@file-viewer/core 2.0.10 → 2.1.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/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/config/options.d.ts +1 -1
- package/dist/config/options.js +1 -1
- package/dist/contracts/types.d.ts +71 -1
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +105 -48
- package/dist/platform/assets.d.ts +3 -1
- package/dist/platform/assets.js +18 -2
- package/dist/registry/capabilities.d.ts +2 -2
- package/dist/registry/capabilities.js +2 -1
- package/dist/registry/formats.d.ts +20 -7
- package/dist/registry/formats.js +14 -5
- package/dist/registry/registry.d.ts +8 -1
- package/dist/registry/registry.js +29 -0
- package/dist/renderers/image.js +1 -10
- package/dist/renderers/index.d.ts +320 -2
- package/dist/renderers/index.js +27 -157
- package/dist/viewer/createViewer.js +86 -3
- package/package.json +17 -44
- package/dist/renderers/archive.d.ts +0 -2
- package/dist/renderers/archive.js +0 -547
- package/dist/renderers/archiveCache.d.ts +0 -10
- package/dist/renderers/archiveCache.js +0 -96
- package/dist/renderers/archiveFallback.d.ts +0 -7
- package/dist/renderers/archiveFallback.js +0 -166
- package/dist/renderers/archiveShared.d.ts +0 -23
- package/dist/renderers/archiveShared.js +0 -71
- package/dist/renderers/audio.d.ts +0 -8
- package/dist/renderers/audio.js +0 -219
- package/dist/renderers/cad.d.ts +0 -2
- package/dist/renderers/cad.js +0 -446
- package/dist/renderers/code.d.ts +0 -11
- package/dist/renderers/code.js +0 -233
- package/dist/renderers/data.d.ts +0 -7
- package/dist/renderers/data.js +0 -370
- package/dist/renderers/drawing.d.ts +0 -10
- package/dist/renderers/drawing.js +0 -882
- package/dist/renderers/eda.d.ts +0 -2
- package/dist/renderers/eda.js +0 -434
- package/dist/renderers/edaParser.d.ts +0 -77
- package/dist/renderers/edaParser.js +0 -569
- package/dist/renderers/email.d.ts +0 -2
- package/dist/renderers/email.js +0 -463
- package/dist/renderers/epub.d.ts +0 -2
- package/dist/renderers/epub.js +0 -331
- package/dist/renderers/geo.d.ts +0 -2
- package/dist/renderers/geo.js +0 -284
- package/dist/renderers/markdown.d.ts +0 -2
- package/dist/renderers/markdown.js +0 -83
- package/dist/renderers/model.d.ts +0 -2
- package/dist/renderers/model.js +0 -567
- package/dist/renderers/ofd.d.ts +0 -2
- package/dist/renderers/ofd.js +0 -256
- package/dist/renderers/openDocument.d.ts +0 -2
- package/dist/renderers/openDocument.js +0 -122
- package/dist/renderers/pdf.d.ts +0 -3
- package/dist/renderers/pdf.js +0 -1001
- package/dist/renderers/pdfStyles.d.ts +0 -1
- package/dist/renderers/pdfStyles.js +0 -1
- package/dist/renderers/pptx.d.ts +0 -2
- package/dist/renderers/pptx.js +0 -217
- package/dist/renderers/spreadsheet/state.d.ts +0 -80
- package/dist/renderers/spreadsheet/state.js +0 -96
- package/dist/renderers/spreadsheet/view.d.ts +0 -25
- package/dist/renderers/spreadsheet/view.js +0 -833
- package/dist/renderers/spreadsheet/worker/index.d.ts +0 -2
- package/dist/renderers/spreadsheet/worker/index.js +0 -1
- package/dist/renderers/spreadsheet/worker/sheetjs/SheetJsModel.d.ts +0 -73
- package/dist/renderers/spreadsheet/worker/sheetjs/SheetJsModel.js +0 -623
- package/dist/renderers/spreadsheet/worker/sheetjs/color.d.ts +0 -2
- package/dist/renderers/spreadsheet/worker/sheetjs/color.js +0 -73
- package/dist/renderers/spreadsheet/worker/sheetjs/index.d.ts +0 -1
- package/dist/renderers/spreadsheet/worker/sheetjs/index.js +0 -1
- package/dist/renderers/spreadsheet/worker/sheetjs/parser.d.ts +0 -18
- package/dist/renderers/spreadsheet/worker/sheetjs/parser.js +0 -106
- package/dist/renderers/spreadsheet/worker/sheetjs/sheet.worker.d.ts +0 -1
- package/dist/renderers/spreadsheet/worker/sheetjs/sheet.worker.js +0 -11
- package/dist/renderers/spreadsheet/worker/type.d.ts +0 -57
- package/dist/renderers/spreadsheet/worker/type.js +0 -1
- package/dist/renderers/spreadsheet.d.ts +0 -3
- package/dist/renderers/spreadsheet.js +0 -929
- package/dist/renderers/typst.d.ts +0 -8
- package/dist/renderers/typst.js +0 -547
- package/dist/renderers/umd/parser.d.ts +0 -30
- package/dist/renderers/umd/parser.js +0 -408
- package/dist/renderers/umd.d.ts +0 -2
- package/dist/renderers/umd.js +0 -297
- package/dist/renderers/video.d.ts +0 -8
- package/dist/renderers/video.js +0 -108
- package/dist/renderers/wordDoc.d.ts +0 -5
- package/dist/renderers/wordDoc.js +0 -284
- package/dist/renderers/wordDocx.d.ts +0 -5
- package/dist/renderers/wordDocx.js +0 -985
- package/dist/renderers/wordDocx.worker.d.ts +0 -1
- package/dist/renderers/wordDocx.worker.js +0 -96
- package/vendor/ofd/dltech/jbig2/arithmetic_decoder.js +0 -183
- package/vendor/ofd/dltech/jbig2/ccitt.js +0 -1070
- package/vendor/ofd/dltech/jbig2/compatibility.js +0 -12
- package/vendor/ofd/dltech/jbig2/core_utils.js +0 -180
- package/vendor/ofd/dltech/jbig2/is_node.js +0 -27
- package/vendor/ofd/dltech/jbig2/jbig2.js +0 -2589
- package/vendor/ofd/dltech/jbig2/jbig2_stream.js +0 -81
- package/vendor/ofd/dltech/jbig2/primitives.js +0 -387
- package/vendor/ofd/dltech/jbig2/stream.js +0 -1348
- package/vendor/ofd/dltech/jbig2/util.js +0 -972
- package/vendor/ofd/dltech/ofd/ofd.d.ts +0 -11
- package/vendor/ofd/dltech/ofd/ofd.js +0 -100
- package/vendor/ofd/dltech/ofd/ofd_parser.js +0 -395
- package/vendor/ofd/dltech/ofd/ofd_render.js +0 -473
- package/vendor/ofd/dltech/ofd/ofd_util.js +0 -350
- package/vendor/ofd/dltech/ofd/pipeline.js +0 -26
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* Copyright 2017 Mozilla Foundation
|
|
2
|
-
*
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// The upstream JBig2 decoder ships legacy polyfills through CommonJS require().
|
|
8
|
-
// This project targets modern browsers through Vite, so the compatibility layer is kept
|
|
9
|
-
// intentionally small to avoid pulling core-js into the lazy OFD chunk.
|
|
10
|
-
if (!globalThis._pdfjsCompatibilityChecked) {
|
|
11
|
-
globalThis._pdfjsCompatibilityChecked = true;
|
|
12
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/* Copyright 2019 Mozilla Foundation
|
|
2
|
-
*
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
/* eslint no-var: error */
|
|
16
|
-
|
|
17
|
-
import { assert, BaseException, warn } from "./util.js";
|
|
18
|
-
|
|
19
|
-
function getLookupTableFactory(initializer) {
|
|
20
|
-
let lookup;
|
|
21
|
-
return function () {
|
|
22
|
-
if (initializer) {
|
|
23
|
-
lookup = Object.create(null);
|
|
24
|
-
initializer(lookup);
|
|
25
|
-
initializer = null;
|
|
26
|
-
}
|
|
27
|
-
return lookup;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
class MissingDataException extends BaseException {
|
|
32
|
-
constructor(begin, end) {
|
|
33
|
-
super(`Missing data [${begin}, ${end})`);
|
|
34
|
-
this.begin = begin;
|
|
35
|
-
this.end = end;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class XRefEntryException extends BaseException {}
|
|
40
|
-
|
|
41
|
-
class XRefParseException extends BaseException {}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get the value of an inheritable property.
|
|
45
|
-
*
|
|
46
|
-
* If the PDF specification explicitly lists a property in a dictionary as
|
|
47
|
-
* inheritable, then the value of the property may be present in the dictionary
|
|
48
|
-
* itself or in one or more parents of the dictionary.
|
|
49
|
-
*
|
|
50
|
-
* If the key is not found in the tree, `undefined` is returned. Otherwise,
|
|
51
|
-
* the value for the key is returned or, if `stopWhenFound` is `false`, a list
|
|
52
|
-
* of values is returned. To avoid infinite loops, the traversal is stopped when
|
|
53
|
-
* the loop limit is reached.
|
|
54
|
-
*
|
|
55
|
-
* @param {Dict} dict - Dictionary from where to start the traversal.
|
|
56
|
-
* @param {string} key - The key of the property to find the value for.
|
|
57
|
-
* @param {boolean} getArray - Whether or not the value should be fetched as an
|
|
58
|
-
* array. The default value is `false`.
|
|
59
|
-
* @param {boolean} stopWhenFound - Whether or not to stop the traversal when
|
|
60
|
-
* the key is found. If set to `false`, we always walk up the entire parent
|
|
61
|
-
* chain, for example to be able to find `\Resources` placed on multiple
|
|
62
|
-
* levels of the tree. The default value is `true`.
|
|
63
|
-
*/
|
|
64
|
-
function getInheritableProperty({
|
|
65
|
-
dict,
|
|
66
|
-
key,
|
|
67
|
-
getArray = false,
|
|
68
|
-
stopWhenFound = true,
|
|
69
|
-
}) {
|
|
70
|
-
const LOOP_LIMIT = 100;
|
|
71
|
-
let loopCount = 0;
|
|
72
|
-
let values;
|
|
73
|
-
|
|
74
|
-
while (dict) {
|
|
75
|
-
const value = getArray ? dict.getArray(key) : dict.get(key);
|
|
76
|
-
if (value !== undefined) {
|
|
77
|
-
if (stopWhenFound) {
|
|
78
|
-
return value;
|
|
79
|
-
}
|
|
80
|
-
if (!values) {
|
|
81
|
-
values = [];
|
|
82
|
-
}
|
|
83
|
-
values.push(value);
|
|
84
|
-
}
|
|
85
|
-
if (++loopCount > LOOP_LIMIT) {
|
|
86
|
-
warn(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
dict = dict.get("Parent");
|
|
90
|
-
}
|
|
91
|
-
return values;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// prettier-ignore
|
|
95
|
-
const ROMAN_NUMBER_MAP = [
|
|
96
|
-
"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM",
|
|
97
|
-
"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC",
|
|
98
|
-
"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Converts positive integers to (upper case) Roman numerals.
|
|
103
|
-
* @param {number} number - The number that should be converted.
|
|
104
|
-
* @param {boolean} lowerCase - Indicates if the result should be converted
|
|
105
|
-
* to lower case letters. The default value is `false`.
|
|
106
|
-
* @returns {string} The resulting Roman number.
|
|
107
|
-
*/
|
|
108
|
-
function toRomanNumerals(number, lowerCase = false) {
|
|
109
|
-
assert(
|
|
110
|
-
Number.isInteger(number) && number > 0,
|
|
111
|
-
"The number should be a positive integer."
|
|
112
|
-
);
|
|
113
|
-
const romanBuf = [];
|
|
114
|
-
let pos;
|
|
115
|
-
// Thousands
|
|
116
|
-
while (number >= 1000) {
|
|
117
|
-
number -= 1000;
|
|
118
|
-
romanBuf.push("M");
|
|
119
|
-
}
|
|
120
|
-
// Hundreds
|
|
121
|
-
pos = (number / 100) | 0;
|
|
122
|
-
number %= 100;
|
|
123
|
-
romanBuf.push(ROMAN_NUMBER_MAP[pos]);
|
|
124
|
-
// Tens
|
|
125
|
-
pos = (number / 10) | 0;
|
|
126
|
-
number %= 10;
|
|
127
|
-
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
|
|
128
|
-
// Ones
|
|
129
|
-
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
|
|
130
|
-
|
|
131
|
-
const romanStr = romanBuf.join("");
|
|
132
|
-
return lowerCase ? romanStr.toLowerCase() : romanStr;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Calculate the base 2 logarithm of the number `x`. This differs from the
|
|
136
|
-
// native function in the sense that it returns the ceiling value and that it
|
|
137
|
-
// returns 0 instead of `Infinity`/`NaN` for `x` values smaller than/equal to 0.
|
|
138
|
-
function log2(x) {
|
|
139
|
-
if (x <= 0) {
|
|
140
|
-
return 0;
|
|
141
|
-
}
|
|
142
|
-
return Math.ceil(Math.log2(x));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function readInt8(data, offset) {
|
|
146
|
-
return (data[offset] << 24) >> 24;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function readUint16(data, offset) {
|
|
150
|
-
return (data[offset] << 8) | data[offset + 1];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function readUint32(data, offset) {
|
|
154
|
-
return (
|
|
155
|
-
((data[offset] << 24) |
|
|
156
|
-
(data[offset + 1] << 16) |
|
|
157
|
-
(data[offset + 2] << 8) |
|
|
158
|
-
data[offset + 3]) >>>
|
|
159
|
-
0
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Checks if ch is one of the following characters: SPACE, TAB, CR or LF.
|
|
164
|
-
function isWhiteSpace(ch) {
|
|
165
|
-
return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export {
|
|
169
|
-
getLookupTableFactory,
|
|
170
|
-
MissingDataException,
|
|
171
|
-
XRefEntryException,
|
|
172
|
-
XRefParseException,
|
|
173
|
-
getInheritableProperty,
|
|
174
|
-
toRomanNumerals,
|
|
175
|
-
log2,
|
|
176
|
-
readInt8,
|
|
177
|
-
readUint16,
|
|
178
|
-
readUint32,
|
|
179
|
-
isWhiteSpace,
|
|
180
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* Copyright 2018 Mozilla Foundation
|
|
2
|
-
*
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
/* globals process */
|
|
16
|
-
|
|
17
|
-
// NW.js / Electron is a browser context, but copies some Node.js objects; see
|
|
18
|
-
// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context
|
|
19
|
-
// https://www.electronjs.org/docs/api/process#processversionselectron-readonly
|
|
20
|
-
// https://www.electronjs.org/docs/api/process#processtype-readonly
|
|
21
|
-
const isNodeJS =
|
|
22
|
-
typeof process === "object" &&
|
|
23
|
-
process + "" === "[object process]" &&
|
|
24
|
-
!process.versions.nw &&
|
|
25
|
-
!(process.versions.electron && process.type && process.type !== "browser");
|
|
26
|
-
|
|
27
|
-
export { isNodeJS };
|