@build-qube/papyra-native-wasm32-wasi 0.3.0 → 0.4.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/package.json +2 -2
- package/papyra.wasi-browser.js +5 -0
- package/papyra.wasi.cjs +6 -1
- package/papyra.wasi.d.cts +177 -0
- package/papyra.wasm32-wasi.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@build-qube/papyra-native-wasm32-wasi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "papyra.wasi.cjs",
|
|
5
5
|
"files": [
|
|
6
6
|
"papyra.wasm32-wasi.wasm",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"browser": "papyra.wasi-browser.js",
|
|
37
37
|
"type": "module",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@napi-rs/wasm-runtime": "~1.2.
|
|
39
|
+
"@napi-rs/wasm-runtime": "~1.2.5",
|
|
40
40
|
"@emnapi/core": "2.0.0-alpha.4",
|
|
41
41
|
"@emnapi/runtime": "2.0.0-alpha.4"
|
|
42
42
|
}
|
package/papyra.wasi-browser.js
CHANGED
|
@@ -603,10 +603,15 @@ try {
|
|
|
603
603
|
export default __napiModule.exports
|
|
604
604
|
export const PageImage = __napiModule.exports.PageImage
|
|
605
605
|
export const PdfDocument = __napiModule.exports.PdfDocument
|
|
606
|
+
export const Sheet = __napiModule.exports.Sheet
|
|
607
|
+
export const TiffImage = __napiModule.exports.TiffImage
|
|
608
|
+
export const Workbook = __napiModule.exports.Workbook
|
|
606
609
|
export const backendName = __napiModule.exports.backendName
|
|
607
610
|
export const configureThreadPool = __napiModule.exports.configureThreadPool
|
|
608
611
|
export const encodeBitmap = __napiModule.exports.encodeBitmap
|
|
609
612
|
export const encodeBitmapSync = __napiModule.exports.encodeBitmapSync
|
|
610
613
|
export const ImageFormat = __napiModule.exports.ImageFormat
|
|
614
|
+
export const loadTiff = __napiModule.exports.loadTiff
|
|
615
|
+
export const loadWorkbook = __napiModule.exports.loadWorkbook
|
|
611
616
|
export const reserveMemory = __napiModule.exports.reserveMemory
|
|
612
617
|
export const runtime = __napiModule.exports.runtime
|
package/papyra.wasi.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["PageImage","PdfDocument","backendName","configureThreadPool","encodeBitmap","encodeBitmapSync","ImageFormat","reserveMemory","runtime"],"managedRootEntries":["browser.js","index.js","papyra.wasm","papyra.debug.wasm"]}
|
|
1
|
+
// napi-rs-artifact-metadata:{"version":2,"rootEntry":"index.js","exports":["PageImage","PdfDocument","Sheet","TiffImage","Workbook","backendName","configureThreadPool","encodeBitmap","encodeBitmapSync","ImageFormat","loadTiff","loadWorkbook","reserveMemory","runtime"],"managedRootEntries":["browser.js","index.js","papyra.wasm","papyra.debug.wasm"]}
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/* prettier-ignore */
|
|
4
4
|
|
|
@@ -923,10 +923,15 @@ try {
|
|
|
923
923
|
module.exports = __napiModule.exports
|
|
924
924
|
module.exports.PageImage = __napiModule.exports.PageImage
|
|
925
925
|
module.exports.PdfDocument = __napiModule.exports.PdfDocument
|
|
926
|
+
module.exports.Sheet = __napiModule.exports.Sheet
|
|
927
|
+
module.exports.TiffImage = __napiModule.exports.TiffImage
|
|
928
|
+
module.exports.Workbook = __napiModule.exports.Workbook
|
|
926
929
|
module.exports.backendName = __napiModule.exports.backendName
|
|
927
930
|
module.exports.configureThreadPool = __napiModule.exports.configureThreadPool
|
|
928
931
|
module.exports.encodeBitmap = __napiModule.exports.encodeBitmap
|
|
929
932
|
module.exports.encodeBitmapSync = __napiModule.exports.encodeBitmapSync
|
|
930
933
|
module.exports.ImageFormat = __napiModule.exports.ImageFormat
|
|
934
|
+
module.exports.loadTiff = __napiModule.exports.loadTiff
|
|
935
|
+
module.exports.loadWorkbook = __napiModule.exports.loadWorkbook
|
|
931
936
|
module.exports.reserveMemory = __napiModule.exports.reserveMemory
|
|
932
937
|
module.exports.runtime = __napiModule.exports.runtime
|
package/papyra.wasi.d.cts
CHANGED
|
@@ -98,6 +98,55 @@ export declare class PdfDocument {
|
|
|
98
98
|
renderPagesAsync(start: number, end: number, dpi?: number | undefined | null, annotations?: boolean | undefined | null): Promise<Array<RenderedPage>>
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
export declare class Sheet {
|
|
102
|
+
get name(): string
|
|
103
|
+
/** The sheet held more cells than `maxCells`, and this is its first whole rows. */
|
|
104
|
+
get truncated(): boolean
|
|
105
|
+
/** One past the last used row, counting from the sheet's first row. */
|
|
106
|
+
get rows(): number
|
|
107
|
+
/** One past the last used column, counting from column A. */
|
|
108
|
+
get cols(): number
|
|
109
|
+
/**
|
|
110
|
+
* Merged regions as flat quads — `rowStart, colStart, rowEnd, colEnd`, inclusive —
|
|
111
|
+
* so a sheet with thousands of them is one allocation, not thousands of objects.
|
|
112
|
+
*/
|
|
113
|
+
get merges(): Uint32Array
|
|
114
|
+
/** The styles `CellWindow.styles` indexes. Empty for every format but xlsx. */
|
|
115
|
+
get styles(): Array<CellStyle>
|
|
116
|
+
/** Widths and heights as the author set them. Absent for every format but xlsx. */
|
|
117
|
+
get layout(): SheetLayout | null
|
|
118
|
+
/**
|
|
119
|
+
* `[rowStart, rowEnd) x [colStart, colEnd)`, clamped to the sheet.
|
|
120
|
+
*
|
|
121
|
+
* Synchronous: the sheet is already parsed, and a window is as large as the
|
|
122
|
+
* caller asks for — a screenful is a few thousand cells and well under a
|
|
123
|
+
* millisecond. Ask for a screenful.
|
|
124
|
+
*/
|
|
125
|
+
window(rowStart: number, rowEnd: number, colStart: number, colEnd: number): CellWindow
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare class TiffImage {
|
|
129
|
+
/** Every page in directory order, reduced-resolution copies left out. */
|
|
130
|
+
get pages(): Array<TiffPageInfo>
|
|
131
|
+
/** Decode one page to RGBA at no more than the given size, off the JS thread. */
|
|
132
|
+
renderPage(index: number, options?: TiffRenderOptions | undefined | null): Promise<RenderedPage>
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export declare class Workbook {
|
|
136
|
+
/**
|
|
137
|
+
* The container actually read: `"xlsx"`, `"xlsb"`, `"xls"`, `"ods"`, `"csv"` or
|
|
138
|
+
* `"tsv"`. A macro-enabled workbook reads as `"xlsx"`.
|
|
139
|
+
*/
|
|
140
|
+
get format(): string
|
|
141
|
+
get sheets(): Array<SheetInfo>
|
|
142
|
+
/** CSV and TSV only: the encoding the text was decoded from, e.g. `"windows-1252"`. */
|
|
143
|
+
get encoding(): string | null
|
|
144
|
+
/** CSV and TSV only: the delimiter, given or sniffed. */
|
|
145
|
+
get delimiter(): string | null
|
|
146
|
+
/** Read one sheet's cells, off the JS thread. A sheet is read once and kept. */
|
|
147
|
+
sheet(index: number): Promise<Sheet>
|
|
148
|
+
}
|
|
149
|
+
|
|
101
150
|
/**
|
|
102
151
|
* One file embedded in the document. Metadata only; the bytes come from
|
|
103
152
|
* `attachmentData`.
|
|
@@ -126,6 +175,67 @@ export interface Attachment {
|
|
|
126
175
|
/** Name of the rendering backend, currently always `"hayro"`. */
|
|
127
176
|
export declare function backendName(): string
|
|
128
177
|
|
|
178
|
+
/** One edge of a cell border. */
|
|
179
|
+
export interface BorderEdge {
|
|
180
|
+
/** `"thin"`, `"medium"`, `"thick"`, `"dashed"`, `"dotted"`, `"double"` or `"hair"`. */
|
|
181
|
+
style: string
|
|
182
|
+
/** `0xRRGGBB`; absent for automatic. */
|
|
183
|
+
color?: number
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** How a cell looks. Shared by index: cells name a style, they do not carry one. */
|
|
187
|
+
export interface CellStyle {
|
|
188
|
+
bold: boolean
|
|
189
|
+
italic: boolean
|
|
190
|
+
underline: boolean
|
|
191
|
+
strike: boolean
|
|
192
|
+
/** Font size relative to the workbook's default font. */
|
|
193
|
+
fontScale: number
|
|
194
|
+
/** `0xRRGGBB`; absent for automatic. */
|
|
195
|
+
color?: number
|
|
196
|
+
/** `0xRRGGBB` background; absent for none. */
|
|
197
|
+
fill?: number
|
|
198
|
+
borderTop?: BorderEdge
|
|
199
|
+
borderRight?: BorderEdge
|
|
200
|
+
borderBottom?: BorderEdge
|
|
201
|
+
borderLeft?: BorderEdge
|
|
202
|
+
/**
|
|
203
|
+
* `"left"`, `"center"`, `"right"`, `"justify"`, `"centerContinuous"`, `"fill"` or
|
|
204
|
+
* `"distributed"`. Absent means text left, numbers right.
|
|
205
|
+
*/
|
|
206
|
+
horizontal?: string
|
|
207
|
+
/** `"top"`, `"center"`, `"bottom"`, `"justify"` or `"distributed"`. Absent means bottom. */
|
|
208
|
+
vertical?: string
|
|
209
|
+
wrap: boolean
|
|
210
|
+
indent: number
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** A rectangle of cells, packed. See `Window` in `papyra-tables`. */
|
|
214
|
+
export interface CellWindow {
|
|
215
|
+
rowStart: number
|
|
216
|
+
colStart: number
|
|
217
|
+
rows: number
|
|
218
|
+
cols: number
|
|
219
|
+
/**
|
|
220
|
+
* One kind tag per cell, row-major: 0 empty, 1 number, 2 text, 3 bool, 4 date,
|
|
221
|
+
* 5 duration, 6 error.
|
|
222
|
+
*/
|
|
223
|
+
kinds: Uint8Array
|
|
224
|
+
/**
|
|
225
|
+
* One number per cell: the value, a bool as 0/1, a date's serial, a duration in
|
|
226
|
+
* days. NaN when there is none.
|
|
227
|
+
*/
|
|
228
|
+
numbers: Float64Array
|
|
229
|
+
/** Every cell's display text, concatenated. */
|
|
230
|
+
text: string
|
|
231
|
+
/** UTF-16 offsets into `text`, one more than there are cells. */
|
|
232
|
+
offsets: Uint32Array
|
|
233
|
+
/** One index into `Sheet.styles` per cell. 0 is the default style. */
|
|
234
|
+
styles: Uint16Array
|
|
235
|
+
/** The colour a number format chose per cell, as `0x01RRGGBB`; 0 for none. */
|
|
236
|
+
colors: Uint32Array
|
|
237
|
+
}
|
|
238
|
+
|
|
129
239
|
/**
|
|
130
240
|
* Size the rayon pool used by `renderPagesAsync`.
|
|
131
241
|
*
|
|
@@ -169,6 +279,12 @@ export declare const enum ImageFormat {
|
|
|
169
279
|
Jpeg = 'jpeg'
|
|
170
280
|
}
|
|
171
281
|
|
|
282
|
+
/** Open a TIFF and list its pages, off the JS thread. */
|
|
283
|
+
export declare function loadTiff(data: Uint8Array): Promise<TiffImage>
|
|
284
|
+
|
|
285
|
+
/** Open a spreadsheet or delimited text file. */
|
|
286
|
+
export declare function loadWorkbook(data: Uint8Array, options?: WorkbookOptions | undefined | null): Promise<Workbook>
|
|
287
|
+
|
|
172
288
|
/**
|
|
173
289
|
* The outline walk, off the JS thread.
|
|
174
290
|
*
|
|
@@ -278,6 +394,26 @@ export declare function reserveMemory(megabytes: number): number
|
|
|
278
394
|
/** `"native"` or `"wasm"`. The wrapper uses this to pick a concurrency strategy. */
|
|
279
395
|
export declare function runtime(): string
|
|
280
396
|
|
|
397
|
+
/** A sheet's entry in the workbook. */
|
|
398
|
+
export interface SheetInfo {
|
|
399
|
+
name: string
|
|
400
|
+
/** `"worksheet"`, `"chartsheet"`, `"dialog"`, `"macro"` or `"vba"`. */
|
|
401
|
+
kind: string
|
|
402
|
+
/** `"visible"`, `"hidden"` or `"veryHidden"`. */
|
|
403
|
+
visibility: string
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Column widths and row heights in pixels, as Excel lays the sheet out. */
|
|
407
|
+
export interface SheetLayout {
|
|
408
|
+
defaultColWidth: number
|
|
409
|
+
defaultRowHeight: number
|
|
410
|
+
/** Inclusive column spans as flat triples: `first, last, width`. Width 0 is hidden. */
|
|
411
|
+
cols: Float64Array
|
|
412
|
+
/** Rows with their own height as flat pairs: `row, height`. Height 0 is hidden. */
|
|
413
|
+
rows: Float64Array
|
|
414
|
+
showGridLines: boolean
|
|
415
|
+
}
|
|
416
|
+
|
|
281
417
|
/** One structure-tree element. Flat and in pre-order; `level` carries the tree. */
|
|
282
418
|
export interface StructEntry {
|
|
283
419
|
/** Standard structure type, after `/RoleMap`: `"H1"`, `"P"`, `"Table"`, `"TD"`, … */
|
|
@@ -329,3 +465,44 @@ export interface TextLine {
|
|
|
329
465
|
*/
|
|
330
466
|
mcid?: number
|
|
331
467
|
}
|
|
468
|
+
|
|
469
|
+
/** One page of a TIFF, as shown: `Orientation` already applied. */
|
|
470
|
+
export interface TiffPageInfo {
|
|
471
|
+
width: number
|
|
472
|
+
height: number
|
|
473
|
+
/** Horizontal resolution in dots per inch, when the file states one. */
|
|
474
|
+
xDpi?: number
|
|
475
|
+
/** Vertical resolution in dots per inch, when the file states one. */
|
|
476
|
+
yDpi?: number
|
|
477
|
+
/**
|
|
478
|
+
* `"none"`, `"ccitt-rle"`, `"ccitt-g3"`, `"ccitt-g4"`, `"lzw"`, `"old-jpeg"`,
|
|
479
|
+
* `"jpeg"`, `"deflate"`, `"packbits"` or `"other"`.
|
|
480
|
+
*/
|
|
481
|
+
compression: string
|
|
482
|
+
bitsPerSample: number
|
|
483
|
+
samplesPerPixel: number
|
|
484
|
+
/** TIFF `Orientation`, 1–8. */
|
|
485
|
+
orientation: number
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** Output limits for a page decode. Both optional; the page is never enlarged. */
|
|
489
|
+
export interface TiffRenderOptions {
|
|
490
|
+
/** Defaults to 4096 x 4096. A float on the JS side, so read as one. */
|
|
491
|
+
maxPixels?: number
|
|
492
|
+
maxWidth?: number
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** How to read the bytes. Every field is optional and sniffed when absent. */
|
|
496
|
+
export interface WorkbookOptions {
|
|
497
|
+
/**
|
|
498
|
+
* `"xlsx"`, `"xlsm"`, `"xlsb"`, `"xls"`, `"ods"`, `"csv"` or `"tsv"`. Only needed
|
|
499
|
+
* to call a file TSV, or to skip sniffing.
|
|
500
|
+
*/
|
|
501
|
+
format?: string
|
|
502
|
+
/** CSV and TSV only: a single ASCII character. */
|
|
503
|
+
delimiter?: string
|
|
504
|
+
/** CSV and TSV only: a WHATWG encoding label such as `"windows-1252"`. */
|
|
505
|
+
encoding?: string
|
|
506
|
+
/** Cells held per sheet before it is truncated to its first whole rows. */
|
|
507
|
+
maxCells?: number
|
|
508
|
+
}
|
package/papyra.wasm32-wasi.wasm
CHANGED
|
Binary file
|