|
| 1 | +# 📄 zotero-pdfjs-types |
| 2 | + |
| 3 | +[](https://github.com/zotero-plugin-dev/zotero-pdfjs-types/actions/workflows/update-types.yml) |
| 4 | +[](https://github.com/zotero-plugin-dev/zotero-pdfjs-types) |
| 5 | +[](https://github.com/zotero/pdf.js) |
| 6 | + |
| 7 | +[](https://github.com/windingwind/zotero-types) |
| 8 | + |
| 9 | +**Type definitions for Zotero’s fork of PDF.js**, generated automatically from the latest Zotero [`pdf.js`](https://github.com/zotero/pdf.js) source. |
| 10 | + |
| 11 | +This repository provides up-to-date TypeScript types for plugin developers targeting the Zotero PDF reader environment. |
| 12 | + |
| 13 | +## 🧩 Background |
| 14 | + |
| 15 | +Zotero maintains its own fork of [`pdf.js`](https://github.com/mozilla/pdf.js), with custom modifications for its built-in PDF reader. |
| 16 | + |
| 17 | +Since this fork diverges from upstream, the standard `pdfjs-dist` package no longer reflects Zotero’s implementation. |
| 18 | + |
| 19 | +To enable **TypeScript development** for Zotero plugins interacting with the internal PDF viewer, this project: |
| 20 | + |
| 21 | +- Pulls the **latest Zotero `pdf.js` source** every day |
| 22 | +- **Builds it** using the official Gulp pipeline (`npx gulp dist`) |
| 23 | +- **Extracts and commits the generated type definitions** to this repository |
| 24 | + |
| 25 | +## 📦 Usage |
| 26 | + |
| 27 | +> [!TIP] |
| 28 | +> The `zotero-types` package automatically includes this repository, so you typically **don’t need to install this directly**. |
| 29 | +
|
| 30 | +```bash |
| 31 | +pnpm add -D zotero-types |
| 32 | +``` |
| 33 | + |
| 34 | +If you want to use it independently: |
| 35 | + |
| 36 | +```bash |
| 37 | +pnpm add -D github:zotero-plugin-dev/zotero-pdfjs-types#main |
| 38 | +``` |
| 39 | + |
| 40 | +## 🧭 Relationship to Other Projects |
| 41 | + |
| 42 | +- **[`zotero/pdf.js`](https://github.com/zotero/pdf.js)** — the official Zotero fork of Mozilla PDF.js |
| 43 | +- **[`zotero-types`](https://github.com/windingwind/zotero-types)** — the comprehensive Zotero TypeScript type package that integrates this repository |
| 44 | + |
| 45 | +```mermaid |
| 46 | +graph TD |
| 47 | + A["mozilla/pdf.js (Upstream Project)"] -->|Forked by Zotero| B["zotero/pdf.js (Customized Fork)"] |
| 48 | + B -->|Daily sync & build types| C["zotero-pdfjs-types (Generated TS Types)"] |
| 49 | + C -->|Integrated into| D["zotero-types (Full Zotero Type Package)"] |
| 50 | + D -->|Used by| E["Zotero Plugin Developers (Type-safe Plugins)"] |
| 51 | +``` |
| 52 | + |
| 53 | +## 🧑💻 For Contributors |
| 54 | + |
| 55 | +> [!NOTE] |
| 56 | +> Do not manually edit files under `types/`. They are automatically generated and will be overwritten. |
| 57 | +
|
| 58 | +## 🪪 License |
| 59 | + |
| 60 | +Apache 2.0 License. |
0 commit comments