web-doc 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +148 -0
- package/THIRD_PARTY_NOTICES.md +20 -0
- package/bin/copy-assets.mjs +27 -0
- package/dist/abort.d.ts +1 -0
- package/dist/abort.js +18 -0
- package/dist/adapters/bitmap.d.ts +9 -0
- package/dist/adapters/bitmap.js +63 -0
- package/dist/adapters/csv-parser.d.ts +7 -0
- package/dist/adapters/csv-parser.js +124 -0
- package/dist/adapters/csv.d.ts +26 -0
- package/dist/adapters/csv.js +231 -0
- package/dist/adapters/image.d.ts +41 -0
- package/dist/adapters/image.js +198 -0
- package/dist/adapters/office.d.ts +211 -0
- package/dist/adapters/office.js +672 -0
- package/dist/adapters/pdf.d.ts +32 -0
- package/dist/adapters/pdf.js +429 -0
- package/dist/adapters/svg.d.ts +17 -0
- package/dist/adapters/svg.js +123 -0
- package/dist/assets/image/index.d.ts +75 -0
- package/dist/assets/image/index.js +289 -0
- package/dist/assets/image/index_bg.wasm +0 -0
- package/dist/assets/image/index_bg.wasm.d.ts +12 -0
- package/dist/assets/legacy/index.d.ts +54 -0
- package/dist/assets/legacy/index.js +306 -0
- package/dist/assets/legacy/index_bg.wasm +0 -0
- package/dist/assets/legacy/index_bg.wasm.d.ts +9 -0
- package/dist/assets/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/dist/assets/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/assets/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/dist/assets/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/LICENSE +36 -0
- package/dist/assets/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/Roman.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/V.bcmap +0 -0
- package/dist/assets/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/assets/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
- package/dist/assets/pdfjs/iccs/LICENSE +116 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/assets/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/assets/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
- package/dist/assets/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/assets/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/assets/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/assets/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/assets/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/assets/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_QCMS +22 -0
- package/dist/assets/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/assets/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/assets/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/assets/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/assets/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/assets/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/assets/pdfjs/wasm/quickjs-eval.js +16 -0
- package/dist/assets/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/dist/client.d.ts +20 -0
- package/dist/client.js +82 -0
- package/dist/contracts.d.ts +379 -0
- package/dist/contracts.js +22 -0
- package/dist/csv-worker.d.ts +1 -0
- package/dist/csv-worker.js +17 -0
- package/dist/detect.d.ts +15 -0
- package/dist/detect.js +290 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +40 -0
- package/dist/font-manifest.d.ts +11 -0
- package/dist/font-manifest.js +31 -0
- package/dist/fonts/OFL-1.1.txt +88 -0
- package/dist/fonts/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/fonts/manifest.json +83 -0
- package/dist/fonts/noto-sans-arabic.woff2 +0 -0
- package/dist/fonts/noto-sans-bengali.woff2 +0 -0
- package/dist/fonts/noto-sans-cjk.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari.woff2 +0 -0
- package/dist/fonts/noto-sans-gujarati.woff2 +0 -0
- package/dist/fonts/noto-sans-gurmukhi.woff2 +0 -0
- package/dist/fonts/noto-sans-japanese.woff2 +0 -0
- package/dist/fonts/noto-sans-kannada.woff2 +0 -0
- package/dist/fonts/noto-sans-korean.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-cyrillic.woff2 +0 -0
- package/dist/fonts/noto-sans-malayalam.woff2 +0 -0
- package/dist/fonts/noto-sans-odia.woff2 +0 -0
- package/dist/fonts/noto-sans-tamil.woff2 +0 -0
- package/dist/fonts/noto-sans-telugu.woff2 +0 -0
- package/dist/fonts.d.ts +20 -0
- package/dist/fonts.js +238 -0
- package/dist/format.d.ts +1 -0
- package/dist/format.js +1 -0
- package/dist/headless.d.ts +18 -0
- package/dist/headless.js +18 -0
- package/dist/i18n.d.ts +4 -0
- package/dist/i18n.js +55 -0
- package/dist/image-worker.d.ts +1 -0
- package/dist/image-worker.js +41 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +29 -0
- package/dist/interaction.d.ts +24 -0
- package/dist/interaction.js +183 -0
- package/dist/legacy-converter-worker.d.ts +1 -0
- package/dist/legacy-converter-worker.js +19 -0
- package/dist/limits.d.ts +4 -0
- package/dist/limits.js +162 -0
- package/dist/registry.d.ts +8 -0
- package/dist/registry.js +35 -0
- package/dist/render-scheduler.d.ts +8 -0
- package/dist/render-scheduler.js +63 -0
- package/dist/source.d.ts +14 -0
- package/dist/source.js +116 -0
- package/dist/spreadsheet-viewport.d.ts +34 -0
- package/dist/spreadsheet-viewport.js +1035 -0
- package/dist/styles.css +137 -0
- package/dist/ui-styles.d.ts +1 -0
- package/dist/ui-styles.js +139 -0
- package/dist/ui.d.ts +8 -0
- package/dist/ui.js +390 -0
- package/dist/viewer.d.ts +52 -0
- package/dist/viewer.js +901 -0
- package/dist/viewport.d.ts +54 -0
- package/dist/viewport.js +907 -0
- package/dist/worker-adapter.d.ts +24 -0
- package/dist/worker-adapter.js +97 -0
- package/dist/worker-client.d.ts +23 -0
- package/dist/worker-client.js +105 -0
- package/dist/worker-endpoint.d.ts +13 -0
- package/dist/worker-endpoint.js +57 -0
- package/dist/worker-protocol.d.ts +48 -0
- package/dist/worker-protocol.js +14 -0
- package/dist/worker.d.ts +4 -0
- package/dist/worker.js +4 -0
- package/dist/workers/csv-worker.js +160 -0
- package/dist/workers/image-worker.js +41 -0
- package/dist/workers/legacy-converter-worker.js +19 -0
- package/dist/workers/pdf.worker.min.mjs +28 -0
- package/package.json +74 -0
package/dist/styles.css
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
.zrimo-ui {
|
|
2
|
+
--zrimo-background: #e9edf2;
|
|
3
|
+
--zrimo-surface: #ffffff;
|
|
4
|
+
--zrimo-text: #101828;
|
|
5
|
+
--zrimo-muted: #667085;
|
|
6
|
+
--zrimo-border: #d0d5dd;
|
|
7
|
+
--zrimo-primary: #175cd3;
|
|
8
|
+
--zrimo-primary-contrast: #ffffff;
|
|
9
|
+
--zrimo-highlight: rgb(255 215 0 / 45%);
|
|
10
|
+
--zrimo-radius: 6px;
|
|
11
|
+
--zrimo-toolbar-height: 44px;
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
min-height: 240px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
color: var(--zrimo-text);
|
|
20
|
+
background: var(--zrimo-background);
|
|
21
|
+
font: 13px/1.4 "Zrimo Noto", system-ui, sans-serif;
|
|
22
|
+
}
|
|
23
|
+
.zrimo-ui, .zrimo-ui * { box-sizing: border-box; }
|
|
24
|
+
.zrimo-ui button, .zrimo-ui input {
|
|
25
|
+
margin: 0;
|
|
26
|
+
color: inherit;
|
|
27
|
+
font: inherit;
|
|
28
|
+
}
|
|
29
|
+
.zrimo-ui__toolbar {
|
|
30
|
+
z-index: 3;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex: 0 0 var(--zrimo-toolbar-height);
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 4px;
|
|
35
|
+
min-width: 0;
|
|
36
|
+
padding: 5px 8px;
|
|
37
|
+
border-bottom: 1px solid var(--zrimo-border);
|
|
38
|
+
background: var(--zrimo-surface);
|
|
39
|
+
}
|
|
40
|
+
.zrimo-ui__group { display: inline-flex; align-items: center; gap: 4px; }
|
|
41
|
+
.zrimo-ui__spacer { flex: 1 1 auto; }
|
|
42
|
+
.zrimo-ui__button {
|
|
43
|
+
min-width: 32px;
|
|
44
|
+
height: 32px;
|
|
45
|
+
padding: 0 9px;
|
|
46
|
+
border: 1px solid var(--zrimo-border);
|
|
47
|
+
border-radius: var(--zrimo-radius);
|
|
48
|
+
background: var(--zrimo-surface);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
.zrimo-ui__button:hover { border-color: var(--zrimo-primary); }
|
|
52
|
+
.zrimo-ui__button[aria-pressed="true"] {
|
|
53
|
+
color: var(--zrimo-primary-contrast);
|
|
54
|
+
border-color: var(--zrimo-primary);
|
|
55
|
+
background: var(--zrimo-primary);
|
|
56
|
+
}
|
|
57
|
+
.zrimo-ui__button:disabled { opacity: .45; cursor: default; }
|
|
58
|
+
.zrimo-ui__page-input {
|
|
59
|
+
width: 54px;
|
|
60
|
+
height: 30px;
|
|
61
|
+
padding: 2px 5px;
|
|
62
|
+
border: 1px solid var(--zrimo-border);
|
|
63
|
+
border-radius: var(--zrimo-radius);
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
.zrimo-ui__body { position: relative; display: flex; flex: 1 1 auto; min-height: 0; }
|
|
67
|
+
.zrimo-ui__viewport { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; }
|
|
68
|
+
.zrimo-ui__panel {
|
|
69
|
+
z-index: 2;
|
|
70
|
+
flex: 0 0 220px;
|
|
71
|
+
width: 220px;
|
|
72
|
+
overflow: auto;
|
|
73
|
+
border-right: 1px solid var(--zrimo-border);
|
|
74
|
+
background: var(--zrimo-surface);
|
|
75
|
+
}
|
|
76
|
+
.zrimo-ui__panel[hidden], .zrimo-ui__search[hidden],
|
|
77
|
+
.zrimo-ui__sheets[hidden], .zrimo-ui [hidden] { display: none !important; }
|
|
78
|
+
.zrimo-ui__thumbnail {
|
|
79
|
+
display: block;
|
|
80
|
+
width: calc(100% - 20px);
|
|
81
|
+
margin: 10px;
|
|
82
|
+
padding: 6px;
|
|
83
|
+
border: 1px solid var(--zrimo-border);
|
|
84
|
+
border-radius: var(--zrimo-radius);
|
|
85
|
+
background: var(--zrimo-surface);
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
.zrimo-ui__thumbnail[aria-current="page"] { border-color: var(--zrimo-primary); }
|
|
89
|
+
.zrimo-ui__thumbnail canvas { display: block; max-width: 100%; height: auto; margin: auto; }
|
|
90
|
+
.zrimo-ui__search {
|
|
91
|
+
z-index: 4;
|
|
92
|
+
display: flex;
|
|
93
|
+
gap: 5px;
|
|
94
|
+
align-items: center;
|
|
95
|
+
padding: 7px 8px;
|
|
96
|
+
border-bottom: 1px solid var(--zrimo-border);
|
|
97
|
+
background: var(--zrimo-surface);
|
|
98
|
+
}
|
|
99
|
+
.zrimo-ui__search input {
|
|
100
|
+
flex: 1 1 auto;
|
|
101
|
+
min-width: 80px;
|
|
102
|
+
height: 32px;
|
|
103
|
+
padding: 5px 8px;
|
|
104
|
+
border: 1px solid var(--zrimo-border);
|
|
105
|
+
border-radius: var(--zrimo-radius);
|
|
106
|
+
}
|
|
107
|
+
.zrimo-ui__search-status { min-width: 90px; color: var(--zrimo-muted); }
|
|
108
|
+
.zrimo-ui__sheets {
|
|
109
|
+
z-index: 3;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex: 0 0 38px;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 4px;
|
|
114
|
+
overflow-x: auto;
|
|
115
|
+
padding: 4px 8px;
|
|
116
|
+
border-top: 1px solid var(--zrimo-border);
|
|
117
|
+
background: var(--zrimo-surface);
|
|
118
|
+
}
|
|
119
|
+
.zrimo-ui__status {
|
|
120
|
+
position: absolute;
|
|
121
|
+
z-index: 5;
|
|
122
|
+
right: 10px;
|
|
123
|
+
bottom: 10px;
|
|
124
|
+
max-width: min(420px, calc(100% - 20px));
|
|
125
|
+
padding: 6px 9px;
|
|
126
|
+
border-radius: var(--zrimo-radius);
|
|
127
|
+
color: var(--zrimo-primary-contrast);
|
|
128
|
+
background: rgb(16 24 40 / 88%);
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
.zrimo-ui--fullscreen-fallback { position: fixed; z-index: 2147483647; inset: 0; }
|
|
132
|
+
@media (max-width: 640px) {
|
|
133
|
+
.zrimo-ui__toolbar { overflow-x: auto; }
|
|
134
|
+
.zrimo-ui__button { padding-inline: 7px; }
|
|
135
|
+
.zrimo-ui__panel { position: absolute; inset: 0 auto 0 0; }
|
|
136
|
+
.zrimo-ui__label { display: none; }
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const viewerCss = "\n.zrimo-ui {\n --zrimo-background: #e9edf2;\n --zrimo-surface: #ffffff;\n --zrimo-text: #101828;\n --zrimo-muted: #667085;\n --zrimo-border: #d0d5dd;\n --zrimo-primary: #175cd3;\n --zrimo-primary-contrast: #ffffff;\n --zrimo-highlight: rgb(255 215 0 / 45%);\n --zrimo-radius: 6px;\n --zrimo-toolbar-height: 44px;\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 240px;\n overflow: hidden;\n color: var(--zrimo-text);\n background: var(--zrimo-background);\n font: 13px/1.4 \"Zrimo Noto\", system-ui, sans-serif;\n}\n.zrimo-ui, .zrimo-ui * { box-sizing: border-box; }\n.zrimo-ui button, .zrimo-ui input {\n margin: 0;\n color: inherit;\n font: inherit;\n}\n.zrimo-ui__toolbar {\n z-index: 3;\n display: flex;\n flex: 0 0 var(--zrimo-toolbar-height);\n align-items: center;\n gap: 4px;\n min-width: 0;\n padding: 5px 8px;\n border-bottom: 1px solid var(--zrimo-border);\n background: var(--zrimo-surface);\n}\n.zrimo-ui__group { display: inline-flex; align-items: center; gap: 4px; }\n.zrimo-ui__spacer { flex: 1 1 auto; }\n.zrimo-ui__button {\n min-width: 32px;\n height: 32px;\n padding: 0 9px;\n border: 1px solid var(--zrimo-border);\n border-radius: var(--zrimo-radius);\n background: var(--zrimo-surface);\n cursor: pointer;\n}\n.zrimo-ui__button:hover { border-color: var(--zrimo-primary); }\n.zrimo-ui__button[aria-pressed=\"true\"] {\n color: var(--zrimo-primary-contrast);\n border-color: var(--zrimo-primary);\n background: var(--zrimo-primary);\n}\n.zrimo-ui__button:disabled { opacity: .45; cursor: default; }\n.zrimo-ui__page-input {\n width: 54px;\n height: 30px;\n padding: 2px 5px;\n border: 1px solid var(--zrimo-border);\n border-radius: var(--zrimo-radius);\n text-align: center;\n}\n.zrimo-ui__body { position: relative; display: flex; flex: 1 1 auto; min-height: 0; }\n.zrimo-ui__viewport { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; }\n.zrimo-ui__panel {\n z-index: 2;\n flex: 0 0 220px;\n width: 220px;\n overflow: auto;\n border-right: 1px solid var(--zrimo-border);\n background: var(--zrimo-surface);\n}\n.zrimo-ui__panel[hidden], .zrimo-ui__search[hidden],\n.zrimo-ui__sheets[hidden], .zrimo-ui [hidden] { display: none !important; }\n.zrimo-ui__thumbnail {\n display: block;\n width: calc(100% - 20px);\n margin: 10px;\n padding: 6px;\n border: 1px solid var(--zrimo-border);\n border-radius: var(--zrimo-radius);\n background: var(--zrimo-surface);\n cursor: pointer;\n}\n.zrimo-ui__thumbnail[aria-current=\"page\"] { border-color: var(--zrimo-primary); }\n.zrimo-ui__thumbnail canvas { display: block; max-width: 100%; height: auto; margin: auto; }\n.zrimo-ui__search {\n z-index: 4;\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 7px 8px;\n border-bottom: 1px solid var(--zrimo-border);\n background: var(--zrimo-surface);\n}\n.zrimo-ui__search input {\n flex: 1 1 auto;\n min-width: 80px;\n height: 32px;\n padding: 5px 8px;\n border: 1px solid var(--zrimo-border);\n border-radius: var(--zrimo-radius);\n}\n.zrimo-ui__search-status { min-width: 90px; color: var(--zrimo-muted); }\n.zrimo-ui__sheets {\n z-index: 3;\n display: flex;\n flex: 0 0 38px;\n align-items: center;\n gap: 4px;\n overflow-x: auto;\n padding: 4px 8px;\n border-top: 1px solid var(--zrimo-border);\n background: var(--zrimo-surface);\n}\n.zrimo-ui__status {\n position: absolute;\n z-index: 5;\n right: 10px;\n bottom: 10px;\n max-width: min(420px, calc(100% - 20px));\n padding: 6px 9px;\n border-radius: var(--zrimo-radius);\n color: var(--zrimo-primary-contrast);\n background: rgb(16 24 40 / 88%);\n pointer-events: none;\n}\n.zrimo-ui--fullscreen-fallback { position: fixed; z-index: 2147483647; inset: 0; }\n@media (max-width: 640px) {\n .zrimo-ui__toolbar { overflow-x: auto; }\n .zrimo-ui__button { padding-inline: 7px; }\n .zrimo-ui__panel { position: absolute; inset: 0 auto 0 0; }\n .zrimo-ui__label { display: none; }\n}\n";
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export const viewerCss = `
|
|
2
|
+
.zrimo-ui {
|
|
3
|
+
--zrimo-background: #e9edf2;
|
|
4
|
+
--zrimo-surface: #ffffff;
|
|
5
|
+
--zrimo-text: #101828;
|
|
6
|
+
--zrimo-muted: #667085;
|
|
7
|
+
--zrimo-border: #d0d5dd;
|
|
8
|
+
--zrimo-primary: #175cd3;
|
|
9
|
+
--zrimo-primary-contrast: #ffffff;
|
|
10
|
+
--zrimo-highlight: rgb(255 215 0 / 45%);
|
|
11
|
+
--zrimo-radius: 6px;
|
|
12
|
+
--zrimo-toolbar-height: 44px;
|
|
13
|
+
position: relative;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-height: 240px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
color: var(--zrimo-text);
|
|
21
|
+
background: var(--zrimo-background);
|
|
22
|
+
font: 13px/1.4 "Zrimo Noto", system-ui, sans-serif;
|
|
23
|
+
}
|
|
24
|
+
.zrimo-ui, .zrimo-ui * { box-sizing: border-box; }
|
|
25
|
+
.zrimo-ui button, .zrimo-ui input {
|
|
26
|
+
margin: 0;
|
|
27
|
+
color: inherit;
|
|
28
|
+
font: inherit;
|
|
29
|
+
}
|
|
30
|
+
.zrimo-ui__toolbar {
|
|
31
|
+
z-index: 3;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex: 0 0 var(--zrimo-toolbar-height);
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
padding: 5px 8px;
|
|
38
|
+
border-bottom: 1px solid var(--zrimo-border);
|
|
39
|
+
background: var(--zrimo-surface);
|
|
40
|
+
}
|
|
41
|
+
.zrimo-ui__group { display: inline-flex; align-items: center; gap: 4px; }
|
|
42
|
+
.zrimo-ui__spacer { flex: 1 1 auto; }
|
|
43
|
+
.zrimo-ui__button {
|
|
44
|
+
min-width: 32px;
|
|
45
|
+
height: 32px;
|
|
46
|
+
padding: 0 9px;
|
|
47
|
+
border: 1px solid var(--zrimo-border);
|
|
48
|
+
border-radius: var(--zrimo-radius);
|
|
49
|
+
background: var(--zrimo-surface);
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
.zrimo-ui__button:hover { border-color: var(--zrimo-primary); }
|
|
53
|
+
.zrimo-ui__button[aria-pressed="true"] {
|
|
54
|
+
color: var(--zrimo-primary-contrast);
|
|
55
|
+
border-color: var(--zrimo-primary);
|
|
56
|
+
background: var(--zrimo-primary);
|
|
57
|
+
}
|
|
58
|
+
.zrimo-ui__button:disabled { opacity: .45; cursor: default; }
|
|
59
|
+
.zrimo-ui__page-input {
|
|
60
|
+
width: 54px;
|
|
61
|
+
height: 30px;
|
|
62
|
+
padding: 2px 5px;
|
|
63
|
+
border: 1px solid var(--zrimo-border);
|
|
64
|
+
border-radius: var(--zrimo-radius);
|
|
65
|
+
text-align: center;
|
|
66
|
+
}
|
|
67
|
+
.zrimo-ui__body { position: relative; display: flex; flex: 1 1 auto; min-height: 0; }
|
|
68
|
+
.zrimo-ui__viewport { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; }
|
|
69
|
+
.zrimo-ui__panel {
|
|
70
|
+
z-index: 2;
|
|
71
|
+
flex: 0 0 220px;
|
|
72
|
+
width: 220px;
|
|
73
|
+
overflow: auto;
|
|
74
|
+
border-right: 1px solid var(--zrimo-border);
|
|
75
|
+
background: var(--zrimo-surface);
|
|
76
|
+
}
|
|
77
|
+
.zrimo-ui__panel[hidden], .zrimo-ui__search[hidden],
|
|
78
|
+
.zrimo-ui__sheets[hidden], .zrimo-ui [hidden] { display: none !important; }
|
|
79
|
+
.zrimo-ui__thumbnail {
|
|
80
|
+
display: block;
|
|
81
|
+
width: calc(100% - 20px);
|
|
82
|
+
margin: 10px;
|
|
83
|
+
padding: 6px;
|
|
84
|
+
border: 1px solid var(--zrimo-border);
|
|
85
|
+
border-radius: var(--zrimo-radius);
|
|
86
|
+
background: var(--zrimo-surface);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
.zrimo-ui__thumbnail[aria-current="page"] { border-color: var(--zrimo-primary); }
|
|
90
|
+
.zrimo-ui__thumbnail canvas { display: block; max-width: 100%; height: auto; margin: auto; }
|
|
91
|
+
.zrimo-ui__search {
|
|
92
|
+
z-index: 4;
|
|
93
|
+
display: flex;
|
|
94
|
+
gap: 5px;
|
|
95
|
+
align-items: center;
|
|
96
|
+
padding: 7px 8px;
|
|
97
|
+
border-bottom: 1px solid var(--zrimo-border);
|
|
98
|
+
background: var(--zrimo-surface);
|
|
99
|
+
}
|
|
100
|
+
.zrimo-ui__search input {
|
|
101
|
+
flex: 1 1 auto;
|
|
102
|
+
min-width: 80px;
|
|
103
|
+
height: 32px;
|
|
104
|
+
padding: 5px 8px;
|
|
105
|
+
border: 1px solid var(--zrimo-border);
|
|
106
|
+
border-radius: var(--zrimo-radius);
|
|
107
|
+
}
|
|
108
|
+
.zrimo-ui__search-status { min-width: 90px; color: var(--zrimo-muted); }
|
|
109
|
+
.zrimo-ui__sheets {
|
|
110
|
+
z-index: 3;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex: 0 0 38px;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 4px;
|
|
115
|
+
overflow-x: auto;
|
|
116
|
+
padding: 4px 8px;
|
|
117
|
+
border-top: 1px solid var(--zrimo-border);
|
|
118
|
+
background: var(--zrimo-surface);
|
|
119
|
+
}
|
|
120
|
+
.zrimo-ui__status {
|
|
121
|
+
position: absolute;
|
|
122
|
+
z-index: 5;
|
|
123
|
+
right: 10px;
|
|
124
|
+
bottom: 10px;
|
|
125
|
+
max-width: min(420px, calc(100% - 20px));
|
|
126
|
+
padding: 6px 9px;
|
|
127
|
+
border-radius: var(--zrimo-radius);
|
|
128
|
+
color: var(--zrimo-primary-contrast);
|
|
129
|
+
background: rgb(16 24 40 / 88%);
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
.zrimo-ui--fullscreen-fallback { position: fixed; z-index: 2147483647; inset: 0; }
|
|
133
|
+
@media (max-width: 640px) {
|
|
134
|
+
.zrimo-ui__toolbar { overflow-x: auto; }
|
|
135
|
+
.zrimo-ui__button { padding-inline: 7px; }
|
|
136
|
+
.zrimo-ui__panel { position: absolute; inset: 0 auto 0 0; }
|
|
137
|
+
.zrimo-ui__label { display: none; }
|
|
138
|
+
}
|
|
139
|
+
`;
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ViewerApi, ViewerTranslations } from "./contracts.js";
|
|
2
|
+
export declare class BasicViewerUi {
|
|
3
|
+
#private;
|
|
4
|
+
readonly root: HTMLDivElement;
|
|
5
|
+
readonly viewportContainer: HTMLDivElement;
|
|
6
|
+
constructor(container: HTMLElement, viewer: ViewerApi, translations: ViewerTranslations);
|
|
7
|
+
destroy(): void;
|
|
8
|
+
}
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { ViewerError } from "./errors.js";
|
|
2
|
+
import { viewerCss } from "./ui-styles.js";
|
|
3
|
+
export class BasicViewerUi {
|
|
4
|
+
root;
|
|
5
|
+
viewportContainer;
|
|
6
|
+
#viewer;
|
|
7
|
+
#translations;
|
|
8
|
+
#toolbar;
|
|
9
|
+
#searchPanel;
|
|
10
|
+
#searchInput;
|
|
11
|
+
#searchStatus;
|
|
12
|
+
#thumbnailPanel;
|
|
13
|
+
#sheetTabs;
|
|
14
|
+
#status;
|
|
15
|
+
#pageInput;
|
|
16
|
+
#pageCount;
|
|
17
|
+
#zoomLabel;
|
|
18
|
+
#buttons = new Map();
|
|
19
|
+
#unsubscribes = [];
|
|
20
|
+
#onKeyDown = (event) => this.#handleKeyDown(event);
|
|
21
|
+
#onFullscreenChange = () => this.#syncFullscreen();
|
|
22
|
+
#info;
|
|
23
|
+
#search = null;
|
|
24
|
+
#selection = null;
|
|
25
|
+
#thumbnailAbort;
|
|
26
|
+
#searchTimer;
|
|
27
|
+
#fallbackFullscreen = false;
|
|
28
|
+
#destroyed = false;
|
|
29
|
+
constructor(container, viewer, translations) {
|
|
30
|
+
this.#viewer = viewer;
|
|
31
|
+
this.#translations = translations;
|
|
32
|
+
this.root = document.createElement("div");
|
|
33
|
+
this.root.className = "zrimo-ui";
|
|
34
|
+
this.root.dataset.zrimoUi = "root";
|
|
35
|
+
this.root.setAttribute("lang", "");
|
|
36
|
+
const style = document.createElement("style");
|
|
37
|
+
style.dataset.zrimoStyles = "";
|
|
38
|
+
style.textContent = viewerCss;
|
|
39
|
+
this.#toolbar = document.createElement("div");
|
|
40
|
+
this.#toolbar.className = "zrimo-ui__toolbar";
|
|
41
|
+
this.#toolbar.setAttribute("role", "toolbar");
|
|
42
|
+
this.#toolbar.append(this.#button("thumbnails", "▦", translations.thumbnails, () => this.#toggleThumbnails()), group(this.#button("previous", "‹", translations.previous, () => viewer.previous()), this.#button("next", "›", translations.next, () => viewer.next())));
|
|
43
|
+
const pageGroup = group();
|
|
44
|
+
pageGroup.dataset.control = "page";
|
|
45
|
+
this.#pageInput = document.createElement("input");
|
|
46
|
+
this.#pageInput.className = "zrimo-ui__page-input";
|
|
47
|
+
this.#pageInput.type = "number";
|
|
48
|
+
this.#pageInput.min = "1";
|
|
49
|
+
this.#pageInput.setAttribute("aria-label", translations.page);
|
|
50
|
+
this.#pageInput.addEventListener("change", () => viewer.goToPage(Number(this.#pageInput.value) - 1));
|
|
51
|
+
this.#pageCount = document.createElement("span");
|
|
52
|
+
pageGroup.append(this.#pageInput, this.#pageCount);
|
|
53
|
+
this.#toolbar.append(pageGroup, group(this.#button("zoom-out", "−", translations.zoomOut, () => viewer.zoomOut()), this.#button("zoom-in", "+", translations.zoomIn, () => viewer.zoomIn())));
|
|
54
|
+
this.#zoomLabel = document.createElement("span");
|
|
55
|
+
this.#zoomLabel.dataset.control = "zoom-label";
|
|
56
|
+
this.#toolbar.append(this.#zoomLabel, group(this.#button("fit-width", "↔", translations.fitWidth, () => viewer.fitWidth()), this.#button("fit-page", "□", translations.fitPage, () => viewer.fitPage())), spacer(), this.#button("search", "⌕", translations.search, () => this.#toggleSearch()), this.#button("fullscreen", "⛶", translations.fullscreen, () => void this.#toggleFullscreen()), this.#button("download", "⇩", translations.download, () => {
|
|
57
|
+
try {
|
|
58
|
+
viewer.downloadOriginal();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
this.#showStatus(error instanceof Error ? error.message : String(error));
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
this.#searchPanel = document.createElement("div");
|
|
65
|
+
this.#searchPanel.className = "zrimo-ui__search";
|
|
66
|
+
this.#searchPanel.hidden = true;
|
|
67
|
+
this.#searchInput = document.createElement("input");
|
|
68
|
+
this.#searchInput.type = "search";
|
|
69
|
+
this.#searchInput.placeholder = translations.searchPlaceholder;
|
|
70
|
+
this.#searchInput.setAttribute("aria-label", translations.search);
|
|
71
|
+
this.#searchInput.addEventListener("input", () => this.#scheduleSearch());
|
|
72
|
+
this.#searchInput.addEventListener("keydown", (event) => {
|
|
73
|
+
if (event.key === "Enter") {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
if (event.shiftKey)
|
|
76
|
+
viewer.searchPrevious();
|
|
77
|
+
else
|
|
78
|
+
viewer.searchNext();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this.#searchStatus = document.createElement("span");
|
|
82
|
+
this.#searchStatus.className = "zrimo-ui__search-status";
|
|
83
|
+
this.#searchPanel.append(this.#searchInput, this.#button("search-previous", "‹", translations.previous, () => viewer.searchPrevious()), this.#button("search-next", "›", translations.next, () => viewer.searchNext()), this.#searchStatus, this.#button("search-close", "×", translations.close, () => this.#closeSearch()));
|
|
84
|
+
const body = document.createElement("div");
|
|
85
|
+
body.className = "zrimo-ui__body";
|
|
86
|
+
this.#thumbnailPanel = document.createElement("aside");
|
|
87
|
+
this.#thumbnailPanel.className = "zrimo-ui__panel";
|
|
88
|
+
this.#thumbnailPanel.dataset.panel = "thumbnails";
|
|
89
|
+
this.#thumbnailPanel.hidden = true;
|
|
90
|
+
this.#thumbnailPanel.setAttribute("aria-label", translations.thumbnails);
|
|
91
|
+
this.viewportContainer = document.createElement("div");
|
|
92
|
+
this.viewportContainer.className = "zrimo-ui__viewport";
|
|
93
|
+
body.append(this.#thumbnailPanel, this.viewportContainer);
|
|
94
|
+
this.#sheetTabs = document.createElement("div");
|
|
95
|
+
this.#sheetTabs.className = "zrimo-ui__sheets";
|
|
96
|
+
this.#sheetTabs.hidden = true;
|
|
97
|
+
this.#sheetTabs.setAttribute("aria-label", translations.sheets);
|
|
98
|
+
this.#status = document.createElement("div");
|
|
99
|
+
this.#status.className = "zrimo-ui__status";
|
|
100
|
+
this.#status.hidden = true;
|
|
101
|
+
this.#status.setAttribute("role", "status");
|
|
102
|
+
this.root.append(style, this.#toolbar, this.#searchPanel, body, this.#sheetTabs, this.#status);
|
|
103
|
+
container.append(this.root);
|
|
104
|
+
this.#unsubscribes.push(viewer.on("statechange", (state) => this.#syncState(state)), viewer.on("ready", () => {
|
|
105
|
+
this.#info = viewer.getDocumentInfo();
|
|
106
|
+
this.#renderSheetTabs();
|
|
107
|
+
this.#syncState(viewer.state);
|
|
108
|
+
}), viewer.on("progress", (progress) => {
|
|
109
|
+
if (viewer.state.status === "loading")
|
|
110
|
+
this.#showStatus(progress.ratio === undefined
|
|
111
|
+
? translations.loading
|
|
112
|
+
: `${translations.loading} ${Math.round(progress.ratio * 100)}%`);
|
|
113
|
+
}), viewer.on("error", (error) => this.#showStatus(error.message)), viewer.on("warning", (warning) => this.#showStatus(warning.message, 3500)), viewer.on("searchchange", (result) => {
|
|
114
|
+
this.#search = result;
|
|
115
|
+
this.#syncSearch();
|
|
116
|
+
}), viewer.on("selectionchange", (selection) => {
|
|
117
|
+
this.#selection = selection;
|
|
118
|
+
this.#renderSheetTabs();
|
|
119
|
+
}), viewer.on("pagechange", () => {
|
|
120
|
+
if (!this.#thumbnailPanel.hidden)
|
|
121
|
+
void this.#renderThumbnails();
|
|
122
|
+
this.#renderSheetTabs();
|
|
123
|
+
}));
|
|
124
|
+
this.root.addEventListener("keydown", this.#onKeyDown);
|
|
125
|
+
document.addEventListener("fullscreenchange", this.#onFullscreenChange);
|
|
126
|
+
this.#syncState(viewer.state);
|
|
127
|
+
}
|
|
128
|
+
destroy() {
|
|
129
|
+
if (this.#destroyed)
|
|
130
|
+
return;
|
|
131
|
+
this.#destroyed = true;
|
|
132
|
+
if (this.#searchTimer)
|
|
133
|
+
clearTimeout(this.#searchTimer);
|
|
134
|
+
this.#thumbnailAbort?.abort();
|
|
135
|
+
for (const unsubscribe of this.#unsubscribes)
|
|
136
|
+
unsubscribe();
|
|
137
|
+
this.root.removeEventListener("keydown", this.#onKeyDown);
|
|
138
|
+
document.removeEventListener("fullscreenchange", this.#onFullscreenChange);
|
|
139
|
+
if (document.fullscreenElement === this.root)
|
|
140
|
+
void document.exitFullscreen();
|
|
141
|
+
this.root.remove();
|
|
142
|
+
}
|
|
143
|
+
#button(id, text, label, action) {
|
|
144
|
+
const button = document.createElement("button");
|
|
145
|
+
button.type = "button";
|
|
146
|
+
button.className = "zrimo-ui__button";
|
|
147
|
+
button.dataset.action = id;
|
|
148
|
+
button.textContent = text;
|
|
149
|
+
button.title = label;
|
|
150
|
+
button.setAttribute("aria-label", label);
|
|
151
|
+
button.addEventListener("click", action);
|
|
152
|
+
this.#buttons.set(id, button);
|
|
153
|
+
return button;
|
|
154
|
+
}
|
|
155
|
+
#syncState(state) {
|
|
156
|
+
const ready = state.status === "ready";
|
|
157
|
+
this.#pageInput.value = String(state.pageIndex + 1);
|
|
158
|
+
this.#pageInput.max = String(Math.max(1, state.pageCount));
|
|
159
|
+
this.#pageCount.textContent = `${this.#translations.of} ${state.pageCount}`;
|
|
160
|
+
this.#zoomLabel.textContent = `${Math.round(state.zoom * 100)}%`;
|
|
161
|
+
this.#buttons.get("previous").disabled = !ready || state.pageIndex <= 0;
|
|
162
|
+
this.#buttons.get("next").disabled =
|
|
163
|
+
!ready || state.pageIndex >= state.pageCount - 1;
|
|
164
|
+
this.#buttons.get("download").disabled = !ready;
|
|
165
|
+
this.#buttons.get("search").disabled =
|
|
166
|
+
!ready || !this.#info?.capabilities?.search;
|
|
167
|
+
const single = state.pageCount <= 1;
|
|
168
|
+
const pageControls = this.#toolbar.querySelector('[data-control="page"]');
|
|
169
|
+
if (pageControls)
|
|
170
|
+
pageControls.hidden = single || this.#info?.unit === "sheet";
|
|
171
|
+
this.#buttons.get("previous").hidden =
|
|
172
|
+
single || this.#info?.unit === "sheet";
|
|
173
|
+
this.#buttons.get("next").hidden = single || this.#info?.unit === "sheet";
|
|
174
|
+
const thumbnailsAvailable = Boolean(ready &&
|
|
175
|
+
!single &&
|
|
176
|
+
this.#info?.capabilities?.thumbnails &&
|
|
177
|
+
this.#info.unit !== "sheet");
|
|
178
|
+
this.#buttons.get("thumbnails").hidden = !thumbnailsAvailable;
|
|
179
|
+
if (!thumbnailsAvailable)
|
|
180
|
+
this.#closeThumbnails();
|
|
181
|
+
if (state.status !== "loading" && state.status !== "error")
|
|
182
|
+
this.#hideStatus();
|
|
183
|
+
if (state.status === "idle") {
|
|
184
|
+
this.#info = undefined;
|
|
185
|
+
this.#search = null;
|
|
186
|
+
this.#selection = null;
|
|
187
|
+
this.#renderSheetTabs();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
#toggleSearch() {
|
|
191
|
+
const open = this.#searchPanel.hidden;
|
|
192
|
+
this.#searchPanel.hidden = !open;
|
|
193
|
+
this.#buttons.get("search").setAttribute("aria-pressed", String(open));
|
|
194
|
+
if (open)
|
|
195
|
+
this.#searchInput.focus();
|
|
196
|
+
}
|
|
197
|
+
#closeSearch() {
|
|
198
|
+
this.#searchPanel.hidden = true;
|
|
199
|
+
this.#buttons.get("search").setAttribute("aria-pressed", "false");
|
|
200
|
+
this.#searchInput.value = "";
|
|
201
|
+
this.#viewer.clearSearch();
|
|
202
|
+
}
|
|
203
|
+
#scheduleSearch() {
|
|
204
|
+
if (this.#searchTimer)
|
|
205
|
+
clearTimeout(this.#searchTimer);
|
|
206
|
+
this.#searchTimer = setTimeout(() => {
|
|
207
|
+
this.#searchTimer = undefined;
|
|
208
|
+
void this.#viewer
|
|
209
|
+
.search(this.#searchInput.value)
|
|
210
|
+
.catch((error) => {
|
|
211
|
+
if (!(error instanceof ViewerError) || error.code !== "aborted")
|
|
212
|
+
this.#showStatus(error instanceof Error ? error.message : String(error));
|
|
213
|
+
});
|
|
214
|
+
}, 120);
|
|
215
|
+
}
|
|
216
|
+
#syncSearch() {
|
|
217
|
+
const result = this.#search;
|
|
218
|
+
if (!result || result.matches.length === 0) {
|
|
219
|
+
this.#searchStatus.textContent = this.#searchInput.value
|
|
220
|
+
? this.#translations.noMatches
|
|
221
|
+
: "";
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.#searchStatus.textContent = `${result.activeIndex + 1}/${result.matches.length}`;
|
|
225
|
+
}
|
|
226
|
+
#toggleThumbnails() {
|
|
227
|
+
const open = this.#thumbnailPanel.hidden;
|
|
228
|
+
this.#thumbnailPanel.hidden = !open;
|
|
229
|
+
this.#buttons.get("thumbnails").setAttribute("aria-pressed", String(open));
|
|
230
|
+
if (open)
|
|
231
|
+
void this.#renderThumbnails();
|
|
232
|
+
else
|
|
233
|
+
this.#thumbnailAbort?.abort();
|
|
234
|
+
}
|
|
235
|
+
#closeThumbnails() {
|
|
236
|
+
this.#thumbnailPanel.hidden = true;
|
|
237
|
+
this.#buttons.get("thumbnails").setAttribute("aria-pressed", "false");
|
|
238
|
+
this.#thumbnailAbort?.abort();
|
|
239
|
+
this.#thumbnailPanel.replaceChildren();
|
|
240
|
+
}
|
|
241
|
+
async #renderThumbnails() {
|
|
242
|
+
if (this.#thumbnailPanel.hidden || this.#viewer.state.status !== "ready")
|
|
243
|
+
return;
|
|
244
|
+
this.#thumbnailAbort?.abort();
|
|
245
|
+
const controller = new AbortController();
|
|
246
|
+
this.#thumbnailAbort = controller;
|
|
247
|
+
const state = this.#viewer.state;
|
|
248
|
+
const start = Math.max(0, state.pageIndex - 5);
|
|
249
|
+
const end = Math.min(state.pageCount, start + 11);
|
|
250
|
+
this.#thumbnailPanel.replaceChildren();
|
|
251
|
+
for (let pageIndex = start; pageIndex < end; pageIndex += 1) {
|
|
252
|
+
if (controller.signal.aborted)
|
|
253
|
+
return;
|
|
254
|
+
const button = document.createElement("button");
|
|
255
|
+
button.type = "button";
|
|
256
|
+
button.className = "zrimo-ui__thumbnail";
|
|
257
|
+
button.dataset.pageIndex = String(pageIndex);
|
|
258
|
+
button.setAttribute("aria-label", `${this.#translations.page} ${pageIndex + 1}`);
|
|
259
|
+
button.setAttribute("aria-current", pageIndex === state.pageIndex ? "page" : "false");
|
|
260
|
+
const canvas = document.createElement("canvas");
|
|
261
|
+
const label = document.createElement("span");
|
|
262
|
+
label.textContent = String(pageIndex + 1);
|
|
263
|
+
button.append(canvas, label);
|
|
264
|
+
button.addEventListener("click", () => this.#viewer.goToPage(pageIndex));
|
|
265
|
+
this.#thumbnailPanel.append(button);
|
|
266
|
+
try {
|
|
267
|
+
await this.#viewer.renderThumbnail(pageIndex, canvas, {
|
|
268
|
+
maxWidth: 180,
|
|
269
|
+
maxHeight: 220,
|
|
270
|
+
signal: controller.signal,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
if (!(error instanceof ViewerError) || error.code !== "aborted")
|
|
275
|
+
button.dataset.renderError = "true";
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
#renderSheetTabs() {
|
|
280
|
+
const names = this.#info?.sheetNames;
|
|
281
|
+
if (this.#info?.unit !== "sheet" || !names) {
|
|
282
|
+
this.#sheetTabs.hidden = true;
|
|
283
|
+
this.#sheetTabs.replaceChildren();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
this.#sheetTabs.hidden = false;
|
|
287
|
+
this.#sheetTabs.replaceChildren();
|
|
288
|
+
names.forEach((name, sheetIndex) => {
|
|
289
|
+
const button = this.#button(`sheet-${sheetIndex}`, name, name, () => this.#viewer.setSheet(sheetIndex));
|
|
290
|
+
button.setAttribute("aria-pressed", String(sheetIndex === this.#viewer.state.pageIndex));
|
|
291
|
+
this.#sheetTabs.append(button);
|
|
292
|
+
});
|
|
293
|
+
if (this.#selection && "sheetIndex" in this.#selection) {
|
|
294
|
+
const range = document.createElement("span");
|
|
295
|
+
range.className = "zrimo-ui__label";
|
|
296
|
+
const ranges = "ranges" in this.#selection
|
|
297
|
+
? this.#selection.ranges
|
|
298
|
+
: [this.#selection];
|
|
299
|
+
const labels = ranges.slice(0, 3).map(formatCellRange);
|
|
300
|
+
range.textContent = `${this.#translations.selectedRange}: ${labels.join("; ")}${ranges.length > labels.length ? "; …" : ""}`;
|
|
301
|
+
this.#sheetTabs.append(range);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
async #toggleFullscreen() {
|
|
305
|
+
if (document.fullscreenElement === this.root) {
|
|
306
|
+
await document.exitFullscreen();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (this.#fallbackFullscreen) {
|
|
310
|
+
this.#setFallbackFullscreen(false);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
try {
|
|
314
|
+
if (!this.root.requestFullscreen)
|
|
315
|
+
throw new Error("Fullscreen API unavailable");
|
|
316
|
+
await this.root.requestFullscreen();
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
this.#setFallbackFullscreen(true);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
#setFallbackFullscreen(active) {
|
|
323
|
+
this.#fallbackFullscreen = active;
|
|
324
|
+
this.root.classList.toggle("zrimo-ui--fullscreen-fallback", active);
|
|
325
|
+
this.#syncFullscreen();
|
|
326
|
+
}
|
|
327
|
+
#syncFullscreen() {
|
|
328
|
+
const active = document.fullscreenElement === this.root || this.#fallbackFullscreen;
|
|
329
|
+
const button = this.#buttons.get("fullscreen");
|
|
330
|
+
button.setAttribute("aria-pressed", String(active));
|
|
331
|
+
button.title = active
|
|
332
|
+
? this.#translations.exitFullscreen
|
|
333
|
+
: this.#translations.fullscreen;
|
|
334
|
+
button.setAttribute("aria-label", button.title);
|
|
335
|
+
}
|
|
336
|
+
#handleKeyDown(event) {
|
|
337
|
+
if (event.defaultPrevented)
|
|
338
|
+
return;
|
|
339
|
+
const editing = event.target instanceof HTMLInputElement ||
|
|
340
|
+
event.target instanceof HTMLTextAreaElement ||
|
|
341
|
+
(event.target instanceof HTMLElement && event.target.isContentEditable);
|
|
342
|
+
if (event.key === "Escape") {
|
|
343
|
+
this.#searchPanel.hidden = true;
|
|
344
|
+
this.#closeThumbnails();
|
|
345
|
+
if (this.#fallbackFullscreen)
|
|
346
|
+
this.#setFallbackFullscreen(false);
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (editing)
|
|
350
|
+
return;
|
|
351
|
+
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "f") {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
if (this.#searchPanel.hidden)
|
|
354
|
+
this.#toggleSearch();
|
|
355
|
+
else
|
|
356
|
+
this.#searchInput.focus();
|
|
357
|
+
}
|
|
358
|
+
else if (event.key === "F11") {
|
|
359
|
+
event.preventDefault();
|
|
360
|
+
void this.#toggleFullscreen();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
#showStatus(message, timeout = 0) {
|
|
364
|
+
this.#status.textContent = message;
|
|
365
|
+
this.#status.hidden = false;
|
|
366
|
+
if (timeout > 0)
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
if (this.#status.textContent === message)
|
|
369
|
+
this.#hideStatus();
|
|
370
|
+
}, timeout);
|
|
371
|
+
}
|
|
372
|
+
#hideStatus() {
|
|
373
|
+
this.#status.hidden = true;
|
|
374
|
+
this.#status.textContent = "";
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function formatCellRange(range) {
|
|
378
|
+
return `R${range.startRow}C${range.startColumn}:R${range.endRow}C${range.endColumn}`;
|
|
379
|
+
}
|
|
380
|
+
function group(...children) {
|
|
381
|
+
const element = document.createElement("span");
|
|
382
|
+
element.className = "zrimo-ui__group";
|
|
383
|
+
element.append(...children);
|
|
384
|
+
return element;
|
|
385
|
+
}
|
|
386
|
+
function spacer() {
|
|
387
|
+
const element = document.createElement("span");
|
|
388
|
+
element.className = "zrimo-ui__spacer";
|
|
389
|
+
return element;
|
|
390
|
+
}
|