Merge pull request #21855 from calixteman/jsdoc_linter

Add JSDoc linting
This commit is contained in:
Tim van der Meij
2026-09-01 20:35:13 +02:00
committed by GitHub
105 changed files with 661 additions and 546 deletions
+56
View File
@@ -2,6 +2,7 @@ import globals from "globals";
import import_ from "eslint-plugin-import-x";
import jasmine from "eslint-plugin-jasmine";
import jsdoc from "eslint-plugin-jsdoc";
import json from "@eslint/json";
import noUnsanitized from "eslint-plugin-no-unsanitized";
import perfectionist from "eslint-plugin-perfectionist";
@@ -410,6 +411,61 @@ export default [
},
},
/* ======================================================================== *\
JSDoc
\* ======================================================================== */
{
files: jsFiles("."),
plugins: { jsdoc },
settings: {
jsdoc: {
tagNamePreference: { return: "returns" },
},
},
rules: {
"jsdoc/check-access": "error",
"jsdoc/check-alignment": "error",
"jsdoc/check-param-names": "error",
"jsdoc/check-property-names": "error",
// `@licstart`/`@licend` are GNU LibreJS tags, used in the license header.
"jsdoc/check-tag-names": [
"error",
{ definedTags: ["licend", "licstart"] },
],
"jsdoc/check-template-names": "error",
"jsdoc/check-types": "error",
"jsdoc/check-values": "error",
"jsdoc/empty-tags": "error",
"jsdoc/escape-inline-tags": "error",
"jsdoc/implements-on-classes": "error",
"jsdoc/multiline-blocks": "error",
"jsdoc/no-bad-blocks": "error",
"jsdoc/no-blank-block-descriptions": "error",
"jsdoc/no-blank-blocks": "error",
"jsdoc/no-multi-asterisks": "error",
"jsdoc/normalize-see-links": "error",
"jsdoc/require-asterisk-prefix": "error",
"jsdoc/require-param-name": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-property": "error",
"jsdoc/require-property-name": "error",
"jsdoc/require-property-type": "error",
"jsdoc/require-returns-check": "error",
"jsdoc/require-returns-type": "error",
"jsdoc/require-throws-description": "error",
"jsdoc/require-throws-type": "error",
"jsdoc/require-yields-check": "error",
"jsdoc/require-yields-description": "error",
"jsdoc/require-yields-type": "error",
"jsdoc/tag-lines": "error",
"jsdoc/valid-types": "error",
},
},
/* ======================================================================== *\
Test-specific rules
\* ======================================================================== */
-1
View File
@@ -112,7 +112,6 @@ function isUsed(id, sources) {
* gap. The prefix must appear immediately followed by `${` in a template
* literal; the suffix (if non-empty) must also appear in the same file.
* Minimum length guards prevent matches on trivially short fragments.
*
* @param {string} id - Message ID to test.
* @param {{ path: string, content: string }[]} sources
* @returns {{ path: string, line: number } | null} Location of the first
+232 -42
View File
@@ -28,6 +28,7 @@
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-jasmine": "^4.2.2",
"eslint-plugin-jsdoc": "^64.3.2",
"eslint-plugin-no-unsanitized": "^4.1.5",
"eslint-plugin-perfectionist": "^5.10.1",
"eslint-plugin-prettier": "^5.5.6",
@@ -3198,6 +3199,33 @@
"tslib": "^2.4.0"
}
},
"node_modules/@es-joy/jsdoccomment": {
"version": "0.95.1",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.95.1.tgz",
"integrity": "sha512-LO/RI08Fo9bhXwB7Od9G+1j3eSNq63+ZS5CQO8YLXHbDg6kx6S/DhTeY0+Fc9uZrjK1zZSyTx8Sg5gv5DIoCnA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "^1.0.9",
"@typescript-eslint/types": "^8.67.0",
"comment-parser": "1.4.8",
"esquery": "^1.7.0",
"jsdoc-type-pratt-parser": "~9.1.2"
},
"engines": {
"node": "^22.22.2 || >=24.15.0"
}
},
"node_modules/@es-joy/resolve.exports": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@es-joy/resolve.exports/-/resolve.exports-1.2.0.tgz",
"integrity": "sha512-Q9hjxWI5xBM+qW2enxfe8wDKdFWMfd0Z29k5ZJnuBqD/CasY5Zryj09aCA6owbGATWz+39p5uIdaHXpopOcG8g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz",
@@ -4068,6 +4096,19 @@
"dev": true,
"license": "MIT"
},
"node_modules/@sindresorhus/base62": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/base62/-/base62-1.0.0.tgz",
"integrity": "sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@sindresorhus/merge-streams": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz",
@@ -4181,14 +4222,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.67.0.tgz",
"integrity": "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.68.0.tgz",
"integrity": "sha512-5GQtWZCXFcFYux955pvoS02WLc49pXNlvIxocKjS0clvwo3in1RdlzVKyiqQH9vE5AKWFLTaUgeQkOrTS+0Qxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.67.0",
"@typescript-eslint/types": "^8.67.0",
"@typescript-eslint/tsconfig-utils": "^8.68.0",
"@typescript-eslint/types": "^8.68.0",
"debug": "^4.4.3"
},
"engines": {
@@ -4203,14 +4244,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.67.0.tgz",
"integrity": "sha512-EgvsleTwS4E+WzzSvem8fAUubLwatMNF1B5hHSLQxcvs7q2dtRhGyujHwLJSYlG41niJ7GP24Aha2+0mb1b2kg==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.68.0.tgz",
"integrity": "sha512-T5eXpcaJNg8bhjHJ8Rjp68Vq/QBteYtTKY8TZqVNPaUbuz0f6jI9t6aDkylwvalpAB9XTTFeFOjrjXAZ3YvmVA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.67.0",
"@typescript-eslint/visitor-keys": "8.67.0"
"@typescript-eslint/types": "8.68.0",
"@typescript-eslint/visitor-keys": "8.68.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -4221,9 +4262,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.67.0.tgz",
"integrity": "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.68.0.tgz",
"integrity": "sha512-F7zrGQfiJHojPwi8vhxZQC1tWtJzvL74cK/nqri2lk8YUXvYaYwl263xOJ69jDWPUk1hmcdoayFwk9lX09npVw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -4238,9 +4279,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.67.0.tgz",
"integrity": "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.68.0.tgz",
"integrity": "sha512-9RnpsGJjrAllCMefGVVsImJM24YurhC0Q1h4UbvivtvOqXmR/vEJge2OoE++z9m6hyg8T1Q8t5SNT6tHSbrxcg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -4252,16 +4293,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.67.0.tgz",
"integrity": "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.68.0.tgz",
"integrity": "sha512-OKKsD0tYmoNiU5PW2zehO1yO56jYOm1ShYlxon/Z0SJNidAkdVg86eg9ruRuoXf8xfnuWZGbwDsStkoXbZtIIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.67.0",
"@typescript-eslint/tsconfig-utils": "8.67.0",
"@typescript-eslint/types": "8.67.0",
"@typescript-eslint/visitor-keys": "8.67.0",
"@typescript-eslint/project-service": "8.68.0",
"@typescript-eslint/tsconfig-utils": "8.68.0",
"@typescript-eslint/types": "8.68.0",
"@typescript-eslint/visitor-keys": "8.68.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"semver": "^7.7.3",
@@ -4293,16 +4334,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.67.0.tgz",
"integrity": "sha512-U9D1FdwEWBwok3hxxSdhclMb0twvt9QnjIQ0VfQ1AiX2epnpSgv2ubVDsayOFyY8K6FX+AQ7E0FKWVG3iKsj1A==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.68.0.tgz",
"integrity": "sha512-PB5gJMMOg0Q5P1tsgWtEAqQacJXq0qEqRHDX/YJ4FaTMLfZPpHB3gjl2EJuiZyPABxmj4ZQYiY9m1bdAJ5y7tQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.67.0",
"@typescript-eslint/types": "8.67.0",
"@typescript-eslint/typescript-estree": "8.67.0"
"@typescript-eslint/scope-manager": "8.68.0",
"@typescript-eslint/types": "8.68.0",
"@typescript-eslint/typescript-estree": "8.68.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -4317,13 +4358,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.67.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.67.0.tgz",
"integrity": "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==",
"version": "8.68.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.68.0.tgz",
"integrity": "sha512-YR65gGdGvTUAWLldC3xLOvOzamdGzB4A5/N8rehEaHs3Zvoe39BhgY+u0SPch1OvrVTfLcc55wsSgK2NcnTS/A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.67.0",
"@typescript-eslint/types": "8.68.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
@@ -4959,6 +5000,16 @@
"node": ">= 8"
}
},
"node_modules/are-docs-informative": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.1.1.tgz",
"integrity": "sha512-sqRsNQBwbKLRX0jV5Cu5uzmtflf892n4Vukz7T659ebL4pz3mpOqCMU7lxMoBTFwnp10E3YB5ZcyHM41W5bcDA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -5858,9 +5909,9 @@
}
},
"node_modules/comment-parser": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.5.tgz",
"integrity": "sha512-aRDkn3uyIlCFfk5NUA+VdwMmMsh8JGhc4hapfV4yxymHGQ3BVskMQfoXGpCo5IoBuQ9tS5iiVKhCpTcB4pW4qw==",
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.8.tgz",
"integrity": "sha512-rKZTGo4fzKYna8UcL0isTg5wkBNla7bxTypLwZQXjIdi++IdP1OJ41rI5Mti3/jltkPujbu4i9LIARYA+zpotQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -6589,6 +6640,62 @@
"npm": ">=6"
}
},
"node_modules/eslint-plugin-jsdoc": {
"version": "64.3.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-64.3.2.tgz",
"integrity": "sha512-9/j8KKTdLt5Gy7FbayPASLKabm9wcntcwkOJ+kidikNudqglqxjbsZBddkPwK9/6AeOyCwlwwAtuzHQzwTQP7A==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"@es-joy/jsdoccomment": "~0.95.1",
"@es-joy/resolve.exports": "1.2.0",
"@typescript-eslint/utils": "^8.68.0",
"are-docs-informative": "^0.1.1",
"comment-parser": "1.4.8",
"debug": "^4.4.3",
"escape-string-regexp": "^5.0.0",
"espree": "^11.2.0",
"esquery": "^1.7.0",
"html-entities": "^2.6.0",
"object-deep-merge": "^2.0.1",
"parse-imports-exports": "^0.2.4",
"semver": "^7.8.5",
"spdx-expression-parse": "^5.0.0",
"to-valid-identifier": "^1.0.0"
},
"engines": {
"node": "^22.22.2 || >=24.15.0"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0"
}
},
"node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint-plugin-jsdoc/node_modules/semver": {
"version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/eslint-plugin-no-unsanitized": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.1.5.tgz",
@@ -7841,6 +7948,23 @@
"dev": true,
"license": "MIT"
},
"node_modules/html-entities": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz",
"integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/mdevils"
},
{
"type": "patreon",
"url": "https://patreon.com/mdevils"
}
],
"license": "MIT"
},
"node_modules/html-escaper": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
@@ -8740,9 +8864,9 @@
}
},
"node_modules/jsdoc-type-pratt-parser": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-9.1.1.tgz",
"integrity": "sha512-kojSbQb9iQM2bk2PmHiKa3reG0U4v2gN9U8D8+eCQq+4KM5ZXBUyBVeF8KmR0RiwqyrW4+uVWYWTOLnpsavnkw==",
"version": "9.1.2",
"resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-9.1.2.tgz",
"integrity": "sha512-9EXymowgk1mb9RY1VxuwKc+AhaxfBk2CV0dWxgGM+l5RURTtiUoAx7MlKwcsiVcEXK5HEPa7FeH/tsRpqjEPRg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -9684,6 +9808,13 @@
"node": ">=0.10.0"
}
},
"node_modules/object-deep-merge": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/object-deep-merge/-/object-deep-merge-2.0.1.tgz",
"integrity": "sha512-aKttDKcU3pyZqKcCkDhsMn70WmZFG2JGDQLP9EcLyTSIFQRCPWLAmBZRLJnrVUrhPG1jETEEbfdgbNtJf1LyMg==",
"dev": true,
"license": "MIT"
},
"node_modules/object.defaults": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz",
@@ -9874,6 +10005,16 @@
"node": ">=0.8"
}
},
"node_modules/parse-imports-exports": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/parse-imports-exports/-/parse-imports-exports-0.2.4.tgz",
"integrity": "sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"parse-statements": "1.0.11"
}
},
"node_modules/parse-json": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
@@ -9913,6 +10054,13 @@
"node": ">=0.10.0"
}
},
"node_modules/parse-statements": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/parse-statements/-/parse-statements-1.0.11.tgz",
"integrity": "sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA==",
"dev": true,
"license": "MIT"
},
"node_modules/parse5": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
@@ -11086,6 +11234,31 @@
"node": ">= 10.13.0"
}
},
"node_modules/spdx-exceptions": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz",
"integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==",
"dev": true,
"license": "CC-BY-3.0"
},
"node_modules/spdx-expression-parse": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-5.0.0.tgz",
"integrity": "sha512-vngmw3Rgn+o2arXNbnZaj5UtOEBuWBfvaI+Wc8GFfykIhA5/vdK9/Sp/XkLv63dykz2rxKDvKEHupF5P0FORcQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"node_modules/spdx-license-ids": {
"version": "3.0.23",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.23.tgz",
"integrity": "sha512-CWLcCCH7VLu13TgOH+r8p1O/Znwhqv/dbb6lqWy67G+pT1kHmeD/+V36AVb/vq8QMIQwVShJ6Ssl5FPh0fuSdw==",
"dev": true,
"license": "CC0-1.0"
},
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -12234,9 +12407,9 @@
}
},
"node_modules/tinyglobby/node_modules/picomatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -12272,6 +12445,23 @@
"node": ">=10.13.0"
}
},
"node_modules/to-valid-identifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-valid-identifier/-/to-valid-identifier-1.0.0.tgz",
"integrity": "sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@sindresorhus/base62": "^1.0.0",
"reserved-identifiers": "^1.0.0"
},
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
+1
View File
@@ -23,6 +23,7 @@
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-jasmine": "^4.2.2",
"eslint-plugin-jsdoc": "^64.3.2",
"eslint-plugin-no-unsanitized": "^4.1.5",
"eslint-plugin-perfectionist": "^5.10.1",
"eslint-plugin-prettier": "^5.5.6",
+8 -36
View File
@@ -125,15 +125,14 @@ class AnnotationFactory {
* Create an `Annotation` object of the correct type for the given reference
* to an annotation dictionary. This yields a promise that is resolved when
* the `Annotation` object is constructed.
*
* @param {XRef} xref
* @param {Object} ref
* @params {Object} annotationGlobals
* @param {Object} idFactory
* @param {object} ref
* @param {object} annotationGlobals
* @param {object} idFactory
* @param {boolean} [collectFields]
* @param {Object} [orphanFields]
* @param {object} [orphanFields]
* @param {Array<string>} [collectByType]
* @param {Object} [pageRef]
* @param {object} [pageRef]
* @returns {Promise} A promise that is resolved with an {Annotation}
* instance.
*/
@@ -888,7 +887,6 @@ class Annotation {
* Check if the annotation must be displayed by taking into account
* the value found in the annotationStorage which may have been set
* through JS.
*
* @public
* @memberof Annotation
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
@@ -907,7 +905,6 @@ class Annotation {
* Check if the annotation must be printed by taking into account
* the value found in the annotationStorage which may have been set
* through JS.
*
* @public
* @memberof Annotation
* @param {AnnotationStorage} [annotationStorage] - Storage for annotation
@@ -975,7 +972,6 @@ class Annotation {
/**
* Set the title.
*
* @param {string} title - The title of the annotation, used e.g. with
* PopupAnnotations.
*/
@@ -985,7 +981,6 @@ class Annotation {
/**
* Set the contents.
*
* @param {string} contents - Text to display for the annotation or, if the
* type of annotation does not display text, a
* description of the annotation's contents
@@ -996,7 +991,6 @@ class Annotation {
/**
* Set the modification date.
*
* @public
* @memberof Annotation
* @param {string} modificationDate - PDF date string that indicates when the
@@ -1009,7 +1003,6 @@ class Annotation {
/**
* Set the flags.
*
* @public
* @memberof Annotation
* @param {number} flags - Unsigned 32-bit integer specifying annotation
@@ -1033,7 +1026,6 @@ class Annotation {
/**
* Check if a provided flag is set.
*
* @public
* @memberof Annotation
* @param {number} flag - Hexadecimal representation for an annotation
@@ -1047,7 +1039,6 @@ class Annotation {
/**
* Set the rectangle.
*
* @public
* @memberof Annotation
* @param {Array} rectangle - The rectangle array with exactly four entries
@@ -1059,7 +1050,6 @@ class Annotation {
/**
* Set the color and take care of color space conversion.
* The default value is black, in RGB color space.
*
* @public
* @memberof Annotation
* @param {Array} color - The color array containing either 0
@@ -1123,7 +1113,6 @@ class Annotation {
/**
* Set the color for background and border if any.
* The default values are transparent.
*
* @public
* @memberof Annotation
* @param {Dict} mk - The MK dictionary
@@ -1139,7 +1128,6 @@ class Annotation {
/**
* Set the border style (as AnnotationBorderStyle object).
*
* @public
* @memberof Annotation
* @param {Dict} borderStyle - The border style dictionary
@@ -1193,7 +1181,6 @@ class Annotation {
/**
* Set the (normal) appearance.
*
* @public
* @memberof Annotation
* @param {Dict} dict - The annotation's data dictionary
@@ -1427,10 +1414,9 @@ class Annotation {
*
* Field object is defined here:
* https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf#page=16
*
* @public
* @memberof Annotation
* @returns {Object | null}
* @returns {object | null}
*/
getFieldObject() {
if (this.data.kidIds) {
@@ -1454,7 +1440,6 @@ class Annotation {
*
* This involves resetting the various streams that are either cached on the
* annotation instance or created during its construction.
*
* @public
* @memberof Annotation
*/
@@ -1475,7 +1460,6 @@ class Annotation {
/**
* Construct the (fully qualified) field name from the (partial) field
* names of the field and its ancestors.
*
* @private
* @memberof Annotation
* @param {Dict} dict - Complete widget annotation dictionary
@@ -1577,7 +1561,6 @@ class AnnotationBorderStyle {
/**
* Set the width.
*
* @public
* @memberof AnnotationBorderStyle
* @param {number} width - The width.
@@ -1621,7 +1604,6 @@ class AnnotationBorderStyle {
/**
* Set the style.
*
* @public
* @memberof AnnotationBorderStyle
* @param {Name} style - The annotation style.
@@ -1659,7 +1641,6 @@ class AnnotationBorderStyle {
/**
* Set the dash array.
*
* @public
* @memberof AnnotationBorderStyle
* @param {Array} dashArray - The dash array with at least one element
@@ -1701,7 +1682,6 @@ class AnnotationBorderStyle {
/**
* Set the horizontal corner radius (from a Border dictionary).
*
* @public
* @memberof AnnotationBorderStyle
* @param {number} radius - The horizontal corner radius.
@@ -1714,7 +1694,6 @@ class AnnotationBorderStyle {
/**
* Set the vertical corner radius (from a Border dictionary).
*
* @public
* @memberof AnnotationBorderStyle
* @param {number} radius - The vertical corner radius.
@@ -1799,7 +1778,6 @@ class MarkupAnnotation extends Annotation {
/**
* Set the creation date.
*
* @public
* @memberof MarkupAnnotation
* @param {string} creationDate - PDF date string that indicates when the
@@ -2055,7 +2033,6 @@ class WidgetAnnotation extends Annotation {
/**
* Decode the given form value.
*
* @private
* @memberof WidgetAnnotation
* @param {Array<string>|Name|string} formValue - The (possibly encoded)
@@ -2078,7 +2055,6 @@ class WidgetAnnotation extends Annotation {
/**
* Check if a provided field flag is set.
*
* @public
* @memberof WidgetAnnotation
* @param {number} flag - Hexadecimal representation for an annotation
@@ -5463,8 +5439,7 @@ class MediaAnnotation extends Annotation {
/**
* Expose a resolved embedded media asset as `data.richMedia`.
*
* @param {Object} asset
* @param {object} asset
* @param {Ref | null} asset.assetRef
* Reference to the file-spec dictionary (or, for an inline file-spec, the
* embedded-file stream); used to lazily fetch the bytes on the main thread.
@@ -5476,7 +5451,7 @@ class MediaAnnotation extends Annotation {
* @param {boolean} [asset.wrapSound]
* When set, the embedded bytes are raw PDF sound samples that the catalog
* wraps in a WAV container when fetched (see `soundStreamToWav`).
* @param {Object} annotationGlobals
* @param {object} annotationGlobals
*/
_setMediaData(
{ assetRef, assetDict, filename, contentType, wrapSound = false },
@@ -5507,7 +5482,6 @@ class MediaAnnotation extends Annotation {
* extension. Returns `null` when the asset isn't a recognized audio/video
* type (e.g. Flash `.swf` or 3D models), so we don't build a player that
* can't play anything.
*
* @param {Dict} assetDict
* @param {string} filename
* @param {string | null} [contentType]
@@ -5588,7 +5562,6 @@ class RichMediaAnnotation extends MediaAnnotation {
* merely enumerates every embedded file; we don't use it as a fallback, since
* Acrobat itself won't play media that's only reachable that way. Flash
* instances are skipped, since they can't be played natively.
*
* @returns {{
* assetRef: Ref | null,
* assetDict: Dict,
@@ -5670,7 +5643,6 @@ class ScreenAnnotation extends MediaAnnotation {
* Selector renditions (`/SR`) are unwrapped to their first playable media
* rendition. This mirrors `RichMediaAnnotation`, which also targets the
* common single embedded-media case.
*
* @returns {{
* assetRef: Ref | null,
* assetDict: Dict,
+3
View File
@@ -26,6 +26,7 @@ class BaseStream {
}
/**
* @abstract
* @returns {number}
*/
// eslint-disable-next-line getter-return
@@ -34,6 +35,7 @@ class BaseStream {
}
/**
* @abstract
* @returns {boolean}
*/
// eslint-disable-next-line getter-return
@@ -50,6 +52,7 @@ class BaseStream {
}
/**
* @abstract
* @param {number | undefined} [length]
* @returns {Uint8Array}
*/
+2 -5
View File
@@ -171,7 +171,6 @@ class Catalog {
* The id is registered here rather than parsed from a public string prefix in
* `attachmentContent`, since catalog attachment names can be arbitrary PDF
* strings and may otherwise collide with annotation-local ids.
*
* @param {Ref} ref
* File-spec or embedded-file stream reference.
* @param {boolean} [isSound]
@@ -1123,7 +1122,6 @@ class Catalog {
/**
* Get attachments.
*
* @returns {Map<string, CatalogAttachment> | null}
* Attachments.
*/
@@ -1165,7 +1163,6 @@ class Catalog {
/**
* Get content for an attachment.
*
* @param {string} id
* Unique attachment identifier (required).
* @returns {CatalogAttachmentContent}
@@ -1680,9 +1677,9 @@ class Catalog {
}
/**
* @typedef {Object} ParseDestDictionaryParameters
* @typedef {object} ParseDestDictionaryParameters
* @property {Dict} destDict - The dictionary containing the destination.
* @property {Object} resultObj - The object where the parsed destination
* @property {object} resultObj - The object where the parsed destination
* properties will be placed.
* @property {string} [docBaseUrl] - The document base URL that is used when
* attempting to recover valid absolute URLs from relative ones.
+9 -11
View File
@@ -141,15 +141,15 @@ async function fetchBinaryData(url) {
* If the key is not found in the tree, `undefined` is returned. Otherwise,
* the value for the key is returned or, if `stopWhenFound` is `false`, a list
* of values is returned.
*
* @param {Dict} dict - Dictionary from where to start the traversal.
* @param {string} key - The key of the property to find the value for.
* @param {boolean} getArray - Whether or not the value should be fetched as an
* array. The default value is `false`.
* @param {boolean} stopWhenFound - Whether or not to stop the traversal when
* the key is found. If set to `false`, we always walk up the entire parent
* chain, for example to be able to find `\Resources` placed on multiple
* levels of the tree. The default value is `true`.
* @param {object} params
* @param {Dict} params.dict - Dictionary from where to start the traversal.
* @param {string} params.key - The key of the property to find the value for.
* @param {boolean} params.getArray - Whether or not the value should be fetched
* as an array. The default value is `false`.
* @param {boolean} params.stopWhenFound - Whether or not to stop the traversal
* when the key is found. If set to `false`, we always walk up the entire
* parent chain, for example to be able to find `\Resources` placed on
* multiple levels of the tree. The default value is `true`.
*/
function getInheritableProperty({
dict,
@@ -178,7 +178,6 @@ function getInheritableProperty({
/**
* Get the parent dictionary to update when a property is set.
*
* @param {Dict} dict - Dictionary from where to start the traversal.
* @param {Ref} ref - The reference to the dictionary.
* @param {XRef} xref - The `XRef` instance.
@@ -336,7 +335,6 @@ function lookupNormalRect(arr, fallback) {
* AcroForm field names use an array like notation to refer to
* repeated XFA elements e.g. foo.bar[nnn].
* see: XFA Spec Chapter 3 - Repeated Elements
*
* @param {string} path - XFA path name.
* @returns {Array} - Array of Objects with the name and pos of
* each part of the path.
-1
View File
@@ -1256,7 +1256,6 @@ class CipherTransformFactory {
/**
* Set password.
*
* @param {string} password
* New password.
* @returns {undefined}
+6 -6
View File
@@ -770,7 +770,7 @@ class PDFEditor {
}
/**
* @typedef {Object} PageInfo
* @typedef {object} PageInfo
* @property {PDFDocument} [document]
* @property {ImageBitmap} [image]
* image to insert as a synthetic page.
@@ -965,7 +965,7 @@ class PDFEditor {
/**
* Extract pages from the given documents.
* @param {Array<PageInfo>} pageInfos
* @param {Object} annotationStorage - The annotation storage containing the
* @param {object} annotationStorage - The annotation storage containing the
* annotations to be merged into the new document.
* @param {PDFDocument} primaryDocument - The document the annotation storage
* belongs to.
@@ -973,7 +973,7 @@ class PDFEditor {
* the annotations.
* @param {WorkerTask} task - The worker task to use for reporting progress
* and cancellation.
* @return {Promise<void>}
* @returns {Promise<void>}
*/
async extractPages(
pageInfos,
@@ -1157,7 +1157,7 @@ class PDFEditor {
/**
* Collect the document data.
* @param {DocumentData} documentData
* @return {Promise<void>}
* @returns {Promise<void>}
*/
async #collectDocumentData(documentData) {
const {
@@ -1780,7 +1780,7 @@ class PDFEditor {
/**
* Check whether an outline item has a valid destination in the output doc.
* @param {Object} item
* @param {object} item
* @param {DocumentData} documentData
* @returns {boolean}
*/
@@ -1857,7 +1857,7 @@ class PDFEditor {
/**
* Write the destination or action of an outline item into the given dict.
* @param {Dict} itemDict
* @param {Object} item
* @param {object} item
* @returns {Promise<void>}
*/
async #setOutlineItemDest(itemDict, item) {
+1 -1
View File
@@ -3943,7 +3943,7 @@ class PartialEvaluator {
/**
* Builds a char code to unicode map based on section 9.10 of the spec.
* @param {Object} properties Font properties object.
* @param {object} properties Font properties object.
* @returns {Promise} A Promise that is resolved with a
* {ToUnicodeMap|IdentityToUnicodeMap} object.
*/
-4
View File
@@ -85,7 +85,6 @@ class FileSpec {
*
* Search order follows the PDF platform keys: `UF`, `F`, `Unix`, `Mac`,
* `DOS`.
*
* @param {Dict | null | undefined} dict
* Dictionary.
* @param {boolean} [raw]
@@ -107,7 +106,6 @@ class FileSpec {
/**
* Whether a file specification carries an embedded file we can read.
*
* @param {Dict} fileSpecDict
* @returns {boolean}
*/
@@ -117,7 +115,6 @@ class FileSpec {
/**
* Read attachment bytes from a file-spec dictionary.
*
* @param {Dict | null | undefined} dict
* File-spec dictionary containing an `EF` entry.
* @returns {CatalogAttachmentContent}
@@ -141,7 +138,6 @@ class FileSpec {
/**
* Read the bytes of an embedded-file stream.
*
* @param {BaseStream} stream
* Embedded-file stream.
* @returns {CatalogAttachmentContent}
+26 -17
View File
@@ -623,13 +623,22 @@ function getFamilyName(str) {
/**
* Generate font description.
* @param {Object} param0, font substitution description.
* @param {Array<String>} src, contains src values (local(...) or url(...)).
* @param {String} localFontPath, path to local fonts.
* @param {boolean} useFallback, whether to use fallback font.
* @param {boolean} usePath, whether to use path to font.
* @param {String} append, style (Bold, Italic, ...) to append to font name.
* @return {Object} { style, ultimate }.
* @param {object} substitution - Font substitution description.
* @param {string} [substitution.alias] - Key of another substitution to
* inherit the src values from.
* @param {Array<string>} [substitution.local] - Local font names.
* @param {string} [substitution.path] - Font file name, relative to
* `localFontPath`.
* @param {string} [substitution.fallback] - Key of the substitution to take
* the ultimate font from.
* @param {object} [substitution.style] - CSS `font-style` and `font-weight`.
* @param {string} [substitution.ultimate] - Ultimate (generic) font family.
* @param {Array<string>} src - Contains src values (local(...) or url(...)).
* @param {string} localFontPath - Path to local fonts.
* @param {boolean} useFallback - Whether to use fallback font.
* @param {boolean} usePath - Whether to use path to font.
* @param {string} append - Style (Bold, Italic, ...) to append to font name.
* @returns {object} The resolved `style` and `ultimate` values.
*/
function generateFont(
{ alias, local, path, fallback, style, ultimate },
@@ -691,9 +700,9 @@ function generateFont(
/**
* Get a font substitution for a given font.
* The general idea is to have enough information to create a CSS rule like
* this:
* @font-face {
* The general idea is to have enough information to create a CSS `@font-face`
* rule like this:
* {
* font-family: 'Times';
* src: local('Times New Roman'), local('Subst1'), local('Subst2'),
* url(.../TimesNewRoman.ttf)
@@ -701,15 +710,15 @@ function generateFont(
* font-style: normal;
* }
* or use the FontFace API.
*
* @param {Map} systemFontCache The cache of local fonts.
* @param {Object} idFactory The ids factory.
* @param {String} localFontPath Path to the fonts directory.
* @param {String} baseFontName The font name to be substituted.
* @param {String|undefined} standardFontName The standard font name to use
* @param {object} idFactory The ids factory.
* @param {string} localFontPath Path to the fonts directory.
* @param {string} baseFontName The font name to be substituted.
* @param {string | undefined} standardFontName The standard font name to use
* if the base font is not available.
* @param {String} type The font type.
* @returns an Object with the CSS, the loaded name, the src and the style.
* @param {string} type The font type.
* @returns {object | null} An object with the CSS, the loaded name, the src
* and the style, or `null` when no substitution can be made.
*/
function getFontSubstitution(
systemFontCache,
+5 -5
View File
@@ -272,7 +272,7 @@ class Glyph {
/**
* This property, which is only used by `PartialEvaluator.getTextContent`,
* is purposely made non-serializable.
* @type {Object}
* @type {object}
*/
get category() {
return shadow(
@@ -456,7 +456,7 @@ function convertCidString(charCode, cid, shouldThrow = false) {
* private use area. This is done to avoid issues with various problematic
* unicode areas where either a glyph won't be drawn or is deformed by a
* shaper.
* @returns {Object} Two properties:
* @returns {object} Two properties:
* 'toFontChar' - maps original char codes(the value that will be read
* from commands such as show text) to the char codes that will be used in the
* font that we build
@@ -3689,7 +3689,7 @@ class Font {
/**
* Chars can have different sizes (depends on the encoding).
* @param {String} a string encoded with font encoding.
* @param {string} chars - A string encoded with font encoding.
* @returns {Array<Array<number>>} the positions of each char in the string.
*/
getCharPositions(chars) {
@@ -3723,8 +3723,8 @@ class Font {
* Encode a js string using font encoding.
* The resulting array contains an encoded string at even positions
* (can be empty) and a non-encoded one at odd positions.
* @param {String} a js string.
* @returns {Array<String>} an array of encoded strings or non-encoded ones.
* @param {string} str - A js string.
* @returns {Array<string>} an array of encoded strings or non-encoded ones.
*/
encodeString(str) {
const buffers = [];
+3 -3
View File
@@ -101,12 +101,12 @@ function recoverGlyphName(name, glyphsUnicodeMap) {
/**
* Shared logic for building a char code to glyph id mapping for Type1 and
* simple CFF fonts. See section 9.6.6.2 of the spec.
* @param {Object} properties Font properties object.
* @param {Object} builtInEncoding The encoding contained within the actual font
* @param {object} properties Font properties object.
* @param {object} builtInEncoding The encoding contained within the actual font
* data.
* @param {Array} glyphNames Array of glyph names where the index is the
* glyph ID.
* @returns {Object} A char code to glyph ID map.
* @returns {object} A char code to glyph ID map.
*/
function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
const charCodeToGlyphId = Object.create(null);
+1 -5
View File
@@ -36,7 +36,6 @@ import { Name } from "./primitives.js";
/**
* Configuration for {@linkcode PDFImage.fillGrayBuffer}.
*
* @typedef FillGrayBufferOptions
* @property {number} [destWidth]
* Destination width; defaults to the source image width (no resampling).
@@ -54,7 +53,6 @@ import { Name } from "./primitives.js";
/**
* Configuration for {@linkcode FillMaskAlphaCallback} functions.
*
* @typedef FillMaskAlphaOptions
* @property {number} maxRows
* Maximum number of image rows to write; defaults to the full image height.
@@ -66,13 +64,12 @@ import { Name } from "./primitives.js";
/**
* Fills the alpha values for the mask.
*
* @callback FillMaskAlphaCallback
* @param {Uint8ClampedArray} buffer
* Buffer to write the alpha values to.
* @param {FillMaskAlphaOptions} options
* Configuration for filling the alpha values.
* @return {Promise<undefined> | undefined | void}
* @returns {Promise<undefined> | undefined | void}
* Optional promise that resolves when the alpha values have been filled.
*/
@@ -980,7 +977,6 @@ class PDFImage {
* omitted), pixels are sampled linearly with no extra allocation.
* When they differ, nearest-neighbour resampling is used, sampling decoded
* pixels directly from the `comps` array with no intermediate buffer.
*
* @param {Uint8ClampedArray} buffer
* Buffer to fill with grayscale values.
* @param {FillGrayBufferOptions} [options]
-2
View File
@@ -629,7 +629,6 @@ class Parser {
/**
* Resolve indirect objects when `xref` is available.
*
* @param {unknown} obj
* @returns {unknown}
*/
@@ -639,7 +638,6 @@ class Parser {
/**
* Check if a stream filter chain contains `/Crypt`.
*
* @param {unknown} [filter]
* Object, probably a name or an array of names.
* @returns {boolean}
-1
View File
@@ -155,7 +155,6 @@ class BasePdfManager {
/**
* Set password.
*
* @param {string} password
* New password.
* @returns {undefined}
-2
View File
@@ -250,7 +250,6 @@ class Parser {
* | operator (any PS_OPERATOR except if / ifelse)
* | '{' block '}' 'if'
* | '{' block '}' '{' block '}' 'ifelse'
*
* @returns {PsProgram}
*/
parse() {
@@ -327,7 +326,6 @@ class Parser {
/**
* Convenience function: tokenize and parse a PostScript Type 4 function body
* given as a plain string (already decoded from the PDF stream).
*
* @param {string} source
* @returns {PsProgram}
*/
-1
View File
@@ -789,7 +789,6 @@ class PSStackBasedInterpreter {
/**
* Tries PSStackToTree-optimized IR first; falls back to direct interpreter.
*
* @param {string} source
* @param {number[]} domain – flat [min0,max0, …]
* @param {number[]} range – flat [min0,max0, …]
-3
View File
@@ -870,7 +870,6 @@ class PsWasmCompiler {
* Convert the parser AST to a tree, compile each output expression, clamp
* results to the declared range, store to linear memory, and assemble the
* Wasm binary.
*
* @param {import("./ast.js").PsProgram} program
* @returns {Uint8Array|null} Wasm binary, or null if compilation failed.
*/
@@ -963,7 +962,6 @@ class PsWasmCompiler {
* Parse and compile a PostScript Type 4 function source string into a Wasm
* binary. PSStackToTree handles constant folding and algebraic simplifications
* during the parse-to-tree conversion, so no separate optimizer pass is needed.
*
* @param {string} source – raw PostScript source (decoded PDF stream)
* @param {number[]} domain – flat [min0,max0, min1,max1, ...] array
* @param {number[]} range – flat [min0,max0, min1,max1, ...] array
@@ -1073,7 +1071,6 @@ function _makeWrapper(exports, nIn, nOut) {
*
* Note: synchronous Wasm compilation is only allowed for small modules
* (< 4 KB in most browsers). Type 4 functions always qualify.
*
* @param {string} source – raw PostScript source (decoded PDF stream)
* @param {number[]} domain – flat [min0,max0, min1,max1, ...] array
* @param {number[]} range – flat [min0,max0, min1,max1, ...] array
-3
View File
@@ -26,14 +26,12 @@ const WAV_HEADER_SIZE = 44;
* Sound streams contain samples described by /R, /C, /B, /E, and optional /CO.
* We wrap supported uncompressed PCM (Raw/Signed, 8/16-bit, mono/stereo) in WAV
* for playback.
*
* @import { BaseStream } from "./base_stream.js";
* @import { Dict } from "./primitives.js";
*/
/**
* Return a supported uncompressed sample format.
*
* @param {Dict} [dict] The sound object's stream dictionary.
* @returns {{
* channels: number,
@@ -79,7 +77,6 @@ function getSoundFormat(dict) {
* samples, and signed 16-bit samples. The data chunk is trimmed to a whole
* number of frames (a multiple of the block alignment); a stream with no
* complete frame produces no WAV.
*
* @param {BaseStream} stream The sound object stream.
* @param {Uint8Array} samples Raw sample bytes from the stream.
* @returns {Uint8Array | null}
+1 -1
View File
@@ -1024,7 +1024,7 @@ class StructTreePage {
/**
* Convert the tree structure into a simplified object literal that can
* be sent to the main thread.
* @returns {Object}
* @returns {object}
*/
get serializable() {
function nodeToSerializable(node, parent, level = 0) {
+4 -4
View File
@@ -217,10 +217,10 @@ class XFAObject {
}
/**
Return true if this node (typically a container)
can provide more width during layout.
The goal is to help to know what a descendant must
do in case of horizontal overflow.
* Return true if this node (typically a container)
* can provide more width during layout.
* The goal is to help to know what a descendant must
* do in case of horizontal overflow.
*/
[$isThereMoreWidth]() {
return false;
-1
View File
@@ -342,7 +342,6 @@ class SimpleDOMNode {
* Search a node in the tree with the given path
* foo.bar[nnn], i.e. find the nnn-th node named
* bar under a node named foo.
*
* @param {Array} paths - an array of objects as
* returned by {parseXFAPath}.
* @param {number} pos - the current position in
+19 -29
View File
@@ -63,8 +63,8 @@ const GetElementsByNameSet = new WeakSet();
const TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000;
/**
* @typedef {Object} AnnotationElementParameters
* @property {Object} data
* @typedef {object} AnnotationElementParameters
* @property {object} data
* @property {HTMLDivElement} layer
* @property {PDFLinkService} linkService
* @property {BaseDownloadManager} [downloadManager]
@@ -72,7 +72,7 @@ const TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000;
* @property {string} [imageResourcesPath] - Path for image resources, mainly
* for annotation icons. Include trailing slash.
* @property {boolean} renderForms
* @property {Object} svgFactory
* @property {object} svgFactory
* @property {boolean} [enableScripting]
* @property {boolean} [hasJSActions]
* @property {Map} [fieldObjects]
@@ -391,7 +391,6 @@ class AnnotationElement {
/**
* Create an empty container for the annotation's HTML element.
*
* @private
* @param {boolean} ignoreBorder
* @memberof AnnotationElement
@@ -641,7 +640,6 @@ class AnnotationElement {
/**
* Create quadrilaterals from the annotation's quadpoints.
*
* @private
* @memberof AnnotationElement
*/
@@ -739,9 +737,7 @@ class AnnotationElement {
* Create a popup for the annotation's HTML element. This is used for
* annotations that do not have a Popup entry in the dictionary, but
* are of a type that works with popups (such as Highlight annotations).
*
* @param {Object} [popupData] - The data for the popup, if any.
*
* @param {object} [popupData] - The data for the popup, if any.
* @private
* @memberof AnnotationElement
*/
@@ -787,7 +783,6 @@ class AnnotationElement {
/**
* Render the annotation's HTML element(s).
*
* @public
* @memberof AnnotationElement
*/
@@ -856,7 +851,6 @@ class AnnotationElement {
/**
* Get the HTML element(s) which can trigger a popup when clicked or hovered.
*
* @public
* @memberof AnnotationElement
* @returns {Array<HTMLElement>|HTMLElement} An array of elements or an
@@ -1046,10 +1040,9 @@ class LinkAnnotationElement extends AnnotationElement {
/**
* Bind internal links to the link element.
*
* @private
* @param {Object} link
* @param {Object} destination
* @param {object} link
* @param {object} destination
* @param {string} [overlaidText]
* @memberof LinkAnnotationElement
*/
@@ -1071,10 +1064,9 @@ class LinkAnnotationElement extends AnnotationElement {
/**
* Bind named actions to the link element.
*
* @private
* @param {Object} link
* @param {Object} action
* @param {object} link
* @param {object} action
* @param {string} [overlaidText]
* @memberof LinkAnnotationElement
*/
@@ -1092,7 +1084,7 @@ class LinkAnnotationElement extends AnnotationElement {
/**
* Bind attachments to the link element.
* @param {Object} link
* @param {object} link
* @param {string} attachmentId
* @param {CatalogAttachment} attachment
* @param {string} [overlaidText]
@@ -1134,8 +1126,8 @@ class LinkAnnotationElement extends AnnotationElement {
/**
* Bind SetOCGState actions to the link element.
* @param {Object} link
* @param {Object} action
* @param {object} link
* @param {object} action
* @param {string} [overlaidText]
*/
#bindSetOCGState(link, action, overlaidText = "") {
@@ -1152,10 +1144,12 @@ class LinkAnnotationElement extends AnnotationElement {
/**
* Bind JS actions to the link element.
*
* @private
* @param {Object} link
* @param {Object} data
* @param {object} link
* @param {object} data
* @param {Map<string, Array<string>>} data.actions
* @param {string} data.id
* @param {string} [data.overlaidText]
* @memberof LinkAnnotationElement
*/
_bindJSAction(link, { actions, id, overlaidText }) {
@@ -1402,7 +1396,6 @@ class WidgetAnnotationElement extends AnnotationElement {
/**
* Apply text styles to the text in the element.
*
* @private
* @param {HTMLDivElement} element
* @memberof TextWidgetAnnotationElement
@@ -3939,7 +3932,7 @@ class MediaAnnotationElement extends AnnotationElement {
}
/**
* @typedef {Object} AnnotationLayerParameters
* @typedef {object} AnnotationLayerParameters
* @property {PageViewport} viewport
* @property {HTMLDivElement} div
* @property {Array} annotations
@@ -3953,7 +3946,7 @@ class MediaAnnotationElement extends AnnotationElement {
* @property {boolean} [enableScripting] - Enable embedded script execution.
* @property {boolean} [hasJSActions] - Some fields have JS actions.
* The default value is `false`.
* @property {Map<string, Array<Object>> | null} [fieldObjects]
* @property {Map<string, Array<object>> | null} [fieldObjects]
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
* @property {TextAccessibilityManager} [accessibilityManager]
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
@@ -4025,7 +4018,6 @@ class AnnotationLayer {
/**
* Render a new annotation layer with all annotation elements.
*
* @param {AnnotationLayerParameters} params
* @memberof AnnotationLayer
*/
@@ -4235,8 +4227,7 @@ class AnnotationLayer {
/**
* Add link annotations to the annotation layer.
*
* @param {Array<Object>} annotations
* @param {Array<object>} annotations
*/
async addLinkAnnotations(annotations) {
const elementParams = {
@@ -4264,7 +4255,6 @@ class AnnotationLayer {
/**
* Update the annotation elements on existing annotation layer.
*
* @param {AnnotationLayerParameters} viewport
* @memberof AnnotationLayer
*/
+6 -5
View File
@@ -61,8 +61,8 @@ class AnnotationStorage {
/**
* Get the value for a given key if it exists, or return the default value.
* @param {string} key
* @param {Object} defaultValue
* @returns {Object}
* @param {object} defaultValue
* @returns {object}
*/
getValue(key, defaultValue) {
const value = this.#storage.get(key);
@@ -76,7 +76,7 @@ class AnnotationStorage {
/**
* Get the value for a given key.
* @param {string} key
* @returns {Object}
* @returns {object}
*/
getRawValue(key) {
return this.#storage.get(key);
@@ -109,7 +109,7 @@ class AnnotationStorage {
/**
* Set the value for a given key
* @param {string} key
* @param {Object} value
* @param {object} value
*/
setValue(key, value) {
const obj = this.#storage.get(key);
@@ -345,7 +345,8 @@ class PrintAnnotationStorage extends AnnotationStorage {
}
/**
* @returns {PrintAnnotationStorage}
* @type {PrintAnnotationStorage}
* @throws {Error} Always, since a `PrintAnnotationStorage` cannot be nested.
*/
// eslint-disable-next-line getter-return
get print() {
+40 -63
View File
@@ -101,15 +101,14 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
*/
/**
* @typedef {Object} RefProxy
* @typedef {object} RefProxy
* @property {number} num
* @property {number} gen
*/
/**
* Document initialization / loading parameters object.
*
* @typedef {Object} DocumentInitParameters
* @typedef {object} DocumentInitParameters
* @property {string | URL} [url] - The URL of the PDF.
* @property {TypedArray | ArrayBuffer | Array<number> | string} [data] -
* Binary PDF data.
@@ -119,7 +118,7 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
* NOTE: If TypedArrays are used they will generally be transferred to the
* worker-thread. This will help reduce main-thread memory usage, however
* it will take ownership of the TypedArrays.
* @property {Object} [httpHeaders] - Basic authentication headers.
* @property {object} [httpHeaders] - Basic authentication headers.
* @property {boolean} [withCredentials] - Indicates whether or not
* cross-site Access-Control requests should be made using credentials such
* as cookies or authorization headers. The default is `false`.
@@ -205,18 +204,18 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
* disabling of pre-fetching to work correctly.
* @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
* (see `web/debugger.js`). The default value is `false`.
* @property {Object} [CanvasFactory] - The factory that will be used when
* @property {object} [CanvasFactory] - The factory that will be used when
* creating canvases. The default value is {DOMCanvasFactory}.
* @property {Object} [FilterFactory] - The factory that will be used to
* @property {object} [FilterFactory] - The factory that will be used to
* create SVG filters when rendering some images on the main canvas.
* The default value is {DOMFilterFactory}.
* @property {Object} [BinaryDataFactory] - The factory that will be used when
* @property {object} [BinaryDataFactory] - The factory that will be used when
* falling back to reading built-in CMap files, standard font files,
* and wasm files in the main-thread.
* The default value is {DOMBinaryDataFactory}.
* @property {boolean} [enableHWA] - Enables hardware acceleration for
* rendering. The default value is `false`.
* @property {Object} [pagesMapper] - The pages mapper that will be used to map
* @property {object} [pagesMapper] - The pages mapper that will be used to map
* page ids and page numbers. It's used when the page order is changed or some
* pages are removed, cloned, etc.
*/
@@ -227,7 +226,6 @@ const RENDERING_CANCELLED_TIMEOUT = 100; // ms
* NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or
* XHR as fallback) is used, which means it must follow same origin rules,
* e.g. no cross-domain requests without CORS.
*
* @param {DocumentInitParameters} src - Parameter object.
* @returns {PDFDocumentLoadingTask}
*/
@@ -476,7 +474,7 @@ function getDocument(src = {}) {
}
/**
* @typedef {Object} OnProgressParameters
* @typedef {object} OnProgressParameters
* @property {number} loaded - Currently loaded number of bytes.
* @property {number} total - Total number of bytes in the PDF file.
* @property {number} percent - Currently loaded percentage, as an integer value
@@ -530,7 +528,7 @@ class PDFDocumentLoadingTask {
* Callback to request a password if a wrong or no password was provided.
* The callback receives two parameters: a function that should be called
* with the new password, and a reason (see {@link PasswordResponses}).
* @type {function}
* @type {Function}
*/
onPassword = null;
@@ -538,7 +536,7 @@ class PDFDocumentLoadingTask {
* Callback to be able to monitor the loading progress of the PDF file
* (necessary to implement e.g. a loading bar).
* The callback receives an {@link OnProgressParameters} argument.
* @type {function}
* @type {Function}
*/
onProgress = null;
@@ -718,14 +716,14 @@ class PDFDocumentProxy {
}
/**
* @type {Object} The canvas factory instance.
* @type {object} The canvas factory instance.
*/
get canvasFactory() {
return this._transport.canvasFactory;
}
/**
* @type {Object} The filter factory instance.
* @type {object} The filter factory instance.
*/
get filterFactory() {
return this._transport.filterFactory;
@@ -757,8 +755,7 @@ class PDFDocumentProxy {
/**
* NOTE: This is (mostly) intended to support printing of XFA forms.
*
* @type {Object | null} An object representing a HTML tree structure
* @type {object | null} An object representing a HTML tree structure
* to render the XFA, or `null` when no XFA form exists.
*/
get allXfaHtml() {
@@ -868,7 +865,7 @@ class PDFDocumentProxy {
/**
* @param {Set<number>} types - The annotation types to retrieve.
* @param {Set<number>} pageIndexesToSkip
* @returns {Promise<Array<Object>>} A promise that is resolved with a list of
* @returns {Promise<Array<object>>} A promise that is resolved with a list of
* annotations data.
*/
getAnnotationsByType(types, pageIndexesToSkip) {
@@ -887,7 +884,7 @@ class PDFDocumentProxy {
}
/**
* @typedef {Object} OutlineNode
* @typedef {object} OutlineNode
* @property {string} title
* @property {boolean} bold
* @property {boolean} italic
@@ -910,7 +907,7 @@ class PDFDocumentProxy {
}
/**
* @typedef {Object} GetOptionalContentConfigParameters
* @typedef {object} GetOptionalContentConfigParameters
* @property {string} [intent] - Determines the optional content groups that
* are visible by default; valid values are:
* - 'display' (viewable groups).
@@ -942,7 +939,7 @@ class PDFDocumentProxy {
}
/**
* @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is
* @returns {Promise<{info: object, metadata: Metadata}>} A promise that is
* resolved with an {Object} that has `info` and `metadata` properties.
* `info` is an {Object} filled with anything available in the information
* dictionary and similarly `metadata` is a {Metadata} object with
@@ -953,7 +950,7 @@ class PDFDocumentProxy {
}
/**
* @typedef {Object} MarkInfo
* @typedef {object} MarkInfo
* Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
* @property {boolean} Marked
* @property {boolean} UserProperties
@@ -987,7 +984,7 @@ class PDFDocumentProxy {
}
/**
* @typedef {Object} PageInfo
* @typedef {object} PageInfo
* @property {null|Uint8Array} [document]
* @property {ImageBitmap} [image] Image to insert as a synthetic page.
* @property {Array<Array<number>|number>} [includePages]
@@ -1044,7 +1041,6 @@ class PDFDocumentProxy {
*
* NOTE: Do not, under any circumstances, call this method when rendering is
* currently ongoing since that may lead to rendering errors.
*
* @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.
* NOTE: This will increase persistent memory usage, hence don't use this
* option unless absolutely necessary. The default value is `false`.
@@ -1078,7 +1074,7 @@ class PDFDocumentProxy {
}
/**
* @returns {Promise<Map<string, Array<Object>> | null>} A promise that is
* @returns {Promise<Map<string, Array<object>> | null>} A promise that is
* resolved with a {Map} containing /AcroForm field data for the JS sandbox,
* or `null` when no field data is present in the PDF file.
*/
@@ -1087,7 +1083,7 @@ class PDFDocumentProxy {
}
/**
* @returns {Promise<Array<Object> | null>} A promise that is resolved
* @returns {Promise<Array<object> | null>} A promise that is resolved
* with an {Array} of digital signature metadata (signerName, reason,
* signingTime, byteRange, subFilter, …), or `null` when the document
* has no signatures. The PKCS#7 blob and signed-data byte spans
@@ -1129,8 +1125,7 @@ class PDFDocumentProxy {
/**
* Page getViewport parameters.
*
* @typedef {Object} GetViewportParameters
* @typedef {object} GetViewportParameters
* @property {number} scale - The desired scale of the viewport.
* @property {number} [rotation] - The desired rotation, in degrees, of
* the viewport. If omitted it defaults to the page rotation.
@@ -1144,8 +1139,7 @@ class PDFDocumentProxy {
/**
* Page getTextContent parameters.
*
* @typedef {Object} getTextContentParameters
* @typedef {object} getTextContentParameters
* @property {boolean} [includeMarkedContent] - When true include marked
* content items in the items array of TextContent. The default is `false`.
* @property {boolean} [disableNormalization] - When true the text is *not*
@@ -1154,20 +1148,18 @@ class PDFDocumentProxy {
/**
* Page text content.
*
* @typedef {Object} TextContent
* @typedef {object} TextContent
* @property {Array<TextItem | TextMarkedContent>} items - Array of
* {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
* items are included when includeMarkedContent is true.
* @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
* @property {Record<string, TextStyle>} styles - {@link TextStyle} objects,
* indexed by font name.
* @property {string | null} lang - The document /Lang attribute.
*/
/**
* Page text content part.
*
* @typedef {Object} TextItem
* @typedef {object} TextItem
* @property {string} str - Text content.
* @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.
* @property {Array<any>} transform - Transformation matrix.
@@ -1180,8 +1172,7 @@ class PDFDocumentProxy {
/**
* Page text marked content part.
*
* @typedef {Object} TextMarkedContent
* @typedef {object} TextMarkedContent
* @property {string} type - Either 'beginMarkedContent',
* 'beginMarkedContentProps', or 'endMarkedContent'.
* @property {string} id - The marked content identifier. Only used for type
@@ -1190,8 +1181,7 @@ class PDFDocumentProxy {
/**
* Text style.
*
* @typedef {Object} TextStyle
* @typedef {object} TextStyle
* @property {number} ascent - Font ascent.
* @property {number} descent - Font descent.
* @property {boolean} vertical - Whether or not the text is in vertical mode.
@@ -1200,8 +1190,7 @@ class PDFDocumentProxy {
/**
* Page annotation parameters.
*
* @typedef {Object} GetAnnotationsParameters
* @typedef {object} GetAnnotationsParameters
* @property {string} [intent] - Determines the annotations that are fetched,
* can be 'display' (viewable annotations), 'print' (printable annotations),
* or 'any' (all annotations). The default value is 'display'.
@@ -1209,8 +1198,7 @@ class PDFDocumentProxy {
/**
* Page render parameters.
*
* @typedef {Object} RenderParameters
* @typedef {object} RenderParameters
* @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default
* value is the canvas associated with the `canvasContext` parameter if no
* value is provided explicitly.
@@ -1246,7 +1234,7 @@ class PDFDocumentProxy {
*
* NOTE: This option may be partially, or completely, ignored when the
* `pageColors`-option is used.
* @property {Object} [pageColors] - Overwrites background and foreground colors
* @property {object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
@@ -1274,8 +1262,7 @@ class PDFDocumentProxy {
/**
* Page getOperatorList parameters.
*
* @typedef {Object} GetOperatorListParameters
* @typedef {object} GetOperatorListParameters
* @property {string} [intent] - Rendering intent, can be 'display', 'print',
* or 'any'. The default value is 'display'.
* @property {number} [annotationMode] Controls which annotations are included
@@ -1296,8 +1283,7 @@ class PDFDocumentProxy {
/**
* Structure tree node. The root node will have a role "Root".
*
* @typedef {Object} StructTreeNode
* @typedef {object} StructTreeNode
* @property {Array<StructTreeNode | StructTreeContent>} children - Array of
* {@link StructTreeNode} and {@link StructTreeContent} objects.
* @property {string} role - element's role, already mapped if a role map exists
@@ -1318,8 +1304,7 @@ class PDFDocumentProxy {
/**
* Structure tree content.
*
* @typedef {Object} StructTreeContent
* @typedef {object} StructTreeContent
* @property {string} type - either "content" for page and stream structure
* elements or "object" for object references.
* @property {string} id - unique id that will map to the text layer.
@@ -1327,8 +1312,7 @@ class PDFDocumentProxy {
/**
* PDF page operator list.
*
* @typedef {Object} PDFOperatorList
* @typedef {object} PDFOperatorList
* @property {Array<number>} fnArray - Array containing the operator functions.
* @property {Array<any>} argsArray - Array containing the arguments of the
* functions.
@@ -1459,7 +1443,7 @@ class PDFPageProxy {
}
/**
* @type {Object} The filter factory instance.
* @type {object} The filter factory instance.
*/
get filterFactory() {
return this._transport.filterFactory;
@@ -1473,7 +1457,7 @@ class PDFPageProxy {
}
/**
* @returns {Promise<Object | null>} A promise that is resolved with
* @returns {Promise<object | null>} A promise that is resolved with
* an {Object} with a fake DOM object (a tree structure where elements
* are {Object} with a name, attributes (class, style, ...), value and
* children, very similar to a HTML DOM tree), or `null` if no XFA exists.
@@ -1484,7 +1468,6 @@ class PDFPageProxy {
/**
* Begins the process of rendering a page to the desired context.
*
* @param {RenderParameters} params - Page render parameters.
* @returns {RenderTask} An object that contains a promise that is
* resolved when the page finishes rendering.
@@ -1739,7 +1722,6 @@ class PDFPageProxy {
/**
* NOTE: All occurrences of whitespace will be replaced by
* standard spaces (0x20).
*
* @param {getTextContentParameters} params - getTextContent parameters.
* @returns {ReadableStream} Stream for reading text content chunks.
*/
@@ -1769,7 +1751,6 @@ class PDFPageProxy {
/**
* NOTE: All occurrences of whitespace will be replaced by
* standard spaces (0x20).
*
* @param {getTextContentParameters} params - getTextContent parameters.
* @returns {Promise<TextContent>} A promise that is resolved with a
* {@link TextContent} object that represents the page's text content.
@@ -1837,7 +1818,6 @@ class PDFPageProxy {
/**
* Cleans up resources allocated by the page.
*
* @param {boolean} [resetStats] - Reset page stats, if enabled.
* The default value is `false`.
* @returns {boolean} Indicates if clean-up was successfully run.
@@ -2060,7 +2040,7 @@ class PDFPageProxy {
}
/**
* @typedef {Object} PDFWorkerParameters
* @typedef {object} PDFWorkerParameters
* @property {string} [name] - The name of the worker.
* @property {Worker} [port] - The `workerPort` object.
* @property {number} [verbosity] - Controls the logging level;
@@ -2072,7 +2052,6 @@ class PDFPageProxy {
* documents. Message handlers are used to pass information from the main
* thread to the worker thread and vice versa. If the creation of a web
* worker is not possible, a "fake" worker will be used instead.
*
* @param {PDFWorkerParameters} params - The worker initialization parameters.
*/
class PDFWorker {
@@ -3269,7 +3248,7 @@ class RenderTask {
* Callback for incremental rendering -- a function that will be called
* each time the rendering is paused. To continue rendering call the
* function that is the first argument to the callback.
* @type {function}
* @type {Function}
*/
onContinue = null;
@@ -3277,8 +3256,7 @@ class RenderTask {
* A function that will be synchronously called when the rendering tasks
* finishes with an error (either because of an actual error, or because the
* rendering is cancelled).
*
* @type {function}
* @type {Function}
* @param {Error} error
*/
onError = null;
@@ -3306,7 +3284,6 @@ class RenderTask {
* Cancels the rendering task. If the task is currently rendering it will
* not be cancelled until graphics pauses with a timeout. The promise that
* this object extends will be rejected when cancelled.
*
* @param {number} [extraDelay]
*/
cancel(extraDelay = 0) {
+2 -5
View File
@@ -77,10 +77,9 @@ const XY = new Float32Array(2);
* only state modifiers that we cannot copy over when we switch contexts.
*
* To remove mirroring call `ctx._removeMirroring()`.
*
* @param {Object} ctx - The 2d canvas context that will duplicate its calls on
* @param {object} ctx - The 2d canvas context that will duplicate its calls on
* the destCtx.
* @param {Object} destCtx - The 2d canvas context that will receive the
* @param {object} destCtx - The 2d canvas context that will receive the
* forwarded calls.
*/
function mirrorContextOperations(ctx, destCtx) {
@@ -1651,7 +1650,6 @@ class CanvasGraphics {
* not) rather than against the running group result. We render onto a temp
* canvas; path/clip/transform ops are mirrored back to the group canvas so
* its state stays in sync for the next element.
*
* @returns {boolean} true if a knockout element was started.
*/
#beginKnockoutElement(alpha = 1) {
@@ -1706,7 +1704,6 @@ class CanvasGraphics {
* coverage when alpha_s < 1), destination-out the group canvas over that
* mask, restore the initial backdrop into the cleared footprint
* (non-isolated only), then paint the element on top.
*
* @param {boolean} started - the value returned by `#beginKnockoutElement`.
*/
#endKnockoutElement(started) {
+3 -3
View File
@@ -300,8 +300,9 @@ class CanvasBBoxTracker {
/**
* @param {number} idx
* @param {boolean} [preserve=false] - When false, the pending bounding box is
* cleared once recorded; pass true to keep it for subsequent operations.
* @param {boolean} [preserve=false] - When false, the pending bounding box
* is cleared once recorded; pass true to keep it for subsequent
* operations.
* @param {Iterable<Iterable<number>>} [dependencyLists] - Groups of operation
* indices whose bounding boxes are also expanded to cover this operation.
*/
@@ -803,7 +804,6 @@ class CanvasDependencyTracker {
* Used to track dependencies of nested operations list, that
* should actually all map to the index of the operation that
* contains the nested list.
*
* @implements {CanvasDependencyTracker}
*/
class CanvasNestedDependencyTracker {
-1
View File
@@ -24,7 +24,6 @@ import { stringToBytes } from "../shared/util.js";
/**
* Extract file name from the Content-Disposition HTTP response header.
*
* @param {string} contentDisposition
* @returns {string} Filename, if found in the Content-Disposition header.
*/
-1
View File
@@ -287,7 +287,6 @@ class PDFDateString {
* Moreover, Adobe Acrobat doesn't handle changing the date to universal time
* and doesn't use the user's time zone (effectively ignoring the HH' and mm'
* parts of the date string).
*
* @param {string} input
* @returns {Date|null}
*/
+4 -12
View File
@@ -19,9 +19,9 @@ import { shadow } from "../shared/util.js";
/**
* @typedef DrawLayerOptions
* Configuration for {@linkcode DrawLayer}.
* @property {Object | null} [filterFactory]
* @property {object | null} [filterFactory]
* Filter factory used to style selections (optional).
* @property {Object | null} [pageColors]
* @property {object | null} [pageColors]
* Page foreground/background colors for HCM (optional).
* @property {number} pageIndex
* Zero-based page index.
@@ -80,7 +80,6 @@ import { shadow } from "../shared/util.js";
/**
* Compare the document position of two text layers.
*
* @param {Element} a
* Text layer.
* @param {Element} b
@@ -99,7 +98,6 @@ function compareTextLayers(a, b) {
/**
* Find the closest text layer upwards.
*
* @param {Node | null} node
* Node.
* @returns {Element | null}
@@ -117,7 +115,6 @@ function getTextLayer(node) {
/**
* Compare the position of two points in the document order.
*
* @param {Node} nodeA
* Node.
* @param {number} offsetA
@@ -150,7 +147,6 @@ function isPointBefore(nodeA, offsetA, nodeB, offsetB) {
* In that case, we want to move it to the last valid position within
* the text layer, which can be either the end of the last text node or the end
* of the last text node before the endOfContent element if it exists.
*
* @param {Node} container
* Container.
* @param {number} offset
@@ -197,10 +193,10 @@ class DrawLayer {
/** @type {Element | null} */
#textLayer = null;
/** @type {Object | null} */
/** @type {object | null} */
#filterFactory = null;
/** @type {Object | null} */
/** @type {object | null} */
#pageColors = null;
/** @type {MutationObserver | null} */
@@ -230,8 +226,6 @@ class DrawLayer {
/**
* @param {DrawLayerOptions} options
* Configuration.
* @returns
* Instance.
*/
constructor({
filterFactory = null,
@@ -335,7 +329,6 @@ class DrawLayer {
/**
* Clean up the selection for a text layer.
*
* @param {Element} textLayer
* Text layer.
* @returns {undefined}
@@ -378,7 +371,6 @@ class DrawLayer {
* We want to display the selection in a separate layer on top of the text
* layer because the text layer has `mix-blend-mode: multiply` and we want
* the selection to have a different blend mode.
*
* @returns {undefined}
* Nothing.
*/
+12 -13
View File
@@ -39,8 +39,8 @@ import { SignatureEditor } from "./signature.js";
import { StampEditor } from "./stamp.js";
/**
* @typedef {Object} AnnotationEditorLayerOptions
* @property {Object} mode
* @typedef {object} AnnotationEditorLayerOptions
* @property {object} mode
* @property {HTMLDivElement} div
* @property {StructTreeLayerBuilder} structTreeLayer
* @property {AnnotationEditorUIManager} uiManager
@@ -55,7 +55,7 @@ import { StampEditor } from "./stamp.js";
*/
/**
* @typedef {Object} RenderEditorLayerOptions
* @typedef {object} RenderEditorLayerOptions
* @property {PageViewport} viewport
*/
@@ -156,7 +156,7 @@ class AnnotationEditorLayer {
/**
* Update the toolbar if it's required to reflect the tool currently used.
* @param {Object} options
* @param {object} options
*/
updateToolbar(options) {
this.#uiManager.updateToolbar(options);
@@ -223,7 +223,7 @@ class AnnotationEditorLayer {
/**
* Add some commands into the CommandManager (undo/redo stuff).
* @param {Object} params
* @param {object} params
*/
addCommands(params) {
this.#uiManager.addCommands(params);
@@ -674,7 +674,7 @@ class AnnotationEditorLayer {
/**
* Create a new editor
* @param {Object} params
* @param {object} params
* @returns {AnnotationEditor}
*/
#createNewEditor(params) {
@@ -688,8 +688,8 @@ class AnnotationEditorLayer {
/**
* Paste some content into a new editor.
* @param {Object} options
* @param {Object} params
* @param {object} options
* @param {object} params
*/
async pasteEditor(options, params) {
this.updateToolbar(options);
@@ -713,7 +713,7 @@ class AnnotationEditorLayer {
/**
* Create a new editor
* @param {Object} data
* @param {object} data
* @returns {Promise<AnnotationEditor | null>}
*/
async deserialize(data) {
@@ -728,7 +728,7 @@ class AnnotationEditorLayer {
* Create and add a new editor.
* @param {PointerEvent} event
* @param {boolean} isCentered
* @param {Object} [data]
* @param {object} [data]
* @returns {AnnotationEditor}
*/
createAndAddNewEditor(event, isCentered, data = {}) {
@@ -944,11 +944,10 @@ class AnnotationEditorLayer {
}
/**
*
* @param {AnnotationEditor} editor
* @param {number} x
* @param {number} y
* @returns
* @returns {boolean}
*/
findNewParent(editor, x, y) {
const layer = this.#uiManager.findParent(x, y);
@@ -1057,7 +1056,7 @@ class AnnotationEditorLayer {
/**
* Get page dimensions.
* @returns {Object} dimensions.
* @returns {object} dimensions.
*/
get pageDimensions() {
const { pageWidth, pageHeight } = this.viewport.rawDims;
+1 -1
View File
@@ -316,7 +316,7 @@ class Comment {
/**
* Restore the comment data (used for undo).
* @param {Object} data - The comment data to restore.
* @param {object} data - The comment data to restore.
* @param {string} data.text - The comment text.
* @param {string|null} data.richText - The rich text content.
* @param {Date|null} data.date - The original date.
+24 -19
View File
@@ -218,15 +218,17 @@ class DrawingEditor extends AnnotationEditor {
}
/**
* @param {Object} options
* @return {DrawingOptions} the default options to use for a new editor.
* @abstract
* @param {object} _options
* @returns {DrawingOptions} the default options to use for a new editor.
*/
static getDefaultDrawingOptions(_options) {
unreachable("Not implemented");
}
/**
* @return {Map<AnnotationEditorParamsType, string>} a map between the
* @abstract
* @returns {Map<AnnotationEditorParamsType, string>} a map between the
* parameter types and the name of the options.
*/
// eslint-disable-next-line getter-return
@@ -840,13 +842,15 @@ class DrawingEditor extends AnnotationEditor {
}
/**
* @param {Object} params
* @param {number} params.x - The x coordinate of the event.
* @param {number} params.y - The y coordinate of the event.
* @param {Array<number>} params.box - The target's client bounding box.
* @param {number} params.rotation - The viewport rotation.
* @param {AnnotationEditorLayer} params.parent - The parent layer.
* @param {boolean} params.isLTR - Whether the direction is left-to-right.
* @abstract
* @param {object} _params
* @param {number} _params.x - The x coordinate of the event.
* @param {number} _params.y - The y coordinate of the event.
* @param {[number, number, number, number]} _params.box - The target's
* client bounding box.
* @param {number} _params.rotation - The viewport rotation.
* @param {AnnotationEditorLayer} _params.parent - The parent layer.
* @param {boolean} _params.isLTR - Whether the direction is left-to-right.
*/
static createDrawerInstance(_params) {
unreachable("Not implemented");
@@ -1173,20 +1177,21 @@ class DrawingEditor extends AnnotationEditor {
/**
* Create the drawing options.
* @param {Object} _data
* @param {object} _data
*/
createDrawingOptions(_data) {}
/**
* Deserialize the drawing outlines.
* @param {number} pageX - The x coordinate of the page.
* @param {number} pageY - The y coordinate of the page.
* @param {number} pageWidth - The width of the page.
* @param {number} pageHeight - The height of the page.
* @param {number} innerMargin - The outline's inner margin.
* @param {Object} data - The data to deserialize.
* @param {AnnotationEditorUIManager} uiManager
* @returns {Object} The deserialized outlines.
* @abstract
* @param {number} _pageX - The x coordinate of the page.
* @param {number} _pageY - The y coordinate of the page.
* @param {number} _pageWidth - The width of the page.
* @param {number} _pageHeight - The height of the page.
* @param {number} _innerMargin - The outline's inner margin.
* @param {object} _data - The data to deserialize.
* @param {AnnotationEditorUIManager} _uiManager
* @returns {object} The deserialized outlines.
*/
static deserializeDraw(
_pageX,
+1 -1
View File
@@ -80,7 +80,7 @@ class FreeDrawOutliner {
return this.#points.length <= 10;
}
/** @returns {Object} The SVG properties to apply. */
/** @returns {object} The SVG properties to apply. */
removeLastElement() {
this.#last.fill(NaN);
this.#top.length = this.#bottom.length = this.#points.length = 0;
+4 -4
View File
@@ -19,7 +19,7 @@ import { Outline } from "./outline.js";
/**
* @param {Outline} outline
* @returns {Object}
* @returns {object}
*/
function getHighlightSVGProperties(outline) {
return {
@@ -40,7 +40,7 @@ function getHighlightSVGProperties(outline) {
/**
* @param {Outline} outline
* @param {number} rotation
* @returns {Object}
* @returns {object}
*/
function getHighlightFocusSVGProperties(outline, rotation) {
const { focusOutline } = outline;
@@ -72,7 +72,7 @@ class HighlightOutliner {
/**
* Construct an outliner.
* @param {Array<Object>} boxes - An array of axis-aligned rectangles.
* @param {Array<object>} boxes - An array of axis-aligned rectangles.
* @param {number} borderWidth - The width of the border of the boxes, it
* allows to make the boxes bigger (or smaller).
* @param {number} innerMargin - The margin between the boxes and the
@@ -344,7 +344,7 @@ class HighlightOutline extends Outline {
/**
* Build a text selection and its hover/selection outline.
* @param {Array<Object>} boxes - the boxes of the selected text.
* @param {Array<object>} boxes - the boxes of the selected text.
* @param {boolean} isLTR
* @returns {HighlightOutline}
*/
+9 -8
View File
@@ -22,6 +22,7 @@ class Outline {
focusOutline = null;
/**
* @abstract
* @returns {string} The SVG path of the outline.
*/
toSVGPath() {
@@ -29,7 +30,7 @@ class Outline {
}
/**
* @type {Object|null} The bounding box of the outline.
* @type {object | null} The bounding box of the outline.
*/
// eslint-disable-next-line getter-return
get box() {
@@ -40,20 +41,20 @@ class Outline {
unreachable("Abstract method `serialize` must be implemented.");
}
/** @type {Object} */
/** @type {object} */
// eslint-disable-next-line getter-return
get defaultSVGProperties() {
unreachable("Abstract getter `defaultSVGProperties` must be implemented.");
}
/** @type {Object} SVG properties used to finalize a drawing session. */
/** @type {object} SVG properties used to finalize a drawing session. */
get defaultProperties() {
return this.defaultSVGProperties;
}
/**
* @param {number} _rotation - the rotation to apply to the outline.
* @returns {Object|null}
* @returns {object | null}
*/
getFocusSVGProperties(_rotation) {
return null;
@@ -93,7 +94,7 @@ class Outline {
/**
* @param {number} _rotation
* @returns {Object} the SVG properties to apply to the rotated shape.
* @returns {object} the SVG properties to apply to the rotated shape.
*/
updateRotation(_rotation) {
return {};
@@ -102,7 +103,7 @@ class Outline {
/**
* Called on each resizing step, hence the outline itself is unchanged.
* @param {Array<number>} _bbox - the bounding box being resized to.
* @returns {Object} the SVG properties to apply to the resizing shape.
* @returns {object} the SVG properties to apply to the resizing shape.
*/
getPathResizingSVGProperties(_bbox) {
return {};
@@ -111,7 +112,7 @@ class Outline {
/**
* Called once the resizing is done, hence the outline can be updated.
* @param {Array<number>} _bbox - the new bounding box.
* @returns {Object} the SVG properties to apply to the resized shape.
* @returns {object} the SVG properties to apply to the resized shape.
*/
getPathResizedSVGProperties(_bbox) {
return {};
@@ -121,7 +122,7 @@ class Outline {
* Called once the translation is done, hence the outline can be updated.
* @param {Array<number>} _bbox - the new bounding box.
* @param {Array<number>} _parentDimensions
* @returns {Object} the SVG properties to apply to the translated shape.
* @returns {object} the SVG properties to apply to the translated shape.
*/
getPathTranslatedSVGProperties(_bbox, _parentDimensions) {
return {};
+11 -12
View File
@@ -31,7 +31,7 @@ import { MathClamp } from "../../shared/math_clamp.js";
import { TouchManager } from "../touch_manager.js";
/**
* @typedef {Object} AnnotationEditorParameters
* @typedef {object} AnnotationEditorParameters
* @property {AnnotationEditorUIManager} uiManager - the global manager
* @property {AnnotationEditorLayer} parent - the layer containing this editor
* @property {string} id - editor id
@@ -241,7 +241,7 @@ class AnnotationEditor {
/**
* Initialize the l10n stuff for this type of editor.
* @param {Object} l10n
* @param {object} l10n
*/
static initialize(l10n, _uiManager) {
AnnotationEditor._l10n ??= l10n;
@@ -361,7 +361,7 @@ class AnnotationEditor {
/**
* Add some commands into the CommandManager (undo/redo stuff).
* @param {Object} params
* @param {object} params
*/
addCommands(params) {
this._uiManager.addCommands(params);
@@ -1828,7 +1828,7 @@ class AnnotationEditor {
/**
* Rotate the editor when the page is rotated.
* @param {number} angle
* @param {number} _angle
*/
rotate(_angle) {}
@@ -1839,7 +1839,7 @@ class AnnotationEditor {
/**
* Serialize the editor when it has been deleted.
* @returns {Object}
* @returns {object}
*/
serializeDeleted() {
return {
@@ -1857,8 +1857,8 @@ class AnnotationEditor {
*
* To implement in subclasses.
* @param {boolean} [isForCopying]
* @param {Object | null} [context]
* @returns {Object | null}
* @param {object | null} [context]
* @returns {object | null}
*/
serialize(isForCopying = false, context = null) {
return {
@@ -1874,8 +1874,7 @@ class AnnotationEditor {
/**
* Deserialize the editor.
* The result of the deserialization is a new editor.
*
* @param {Object} data
* @param {object} data
* @param {AnnotationEditorLayer} parent
* @param {AnnotationEditorUIManager} uiManager
* @returns {Promise<AnnotationEditor | null>}
@@ -2329,7 +2328,7 @@ class AnnotationEditor {
/**
* Get the data to report to the telemetry when the editor is added.
* @returns {Object}
* @returns {object}
*/
get telemetryInitialData() {
return { action: "added" };
@@ -2337,7 +2336,7 @@ class AnnotationEditor {
/**
* The telemetry data to use when saving/printing.
* @returns {Object|null}
* @returns {object | null}
*/
get telemetryFinalData() {
return null;
@@ -2414,7 +2413,7 @@ class AnnotationEditor {
/**
* Render an annotation in the annotation layer.
* @param {Object} annotation
* @param {object} annotation
* @returns {HTMLElement|null}
*/
renderAnnotationElement(annotation) {
+12 -13
View File
@@ -367,10 +367,10 @@ class CommandManager {
}
/**
* @typedef {Object} addOptions
* @property {function} cmd
* @property {function} undo
* @property {function} [post]
* @typedef {object} addOptions
* @property {Function} cmd
* @property {Function} undo
* @property {Function} [post]
* @property {boolean} mustExec
* @property {number} type
* @property {boolean} overwriteIfSameType
@@ -611,9 +611,8 @@ class KeyboardManager {
/**
* Execute a callback, if any, for a given keyboard event.
* The self is used as `this` in the callback.
* @param {Object} self
* @param {object} self
* @param {KeyboardEvent} event
* @returns
*/
exec(self, event) {
let shortcuts = this.callbacks.get(event.key);
@@ -1256,7 +1255,7 @@ class AnnotationEditorUIManager {
/**
* Delete a comment from an editor with undo support.
* @param {AnnotationEditor} editor - The editor whose comment to delete.
* @param {Object} savedData - The comment data to save for undo.
* @param {object} savedData - The comment data to save for undo.
*/
deleteComment(editor, savedData) {
const undo = () => {
@@ -1490,7 +1489,7 @@ class AnnotationEditorUIManager {
* So this function retrieves the data from the storage and removes
* them from the storage in order to be able to save them later.
* @param {string} annotationId
* @returns {Object|null} The data associated to the annotation or null.
* @returns {object | null} The data associated to the annotation or null.
*/
getAndRemoveDataFromAnnotationStorage(annotationId) {
if (!this.#annotationStorage) {
@@ -1999,7 +1998,7 @@ class AnnotationEditorUIManager {
/**
* Update the different possible states of this manager, e.g. is there
* something to undo, redo, ...
* @param {Object} details
* @param {object} details
*/
#dispatchUpdateStates(details) {
const hasChanged = Object.entries(details).some(
@@ -2253,7 +2252,7 @@ class AnnotationEditorUIManager {
/**
* Update the toolbar if it's required to reflect the tool currently used.
* @param {Object} options
* @param {object} options
* @param {number} options.mode
* @returns {undefined}
*/
@@ -2375,7 +2374,7 @@ class AnnotationEditorUIManager {
/**
* Get all the editors belonging to a given page.
* @param {number} pageIndex
* @yields {AnnotationEditor}
* @yields {AnnotationEditor} An editor on the given page.
*/
*getEditors(pageIndex) {
for (const editor of this.#allEditors.values()) {
@@ -2613,7 +2612,7 @@ class AnnotationEditorUIManager {
/**
* Add a command to execute (cmd) and another one to undo it.
* @param {Object} params
* @param {object} params
*/
addCommands(params) {
this.#commandManager.add(params);
@@ -2927,7 +2926,7 @@ class AnnotationEditorUIManager {
/**
* Is the current editor the one passed as argument?
* @param {AnnotationEditor} editor
* @returns
* @returns {boolean}
*/
isActive(editor) {
return this.#activeEditor === editor;
+2 -11
View File
@@ -64,7 +64,6 @@ class BaseFilterFactory {
/**
* Create a filter for the selection of text, given colors.
*
* @param {string} fgColor
* @param {string} bgColor
* @returns {string}
@@ -75,7 +74,6 @@ class BaseFilterFactory {
/**
* Create a filter for the selection of text.
*
* @returns {string}
*/
addSelectionFilter() {
@@ -83,7 +81,7 @@ class BaseFilterFactory {
}
/**
* @param {Object} [pageColors]
* @param {object} [pageColors]
* @param {string} [pageColors.background]
* @param {string} [pageColors.foreground]
* @returns {Record<string, string> | null}
@@ -314,7 +312,6 @@ class DOMFilterFactory extends BaseFilterFactory {
/**
* Create a filter for the selection of text, given colors.
*
* @param {string} fgColor
* @param {string} bgColor
* @returns {string}
@@ -332,9 +329,6 @@ class DOMFilterFactory extends BaseFilterFactory {
/**
* Create a filter for the selection of text.
*
* @param {string} fgColor
* @param {string} bgColor
* @returns {string}
*/
addSelectionFilter() {
@@ -348,7 +342,7 @@ class DOMFilterFactory extends BaseFilterFactory {
}
/**
* @param {Object} [pageColors]
* @param {object} [pageColors]
* @param {string} [pageColors.background]
* @param {string} [pageColors.foreground]
* @returns {Record<string, string> | null}
@@ -640,7 +634,6 @@ class DOMFilterFactory extends BaseFilterFactory {
/**
* Get the RGB channels of a color.
*
* @param {string} color
* Color in any valid CSS format (such as `x` in `color: x`).
* @returns {[number, number, number, number]}
@@ -678,7 +671,6 @@ class DOMFilterFactory extends BaseFilterFactory {
/**
* Get the opaque text color by, if it has an alpha layer, blending it with
* the `Canvas` background.
*
* @param {string} color
* Color in any valid CSS format (such as `x` in `color: x`).
* @returns {[number, number, number]}
@@ -703,7 +695,6 @@ class DOMFilterFactory extends BaseFilterFactory {
/**
* Blend a foreground color with a background color using the alpha value.
*
* @param {number} fg
* Foreground color channel value in the range `[0, 255]`.
* @param {number} bg
+4 -4
View File
@@ -16,7 +16,7 @@
import { shadow, Util } from "../shared/util.js";
/**
* @typedef {Object} PageViewportParameters
* @typedef {object} PageViewportParameters
* @property {Array<number>} viewBox - The xMin, yMin, xMax and
* yMax coordinates.
* @property {number} userUnit - The size of units.
@@ -31,7 +31,7 @@ import { shadow, Util } from "../shared/util.js";
*/
/**
* @typedef {Object} PageViewportCloneParameters
* @typedef {object} PageViewportCloneParameters
* @property {number} [scale] - The scale, overriding the one in the cloned
* viewport. The default value is `this.scale`.
* @property {number} [rotation] - The rotation, in degrees, overriding the one
@@ -49,7 +49,7 @@ import { shadow, Util } from "../shared/util.js";
*/
class PageViewport {
/**
* @param {PageViewportParameters}
* @param {PageViewportParameters} params
*/
constructor({
viewBox,
@@ -146,7 +146,7 @@ class PageViewport {
/**
* The original, un-scaled, viewport dimensions.
* @type {Object}
* @type {object}
*/
get rawDims() {
const dims = this.viewBox;
+1 -3
View File
@@ -103,7 +103,6 @@ class PagesMapper {
/**
* Move a set of pages to a new position.
*
* @param {Set<number>} selectedPages - Page numbers being moved (1-indexed).
* @param {number[]} pagesToMove - Ordered list of page numbers to move.
* @param {number} index - Zero-based insertion index in the page-number list.
@@ -265,7 +264,6 @@ class PagesMapper {
/**
* Recomputes #prevPageNumbers after a mutation, using the pre-mutation
* id to pageNumbers map to track where each page came from.
*
* @param {Map<number, Array<number>>} prevIdToPageNumber - Id to pageNumbers
* before the mutation.
* @param {Set<number>|null} [deletedPageNumbers] - Page numbers that were
@@ -352,7 +350,7 @@ class PagesMapper {
* Gets the current page mapping suitable for saving.
* @param {Map<number, Array<number>>} [idToPageNumber]
* @param {Int32Array} [copyLevels]
* @returns {{pageInfos: Array<Object>, copyLevels: Int32Array|null}}
* @returns {{pageInfos: Array<object>, copyLevels: Int32Array | null}}
*/
getPageMappingForSaving(
idToPageNumber = null,
+1 -3
View File
@@ -35,9 +35,8 @@ class PDFObjects {
* If called *with* a callback, the callback is called with the data of the
* object once the object is resolved. That means, if you call this method
* and the object is already resolved, the callback gets called right away.
*
* @param {string} objId
* @param {function} [callback]
* @param {Function} [callback]
* @returns {any}
*/
get(objId, callback = null) {
@@ -84,7 +83,6 @@ class PDFObjects {
/**
* Resolves the object `objId` with optional `data`.
*
* @param {string} objId
* @param {any} [data]
*/
+3 -3
View File
@@ -27,7 +27,7 @@ import {
import { OutputScale, setLayerDimensions } from "./display_utils.js";
/**
* @typedef {Object} TextLayerParameters
* @typedef {object} TextLayerParameters
* @property {ReadableStream | TextContent} textContentSource - Text content to
* render, i.e. the value returned by the page's `streamTextContent` or
* `getTextContent` method.
@@ -40,10 +40,10 @@ import { OutputScale, setLayerDimensions } from "./display_utils.js";
*/
/**
* @typedef {Object} TextLayerUpdateParameters
* @typedef {object} TextLayerUpdateParameters
* @property {PageViewport} viewport - The target viewport to properly layout
* the text runs.
* @property {function} [onBefore] - Callback invoked before the textLayer is
* @property {Function} [onBefore] - Callback invoked before the textLayer is
* updated in the DOM.
*/
+7 -7
View File
@@ -39,16 +39,16 @@ function stopTouchEvent(evt) {
}
/**
* @typedef {Object} TouchManagerOptions
* @typedef {object} TouchManagerOptions
* @property {HTMLElement | Window} container
* @property {function} [isPinchingDisabled]
* @property {function} [isPinchingStopped]
* @property {function} [onPinchStart]
* @property {function} [onPinching] - Called with the previous client
* @property {Function} [isPinchingDisabled]
* @property {Function} [isPinchingStopped]
* @property {Function} [onPinchStart]
* @property {Function} [onPinching] - Called with the previous client
* midpoint, the previous/current screen distance, and the client midpoint
* delta.
* @property {function} [onPinchEnd]
* @property {function} [onPanning] - Called with the client midpoint delta
* @property {Function} [onPinchEnd]
* @property {Function} [onPanning] - Called with the client midpoint delta
* when no scale update is emitted.
* @property {AbortSignal} signal
*/
+1 -2
View File
@@ -153,11 +153,10 @@ class WebGPU {
* GPU-resident; `ctx2d.drawImage(bitmap)` is a zero-copy GPU-to-GPU blit.
*
* The GPU device must already be initialized (`this.isReady === true`).
*
* @param {Float32Array} posData flat vertex positions (x,y per vertex)
* @param {Uint8Array} colData flat vertex colors (r,g,b,_ per vertex)
* @param {number} vertexCount
* @param {Object} context offsetX/offsetY/scaleX/scaleY
* @param {object} context offsetX/offsetY/scaleX/scaleY
* @param {Uint8Array|null} backgroundColor [r,g,b] or null for transparent
* @param {number} paddedWidth render-target width
* @param {number} paddedHeight render-target height
+2 -2
View File
@@ -26,7 +26,7 @@ class GlobalWorkerOptions {
}
/**
* @param {Worker | null} workerPort - Defines global port for worker process.
* @param {Worker | null} val - Defines global port for worker process.
* Overrides the `workerSrc` option.
*/
static set workerPort(val) {
@@ -47,7 +47,7 @@ class GlobalWorkerOptions {
}
/**
* @param {string} workerSrc - A string containing the path and filename of
* @param {string} val - A string containing the path and filename of
* the worker file.
*
* NOTE: The `workerSrc` option should always be set, in order to prevent
+2 -4
View File
@@ -23,10 +23,10 @@ import { PageViewport } from "./page_viewport.js";
import { XfaText } from "./xfa_text.js";
/**
* @typedef {Object} XfaLayerParameters
* @typedef {object} XfaLayerParameters
* @property {PageViewport} viewport
* @property {HTMLDivElement} div
* @property {Object} xfaHtml
* @property {object} xfaHtml
* @property {AnnotationStorage} [annotationStorage]
* @property {PDFLinkService} linkService
* @property {string} [intent] - (default value is 'display').
@@ -312,7 +312,6 @@ class XfaLayer {
/**
* Render the XFA layer.
*
* @param {XfaLayerParameters} parameters
*/
static render(parameters) {
@@ -444,7 +443,6 @@ class XfaLayer {
/**
* Update the XFA layer.
*
* @param {XfaLayerParameters} parameters
*/
static update(parameters) {
+1 -4
View File
@@ -20,9 +20,7 @@ class XfaText {
* Walk an XFA tree and create an array of text nodes that is compatible
* with a regular PDFs TextContent. Currently, only TextItem.str is supported,
* all other fields and styles haven't been implemented.
*
* @param {Object} xfa - An XFA fake DOM object.
*
* @param {object} xfa - An XFA fake DOM object.
* @returns {TextContent}
*/
static textContent(xfa) {
@@ -64,7 +62,6 @@ class XfaText {
/**
* @param {string} name - DOM node name. (lower case)
*
* @returns {boolean} true if the DOM node should have a corresponding text
* node.
*/
-1
View File
@@ -15,7 +15,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
+6 -6
View File
@@ -19,7 +19,7 @@
// eslint-disable-next-line no-restricted-syntax
export class SandboxSupportBase {
/**
* @param {DOMWindow} - win
* @param {DOMWindow} win
*/
constructor(win) {
this.win = win;
@@ -38,29 +38,29 @@ export class SandboxSupportBase {
}
/**
* @param {Object} val - Export a value in the sandbox.
* @param {object} val - Export a value in the sandbox.
*/
exportValueToSandbox(val) {
throw new Error("Not implemented");
}
/**
* @param {Object} val - Import a value from the sandbox.
* @param {object} val - Import a value from the sandbox.
*/
importValueFromSandbox(val) {
throw new Error("Not implemented");
}
/**
* @param {String} errorMessage - Create an error in the sandbox.
* @param {string} errorMessage - Create an error in the sandbox.
*/
createErrorForSandbox(errorMessage) {
throw new Error("Not implemented");
}
/**
* @param {String} name - Name of the function to call in the sandbox
* @param {Array<Object>} args - Arguments of the function.
* @param {string} name - Name of the function to call in the sandbox
* @param {Array<object>} args - Arguments of the function.
*/
callSandboxFunction(name, args) {
if (!this.commFun) {
+3 -4
View File
@@ -64,7 +64,6 @@ class BasePDFStream {
*
* NOTE: Currently this method is only expected to be invoked *after*
* the `BasePDFStreamReader.prototype.headersReady` promise has resolved.
*
* @param {number} begin - the start offset of the data.
* @param {number} end - the end offset of the data.
* @returns {BasePDFStreamRangeReader}
@@ -80,7 +79,7 @@ class BasePDFStream {
/**
* Cancels all opened reader and closes all their opened requests.
* @param {Object} reason - the reason for cancelling
* @param {object} reason - the reason for cancelling
*/
cancelAllRequests(reason) {
this._fullReader?.cancel(reason);
@@ -193,7 +192,7 @@ class BasePDFStreamReader {
/**
* Cancels all pending read requests and closes the stream.
* @param {Object} reason
* @param {object} reason
*/
cancel(reason) {
unreachable("Abstract method `cancel` called");
@@ -230,7 +229,7 @@ class BasePDFStreamRangeReader {
/**
* Cancels all pending read requests and closes the stream.
* @param {Object} reason
* @param {object} reason
*/
cancel(reason) {
unreachable("Abstract method `cancel` called");
+1 -1
View File
@@ -221,7 +221,7 @@ class MessageHandler {
* Expect that the other side will callback to signal 'start_complete'.
* @param {string} actionName - Action to call.
* @param {JSON} data - JSON data to send.
* @param {Object} queueingStrategy - Strategy to signal backpressure based on
* @param {object} queueingStrategy - Strategy to signal backpressure based on
* internal queue.
* @param {Array} [transfers] - List of transfers/ArrayBuffers.
* @returns {ReadableStream} ReadableStream to read data in chunks.
+2 -4
View File
@@ -441,11 +441,10 @@ function _isValidProtocol(url) {
/**
* Attempts to create a valid absolute URL.
*
* @param {URL|string} url - An absolute, or relative, URL.
* @param {URL|string} [baseUrl] - An absolute URL.
* @param {Object} [options]
* @returns Either a valid {URL}, or `null` otherwise.
* @param {object} [options]
* @returns {URL | null} Either a valid {@link URL}, or `null` otherwise.
*/
function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
if (!url) {
@@ -477,7 +476,6 @@ function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
/**
* Remove, or replace, the hash property of the URL.
*
* @param {URL|string} url - The absolute, or relative, URL.
* @param {string} hash - The hash property (use an empty string to remove it).
* @param {boolean} [allowRel] - Allow relative URLs.
+1 -2
View File
@@ -496,7 +496,7 @@ class Rasterize {
}
/**
* @typedef {Object} DriverOptions
* @typedef {object} DriverOptions
* @property {HTMLSpanElement} inflight - Field displaying the number of
* inflight requests.
* @property {HTMLInputElement} disableScrolling - Checkbox to disable
@@ -643,7 +643,6 @@ class Driver {
* A debugging tool to log to the terminal while tests are running.
* XXX: This isn't currently referenced, but it's useful for debugging so
* do not remove it.
*
* @param {string} msg - The message to log, it will be prepended with the
* current PDF ID if there is one.
*/
-6
View File
@@ -170,7 +170,6 @@ describe("Text layer", () => {
/**
* Pick a point outside the page while remaining inside the viewer.
*
* @param {Rect} page
* Page rectangle.
* @param {Rect} viewer
@@ -223,7 +222,6 @@ describe("Text layer", () => {
/**
* Get current selection.
*
* @param {Page} page
* @returns {Promise<string>}
*/
@@ -235,7 +233,6 @@ describe("Text layer", () => {
/**
* Check if the draw layer contains a non-empty selection.
*
* @param {Page} page
* @returns {Promise<boolean>}
*/
@@ -255,7 +252,6 @@ describe("Text layer", () => {
/**
* Get the first non-empty text span on a page.
*
* @param {Page} page
* @param {number} pageNumber
* @returns {Promise<SpanInfo | null>}
@@ -281,7 +277,6 @@ describe("Text layer", () => {
/**
* Get the last non-empty text span on a page.
*
* @param {Page} page
* @param {number} pageNumber
* @returns {Promise<SpanInfo | null>}
@@ -1363,7 +1358,6 @@ describe("Text layer", () => {
/**
* Return the set of page numbers that have a non-empty selection
* overlay path in their draw layer.
*
* @param {Page} page
* @returns {Promise<Array<number>>}
*/
+3 -3
View File
@@ -29,7 +29,7 @@ import { AnnotationEditorLayer } from "pdfjs-lib";
import { GenericL10n } from "web-null_l10n";
/**
* @typedef {Object} AnnotationEditorLayerBuilderOptions
* @typedef {object} AnnotationEditorLayerBuilderOptions
* @property {AnnotationEditorUIManager} [uiManager]
* @property {number} pageIndex
* @property {L10n} [l10n]
@@ -38,11 +38,11 @@ import { GenericL10n } from "web-null_l10n";
* @property {AnnotationLayer} [annotationLayer]
* @property {TextLayer} [textLayer]
* @property {DrawLayer} [drawLayer]
* @property {function} [onAppend]
* @property {Function} [onAppend]
*/
/**
* @typedef {Object} AnnotationEditorLayerBuilderRenderOptions
* @typedef {object} AnnotationEditorLayerBuilderRenderOptions
* @property {PageViewport} viewport
* @property {string} [intent] - The default value is "display".
*/
+1 -1
View File
@@ -24,7 +24,7 @@ import {
import { internalOpt } from "./internal_evt.js";
/**
* @typedef {Object} AnnotationEditorParamsOptions
* @typedef {object} AnnotationEditorParamsOptions
* @property {HTMLInputElement} editorFreeTextFontSize
* @property {HTMLInputElement} editorFreeTextColor
* @property {HTMLInputElement} editorInkColor
+5 -5
View File
@@ -39,7 +39,7 @@ import { internalOpt } from "./internal_evt.js";
import { PresentationModeState } from "./ui_utils.js";
/**
* @typedef {Object} AnnotationLayerBuilderOptions
* @typedef {object} AnnotationLayerBuilderOptions
* @property {PDFPageProxy} pdfPage
* @property {AnnotationStorage} [annotationStorage]
* @property {string} [imageResourcesPath] - Path for image resources, mainly
@@ -50,17 +50,17 @@ import { PresentationModeState } from "./ui_utils.js";
* @property {boolean} [enableComment]
* @property {boolean} [enableScripting]
* @property {Promise<boolean>} [hasJSActionsPromise]
* @property {Promise<Object<string, Array<Object>> | null>}
* @property {Promise<Record<string, Array<object>> | null>}
* [fieldObjectsPromise]
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
* @property {TextAccessibilityManager} [accessibilityManager]
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
* @property {function} [onAppend]
* @property {Function} [onAppend]
* @property {CommentManager} [commentManager]
*/
/**
* @typedef {Object} AnnotationLayerBuilderRenderOptions
* @typedef {object} AnnotationLayerBuilderRenderOptions
* @property {PageViewport} viewport
* @property {string} [intent] - The default value is "display".
* @property {StructTreeLayerBuilder} [structTreeLayer]
@@ -241,7 +241,7 @@ class AnnotationLayerBuilder {
}
/**
* @param {Array<Object>} inferredLinks
* @param {Array<object>} inferredLinks
* @returns {Promise<void>} A promise that is resolved when the inferred links
* are added to the annotation layer.
*/
+2 -2
View File
@@ -1322,7 +1322,7 @@ const PDFViewerApplication = {
/**
* Opens a new PDF document.
* @param {Object} args - Accepts any/all of the properties from
* @param {object} args - Accepts any/all of the properties from
* {@link DocumentInitParameters}, and also a `originalUrl` string.
* @returns {Promise} - Promise that is resolved when the document is opened.
*/
@@ -1517,7 +1517,7 @@ const PDFViewerApplication = {
/**
* Report the error; used for errors affecting e.g. only a single page.
* @param {string} key - The localization key for the error.
* @param {Object} [moreInfo] - Further information about the error that is
* @param {object} [moreInfo] - Further information about the error that is
* more technical. Should have a 'message' and
* optionally a 'stack' property.
* @returns {string} A (localized) error message that is human readable.
+3 -3
View File
@@ -63,7 +63,7 @@ const defaultOptions = new Map([
[
"allowedGlobalEvents",
{
/** @type {Object} */
/** @type {object} */
value: null,
kind: OptionKind.BROWSER,
},
@@ -87,7 +87,7 @@ const defaultOptions = new Map([
[
"localeProperties",
{
/** @type {Object} */
/** @type {object} */
value:
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? { lang: navigator.language || "en-US" }
@@ -916,7 +916,7 @@ const defaultOptions = new Map([
[
"workerPort",
{
/** @type {Object} */
/** @type {object} */
value:
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
? globalThis.pdfjsPreloadedWorker || null
-1
View File
@@ -89,7 +89,6 @@ class BaseTreeViewer {
/**
* Collapse or expand the subtree of a tree item.
*
* @param {Element} root - the root of the item (sub)tree.
* @param {boolean} show - whether to show the item (sub)tree. If false,
* the item subtree rooted at `root` will be collapsed.
-2
View File
@@ -63,7 +63,6 @@ const ChromeCom = {
/**
* Creates an event that the extension is listening for and will
* asynchronously respond by calling the callback.
*
* @param {string} action - The action to trigger.
* @param {string} [data] - The data to send.
* @param {Function} [callback] - Response callback that will be called with
@@ -87,7 +86,6 @@ const ChromeCom = {
/**
* Resolves a PDF file path and attempts to detects length.
*
* @param {string} file - Absolute URL of PDF file.
* @param {Function} callback - A callback with resolved URL and file length.
*/
+3 -5
View File
@@ -22,14 +22,14 @@ import { DrawLayer } from "pdfjs-lib";
* Zero-based page index.
* @property {Element | null} [textLayer]
* Text layer element (optional).
* @property {Object | null} [filterFactory]
* @property {object | null} [filterFactory]
* Filter factory used to style selections (optional).
* @property {Object | null} [pageColors]
* @property {object | null} [pageColors]
* Page foreground/background colors for HCM (optional).
*/
/**
* @typedef {Object} DrawLayerBuilderRenderOptions
* @typedef {object} DrawLayerBuilderRenderOptions
* @property {string} [intent] - The default value is "display".
*/
@@ -39,8 +39,6 @@ class DrawLayerBuilder {
/**
* @param {DrawLayerBuilderOptions} options
* Configuration.
* @returns
* Instance.
*/
constructor(options) {
this.pageIndex = options.pageIndex;
+8 -9
View File
@@ -22,8 +22,8 @@ const WaitOnType = {
};
/**
* @typedef {Object} WaitOnEventOrTimeoutParameters
* @property {Object} target - The event target, can for example be:
* @typedef {object} WaitOnEventOrTimeoutParameters
* @property {object} target - The event target, can for example be:
* `window`, `document`, a DOM element, or an {EventBus} instance.
* @property {string} name - The name of the event.
* @property {number} delay - The delay, in milliseconds, after which the
@@ -34,8 +34,7 @@ const WaitOnType = {
* Allows waiting for an event or a timeout, whichever occurs first.
* Can be used to ensure that an action always occurs, even when an event
* arrives late or not at all.
*
* @param {WaitOnEventOrTimeoutParameters}
* @param {WaitOnEventOrTimeoutParameters} params
* @returns {Promise} A promise that is resolved with a {WaitOnType} value.
*/
async function waitOnEventOrTimeout({ target, name, delay = 0 }) {
@@ -85,8 +84,8 @@ class EventBus {
/**
* @param {string} eventName
* @param {function} listener
* @param {Object} [options]
* @param {Function} listener
* @param {object} [options]
*/
on(eventName, listener, options = null) {
let rmAbort = null;
@@ -112,8 +111,8 @@ class EventBus {
/**
* @param {string} eventName
* @param {function} listener
* @param {Object} [options]
* @param {Function} listener
* @param {object} [options]
*/
off(eventName, listener, options = null) {
const eventListeners = this.#listeners.get(eventName);
@@ -126,7 +125,7 @@ class EventBus {
/**
* @param {string} eventName
* @param {Object} data
* @param {object} data
*/
dispatch(eventName, data) {
const eventListeners = this.#listeners.get(eventName);
+1 -2
View File
@@ -62,8 +62,7 @@ class BaseExternalServices {
* an object exposing `verify(signature)` (and optionally
* `viewCertificate(certificate)`) that resolves to a
* `VerificationResult` — see `web/firefoxcom.js` for the exact shape.
*
* @returns {Object|null}
* @returns {object | null}
*/
createSignatureVerifier() {
return null;
+2 -2
View File
@@ -38,7 +38,7 @@ class FirefoxCom {
* Creates an event that the extension is listening for and will
* asynchronously respond to.
* @param {string} action - The action to trigger.
* @param {Object|string} [data] - The data to send.
* @param {object | string} [data] - The data to send.
* @returns {Promise<any>} A promise that is resolved with the response data.
*/
static requestAsync(action, data) {
@@ -51,7 +51,7 @@ class FirefoxCom {
* Creates an event that the extension is listening for and will, optionally,
* asynchronously respond to.
* @param {string} action - The action to trigger.
* @param {Object|string} [data] - The data to send.
* @param {object | string} [data] - The data to send.
*/
static request(action, data, callback = null) {
const request = document.createTextNode("");
+2 -2
View File
@@ -66,9 +66,9 @@ class GenericL10n extends L10n {
/**
* Generate the bundles for Fluent.
* @param {String} defaultLang - The fallback language to use for
* @param {string} defaultLang - The fallback language to use for
* translations.
* @param {String} baseLang - The base language to use for translations.
* @param {string} baseLang - The base language to use for translations.
*/
static async *#generateBundles(defaultLang, baseLang) {
const { baseURL, paths } = await this.#getPaths();
+1 -2
View File
@@ -20,7 +20,7 @@ import { stopEvent } from "pdfjs-lib";
const CSS_CLASS_GRAB = "grab-to-pan-grab";
/**
* @typedef {Object} GrabToPanOptions
* @typedef {object} GrabToPanOptions
* @property {HTMLElement} element
*/
@@ -76,7 +76,6 @@ class GrabToPan {
/**
* Whether to not pan if the target element is clicked.
* Override this method to change the default behaviour.
*
* @param {Element} node - The target of the event.
* @returns {boolean} Whether to not react to the click event.
*/
@@ -65,7 +65,6 @@ const MATHML_NS = "http://www.w3.org/1998/Math/MathML";
/**
* Tracks and displays the CanvasRenderingContext2D graphics state for all
* contexts created during a stepped render.
*
* @param {HTMLElement} panelEl The #gfx-state-panel DOM element.
*/
class CanvasContextDetailsView {
+4 -2
View File
@@ -150,8 +150,10 @@ class MultilineView {
return this.#element;
}
/** The inner content container (between the sentinels). Useful for setting
* ARIA attributes and attaching keyboard listeners. */
/**
* The inner content container (between the sentinels). Useful for setting
* ARIA attributes and attaching keyboard listeners.
*/
get inner() {
return this.#pre;
}
-1
View File
@@ -17,7 +17,6 @@ import { MathClamp } from "pdfjs-lib";
/**
* Wraps two elements with a drag-to-resize handle between them.
*
* @param {HTMLElement} firstEl
* @param {HTMLElement} secondEl
* @param {object} [options]
-1
View File
@@ -23,7 +23,6 @@ const REF_RE = /^\d+ \d+ R$/;
/**
* Renders and manages the PDF internal structure tree.
*
* @param {HTMLElement} treeEl
* @param {object} options
* @param {Function} options.onMarkLoading Called with +1/-1 to track
+1 -1
View File
@@ -18,7 +18,7 @@
import { PasswordResponses } from "pdfjs-lib";
/**
* @typedef {Object} PasswordPromptOptions
* @typedef {object} PasswordPromptOptions
* @property {HTMLDialogElement} dialog - The overlay's DOM element.
* @property {HTMLParagraphElement} label - Label containing instructions for
* entering the password.
+1 -1
View File
@@ -30,7 +30,7 @@ import { internalOpt } from "./internal_evt.js";
import { waitOnEventOrTimeout } from "./event_utils.js";
/**
* @typedef {Object} PDFAttachmentViewerOptions
* @typedef {object} PDFAttachmentViewerOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {EventBus} eventBus - The application event bus.
* @property {DownloadManager} downloadManager - The download manager.
+1 -1
View File
@@ -21,7 +21,7 @@ import { GrabToPan } from "./grab_to_pan.js";
import { internalOpt } from "./internal_evt.js";
/**
* @typedef {Object} PDFCursorToolsOptions
* @typedef {object} PDFCursorToolsOptions
* @property {HTMLDivElement} container - The document container.
* @property {EventBus} eventBus - The application event bus.
* @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled
+3 -4
View File
@@ -45,9 +45,9 @@ function getPageName(size, isPortrait, pageNames) {
}
/**
* @typedef {Object} PDFDocumentPropertiesOptions
* @typedef {object} PDFDocumentPropertiesOptions
* @property {HTMLDialogElement} dialog - The overlay's DOM element.
* @property {Object} fields - Names and elements of the overlay's fields.
* @property {object} fields - Names and elements of the overlay's fields.
* @property {HTMLButtonElement} closeButton - Button for closing the overlay.
*/
@@ -59,7 +59,7 @@ class PDFDocumentProperties {
* @param {OverlayManager} overlayManager - Manager for the viewer overlays.
* @param {EventBus} eventBus - The application event bus.
* @param {L10n} l10n - Localization service.
* @param {function} fileNameLookup - The function that is used to lookup
* @param {Function} fileNameLookup - The function that is used to lookup
* the document fileName.
*/
constructor(
@@ -201,7 +201,6 @@ class PDFDocumentProperties {
* Set a reference to the PDF document in order to populate the dialog fields
* with the document properties. Note that the dialog will contain no
* information if this method is not called.
*
* @param {PDFDocumentProxy} pdfDocument - A reference to the PDF document.
*/
setDocument(pdfDocument) {
+5 -6
View File
@@ -399,7 +399,7 @@ function getOriginalIndex(diffs, pos, len) {
}
/**
* @typedef {Object} PDFFindControllerOptions
* @typedef {object} PDFFindControllerOptions
* @property {PDFLinkService} linkService - The navigation/linking service.
* @property {EventBus} eventBus - The application event bus.
* @property {number} [delay] - The number of milliseconds to delay execution of
@@ -443,7 +443,7 @@ class PDFFindController {
/**
* Callback used to check if a `pageNumber` is currently visible.
* @type {function}
* @type {Function}
*/
this.onIsPageVisible = null;
@@ -476,7 +476,6 @@ class PDFFindController {
/**
* Set a reference to the PDF document in order to search it.
* Note that searching is not possible if this method is not called.
*
* @param {PDFDocumentProxy} pdfDocument - The PDF document to search.
*/
setDocument(pdfDocument) {
@@ -558,7 +557,7 @@ class PDFFindController {
}
/**
* @typedef {Object} PDFFindControllerScrollMatchIntoViewParams
* @typedef {object} PDFFindControllerScrollMatchIntoViewParams
* @property {HTMLElement} element
* @property {number} pageIndex
* @property {number} matchIndex
@@ -566,7 +565,7 @@ class PDFFindController {
/**
* Scroll the current match into view.
* @param {PDFFindControllerScrollMatchIntoViewParams}
* @param {PDFFindControllerScrollMatchIntoViewParams} params
*/
scrollMatchIntoView({ element = null, pageIndex = -1, matchIndex = -1 }) {
if (!this._scrollMatches || !element) {
@@ -807,7 +806,7 @@ class PDFFindController {
}
/**
* @typedef {Object} FindMatch
* @typedef {object} FindMatch
* @property {number} index - The start of the matched text in the page's
* string contents.
* @property {number} length - The length of the matched text.
+4 -4
View File
@@ -29,13 +29,13 @@ const POSITION_UPDATED_THRESHOLD = 50;
const UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds
/**
* @typedef {Object} PDFHistoryOptions
* @typedef {object} PDFHistoryOptions
* @property {PDFLinkService} linkService - The navigation/linking service.
* @property {EventBus} eventBus - The application event bus.
*/
/**
* @typedef {Object} InitializeParameters
* @typedef {object} InitializeParameters
* @property {string} fingerprint - The PDF document's unique fingerprint.
* @property {boolean} [resetHistory] - Reset the browsing history.
* @property {boolean} [updateUrl] - Attempt to update the document URL, with
@@ -43,7 +43,7 @@ const UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds
*/
/**
* @typedef {Object} PushParameters
* @typedef {object} PushParameters
* @property {string} [namedDest] - The named destination. If absent, a
* stringified version of `explicitDest` is used.
* @property {Array} explicitDest - The explicit destination array.
@@ -188,7 +188,7 @@ class PDFHistory {
/**
* Push an internal destination to the browser history.
* @param {PushParameters}
* @param {PushParameters} params
*/
push({ namedDest = null, explicitDest, pageNumber }) {
if (!this._initialized) {
+2 -2
View File
@@ -23,13 +23,13 @@ import { BaseTreeViewer } from "./base_tree_viewer.js";
import { internalOpt } from "./internal_evt.js";
/**
* @typedef {Object} PDFLayerViewerOptions
* @typedef {object} PDFLayerViewerOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {EventBus} eventBus - The application event bus.
*/
/**
* @typedef {Object} PDFLayerViewerRenderParameters
* @typedef {object} PDFLayerViewerRenderParameters
* @property {OptionalContentConfig|null} optionalContentConfig - An
* {OptionalContentConfig} instance.
* @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.
+3 -5
View File
@@ -34,7 +34,7 @@ const LinkTarget = {
};
/**
* @typedef {Object} PDFLinkServiceOptions
* @typedef {object} PDFLinkServiceOptions
* @property {EventBus} eventBus - The application event bus.
* @property {number} [externalLinkTarget] - Specifies the `target` attribute
* for external links. Must use one of the values from {LinkTarget}.
@@ -134,7 +134,6 @@ class PDFLinkService {
/**
* This method will, when available, also update the browser history.
*
* @param {string|Array} dest - The named, or explicit, PDF destination.
*/
async goToDestination(dest) {
@@ -211,7 +210,6 @@ class PDFLinkService {
/**
* This method will, when available, also update the browser history.
*
* @param {number|string} val - The page number, or page label.
*/
goToPage(val) {
@@ -245,7 +243,7 @@ class PDFLinkService {
* @param {number} pageNumber - The page number to scroll to.
* @param {number} x - The x-coordinate to scroll to in page coordinates.
* @param {number} y - The y-coordinate to scroll to in page coordinates.
* @param {Object} [options]
* @param {object} [options]
*/
goToXY(pageNumber, x, y, options = {}) {
this.pdfViewer.scrollPageIntoView({
@@ -525,7 +523,7 @@ class PDFLinkService {
}
/**
* @param {Object} action
* @param {object} action
*/
async executeSetOCGState(action) {
if (!this.pdfDocument) {
+2 -2
View File
@@ -28,7 +28,7 @@ import { internalOpt } from "./internal_evt.js";
import { SidebarView } from "./ui_utils.js";
/**
* @typedef {Object} PDFOutlineViewerOptions
* @typedef {object} PDFOutlineViewerOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {EventBus} eventBus - The application event bus.
* @property {PDFLinkService} linkService - The navigation/linking service.
@@ -36,7 +36,7 @@ import { SidebarView } from "./ui_utils.js";
*/
/**
* @typedef {Object} PDFOutlineViewerRenderParameters
* @typedef {object} PDFOutlineViewerRenderParameters
* @property {Array|null} outline - An array of outline objects.
* @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.
*/
+4 -4
View File
@@ -56,7 +56,7 @@ import { TextLayerBuilder } from "./text_layer_builder.js";
import { XfaLayerBuilder } from "./xfa_layer_builder.js";
/**
* @typedef {Object} PDFPageViewOptions
* @typedef {object} PDFPageViewOptions
* @property {HTMLDivElement} [container] - The viewer element.
* @property {EventBus} eventBus - The application event bus.
* @property {number} id - The page unique ID (normally its number).
@@ -101,11 +101,11 @@ import { XfaLayerBuilder } from "./xfa_layer_builder.js";
* affects. Then, when rendering a partial page (if `enableDetailCanvas` is
* enabled), it will only run through the operations that affect that portion.
* The default value is `false`.
* @property {Object} [pageColors] - Overwrites background and foreground colors
* @property {object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
* @property {L10n} [l10n] - Localization service.
* @property {Object} [layerProperties] - The object that is used to lookup
* @property {object} [layerProperties] - The object that is used to lookup
* the necessary layer-properties.
* @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
* text that look like URLs. The default value is `true`.
@@ -754,7 +754,7 @@ class PDFPageView extends BasePDFPageView {
}
/**
* @typedef {Object} PDFPageViewUpdateParameters
* @typedef {object} PDFPageViewUpdateParameters
* @property {number} [scale] The new scale, if specified.
* @property {number} [rotation] The new rotation, if specified.
* @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]
+1 -1
View File
@@ -38,7 +38,7 @@ const SWIPE_MIN_DISTANCE_THRESHOLD = 50;
const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
/**
* @typedef {Object} PDFPresentationModeOptions
* @typedef {object} PDFPresentationModeOptions
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {PDFViewer} pdfViewer - The document viewer.
* @property {EventBus} eventBus - The application event bus.
+2 -3
View File
@@ -72,7 +72,7 @@ class PDFRenderingQueue {
}
/**
* @param {Object} currentlyVisiblePages
* @param {object} currentlyVisiblePages
*/
renderHighestPriority(currentlyVisiblePages) {
if (this.#idleTimeout) {
@@ -103,7 +103,7 @@ class PDFRenderingQueue {
}
/**
* @param {Object} visible
* @param {object} visible
* @param {Array} views
* @param {boolean} scrolledDown
* @param {boolean} [preRenderExtra]
@@ -199,7 +199,6 @@ class PDFRenderingQueue {
* Render a page or thumbnail view. This calls the appropriate function
* based on the views state. If the view is already rendered it will return
* `false`.
*
* @param {RenderableView} view
*/
renderView(view) {
+3 -3
View File
@@ -21,14 +21,14 @@ import { RenderingStates } from "./renderable_view.js";
import { shadow } from "pdfjs-lib";
/**
* @typedef {Object} PDFScriptingManagerOptions
* @typedef {object} PDFScriptingManagerOptions
* @property {EventBus} eventBus - The application event bus.
* @property {string} [sandboxBundleSrc] - The path and filename of the
* scripting bundle.
* @property {Object} [externalServices] - The factory that is used when
* @property {object} [externalServices] - The factory that is used when
* initializing scripting; must contain a `createScripting` method.
* PLEASE NOTE: Primarily intended for the default viewer use-case.
* @property {function} [docProperties] - The function that is used to lookup
* @property {Function} [docProperties] - The function that is used to lookup
* the necessary document properties.
*/
-1
View File
@@ -56,7 +56,6 @@ class PdfTextExtractor {
/**
* Builds up all of the text from a PDF.
*
* @param {number} requestId
*/
async extractTextContent(requestId) {
+2 -2
View File
@@ -30,7 +30,7 @@ const MAX_NUM_SCALING_STEPS = 3;
const THUMBNAIL_WIDTH = 126; // px
/**
* @typedef {Object} PDFThumbnailViewOptions
* @typedef {object} PDFThumbnailViewOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {EventBus} eventBus - The application event bus.
* @property {number} id - The thumbnail's unique ID (normally its number).
@@ -46,7 +46,7 @@ const THUMBNAIL_WIDTH = 126; // px
* @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
* in either width or height. Use `-1` for no limit.
* The default value is 32767.
* @property {Object} [pageColors] - Overwrites background and foreground colors
* @property {object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
*/
+7 -7
View File
@@ -48,7 +48,7 @@ const PIXELS_TO_SCROLL_WHEN_DRAGGING = 20;
const SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;
/**
* @typedef {Object} PDFThumbnailViewerOptions
* @typedef {object} PDFThumbnailViewerOptions
* @property {HTMLDivElement} container - The container for the thumbnail
* elements.
* @property {EventBus} eventBus - The application event bus.
@@ -60,7 +60,7 @@ const SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;
* @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
* in either width or height. Use `-1` for no limit.
* The default value is 32767.
* @property {Object} [pageColors] - Overwrites background and foreground colors
* @property {object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
* @property {AbortSignal} [abortSignal] - The AbortSignal for the window
@@ -71,15 +71,15 @@ const SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;
* The default value is `false`.
* @property {boolean} [enableSplitMerge] - Enables split and merge features.
* The default value is `false`.
* @property {Object} [statusBar] - The status bar elements to manage the status
* @property {object} [statusBar] - The status bar elements to manage the status
* label and action when editing pages.
* @property {Object} [undoBar] - The undo bar elements to manage the undo
* @property {object} [undoBar] - The undo bar elements to manage the undo
* action.
* @property {Object} [manageMenu] - The menu elements to manage saving edited
* @property {object} [manageMenu] - The menu elements to manage saving edited
* PDF.
* @property {Object} [waitingBar] - The waiting bar elements shown during
* @property {object} [waitingBar] - The waiting bar elements shown during
* long-running operations.
* @property {Object} [addFileComponent] - The file picker and button used to
* @property {object} [addFileComponent] - The file picker and button used to
* add one or more PDF files to merge with the current one.
*/
+8 -7
View File
@@ -88,7 +88,7 @@ function isValidAnnotationEditorMode(mode) {
}
/**
* @typedef {Object} PDFViewerOptions
* @typedef {object} PDFViewerOptions
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} [viewer] - The viewer element.
* @property {EventBus} eventBus - The application event bus.
@@ -146,7 +146,7 @@ function isValidAnnotationEditorMode(mode) {
* @property {L10n} [l10n] - Localization service.
* @property {boolean} [enablePermissions] - Enables PDF document permissions,
* when they exist. The default value is `false`.
* @property {Object} [pageColors] - Overwrites background and foreground colors
* @property {object} [pageColors] - Overwrites background and foreground colors
* with user defined ones in order to improve readability in high contrast
* mode.
* @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
@@ -622,7 +622,8 @@ class PDFViewer {
}
/**
* @param val - The scale of the pages (in percent or predefined value).
* @param {string} val - The scale of the pages (in percent or predefined
* value).
*/
set currentScaleValue(val) {
if (!this.pdfDocument) {
@@ -732,7 +733,7 @@ class PDFViewer {
/**
* Currently only *some* permissions are supported.
* @returns {Object}
* @returns {object}
*/
#initializePermissions(permissions) {
const params = {
@@ -1775,7 +1776,7 @@ class PDFViewer {
}
/**
* @typedef {Object} ScrollPageIntoViewParameters
* @typedef {object} ScrollPageIntoViewParameters
* @property {number} pageNumber - The page number.
* @property {Array} [destArray] - The original PDF destination array, in the
* format: <page-ref> </XYZ|/FitXXX> <args..>
@@ -2561,7 +2562,7 @@ class PDFViewer {
}
/**
* @typedef {Object} ChangeScaleOptions
* @typedef {object} ChangeScaleOptions
* @property {number} [drawingDelay]
* @property {number} [scaleFactor]
* @property {number} [steps]
@@ -2686,7 +2687,7 @@ class PDFViewer {
}
/**
* @typedef {Object} AnnotationEditorModeOptions
* @typedef {object} AnnotationEditorModeOptions
* @property {number} mode - The editor mode (none, FreeText, ink, ...).
* @property {string|null} [editId] - ID of the existing annotation to edit.
* @property {boolean} [isFromKeyboard] - True if the mode change is due to a
+2 -2
View File
@@ -63,7 +63,7 @@ class BasePreferences {
/**
* Stub function for writing preferences to storage.
* @param {Object} prefObj The preferences that should be written to storage.
* @param {object} prefObj The preferences that should be written to storage.
* @returns {Promise} A promise that is resolved when the preference values
* have been written.
*/
@@ -73,7 +73,7 @@ class BasePreferences {
/**
* Stub function for reading preferences from storage.
* @param {Object} prefObj The preferences that should be read from storage.
* @param {object} prefObj The preferences that should be read from storage.
* @returns {Promise} A promise that is resolved with an {Object} containing
* the preferences that have been read.
*/
+1 -1
View File
@@ -33,7 +33,7 @@ class RenderableView {
renderTask = null;
/**
* @type {function | null}
* @type {Function | null}
*/
resume = null;
+1 -1
View File
@@ -26,7 +26,7 @@ import { internalOpt } from "./internal_evt.js";
import { PagesCountLimit } from "./pdf_viewer.js";
/**
* @typedef {Object} SecondaryToolbarOptions
* @typedef {object} SecondaryToolbarOptions
* @property {HTMLDivElement} toolbar - Container for the secondary toolbar.
* @property {HTMLButtonElement} toggleButton - Button to toggle the visibility
* of the secondary toolbar.
+2 -2
View File
@@ -41,7 +41,7 @@ class Sidebar {
#prevX = 0;
/**
* @typedef {Object} SidebarElements
* @typedef {object} SidebarElements
* @property {HTMLElement} sidebar - The sidebar element.
* @property {HTMLElement} resizer - The sidebar resizer element.
* @property {HTMLElement} toggleButton - The button used to toggle the
@@ -206,7 +206,7 @@ class Sidebar {
/**
* Callback to be executed when the sidebar is being resized.
* @param {number} newWidth - The new width of the sidebar in pixels.
* @param {number} _newWidth - The new width of the sidebar in pixels.
*/
onResizing(_newWidth) {}
+5 -4
View File
@@ -181,9 +181,9 @@ class MathMLSanitizer {
const HEADING_PATTERN = /^H(\d+)$/;
/**
* @typedef {Object} StructTreeLayerBuilderOptions
* @typedef {object} StructTreeLayerBuilderOptions
* @property {PDFPageProxy} pdfPage
* @property {Object} rawDims
* @property {object} rawDims
*/
class StructTreeLayerBuilder {
@@ -216,7 +216,8 @@ class StructTreeLayerBuilder {
#elementsToStealFromTextLayer = null;
/**
* @param {StructTreeLayerBuilderOptions} options
* @param {PDFPageProxy} pdfPage
* @param {object} rawDims
*/
constructor(pdfPage, rawDims) {
this.#promise = pdfPage.getStructTree();
@@ -251,7 +252,7 @@ class StructTreeLayerBuilder {
/**
* @param {string} annotationId
* @param {Object} [options]
* @param {object} [options]
* @param {boolean} [options.enableLinkOwnership]
* @returns {Promise<Map<string, string>|null|undefined>}
*/
+3 -1
View File
@@ -38,7 +38,6 @@ class TextAccessibilityManager {
/**
* Compare the positions of two elements, it must correspond to
* the visual ordering.
*
* @param {HTMLElement} e1
* @param {HTMLElement} e2
* @returns {number}
@@ -219,7 +218,10 @@ class TextAccessibilityManager {
/**
* Move a div in the DOM in order to respect the visual order.
* @param {HTMLElement} container
* @param {HTMLDivElement} element
* @param {HTMLElement} contentElement
* @param {boolean} isRemovable
* @returns {string|null} The id in the struct tree if any.
*/
moveElementInDOM(container, element, contentElement, isRemovable) {
+1 -2
View File
@@ -20,7 +20,7 @@ import { internalOpt } from "./internal_evt.js";
/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
/**
* @typedef {Object} TextHighlighterOptions
* @typedef {object} TextHighlighterOptions
* @property {PDFFindController} findController
* @property {EventBus} eventBus - The application event bus.
* @property {number} pageIndex - The page index.
@@ -51,7 +51,6 @@ class TextHighlighter {
* The arrays should be of equal length and the array element at each index
* should correspond to the other. e.g.
* `items[0] = "<span>Item 0</span>" and texts[0] = "Item 0";
*
* @param {Array<Node>} divs
* @param {Array<string>} texts
*/
+4 -4
View File
@@ -26,21 +26,21 @@ import { normalizeUnicode, stopEvent, TextLayer } from "pdfjs-lib";
import { removeNullCharacters } from "./ui_utils.js";
/**
* @typedef {Object} TextLayerBuilderOptions
* @typedef {object} TextLayerBuilderOptions
* @property {PDFPageProxy} pdfPage
* @property {TextHighlighter} [highlighter] - Optional object that will handle
* highlighting text from the find controller.
* @property {TextAccessibilityManager} [accessibilityManager]
* @property {boolean} [enablePermissions]
* @property {function} [onAppend]
* @property {Function} [onAppend]
* @property {AbortSignal} [abortSignal]
*/
/**
* @typedef {Object} TextLayerBuilderRenderOptions
* @typedef {object} TextLayerBuilderRenderOptions
* @property {PageViewport} viewport
* @property {TextLayerImages} images
* @property {Object} [textContentParams]
* @property {object} [textContentParams]
*/
/**

Some files were not shown because too many files have changed in this diff Show More