{"_id":"@datenlabor-bmz/redaction-ui","_rev":"3-9c6965ce1e85ab5bbbbc2d19f76a7103","name":"@datenlabor-bmz/redaction-ui","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@datenlabor-bmz/redaction-ui","version":"0.1.0","keywords":["react","pdf","redaction","mupdf","viewer"],"license":"AGPL-3.0","_id":"@datenlabor-bmz/redaction-ui@0.1.0","maintainers":[{"name":"davidpomerenke","email":"scroogemcduck@web.de"}],"homepage":"https://datenlabor-bmz.github.io/redaction-ui/","bugs":{"url":"https://github.com/datenlabor-bmz/redaction-ui/issues"},"dist":{"shasum":"478e31fc104619255de068ecbf7b1def332a8ab0","tarball":"https://registry.npmjs.org/@datenlabor-bmz/redaction-ui/-/redaction-ui-0.1.0.tgz","fileCount":33,"integrity":"sha512-fMPqOufG8FNVq1/PJJuywCOpLiKn2l/VGsDUTVEi7IpQipUWyuFsXh9QLweDSM5c+YEVBE8skCTr45piQ9ZLUg==","signatures":[{"sig":"MEYCIQDxOpd+cJAvgZ90Ddgp5BdwLvBZQGsF1KVXU4z96d+d2gIhAIeKDIpDGfEhFwOqZZ+9fg2gjQ6IX7ezucFx0pfUFp2o","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26534479},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"3532be2e7645ceacc1fe3397de2db8467f4e4b80","scripts":{"build":"vite build && tsc --emitDeclarationOnly --declaration --outDir dist","prepublishOnly":"npm run build"},"_npmUser":{"name":"davidpomerenke","email":"scroogemcduck@web.de"},"repository":{"url":"git+https://github.com/datenlabor-bmz/redaction-ui.git","type":"git"},"_npmVersion":"11.6.2","description":"React component library for PDF viewing and redaction","directories":{},"_nodeVersion":"25.1.0","dependencies":{"mupdf":"^1.3.0","comlink":"^4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.5","typescript":"~5.6.2","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@vitejs/plugin-react":"^4.3.4"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/redaction-ui_0.1.0_1767024191413_0.7580787115458065","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@datenlabor-bmz/redaction-ui","version":"0.1.2","keywords":["react","pdf","redaction","mupdf","viewer"],"license":"AGPL-3.0","_id":"@datenlabor-bmz/redaction-ui@0.1.2","maintainers":[{"name":"davidpomerenke","email":"scroogemcduck@web.de"}],"homepage":"https://datenlabor-bmz.github.io/redaction-ui/","bugs":{"url":"https://github.com/datenlabor-bmz/redaction-ui/issues"},"dist":{"shasum":"7068db1c5e13329e71811675c84a96e79d7d9986","tarball":"https://registry.npmjs.org/@datenlabor-bmz/redaction-ui/-/redaction-ui-0.1.2.tgz","fileCount":17,"integrity":"sha512-0yqNJyHLHkvZd8lMaRrEISMskJIEdUTn3evddQj/MNFqnc86s4abNu3dSCsAaT5nXDZBBA+MbdHNYinOjhJsBQ==","signatures":[{"sig":"MEUCIQCJwDhGAigSfeE76Bi9QpPUNeqxR71FHRLdosdE5a9VBgIgXByOe7gFOF9bsJ7L/HiaXXSYG3t9gygZAYGVsGtelNw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":112191},"main":"./src/index.ts","type":"module","types":"./src/index.ts","module":"./src/index.ts","exports":{".":{"types":"./src/index.ts","import":"./src/index.ts"}},"gitHead":"4876e3fdb345087ae38341035cc0af3102f3dde9","scripts":{"build":"echo 'No build needed - source is published directly'","typecheck":"tsc --noEmit"},"_npmUser":{"name":"davidpomerenke","email":"scroogemcduck@web.de"},"repository":{"url":"git+https://github.com/datenlabor-bmz/redaction-ui.git","type":"git"},"_npmVersion":"11.6.2","description":"React component library for PDF viewing and redaction","directories":{},"_nodeVersion":"25.1.0","dependencies":{"mupdf":"^1.3.0","comlink":"^4.4.2"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.0.5","typescript":"~5.6.2","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@vitejs/plugin-react":"^4.3.4"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/redaction-ui_0.1.2_1767026653130_0.7956499611029759","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@datenlabor-bmz/redaction-ui","version":"0.1.3","description":"React component library for PDF viewing and redaction","license":"AGPL-3.0","type":"module","main":"./src/index.ts","module":"./src/index.ts","types":"./src/index.ts","exports":{".":{"import":"./src/index.ts","types":"./src/index.ts"}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build":"echo 'No build needed - source is published directly'","typecheck":"tsc --noEmit"},"peerDependencies":{"react":"^18.0.0","react-dom":"^18.0.0"},"dependencies":{"comlink":"^4.4.2","mupdf":"^1.3.0"},"devDependencies":{"@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@vitejs/plugin-react":"^4.3.4","typescript":"~5.6.2","vite":"^6.0.5"},"repository":{"type":"git","url":"git+https://github.com/datenlabor-bmz/redaction-ui.git"},"homepage":"https://datenlabor-bmz.github.io/redaction-ui/","keywords":["react","pdf","redaction","mupdf","viewer"],"gitHead":"c01ea7515cfab678130cee6cf49328500f8545b8","_id":"@datenlabor-bmz/redaction-ui@0.1.3","bugs":{"url":"https://github.com/datenlabor-bmz/redaction-ui/issues"},"_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-Xw7DXmNVPS2OC9XZ/wLtzSs4UoEkAA0sOTnDdIgUgoJKksUbWaP2GWaZOyq/CohcrCaqcnW2Bjxucb/uEl6xCQ==","shasum":"eb25748f085ee7e1c044964038eab24923dce107","tarball":"https://registry.npmjs.org/@datenlabor-bmz/redaction-ui/-/redaction-ui-0.1.3.tgz","fileCount":17,"unpackedSize":112191,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@datenlabor-bmz%2fredaction-ui@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC0PmWoIr5ESED5bagMYjdV9pkqJPDra9byB+THZ1aTCAiEAyT53LN0Cl6aeNf2OOgqNbzoB9nZUTecEo1ONTOKB/gM="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6efdd2ea-5071-494e-8989-9c2ae1ae0b46"}},"directories":{},"maintainers":[{"name":"davidpomerenke","email":"scroogemcduck@web.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/redaction-ui_0.1.3_1767026900706_0.7053648553305467"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-29T16:03:11.343Z","modified":"2025-12-29T16:48:21.266Z","0.1.0":"2025-12-29T16:03:11.884Z","0.1.2":"2025-12-29T16:44:13.276Z","0.1.3":"2025-12-29T16:48:20.847Z"},"bugs":{"url":"https://github.com/datenlabor-bmz/redaction-ui/issues"},"license":"AGPL-3.0","homepage":"https://datenlabor-bmz.github.io/redaction-ui/","keywords":["react","pdf","redaction","mupdf","viewer"],"repository":{"type":"git","url":"git+https://github.com/datenlabor-bmz/redaction-ui.git"},"description":"React component library for PDF viewing and redaction","maintainers":[{"name":"davidpomerenke","email":"scroogemcduck@web.de"}],"readme":"# @datenlabor-bmz/redaction-ui\n\nA React component library for PDF viewing and redaction.\n\n## Demo\n\n**Live Demo:** https://datenlabor-bmz.github.io/redaction-ui/\n\nTo run the demo locally:\n\n```bash\ncd demo\nnpm install\nnpm run dev\n```\n\nThen open http://localhost:5173 in your browser.\n\n## Installation\n\n```bash\nnpm install @datenlabor-bmz/redaction-ui\n```\n\n## Components\n\n### PdfRedactorStandalone (Recommended)\n\nManages its own internal state. Simpler API for basic usage with optional AI integration hooks.\n\n```tsx\nimport { PdfRedactorStandalone } from '@datenlabor-bmz/redaction-ui';\n\n<PdfRedactorStandalone\n  rules={myRules}\n  onExport={(blob, redactions) => handleExport(blob, redactions)}\n  \n  // Optional: AI integration\n  aiSuggestions={suggestionsFromAI}\n  onPageTextExtracted={(text, pageIndex) => sendToAI(text, pageIndex)}\n/>\n```\n\n### PdfRedactor (Controlled)\n\nFully controlled component where all state is passed as props. Use this for advanced integrations where you manage state externally.\n\n```tsx\nimport { PdfRedactor, Redaction } from '@datenlabor-bmz/redaction-ui';\n\nconst [redactions, setRedactions] = useState<Redaction[]>([]);\n\n<PdfRedactor\n  file={pdfFile}\n  redactions={redactions}\n  onRedactionAdd={(r) => setRedactions(prev => [...prev, r])}\n  onRedactionRemove={(id) => setRedactions(prev => prev.filter(r => r.id !== id))}\n  onRedactionUpdate={(id, updates) => setRedactions(prev => \n    prev.map(r => r.id === id ? { ...r, ...updates } : r)\n  )}\n  onExport={(blob, applied) => downloadBlob(blob)}\n/>\n```\n\n## AI Integration\n\nThe library provides hooks for AI-powered redaction suggestions:\n\n```tsx\n<PdfRedactorStandalone\n  rules={rules}\n  // Called when page text is extracted - send this to your AI\n  onPageTextExtracted={(text, pageIndex) => {\n    sendToAI(text, pageIndex).then(suggestions => {\n      setAiSuggestions(suggestions)\n    })\n  }}\n  // AI suggestions are merged into the redaction list\n  aiSuggestions={aiSuggestions}\n/>\n```\n\n## Bundler Configuration\n\nThis library publishes TypeScript source directly and requires a bundler (Vite, Webpack, etc.) that can handle TypeScript and Web Workers. It uses MuPDF which requires specific configuration for WASM.\n\n### Vite\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  // Required: exclude mupdf from pre-bundling (loads WASM dynamically)\n  optimizeDeps: {\n    exclude: ['mupdf']\n  },\n  // Required: ES module format for workers\n  worker: {\n    format: 'es'\n  },\n  // Required: modern target for top-level await support\n  build: {\n    target: 'esnext'\n  }\n})\n```\n\n\n## Types\n\nThe library exports all TypeScript types:\n\n- `Redaction` - A redaction annotation\n- `RedactionPart` - A single rectangular region\n- `RedactionRule` - A legal rule/justification for redaction\n- `PdfRedactorProps` - Props for controlled component\n- `PdfRedactorStandaloneProps` - Props for standalone component\n\n## Defining Rules\n\nRules provide legal justifications for redactions:\n\n```typescript\nimport { RedactionRule } from '@datenlabor-bmz/redaction-ui';\n\nconst rules: RedactionRule[] = [\n  {\n    group: 'Personal Data',      // Optional grouping\n    title: 'Name',               // Display title\n    reference: 'GDPR Art. 4(1)', // Legal reference\n    reason: 'Personal identification information',\n    full_text: 'Full legal text...',\n    url: 'https://...'           // Optional link to law\n  }\n];\n```\n\n## License\n\nAGPL-3.0 - This library is based on [mupdf.js](https://github.com/ArtifexSoftware/mupdf.js) which is licensed under the GNU Affero General Public License.\n","readmeFilename":"README.md"}