mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Compare commits
No commits in common. "master" and "v5.2.133" have entirely different histories.
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -8,6 +8,8 @@ The issue tracking system is designed to record a single technical problem. A bu
|
|||||||
|
|
||||||
If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.
|
If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room -- keep in mind that just code snippets won't help us troubleshoot the problem.
|
||||||
|
|
||||||
|
Note that the translations for PDF.js in the `l10n` folder are imported from the Nightly channel of Mozilla Firefox, such that we don't have to maintain them ourselves. This means that we will not accept pull requests that add new languages and/or modify existing translations, unless the corresponding changes have been made in Mozilla Firefox first.
|
||||||
|
|
||||||
See also:
|
See also:
|
||||||
- https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions
|
- https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions
|
||||||
- https://github.com/mozilla/pdf.js/wiki/Contributing
|
- https://github.com/mozilla/pdf.js/wiki/Contributing
|
||||||
|
|||||||
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -6,5 +6,3 @@ updates:
|
|||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
cooldown:
|
|
||||||
default-days: 7
|
|
||||||
|
|||||||
1
.github/font_tests_requirements.txt
vendored
1
.github/font_tests_requirements.txt
vendored
@ -1 +0,0 @@
|
|||||||
fonttools==4.*
|
|
||||||
41
.github/workflows/ci.yml
vendored
41
.github/workflows/ci.yml
vendored
@ -7,59 +7,28 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: code-coverage
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [22, 24, 26]
|
node-version: [20, 22, 23]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Restore cached PDF files
|
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
restore-keys: |
|
|
||||||
cached-pdf-files-
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Run external tests
|
- name: Run external tests
|
||||||
run: npx gulp externaltest
|
run: npx gulp externaltest
|
||||||
|
|
||||||
- name: Run CLI unit tests with code coverage
|
- name: Run CLI unit tests
|
||||||
run: npx gulp unittestcli --coverage --coverage-output build/coverage/unitcli
|
run: npx gulp unittestcli
|
||||||
|
|
||||||
- name: Save cached PDF files
|
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./build/coverage/unitcli/lcov.info
|
|
||||||
flags: unittestcli
|
|
||||||
name: codecov-umbrella
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
verbose: true
|
|
||||||
|
|||||||
9
.github/workflows/codeql.yml
vendored
9
.github/workflows/codeql.yml
vendored
@ -18,19 +18,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
queries: security-and-quality
|
queries: security-and-quality
|
||||||
|
|
||||||
- name: Autobuild CodeQL
|
- name: Autobuild CodeQL
|
||||||
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
- name: Perform CodeQL analysis
|
- name: Perform CodeQL analysis
|
||||||
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
99
.github/workflows/coverage_browser_tests.yml
vendored
99
.github/workflows/coverage_browser_tests.yml
vendored
@ -1,99 +0,0 @@
|
|||||||
name: Coverage (Browser tests)
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/images/**'
|
|
||||||
- 'test/pdfs/**'
|
|
||||||
- 'test/resources/**'
|
|
||||||
- 'test/*.css'
|
|
||||||
- 'test/driver.js'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/test_manifest.json'
|
|
||||||
- 'test/test_slave.html'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/coverage_browser_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/images/**'
|
|
||||||
- 'test/pdfs/**'
|
|
||||||
- 'test/resources/**'
|
|
||||||
- 'test/*.css'
|
|
||||||
- 'test/driver.js'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/test_manifest.json'
|
|
||||||
- 'test/test_slave.html'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/coverage_browser_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: ${{ matrix.os }} / firefox
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
node-version: [lts/*]
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
environment: code-coverage
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Restore cached PDF files
|
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
restore-keys: |
|
|
||||||
cached-pdf-files-
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Run browser tests with code coverage
|
|
||||||
run: npx gulp botbrowsertest --headless -j$(nproc) --coverage --coverage-output build/coverage/browser --noChrome
|
|
||||||
|
|
||||||
- name: Save cached PDF files
|
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./build/coverage/browser/lcov.info
|
|
||||||
flags: browsertest
|
|
||||||
name: codecov-umbrella
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
verbose: true
|
|
||||||
19
.github/workflows/fluent_linter.yml
vendored
19
.github/workflows/fluent_linter.yml
vendored
@ -25,19 +25,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Python 3.14
|
- name: Use Python 3.13
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.14'
|
python-version: '3.13'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: '.github/fluent_linter_requirements.txt'
|
|
||||||
|
|
||||||
- name: Install requirements
|
- name: Install Fluent dependencies
|
||||||
run: pip install -r .github/fluent_linter_requirements.txt
|
run: |
|
||||||
|
pip install -r .github/requirements.txt
|
||||||
|
|
||||||
- name: Lint Fluent reference files
|
- name: Lint Fluent reference files
|
||||||
run: moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml
|
run: |
|
||||||
|
moz-fluent-lint ./l10n/en-US --config .github/fluent_linter_config.yml
|
||||||
|
|||||||
44
.github/workflows/font_tests.yml
vendored
44
.github/workflows/font_tests.yml
vendored
@ -3,7 +3,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'gulpfile.mjs'
|
- 'gulpfile.mjs'
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- 'test/test.mjs'
|
- 'test/test.mjs'
|
||||||
- 'test/font/**'
|
- 'test/font/**'
|
||||||
@ -13,7 +12,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'gulpfile.mjs'
|
- 'gulpfile.mjs'
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- 'test/test.mjs'
|
- 'test/test.mjs'
|
||||||
- 'test/font/**'
|
- 'test/font/**'
|
||||||
@ -26,60 +24,38 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: ${{ matrix.os }} / ${{ matrix.browser }}
|
name: Test
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [lts/*]
|
node-version: [lts/*]
|
||||||
os: [windows-latest, ubuntu-latest]
|
os: [windows-latest, ubuntu-latest]
|
||||||
browser: [firefox, chrome]
|
|
||||||
include:
|
|
||||||
- browser: firefox
|
|
||||||
skip: --noChrome
|
|
||||||
- browser: chrome
|
|
||||||
skip: --noFirefox
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
environment: code-coverage
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Use Python 3.14
|
- name: Use Python 3.13
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.0.2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.14'
|
python-version: '3.13'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: '.github/font_tests_requirements.txt'
|
|
||||||
|
|
||||||
- name: Install requirements
|
- name: Install Fonttools
|
||||||
run: pip install -r .github/font_tests_requirements.txt
|
run: pip install fonttools
|
||||||
|
|
||||||
- name: Run font tests with code coverage
|
- name: Run font tests
|
||||||
run: npx gulp fonttest --headless --coverage --coverage-output build/coverage/font ${{ matrix.skip }}
|
run: npx gulp fonttest --headless
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./build/coverage/font/lcov.info
|
|
||||||
flags: fonttest
|
|
||||||
name: codecov-umbrella
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
verbose: true
|
|
||||||
|
|||||||
106
.github/workflows/integration_tests.yml
vendored
106
.github/workflows/integration_tests.yml
vendored
@ -1,106 +0,0 @@
|
|||||||
name: Integration tests
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/integration/**'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/integration_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/integration/**'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/integration_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: ${{ matrix.os }} / ${{ matrix.browser }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
node-version: [lts/*]
|
|
||||||
os: [windows-latest, ubuntu-latest]
|
|
||||||
browser: [firefox, chrome]
|
|
||||||
include:
|
|
||||||
- browser: firefox
|
|
||||||
skip: --noChrome
|
|
||||||
- browser: chrome
|
|
||||||
skip: --noFirefox
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
environment: code-coverage
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Restore cached PDF files
|
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
restore-keys: |
|
|
||||||
cached-pdf-files-
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
# Note that the integration tests can't run in headless mode until bug
|
|
||||||
# 1878643 (tracked in #20918), and possibly others, have been fixed
|
|
||||||
# upstream, so we can't run with the `--headless` flag and thus have to
|
|
||||||
# configure a standard resolution for the headful browser windows.
|
|
||||||
- name: Update resolution (Windows)
|
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
|
||||||
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
|
|
||||||
|
|
||||||
- name: Run integration tests with code coverage (Windows)
|
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
|
||||||
run: npx gulp integrationtest --coverage --coverage-output build/coverage/integration ${{ matrix.skip }}
|
|
||||||
|
|
||||||
- name: Run integration tests with code coverage (Linux)
|
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
||||||
run: xvfb-run -a --server-args="-screen 0, 1920x1080x24" npx gulp integrationtest --coverage --coverage-output build/coverage/integration ${{ matrix.skip }}
|
|
||||||
|
|
||||||
- name: Save cached PDF files
|
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./build/coverage/integration/lcov.info
|
|
||||||
flags: integrationtest
|
|
||||||
name: codecov-umbrella
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
verbose: true
|
|
||||||
10
.github/workflows/lint.yml
vendored
10
.github/workflows/lint.yml
vendored
@ -15,16 +15,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -32,5 +30,5 @@ jobs:
|
|||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: npx gulp lint
|
run: npx gulp lint
|
||||||
|
|
||||||
- name: Run lint-mozcentral
|
- name: Run lint-chromium
|
||||||
run: npx gulp lint-mozcentral
|
run: npx gulp lint-chromium
|
||||||
|
|||||||
77
.github/workflows/notify-pdf-sync.yml
vendored
77
.github/workflows/notify-pdf-sync.yml
vendored
@ -1,77 +0,0 @@
|
|||||||
name: Notify PDF sync
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
paths:
|
|
||||||
- "test/pdfs/*.pdf"
|
|
||||||
- "test/pdfs/*.pdf.link"
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
notify:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: sync_pdfs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Check for added PDF files
|
|
||||||
id: check
|
|
||||||
run: |
|
|
||||||
git fetch --no-tags --depth=1 origin ${{ github.event.before }}
|
|
||||||
|
|
||||||
mapfile -t added < <(
|
|
||||||
git diff --diff-filter=A --name-only \
|
|
||||||
${{ github.event.before }} \
|
|
||||||
${{ github.sha }} \
|
|
||||||
-- \
|
|
||||||
':(glob)test/pdfs/*.pdf' \
|
|
||||||
':(glob)test/pdfs/*.pdf.link'
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${#added[@]}" -gt 0 ]; then
|
|
||||||
echo "has_added=true" >> "$GITHUB_OUTPUT"
|
|
||||||
printf 'files_json=%s\n' "$(printf '%s\n' "${added[@]}" | jq -Rsc 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "has_added=false" >> "$GITHUB_OUTPUT"
|
|
||||||
echo 'files_json=[]' >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate app token
|
|
||||||
if: steps.check.outputs.has_added == 'true'
|
|
||||||
id: app-token
|
|
||||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.CLIENT_ID }}
|
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
||||||
owner: mozilla
|
|
||||||
repositories: pdf.js.pdfs
|
|
||||||
|
|
||||||
- name: Trigger sync
|
|
||||||
if: steps.check.outputs.has_added == 'true'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
||||||
FILES_JSON: ${{ steps.check.outputs.files_json }}
|
|
||||||
run: |
|
|
||||||
payload=$(jq -nc \
|
|
||||||
--arg before "${{ github.event.before }}" \
|
|
||||||
--arg after "${{ github.sha }}" \
|
|
||||||
--argjson files "$FILES_JSON" \
|
|
||||||
'{
|
|
||||||
event_type: "pdf-added",
|
|
||||||
client_payload: {
|
|
||||||
before: $before,
|
|
||||||
after: $after,
|
|
||||||
files: $files
|
|
||||||
}
|
|
||||||
}')
|
|
||||||
|
|
||||||
gh api repos/mozilla/pdf.js.pdfs/dispatches \
|
|
||||||
--method POST \
|
|
||||||
--input - <<< "$payload"
|
|
||||||
33
.github/workflows/prefs_tests.yml
vendored
33
.github/workflows/prefs_tests.yml
vendored
@ -1,33 +0,0 @@
|
|||||||
name: Prefs tests
|
|
||||||
on: [push, pull_request]
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
node-version: [lts/*]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run prefs tests
|
|
||||||
run: npx gulp prefstest
|
|
||||||
10
.github/workflows/publish_release.yml
vendored
10
.github/workflows/publish_release.yml
vendored
@ -17,16 +17,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@ -36,4 +34,6 @@ jobs:
|
|||||||
run: npx gulp dist
|
run: npx gulp dist
|
||||||
|
|
||||||
- name: Publish the `pdfjs-dist` library to NPM
|
- name: Publish the `pdfjs-dist` library to NPM
|
||||||
run: npm publish ./build/dist
|
run: npm publish ./build/dist --provenance
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
10
.github/workflows/publish_website.yml
vendored
10
.github/workflows/publish_website.yml
vendored
@ -17,16 +17,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -51,7 +49,7 @@ jobs:
|
|||||||
INPUT_PATH: build/gh-pages
|
INPUT_PATH: build/gh-pages
|
||||||
|
|
||||||
- name: Upload the website
|
- name: Upload the website
|
||||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
path: ${{ runner.temp }}/website.tar
|
path: ${{ runner.temp }}/website.tar
|
||||||
@ -68,4 +66,4 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy the website
|
- name: Deploy the website
|
||||||
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
|
uses: actions/deploy-pages@v4
|
||||||
|
|||||||
6
.github/workflows/types_tests.yml
vendored
6
.github/workflows/types_tests.yml
vendored
@ -15,16 +15,14 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|||||||
93
.github/workflows/unit_tests.yml
vendored
93
.github/workflows/unit_tests.yml
vendored
@ -1,93 +0,0 @@
|
|||||||
name: Unit tests
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/unit/**'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/unit_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'gulpfile.mjs'
|
|
||||||
- 'external/**'
|
|
||||||
- 'src/**'
|
|
||||||
- 'test/test.mjs'
|
|
||||||
- 'test/unit/**'
|
|
||||||
- 'web/**'
|
|
||||||
- '.github/workflows/unit_tests.yml'
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
workflow_dispatch:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: ${{ matrix.os }} / ${{ matrix.browser }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
node-version: [lts/*]
|
|
||||||
os: [windows-latest, ubuntu-latest]
|
|
||||||
browser: [firefox, chrome]
|
|
||||||
include:
|
|
||||||
- browser: firefox
|
|
||||||
skip: --noChrome
|
|
||||||
- browser: chrome
|
|
||||||
skip: --noFirefox
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
environment: code-coverage
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Restore cached PDF files
|
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
restore-keys: |
|
|
||||||
cached-pdf-files-
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Run unit tests with code coverage
|
|
||||||
run: npx gulp unittest --headless --coverage --coverage-output build/coverage/unit ${{ matrix.skip }}
|
|
||||||
|
|
||||||
- name: Save cached PDF files
|
|
||||||
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
|
||||||
with:
|
|
||||||
path: test/pdfs/*.pdf
|
|
||||||
key: cached-pdf-files-${{ hashFiles('test/pdfs/*.pdf') }}
|
|
||||||
enableCrossOsArchive: true
|
|
||||||
|
|
||||||
- name: Upload results to Codecov
|
|
||||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
fail_ci_if_error: true
|
|
||||||
files: ./build/coverage/unit/lcov.info
|
|
||||||
flags: unittest
|
|
||||||
name: codecov-umbrella
|
|
||||||
disable_search: true
|
|
||||||
disable_telem: true
|
|
||||||
verbose: true
|
|
||||||
61
.github/workflows/update_locales.yml
vendored
61
.github/workflows/update_locales.yml
vendored
@ -1,61 +0,0 @@
|
|||||||
name: Update locales
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * 5" # Every Friday at midnight UTC
|
|
||||||
workflow_dispatch: # Allow manual triggering
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update-locales:
|
|
||||||
name: Update locales
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
environment: sync_l10n
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Generate app token
|
|
||||||
id: app-token
|
|
||||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.CLIENT_ID }}
|
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
||||||
with:
|
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Use Node.js LTS
|
|
||||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
||||||
with:
|
|
||||||
node-version: lts/*
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Import translations from mozilla-central
|
|
||||||
run: npx gulp importl10n
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
||||||
run: |
|
|
||||||
if [ -z "$(git status --porcelain l10n/)" ]; then
|
|
||||||
echo "No locale changes to commit."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}"
|
|
||||||
git switch -C update-locales
|
|
||||||
git add l10n/
|
|
||||||
git commit -m "l10n: Update locale files"
|
|
||||||
git push --force origin update-locales
|
|
||||||
gh pr create \
|
|
||||||
--title "l10n: Update locale files" \
|
|
||||||
--body "Automated weekly update of locale files from mozilla-central." \
|
|
||||||
--label l10n || true
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,4 +7,3 @@ Makefile
|
|||||||
node_modules/
|
node_modules/
|
||||||
examples/node/svgdump/
|
examples/node/svgdump/
|
||||||
examples/node/pdf2png/*.png
|
examples/node/pdf2png/*.png
|
||||||
.vscode/
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"firefox-devtools": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["@padenot/firefox-devtools-mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,6 +13,3 @@ test/tmp/
|
|||||||
test/pdfs/
|
test/pdfs/
|
||||||
web/locale/
|
web/locale/
|
||||||
*~/
|
*~/
|
||||||
.claude/
|
|
||||||
.codex/
|
|
||||||
.cursor/
|
|
||||||
|
|||||||
15
.prettierrc
15
.prettierrc
@ -9,17 +9,10 @@
|
|||||||
|
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": ["tsconfig.json", ".prettierrc"],
|
files: ["tsconfig.json"],
|
||||||
"options": {
|
options: {
|
||||||
"parser": "json"
|
parser: "json",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"files": ["**/*.html"],
|
|
||||||
"options": {
|
|
||||||
"parser": "html",
|
|
||||||
"printWidth": 160
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
9
.puppeteerrc
Normal file
9
.puppeteerrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"chrome": {
|
||||||
|
"skipDownload": false
|
||||||
|
},
|
||||||
|
"firefox": {
|
||||||
|
"skipDownload": false,
|
||||||
|
"version": "nightly"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"chrome": {
|
|
||||||
"skipDownload": true,
|
|
||||||
"version": "stable"
|
|
||||||
},
|
|
||||||
"chrome-headless-shell": {
|
|
||||||
"skipDownload": true
|
|
||||||
},
|
|
||||||
"firefox": {
|
|
||||||
"skipDownload": true,
|
|
||||||
"version": "nightly"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,10 +13,13 @@
|
|||||||
"color-no-invalid-hex": true,
|
"color-no-invalid-hex": true,
|
||||||
"declaration-block-no-duplicate-properties": true,
|
"declaration-block-no-duplicate-properties": true,
|
||||||
"declaration-block-no-redundant-longhand-properties": true,
|
"declaration-block-no-redundant-longhand-properties": true,
|
||||||
|
"declaration-property-value-disallowed-list": {
|
||||||
|
"float": ["inline-start", "inline-end"]
|
||||||
|
},
|
||||||
"length-zero-no-unit": [true, {
|
"length-zero-no-unit": [true, {
|
||||||
"ignore": ["custom-properties"]
|
ignore: ["custom-properties"]
|
||||||
}],
|
}],
|
||||||
"selector-pseudo-element-colon-notation": "double",
|
"selector-pseudo-element-colon-notation": "double",
|
||||||
"shorthand-property-no-redundant-values": true
|
"shorthand-property-no-redundant-values": true,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
204
AGENTS.md
204
AGENTS.md
@ -1,204 +0,0 @@
|
|||||||
## Overview
|
|
||||||
|
|
||||||
PDF.js is a Portable Document Format (PDF) viewer built with JavaScript, HTML5 Canvas, and CSS. It's a Mozilla project that provides a general-purpose, web standards-based platform for parsing and rendering PDFs without requiring native code or plugins.
|
|
||||||
|
|
||||||
## Common Commands
|
|
||||||
|
|
||||||
### Development Server
|
|
||||||
```bash
|
|
||||||
npx gulp server
|
|
||||||
```
|
|
||||||
Then open http://localhost:8888/web/viewer.html to view the PDF viewer. Test PDFs are available at http://localhost:8888/test/pdfs/?frame
|
|
||||||
|
|
||||||
### Building
|
|
||||||
|
|
||||||
Build for modern browsers:
|
|
||||||
```bash
|
|
||||||
npx gulp generic
|
|
||||||
```
|
|
||||||
|
|
||||||
This generates `pdf.js` and `pdf.worker.js` in `build/generic/build/`.
|
|
||||||
|
|
||||||
Build for distribution (creates pdfjs-dist package):
|
|
||||||
```bash
|
|
||||||
npx gulp dist
|
|
||||||
npx gulp dist-install # Build and install locally
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
Run all tests:
|
|
||||||
```bash
|
|
||||||
npx gulp test
|
|
||||||
```
|
|
||||||
|
|
||||||
Run unit tests only:
|
|
||||||
```bash
|
|
||||||
npx gulp unittest
|
|
||||||
```
|
|
||||||
|
|
||||||
Run integration tests (browser-based tests using Puppeteer):
|
|
||||||
```bash
|
|
||||||
npx gulp integrationtest
|
|
||||||
```
|
|
||||||
|
|
||||||
Run font tests:
|
|
||||||
```bash
|
|
||||||
npx gulp fonttest
|
|
||||||
```
|
|
||||||
|
|
||||||
Run a single test file by modifying test/test_manifest.json or using test runner options.
|
|
||||||
|
|
||||||
### Linting and Formatting
|
|
||||||
|
|
||||||
Lint JavaScript:
|
|
||||||
```bash
|
|
||||||
npx gulp lint
|
|
||||||
```
|
|
||||||
|
|
||||||
Format code (uses Prettier and ESLint):
|
|
||||||
```bash
|
|
||||||
npx eslint --fix <file>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Type Checking
|
|
||||||
|
|
||||||
Run TypeScript type checking:
|
|
||||||
```bash
|
|
||||||
npx gulp typestest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
### High-Level Structure
|
|
||||||
|
|
||||||
PDF.js has a multi-layer architecture that separates concerns between PDF parsing, rendering, and UI:
|
|
||||||
|
|
||||||
#### 1. Core Layer (`src/core/`)
|
|
||||||
The core layer handles PDF parsing and interpretation. Key responsibilities:
|
|
||||||
- **PDF parsing**: Parsing PDF structure, cross-reference tables, streams
|
|
||||||
- **Font handling**: CFF, TrueType, Type1 font parsing and conversion (`font.js`, `fonts.js`, `cff_*.js`, `type1_*.js`)
|
|
||||||
- **Image decoding**: JPEG, JBIG2, JPX/JPEG2000 decoders
|
|
||||||
- **Operators**: Processing PDF drawing operators (`operator_list.js`, `evaluator.js`)
|
|
||||||
- **XFA Forms**: XML Forms Architecture support (`src/core/xfa/`)
|
|
||||||
- **Color spaces**: ICC profiles, device color spaces (`colorspace.js`, `icc_colorspace.js`)
|
|
||||||
- Runs in a Web Worker for performance isolation
|
|
||||||
|
|
||||||
Entry point: `src/pdf.worker.js`
|
|
||||||
|
|
||||||
#### 2. Display Layer (`src/display/`)
|
|
||||||
The display layer provides the API for rendering PDFs to canvas and managing documents. Key components:
|
|
||||||
- **API**: Main public API (`api.js`) - `PDFDocumentProxy`, `PDFPageProxy`, `getDocument()`
|
|
||||||
- **Canvas rendering**: Renders PDF operations to HTML5 canvas (`canvas.js`)
|
|
||||||
- **Text layer**: Extracts and positions text for selection/search (`text_layer.js`)
|
|
||||||
- **Annotation layer**: Renders and handles PDF annotations (`annotation_layer.js`)
|
|
||||||
- **Editor layer**: Supports PDF editing (annotations, highlights, stamps) (`editor/`)
|
|
||||||
- **Metadata**: Parses XMP metadata (`metadata.js`)
|
|
||||||
- **Streams**: Handles PDF data fetching (fetch, network, node) (`fetch_stream.js`, `network.js`, `node_stream.js`)
|
|
||||||
|
|
||||||
Entry point: `src/pdf.js`
|
|
||||||
|
|
||||||
#### 3. Scripting Layer (`src/scripting_api/`)
|
|
||||||
Implements JavaScript execution for interactive PDFs (form calculations, validations, button actions).
|
|
||||||
- Sandboxed execution environment
|
|
||||||
- Implements Acrobat JavaScript API objects (App, Doc, Field, etc.)
|
|
||||||
|
|
||||||
Entry points: `src/pdf.scripting.js`, `src/pdf.sandbox.js`
|
|
||||||
|
|
||||||
#### 4. Web Viewer (`web/`)
|
|
||||||
The complete PDF viewer application with UI. Key components:
|
|
||||||
- **Main app**: Application orchestration (`app.js`)
|
|
||||||
- **Viewer**: Page rendering and layout (`pdf_viewer.js`, `pdf_page_view.js`)
|
|
||||||
- **Toolbar**: Zoom, page navigation, print, download controls
|
|
||||||
- **Sidebar**: Thumbnails, outlines, attachments (`pdf_sidebar.js`, `pdf_thumbnail_view.js`, `pdf_outline_viewer.js`)
|
|
||||||
- **Find controller**: Text search functionality (`pdf_find_controller.js`)
|
|
||||||
- **Annotation editors**: UI for creating/editing annotations (`annotation_editor_layer_builder.js`)
|
|
||||||
- **Presentation mode**: Full-screen presentation (`pdf_presentation_mode.js`)
|
|
||||||
|
|
||||||
Entry point: `web/viewer.html` + `web/viewer.mjs`
|
|
||||||
|
|
||||||
#### 5. Shared Utilities (`src/shared/`)
|
|
||||||
Common utilities used across layers:
|
|
||||||
- **Message handling**: Worker communication (`message_handler.js`)
|
|
||||||
- **Utilities**: Common functions and constants (`util.js`)
|
|
||||||
- **Image utilities**: Image processing helpers (`image_utils.js`)
|
|
||||||
|
|
||||||
### Worker Communication
|
|
||||||
|
|
||||||
PDF.js uses a Web Worker architecture:
|
|
||||||
- Main thread (`display` layer) communicates with worker thread (`core` layer) via `MessageHandler`
|
|
||||||
- Keeps PDF parsing off the main thread for better performance
|
|
||||||
- Messages include: page rendering requests, text content extraction, metadata queries
|
|
||||||
|
|
||||||
### Build System
|
|
||||||
|
|
||||||
- Uses **Gulp** for build orchestration (`gulpfile.mjs`)
|
|
||||||
- **Webpack** bundles modules into browser-compatible formats
|
|
||||||
- **Babel** transpiles for browser compatibility (configurable targets in gulpfile)
|
|
||||||
- Preprocessor replaces build-time constants (e.g., `typeof PDFJSDev !== "undefined"` checks)
|
|
||||||
- Multiple build targets: generic, components, minified, legacy (older browser support)
|
|
||||||
|
|
||||||
### External Dependencies
|
|
||||||
|
|
||||||
Located in `external/`:
|
|
||||||
- **bcmaps**: Binary CMaps for CJK fonts
|
|
||||||
- **standard_fonts**: Core 14 PDF fonts metrics
|
|
||||||
- **cmapscompress**: Tools for compressing CMaps
|
|
||||||
- **openjpeg**: JPEG2000 decoder (WASM)
|
|
||||||
- **quickjs**: JavaScript engine for sandboxed execution
|
|
||||||
|
|
||||||
### Translations
|
|
||||||
|
|
||||||
Translations in `l10n/` are imported from Mozilla Firefox Nightly. Only the file l10n/en-US/viewer.ftl can be updated.
|
|
||||||
|
|
||||||
## Development Notes
|
|
||||||
|
|
||||||
### Adding New Features
|
|
||||||
|
|
||||||
When adding features that span multiple layers:
|
|
||||||
1. Start with the `core` layer if parsing/interpretation changes are needed
|
|
||||||
2. Update the `display` layer API if new capabilities need exposure
|
|
||||||
3. Modify the `web` viewer if UI changes are required
|
|
||||||
4. Ensure worker communication handles new message types
|
|
||||||
|
|
||||||
### Preprocessor Directives
|
|
||||||
|
|
||||||
Code uses preprocessor checks for build-time conditionals:
|
|
||||||
```javascript
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("GENERIC")) {
|
|
||||||
// Generic build-specific code
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Common flags: `GENERIC`, `MOZCENTRAL`, `CHROME`, `MINIFIED`, `TESTING`, `LIB`, `SKIP_BABEL`, `IMAGE_DECODERS`
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
- Unit tests use Jasmine framework (`test/unit/`)
|
|
||||||
- Integration tests use Puppeteer for browser automation (`test/integration/`)
|
|
||||||
- Test PDFs downloaded from manifest (`test/test_manifest.json`)
|
|
||||||
- Reference images for visual regression testing (`test/ref/`)
|
|
||||||
|
|
||||||
### Code Style
|
|
||||||
|
|
||||||
- Uses ESLint with custom configuration (`eslint.config.mjs`)
|
|
||||||
- Prettier for formatting
|
|
||||||
- Stylelint for CSS
|
|
||||||
- No semicolons required (ASI enabled)
|
|
||||||
- Single quotes for strings
|
|
||||||
|
|
||||||
### Pull Request Process
|
|
||||||
|
|
||||||
- Keep PRs focused on a single issue
|
|
||||||
- Provide a test PDF if the issue is PDF-specific
|
|
||||||
- Ensure tests pass (`npx gulp test`)
|
|
||||||
- Run linting (`npx gulp lint`)
|
|
||||||
- Follow existing code patterns
|
|
||||||
- Don't modify translations directly (they come from Firefox)
|
|
||||||
|
|
||||||
### Performance Considerations
|
|
||||||
|
|
||||||
- Core parsing runs in a Web Worker - keep main thread work minimal
|
|
||||||
- Canvas rendering can be expensive - use appropriate scale factors
|
|
||||||
- Text layer generation is separate from rendering - can be deferred
|
|
||||||
- Annotation layer is optional - only enable when needed
|
|
||||||
71
README.md
71
README.md
@ -1,4 +1,4 @@
|
|||||||
# PDF.js [](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml?query=branch%3Amaster) [](https://codecov.io/gh/mozilla/pdf.js)
|
# PDF.js [](https://github.com/mozilla/pdf.js/actions/workflows/ci.yml?query=branch%3Amaster)
|
||||||
|
|
||||||
[PDF.js](https://mozilla.github.io/pdf.js/) is a Portable Document Format (PDF) viewer that is built with HTML5.
|
[PDF.js](https://mozilla.github.io/pdf.js/) is a Portable Document Format (PDF) viewer that is built with HTML5.
|
||||||
|
|
||||||
@ -44,10 +44,6 @@ PDF.js is built into version 19+ of Firefox.
|
|||||||
Chrome, go to `Tools > Extension` and load the (unpackaged) extension from the
|
Chrome, go to `Tools > Extension` and load the (unpackaged) extension from the
|
||||||
directory `build/chromium`.
|
directory `build/chromium`.
|
||||||
|
|
||||||
### PDF debugger
|
|
||||||
|
|
||||||
Browse the internal structure of a PDF document with https://mozilla.github.io/pdf.js/internal-viewer/web/debugger.html
|
|
||||||
|
|
||||||
## Getting the Code
|
## Getting the Code
|
||||||
|
|
||||||
To get a local copy of the current code, clone it using git:
|
To get a local copy of the current code, clone it using git:
|
||||||
@ -91,71 +87,6 @@ This will generate `pdf.js` and `pdf.worker.js` in the `build/generic/build/` di
|
|||||||
Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will
|
Both scripts are needed but only `pdf.js` needs to be included since `pdf.worker.js` will
|
||||||
be loaded by `pdf.js`. The PDF.js files are large and should be minified for production.
|
be loaded by `pdf.js`. The PDF.js files are large and should be minified for production.
|
||||||
|
|
||||||
## Code coverage
|
|
||||||
|
|
||||||
We track how much of the code is exercised by the test suite on
|
|
||||||
[Codecov](https://codecov.io/gh/mozilla/pdf.js) (see the badge at the top of this
|
|
||||||
file).
|
|
||||||
|
|
||||||
### How it is collected
|
|
||||||
|
|
||||||
When coverage is enabled, the build instruments the bundled code with
|
|
||||||
[`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul),
|
|
||||||
which adds counters that record every line, branch and function that runs:
|
|
||||||
|
|
||||||
+ For browser-based tests (unit, integration and reference tests) the
|
|
||||||
instrumented code runs in the browser, fills a global `window.__coverage__`
|
|
||||||
object, and the test runner collects it from each browser session, merges the
|
|
||||||
results, and writes the report.
|
|
||||||
+ For the Node-based unit tests (`unittestcli`) the raw data is written to
|
|
||||||
`build/tmp/unittestcli-coverage.json` and turned into a report afterwards.
|
|
||||||
|
|
||||||
### Collecting coverage locally
|
|
||||||
|
|
||||||
Add the `--coverage` flag to any of the test tasks, for example:
|
|
||||||
|
|
||||||
$ npx gulp unittest --coverage # browser unit tests
|
|
||||||
$ npx gulp unittestcli --coverage # Node unit tests
|
|
||||||
$ npx gulp integrationtest --coverage # Puppeteer integration tests
|
|
||||||
$ npx gulp botbrowsertest --coverage # reference tests
|
|
||||||
|
|
||||||
The following options control the output:
|
|
||||||
|
|
||||||
| Option | Description | Default |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| `--coverage` | Enable coverage collection. | off |
|
|
||||||
| `--coverage-output <dir>` | Directory where the report is written. | `build/coverage` |
|
|
||||||
| `--coverage-formats <list>` | Comma-separated list of formats: `info`, `html`, `json`, `text`, `cobertura`, `clover`. | `info` |
|
|
||||||
| `--coverage-per-test` | Also build a per-test index (see below). | off |
|
|
||||||
|
|
||||||
By default the report is written to `build/coverage` in the `info` format, i.e.
|
|
||||||
an [LCOV](https://github.com/linux-test-project/lcov) `lcov.info` file (the same
|
|
||||||
format that is uploaded to Codecov). Use `--coverage-formats html` to get a
|
|
||||||
browsable HTML report instead, or pass several formats at once, e.g.
|
|
||||||
`--coverage-formats info,html`.
|
|
||||||
|
|
||||||
### Finding which tests cover a given line
|
|
||||||
|
|
||||||
Run a browser test task with `--coverage-per-test` to build an index
|
|
||||||
(`per-test-index.json`) in the coverage directory, then query it to list the
|
|
||||||
tests that exercised a specific source line or function:
|
|
||||||
|
|
||||||
$ npx gulp botbrowsertest --coverage-per-test
|
|
||||||
$ npx gulp coverage_search --code="canvas.js::205"
|
|
||||||
$ npx gulp coverage_search --code="canvas.js::drawImageAtIntegerCoords"
|
|
||||||
|
|
||||||
### Continuous integration
|
|
||||||
|
|
||||||
On every push and pull request three GitHub Actions workflows collect coverage
|
|
||||||
and upload it to Codecov, each tagged with its own Codecov *flag* so the test
|
|
||||||
types can be told apart:
|
|
||||||
|
|
||||||
| Workflow | Task | Codecov flag |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| `unit_tests.yml` | `unittest` | `unittest` |
|
|
||||||
| `integration_tests.yml` | `integrationtest` | `integrationtest` |
|
|
||||||
| `coverage_browser_tests.yml` | `botbrowsertest` | `browsertest` |
|
|
||||||
|
|
||||||
## Using PDF.js in a web application
|
## Using PDF.js in a web application
|
||||||
|
|
||||||
To use PDF.js in a web application you can choose to use a pre-built version of the library
|
To use PDF.js in a web application you can choose to use a pre-built version of the library
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
flag_management:
|
|
||||||
default_rules:
|
|
||||||
carryforward: true
|
|
||||||
@ -18,13 +18,13 @@ This tutorial shows how PDF.js can be used as a library in a web browser.
|
|||||||
The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document:
|
The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
pdfjsLib.getDocument({ url: "helloworld.pdf" })
|
pdfjsLib.getDocument('helloworld.pdf')
|
||||||
```
|
```
|
||||||
|
|
||||||
Remember though that PDF.js uses promises, and the above will return a `PDFDocumentLoadingTask` instance that has a `promise` property which is resolved with the document object.
|
Remember though that PDF.js uses promises, and the above will return a `PDFDocumentLoadingTask` instance that has a `promise` property which is resolved with the document object.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var loadingTask = pdfjsLib.getDocument({ url: "helloworld.pdf" });
|
var loadingTask = pdfjsLib.getDocument('helloworld.pdf');
|
||||||
loadingTask.promise.then(function(pdf) {
|
loadingTask.promise.then(function(pdf) {
|
||||||
// you can now use *pdf* here
|
// you can now use *pdf* here
|
||||||
});
|
});
|
||||||
@ -48,8 +48,8 @@ var viewport = page.getViewport({ scale: scale, });
|
|||||||
// Support HiDPI-screens.
|
// Support HiDPI-screens.
|
||||||
var outputScale = window.devicePixelRatio || 1;
|
var outputScale = window.devicePixelRatio || 1;
|
||||||
|
|
||||||
var canvas = document.getElementById("the-canvas");
|
var canvas = document.getElementById('the-canvas');
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext('2d');
|
||||||
|
|
||||||
canvas.width = Math.floor(viewport.width * outputScale);
|
canvas.width = Math.floor(viewport.width * outputScale);
|
||||||
canvas.height = Math.floor(viewport.height * outputScale);
|
canvas.height = Math.floor(viewport.height * outputScale);
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
import globals from "globals";
|
import globals from "globals";
|
||||||
|
|
||||||
import import_ from "eslint-plugin-import-x";
|
import import_ from "eslint-plugin-import";
|
||||||
import jasmine from "eslint-plugin-jasmine";
|
import jasmine from "eslint-plugin-jasmine";
|
||||||
import json from "@eslint/json";
|
import json from "eslint-plugin-json";
|
||||||
import noUnsanitized from "eslint-plugin-no-unsanitized";
|
import noUnsanitized from "eslint-plugin-no-unsanitized";
|
||||||
import perfectionist from "eslint-plugin-perfectionist";
|
import perfectionist from "eslint-plugin-perfectionist";
|
||||||
import preferMathClamp from "./external/eslint_plugins/prefer-math-clamp.mjs";
|
|
||||||
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
||||||
import regexpPlugin from "eslint-plugin-regexp";
|
|
||||||
import unicorn from "eslint-plugin-unicorn";
|
import unicorn from "eslint-plugin-unicorn";
|
||||||
|
|
||||||
const jsFiles = folder => {
|
const jsFiles = folder => {
|
||||||
@ -28,18 +26,15 @@ const chromiumExtensionServiceWorkerFiles = [
|
|||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
ignores: [
|
ignores: [
|
||||||
"package-lock.json",
|
|
||||||
"**/build/",
|
"**/build/",
|
||||||
"**/l10n/",
|
"**/l10n/",
|
||||||
"**/docs/",
|
"**/docs/",
|
||||||
"**/node_modules/",
|
"**/node_modules/",
|
||||||
"external/bcmaps/",
|
"external/bcmaps/",
|
||||||
"external/brotli/",
|
|
||||||
"external/builder/fixtures/",
|
"external/builder/fixtures/",
|
||||||
"external/builder/fixtures_babel/",
|
"external/builder/fixtures_babel/",
|
||||||
"external/openjpeg/",
|
"external/openjpeg/",
|
||||||
"external/qcms/",
|
"external/qcms/",
|
||||||
"external/jbig2/",
|
|
||||||
"external/quickjs/",
|
"external/quickjs/",
|
||||||
"test/stats/results/",
|
"test/stats/results/",
|
||||||
"test/tmp/",
|
"test/tmp/",
|
||||||
@ -47,7 +42,6 @@ export default [
|
|||||||
"web/locale/",
|
"web/locale/",
|
||||||
"web/wasm/",
|
"web/wasm/",
|
||||||
"**/*~/",
|
"**/*~/",
|
||||||
".{claude,codex,cursor}/",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -57,16 +51,7 @@ export default [
|
|||||||
|
|
||||||
prettierRecommended,
|
prettierRecommended,
|
||||||
{
|
{
|
||||||
files: jsFiles("."),
|
files: ["**/*.json"],
|
||||||
plugins: regexpPlugin.configs["flat/recommended"].plugins,
|
|
||||||
rules: {
|
|
||||||
...regexpPlugin.configs["flat/recommended"].rules,
|
|
||||||
"regexp/no-legacy-features": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["**/*.json", "**/.*.json"],
|
|
||||||
language: "json/json",
|
|
||||||
...json.configs.recommended,
|
...json.configs.recommended,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -80,24 +65,18 @@ export default [
|
|||||||
files: jsFiles("."),
|
files: jsFiles("."),
|
||||||
|
|
||||||
plugins: {
|
plugins: {
|
||||||
import: import_.flatConfigs.recommended.plugins["import-x"],
|
import: import_.flatConfigs.recommended.plugins.import,
|
||||||
json,
|
json,
|
||||||
"no-unsanitized": noUnsanitized,
|
"no-unsanitized": noUnsanitized,
|
||||||
perfectionist,
|
perfectionist,
|
||||||
"prefer-math-clamp": preferMathClamp,
|
|
||||||
unicorn,
|
unicorn,
|
||||||
},
|
},
|
||||||
|
|
||||||
settings: {
|
|
||||||
"import-x/resolver-next": [import_.createNodeResolver()],
|
|
||||||
},
|
|
||||||
|
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
...globals.worker,
|
...globals.worker,
|
||||||
PDFJSDev: "readonly",
|
PDFJSDev: "readonly",
|
||||||
__raw_import__: "readonly",
|
__raw_import__: "readonly",
|
||||||
__eager_import__: "readonly",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ecmaVersion: 2025,
|
ecmaVersion: 2025,
|
||||||
@ -135,13 +114,8 @@ export default [
|
|||||||
"pdfjs-lib",
|
"pdfjs-lib",
|
||||||
"pdfjs-web",
|
"pdfjs-web",
|
||||||
"web",
|
"web",
|
||||||
"@csstools/postcss-light-dark-function",
|
|
||||||
"fluent-bundle",
|
"fluent-bundle",
|
||||||
"fluent-dom",
|
"fluent-dom",
|
||||||
"postcss-dir-pseudo-class",
|
|
||||||
"postcss-nesting",
|
|
||||||
"postcss-values-parser",
|
|
||||||
"stylelint",
|
|
||||||
// See https://github.com/firebase/firebase-admin-node/discussions/1359.
|
// See https://github.com/firebase/firebase-admin-node/discussions/1359.
|
||||||
"eslint-plugin-perfectionist",
|
"eslint-plugin-perfectionist",
|
||||||
],
|
],
|
||||||
@ -152,6 +126,7 @@ export default [
|
|||||||
"perfectionist/sort-exports": "error",
|
"perfectionist/sort-exports": "error",
|
||||||
"perfectionist/sort-named-exports": "error",
|
"perfectionist/sort-named-exports": "error",
|
||||||
"unicorn/no-abusive-eslint-disable": "error",
|
"unicorn/no-abusive-eslint-disable": "error",
|
||||||
|
"unicorn/no-array-push-push": "error",
|
||||||
"unicorn/no-array-reduce": ["error", { allowSimpleOperations: true }],
|
"unicorn/no-array-reduce": ["error", { allowSimpleOperations: true }],
|
||||||
"unicorn/no-console-spaces": "error",
|
"unicorn/no-console-spaces": "error",
|
||||||
"unicorn/no-instanceof-builtins": "error",
|
"unicorn/no-instanceof-builtins": "error",
|
||||||
@ -159,10 +134,6 @@ export default [
|
|||||||
"unicorn/no-new-buffer": "error",
|
"unicorn/no-new-buffer": "error",
|
||||||
"unicorn/no-single-promise-in-promise-methods": "error",
|
"unicorn/no-single-promise-in-promise-methods": "error",
|
||||||
"unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }],
|
"unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }],
|
||||||
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
||||||
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
||||||
"unicorn/no-unnecessary-slice-end": "error",
|
|
||||||
"unicorn/no-useless-collection-argument": "error",
|
|
||||||
"unicorn/no-useless-promise-resolve-reject": "error",
|
"unicorn/no-useless-promise-resolve-reject": "error",
|
||||||
"unicorn/no-useless-spread": "error",
|
"unicorn/no-useless-spread": "error",
|
||||||
"unicorn/prefer-array-find": "error",
|
"unicorn/prefer-array-find": "error",
|
||||||
@ -171,12 +142,9 @@ export default [
|
|||||||
"unicorn/prefer-array-index-of": "error",
|
"unicorn/prefer-array-index-of": "error",
|
||||||
"unicorn/prefer-array-some": "error",
|
"unicorn/prefer-array-some": "error",
|
||||||
"unicorn/prefer-at": "error",
|
"unicorn/prefer-at": "error",
|
||||||
"unicorn/prefer-class-fields": "error",
|
|
||||||
"unicorn/prefer-classlist-toggle": "error",
|
|
||||||
"unicorn/prefer-date-now": "error",
|
"unicorn/prefer-date-now": "error",
|
||||||
"unicorn/prefer-dom-node-append": "error",
|
"unicorn/prefer-dom-node-append": "error",
|
||||||
"unicorn/prefer-dom-node-remove": "error",
|
"unicorn/prefer-dom-node-remove": "error",
|
||||||
"unicorn/prefer-import-meta-properties": "error",
|
|
||||||
"unicorn/prefer-includes": "error",
|
"unicorn/prefer-includes": "error",
|
||||||
"unicorn/prefer-logical-operator-over-ternary": "error",
|
"unicorn/prefer-logical-operator-over-ternary": "error",
|
||||||
"unicorn/prefer-modern-dom-apis": "error",
|
"unicorn/prefer-modern-dom-apis": "error",
|
||||||
@ -184,14 +152,11 @@ export default [
|
|||||||
"unicorn/prefer-negative-index": "error",
|
"unicorn/prefer-negative-index": "error",
|
||||||
"unicorn/prefer-optional-catch-binding": "error",
|
"unicorn/prefer-optional-catch-binding": "error",
|
||||||
"unicorn/prefer-regexp-test": "error",
|
"unicorn/prefer-regexp-test": "error",
|
||||||
"unicorn/prefer-single-call": "error",
|
|
||||||
"unicorn/prefer-string-replace-all": "error",
|
"unicorn/prefer-string-replace-all": "error",
|
||||||
"unicorn/prefer-string-starts-ends-with": "error",
|
"unicorn/prefer-string-starts-ends-with": "error",
|
||||||
"unicorn/prefer-ternary": ["error", "only-single-line"],
|
"unicorn/prefer-ternary": ["error", "only-single-line"],
|
||||||
"unicorn/throw-new-error": "error",
|
"unicorn/throw-new-error": "error",
|
||||||
|
|
||||||
"prefer-math-clamp/prefer-math-clamp": "error",
|
|
||||||
|
|
||||||
// Possible errors
|
// Possible errors
|
||||||
"for-direction": "error",
|
"for-direction": "error",
|
||||||
"getter-return": "error",
|
"getter-return": "error",
|
||||||
@ -275,10 +240,8 @@ export default [
|
|||||||
"no-useless-concat": "error",
|
"no-useless-concat": "error",
|
||||||
"no-useless-escape": "error",
|
"no-useless-escape": "error",
|
||||||
"no-useless-return": "error",
|
"no-useless-return": "error",
|
||||||
"prefer-object-has-own": "error",
|
|
||||||
"prefer-promise-reject-errors": "error",
|
"prefer-promise-reject-errors": "error",
|
||||||
"prefer-spread": "error",
|
"prefer-spread": "error",
|
||||||
radix: "error",
|
|
||||||
"wrap-iife": ["error", "any"],
|
"wrap-iife": ["error", "any"],
|
||||||
yoda: ["error", "never", { exceptRange: true }],
|
yoda: ["error", "never", { exceptRange: true }],
|
||||||
|
|
||||||
@ -313,11 +276,6 @@ export default [
|
|||||||
"BinaryExpression[operator='instanceof'][right.name='Object']",
|
"BinaryExpression[operator='instanceof'][right.name='Object']",
|
||||||
message: "Use `typeof` rather than `instanceof Object`.",
|
message: "Use `typeof` rather than `instanceof Object`.",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
selector: "MemberExpression[property.name='hasOwnProperty']",
|
|
||||||
message:
|
|
||||||
"Use `Object.hasOwn` rather than `Object.prototype.hasOwnProperty`.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
selector: "CallExpression[callee.name='assert'][arguments.length!=2]",
|
selector: "CallExpression[callee.name='assert'][arguments.length!=2]",
|
||||||
message: "`assert()` must always be invoked with two arguments.",
|
message: "`assert()` must always be invoked with two arguments.",
|
||||||
@ -345,11 +303,6 @@ export default [
|
|||||||
selector: "NewExpression[callee.name='Name']",
|
selector: "NewExpression[callee.name='Name']",
|
||||||
message: "Use `Name.get()` rather than `new Name()`.",
|
message: "Use `Name.get()` rather than `new Name()`.",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
selector: "NewExpression[callee.name='ObjectLoader']",
|
|
||||||
message:
|
|
||||||
"Use `ObjectLoader.load()` rather than `new ObjectLoader()`.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
selector: "NewExpression[callee.name='Ref']",
|
selector: "NewExpression[callee.name='Ref']",
|
||||||
message: "Use `Ref.get()` rather than `new Ref()`.",
|
message: "Use `Ref.get()` rather than `new Ref()`.",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2014 Mozilla Foundation
|
Copyright 2014 Mozilla Foundation
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html dir="ltr" mozdisallowselectionprint>
|
<html dir="ltr" mozdisallowselectionprint>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="google" content="notranslate" />
|
<meta name="google" content="notranslate">
|
||||||
<title>PDF.js page viewer using built components</title>
|
<title>PDF.js page viewer using built components</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -29,7 +29,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
|
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2014 Mozilla Foundation
|
Copyright 2014 Mozilla Foundation
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html dir="ltr" mozdisallowselectionprint>
|
<html dir="ltr" mozdisallowselectionprint>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="google" content="notranslate" />
|
<meta name="google" content="notranslate">
|
||||||
<title>PDF.js viewer using built components</title>
|
<title>PDF.js viewer using built components</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -35,7 +35,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
|
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
||||||
|
|||||||
@ -40,8 +40,6 @@ const SANDBOX_BUNDLE_SRC = new URL(
|
|||||||
window.location
|
window.location
|
||||||
);
|
);
|
||||||
|
|
||||||
const WASM_URL = "../../node_modules/pdfjs-dist/build/wasm/";
|
|
||||||
|
|
||||||
const container = document.getElementById("viewerContainer");
|
const container = document.getElementById("viewerContainer");
|
||||||
|
|
||||||
const eventBus = new pdfjsViewer.EventBus();
|
const eventBus = new pdfjsViewer.EventBus();
|
||||||
@ -61,7 +59,6 @@ const pdfFindController = new pdfjsViewer.PDFFindController({
|
|||||||
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
|
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
|
||||||
eventBus,
|
eventBus,
|
||||||
sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
|
sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
|
||||||
wasmUrl: WASM_URL,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const pdfViewer = new pdfjsViewer.PDFViewer({
|
const pdfViewer = new pdfjsViewer.PDFViewer({
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2014 Mozilla Foundation
|
Copyright 2014 Mozilla Foundation
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html dir="ltr" mozdisallowselectionprint>
|
<html dir="ltr" mozdisallowselectionprint>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="google" content="notranslate" />
|
<meta name="google" content="notranslate">
|
||||||
<title>PDF.js Single Page Viewer using built components</title>
|
<title>PDF.js Single Page Viewer using built components</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -35,7 +35,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
|
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
||||||
|
|||||||
@ -40,8 +40,6 @@ const SANDBOX_BUNDLE_SRC = new URL(
|
|||||||
window.location
|
window.location
|
||||||
);
|
);
|
||||||
|
|
||||||
const WASM_URL = "../../node_modules/pdfjs-dist/build/wasm/";
|
|
||||||
|
|
||||||
const container = document.getElementById("viewerContainer");
|
const container = document.getElementById("viewerContainer");
|
||||||
|
|
||||||
const eventBus = new pdfjsViewer.EventBus();
|
const eventBus = new pdfjsViewer.EventBus();
|
||||||
@ -61,7 +59,6 @@ const pdfFindController = new pdfjsViewer.PDFFindController({
|
|||||||
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
|
const pdfScriptingManager = new pdfjsViewer.PDFScriptingManager({
|
||||||
eventBus,
|
eventBus,
|
||||||
sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
|
sandboxBundleSrc: SANDBOX_BUNDLE_SRC,
|
||||||
wasmUrl: WASM_URL,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({
|
const pdfSinglePageViewer = new pdfjsViewer.PDFSinglePageViewer({
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2018 Mozilla Foundation
|
Copyright 2018 Mozilla Foundation
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html dir="ltr" mozdisallowselectionprint>
|
<html dir="ltr" mozdisallowselectionprint>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="google" content="notranslate" />
|
<meta name="google" content="notranslate">
|
||||||
<title>PDF.js standalone JpegImage parser</title>
|
<title>PDF.js standalone JpegImage parser</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@ -29,7 +29,7 @@ const response = await fetch(JPEG_IMAGE);
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(response.statusText);
|
throw new Error(response.statusText);
|
||||||
}
|
}
|
||||||
const typedArrayImage = await response.bytes();
|
const typedArrayImage = new Uint8Array(await response.arrayBuffer());
|
||||||
|
|
||||||
// Parse the image data using `JpegImage`.
|
// Parse the image data using `JpegImage`.
|
||||||
//
|
//
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<title>'Hello, world!' example</title>
|
<title>'Hello, world!' example</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>'Hello, world!' example</h1>
|
<h1>'Hello, world!' example</h1>
|
||||||
|
|
||||||
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
|
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas>
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
|
|
||||||
@ -16,17 +17,18 @@
|
|||||||
// If absolute URL from the remote server is provided, configure the CORS
|
// If absolute URL from the remote server is provided, configure the CORS
|
||||||
// header on that server.
|
// header on that server.
|
||||||
//
|
//
|
||||||
const url = "./helloworld.pdf";
|
const url = './helloworld.pdf';
|
||||||
|
|
||||||
//
|
//
|
||||||
// The workerSrc property shall be specified.
|
// The workerSrc property shall be specified.
|
||||||
//
|
//
|
||||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
|
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
||||||
|
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Asynchronous download PDF
|
// Asynchronous download PDF
|
||||||
//
|
//
|
||||||
const loadingTask = pdfjsLib.getDocument({ url });
|
const loadingTask = pdfjsLib.getDocument(url);
|
||||||
const pdf = await loadingTask.promise;
|
const pdf = await loadingTask.promise;
|
||||||
//
|
//
|
||||||
// Fetch the first page
|
// Fetch the first page
|
||||||
@ -48,7 +50,9 @@
|
|||||||
canvas.style.width = Math.floor(viewport.width) + "px";
|
canvas.style.width = Math.floor(viewport.width) + "px";
|
||||||
canvas.style.height = Math.floor(viewport.height) + "px";
|
canvas.style.height = Math.floor(viewport.height) + "px";
|
||||||
|
|
||||||
const transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
|
const transform = outputScale !== 1
|
||||||
|
? [outputScale, 0, 0, outputScale, 0, 0]
|
||||||
|
: null;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render PDF page into canvas context
|
// Render PDF page into canvas context
|
||||||
@ -61,11 +65,12 @@
|
|||||||
page.render(renderContext);
|
page.render(renderContext);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<hr />
|
<hr>
|
||||||
<h2>JavaScript code:</h2>
|
<h2>JavaScript code:</h2>
|
||||||
<pre id="code"></pre>
|
<pre id="code"></pre>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("code").textContent = document.getElementById("script").text;
|
document.getElementById('code').textContent =
|
||||||
|
document.getElementById('script').text;
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<title>'Hello, world!' base64 example</title>
|
<title>'Hello, world!' base64 example</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>'Hello, world!' example</h1>
|
<h1>'Hello, world!' example</h1>
|
||||||
|
|
||||||
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
|
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas>
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
|
|
||||||
@ -16,47 +17,49 @@
|
|||||||
// (See also https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/
|
// (See also https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/
|
||||||
// Base64_encoding_and_decoding.)
|
// Base64_encoding_and_decoding.)
|
||||||
var pdfData = atob(
|
var pdfData = atob(
|
||||||
"JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog" +
|
'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
|
||||||
"IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv" +
|
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
|
||||||
"TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K" +
|
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
|
||||||
"Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg" +
|
'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' +
|
||||||
"L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+" +
|
'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' +
|
||||||
"PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u" +
|
'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' +
|
||||||
"dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq" +
|
'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' +
|
||||||
"Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU" +
|
'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' +
|
||||||
"CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu" +
|
'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' +
|
||||||
"ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g" +
|
'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' +
|
||||||
"CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw" +
|
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
|
||||||
"MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v" +
|
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
|
||||||
"dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G"
|
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G');
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The workerSrc property shall be specified.
|
// The workerSrc property shall be specified.
|
||||||
//
|
//
|
||||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
|
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
||||||
|
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
|
||||||
|
|
||||||
// Opening PDF by passing its binary data as a string. It is still preferable
|
// Opening PDF by passing its binary data as a string. It is still preferable
|
||||||
// to use Uint8Array, but string or array-like structure will work too.
|
// to use Uint8Array, but string or array-like structure will work too.
|
||||||
var loadingTask = pdfjsLib.getDocument({ data: pdfData });
|
var loadingTask = pdfjsLib.getDocument({ data: pdfData, });
|
||||||
var pdf = await loadingTask.promise;
|
var pdf = await loadingTask.promise;
|
||||||
// Fetch the first page.
|
// Fetch the first page.
|
||||||
var page = await pdf.getPage(1);
|
var page = await pdf.getPage(1);
|
||||||
var scale = 1.5;
|
var scale = 1.5;
|
||||||
var viewport = page.getViewport({ scale: scale });
|
var viewport = page.getViewport({ scale: scale, });
|
||||||
// Support HiDPI-screens.
|
// Support HiDPI-screens.
|
||||||
var outputScale = window.devicePixelRatio || 1;
|
var outputScale = window.devicePixelRatio || 1;
|
||||||
|
|
||||||
// Prepare canvas using PDF page dimensions.
|
// Prepare canvas using PDF page dimensions.
|
||||||
var canvas = document.getElementById("the-canvas");
|
var canvas = document.getElementById('the-canvas');
|
||||||
var context = canvas.getContext("2d");
|
var context = canvas.getContext('2d');
|
||||||
|
|
||||||
canvas.width = Math.floor(viewport.width * outputScale);
|
canvas.width = Math.floor(viewport.width * outputScale);
|
||||||
canvas.height = Math.floor(viewport.height * outputScale);
|
canvas.height = Math.floor(viewport.height * outputScale);
|
||||||
canvas.style.width = Math.floor(viewport.width) + "px";
|
canvas.style.width = Math.floor(viewport.width) + "px";
|
||||||
canvas.style.height = Math.floor(viewport.height) + "px";
|
canvas.style.height = Math.floor(viewport.height) + "px";
|
||||||
|
|
||||||
var transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
|
var transform = outputScale !== 1
|
||||||
|
? [outputScale, 0, 0, outputScale, 0, 0]
|
||||||
|
: null;
|
||||||
|
|
||||||
// Render PDF page into canvas context.
|
// Render PDF page into canvas context.
|
||||||
var renderContext = {
|
var renderContext = {
|
||||||
@ -67,11 +70,12 @@
|
|||||||
page.render(renderContext);
|
page.render(renderContext);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<hr />
|
<hr>
|
||||||
<h2>JavaScript code:</h2>
|
<h2>JavaScript code:</h2>
|
||||||
<pre id="code"></pre>
|
<pre id="code"></pre>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("code").textContent = document.getElementById("script").text;
|
document.getElementById('code').textContent =
|
||||||
|
document.getElementById('script').text;
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<title>Previous/Next example</title>
|
<title>Previous/Next example</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>'Previous/Next' example</h1>
|
<h1>'Previous/Next' example</h1>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -15,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr"></canvas>
|
<canvas id="the-canvas" style="border: 1px solid black; direction: ltr;"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
@ -25,22 +26,23 @@
|
|||||||
// If absolute URL from the remote server is provided, configure the CORS
|
// If absolute URL from the remote server is provided, configure the CORS
|
||||||
// header on that server.
|
// header on that server.
|
||||||
//
|
//
|
||||||
var url = "../../web/compressed.tracemonkey-pldi-09.pdf";
|
var url = '../../web/compressed.tracemonkey-pldi-09.pdf';
|
||||||
|
|
||||||
//
|
//
|
||||||
// In cases when the pdf.worker.js is located at the different folder than the
|
// In cases when the pdf.worker.js is located at the different folder than the
|
||||||
// PDF.js's one, or the PDF.js is executed via eval(), the workerSrc property
|
// PDF.js's one, or the PDF.js is executed via eval(), the workerSrc property
|
||||||
// shall be specified.
|
// shall be specified.
|
||||||
//
|
//
|
||||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
|
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
||||||
|
'../../node_modules/pdfjs-dist/build/pdf.worker.mjs';
|
||||||
|
|
||||||
var pdfDoc = null,
|
var pdfDoc = null,
|
||||||
pageNum = 1,
|
pageNum = 1,
|
||||||
pageRendering = false,
|
pageRendering = false,
|
||||||
pageNumPending = null,
|
pageNumPending = null,
|
||||||
scale = 0.8,
|
scale = 0.8,
|
||||||
canvas = document.getElementById("the-canvas"),
|
canvas = document.getElementById('the-canvas'),
|
||||||
ctx = canvas.getContext("2d");
|
ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get page info from document, resize canvas accordingly, and render page.
|
* Get page info from document, resize canvas accordingly, and render page.
|
||||||
@ -50,7 +52,7 @@
|
|||||||
pageRendering = true;
|
pageRendering = true;
|
||||||
// Using promise to fetch the page
|
// Using promise to fetch the page
|
||||||
pdfDoc.getPage(num).then(function(page) {
|
pdfDoc.getPage(num).then(function(page) {
|
||||||
var viewport = page.getViewport({ scale: scale });
|
var viewport = page.getViewport({ scale: scale, });
|
||||||
// Support HiDPI-screens.
|
// Support HiDPI-screens.
|
||||||
var outputScale = window.devicePixelRatio || 1;
|
var outputScale = window.devicePixelRatio || 1;
|
||||||
|
|
||||||
@ -59,7 +61,9 @@
|
|||||||
canvas.style.width = Math.floor(viewport.width) + "px";
|
canvas.style.width = Math.floor(viewport.width) + "px";
|
||||||
canvas.style.height = Math.floor(viewport.height) + "px";
|
canvas.style.height = Math.floor(viewport.height) + "px";
|
||||||
|
|
||||||
var transform = outputScale !== 1 ? [outputScale, 0, 0, outputScale, 0, 0] : null;
|
var transform = outputScale !== 1
|
||||||
|
? [outputScale, 0, 0, outputScale, 0, 0]
|
||||||
|
: null;
|
||||||
|
|
||||||
// Render PDF page into canvas context
|
// Render PDF page into canvas context
|
||||||
var renderContext = {
|
var renderContext = {
|
||||||
@ -81,7 +85,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Update page counters
|
// Update page counters
|
||||||
document.getElementById("page_num").textContent = num;
|
document.getElementById('page_num').textContent = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +110,7 @@
|
|||||||
pageNum--;
|
pageNum--;
|
||||||
queueRenderPage(pageNum);
|
queueRenderPage(pageNum);
|
||||||
}
|
}
|
||||||
document.getElementById("prev").addEventListener("click", onPrevPage);
|
document.getElementById('prev').addEventListener('click', onPrevPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays next page.
|
* Displays next page.
|
||||||
@ -118,17 +122,18 @@
|
|||||||
pageNum++;
|
pageNum++;
|
||||||
queueRenderPage(pageNum);
|
queueRenderPage(pageNum);
|
||||||
}
|
}
|
||||||
document.getElementById("next").addEventListener("click", onNextPage);
|
document.getElementById('next').addEventListener('click', onNextPage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronously downloads PDF.
|
* Asynchronously downloads PDF.
|
||||||
*/
|
*/
|
||||||
var loadingTask = pdfjsLib.getDocument({ url });
|
var loadingTask = pdfjsLib.getDocument(url);
|
||||||
pdfDoc = await loadingTask.promise;
|
pdfDoc = await loadingTask.promise;
|
||||||
document.getElementById("page_count").textContent = pdfDoc.numPages;
|
document.getElementById('page_count').textContent = pdfDoc.numPages;
|
||||||
|
|
||||||
// Initial/first page rendering
|
// Initial/first page rendering
|
||||||
renderPage(pageNum);
|
renderPage(pageNum);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2016 Mozilla Foundation
|
Copyright 2016 Mozilla Foundation
|
||||||
|
|
||||||
@ -16,13 +16,13 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html dir="ltr">
|
<html dir="ltr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
|
||||||
<title>PDF.js viewer</title>
|
<title>PDF.js viewer</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css" />
|
<link rel="stylesheet" href="../../node_modules/pdfjs-dist/web/pdf_viewer.css">
|
||||||
<link rel="stylesheet" type="text/css" href="viewer.css" />
|
<link rel="stylesheet" type="text/css" href="viewer.css">
|
||||||
|
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/web/pdf_viewer.mjs" type="module"></script>
|
||||||
@ -46,7 +46,7 @@ limitations under the License.
|
|||||||
<button class="toolbarButton pageUp" title="Previous Page" id="previous" type="button"></button>
|
<button class="toolbarButton pageUp" title="Previous Page" id="previous" type="button"></button>
|
||||||
<button class="toolbarButton pageDown" title="Next Page" id="next" type="button"></button>
|
<button class="toolbarButton pageDown" title="Next Page" id="next" type="button"></button>
|
||||||
|
|
||||||
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" />
|
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1">
|
||||||
|
|
||||||
<button class="toolbarButton zoomOut" title="Zoom Out" id="zoomOut" type="button"></button>
|
<button class="toolbarButton zoomOut" title="Zoom Out" id="zoomOut" type="button"></button>
|
||||||
<button class="toolbarButton zoomIn" title="Zoom In" id="zoomIn" type="button"></button>
|
<button class="toolbarButton zoomIn" title="Zoom In" id="zoomIn" type="button"></button>
|
||||||
|
|||||||
@ -46,13 +46,19 @@ const PDFViewerApplication = {
|
|||||||
* @returns {Promise} - Returns the promise, which is resolved when document
|
* @returns {Promise} - Returns the promise, which is resolved when document
|
||||||
* is opened.
|
* is opened.
|
||||||
*/
|
*/
|
||||||
async open(params) {
|
open(params) {
|
||||||
if (this.pdfLoadingTask) {
|
if (this.pdfLoadingTask) {
|
||||||
// We need to destroy already opened document.
|
// We need to destroy already opened document
|
||||||
await this.close();
|
return this.close().then(
|
||||||
|
function () {
|
||||||
|
// ... and repeat the open() call.
|
||||||
|
return this.open(params);
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { url } = params;
|
const url = params.url;
|
||||||
|
const self = this;
|
||||||
this.setTitleUsingUrl(url);
|
this.setTitleUsingUrl(url);
|
||||||
|
|
||||||
// Loading document.
|
// Loading document.
|
||||||
@ -64,22 +70,24 @@ const PDFViewerApplication = {
|
|||||||
});
|
});
|
||||||
this.pdfLoadingTask = loadingTask;
|
this.pdfLoadingTask = loadingTask;
|
||||||
|
|
||||||
loadingTask.onProgress = evt => this.progress(evt.percent);
|
loadingTask.onProgress = function (progressData) {
|
||||||
|
self.progress(progressData.loaded / progressData.total);
|
||||||
|
};
|
||||||
|
|
||||||
return loadingTask.promise.then(
|
return loadingTask.promise.then(
|
||||||
pdfDocument => {
|
function (pdfDocument) {
|
||||||
// Document loaded, specifying document for the viewer.
|
// Document loaded, specifying document for the viewer.
|
||||||
this.pdfDocument = pdfDocument;
|
self.pdfDocument = pdfDocument;
|
||||||
this.pdfViewer.setDocument(pdfDocument);
|
self.pdfViewer.setDocument(pdfDocument);
|
||||||
this.pdfLinkService.setDocument(pdfDocument);
|
self.pdfLinkService.setDocument(pdfDocument);
|
||||||
this.pdfHistory.initialize({
|
self.pdfHistory.initialize({
|
||||||
fingerprint: pdfDocument.fingerprints[0],
|
fingerprint: pdfDocument.fingerprints[0],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.loadingBar.hide();
|
self.loadingBar.hide();
|
||||||
this.setTitleUsingMetadata(pdfDocument);
|
self.setTitleUsingMetadata(pdfDocument);
|
||||||
},
|
},
|
||||||
reason => {
|
function (reason) {
|
||||||
let key = "pdfjs-loading-error";
|
let key = "pdfjs-loading-error";
|
||||||
if (reason instanceof pdfjsLib.InvalidPDFException) {
|
if (reason instanceof pdfjsLib.InvalidPDFException) {
|
||||||
key = "pdfjs-invalid-file-error";
|
key = "pdfjs-invalid-file-error";
|
||||||
@ -88,10 +96,10 @@ const PDFViewerApplication = {
|
|||||||
? "pdfjs-missing-file-error"
|
? "pdfjs-missing-file-error"
|
||||||
: "pdfjs-unexpected-response-error";
|
: "pdfjs-unexpected-response-error";
|
||||||
}
|
}
|
||||||
this.l10n.get(key).then(msg => {
|
self.l10n.get(key).then(msg => {
|
||||||
this.error(msg, { message: reason.message });
|
self.error(msg, { message: reason?.message });
|
||||||
});
|
});
|
||||||
this.loadingBar.hide();
|
self.loadingBar.hide();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -101,9 +109,9 @@ const PDFViewerApplication = {
|
|||||||
* @returns {Promise} - Returns the promise, which is resolved when all
|
* @returns {Promise} - Returns the promise, which is resolved when all
|
||||||
* destruction is completed.
|
* destruction is completed.
|
||||||
*/
|
*/
|
||||||
async close() {
|
close() {
|
||||||
if (!this.pdfLoadingTask) {
|
if (!this.pdfLoadingTask) {
|
||||||
return;
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
const promise = this.pdfLoadingTask.destroy();
|
const promise = this.pdfLoadingTask.destroy();
|
||||||
@ -120,7 +128,7 @@ const PDFViewerApplication = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await promise;
|
return promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
get loadingBar() {
|
get loadingBar() {
|
||||||
@ -144,21 +152,32 @@ const PDFViewerApplication = {
|
|||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
async setTitleUsingMetadata(pdfDocument) {
|
setTitleUsingMetadata(pdfDocument) {
|
||||||
const { info, metadata } = await pdfDocument.getMetadata();
|
const self = this;
|
||||||
this.documentInfo = info;
|
pdfDocument.getMetadata().then(function (data) {
|
||||||
this.metadata = metadata;
|
const info = data.info,
|
||||||
|
metadata = data.metadata;
|
||||||
|
self.documentInfo = info;
|
||||||
|
self.metadata = metadata;
|
||||||
|
|
||||||
// Provides some basic debug information
|
// Provides some basic debug information
|
||||||
console.log(
|
console.log(
|
||||||
`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
|
"PDF " +
|
||||||
`${(metadata?.get("pdf:producer") || info.Producer || "-").trim()} / ` +
|
pdfDocument.fingerprints[0] +
|
||||||
`${(metadata?.get("xmp:creatortool") || info.Creator || "-").trim()}` +
|
" [" +
|
||||||
`] (PDF.js: ${pdfjsLib.version || "?"} [${pdfjsLib.build || "?"}])`
|
info.PDFFormatVersion +
|
||||||
|
" " +
|
||||||
|
(info.Producer || "-").trim() +
|
||||||
|
" / " +
|
||||||
|
(info.Creator || "-").trim() +
|
||||||
|
"]" +
|
||||||
|
" (PDF.js: " +
|
||||||
|
(pdfjsLib.version || "-") +
|
||||||
|
")"
|
||||||
);
|
);
|
||||||
|
|
||||||
let pdfTitle;
|
let pdfTitle;
|
||||||
if (metadata?.has("dc:title")) {
|
if (metadata && metadata.has("dc:title")) {
|
||||||
const title = metadata.get("dc:title");
|
const title = metadata.get("dc:title");
|
||||||
// Ghostscript sometimes returns 'Untitled', so prevent setting the
|
// Ghostscript sometimes returns 'Untitled', so prevent setting the
|
||||||
// title to 'Untitled.
|
// title to 'Untitled.
|
||||||
@ -166,11 +185,15 @@ const PDFViewerApplication = {
|
|||||||
pdfTitle = title;
|
pdfTitle = title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pdfTitle ||= info?.Title;
|
|
||||||
|
if (!pdfTitle && info && info.Title) {
|
||||||
|
pdfTitle = info.Title;
|
||||||
|
}
|
||||||
|
|
||||||
if (pdfTitle) {
|
if (pdfTitle) {
|
||||||
this.setTitle(pdfTitle + " - " + document.title);
|
self.setTitle(pdfTitle + " - " + document.title);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitle: function pdfViewSetTitle(title) {
|
setTitle: function pdfViewSetTitle(title) {
|
||||||
@ -200,7 +223,8 @@ const PDFViewerApplication = {
|
|||||||
console.error(`${message}\n\n${moreInfoText.join("\n")}`);
|
console.error(`${message}\n\n${moreInfoText.join("\n")}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
progress(percent) {
|
progress: function pdfViewProgress(level) {
|
||||||
|
const percent = Math.round(level * 100);
|
||||||
// Updating the bar if value increases.
|
// Updating the bar if value increases.
|
||||||
if (percent > this.loadingBar.percent || isNaN(percent)) {
|
if (percent > this.loadingBar.percent || isNaN(percent)) {
|
||||||
this.loadingBar.percent = percent;
|
this.loadingBar.percent = percent;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ const pdfPath =
|
|||||||
|
|
||||||
// Will be using promises to load document, pages and misc data instead of
|
// Will be using promises to load document, pages and misc data instead of
|
||||||
// callback.
|
// callback.
|
||||||
const loadingTask = getDocument({ url: pdfPath });
|
const loadingTask = getDocument(pdfPath);
|
||||||
loadingTask.promise
|
loadingTask.promise
|
||||||
.then(function (doc) {
|
.then(function (doc) {
|
||||||
const numPages = doc.numPages;
|
const numPages = doc.numPages;
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<title>Text-only PDF.js example</title>
|
<title>Text-only PDF.js example</title>
|
||||||
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
<script src="../../node_modules/pdfjs-dist/build/pdf.mjs" type="module"></script>
|
||||||
<script src="pdf2svg.mjs" type="module"></script>
|
<script src="pdf2svg.mjs" type="module"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p>Text-only PDF.js example</p>
|
<p>Text-only PDF.js example</p>
|
||||||
<div id="pageContainer" style="display: inline-block; border: solid 1px black"></div>
|
<div id="pageContainer" style="display: inline-block; border: solid 1px black;">
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<title>webpack example</title>
|
<title>webpack example</title>
|
||||||
<script src="../../build/webpack/main.bundle.js"></script>
|
<script src="../../build/webpack/main.bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -45,7 +45,7 @@ function watchObjectOrEmbed(elem) {
|
|||||||
// <embed src> <object data>
|
// <embed src> <object data>
|
||||||
var srcAttribute = "src" in elem ? "src" : "data";
|
var srcAttribute = "src" in elem ? "src" : "data";
|
||||||
var path = elem[srcAttribute];
|
var path = elem[srcAttribute];
|
||||||
if (!mimeType && !/\.pdf(?:$|[?#])/i.test(path)) {
|
if (!mimeType && !/\.pdf($|[?#])/i.test(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<title>PDF.js viewer options</title>
|
<title>PDF.js viewer options</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@ -42,7 +42,7 @@ limitations under the License.
|
|||||||
<template id="checkbox-template">
|
<template id="checkbox-template">
|
||||||
<div class="settings-row checkbox">
|
<div class="settings-row checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" />
|
<input type="checkbox">
|
||||||
<span></span>
|
<span></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -168,7 +168,7 @@ function renderEnumPref(shortDescription, prefName) {
|
|||||||
var select = wrapper.querySelector("select");
|
var select = wrapper.querySelector("select");
|
||||||
select.onchange = function () {
|
select.onchange = function () {
|
||||||
var pref = {};
|
var pref = {};
|
||||||
pref[prefName] = parseInt(this.value, 10);
|
pref[prefName] = parseInt(this.value);
|
||||||
storageArea.set(pref);
|
storageArea.set(pref);
|
||||||
};
|
};
|
||||||
wrapper.querySelector("span").textContent = shortDescription;
|
wrapper.querySelector("span").textContent = shortDescription;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ async function registerPdfRedirectRule() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rules in order of priority (highest priority rule first).
|
// Rules in order of prority (highest priority rule first).
|
||||||
// The required "id" fields will be auto-generated later.
|
// The required "id" fields will be auto-generated later.
|
||||||
const addRules = [
|
const addRules = [
|
||||||
{
|
{
|
||||||
|
|||||||
234
extensions/chromium/preferences_schema.json
Normal file
234
extensions/chromium/preferences_schema.json
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"viewerCssTheme": {
|
||||||
|
"title": "Theme",
|
||||||
|
"description": "The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [0, 1, 2],
|
||||||
|
"default": 2
|
||||||
|
},
|
||||||
|
"showPreviousViewOnLoad": {
|
||||||
|
"description": "DEPRECATED. Set viewOnLoad to 1 to disable showing the last page/position on load.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"viewOnLoad": {
|
||||||
|
"title": "View position on load",
|
||||||
|
"description": "The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [-1, 0, 1],
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"defaultZoomDelay": {
|
||||||
|
"title": "Default zoom delay",
|
||||||
|
"description": "Delay (in ms) to wait before redrawing the canvas.",
|
||||||
|
"type": "integer",
|
||||||
|
"default": 400
|
||||||
|
},
|
||||||
|
"defaultZoomValue": {
|
||||||
|
"title": "Default zoom level",
|
||||||
|
"description": "Default zoom level of the viewer. Accepted values: 'auto', 'page-actual', 'page-width', 'page-height', 'page-fit', or a zoom level in percents.",
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "|auto|page-actual|page-width|page-height|page-fit|[0-9]+\\.?[0-9]*(,[0-9]+\\.?[0-9]*){0,2}",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"sidebarViewOnLoad": {
|
||||||
|
"title": "Sidebar state on load",
|
||||||
|
"description": "Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [-1, 0, 1, 2, 3],
|
||||||
|
"default": -1
|
||||||
|
},
|
||||||
|
"enableHandToolOnLoad": {
|
||||||
|
"description": "DEPRECATED. Set cursorToolOnLoad to 1 to enable the hand tool by default.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableHWA": {
|
||||||
|
"title": "Enable hardware acceleration",
|
||||||
|
"description": "Whether to enable hardware acceleration.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"enableAltText": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableGuessAltText": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"enableAltTextModelDownload": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"enableNewAltTextWhenAddingImage": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"altTextLearnMoreUrl": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"enableSignatureEditor": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableUpdatedAddImage": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"cursorToolOnLoad": {
|
||||||
|
"title": "Cursor tool on load",
|
||||||
|
"description": "The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [0, 1],
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"pdfBugEnabled": {
|
||||||
|
"title": "Enable debugging tools",
|
||||||
|
"description": "Whether to enable debugging tools.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableScripting": {
|
||||||
|
"title": "Enable active content (JavaScript) in PDFs",
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether to allow execution of active content (JavaScript) by PDF files.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableHighlightFloatingButton": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"highlightEditorColors": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F"
|
||||||
|
},
|
||||||
|
"disableRange": {
|
||||||
|
"title": "Disable range requests",
|
||||||
|
"description": "Whether to disable range requests (not recommended).",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disableStream": {
|
||||||
|
"title": "Disable streaming for requests",
|
||||||
|
"description": "Whether to disable streaming for requests (not recommended).",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disableAutoFetch": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disableFontFace": {
|
||||||
|
"title": "Disable @font-face",
|
||||||
|
"description": "Whether to disable @font-face and fall back to canvas rendering (this is more resource-intensive).",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disableTextLayer": {
|
||||||
|
"description": "DEPRECATED. Set textLayerMode to 0 to disable the text selection layer by default.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"textLayerMode": {
|
||||||
|
"title": "Text layer mode",
|
||||||
|
"description": "Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [0, 1],
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
"externalLinkTarget": {
|
||||||
|
"title": "External links target window",
|
||||||
|
"description": "Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [0, 1, 2, 3, 4],
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"disablePageLabels": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disablePageMode": {
|
||||||
|
"description": "DEPRECATED.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"disableTelemetry": {
|
||||||
|
"title": "Disable telemetry",
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether to prevent the extension from reporting the extension and browser version to the extension developers.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"annotationMode": {
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [0, 1, 2, 3],
|
||||||
|
"default": 2
|
||||||
|
},
|
||||||
|
"annotationEditorMode": {
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [-1, 0, 3, 15],
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
"enablePermissions": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enableXfa": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"historyUpdateUrl": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"ignoreDestinationZoom": {
|
||||||
|
"title": "Ignore the zoom argument in destinations",
|
||||||
|
"description": "When enabled it will maintain the currently active zoom level, rather than letting the PDF document modify it, when navigating to internal destinations.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"enablePrintAutoRotate": {
|
||||||
|
"title": "Automatically rotate printed pages",
|
||||||
|
"description": "When enabled, landscape pages are rotated when printed.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
|
"scrollModeOnLoad": {
|
||||||
|
"title": "Scroll mode on load",
|
||||||
|
"description": "Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 3 = Page scrolling.\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [-1, 0, 1, 2, 3],
|
||||||
|
"default": -1
|
||||||
|
},
|
||||||
|
"spreadModeOnLoad": {
|
||||||
|
"title": "Spread mode on load",
|
||||||
|
"description": "Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [-1, 0, 1, 2],
|
||||||
|
"default": -1
|
||||||
|
},
|
||||||
|
"forcePageColors": {
|
||||||
|
"description": "When enabled, the pdf rendering will use the high contrast mode colors",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
"pageColorsBackground": {
|
||||||
|
"description": "The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
|
||||||
|
"type": "string",
|
||||||
|
"default": "Canvas"
|
||||||
|
},
|
||||||
|
"pageColorsForeground": {
|
||||||
|
"description": "The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
|
||||||
|
"type": "string",
|
||||||
|
"default": "CanvasText"
|
||||||
|
},
|
||||||
|
"enableAutoLinking": {
|
||||||
|
"description": "Enable creation of hyperlinks from text that look like URLs.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -96,7 +96,7 @@ limitations under the License.
|
|||||||
chrome.storage.local.get(localStorage, items => {
|
chrome.storage.local.get(localStorage, items => {
|
||||||
Object.assign(localStorage, items);
|
Object.assign(localStorage, items);
|
||||||
|
|
||||||
var lastTime = parseInt(localStorage.telemetryLastTime, 10) || 0;
|
var lastTime = parseInt(localStorage.telemetryLastTime) || 0;
|
||||||
var wasUpdated = didUpdateSinceLastCheck();
|
var wasUpdated = didUpdateSinceLastCheck();
|
||||||
if (!wasUpdated && Date.now() - lastTime < MINIMUM_TIME_BETWEEN_PING) {
|
if (!wasUpdated && Date.now() - lastTime < MINIMUM_TIME_BETWEEN_PING) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
19
external/brotli/LICENSE_BROTLI
vendored
19
external/brotli/LICENSE_BROTLI
vendored
@ -1,19 +0,0 @@
|
|||||||
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
8
external/brotli/README.md
vendored
8
external/brotli/README.md
vendored
@ -1,8 +0,0 @@
|
|||||||
## Release
|
|
||||||
|
|
||||||
In order to get the file `decoder.js`:
|
|
||||||
* `gulp release-brotli --hash` followed by the git hash of the revision.
|
|
||||||
|
|
||||||
## Licensing
|
|
||||||
|
|
||||||
[brotli](https://github.com/google/brotli/) is under [MIT License](https://github.com/google/brotli/blob/master/LICENSE)
|
|
||||||
2466
external/brotli/decode.js
vendored
2466
external/brotli/decode.js
vendored
File diff suppressed because one or more lines are too long
@ -47,25 +47,6 @@ function handlePreprocessorAction(ctx, actionName, args, path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function babelPluginPDFJSPreprocessor(babel, ctx) {
|
function babelPluginPDFJSPreprocessor(babel, ctx) {
|
||||||
function removeUnusedFunctions(path) {
|
|
||||||
let removed;
|
|
||||||
do {
|
|
||||||
removed = false;
|
|
||||||
path.scope.crawl();
|
|
||||||
for (const name in path.scope.bindings) {
|
|
||||||
const binding = path.scope.bindings[name];
|
|
||||||
if (!binding.referenced) {
|
|
||||||
const { path: bindingPath } = binding;
|
|
||||||
if (bindingPath.isFunctionDeclaration()) {
|
|
||||||
bindingPath.remove();
|
|
||||||
removed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we removed some functions, there might be new unused ones
|
|
||||||
} while (removed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "babel-plugin-pdfjs-preprocessor",
|
name: "babel-plugin-pdfjs-preprocessor",
|
||||||
manipulateOptions({ parserOpts }) {
|
manipulateOptions({ parserOpts }) {
|
||||||
@ -190,19 +171,36 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
path.replaceWith(t.importExpression(source));
|
path.replaceWith(t.importExpression(source));
|
||||||
} else if (t.isIdentifier(node.callee, { name: "__eager_import__" })) {
|
|
||||||
if (node.arguments.length !== 1) {
|
|
||||||
throw new Error("Invalid `__eager_import__` usage.");
|
|
||||||
}
|
}
|
||||||
// Replace it with a standard `import`-call and inline the module.
|
},
|
||||||
const source = node.arguments[0];
|
NewExpression(path) {
|
||||||
source.leadingComments = [
|
const { node } = path;
|
||||||
|
|
||||||
|
if (
|
||||||
|
t.isIdentifier(node.callee, { name: "URL" }) &&
|
||||||
|
node.arguments.length === 2
|
||||||
|
) {
|
||||||
|
const [arg1, arg2] = node.arguments;
|
||||||
|
|
||||||
|
if (
|
||||||
|
arg1.type === "StringLiteral" &&
|
||||||
|
arg1.value.endsWith(".wasm") &&
|
||||||
|
arg2.type === "MemberExpression"
|
||||||
|
) {
|
||||||
|
// This statement is generated by the Emscripten Compiler (emcc),
|
||||||
|
// however we're manually loading wasm-files and we want to ensure
|
||||||
|
// that bundlers will leave it alone; this *must* include Webpack.
|
||||||
|
arg1.leadingComments = [
|
||||||
{
|
{
|
||||||
type: "CommentBlock",
|
type: "CommentBlock",
|
||||||
value: "webpackMode: 'eager'",
|
value: "webpackIgnore: true",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "CommentBlock",
|
||||||
|
value: "@vite-ignore",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
path.replaceWith(t.importExpression(source));
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"BlockStatement|StaticBlock": {
|
"BlockStatement|StaticBlock": {
|
||||||
@ -257,8 +255,6 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
|
|||||||
// Function body ends with return without arg -- removing it.
|
// Function body ends with return without arg -- removing it.
|
||||||
body.pop();
|
body.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeUnusedFunctions(path);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ClassMethod: {
|
ClassMethod: {
|
||||||
@ -281,40 +277,6 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Program: {
|
|
||||||
exit(path) {
|
|
||||||
if (path.node.sourceType === "module") {
|
|
||||||
removeUnusedFunctions(path);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
MemberExpression(path) {
|
|
||||||
// The Emscripten Compiler (emcc) generates code that allows the caller
|
|
||||||
// to provide the Wasm module (thorugh Module.instantiateWasm), with
|
|
||||||
// a fallback in case .instantiateWasm is not provided.
|
|
||||||
// We always define instantiateWasm, so we can hard-code the check
|
|
||||||
// and let our dead code elimination logic remove the unused fallback.
|
|
||||||
if (
|
|
||||||
path.parentPath.isIfStatement({ test: path.node }) &&
|
|
||||||
path.matchesPattern("Module.instantiateWasm")
|
|
||||||
) {
|
|
||||||
path.replaceWith(t.booleanLiteral(true));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function babelPluginStripSrcPath() {
|
|
||||||
return {
|
|
||||||
name: "babel-plugin-strip-src-path",
|
|
||||||
visitor: {
|
|
||||||
"ImportDeclaration|ExportNamedDeclaration|ExportAllDeclaration":
|
|
||||||
function ({ node }) {
|
|
||||||
if (node.source?.value.includes("/src/")) {
|
|
||||||
node.source.value = node.source.value.replace("/src/", "/");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -326,8 +288,4 @@ function preprocessPDFJSCode(ctx, content) {
|
|||||||
}).code;
|
}).code;
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export { babelPluginPDFJSPreprocessor, preprocessPDFJSCode };
|
||||||
babelPluginPDFJSPreprocessor,
|
|
||||||
babelPluginStripSrcPath,
|
|
||||||
preprocessPDFJSCode,
|
|
||||||
};
|
|
||||||
|
|||||||
26
external/builder/builder.mjs
vendored
26
external/builder/builder.mjs
vendored
@ -39,22 +39,15 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function expandCssImports(content, baseUrl) {
|
function expandCssImports(content, baseUrl) {
|
||||||
if (defines.GECKOVIEW) {
|
|
||||||
// In Geckoview, we don't need some styles.
|
|
||||||
const startComment = "/* Ignored in GECKOVIEW: begin */";
|
|
||||||
const endComment = "/* Ignored in GECKOVIEW: end */";
|
|
||||||
const beginIndex = content.indexOf(startComment);
|
|
||||||
const endIndex = content.indexOf(endComment);
|
|
||||||
if (beginIndex >= 0 && endIndex > beginIndex) {
|
|
||||||
content =
|
|
||||||
content.substring(0, beginIndex) +
|
|
||||||
content.substring(endIndex + endComment.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return content.replaceAll(
|
return content.replaceAll(
|
||||||
/^\s*@import\s+url\(([^)]+)\);\s*$/gm,
|
/^\s*@import\s+url\(([^)]+)\);\s*$/gm,
|
||||||
function (all, url) {
|
function (all, url) {
|
||||||
|
if (defines.GECKOVIEW) {
|
||||||
|
switch (url) {
|
||||||
|
case "annotation_editor_layer_builder.css":
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
const file = path.join(path.dirname(baseUrl), url);
|
const file = path.join(path.dirname(baseUrl), url);
|
||||||
const imported = fs.readFileSync(file, "utf8").toString();
|
const imported = fs.readFileSync(file, "utf8").toString();
|
||||||
return expandCssImports(imported, file);
|
return expandCssImports(imported, file);
|
||||||
@ -132,7 +125,7 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function expand(line) {
|
function expand(line) {
|
||||||
line = line.replaceAll(/__\w+__/g, function (variable) {
|
line = line.replaceAll(/__[\w]+__/g, function (variable) {
|
||||||
variable = variable.substring(2, variable.length - 2);
|
variable = variable.substring(2, variable.length - 2);
|
||||||
if (variable in defines) {
|
if (variable in defines) {
|
||||||
return defines[variable];
|
return defines[variable];
|
||||||
@ -158,8 +151,7 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
let state = STATE_NONE;
|
let state = STATE_NONE;
|
||||||
const stack = [];
|
const stack = [];
|
||||||
const control =
|
const control =
|
||||||
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
/^(?:\/\/|\s*\/\*|<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:\*\/|-->)?$)?/;
|
||||||
/^(?:\/\/|\s*\/\*|\s*<!--)\s*#(if|elif|else|endif|expand|include|error)\b(?:\s+(.*?)(?:\*\/|-->)?$)?/;
|
|
||||||
|
|
||||||
while ((line = readLine()) !== null) {
|
while ((line = readLine()) !== null) {
|
||||||
++lineNumber;
|
++lineNumber;
|
||||||
@ -221,7 +213,7 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
) {
|
) {
|
||||||
writeLine(
|
writeLine(
|
||||||
line
|
line
|
||||||
.replaceAll(/^\/\/|^\s*<!--/g, " ")
|
.replaceAll(/^\/\/|^<!--/g, " ")
|
||||||
.replaceAll(/(^\s*)\/\*/g, "$1 ")
|
.replaceAll(/(^\s*)\/\*/g, "$1 ")
|
||||||
.replaceAll(/\*\/$|-->$/g, "")
|
.replaceAll(/\*\/$|-->$/g, "")
|
||||||
);
|
);
|
||||||
|
|||||||
@ -8,4 +8,3 @@ function test() {
|
|||||||
}
|
}
|
||||||
"4";
|
"4";
|
||||||
}
|
}
|
||||||
test();
|
|
||||||
|
|||||||
1
external/builder/fixtures_babel/blocks.js
vendored
1
external/builder/fixtures_babel/blocks.js
vendored
@ -17,4 +17,3 @@ function test() {
|
|||||||
"4";
|
"4";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test();
|
|
||||||
|
|||||||
@ -2,12 +2,10 @@ function f1() {
|
|||||||
"1";
|
"1";
|
||||||
"2";
|
"2";
|
||||||
}
|
}
|
||||||
f1();
|
|
||||||
function f2() {
|
function f2() {
|
||||||
"1";
|
"1";
|
||||||
"2";
|
"2";
|
||||||
}
|
}
|
||||||
f2();
|
|
||||||
function f3() {
|
function f3() {
|
||||||
if ("1") {
|
if ("1") {
|
||||||
"1";
|
"1";
|
||||||
@ -17,4 +15,3 @@ function f3() {
|
|||||||
"4";
|
"4";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f3();
|
|
||||||
|
|||||||
3
external/builder/fixtures_babel/comments.js
vendored
3
external/builder/fixtures_babel/comments.js
vendored
@ -6,7 +6,6 @@ function f1() {
|
|||||||
"2";
|
"2";
|
||||||
/* tail */
|
/* tail */
|
||||||
}
|
}
|
||||||
f1();
|
|
||||||
|
|
||||||
function f2() {
|
function f2() {
|
||||||
// head
|
// head
|
||||||
@ -15,7 +14,6 @@ function f2() {
|
|||||||
"2";
|
"2";
|
||||||
// tail
|
// tail
|
||||||
}
|
}
|
||||||
f2();
|
|
||||||
|
|
||||||
function f3() {
|
function f3() {
|
||||||
if ("1") { // begin block
|
if ("1") { // begin block
|
||||||
@ -26,4 +24,3 @@ function f3() {
|
|||||||
"4";
|
"4";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f3();
|
|
||||||
|
|||||||
@ -1,18 +1,14 @@
|
|||||||
function f1() {}
|
function f1() {}
|
||||||
f1();
|
|
||||||
function f2() {
|
function f2() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
f2();
|
|
||||||
function f3() {
|
function f3() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
throw "test";
|
throw "test";
|
||||||
}
|
}
|
||||||
f3();
|
|
||||||
function f4() {
|
function f4() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
}
|
}
|
||||||
f4();
|
|
||||||
var obj = {
|
var obj = {
|
||||||
method1() {},
|
method1() {},
|
||||||
method2() {}
|
method2() {}
|
||||||
|
|||||||
4
external/builder/fixtures_babel/deadcode.js
vendored
4
external/builder/fixtures_babel/deadcode.js
vendored
@ -2,20 +2,17 @@ function f1() {
|
|||||||
return;
|
return;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
}
|
}
|
||||||
f1();
|
|
||||||
|
|
||||||
function f2() {
|
function f2() {
|
||||||
return 1;
|
return 1;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
}
|
}
|
||||||
f2();
|
|
||||||
|
|
||||||
function f3() {
|
function f3() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
throw "test";
|
throw "test";
|
||||||
var j = 0;
|
var j = 0;
|
||||||
}
|
}
|
||||||
f3();
|
|
||||||
|
|
||||||
function f4() {
|
function f4() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@ -25,7 +22,6 @@ function f4() {
|
|||||||
throw "test";
|
throw "test";
|
||||||
var j = 0;
|
var j = 0;
|
||||||
}
|
}
|
||||||
f4();
|
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
method1() { return; var i = 0; },
|
method1() { return; var i = 0; },
|
||||||
|
|||||||
@ -16,4 +16,3 @@ if ('1') {
|
|||||||
function f1() {
|
function f1() {
|
||||||
"1";
|
"1";
|
||||||
}
|
}
|
||||||
f1();
|
|
||||||
|
|||||||
1
external/builder/fixtures_babel/ifs.js
vendored
1
external/builder/fixtures_babel/ifs.js
vendored
@ -32,4 +32,3 @@ function f1() {
|
|||||||
"2";
|
"2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f1();
|
|
||||||
|
|||||||
4
external/builder/fixtures_babel/ignore-expected.js
vendored
Normal file
4
external/builder/fixtures_babel/ignore-expected.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const wasmUrl = new URL(
|
||||||
|
/*webpackIgnore: true*/
|
||||||
|
/*@vite-ignore*/
|
||||||
|
"qwerty.wasm", import.meta.url);
|
||||||
1
external/builder/fixtures_babel/ignore.js
vendored
Normal file
1
external/builder/fixtures_babel/ignore.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
const wasmUrl = new URL("qwerty.wasm" , import.meta.url);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
function usedByUsed() {}
|
|
||||||
function used() {
|
|
||||||
usedByUsed();
|
|
||||||
}
|
|
||||||
used();
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
function usedByUsed() {}
|
|
||||||
function usedByUnused() {}
|
|
||||||
function usedByRemovedCode() {}
|
|
||||||
|
|
||||||
function used() {
|
|
||||||
usedByUsed();
|
|
||||||
return;
|
|
||||||
usedByRemovedCode();
|
|
||||||
}
|
|
||||||
function unused() {
|
|
||||||
usedByUnused();
|
|
||||||
}
|
|
||||||
|
|
||||||
used();
|
|
||||||
3
external/builder/test-fixtures.mjs
vendored
3
external/builder/test-fixtures.mjs
vendored
@ -1,8 +1,9 @@
|
|||||||
import * as builder from "./builder.mjs";
|
import * as builder from "./builder.mjs";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
const __dirname = import.meta.dirname;
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
let errors = 0;
|
let errors = 0;
|
||||||
|
|
||||||
|
|||||||
3
external/builder/test-fixtures_babel.mjs
vendored
3
external/builder/test-fixtures_babel.mjs
vendored
@ -1,8 +1,9 @@
|
|||||||
|
import { fileURLToPath } from "url";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { preprocessPDFJSCode } from "./babel-plugin-pdfjs-preprocessor.mjs";
|
import { preprocessPDFJSCode } from "./babel-plugin-pdfjs-preprocessor.mjs";
|
||||||
|
|
||||||
const __dirname = import.meta.dirname;
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
let errors = 0;
|
let errors = 0;
|
||||||
|
|
||||||
|
|||||||
40
external/ccov/coverage_format.mjs
vendored
40
external/ccov/coverage_format.mjs
vendored
@ -1,40 +0,0 @@
|
|||||||
/* Copyright 2026 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const COVERAGE_FORMAT_TO_REPORTER = {
|
|
||||||
info: "lcovonly",
|
|
||||||
html: "html",
|
|
||||||
json: "json",
|
|
||||||
text: "text",
|
|
||||||
cobertura: "cobertura",
|
|
||||||
clover: "clover",
|
|
||||||
};
|
|
||||||
|
|
||||||
function parseCoverageFormats(str) {
|
|
||||||
const formats = new Set();
|
|
||||||
for (const fmt of (str ?? "").split(",")) {
|
|
||||||
const name = fmt.trim();
|
|
||||||
if (name && COVERAGE_FORMAT_TO_REPORTER[name]) {
|
|
||||||
formats.add(name);
|
|
||||||
} else if (name) {
|
|
||||||
console.warn(
|
|
||||||
`### Unknown coverage format "${name}", valid values: ${Object.keys(COVERAGE_FORMAT_TO_REPORTER).join(", ")}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formats.size > 0 ? formats : new Set(["info"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { COVERAGE_FORMAT_TO_REPORTER, parseCoverageFormats };
|
|
||||||
110
external/ccov/coverage_search.mjs
vendored
110
external/ccov/coverage_search.mjs
vendored
@ -1,110 +0,0 @@
|
|||||||
/* Copyright 2026 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import fs from "fs";
|
|
||||||
import { parseArgs } from "node:util";
|
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
const __dirname = import.meta.dirname;
|
|
||||||
const PROJECT_ROOT = path.join(__dirname, "../..");
|
|
||||||
|
|
||||||
const { values } = parseArgs({
|
|
||||||
args: process.argv.slice(2),
|
|
||||||
options: {
|
|
||||||
code: { type: "string" },
|
|
||||||
"coverage-dir": { type: "string", default: "build/coverage" },
|
|
||||||
help: { type: "boolean", short: "h", default: false },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (values.help || !values.code) {
|
|
||||||
console.log(
|
|
||||||
"Usage: coverage_search.mjs --code=<file>::<line|function> [--coverage-dir=<path>]\n\n" +
|
|
||||||
" --code Source file and line number or function name to search for.\n" +
|
|
||||||
" Examples:\n" +
|
|
||||||
" --code=canvas.js::205\n" +
|
|
||||||
" --code=canvas.js::drawImageAtIntegerCoords\n" +
|
|
||||||
" --coverage-dir Coverage directory containing per-test-index.json [build/coverage]\n\n" +
|
|
||||||
"Prints to stdout the IDs of tests whose coverage includes the given line or\n" +
|
|
||||||
"function (one ID per line).\n" +
|
|
||||||
"Run browsertest with --coverage-per-test first to generate the index."
|
|
||||||
);
|
|
||||||
process.exit(values.help ? 0 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const sep = values.code.indexOf("::");
|
|
||||||
if (sep === -1) {
|
|
||||||
console.error(
|
|
||||||
"Error: --code must be in format 'file.js::line_or_function', e.g. canvas.js::205"
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileName = values.code.slice(0, sep);
|
|
||||||
const location = values.code.slice(sep + 2);
|
|
||||||
const isLine = /^\d+$/.test(location);
|
|
||||||
const lineNum = isLine ? parseInt(location, 10) : null;
|
|
||||||
const funcName = isLine ? null : location;
|
|
||||||
|
|
||||||
const coverageDir = path.isAbsolute(values["coverage-dir"])
|
|
||||||
? values["coverage-dir"]
|
|
||||||
: path.join(PROJECT_ROOT, values["coverage-dir"]);
|
|
||||||
|
|
||||||
const indexPath = path.join(coverageDir, "per-test-index.json");
|
|
||||||
if (!fs.existsSync(indexPath)) {
|
|
||||||
console.error(`Error: index file not found: ${indexPath}`);
|
|
||||||
console.error("Run browsertest with --coverage-per-test first.");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { ids, files } = JSON.parse(fs.readFileSync(indexPath, "utf8"));
|
|
||||||
|
|
||||||
// Find the file entry whose path matches fileName.
|
|
||||||
let fileEntry = null;
|
|
||||||
for (const [filePath, entry] of Object.entries(files)) {
|
|
||||||
if (
|
|
||||||
filePath === fileName ||
|
|
||||||
filePath.endsWith(`/${fileName}`) ||
|
|
||||||
filePath.endsWith(`\\${fileName}`)
|
|
||||||
) {
|
|
||||||
fileEntry = entry;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fileEntry) {
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
let testIndices = null;
|
|
||||||
|
|
||||||
if (lineNum !== null) {
|
|
||||||
// Direct line lookup.
|
|
||||||
testIndices = fileEntry.l?.[lineNum];
|
|
||||||
|
|
||||||
// If no hit, check whether lineNum is a function declaration start and
|
|
||||||
// redirect to that function's coverage.
|
|
||||||
if (!testIndices && fileEntry.fstarts?.[lineNum]) {
|
|
||||||
testIndices = fileEntry.f?.[fileEntry.fstarts[lineNum]];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
testIndices = fileEntry.f?.[funcName];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (testIndices) {
|
|
||||||
for (const idx of testIndices) {
|
|
||||||
console.log(ids[idx]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
190
external/check_l10n/check_l10n.mjs
vendored
190
external/check_l10n/check_l10n.mjs
vendored
@ -1,190 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/* Copyright 2026 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks that every message ID defined in l10n/en-US/viewer.ftl is referenced
|
|
||||||
* in at least one HTML or JS/MJS file under the web/ directory.
|
|
||||||
*
|
|
||||||
* Usage: node external/check_l10n/check_l10n.mjs
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { extname, join } from "path";
|
|
||||||
import { readdirSync, readFileSync, statSync } from "fs";
|
|
||||||
|
|
||||||
const ROOT = join(import.meta.dirname, "..", "..");
|
|
||||||
const FTL_PATH = join(ROOT, "l10n", "en-US", "viewer.ftl");
|
|
||||||
const SEARCH_DIRS = ["web", "src"];
|
|
||||||
const SEARCH_EXTENSIONS = new Set([".html", ".js", ".mjs"]);
|
|
||||||
// Minimum number of characters a prefix or suffix fragment must have to be
|
|
||||||
// considered a meaningful match when detecting dynamically-built IDs.
|
|
||||||
const MIN_FRAGMENT_LENGTH = 6;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract all message IDs from a Fluent (.ftl) file.
|
|
||||||
* A message ID is an identifier at the start of a line followed by " =".
|
|
||||||
* @param {string} ftlPath - Absolute path to the .ftl file.
|
|
||||||
* @returns {string[]} Ordered list of message IDs.
|
|
||||||
*/
|
|
||||||
function extractFtlIds(ftlPath) {
|
|
||||||
const lines = readFileSync(ftlPath, "utf8").split("\n");
|
|
||||||
const ids = [];
|
|
||||||
for (const line of lines) {
|
|
||||||
const match = line.match(/^([a-z][a-z0-9-]*)\s*=/i);
|
|
||||||
if (match) {
|
|
||||||
ids.push(match[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively collect all files with matching extensions under a directory.
|
|
||||||
* @param {string} dir - Directory to walk.
|
|
||||||
* @param {Set<string>} extensions - Allowed file extensions (e.g. `".js"`).
|
|
||||||
* @returns {string[]} Absolute paths of matching files.
|
|
||||||
*/
|
|
||||||
function collectFiles(dir, extensions) {
|
|
||||||
const results = [];
|
|
||||||
for (const entry of readdirSync(dir)) {
|
|
||||||
const fullPath = join(dir, entry);
|
|
||||||
const stat = statSync(fullPath);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
results.push(...collectFiles(fullPath, extensions));
|
|
||||||
} else if (extensions.has(extname(entry))) {
|
|
||||||
results.push(fullPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the contents of all source files found under the given directories.
|
|
||||||
* @param {string[]} dirs - Directory names relative to ROOT.
|
|
||||||
* @param {Set<string>} extensions - Allowed file extensions.
|
|
||||||
* @returns {{ path: string, content: string }[]}
|
|
||||||
*/
|
|
||||||
function loadSources(dirs, extensions) {
|
|
||||||
const files = dirs.flatMap(d => collectFiles(join(ROOT, d), extensions));
|
|
||||||
return files.map(f => ({ path: f, content: readFileSync(f, "utf8") }));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether a message ID appears as a quoted string literal in any source
|
|
||||||
* file. Handles double quotes, single quotes, and backticks, covering:
|
|
||||||
* - `data-l10n-id="pdfjs-foo"` (HTML attribute)
|
|
||||||
* - `"pdfjs-foo"` / `'pdfjs-foo'` / `` `pdfjs-foo` `` (JS string literals,
|
|
||||||
* `setAttribute`, `l10n.get`, …)
|
|
||||||
* @param {string} id - Message ID to look up.
|
|
||||||
* @param {{ path: string, content: string }[]} sources
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function isUsed(id, sources) {
|
|
||||||
const dq = `"${id}"`;
|
|
||||||
const sq = `'${id}'`;
|
|
||||||
const bt = `\`${id}\``;
|
|
||||||
return sources.some(
|
|
||||||
({ content }) =>
|
|
||||||
content.includes(dq) || content.includes(sq) || content.includes(bt)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For IDs not found as complete literals, check whether the ID is likely
|
|
||||||
* constructed dynamically via a template literal such as:
|
|
||||||
* `pdfjs-editor-${editorType}-added-alert`
|
|
||||||
*
|
|
||||||
* Strategy: try every (prefix, suffix) pair obtained by splitting the ID's
|
|
||||||
* dash-separated components, leaving one or more components as the "variable"
|
|
||||||
* 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
|
|
||||||
* matching template literal, or `null` if none found.
|
|
||||||
*/
|
|
||||||
function findDynamicLocation(id, sources) {
|
|
||||||
const parts = id.split("-");
|
|
||||||
// i = end of prefix (exclusive), j = start of suffix (inclusive)
|
|
||||||
for (let i = 1; i < parts.length; i++) {
|
|
||||||
for (let j = i + 1; j <= parts.length; j++) {
|
|
||||||
const prefix = parts.slice(0, i).join("-") + "-"; // e.g. "pdfjs-editor-"
|
|
||||||
const suffix = j < parts.length ? "-" + parts.slice(j).join("-") : ""; // e.g. "-added-alert"
|
|
||||||
if (prefix.length < MIN_FRAGMENT_LENGTH) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (suffix !== "" && suffix.length < MIN_FRAGMENT_LENGTH) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// The prefix must be immediately followed by "${" in a template literal.
|
|
||||||
const prefixWithVar = prefix + "${";
|
|
||||||
for (const { path, content } of sources) {
|
|
||||||
if (
|
|
||||||
content.includes(prefixWithVar) &&
|
|
||||||
(suffix === "" || content.includes(suffix))
|
|
||||||
) {
|
|
||||||
const idx = content.indexOf(prefixWithVar);
|
|
||||||
const line = content.slice(0, idx).split("\n").length;
|
|
||||||
return { path, line };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
const ids = extractFtlIds(FTL_PATH);
|
|
||||||
console.log(`Found ${ids.length} message IDs in viewer.ftl\n`);
|
|
||||||
|
|
||||||
const sources = loadSources(SEARCH_DIRS, SEARCH_EXTENSIONS);
|
|
||||||
console.log(
|
|
||||||
`Searching in ${sources.length} files under: ${SEARCH_DIRS.join(", ")}\n`
|
|
||||||
);
|
|
||||||
|
|
||||||
const notFound = ids.filter(id => !isUsed(id, sources));
|
|
||||||
const dynamicEntries = notFound
|
|
||||||
.map(id => ({ id, loc: findDynamicLocation(id, sources) }))
|
|
||||||
.filter(({ loc }) => loc !== null);
|
|
||||||
const dynamicIds = new Set(dynamicEntries.map(({ id }) => id));
|
|
||||||
const unused = notFound.filter(id => !dynamicIds.has(id));
|
|
||||||
|
|
||||||
if (dynamicEntries.length > 0) {
|
|
||||||
console.log(
|
|
||||||
`~ ${dynamicEntries.length} ID(s) likely built dynamically (template literals):\n`
|
|
||||||
);
|
|
||||||
for (const { id, loc } of dynamicEntries) {
|
|
||||||
const rel = loc.path.replace(ROOT + "/", "").replace(ROOT + "\\", "");
|
|
||||||
console.log(` ${id}`);
|
|
||||||
console.log(` → ${rel}:${loc.line}`);
|
|
||||||
}
|
|
||||||
console.log();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unused.length === 0) {
|
|
||||||
console.log("✓ All remaining message IDs are used.");
|
|
||||||
} else {
|
|
||||||
console.log(`✗ ${unused.length} unused message ID(s):\n`);
|
|
||||||
for (const id of unused) {
|
|
||||||
console.log(` ${id}`);
|
|
||||||
}
|
|
||||||
process.exitCode = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
270
external/chromium/prefs.mjs
vendored
270
external/chromium/prefs.mjs
vendored
@ -1,270 +0,0 @@
|
|||||||
/* Copyright 2026 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const prefsMetadata = {
|
|
||||||
annotationEditorMode: {
|
|
||||||
enum: [-1, 0, 3, 15],
|
|
||||||
},
|
|
||||||
annotationMode: {
|
|
||||||
enum: [0, 1, 2, 3],
|
|
||||||
},
|
|
||||||
cursorToolOnLoad: {
|
|
||||||
title: "Cursor tool on load",
|
|
||||||
description:
|
|
||||||
"The cursor tool that is enabled upon load.\n 0 = Text selection tool.\n 1 = Hand tool.",
|
|
||||||
enum: [0, 1],
|
|
||||||
},
|
|
||||||
defaultZoomDelay: {
|
|
||||||
title: "Default zoom delay",
|
|
||||||
description: "Delay (in ms) to wait before redrawing the canvas.",
|
|
||||||
},
|
|
||||||
defaultZoomValue: {
|
|
||||||
title: "Default zoom level",
|
|
||||||
description:
|
|
||||||
"Default zoom level of the viewer. Accepted values: 'auto', 'page-actual', 'page-width', 'page-height', 'page-fit', or a zoom level in percents.",
|
|
||||||
pattern:
|
|
||||||
"|auto|page-actual|page-width|page-height|page-fit|[0-9]+\\.?[0-9]*(,[0-9]+\\.?[0-9]*){0,2}",
|
|
||||||
},
|
|
||||||
disableFontFace: {
|
|
||||||
title: "Disable @font-face",
|
|
||||||
description:
|
|
||||||
"Whether to disable @font-face and fall back to canvas rendering (this is more resource-intensive).",
|
|
||||||
},
|
|
||||||
disableRange: {
|
|
||||||
title: "Disable range requests",
|
|
||||||
description: "Whether to disable range requests (not recommended).",
|
|
||||||
},
|
|
||||||
disableStream: {
|
|
||||||
title: "Disable streaming for requests",
|
|
||||||
description: "Whether to disable streaming for requests (not recommended).",
|
|
||||||
},
|
|
||||||
disableTelemetry: {
|
|
||||||
title: "Disable telemetry",
|
|
||||||
description:
|
|
||||||
"Whether to prevent the extension from reporting the extension and browser version to the extension developers.",
|
|
||||||
},
|
|
||||||
enableAutoLinking: {
|
|
||||||
description: "Enable creation of hyperlinks from text that look like URLs.",
|
|
||||||
},
|
|
||||||
enableComment: {
|
|
||||||
description: "Enable creation of comment annotations.",
|
|
||||||
},
|
|
||||||
enableHWA: {
|
|
||||||
title: "Enable hardware acceleration",
|
|
||||||
description: "Whether to enable hardware acceleration.",
|
|
||||||
},
|
|
||||||
enableOptimizedPartialRendering: {
|
|
||||||
description:
|
|
||||||
"Enable tracking of PDF operations to optimize partial rendering.",
|
|
||||||
},
|
|
||||||
enablePrintAutoRotate: {
|
|
||||||
title: "Automatically rotate printed pages",
|
|
||||||
description: "When enabled, landscape pages are rotated when printed.",
|
|
||||||
},
|
|
||||||
enableScripting: {
|
|
||||||
title: "Enable active content (JavaScript) in PDFs",
|
|
||||||
description:
|
|
||||||
"Whether to allow execution of active content (JavaScript) by PDF files.",
|
|
||||||
},
|
|
||||||
externalLinkTarget: {
|
|
||||||
title: "External links target window",
|
|
||||||
description:
|
|
||||||
"Controls how external links will be opened.\n 0 = default.\n 1 = replaces current window.\n 2 = new window/tab.\n 3 = parent.\n 4 = in top window.",
|
|
||||||
enum: [0, 1, 2, 3, 4],
|
|
||||||
},
|
|
||||||
forcePageColors: {
|
|
||||||
description:
|
|
||||||
"When enabled, the pdf rendering will use the high contrast mode colors",
|
|
||||||
},
|
|
||||||
ignoreDestinationZoom: {
|
|
||||||
title: "Ignore the zoom argument in destinations",
|
|
||||||
description:
|
|
||||||
"When enabled it will maintain the currently active zoom level, rather than letting the PDF document modify it, when navigating to internal destinations.",
|
|
||||||
},
|
|
||||||
pageColorsBackground: {
|
|
||||||
description:
|
|
||||||
"The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
|
|
||||||
},
|
|
||||||
pageColorsForeground: {
|
|
||||||
description:
|
|
||||||
"The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
|
|
||||||
},
|
|
||||||
pdfBugEnabled: {
|
|
||||||
title: "Enable debugging tools",
|
|
||||||
description: "Whether to enable debugging tools.",
|
|
||||||
},
|
|
||||||
scrollModeOnLoad: {
|
|
||||||
title: "Scroll mode on load",
|
|
||||||
description:
|
|
||||||
"Controls how the viewer scrolls upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = Vertical scrolling.\n 1 = Horizontal scrolling.\n 2 = Wrapped scrolling.\n 3 = Page scrolling.",
|
|
||||||
enum: [-1, 0, 1, 2, 3],
|
|
||||||
},
|
|
||||||
sidebarViewOnLoad: {
|
|
||||||
title: "Sidebar state on load",
|
|
||||||
description:
|
|
||||||
"Controls the state of the sidebar upon load.\n -1 = Default (uses PageMode if available, otherwise the last position if available/enabled).\n 0 = Do not show sidebar.\n 1 = Show thumbnails in sidebar.\n 2 = Show document outline in sidebar.\n 3 = Show attachments in sidebar.",
|
|
||||||
enum: [-1, 0, 1, 2, 3],
|
|
||||||
},
|
|
||||||
spreadModeOnLoad: {
|
|
||||||
title: "Spread mode on load",
|
|
||||||
description:
|
|
||||||
"Whether the viewer should join pages into spreads upon load.\n -1 = Default (uses the last position if available/enabled).\n 0 = No spreads.\n 1 = Odd spreads.\n 2 = Even spreads.",
|
|
||||||
enum: [-1, 0, 1, 2],
|
|
||||||
},
|
|
||||||
textLayerMode: {
|
|
||||||
title: "Text layer mode",
|
|
||||||
description:
|
|
||||||
"Controls if the text layer is enabled, and the selection mode that is used.\n 0 = Disabled.\n 1 = Enabled.",
|
|
||||||
enum: [0, 1],
|
|
||||||
},
|
|
||||||
viewerCssTheme: {
|
|
||||||
title: "Theme",
|
|
||||||
description:
|
|
||||||
"The theme to use.\n0 = Use system theme.\n1 = Light theme.\n2 = Dark theme.",
|
|
||||||
enum: [0, 1, 2],
|
|
||||||
},
|
|
||||||
viewOnLoad: {
|
|
||||||
title: "View position on load",
|
|
||||||
description:
|
|
||||||
"The position in the document upon load.\n -1 = Default (uses OpenAction if available, otherwise equal to `viewOnLoad = 0`).\n 0 = The last viewed page/position.\n 1 = The initial page/position.",
|
|
||||||
enum: [-1, 0, 1],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Deprecated keys are allowed in the managed preferences file.
|
|
||||||
// The code maintainer is responsible for adding migration logic to
|
|
||||||
// extensions/chromium/options/migration.js and web/chromecom.js .
|
|
||||||
const deprecatedPrefs = {
|
|
||||||
disablePageMode: {
|
|
||||||
description: "DEPRECATED.",
|
|
||||||
type: "boolean",
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
disableTextLayer: {
|
|
||||||
description:
|
|
||||||
"DEPRECATED. Set textLayerMode to 0 to disable the text selection layer by default.",
|
|
||||||
type: "boolean",
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
enableHandToolOnLoad: {
|
|
||||||
description:
|
|
||||||
"DEPRECATED. Set cursorToolOnLoad to 1 to enable the hand tool by default.",
|
|
||||||
type: "boolean",
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
showPreviousViewOnLoad: {
|
|
||||||
description:
|
|
||||||
"DEPRECATED. Set viewOnLoad to 1 to disable showing the last page/position on load.",
|
|
||||||
type: "boolean",
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
function buildPrefsSchema(prefs) {
|
|
||||||
const properties = Object.create(null);
|
|
||||||
|
|
||||||
for (const name in prefs) {
|
|
||||||
const pref = prefs[name];
|
|
||||||
let type = typeof pref;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case "boolean":
|
|
||||||
case "string":
|
|
||||||
break;
|
|
||||||
case "number":
|
|
||||||
type = "integer";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(`Invalid type (${type}) for "${name}"-preference.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const metadata = prefsMetadata[name];
|
|
||||||
if (metadata) {
|
|
||||||
let numMetadataKeys = 0;
|
|
||||||
// Do some (very basic) validation of the metadata.
|
|
||||||
for (const key in metadata) {
|
|
||||||
const entry = metadata[key];
|
|
||||||
|
|
||||||
switch (key) {
|
|
||||||
case "default":
|
|
||||||
case "type":
|
|
||||||
throw new Error(
|
|
||||||
`Invalid key (${key}) in metadata for "${name}"-preference.`
|
|
||||||
);
|
|
||||||
case "description":
|
|
||||||
if (entry.startsWith("DEPRECATED.")) {
|
|
||||||
throw new Error(
|
|
||||||
`The \`description\` of the "${name}"-preference cannot begin with "DEPRECATED."`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
numMetadataKeys++;
|
|
||||||
}
|
|
||||||
if (numMetadataKeys === 0) {
|
|
||||||
throw new Error(
|
|
||||||
`No metadata for "${name}"-preference, remove the entry.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
properties[name] = {
|
|
||||||
type,
|
|
||||||
default: pref,
|
|
||||||
...metadata,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const name in prefsMetadata) {
|
|
||||||
if (!properties[name]) {
|
|
||||||
// Do *not* throw here, since keeping the metadata up-to-date should be
|
|
||||||
// the responsibility of the CHROMIUM-addon maintainer.
|
|
||||||
console.error(
|
|
||||||
`The "${name}"-preference was removed, add it to \`deprecatedPrefs\` instead.\n`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const name in deprecatedPrefs) {
|
|
||||||
const entry = deprecatedPrefs[name];
|
|
||||||
|
|
||||||
if (properties[name]) {
|
|
||||||
throw new Error(
|
|
||||||
`The "${name}"-preference should not be listed as deprecated.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!entry.description?.startsWith("DEPRECATED.")) {
|
|
||||||
throw new Error(
|
|
||||||
`The \`description\` of the deprecated "${name}"-preference must begin with "DEPRECATED."`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
for (const key of ["default", "type"]) {
|
|
||||||
if (key in entry) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
throw new Error(
|
|
||||||
`A \`${key}\` entry must be provided for the deprecated "${name}"-preference.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
properties[name] = entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
type: "object",
|
|
||||||
properties,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export { buildPrefsSchema };
|
|
||||||
4
external/cmapscompress/parse.mjs
vendored
4
external/cmapscompress/parse.mjs
vendored
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function parseAdobeCMap(content) {
|
function parseAdobeCMap(content) {
|
||||||
let m = /(\bbegincmap\b[\s\S]+?)\bendcmap\b/.exec(content);
|
let m = /(\bbegincmap\b[\s\S]*?)\bendcmap\b/.exec(content);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
throw new Error("cmap was not found");
|
throw new Error("cmap was not found");
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ function parseAdobeCMap(content) {
|
|||||||
result.usecmap = m[1];
|
result.usecmap = m[1];
|
||||||
}
|
}
|
||||||
const re =
|
const re =
|
||||||
/(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(?:endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
|
/(\d+)\s+(begincodespacerange|beginnotdefrange|begincidchar|begincidrange|beginbfchar|beginbfrange)\n([\s\S]*?)\n(endcodespacerange|endnotdefrange|endcidchar|endcidrange|endbfchar|endbfrange)/g;
|
||||||
while ((m = re.exec(body))) {
|
while ((m = re.exec(body))) {
|
||||||
const lines = m[3].toLowerCase().split("\n");
|
const lines = m[3].toLowerCase().split("\n");
|
||||||
|
|
||||||
|
|||||||
118
external/eslint_plugins/prefer-math-clamp.mjs
vendored
118
external/eslint_plugins/prefer-math-clamp.mjs
vendored
@ -1,118 +0,0 @@
|
|||||||
/**
|
|
||||||
* ESLint rule to prefer `MathClamp(v, min, max)` over nested
|
|
||||||
* `Math.min(Math.max(...), ...)` / `Math.max(Math.min(...), ...)` patterns.
|
|
||||||
*
|
|
||||||
* Detected patterns and their fixes:
|
|
||||||
* Math.min(Math.max(A, B), C) → MathClamp(A, B, C)
|
|
||||||
* Math.min(C, Math.max(A, B)) → MathClamp(A, B, C)
|
|
||||||
* Math.max(Math.min(A, B), C) → MathClamp(A, C, B)
|
|
||||||
* Math.max(C, Math.min(A, B)) → MathClamp(A, C, B)
|
|
||||||
*/
|
|
||||||
|
|
||||||
function isMathCall(node, method) {
|
|
||||||
return (
|
|
||||||
node.type === "CallExpression" &&
|
|
||||||
node.callee.type === "MemberExpression" &&
|
|
||||||
!node.callee.computed &&
|
|
||||||
node.callee.object.type === "Identifier" &&
|
|
||||||
node.callee.object.name === "Math" &&
|
|
||||||
node.callee.property.type === "Identifier" &&
|
|
||||||
node.callee.property.name === method &&
|
|
||||||
node.arguments.length === 2 &&
|
|
||||||
node.arguments.every(a => a.type !== "SpreadElement")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if node is a Math.min or Math.max call.
|
|
||||||
function isMathMinMax(node) {
|
|
||||||
return isMathCall(node, "min") || isMathCall(node, "max");
|
|
||||||
}
|
|
||||||
|
|
||||||
const preferMathClampRule = {
|
|
||||||
meta: {
|
|
||||||
type: "suggestion",
|
|
||||||
fixable: "code",
|
|
||||||
docs: {
|
|
||||||
description:
|
|
||||||
"Prefer MathClamp(v, min, max) over nested Math.min/Math.max",
|
|
||||||
},
|
|
||||||
messages: {
|
|
||||||
useClamp:
|
|
||||||
"Use MathClamp(v, min, max) instead of nested Math.min/Math.max.",
|
|
||||||
},
|
|
||||||
schema: [],
|
|
||||||
},
|
|
||||||
create(context) {
|
|
||||||
const src = context.sourceCode ?? context.getSourceCode();
|
|
||||||
|
|
||||||
return {
|
|
||||||
CallExpression(node) {
|
|
||||||
// Pattern: Math.min(Math.max(A, B), C) or Math.min(C, Math.max(A, B)).
|
|
||||||
// Fix as MathClamp(A, B, C) where A,B are inner args, C is outer arg.
|
|
||||||
if (isMathCall(node, "min")) {
|
|
||||||
const [arg0, arg1] = node.arguments;
|
|
||||||
let outerArg, innerNode;
|
|
||||||
|
|
||||||
// Math.max(Math.min(A, B), Math.min(C, D)) isn't a clamp pattern, so
|
|
||||||
// require the outer arg to not be a min/max call.
|
|
||||||
if (isMathCall(arg0, "max") && !isMathMinMax(arg1)) {
|
|
||||||
innerNode = arg0;
|
|
||||||
outerArg = arg1;
|
|
||||||
} else if (isMathCall(arg1, "max") && !isMathMinMax(arg0)) {
|
|
||||||
innerNode = arg1;
|
|
||||||
outerArg = arg0;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const v = src.getText(innerNode.arguments[0]);
|
|
||||||
const min = src.getText(innerNode.arguments[1]);
|
|
||||||
const max = src.getText(outerArg);
|
|
||||||
|
|
||||||
context.report({
|
|
||||||
node,
|
|
||||||
messageId: "useClamp",
|
|
||||||
fix(fixer) {
|
|
||||||
return fixer.replaceText(node, `MathClamp(${v}, ${min}, ${max})`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pattern: Math.max(Math.min(A, B), C) or Math.max(C, Math.min(A, B)).
|
|
||||||
// Fix as MathClamp(A, C, B) where A,B are inner args, C is outer arg.
|
|
||||||
if (isMathCall(node, "max")) {
|
|
||||||
const [arg0, arg1] = node.arguments;
|
|
||||||
let outerArg, innerNode;
|
|
||||||
|
|
||||||
if (isMathCall(arg0, "min") && !isMathMinMax(arg1)) {
|
|
||||||
innerNode = arg0;
|
|
||||||
outerArg = arg1;
|
|
||||||
} else if (isMathCall(arg1, "min") && !isMathMinMax(arg0)) {
|
|
||||||
innerNode = arg1;
|
|
||||||
outerArg = arg0;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const v = src.getText(innerNode.arguments[0]);
|
|
||||||
const max = src.getText(innerNode.arguments[1]);
|
|
||||||
const min = src.getText(outerArg);
|
|
||||||
|
|
||||||
context.report({
|
|
||||||
node,
|
|
||||||
messageId: "useClamp",
|
|
||||||
fix(fixer) {
|
|
||||||
return fixer.replaceText(node, `MathClamp(${v}, ${min}, ${max})`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
rules: {
|
|
||||||
"prefer-math-clamp": preferMathClampRule,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
0
external/iccs/CGATS001Compat-v2-micro.icc
vendored
Normal file → Executable file
0
external/iccs/CGATS001Compat-v2-micro.icc
vendored
Normal file → Executable file
13
external/importL10n/locales.mjs
vendored
13
external/importL10n/locales.mjs
vendored
@ -31,7 +31,7 @@ async function downloadLanguageCodes() {
|
|||||||
console.log("Downloading language codes...\n");
|
console.log("Downloading language codes...\n");
|
||||||
|
|
||||||
const ALL_LOCALES =
|
const ALL_LOCALES =
|
||||||
"https://raw.githubusercontent.com/mozilla-firefox/firefox/main/browser/locales/all-locales";
|
"https://raw.githubusercontent.com/mozilla/gecko-dev/master/browser/locales/all-locales";
|
||||||
|
|
||||||
const response = await fetch(ALL_LOCALES);
|
const response = await fetch(ALL_LOCALES);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@ -91,7 +91,7 @@ async function downloadL10n(root) {
|
|||||||
await downloadLanguageFiles(root, langCode);
|
await downloadLanguageFiles(root, langCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rmCodes = [];
|
const removeCodes = [];
|
||||||
for (const entry of fs.readdirSync(root)) {
|
for (const entry of fs.readdirSync(root)) {
|
||||||
const dirPath = path.join(root, entry),
|
const dirPath = path.join(root, entry),
|
||||||
stat = fs.lstatSync(dirPath);
|
stat = fs.lstatSync(dirPath);
|
||||||
@ -101,13 +101,14 @@ async function downloadL10n(root) {
|
|||||||
entry !== DEFAULT_LOCALE &&
|
entry !== DEFAULT_LOCALE &&
|
||||||
!langCodes.includes(entry)
|
!langCodes.includes(entry)
|
||||||
) {
|
) {
|
||||||
fs.rmSync(dirPath, { recursive: true, force: true });
|
removeCodes.push(entry);
|
||||||
rmCodes.push(entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rmCodes.length) {
|
if (removeCodes.length) {
|
||||||
console.log(
|
console.log(
|
||||||
`\nRemoved the following unmaintained locales: ${rmCodes.join(", ")}\n`
|
"\nConsider removing the following unmaintained locales:\n" +
|
||||||
|
removeCodes.join(", ") +
|
||||||
|
"\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
196
external/jbig2/LICENSE_JBIG2
vendored
196
external/jbig2/LICENSE_JBIG2
vendored
@ -1,196 +0,0 @@
|
|||||||
// Copyright 2014 The PDFium Authors
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Google Inc. nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from
|
|
||||||
// this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
https://www.apache.org/licenses/
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
1. Definitions.
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
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.
|
|
||||||
13
external/jbig2/LICENSE_PDFJS_JBIG2
vendored
13
external/jbig2/LICENSE_PDFJS_JBIG2
vendored
@ -1,13 +0,0 @@
|
|||||||
Copyright 2026 Mozilla Foundation
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
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.
|
|
||||||
12
external/jbig2/README.md
vendored
12
external/jbig2/README.md
vendored
@ -1,12 +0,0 @@
|
|||||||
## Build
|
|
||||||
|
|
||||||
In order to generate the file `jbig2.js`:
|
|
||||||
* git clone https://github.com/mozilla/pdf.js.jbig2/
|
|
||||||
* the build requires to have a [Docker](https://www.docker.com/) setup and then:
|
|
||||||
* `node build.js -C` to build the Docker image
|
|
||||||
* `node build.js -co /pdf.js/external/jbig2/` to compile the decoder
|
|
||||||
|
|
||||||
## Licensing
|
|
||||||
|
|
||||||
[PDFium](https://pdfium.googlesource.com/pdfium/) is under [Apache-2.0](https://pdfium.googlesource.com/pdfium/+/main/LICENSE)
|
|
||||||
and [pdf.js.jbig2](https://github.com/mozilla/pdf.js.jbig2/) is released under [Apache-2.0](https://github.com/mozilla/pdf.js.jbig2/blob/main/LICENSE) license so `jbig2.js` is released under [Apache-2.0](https://github.com/mozilla/pdf.js.jbig2/blob/main/LICENSE) license too.
|
|
||||||
3
external/jbig2/jbig2.js
vendored
3
external/jbig2/jbig2.js
vendored
File diff suppressed because one or more lines are too long
BIN
external/jbig2/jbig2.wasm
vendored
BIN
external/jbig2/jbig2.wasm
vendored
Binary file not shown.
15
external/jbig2/jbig2_nowasm_fallback.js
vendored
15
external/jbig2/jbig2_nowasm_fallback.js
vendored
File diff suppressed because one or more lines are too long
17
external/openjpeg/openjpeg.js
vendored
17
external/openjpeg/openjpeg.js
vendored
File diff suppressed because one or more lines are too long
BIN
external/openjpeg/openjpeg.wasm
vendored
BIN
external/openjpeg/openjpeg.wasm
vendored
Binary file not shown.
33
external/openjpeg/openjpeg_nowasm_fallback.js
vendored
33
external/openjpeg/openjpeg_nowasm_fallback.js
vendored
File diff suppressed because one or more lines are too long
284
external/qcms/qcms.js
vendored
284
external/qcms/qcms.js
vendored
@ -1,29 +1,34 @@
|
|||||||
/* THIS FILE IS GENERATED - DO NOT EDIT */
|
/* THIS FILE IS GENERATED - DO NOT EDIT */
|
||||||
import { copy_result, copy_rgb, make_cssRGB } from './qcms_utils.js';
|
import { copy_result, copy_rgb } from './qcms_utils.js';
|
||||||
|
|
||||||
|
let wasm;
|
||||||
|
|
||||||
/**
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
||||||
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
||||||
*/
|
|
||||||
export const DataType = Object.freeze({
|
|
||||||
RGB8: 0, "0": "RGB8",
|
|
||||||
RGBA8: 1, "1": "RGBA8",
|
|
||||||
BGRA8: 2, "2": "BGRA8",
|
|
||||||
Gray8: 3, "3": "Gray8",
|
|
||||||
GrayA8: 4, "4": "GrayA8",
|
|
||||||
CMYK: 5, "5": "CMYK",
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
||||||
* @enum {0 | 1 | 2 | 3}
|
|
||||||
*/
|
|
||||||
export const Intent = Object.freeze({
|
|
||||||
Perceptual: 0, "0": "Perceptual",
|
|
||||||
RelativeColorimetric: 1, "1": "RelativeColorimetric",
|
|
||||||
Saturation: 2, "2": "Saturation",
|
|
||||||
AbsoluteColorimetric: 3, "3": "AbsoluteColorimetric",
|
|
||||||
});
|
|
||||||
|
|
||||||
|
let cachedUint8ArrayMemory0 = null;
|
||||||
|
|
||||||
|
function getUint8ArrayMemory0() {
|
||||||
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
||||||
|
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
||||||
|
}
|
||||||
|
return cachedUint8ArrayMemory0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStringFromWasm0(ptr, len) {
|
||||||
|
ptr = ptr >>> 0;
|
||||||
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
||||||
|
}
|
||||||
|
|
||||||
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
|
function passArray8ToWasm0(arg, malloc) {
|
||||||
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
||||||
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
||||||
|
WASM_VECTOR_LEN = arg.length;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* # Safety
|
* # Safety
|
||||||
*
|
*
|
||||||
@ -37,6 +42,30 @@ export function qcms_convert_array(transformer, src) {
|
|||||||
wasm.qcms_convert_array(transformer, ptr0, len0);
|
wasm.qcms_convert_array(transformer, ptr0, len0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* # Safety
|
||||||
|
*
|
||||||
|
* This function is called directly from JavaScript.
|
||||||
|
* @param {number} transformer
|
||||||
|
* @param {number} src
|
||||||
|
*/
|
||||||
|
export function qcms_convert_one(transformer, src) {
|
||||||
|
wasm.qcms_convert_one(transformer, src);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* # Safety
|
||||||
|
*
|
||||||
|
* This function is called directly from JavaScript.
|
||||||
|
* @param {number} transformer
|
||||||
|
* @param {number} src1
|
||||||
|
* @param {number} src2
|
||||||
|
* @param {number} src3
|
||||||
|
*/
|
||||||
|
export function qcms_convert_three(transformer, src1, src2, src3) {
|
||||||
|
wasm.qcms_convert_three(transformer, src1, src2, src3);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* # Safety
|
* # Safety
|
||||||
*
|
*
|
||||||
@ -46,46 +75,9 @@ export function qcms_convert_array(transformer, src) {
|
|||||||
* @param {number} src2
|
* @param {number} src2
|
||||||
* @param {number} src3
|
* @param {number} src3
|
||||||
* @param {number} src4
|
* @param {number} src4
|
||||||
* @param {boolean} css
|
|
||||||
*/
|
*/
|
||||||
export function qcms_convert_four(transformer, src1, src2, src3, src4, css) {
|
export function qcms_convert_four(transformer, src1, src2, src3, src4) {
|
||||||
wasm.qcms_convert_four(transformer, src1, src2, src3, src4, css);
|
wasm.qcms_convert_four(transformer, src1, src2, src3, src4);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # Safety
|
|
||||||
*
|
|
||||||
* This function is called directly from JavaScript.
|
|
||||||
* @param {number} transformer
|
|
||||||
* @param {number} src
|
|
||||||
* @param {boolean} css
|
|
||||||
*/
|
|
||||||
export function qcms_convert_one(transformer, src, css) {
|
|
||||||
wasm.qcms_convert_one(transformer, src, css);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # Safety
|
|
||||||
*
|
|
||||||
* This function is called directly from JavaScript.
|
|
||||||
* @param {number} transformer
|
|
||||||
* @param {number} src1
|
|
||||||
* @param {number} src2
|
|
||||||
* @param {number} src3
|
|
||||||
* @param {boolean} css
|
|
||||||
*/
|
|
||||||
export function qcms_convert_three(transformer, src1, src2, src3, css) {
|
|
||||||
wasm.qcms_convert_three(transformer, src1, src2, src3, css);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* # Safety
|
|
||||||
*
|
|
||||||
* This function is called directly from JavaScript.
|
|
||||||
* @param {number} transformer
|
|
||||||
*/
|
|
||||||
export function qcms_drop_transformer(transformer) {
|
|
||||||
wasm.qcms_drop_transformer(transformer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,122 +95,114 @@ export function qcms_transformer_from_memory(mem, in_type, intent) {
|
|||||||
const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent);
|
const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent);
|
||||||
return ret >>> 0;
|
return ret >>> 0;
|
||||||
}
|
}
|
||||||
function __wbg_get_imports() {
|
|
||||||
const import0 = {
|
/**
|
||||||
__proto__: null,
|
* # Safety
|
||||||
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
*
|
||||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
* This function is called directly from JavaScript.
|
||||||
},
|
* @param {number} transformer
|
||||||
__wbg_copy_result_0d15f3bf9d9012ae: function(arg0, arg1) {
|
*/
|
||||||
copy_result(arg0 >>> 0, arg1 >>> 0);
|
export function qcms_drop_transformer(transformer) {
|
||||||
},
|
wasm.qcms_drop_transformer(transformer);
|
||||||
__wbg_copy_rgb_0106d9d9464fce43: function(arg0) {
|
|
||||||
copy_rgb(arg0 >>> 0);
|
|
||||||
},
|
|
||||||
__wbg_make_cssRGB_8e24b34f71f5363e: function(arg0) {
|
|
||||||
make_cssRGB(arg0 >>> 0);
|
|
||||||
},
|
|
||||||
__wbindgen_init_externref_table: function() {
|
|
||||||
const table = wasm.__wbindgen_externrefs;
|
|
||||||
const offset = table.grow(4);
|
|
||||||
table.set(0, undefined);
|
|
||||||
table.set(offset + 0, undefined);
|
|
||||||
table.set(offset + 1, null);
|
|
||||||
table.set(offset + 2, true);
|
|
||||||
table.set(offset + 3, false);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
__proto__: null,
|
|
||||||
"./qcms_bg.js": import0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStringFromWasm0(ptr, len) {
|
/**
|
||||||
ptr = ptr >>> 0;
|
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
||||||
return decodeText(ptr, len);
|
*/
|
||||||
}
|
export const DataType = Object.freeze({
|
||||||
|
RGB8: 0, "0": "RGB8",
|
||||||
let cachedUint8ArrayMemory0 = null;
|
RGBA8: 1, "1": "RGBA8",
|
||||||
function getUint8ArrayMemory0() {
|
BGRA8: 2, "2": "BGRA8",
|
||||||
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
Gray8: 3, "3": "Gray8",
|
||||||
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
GrayA8: 4, "4": "GrayA8",
|
||||||
}
|
CMYK: 5, "5": "CMYK",
|
||||||
return cachedUint8ArrayMemory0;
|
});
|
||||||
}
|
/**
|
||||||
|
* @enum {0 | 1 | 2 | 3}
|
||||||
function passArray8ToWasm0(arg, malloc) {
|
*/
|
||||||
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
export const Intent = Object.freeze({
|
||||||
getUint8ArrayMemory0().set(arg, ptr / 1);
|
Perceptual: 0, "0": "Perceptual",
|
||||||
WASM_VECTOR_LEN = arg.length;
|
RelativeColorimetric: 1, "1": "RelativeColorimetric",
|
||||||
return ptr;
|
Saturation: 2, "2": "Saturation",
|
||||||
}
|
AbsoluteColorimetric: 3, "3": "AbsoluteColorimetric",
|
||||||
|
});
|
||||||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
||||||
cachedTextDecoder.decode();
|
|
||||||
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
||||||
let numBytesDecoded = 0;
|
|
||||||
function decodeText(ptr, len) {
|
|
||||||
numBytesDecoded += len;
|
|
||||||
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
||||||
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
||||||
cachedTextDecoder.decode();
|
|
||||||
numBytesDecoded = len;
|
|
||||||
}
|
|
||||||
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
||||||
}
|
|
||||||
|
|
||||||
let WASM_VECTOR_LEN = 0;
|
|
||||||
|
|
||||||
let wasmModule, wasm;
|
|
||||||
function __wbg_finalize_init(instance, module) {
|
|
||||||
wasm = instance.exports;
|
|
||||||
wasmModule = module;
|
|
||||||
cachedUint8ArrayMemory0 = null;
|
|
||||||
wasm.__wbindgen_start();
|
|
||||||
return wasm;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function __wbg_load(module, imports) {
|
async function __wbg_load(module, imports) {
|
||||||
if (typeof Response === 'function' && module instanceof Response) {
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
try {
|
try {
|
||||||
return await WebAssembly.instantiateStreaming(module, imports);
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
} catch (e) {
|
|
||||||
const validResponse = module.ok && expectedResponseType(module.type);
|
|
||||||
|
|
||||||
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
} catch (e) {
|
||||||
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||||
|
|
||||||
} else { throw e; }
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bytes = await module.arrayBuffer();
|
const bytes = await module.arrayBuffer();
|
||||||
return await WebAssembly.instantiate(bytes, imports);
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const instance = await WebAssembly.instantiate(module, imports);
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
if (instance instanceof WebAssembly.Instance) {
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
return { instance, module };
|
return { instance, module };
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function expectedResponseType(type) {
|
function __wbg_get_imports() {
|
||||||
switch (type) {
|
const imports = {};
|
||||||
case 'basic': case 'cors': case 'default': return true;
|
imports.wbg = {};
|
||||||
|
imports.wbg.__wbg_copyresult_b08ee7d273f295dd = function(arg0, arg1) {
|
||||||
|
copy_result(arg0 >>> 0, arg1 >>> 0);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbg_copyrgb_d60ce17bb05d9b67 = function(arg0) {
|
||||||
|
copy_rgb(arg0 >>> 0);
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_init_externref_table = function() {
|
||||||
|
const table = wasm.__wbindgen_export_0;
|
||||||
|
const offset = table.grow(4);
|
||||||
|
table.set(0, undefined);
|
||||||
|
table.set(offset + 0, undefined);
|
||||||
|
table.set(offset + 1, null);
|
||||||
|
table.set(offset + 2, true);
|
||||||
|
table.set(offset + 3, false);
|
||||||
|
;
|
||||||
|
};
|
||||||
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||||
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||||
|
};
|
||||||
|
|
||||||
|
return imports;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
function __wbg_init_memory(imports, memory) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __wbg_finalize_init(instance, module) {
|
||||||
|
wasm = instance.exports;
|
||||||
|
__wbg_init.__wbindgen_wasm_module = module;
|
||||||
|
cachedUint8ArrayMemory0 = null;
|
||||||
|
|
||||||
|
|
||||||
|
wasm.__wbindgen_start();
|
||||||
|
return wasm;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSync(module) {
|
function initSync(module) {
|
||||||
if (wasm !== undefined) return wasm;
|
if (wasm !== undefined) return wasm;
|
||||||
|
|
||||||
|
|
||||||
if (module !== undefined) {
|
if (typeof module !== 'undefined') {
|
||||||
if (Object.getPrototypeOf(module) === Object.prototype) {
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
||||||
({module} = module)
|
({module} = module)
|
||||||
} else {
|
} else {
|
||||||
@ -227,10 +211,15 @@ function initSync(module) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const imports = __wbg_get_imports();
|
const imports = __wbg_get_imports();
|
||||||
|
|
||||||
|
__wbg_init_memory(imports);
|
||||||
|
|
||||||
if (!(module instanceof WebAssembly.Module)) {
|
if (!(module instanceof WebAssembly.Module)) {
|
||||||
module = new WebAssembly.Module(module);
|
module = new WebAssembly.Module(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
const instance = new WebAssembly.Instance(module, imports);
|
const instance = new WebAssembly.Instance(module, imports);
|
||||||
|
|
||||||
return __wbg_finalize_init(instance, module);
|
return __wbg_finalize_init(instance, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +227,7 @@ async function __wbg_init(module_or_path) {
|
|||||||
if (wasm !== undefined) return wasm;
|
if (wasm !== undefined) return wasm;
|
||||||
|
|
||||||
|
|
||||||
if (module_or_path !== undefined) {
|
if (typeof module_or_path !== 'undefined') {
|
||||||
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
||||||
({module_or_path} = module_or_path)
|
({module_or_path} = module_or_path)
|
||||||
} else {
|
} else {
|
||||||
@ -246,16 +235,21 @@ async function __wbg_init(module_or_path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof module_or_path === 'undefined') {
|
||||||
|
module_or_path = new URL('qcms_bg.wasm', import.meta.url);
|
||||||
|
}
|
||||||
const imports = __wbg_get_imports();
|
const imports = __wbg_get_imports();
|
||||||
|
|
||||||
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
||||||
module_or_path = fetch(module_or_path);
|
module_or_path = fetch(module_or_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__wbg_init_memory(imports);
|
||||||
|
|
||||||
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
||||||
|
|
||||||
return __wbg_finalize_init(instance, module);
|
return __wbg_finalize_init(instance, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { initSync, __wbg_init as default };
|
export { initSync };
|
||||||
|
export default __wbg_init;
|
||||||
|
|||||||
BIN
external/qcms/qcms_bg.wasm
vendored
BIN
external/qcms/qcms_bg.wasm
vendored
Binary file not shown.
60
external/qcms/qcms_utils.js
vendored
60
external/qcms/qcms_utils.js
vendored
@ -14,71 +14,41 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class QCMS {
|
class QCMS {
|
||||||
static #memoryArray = null;
|
static _module = null;
|
||||||
|
|
||||||
static _memory = null;
|
|
||||||
|
|
||||||
static _mustAddAlpha = false;
|
static _mustAddAlpha = false;
|
||||||
|
|
||||||
static _destBuffer = null;
|
static _destBuffer = null;
|
||||||
|
|
||||||
static _destOffset = 0;
|
|
||||||
|
|
||||||
static _destLength = 0;
|
|
||||||
|
|
||||||
static _cssColor = "";
|
|
||||||
|
|
||||||
static _makeHexColor = null;
|
|
||||||
|
|
||||||
static get _memoryArray() {
|
|
||||||
const array = this.#memoryArray;
|
|
||||||
if (array?.byteLength) {
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
return (this.#memoryArray = new Uint8Array(this._memory.buffer));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_result(ptr, len) {
|
function copy_result(ptr, len) {
|
||||||
// This function is called from the wasm module (it's an external
|
// This function is called from the wasm module (it's an external
|
||||||
// "C" function). Its goal is to copy the result from the wasm memory
|
// "C" function). Its goal is to copy the result from the wasm memory
|
||||||
// to the destination buffer without any intermediate copies.
|
// to the destination buffer without any intermediate copies.
|
||||||
const { _mustAddAlpha, _destBuffer, _destOffset, _destLength, _memoryArray } =
|
const { _module, _mustAddAlpha, _destBuffer } = QCMS;
|
||||||
QCMS;
|
const result = new Uint8Array(_module.memory.buffer, ptr, len);
|
||||||
if (len === _destLength) {
|
if (result.length === _destBuffer.length) {
|
||||||
_destBuffer.set(_memoryArray.subarray(ptr, ptr + len), _destOffset);
|
_destBuffer.set(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_mustAddAlpha) {
|
if (_mustAddAlpha) {
|
||||||
for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
|
for (let i = 0, j = 0, ii = result.length; i < ii; i += 3, j += 4) {
|
||||||
_destBuffer[j] = _memoryArray[i];
|
_destBuffer[j] = result[i];
|
||||||
_destBuffer[j + 1] = _memoryArray[i + 1];
|
_destBuffer[j + 1] = result[i + 1];
|
||||||
_destBuffer[j + 2] = _memoryArray[i + 2];
|
_destBuffer[j + 2] = result[i + 2];
|
||||||
_destBuffer[j + 3] = 255;
|
_destBuffer[j + 3] = 255;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
|
for (let i = 0, j = 0, ii = result.length; i < ii; i += 3, j += 4) {
|
||||||
_destBuffer[j] = _memoryArray[i];
|
_destBuffer[j] = result[i];
|
||||||
_destBuffer[j + 1] = _memoryArray[i + 1];
|
_destBuffer[j + 1] = result[i + 1];
|
||||||
_destBuffer[j + 2] = _memoryArray[i + 2];
|
_destBuffer[j + 2] = result[i + 2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_rgb(ptr) {
|
function copy_rgb(ptr) {
|
||||||
const { _destBuffer, _destOffset, _memoryArray } = QCMS;
|
QCMS._destBuffer.set(new Uint8Array(QCMS._module.memory.buffer, ptr, 3));
|
||||||
_destBuffer[_destOffset] = _memoryArray[ptr];
|
|
||||||
_destBuffer[_destOffset + 1] = _memoryArray[ptr + 1];
|
|
||||||
_destBuffer[_destOffset + 2] = _memoryArray[ptr + 2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_cssRGB(ptr) {
|
export { copy_result, copy_rgb, QCMS };
|
||||||
const { _memoryArray } = QCMS;
|
|
||||||
QCMS._cssColor = QCMS._makeHexColor(
|
|
||||||
_memoryArray[ptr],
|
|
||||||
_memoryArray[ptr + 1],
|
|
||||||
_memoryArray[ptr + 2]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { copy_result, copy_rgb, make_cssRGB, QCMS };
|
|
||||||
|
|||||||
47
external/quickjs/quickjs-eval.js
vendored
47
external/quickjs/quickjs-eval.js
vendored
File diff suppressed because one or more lines are too long
BIN
external/quickjs/quickjs-eval.wasm
vendored
BIN
external/quickjs/quickjs-eval.wasm
vendored
Binary file not shown.
108
external/stylelint/no-unused-custom-properties.mjs
vendored
108
external/stylelint/no-unused-custom-properties.mjs
vendored
@ -1,108 +0,0 @@
|
|||||||
/* Copyright 2025 Mozilla Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { parse, registerWalkers, Root } from "postcss-values-parser";
|
|
||||||
import { isString } from "stylelint/lib/utils/validateTypes.mjs";
|
|
||||||
import stylelint from "stylelint";
|
|
||||||
|
|
||||||
const {
|
|
||||||
createPlugin,
|
|
||||||
utils: { report, validateOptions },
|
|
||||||
} = stylelint;
|
|
||||||
|
|
||||||
registerWalkers(Root);
|
|
||||||
|
|
||||||
const ruleName = "pdfjs/no-unused-custom-properties";
|
|
||||||
|
|
||||||
// It's a very basic linter: we don't take into account scopes.
|
|
||||||
// But it should be enough for our use case.
|
|
||||||
|
|
||||||
/** @type {import('stylelint').Plugin} */
|
|
||||||
const ruleFunction =
|
|
||||||
(enabled, { ignoreList = [] } = {}, context = {}) =>
|
|
||||||
(root, result) => {
|
|
||||||
const validOptions = validateOptions(
|
|
||||||
result,
|
|
||||||
ruleName,
|
|
||||||
{
|
|
||||||
actual: enabled,
|
|
||||||
possible: [true],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
actual: ignoreList,
|
|
||||||
possible: [isString],
|
|
||||||
optional: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!validOptions) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ignoreList = ignoreList.map(s => (s.startsWith("--") ? s : `--${s}`));
|
|
||||||
|
|
||||||
const usedCustomProperties = new Set(ignoreList);
|
|
||||||
const definedCustomProperties = new Set();
|
|
||||||
const usedBy = new Map();
|
|
||||||
root.walkDecls(decl => {
|
|
||||||
let definingProperty = null;
|
|
||||||
if (decl.prop.startsWith("--")) {
|
|
||||||
// This is a custom property definition.
|
|
||||||
definingProperty = decl.prop;
|
|
||||||
definedCustomProperties.add(definingProperty);
|
|
||||||
}
|
|
||||||
// Parse the declaration value to find var() usages.
|
|
||||||
const parsedValue = parse(decl.value);
|
|
||||||
parsedValue.walkFuncs(node => {
|
|
||||||
if (!node.isVar || node.nodes.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// This is a var() function; get the custom property name.
|
|
||||||
const property = node.nodes[0].value;
|
|
||||||
if (!definingProperty) {
|
|
||||||
// This is a usage of a custom property but not in a definition.
|
|
||||||
// width: var(--foo);
|
|
||||||
usedCustomProperties.add(property);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let usages = usedBy.get(property);
|
|
||||||
if (!usages) {
|
|
||||||
usages = [];
|
|
||||||
usedBy.set(property, usages);
|
|
||||||
}
|
|
||||||
// Record that this custom property is used by the defining property.
|
|
||||||
// --foo: var(--bar);
|
|
||||||
// bar is really used only if foo is.
|
|
||||||
usages.push(definingProperty);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const isUsed = p =>
|
|
||||||
usedCustomProperties.has(p) || (usedBy.get(p) || []).some(isUsed);
|
|
||||||
for (const customProperty of definedCustomProperties) {
|
|
||||||
if (isUsed(customProperty)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
report({
|
|
||||||
message: `Custom property "${customProperty}" is defined but never used.`,
|
|
||||||
node: root,
|
|
||||||
result,
|
|
||||||
ruleName,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ruleFunction.ruleName = ruleName;
|
|
||||||
|
|
||||||
export default createPlugin(ruleName, ruleFunction);
|
|
||||||
1348
gulpfile.mjs
1348
gulpfile.mjs
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,5 @@
|
|||||||
+ Only the translations for the `en-US` locale are maintained here.
|
Most of the files in this folder (except for the `en-US` folder) have been
|
||||||
|
imported from the Firefox Nightly branch;
|
||||||
+ The translations for all other locales are imported automatically from Firefox. Please see https://mozilla-l10n.github.io/introduction/ for information about contributing.
|
please see https://hg.mozilla.org/l10n-central. Some of the files are
|
||||||
|
licensed under the MPL license. You can obtain a copy of the license at
|
||||||
|
https://mozilla.org/MPL/2.0.
|
||||||
|
|||||||
@ -71,12 +71,24 @@ pdfjs-document-properties-button =
|
|||||||
pdfjs-document-properties-button-label = Jami me gin acoya…
|
pdfjs-document-properties-button-label = Jami me gin acoya…
|
||||||
pdfjs-document-properties-file-name = Nying pwail:
|
pdfjs-document-properties-file-name = Nying pwail:
|
||||||
pdfjs-document-properties-file-size = Dit pa pwail:
|
pdfjs-document-properties-file-size = Dit pa pwail:
|
||||||
|
# Variables:
|
||||||
|
# $size_kb (Number) - the PDF file size in kilobytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-kb = { $size_kb } KB ({ $size_b } bytes)
|
||||||
|
# Variables:
|
||||||
|
# $size_mb (Number) - the PDF file size in megabytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-mb = { $size_mb } MB ({ $size_b } bytes)
|
||||||
pdfjs-document-properties-title = Wiye:
|
pdfjs-document-properties-title = Wiye:
|
||||||
pdfjs-document-properties-author = Ngat mucoyo:
|
pdfjs-document-properties-author = Ngat mucoyo:
|
||||||
pdfjs-document-properties-subject = Subjek:
|
pdfjs-document-properties-subject = Subjek:
|
||||||
pdfjs-document-properties-keywords = Lok mapire tek:
|
pdfjs-document-properties-keywords = Lok mapire tek:
|
||||||
pdfjs-document-properties-creation-date = Nino dwe me cwec:
|
pdfjs-document-properties-creation-date = Nino dwe me cwec:
|
||||||
pdfjs-document-properties-modification-date = Nino dwe me yub:
|
pdfjs-document-properties-modification-date = Nino dwe me yub:
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the creation/modification date of the PDF file
|
||||||
|
# $time (Time) - the creation/modification time of the PDF file
|
||||||
|
pdfjs-document-properties-date-string = { $date }, { $time }
|
||||||
pdfjs-document-properties-creator = Lacwec:
|
pdfjs-document-properties-creator = Lacwec:
|
||||||
pdfjs-document-properties-producer = Layub PDF:
|
pdfjs-document-properties-producer = Layub PDF:
|
||||||
pdfjs-document-properties-version = Kit PDF:
|
pdfjs-document-properties-version = Kit PDF:
|
||||||
@ -173,6 +185,9 @@ pdfjs-page-scale-actual = Dite kikome
|
|||||||
# $scale (Number) - percent value for page scale
|
# $scale (Number) - percent value for page scale
|
||||||
pdfjs-page-scale-percent = { $scale }%
|
pdfjs-page-scale-percent = { $scale }%
|
||||||
|
|
||||||
|
## PDF page
|
||||||
|
|
||||||
|
|
||||||
## Loading indicator messages
|
## Loading indicator messages
|
||||||
|
|
||||||
pdfjs-loading-error = Bal otime kun cano PDF.
|
pdfjs-loading-error = Bal otime kun cano PDF.
|
||||||
@ -198,3 +213,63 @@ pdfjs-password-invalid = Mung me donyo pe atir. Tim ber i tem doki.
|
|||||||
pdfjs-password-ok-button = OK
|
pdfjs-password-ok-button = OK
|
||||||
pdfjs-password-cancel-button = Juki
|
pdfjs-password-cancel-button = Juki
|
||||||
pdfjs-web-fonts-disabled = Kijuko dit pa coc me kakube woko: pe romo tic ki dit pa coc me PDF ma kiketo i kine.
|
pdfjs-web-fonts-disabled = Kijuko dit pa coc me kakube woko: pe romo tic ki dit pa coc me PDF ma kiketo i kine.
|
||||||
|
|
||||||
|
## Editing
|
||||||
|
|
||||||
|
|
||||||
|
## Default editor aria labels
|
||||||
|
|
||||||
|
|
||||||
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
## Alt-text dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Editor resizers
|
||||||
|
## This is used in an aria label to help to understand the role of the resizer.
|
||||||
|
|
||||||
|
|
||||||
|
## Color picker
|
||||||
|
|
||||||
|
|
||||||
|
## Show all highlights
|
||||||
|
## This is a toggle button to show/hide all the highlights.
|
||||||
|
|
||||||
|
|
||||||
|
## New alt-text dialog
|
||||||
|
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
|
||||||
|
|
||||||
|
|
||||||
|
## Image alt-text settings
|
||||||
|
|
||||||
|
|
||||||
|
## "Annotations removed" bar
|
||||||
|
|
||||||
|
|
||||||
|
## Add a signature dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Tab names
|
||||||
|
|
||||||
|
|
||||||
|
## Tab panels
|
||||||
|
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
|
||||||
|
## Dialog buttons
|
||||||
|
|
||||||
|
|
||||||
|
## Main menu for adding/removing signatures
|
||||||
|
|
||||||
|
|
||||||
|
## Editor toolbar
|
||||||
|
|
||||||
|
|
||||||
|
## Edit signature description dialog
|
||||||
|
|
||||||
|
|||||||
@ -71,17 +71,37 @@ pdfjs-document-properties-button =
|
|||||||
pdfjs-document-properties-button-label = Dokumenteienskappe…
|
pdfjs-document-properties-button-label = Dokumenteienskappe…
|
||||||
pdfjs-document-properties-file-name = Lêernaam:
|
pdfjs-document-properties-file-name = Lêernaam:
|
||||||
pdfjs-document-properties-file-size = Lêergrootte:
|
pdfjs-document-properties-file-size = Lêergrootte:
|
||||||
|
# Variables:
|
||||||
|
# $size_kb (Number) - the PDF file size in kilobytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-kb = { $size_kb } kG ({ $size_b } grepe)
|
||||||
|
# Variables:
|
||||||
|
# $size_mb (Number) - the PDF file size in megabytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-mb = { $size_mb } MG ({ $size_b } grepe)
|
||||||
pdfjs-document-properties-title = Titel:
|
pdfjs-document-properties-title = Titel:
|
||||||
pdfjs-document-properties-author = Outeur:
|
pdfjs-document-properties-author = Outeur:
|
||||||
pdfjs-document-properties-subject = Onderwerp:
|
pdfjs-document-properties-subject = Onderwerp:
|
||||||
pdfjs-document-properties-keywords = Sleutelwoorde:
|
pdfjs-document-properties-keywords = Sleutelwoorde:
|
||||||
pdfjs-document-properties-creation-date = Skeppingsdatum:
|
pdfjs-document-properties-creation-date = Skeppingsdatum:
|
||||||
pdfjs-document-properties-modification-date = Wysigingsdatum:
|
pdfjs-document-properties-modification-date = Wysigingsdatum:
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the creation/modification date of the PDF file
|
||||||
|
# $time (Time) - the creation/modification time of the PDF file
|
||||||
|
pdfjs-document-properties-date-string = { $date }, { $time }
|
||||||
pdfjs-document-properties-creator = Skepper:
|
pdfjs-document-properties-creator = Skepper:
|
||||||
pdfjs-document-properties-producer = PDF-vervaardiger:
|
pdfjs-document-properties-producer = PDF-vervaardiger:
|
||||||
pdfjs-document-properties-version = PDF-weergawe:
|
pdfjs-document-properties-version = PDF-weergawe:
|
||||||
pdfjs-document-properties-page-count = Aantal bladsye:
|
pdfjs-document-properties-page-count = Aantal bladsye:
|
||||||
|
|
||||||
|
## Variables:
|
||||||
|
## $width (Number) - the width of the (current) page
|
||||||
|
## $height (Number) - the height of the (current) page
|
||||||
|
## $unit (String) - the unit of measurement of the (current) page
|
||||||
|
## $name (String) - the name of the (current) page
|
||||||
|
## $orientation (String) - the orientation of the (current) page
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
pdfjs-document-properties-close-button = Sluit
|
pdfjs-document-properties-close-button = Sluit
|
||||||
@ -152,6 +172,9 @@ pdfjs-page-scale-actual = Werklike grootte
|
|||||||
# $scale (Number) - percent value for page scale
|
# $scale (Number) - percent value for page scale
|
||||||
pdfjs-page-scale-percent = { $scale }%
|
pdfjs-page-scale-percent = { $scale }%
|
||||||
|
|
||||||
|
## PDF page
|
||||||
|
|
||||||
|
|
||||||
## Loading indicator messages
|
## Loading indicator messages
|
||||||
|
|
||||||
pdfjs-loading-error = 'n Fout het voorgekom met die laai van die PDF.
|
pdfjs-loading-error = 'n Fout het voorgekom met die laai van die PDF.
|
||||||
@ -177,3 +200,63 @@ pdfjs-password-invalid = Ongeldige wagwoord. Probeer gerus weer.
|
|||||||
pdfjs-password-ok-button = OK
|
pdfjs-password-ok-button = OK
|
||||||
pdfjs-password-cancel-button = Kanselleer
|
pdfjs-password-cancel-button = Kanselleer
|
||||||
pdfjs-web-fonts-disabled = Webfonte is gedeaktiveer: kan nie PDF-fonte wat ingebed is, gebruik nie.
|
pdfjs-web-fonts-disabled = Webfonte is gedeaktiveer: kan nie PDF-fonte wat ingebed is, gebruik nie.
|
||||||
|
|
||||||
|
## Editing
|
||||||
|
|
||||||
|
|
||||||
|
## Default editor aria labels
|
||||||
|
|
||||||
|
|
||||||
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
## Alt-text dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Editor resizers
|
||||||
|
## This is used in an aria label to help to understand the role of the resizer.
|
||||||
|
|
||||||
|
|
||||||
|
## Color picker
|
||||||
|
|
||||||
|
|
||||||
|
## Show all highlights
|
||||||
|
## This is a toggle button to show/hide all the highlights.
|
||||||
|
|
||||||
|
|
||||||
|
## New alt-text dialog
|
||||||
|
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
|
||||||
|
|
||||||
|
|
||||||
|
## Image alt-text settings
|
||||||
|
|
||||||
|
|
||||||
|
## "Annotations removed" bar
|
||||||
|
|
||||||
|
|
||||||
|
## Add a signature dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Tab names
|
||||||
|
|
||||||
|
|
||||||
|
## Tab panels
|
||||||
|
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
|
||||||
|
## Dialog buttons
|
||||||
|
|
||||||
|
|
||||||
|
## Main menu for adding/removing signatures
|
||||||
|
|
||||||
|
|
||||||
|
## Editor toolbar
|
||||||
|
|
||||||
|
|
||||||
|
## Edit signature description dialog
|
||||||
|
|
||||||
|
|||||||
@ -89,12 +89,24 @@ pdfjs-document-properties-button =
|
|||||||
pdfjs-document-properties-button-label = Propiedatz d'o documento...
|
pdfjs-document-properties-button-label = Propiedatz d'o documento...
|
||||||
pdfjs-document-properties-file-name = Nombre de fichero:
|
pdfjs-document-properties-file-name = Nombre de fichero:
|
||||||
pdfjs-document-properties-file-size = Grandaria d'o fichero:
|
pdfjs-document-properties-file-size = Grandaria d'o fichero:
|
||||||
|
# Variables:
|
||||||
|
# $size_kb (Number) - the PDF file size in kilobytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-kb = { $size_kb } KB ({ $size_b } bytes)
|
||||||
|
# Variables:
|
||||||
|
# $size_mb (Number) - the PDF file size in megabytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-mb = { $size_mb } MB ({ $size_b } bytes)
|
||||||
pdfjs-document-properties-title = Titol:
|
pdfjs-document-properties-title = Titol:
|
||||||
pdfjs-document-properties-author = Autor:
|
pdfjs-document-properties-author = Autor:
|
||||||
pdfjs-document-properties-subject = Afer:
|
pdfjs-document-properties-subject = Afer:
|
||||||
pdfjs-document-properties-keywords = Parolas clau:
|
pdfjs-document-properties-keywords = Parolas clau:
|
||||||
pdfjs-document-properties-creation-date = Calendata de creyación:
|
pdfjs-document-properties-creation-date = Calendata de creyación:
|
||||||
pdfjs-document-properties-modification-date = Calendata de modificación:
|
pdfjs-document-properties-modification-date = Calendata de modificación:
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the creation/modification date of the PDF file
|
||||||
|
# $time (Time) - the creation/modification time of the PDF file
|
||||||
|
pdfjs-document-properties-date-string = { $date }, { $time }
|
||||||
pdfjs-document-properties-creator = Creyador:
|
pdfjs-document-properties-creator = Creyador:
|
||||||
pdfjs-document-properties-producer = Creyador de PDF:
|
pdfjs-document-properties-producer = Creyador de PDF:
|
||||||
pdfjs-document-properties-version = Versión de PDF:
|
pdfjs-document-properties-version = Versión de PDF:
|
||||||
@ -201,6 +213,9 @@ pdfjs-page-scale-actual = Grandaria actual
|
|||||||
# $scale (Number) - percent value for page scale
|
# $scale (Number) - percent value for page scale
|
||||||
pdfjs-page-scale-percent = { $scale }%
|
pdfjs-page-scale-percent = { $scale }%
|
||||||
|
|
||||||
|
## PDF page
|
||||||
|
|
||||||
|
|
||||||
## Loading indicator messages
|
## Loading indicator messages
|
||||||
|
|
||||||
pdfjs-loading-error = S'ha produciu una error en cargar o PDF.
|
pdfjs-loading-error = S'ha produciu una error en cargar o PDF.
|
||||||
@ -211,6 +226,10 @@ pdfjs-rendering-error = Ha ocurriu una error en renderizar a pachina.
|
|||||||
|
|
||||||
## Annotations
|
## Annotations
|
||||||
|
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the modification date of the annotation
|
||||||
|
# $time (Time) - the modification time of the annotation
|
||||||
|
pdfjs-annotation-date-string = { $date }, { $time }
|
||||||
# .alt: This is used as a tooltip.
|
# .alt: This is used as a tooltip.
|
||||||
# Variables:
|
# Variables:
|
||||||
# $type (String) - an annotation type from a list defined in the PDF spec
|
# $type (String) - an annotation type from a list defined in the PDF spec
|
||||||
@ -226,3 +245,63 @@ pdfjs-password-invalid = Clau invalida. Torna a intentar-lo.
|
|||||||
pdfjs-password-ok-button = Acceptar
|
pdfjs-password-ok-button = Acceptar
|
||||||
pdfjs-password-cancel-button = Cancelar
|
pdfjs-password-cancel-button = Cancelar
|
||||||
pdfjs-web-fonts-disabled = As fuents web son desactivadas: no se puet incrustar fichers PDF.
|
pdfjs-web-fonts-disabled = As fuents web son desactivadas: no se puet incrustar fichers PDF.
|
||||||
|
|
||||||
|
## Editing
|
||||||
|
|
||||||
|
|
||||||
|
## Default editor aria labels
|
||||||
|
|
||||||
|
|
||||||
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
## Alt-text dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Editor resizers
|
||||||
|
## This is used in an aria label to help to understand the role of the resizer.
|
||||||
|
|
||||||
|
|
||||||
|
## Color picker
|
||||||
|
|
||||||
|
|
||||||
|
## Show all highlights
|
||||||
|
## This is a toggle button to show/hide all the highlights.
|
||||||
|
|
||||||
|
|
||||||
|
## New alt-text dialog
|
||||||
|
## Group note for entire feature: Alternative text (alt text) helps when people can't see the image. This feature includes a tool to create alt text automatically using an AI model that works locally on the user's device to preserve privacy.
|
||||||
|
|
||||||
|
|
||||||
|
## Image alt-text settings
|
||||||
|
|
||||||
|
|
||||||
|
## "Annotations removed" bar
|
||||||
|
|
||||||
|
|
||||||
|
## Add a signature dialog
|
||||||
|
|
||||||
|
|
||||||
|
## Tab names
|
||||||
|
|
||||||
|
|
||||||
|
## Tab panels
|
||||||
|
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
|
||||||
|
## Dialog buttons
|
||||||
|
|
||||||
|
|
||||||
|
## Main menu for adding/removing signatures
|
||||||
|
|
||||||
|
|
||||||
|
## Editor toolbar
|
||||||
|
|
||||||
|
|
||||||
|
## Edit signature description dialog
|
||||||
|
|
||||||
|
|||||||
@ -112,6 +112,14 @@ pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) }
|
|||||||
# $mb (Number) - the PDF file size in megabytes
|
# $mb (Number) - the PDF file size in megabytes
|
||||||
# $b (Number) - the PDF file size in bytes
|
# $b (Number) - the PDF file size in bytes
|
||||||
pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } م.بايت ({ $b } بايتات)
|
pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } م.بايت ({ $b } بايتات)
|
||||||
|
# Variables:
|
||||||
|
# $size_kb (Number) - the PDF file size in kilobytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-kb = { $size_kb } ك.بايت ({ $size_b } بايت)
|
||||||
|
# Variables:
|
||||||
|
# $size_mb (Number) - the PDF file size in megabytes
|
||||||
|
# $size_b (Number) - the PDF file size in bytes
|
||||||
|
pdfjs-document-properties-mb = { $size_mb } م.بايت ({ $size_b } بايت)
|
||||||
pdfjs-document-properties-title = العنوان:
|
pdfjs-document-properties-title = العنوان:
|
||||||
pdfjs-document-properties-author = المؤلف:
|
pdfjs-document-properties-author = المؤلف:
|
||||||
pdfjs-document-properties-subject = الموضوع:
|
pdfjs-document-properties-subject = الموضوع:
|
||||||
@ -121,6 +129,10 @@ pdfjs-document-properties-modification-date = تاريخ التعديل:
|
|||||||
# Variables:
|
# Variables:
|
||||||
# $dateObj (Date) - the creation/modification date and time of the PDF file
|
# $dateObj (Date) - the creation/modification date and time of the PDF file
|
||||||
pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
|
pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the creation/modification date of the PDF file
|
||||||
|
# $time (Time) - the creation/modification time of the PDF file
|
||||||
|
pdfjs-document-properties-date-string = { $date }، { $time }
|
||||||
pdfjs-document-properties-creator = المنشئ:
|
pdfjs-document-properties-creator = المنشئ:
|
||||||
pdfjs-document-properties-producer = منتج PDF:
|
pdfjs-document-properties-producer = منتج PDF:
|
||||||
pdfjs-document-properties-version = إصدارة PDF:
|
pdfjs-document-properties-version = إصدارة PDF:
|
||||||
@ -201,15 +213,6 @@ pdfjs-thumb-page-title =
|
|||||||
# $page (Number) - the page number
|
# $page (Number) - the page number
|
||||||
pdfjs-thumb-page-canvas =
|
pdfjs-thumb-page-canvas =
|
||||||
.aria-label = مصغّرة صفحة { $page }
|
.aria-label = مصغّرة صفحة { $page }
|
||||||
# Variables:
|
|
||||||
# $page (Number) - the page number
|
|
||||||
pdfjs-thumb-page-checkbox1 =
|
|
||||||
.title = حدّد الصفحة { $page }
|
|
||||||
# Variables:
|
|
||||||
# $page (Number) - the page number
|
|
||||||
# $total (Number) - the number of pages
|
|
||||||
pdfjs-thumb-page-title1 =
|
|
||||||
.title = الصفحة { $page } من { $total }
|
|
||||||
|
|
||||||
## Find panel button title and messages
|
## Find panel button title and messages
|
||||||
|
|
||||||
@ -280,6 +283,10 @@ pdfjs-rendering-error = حدث خطأ أثناء عرض الصفحة.
|
|||||||
|
|
||||||
## Annotations
|
## Annotations
|
||||||
|
|
||||||
|
# Variables:
|
||||||
|
# $date (Date) - the modification date of the annotation
|
||||||
|
# $time (Time) - the modification time of the annotation
|
||||||
|
pdfjs-annotation-date-string = { $date }، { $time }
|
||||||
# .alt: This is used as a tooltip.
|
# .alt: This is used as a tooltip.
|
||||||
# Variables:
|
# Variables:
|
||||||
# $type (String) - an annotation type from a list defined in the PDF spec
|
# $type (String) - an annotation type from a list defined in the PDF spec
|
||||||
@ -295,7 +302,7 @@ pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", tim
|
|||||||
|
|
||||||
pdfjs-password-label = أدخل لكلمة السر لفتح هذا الملف.
|
pdfjs-password-label = أدخل لكلمة السر لفتح هذا الملف.
|
||||||
pdfjs-password-invalid = كلمة سر خطأ. من فضلك أعد المحاولة.
|
pdfjs-password-invalid = كلمة سر خطأ. من فضلك أعد المحاولة.
|
||||||
pdfjs-password-ok-button = حسنًا
|
pdfjs-password-ok-button = حسنا
|
||||||
pdfjs-password-cancel-button = ألغِ
|
pdfjs-password-cancel-button = ألغِ
|
||||||
pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخدام خطوط PDF المُضمّنة.
|
pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخدام خطوط PDF المُضمّنة.
|
||||||
|
|
||||||
@ -303,13 +310,9 @@ pdfjs-web-fonts-disabled = خطوط الوب مُعطّلة: تعذّر استخ
|
|||||||
|
|
||||||
pdfjs-editor-free-text-button =
|
pdfjs-editor-free-text-button =
|
||||||
.title = نص
|
.title = نص
|
||||||
pdfjs-editor-color-picker-free-text-input =
|
|
||||||
.title = غيِّر لون النص
|
|
||||||
pdfjs-editor-free-text-button-label = نص
|
pdfjs-editor-free-text-button-label = نص
|
||||||
pdfjs-editor-ink-button =
|
pdfjs-editor-ink-button =
|
||||||
.title = ارسم
|
.title = ارسم
|
||||||
pdfjs-editor-color-picker-ink-input =
|
|
||||||
.title = غيِّر لون الرسم
|
|
||||||
pdfjs-editor-ink-button-label = ارسم
|
pdfjs-editor-ink-button-label = ارسم
|
||||||
pdfjs-editor-stamp-button =
|
pdfjs-editor-stamp-button =
|
||||||
.title = أضِف أو حرّر الصور
|
.title = أضِف أو حرّر الصور
|
||||||
@ -321,33 +324,9 @@ pdfjs-highlight-floating-button1 =
|
|||||||
.title = أبرِز
|
.title = أبرِز
|
||||||
.aria-label = أبرِز
|
.aria-label = أبرِز
|
||||||
pdfjs-highlight-floating-button-label = أبرِز
|
pdfjs-highlight-floating-button-label = أبرِز
|
||||||
pdfjs-comment-floating-button =
|
|
||||||
.title = علق
|
|
||||||
.aria-label = علق
|
|
||||||
pdfjs-comment-floating-button-label = علق
|
|
||||||
pdfjs-editor-comment-button =
|
|
||||||
.title = علق
|
|
||||||
.aria-label = علق
|
|
||||||
pdfjs-editor-comment-button-label = التعليق
|
|
||||||
pdfjs-editor-signature-button =
|
|
||||||
.title = أضِف توقيع
|
|
||||||
pdfjs-editor-signature-button-label = أضِف توقيع
|
|
||||||
|
|
||||||
## Default editor aria labels
|
## Default editor aria labels
|
||||||
|
|
||||||
# “Highlight” is a noun, the string is used on the editor for highlights.
|
|
||||||
pdfjs-editor-highlight-editor =
|
|
||||||
.aria-label = محرِّر الإبراز
|
|
||||||
# “Drawing” is a noun, the string is used on the editor for drawings.
|
|
||||||
pdfjs-editor-ink-editor =
|
|
||||||
.aria-label = محرِّر الرسم
|
|
||||||
# Used when a signature editor is selected/hovered.
|
|
||||||
# Variables:
|
|
||||||
# $description (String) - a string describing/labeling the signature.
|
|
||||||
pdfjs-editor-signature-editor1 =
|
|
||||||
.aria-description = محرِّر التوقيع: { $description }
|
|
||||||
pdfjs-editor-stamp-editor =
|
|
||||||
.aria-label = محرِّر الصور
|
|
||||||
|
|
||||||
## Remove button for the various kind of editor.
|
## Remove button for the various kind of editor.
|
||||||
|
|
||||||
@ -377,45 +356,24 @@ pdfjs-editor-stamp-add-image-button-label = أضِف صورة
|
|||||||
pdfjs-editor-free-highlight-thickness-input = السماكة
|
pdfjs-editor-free-highlight-thickness-input = السماكة
|
||||||
pdfjs-editor-free-highlight-thickness-title =
|
pdfjs-editor-free-highlight-thickness-title =
|
||||||
.title = غيّر السُمك عند إبراز عناصر أُخرى غير النص
|
.title = غيّر السُمك عند إبراز عناصر أُخرى غير النص
|
||||||
pdfjs-editor-add-signature-container =
|
|
||||||
.aria-label = عناصر التحكم في التوقيع والتوقيعات المحفوظة
|
|
||||||
pdfjs-editor-signature-add-signature-button =
|
|
||||||
.title = أضِف توقيع جديد
|
|
||||||
pdfjs-editor-signature-add-signature-button-label = أضِف توقيع جديد
|
|
||||||
# Used on the button to use an already saved signature.
|
|
||||||
# Variables:
|
|
||||||
# $description (String) - a string describing/labeling the signature.
|
|
||||||
pdfjs-editor-add-saved-signature-button =
|
|
||||||
.title = التوقيع المحفوظ: { $description }
|
|
||||||
# .default-content is used as a placeholder in an empty text editor.
|
# .default-content is used as a placeholder in an empty text editor.
|
||||||
pdfjs-free-text2 =
|
pdfjs-free-text2 =
|
||||||
.aria-label = محرِّر النص
|
.aria-label = محرِّر النص
|
||||||
.default-content = ابدأ في كتابة…
|
.default-content = ابدأ في كتابة…
|
||||||
# Used to show how many comments are present in the pdf file.
|
pdfjs-free-text =
|
||||||
# Variables:
|
.aria-label = محرِّر النص
|
||||||
# $count (Number) - the number of comments.
|
pdfjs-free-text-default-content = ابدأ الكتابة…
|
||||||
pdfjs-editor-comments-sidebar-title =
|
pdfjs-ink =
|
||||||
{ $count ->
|
.aria-label = محرِّر الرسم
|
||||||
[zero] تعليق
|
pdfjs-ink-canvas =
|
||||||
[one] تعليق
|
.aria-label = صورة أنشأها المستخدم
|
||||||
[two] تعليقات
|
|
||||||
[few] تعليقات
|
|
||||||
[many] تعليقات
|
|
||||||
*[other] تعليقات
|
|
||||||
}
|
|
||||||
pdfjs-editor-comments-sidebar-close-button =
|
|
||||||
.title = أغلِق الشريط الجانبي
|
|
||||||
.aria-label = أغلِق الشريط الجانبي
|
|
||||||
pdfjs-editor-comments-sidebar-close-button-label = أغلِق الشريط الجانبي
|
|
||||||
# Instructional copy to add a comment by selecting text or an annotations.
|
|
||||||
pdfjs-editor-comments-sidebar-no-comments1 = هل رأيت شيئاً جديرًا بالملاحظة؟ ابرزه واترك تعليقًا.
|
|
||||||
pdfjs-editor-comments-sidebar-no-comments-link = اطّلع على المزيد
|
|
||||||
|
|
||||||
## Alt-text dialog
|
## Alt-text dialog
|
||||||
|
|
||||||
pdfjs-editor-alt-text-button-label = نص بديل
|
pdfjs-editor-alt-text-button-label = نص بديل
|
||||||
pdfjs-editor-alt-text-edit-button =
|
pdfjs-editor-alt-text-edit-button =
|
||||||
.aria-label = حرّر النص البديل
|
.aria-label = حرّر النص البديل
|
||||||
|
pdfjs-editor-alt-text-edit-button-label = تحرير النص البديل
|
||||||
pdfjs-editor-alt-text-dialog-label = اختر خيار
|
pdfjs-editor-alt-text-dialog-label = اختر خيار
|
||||||
pdfjs-editor-alt-text-dialog-description = يساعد النص البديل عندما لا يتمكن الأشخاص من رؤية الصورة أو عندما لا يتم تحميلها.
|
pdfjs-editor-alt-text-dialog-description = يساعد النص البديل عندما لا يتمكن الأشخاص من رؤية الصورة أو عندما لا يتم تحميلها.
|
||||||
pdfjs-editor-alt-text-add-description-label = أضِف وصف
|
pdfjs-editor-alt-text-add-description-label = أضِف وصف
|
||||||
@ -435,6 +393,14 @@ pdfjs-editor-alt-text-button =
|
|||||||
## Editor resizers
|
## Editor resizers
|
||||||
## This is used in an aria label to help to understand the role of the resizer.
|
## This is used in an aria label to help to understand the role of the resizer.
|
||||||
|
|
||||||
|
pdfjs-editor-resizer-label-top-left = الزاوية اليُسرى العُليا — غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-top-middle = أعلى الوسط - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-top-right = الزاوية اليُمنى العُليا - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-middle-right = اليمين الأوسط - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-bottom-right = الزاوية اليُمنى السُفلى - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-bottom-middle = أسفل الوسط - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-bottom-left = الزاوية اليُسرى السُفلية - غيّر الحجم
|
||||||
|
pdfjs-editor-resizer-label-middle-left = مُنتصف اليسار - غيّر الحجم
|
||||||
pdfjs-editor-resizer-top-left =
|
pdfjs-editor-resizer-top-left =
|
||||||
.aria-label = الزاوية اليُسرى العُليا — غيّر الحجم
|
.aria-label = الزاوية اليُسرى العُليا — غيّر الحجم
|
||||||
pdfjs-editor-resizer-top-middle =
|
pdfjs-editor-resizer-top-middle =
|
||||||
@ -540,14 +506,6 @@ pdfjs-editor-alt-text-settings-show-dialog-button-label = أظهِر مُحرّ
|
|||||||
pdfjs-editor-alt-text-settings-show-dialog-description = يساعدك على التأكد من أن جميع صورك تحتوي على نص بديل.
|
pdfjs-editor-alt-text-settings-show-dialog-description = يساعدك على التأكد من أن جميع صورك تحتوي على نص بديل.
|
||||||
pdfjs-editor-alt-text-settings-close-button = أغلق
|
pdfjs-editor-alt-text-settings-close-button = أغلق
|
||||||
|
|
||||||
## Accessibility labels (announced by screen readers) for objects added to the editor.
|
|
||||||
|
|
||||||
pdfjs-editor-highlight-added-alert = أُضيف إبراز
|
|
||||||
pdfjs-editor-freetext-added-alert = أُضيف النص
|
|
||||||
pdfjs-editor-ink-added-alert = أُضيف رسم
|
|
||||||
pdfjs-editor-stamp-added-alert = أُضيف صورة
|
|
||||||
pdfjs-editor-signature-added-alert = أُضيف توقيع
|
|
||||||
|
|
||||||
## "Annotations removed" bar
|
## "Annotations removed" bar
|
||||||
|
|
||||||
pdfjs-editor-undo-bar-message-highlight = أُزِيل البرز
|
pdfjs-editor-undo-bar-message-highlight = أُزِيل البرز
|
||||||
@ -555,7 +513,6 @@ pdfjs-editor-undo-bar-message-freetext = أُزيل النص
|
|||||||
pdfjs-editor-undo-bar-message-ink = أُزِيلت الرسمة
|
pdfjs-editor-undo-bar-message-ink = أُزِيلت الرسمة
|
||||||
pdfjs-editor-undo-bar-message-stamp = أُزيلت الصورة
|
pdfjs-editor-undo-bar-message-stamp = أُزيلت الصورة
|
||||||
pdfjs-editor-undo-bar-message-signature = أُزيل التوقيع
|
pdfjs-editor-undo-bar-message-signature = أُزيل التوقيع
|
||||||
pdfjs-editor-undo-bar-message-comment = أُزيل التعليق
|
|
||||||
# Variables:
|
# Variables:
|
||||||
# $count (Number) - the number of removed annotations.
|
# $count (Number) - the number of removed annotations.
|
||||||
pdfjs-editor-undo-bar-message-multiple =
|
pdfjs-editor-undo-bar-message-multiple =
|
||||||
@ -577,7 +534,7 @@ pdfjs-editor-undo-bar-close-button-label = أغلق
|
|||||||
## Add a signature dialog
|
## Add a signature dialog
|
||||||
|
|
||||||
pdfjs-editor-add-signature-dialog-label = يتيح هذا النموذج للمستخدم إنشاء توقيع لإضافته إلى مستند PDF. ويمكن للمستخدم تحرير الاسم (الذي يعمل أيضًا كنص بديل)، وحفظ التوقيع بشكل اختياري للاستخدام المتكرر.
|
pdfjs-editor-add-signature-dialog-label = يتيح هذا النموذج للمستخدم إنشاء توقيع لإضافته إلى مستند PDF. ويمكن للمستخدم تحرير الاسم (الذي يعمل أيضًا كنص بديل)، وحفظ التوقيع بشكل اختياري للاستخدام المتكرر.
|
||||||
pdfjs-editor-add-signature-dialog-title = أضِف توقيعًا
|
pdfjs-editor-add-signature-dialog-title = أضِف توقيعا
|
||||||
|
|
||||||
## Tab names
|
## Tab names
|
||||||
|
|
||||||
@ -621,159 +578,18 @@ pdfjs-editor-add-signature-save-checkbox = احفظ التوقيع
|
|||||||
pdfjs-editor-add-signature-save-warning-message = لقد وصلت إلى الحد الأقصى وهو 5 توقيعات محفوظة. أزِل توقيع واحد لحفظ المزيد.
|
pdfjs-editor-add-signature-save-warning-message = لقد وصلت إلى الحد الأقصى وهو 5 توقيعات محفوظة. أزِل توقيع واحد لحفظ المزيد.
|
||||||
pdfjs-editor-add-signature-image-upload-error-title = تعذر رفع الصورة.
|
pdfjs-editor-add-signature-image-upload-error-title = تعذر رفع الصورة.
|
||||||
pdfjs-editor-add-signature-image-upload-error-description = تحقق من اتصال الشبكة لديك أو جرّب صورة أخرى.
|
pdfjs-editor-add-signature-image-upload-error-description = تحقق من اتصال الشبكة لديك أو جرّب صورة أخرى.
|
||||||
pdfjs-editor-add-signature-image-no-data-error-title = لا يمكن تحويل هذه الصورة إلى توقيع
|
|
||||||
pdfjs-editor-add-signature-image-no-data-error-description = من فضلك حاول رفع صورة أخرى.
|
|
||||||
pdfjs-editor-add-signature-error-close-button = أغلق
|
pdfjs-editor-add-signature-error-close-button = أغلق
|
||||||
|
|
||||||
## Dialog buttons
|
## Dialog buttons
|
||||||
|
|
||||||
pdfjs-editor-add-signature-cancel-button = ألغِ
|
pdfjs-editor-add-signature-cancel-button = ألغِ
|
||||||
pdfjs-editor-add-signature-add-button = أضِف
|
pdfjs-editor-add-signature-add-button = أضِف
|
||||||
pdfjs-editor-edit-signature-update-button = حدّث
|
|
||||||
|
|
||||||
## Comment popup
|
|
||||||
|
|
||||||
pdfjs-editor-edit-comment-popup-button-label = حرّر التعليق
|
|
||||||
pdfjs-editor-edit-comment-popup-button =
|
|
||||||
.title = حرّر التعليق
|
|
||||||
pdfjs-editor-delete-comment-popup-button-label = أزِل التعليق
|
|
||||||
pdfjs-editor-delete-comment-popup-button =
|
|
||||||
.title = أزِل التعليق
|
|
||||||
pdfjs-show-comment-button =
|
|
||||||
.title = أظهر التعليق
|
|
||||||
|
|
||||||
## Edit a comment dialog
|
|
||||||
|
|
||||||
# An existing comment is edited
|
|
||||||
pdfjs-editor-edit-comment-dialog-title-when-editing = حرّر التعليق
|
|
||||||
pdfjs-editor-edit-comment-dialog-save-button-when-editing = حدّث
|
|
||||||
# No existing comment
|
|
||||||
pdfjs-editor-edit-comment-dialog-title-when-adding = أضِف تعليقًا
|
|
||||||
pdfjs-editor-edit-comment-dialog-save-button-when-adding = أضف
|
|
||||||
pdfjs-editor-edit-comment-dialog-text-input =
|
|
||||||
.placeholder = ابدأ الكتابة…
|
|
||||||
pdfjs-editor-edit-comment-dialog-cancel-button = ألغِ
|
|
||||||
|
|
||||||
## Edit a comment button in the editor toolbar
|
|
||||||
|
|
||||||
pdfjs-editor-add-comment-button =
|
|
||||||
.title = أضف التعليق
|
|
||||||
|
|
||||||
## The view manager is a sidebar displaying different views:
|
|
||||||
## - thumbnails;
|
|
||||||
## - outline;
|
|
||||||
## - attachments;
|
|
||||||
## - layers.
|
|
||||||
## The thumbnails view is used to edit the pdf: remove/insert pages, ...
|
|
||||||
|
|
||||||
pdfjs-toggle-views-manager-notification-button =
|
|
||||||
.title = تبديل الشريط الجانبي (يحتوي المستند على صور مصغرة/مخطط تفصيلي/مرفقات/طبقات)
|
|
||||||
pdfjs-toggle-views-manager-button1-label = أدِر الصفحات
|
|
||||||
pdfjs-views-manager-sidebar =
|
|
||||||
.aria-label = الشريط الجانبي
|
|
||||||
pdfjs-views-manager-sidebar-resizer =
|
|
||||||
.aria-label = أداة تغيير حجم الشريط الجانبي
|
|
||||||
pdfjs-views-manager-view-selector-button =
|
|
||||||
.title = المناظير
|
|
||||||
pdfjs-views-manager-view-selector-button-label = المناظير
|
|
||||||
pdfjs-views-manager-pages-title = الصفحات
|
|
||||||
pdfjs-views-manager-outlines-title1 = مخطط المستند
|
|
||||||
.title = مخطط المستند (انقر نقرًا مزدوجًا لتوسيع/طي كافة العناصر)
|
|
||||||
pdfjs-views-manager-attachments-title = المرفقات
|
|
||||||
pdfjs-views-manager-layers-title1 = طبقات
|
|
||||||
.title = الطبقات (انقر نقرًا مزدوجًا لإعادة تعيين كافة الطبقات إلى الحالة المبدئية)
|
|
||||||
pdfjs-views-manager-pages-option-label = الصفحات
|
|
||||||
pdfjs-views-manager-outlines-option-label = مخطط المستند
|
|
||||||
pdfjs-views-manager-attachments-option-label = المرفقات
|
|
||||||
pdfjs-views-manager-layers-option-label = الطبقات
|
|
||||||
pdfjs-views-manager-add-file-button =
|
|
||||||
.title = أضف ملف
|
|
||||||
pdfjs-views-manager-add-file-button-label = أضف ملف
|
|
||||||
# Variables:
|
|
||||||
# $count (Number) - the number of selected pages.
|
|
||||||
pdfjs-views-manager-pages-status-action-label =
|
|
||||||
{ $count ->
|
|
||||||
[zero] { $count } محدّد
|
|
||||||
[one] { $count } محدّد
|
|
||||||
[two] { $count } محدّدان
|
|
||||||
[few] { $count } محدّد
|
|
||||||
[many] { $count } محدّد
|
|
||||||
*[other] { $count } محدّد
|
|
||||||
}
|
|
||||||
pdfjs-views-manager-pages-status-none-action-label = حدّد الصفحات
|
|
||||||
pdfjs-views-manager-pages-status-action-button-label = أدِر
|
|
||||||
pdfjs-views-manager-pages-status-copy-button-label = انسخ
|
|
||||||
pdfjs-views-manager-pages-status-cut-button-label = قصّ
|
|
||||||
pdfjs-views-manager-pages-status-delete-button-label = احذف
|
|
||||||
pdfjs-views-manager-pages-status-export-selected-button-label = حُدِّد التصدير…
|
|
||||||
# Variables:
|
|
||||||
# $count (Number) - the number of selected pages to be cut.
|
|
||||||
pdfjs-views-manager-status-undo-cut-label =
|
|
||||||
{ $count ->
|
|
||||||
[zero] لا صفحات قُصت
|
|
||||||
[one] صفحة قُصت
|
|
||||||
[two] { $count } صفحتان قُصت
|
|
||||||
[few] { $count } صفحات قُصت
|
|
||||||
[many] { $count } صفحةً قُصت
|
|
||||||
*[other] { $count } صفحة قُصت
|
|
||||||
}
|
|
||||||
# Variables:
|
|
||||||
# $count (Number) - the number of selected pages to be copied.
|
|
||||||
pdfjs-views-manager-pages-status-undo-copy-label =
|
|
||||||
{ $count ->
|
|
||||||
[zero] لا صفحة منسوخة
|
|
||||||
[one] صفحة منسوخة
|
|
||||||
[two] صفحتان منسوختان
|
|
||||||
[few] { $count } صفحات منسوخة
|
|
||||||
[many] { $count } صفحةً منسوخةً
|
|
||||||
*[other] { $count } صفحة منسوخة
|
|
||||||
}
|
|
||||||
# Variables:
|
|
||||||
# $count (Number) - the number of selected pages to be deleted.
|
|
||||||
pdfjs-views-manager-pages-status-undo-delete-label =
|
|
||||||
{ $count ->
|
|
||||||
[zero] لا صفحات محذوفة
|
|
||||||
[one] حُذف صفحة
|
|
||||||
[two] حُذف صفحتان
|
|
||||||
[few] حُذف { $count } صفحات
|
|
||||||
[many] حُذف { $count } صفحةً
|
|
||||||
*[other] حُذف { $count } صفحة
|
|
||||||
}
|
|
||||||
pdfjs-views-manager-pages-status-waiting-ready-label = يجهز ملفك…
|
|
||||||
pdfjs-views-manager-pages-status-waiting-uploading-label = يرفع ملف…
|
|
||||||
pdfjs-views-manager-status-warning-cut-label = تعذّر القص. أنعش الصفحة وحاول مجددًا.
|
|
||||||
pdfjs-views-manager-status-warning-copy-label = تعذّر النسخ. أنعش الصفحة وحاول مجددًا.
|
|
||||||
pdfjs-views-manager-status-warning-delete-label = تعذّر الحذف. حدِّث الصفحة وحاول مجددًا.
|
|
||||||
pdfjs-views-manager-status-warning-save-label = تعذّر الحفظ. أنعش الصفحة وحاول مجددًا.
|
|
||||||
pdfjs-views-manager-status-undo-button-label = تراجع
|
|
||||||
pdfjs-views-manager-status-done-button-label = تمّ
|
|
||||||
pdfjs-views-manager-status-close-button =
|
|
||||||
.title = أغلق
|
|
||||||
pdfjs-views-manager-status-close-button-label = أغلق
|
|
||||||
pdfjs-views-manager-paste-button-label = ألصق
|
|
||||||
pdfjs-views-manager-paste-button-before =
|
|
||||||
.title = ألصق قبل الصفحة الأولى
|
|
||||||
# Variables:
|
|
||||||
# $page (Number) - the page number after which the paste button is.
|
|
||||||
pdfjs-views-manager-paste-button-after =
|
|
||||||
.title = ألصق بعد الصفحة { $page }
|
|
||||||
# Badge used to promote a new feature in the UI, keep it as short as possible.
|
|
||||||
# It's spelled uppercase for English, but it can be translated as usual.
|
|
||||||
pdfjs-new-badge-content = جديد
|
|
||||||
pdfjs-views-manager-waiting-for-file = يرفع ملف…
|
|
||||||
pdfjs-toggle-views-manager-button1 =
|
|
||||||
.title = أدِر الصفحات
|
|
||||||
|
|
||||||
## Main menu for adding/removing signatures
|
## Main menu for adding/removing signatures
|
||||||
|
|
||||||
pdfjs-editor-delete-signature-button1 =
|
|
||||||
.title = أزِل التوقيع المحفوظ
|
|
||||||
pdfjs-editor-delete-signature-button-label1 = أزِل التوقيع المحفوظ
|
|
||||||
|
|
||||||
## Editor toolbar
|
## Editor toolbar
|
||||||
|
|
||||||
pdfjs-editor-add-signature-edit-button-label = عدّل الوصف
|
|
||||||
|
|
||||||
## Edit signature description dialog
|
## Edit signature description dialog
|
||||||
|
|
||||||
pdfjs-editor-edit-signature-dialog-title = عدّل الوصف
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user