takumi-pdf 0.14.2 → 0.14.3
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/dist/export.cjs +91 -136
- package/dist/export.d.cts +13 -10
- package/dist/export.d.mts +13 -10
- package/dist/export.mjs +91 -136
- package/package.json +2 -2
- package/pkg/takumi_pdf_wasm_bg.wasm +0 -0
- package/pkg/takumi_pdf_wasm_bg.wasm.d.ts +13 -10
package/dist/export.cjs
CHANGED
|
@@ -35,33 +35,19 @@ var PdfRenderer$1 = class {
|
|
|
35
35
|
* @returns {MeasuredSize}
|
|
36
36
|
*/
|
|
37
37
|
measure(node, options) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
42
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
43
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
44
|
-
return takeObject(r0);
|
|
45
|
-
} finally {
|
|
46
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
47
|
-
}
|
|
38
|
+
const ret = wasm.pdfrenderer_measure(this.__wbg_ptr, node, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
39
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
40
|
+
return takeFromExternrefTable0(ret[0]);
|
|
48
41
|
}
|
|
49
42
|
/**
|
|
50
43
|
* Creates a renderer with the bundled last-resort fonts.
|
|
51
44
|
*/
|
|
52
45
|
constructor() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
59
|
-
this.__wbg_ptr = r0;
|
|
60
|
-
PdfRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
61
|
-
return this;
|
|
62
|
-
} finally {
|
|
63
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
64
|
-
}
|
|
46
|
+
const ret = wasm.pdfrenderer_new();
|
|
47
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
48
|
+
this.__wbg_ptr = ret[0];
|
|
49
|
+
PdfRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
50
|
+
return this;
|
|
65
51
|
}
|
|
66
52
|
/**
|
|
67
53
|
* Registers a font (raw bytes or a details object), returning the families
|
|
@@ -70,16 +56,9 @@ var PdfRenderer$1 = class {
|
|
|
70
56
|
* @returns {RegisteredFamily[]}
|
|
71
57
|
*/
|
|
72
58
|
registerFont(font) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
77
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
78
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
79
|
-
return takeObject(r0);
|
|
80
|
-
} finally {
|
|
81
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
82
|
-
}
|
|
59
|
+
const ret = wasm.pdfrenderer_registerFont(this.__wbg_ptr, font);
|
|
60
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
61
|
+
return takeFromExternrefTable0(ret[0]);
|
|
83
62
|
}
|
|
84
63
|
/**
|
|
85
64
|
* Renders a node tree to PDF bytes. Without options the output is paged A4;
|
|
@@ -89,19 +68,11 @@ var PdfRenderer$1 = class {
|
|
|
89
68
|
* @returns {Uint8Array<ArrayBuffer>}
|
|
90
69
|
*/
|
|
91
70
|
render(node, options) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 8, true);
|
|
98
|
-
if (getDataViewMemory0().getInt32(retptr + 12, true)) throw takeObject(r2);
|
|
99
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
100
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
101
|
-
return v1;
|
|
102
|
-
} finally {
|
|
103
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
104
|
-
}
|
|
71
|
+
const ret = wasm.pdfrenderer_render(this.__wbg_ptr, node, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
72
|
+
if (ret[3]) throw takeFromExternrefTable0(ret[2]);
|
|
73
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
74
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
75
|
+
return v1;
|
|
105
76
|
}
|
|
106
77
|
};
|
|
107
78
|
if (Symbol.dispose) PdfRenderer$1.prototype[Symbol.dispose] = PdfRenderer$1.prototype.free;
|
|
@@ -117,18 +88,14 @@ function counterCharacters(classes) {
|
|
|
117
88
|
let deferred2_0;
|
|
118
89
|
let deferred2_1;
|
|
119
90
|
try {
|
|
120
|
-
const
|
|
121
|
-
const ptr0 = passArrayJsValueToWasm0(classes, wasm.__wbindgen_export);
|
|
91
|
+
const ptr0 = passArrayJsValueToWasm0(classes, wasm.__wbindgen_malloc);
|
|
122
92
|
const len0 = WASM_VECTOR_LEN;
|
|
123
|
-
wasm.counterCharacters(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
deferred2_1 = r1;
|
|
128
|
-
return getStringFromWasm0(r0, r1);
|
|
93
|
+
const ret = wasm.counterCharacters(ptr0, len0);
|
|
94
|
+
deferred2_0 = ret[0];
|
|
95
|
+
deferred2_1 = ret[1];
|
|
96
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
129
97
|
} finally {
|
|
130
|
-
wasm.
|
|
131
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
98
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
132
99
|
}
|
|
133
100
|
}
|
|
134
101
|
function __wbg_get_imports() {
|
|
@@ -137,69 +104,69 @@ function __wbg_get_imports() {
|
|
|
137
104
|
"./takumi_pdf_wasm_bg.js": {
|
|
138
105
|
__proto__: null,
|
|
139
106
|
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
140
|
-
return
|
|
107
|
+
return Error(getStringFromWasm0(arg0, arg1));
|
|
141
108
|
},
|
|
142
109
|
__wbg_Number_3890faa6d3ff057d: function(arg0) {
|
|
143
|
-
return Number(
|
|
110
|
+
return Number(arg0);
|
|
144
111
|
},
|
|
145
112
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
146
|
-
const ptr1 = passStringToWasm0(String(
|
|
113
|
+
const ptr1 = passStringToWasm0(String(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
114
|
const len1 = WASM_VECTOR_LEN;
|
|
148
115
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
149
116
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
150
117
|
},
|
|
151
118
|
__wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
|
|
152
|
-
const v =
|
|
119
|
+
const v = arg1;
|
|
153
120
|
const ret = typeof v === "bigint" ? v : void 0;
|
|
154
121
|
getDataViewMemory0().setBigInt64(arg0 + 8, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
155
122
|
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
156
123
|
},
|
|
157
124
|
__wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
|
|
158
|
-
const v =
|
|
125
|
+
const v = arg0;
|
|
159
126
|
const ret = typeof v === "boolean" ? v : void 0;
|
|
160
127
|
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
161
128
|
},
|
|
162
129
|
__wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
|
|
163
|
-
const ptr1 = passStringToWasm0(debugString(
|
|
130
|
+
const ptr1 = passStringToWasm0(debugString(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
164
131
|
const len1 = WASM_VECTOR_LEN;
|
|
165
132
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
166
133
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
167
134
|
},
|
|
168
135
|
__wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
|
|
169
|
-
return
|
|
136
|
+
return arg0 in arg1;
|
|
170
137
|
},
|
|
171
138
|
__wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
|
|
172
|
-
return typeof
|
|
139
|
+
return typeof arg0 === "bigint";
|
|
173
140
|
},
|
|
174
141
|
__wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
|
|
175
|
-
return typeof
|
|
142
|
+
return typeof arg0 === "function";
|
|
176
143
|
},
|
|
177
144
|
__wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
|
|
178
|
-
const val =
|
|
145
|
+
const val = arg0;
|
|
179
146
|
return typeof val === "object" && val !== null;
|
|
180
147
|
},
|
|
181
148
|
__wbg___wbindgen_is_string_e6f02f0ea5f20a32: function(arg0) {
|
|
182
|
-
return typeof
|
|
149
|
+
return typeof arg0 === "string";
|
|
183
150
|
},
|
|
184
151
|
__wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
|
|
185
|
-
return
|
|
152
|
+
return arg0 === void 0;
|
|
186
153
|
},
|
|
187
154
|
__wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
|
|
188
|
-
return
|
|
155
|
+
return arg0 === arg1;
|
|
189
156
|
},
|
|
190
157
|
__wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
|
|
191
|
-
return
|
|
158
|
+
return arg0 == arg1;
|
|
192
159
|
},
|
|
193
160
|
__wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
|
|
194
|
-
const obj =
|
|
161
|
+
const obj = arg1;
|
|
195
162
|
const ret = typeof obj === "number" ? obj : void 0;
|
|
196
163
|
getDataViewMemory0().setFloat64(arg0 + 8, isLikeNone(ret) ? 0 : ret, true);
|
|
197
164
|
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
198
165
|
},
|
|
199
166
|
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
200
|
-
const obj =
|
|
167
|
+
const obj = arg1;
|
|
201
168
|
const ret = typeof obj === "string" ? obj : void 0;
|
|
202
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.
|
|
169
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
203
170
|
var len1 = WASM_VECTOR_LEN;
|
|
204
171
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
205
172
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
@@ -209,36 +176,33 @@ function __wbg_get_imports() {
|
|
|
209
176
|
},
|
|
210
177
|
__wbg_call_1c5886ab9c57d1c7: function() {
|
|
211
178
|
return handleError(function(arg0, arg1) {
|
|
212
|
-
return
|
|
179
|
+
return arg0.call(arg1);
|
|
213
180
|
}, arguments);
|
|
214
181
|
},
|
|
215
182
|
__wbg_done_669171204c3dcae2: function(arg0) {
|
|
216
|
-
return
|
|
183
|
+
return arg0.done;
|
|
217
184
|
},
|
|
218
185
|
__wbg_entries_7774d489e1da5f4f: function(arg0) {
|
|
219
|
-
return
|
|
186
|
+
return Object.entries(arg0);
|
|
220
187
|
},
|
|
221
188
|
__wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
|
|
222
|
-
|
|
223
|
-
return addHeapObject(ret);
|
|
189
|
+
return arg0[arg1 >>> 0];
|
|
224
190
|
},
|
|
225
191
|
__wbg_get_d173c0308df22d37: function() {
|
|
226
192
|
return handleError(function(arg0, arg1) {
|
|
227
|
-
return
|
|
193
|
+
return Reflect.get(arg0, arg1);
|
|
228
194
|
}, arguments);
|
|
229
195
|
},
|
|
230
196
|
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
231
|
-
|
|
232
|
-
return addHeapObject(ret);
|
|
197
|
+
return arg0[arg1 >>> 0];
|
|
233
198
|
},
|
|
234
199
|
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
235
|
-
|
|
236
|
-
return addHeapObject(ret);
|
|
200
|
+
return arg0[arg1];
|
|
237
201
|
},
|
|
238
202
|
__wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
|
|
239
203
|
let result;
|
|
240
204
|
try {
|
|
241
|
-
result =
|
|
205
|
+
result = arg0 instanceof ArrayBuffer;
|
|
242
206
|
} catch (_) {
|
|
243
207
|
result = false;
|
|
244
208
|
}
|
|
@@ -247,7 +211,7 @@ function __wbg_get_imports() {
|
|
|
247
211
|
__wbg_instanceof_Map_9a4d6ead180ae3a9: function(arg0) {
|
|
248
212
|
let result;
|
|
249
213
|
try {
|
|
250
|
-
result =
|
|
214
|
+
result = arg0 instanceof Map;
|
|
251
215
|
} catch (_) {
|
|
252
216
|
result = false;
|
|
253
217
|
}
|
|
@@ -256,79 +220,79 @@ function __wbg_get_imports() {
|
|
|
256
220
|
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
257
221
|
let result;
|
|
258
222
|
try {
|
|
259
|
-
result =
|
|
223
|
+
result = arg0 instanceof Uint8Array;
|
|
260
224
|
} catch (_) {
|
|
261
225
|
result = false;
|
|
262
226
|
}
|
|
263
227
|
return result;
|
|
264
228
|
},
|
|
265
229
|
__wbg_isArray_6339f732981044bf: function(arg0) {
|
|
266
|
-
return Array.isArray(
|
|
230
|
+
return Array.isArray(arg0);
|
|
267
231
|
},
|
|
268
232
|
__wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
|
|
269
|
-
return Number.isSafeInteger(
|
|
233
|
+
return Number.isSafeInteger(arg0);
|
|
270
234
|
},
|
|
271
235
|
__wbg_iterator_5cebbb86e33c6dd6: function() {
|
|
272
|
-
|
|
273
|
-
return addHeapObject(ret);
|
|
236
|
+
return Symbol.iterator;
|
|
274
237
|
},
|
|
275
238
|
__wbg_length_36bd29c6848c2144: function(arg0) {
|
|
276
|
-
return
|
|
239
|
+
return arg0.length;
|
|
277
240
|
},
|
|
278
241
|
__wbg_length_ecfa2c63d3d0d82c: function(arg0) {
|
|
279
|
-
return
|
|
242
|
+
return arg0.length;
|
|
280
243
|
},
|
|
281
244
|
__wbg_new_116be93542d39019: function() {
|
|
282
|
-
return
|
|
245
|
+
return new Array();
|
|
283
246
|
},
|
|
284
247
|
__wbg_new_358857d90afd5a2d: function(arg0, arg1) {
|
|
285
|
-
return
|
|
248
|
+
return new Error(getStringFromWasm0(arg0, arg1));
|
|
286
249
|
},
|
|
287
250
|
__wbg_new_77cc4f4f472aeb81: function(arg0) {
|
|
288
|
-
return
|
|
251
|
+
return new Uint8Array(arg0);
|
|
289
252
|
},
|
|
290
253
|
__wbg_new_ebe3e0f6837f0879: function() {
|
|
291
|
-
return
|
|
254
|
+
return /* @__PURE__ */ new Object();
|
|
292
255
|
},
|
|
293
256
|
__wbg_next_42cf16ee0dafc9e2: function() {
|
|
294
257
|
return handleError(function(arg0) {
|
|
295
|
-
return
|
|
258
|
+
return arg0.next();
|
|
296
259
|
}, arguments);
|
|
297
260
|
},
|
|
298
261
|
__wbg_next_8f26b64fa5e9f64b: function(arg0) {
|
|
299
|
-
|
|
300
|
-
return addHeapObject(ret);
|
|
262
|
+
return arg0.next;
|
|
301
263
|
},
|
|
302
264
|
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
303
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1),
|
|
265
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
304
266
|
},
|
|
305
267
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
306
|
-
|
|
268
|
+
arg0[arg1] = arg2;
|
|
307
269
|
},
|
|
308
270
|
__wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
|
|
309
|
-
|
|
271
|
+
arg0[arg1 >>> 0] = arg2;
|
|
310
272
|
},
|
|
311
273
|
__wbg_value_1e2369fab29b420e: function(arg0) {
|
|
312
|
-
|
|
313
|
-
return addHeapObject(ret);
|
|
274
|
+
return arg0.value;
|
|
314
275
|
},
|
|
315
276
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
316
|
-
return
|
|
277
|
+
return arg0;
|
|
317
278
|
},
|
|
318
279
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
319
|
-
return
|
|
280
|
+
return arg0;
|
|
320
281
|
},
|
|
321
282
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
322
|
-
return
|
|
283
|
+
return getStringFromWasm0(arg0, arg1);
|
|
323
284
|
},
|
|
324
285
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
325
|
-
return
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
286
|
+
return BigInt.asUintN(64, arg0);
|
|
287
|
+
},
|
|
288
|
+
__wbindgen_init_externref_table: function() {
|
|
289
|
+
const table = wasm.__wbindgen_externrefs;
|
|
290
|
+
const offset = table.grow(4);
|
|
291
|
+
table.set(0, void 0);
|
|
292
|
+
table.set(offset + 0, void 0);
|
|
293
|
+
table.set(offset + 1, null);
|
|
294
|
+
table.set(offset + 2, true);
|
|
295
|
+
table.set(offset + 3, false);
|
|
332
296
|
}
|
|
333
297
|
}
|
|
334
298
|
};
|
|
@@ -337,11 +301,9 @@ const PdfRendererFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
|
337
301
|
register: () => {},
|
|
338
302
|
unregister: () => {}
|
|
339
303
|
} : new FinalizationRegistry((ptr) => wasm.__wbg_pdfrenderer_free(ptr, 1));
|
|
340
|
-
function
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
heap_next = heap[idx];
|
|
344
|
-
heap[idx] = obj;
|
|
304
|
+
function addToExternrefTable0(obj) {
|
|
305
|
+
const idx = wasm.__externref_table_alloc();
|
|
306
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
345
307
|
return idx;
|
|
346
308
|
}
|
|
347
309
|
function debugString(val) {
|
|
@@ -378,11 +340,6 @@ function debugString(val) {
|
|
|
378
340
|
if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
|
|
379
341
|
return className;
|
|
380
342
|
}
|
|
381
|
-
function dropObject(idx) {
|
|
382
|
-
if (idx < 1028) return;
|
|
383
|
-
heap[idx] = heap_next;
|
|
384
|
-
heap_next = idx;
|
|
385
|
-
}
|
|
386
343
|
function getArrayU8FromWasm0(ptr, len) {
|
|
387
344
|
ptr = ptr >>> 0;
|
|
388
345
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -400,26 +357,23 @@ function getUint8ArrayMemory0() {
|
|
|
400
357
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
401
358
|
return cachedUint8ArrayMemory0;
|
|
402
359
|
}
|
|
403
|
-
function getObject(idx) {
|
|
404
|
-
return heap[idx];
|
|
405
|
-
}
|
|
406
360
|
function handleError(f, args) {
|
|
407
361
|
try {
|
|
408
362
|
return f.apply(this, args);
|
|
409
363
|
} catch (e) {
|
|
410
|
-
|
|
364
|
+
const idx = addToExternrefTable0(e);
|
|
365
|
+
wasm.__wbindgen_exn_store(idx);
|
|
411
366
|
}
|
|
412
367
|
}
|
|
413
|
-
let heap = new Array(1024).fill(void 0);
|
|
414
|
-
heap.push(void 0, null, true, false);
|
|
415
|
-
let heap_next = heap.length;
|
|
416
368
|
function isLikeNone(x) {
|
|
417
369
|
return x === void 0 || x === null;
|
|
418
370
|
}
|
|
419
371
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
420
372
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
421
|
-
|
|
422
|
-
|
|
373
|
+
for (let i = 0; i < array.length; i++) {
|
|
374
|
+
const add = addToExternrefTable0(array[i]);
|
|
375
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
376
|
+
}
|
|
423
377
|
WASM_VECTOR_LEN = array.length;
|
|
424
378
|
return ptr;
|
|
425
379
|
}
|
|
@@ -451,10 +405,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
451
405
|
WASM_VECTOR_LEN = offset;
|
|
452
406
|
return ptr;
|
|
453
407
|
}
|
|
454
|
-
function
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
return
|
|
408
|
+
function takeFromExternrefTable0(idx) {
|
|
409
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
410
|
+
wasm.__externref_table_dealloc(idx);
|
|
411
|
+
return value;
|
|
458
412
|
}
|
|
459
413
|
let cachedTextDecoder = new TextDecoder("utf-8", {
|
|
460
414
|
ignoreBOM: true,
|
|
@@ -490,6 +444,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
490
444
|
wasm = instance.exports;
|
|
491
445
|
cachedDataViewMemory0 = null;
|
|
492
446
|
cachedUint8ArrayMemory0 = null;
|
|
447
|
+
wasm.__wbindgen_start();
|
|
493
448
|
return wasm;
|
|
494
449
|
}
|
|
495
450
|
async function __wbg_load(module, imports) {
|
package/dist/export.d.cts
CHANGED
|
@@ -7,16 +7,19 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
7
7
|
interface InitOutput {
|
|
8
8
|
readonly memory: WebAssembly.Memory;
|
|
9
9
|
readonly __wbg_pdfrenderer_free: (a: number, b: number) => void;
|
|
10
|
-
readonly counterCharacters: (a: number, b: number
|
|
11
|
-
readonly pdfrenderer_measure: (a: number, b:
|
|
12
|
-
readonly pdfrenderer_new: (
|
|
13
|
-
readonly pdfrenderer_registerFont: (a: number, b: number,
|
|
14
|
-
readonly pdfrenderer_render: (a: number, b:
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
10
|
+
readonly counterCharacters: (a: number, b: number) => [number, number];
|
|
11
|
+
readonly pdfrenderer_measure: (a: number, b: any, c: number) => [number, number, number];
|
|
12
|
+
readonly pdfrenderer_new: () => [number, number, number];
|
|
13
|
+
readonly pdfrenderer_registerFont: (a: number, b: any) => [number, number, number];
|
|
14
|
+
readonly pdfrenderer_render: (a: number, b: any, c: number) => [number, number, number, number];
|
|
15
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
18
|
+
readonly __externref_table_alloc: () => number;
|
|
19
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
20
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
21
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
22
|
+
readonly __wbindgen_start: () => void;
|
|
20
23
|
}
|
|
21
24
|
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
22
25
|
/**
|
package/dist/export.d.mts
CHANGED
|
@@ -7,16 +7,19 @@ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Modul
|
|
|
7
7
|
interface InitOutput {
|
|
8
8
|
readonly memory: WebAssembly.Memory;
|
|
9
9
|
readonly __wbg_pdfrenderer_free: (a: number, b: number) => void;
|
|
10
|
-
readonly counterCharacters: (a: number, b: number
|
|
11
|
-
readonly pdfrenderer_measure: (a: number, b:
|
|
12
|
-
readonly pdfrenderer_new: (
|
|
13
|
-
readonly pdfrenderer_registerFont: (a: number, b: number,
|
|
14
|
-
readonly pdfrenderer_render: (a: number, b:
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
10
|
+
readonly counterCharacters: (a: number, b: number) => [number, number];
|
|
11
|
+
readonly pdfrenderer_measure: (a: number, b: any, c: number) => [number, number, number];
|
|
12
|
+
readonly pdfrenderer_new: () => [number, number, number];
|
|
13
|
+
readonly pdfrenderer_registerFont: (a: number, b: any) => [number, number, number];
|
|
14
|
+
readonly pdfrenderer_render: (a: number, b: any, c: number) => [number, number, number, number];
|
|
15
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
18
|
+
readonly __externref_table_alloc: () => number;
|
|
19
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
20
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
21
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
22
|
+
readonly __wbindgen_start: () => void;
|
|
20
23
|
}
|
|
21
24
|
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
22
25
|
/**
|
package/dist/export.mjs
CHANGED
|
@@ -31,33 +31,19 @@ var PdfRenderer$1 = class {
|
|
|
31
31
|
* @returns {MeasuredSize}
|
|
32
32
|
*/
|
|
33
33
|
measure(node, options) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
38
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
39
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
40
|
-
return takeObject(r0);
|
|
41
|
-
} finally {
|
|
42
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
43
|
-
}
|
|
34
|
+
const ret = wasm.pdfrenderer_measure(this.__wbg_ptr, node, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
35
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
36
|
+
return takeFromExternrefTable0(ret[0]);
|
|
44
37
|
}
|
|
45
38
|
/**
|
|
46
39
|
* Creates a renderer with the bundled last-resort fonts.
|
|
47
40
|
*/
|
|
48
41
|
constructor() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
55
|
-
this.__wbg_ptr = r0;
|
|
56
|
-
PdfRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
57
|
-
return this;
|
|
58
|
-
} finally {
|
|
59
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
60
|
-
}
|
|
42
|
+
const ret = wasm.pdfrenderer_new();
|
|
43
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
44
|
+
this.__wbg_ptr = ret[0];
|
|
45
|
+
PdfRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
46
|
+
return this;
|
|
61
47
|
}
|
|
62
48
|
/**
|
|
63
49
|
* Registers a font (raw bytes or a details object), returning the families
|
|
@@ -66,16 +52,9 @@ var PdfRenderer$1 = class {
|
|
|
66
52
|
* @returns {RegisteredFamily[]}
|
|
67
53
|
*/
|
|
68
54
|
registerFont(font) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 0, true);
|
|
73
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4, true);
|
|
74
|
-
if (getDataViewMemory0().getInt32(retptr + 8, true)) throw takeObject(r1);
|
|
75
|
-
return takeObject(r0);
|
|
76
|
-
} finally {
|
|
77
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
78
|
-
}
|
|
55
|
+
const ret = wasm.pdfrenderer_registerFont(this.__wbg_ptr, font);
|
|
56
|
+
if (ret[2]) throw takeFromExternrefTable0(ret[1]);
|
|
57
|
+
return takeFromExternrefTable0(ret[0]);
|
|
79
58
|
}
|
|
80
59
|
/**
|
|
81
60
|
* Renders a node tree to PDF bytes. Without options the output is paged A4;
|
|
@@ -85,19 +64,11 @@ var PdfRenderer$1 = class {
|
|
|
85
64
|
* @returns {Uint8Array<ArrayBuffer>}
|
|
86
65
|
*/
|
|
87
66
|
render(node, options) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 8, true);
|
|
94
|
-
if (getDataViewMemory0().getInt32(retptr + 12, true)) throw takeObject(r2);
|
|
95
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
96
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
97
|
-
return v1;
|
|
98
|
-
} finally {
|
|
99
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
100
|
-
}
|
|
67
|
+
const ret = wasm.pdfrenderer_render(this.__wbg_ptr, node, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
68
|
+
if (ret[3]) throw takeFromExternrefTable0(ret[2]);
|
|
69
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
70
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
71
|
+
return v1;
|
|
101
72
|
}
|
|
102
73
|
};
|
|
103
74
|
if (Symbol.dispose) PdfRenderer$1.prototype[Symbol.dispose] = PdfRenderer$1.prototype.free;
|
|
@@ -113,18 +84,14 @@ function counterCharacters(classes) {
|
|
|
113
84
|
let deferred2_0;
|
|
114
85
|
let deferred2_1;
|
|
115
86
|
try {
|
|
116
|
-
const
|
|
117
|
-
const ptr0 = passArrayJsValueToWasm0(classes, wasm.__wbindgen_export);
|
|
87
|
+
const ptr0 = passArrayJsValueToWasm0(classes, wasm.__wbindgen_malloc);
|
|
118
88
|
const len0 = WASM_VECTOR_LEN;
|
|
119
|
-
wasm.counterCharacters(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
deferred2_1 = r1;
|
|
124
|
-
return getStringFromWasm0(r0, r1);
|
|
89
|
+
const ret = wasm.counterCharacters(ptr0, len0);
|
|
90
|
+
deferred2_0 = ret[0];
|
|
91
|
+
deferred2_1 = ret[1];
|
|
92
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
125
93
|
} finally {
|
|
126
|
-
wasm.
|
|
127
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
94
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
128
95
|
}
|
|
129
96
|
}
|
|
130
97
|
function __wbg_get_imports() {
|
|
@@ -133,69 +100,69 @@ function __wbg_get_imports() {
|
|
|
133
100
|
"./takumi_pdf_wasm_bg.js": {
|
|
134
101
|
__proto__: null,
|
|
135
102
|
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
136
|
-
return
|
|
103
|
+
return Error(getStringFromWasm0(arg0, arg1));
|
|
137
104
|
},
|
|
138
105
|
__wbg_Number_3890faa6d3ff057d: function(arg0) {
|
|
139
|
-
return Number(
|
|
106
|
+
return Number(arg0);
|
|
140
107
|
},
|
|
141
108
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
142
|
-
const ptr1 = passStringToWasm0(String(
|
|
109
|
+
const ptr1 = passStringToWasm0(String(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
143
110
|
const len1 = WASM_VECTOR_LEN;
|
|
144
111
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
145
112
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
146
113
|
},
|
|
147
114
|
__wbg___wbindgen_bigint_get_as_i64_c4ecf48528083721: function(arg0, arg1) {
|
|
148
|
-
const v =
|
|
115
|
+
const v = arg1;
|
|
149
116
|
const ret = typeof v === "bigint" ? v : void 0;
|
|
150
117
|
getDataViewMemory0().setBigInt64(arg0 + 8, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
151
118
|
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
152
119
|
},
|
|
153
120
|
__wbg___wbindgen_boolean_get_c9c83ebd41b34df3: function(arg0) {
|
|
154
|
-
const v =
|
|
121
|
+
const v = arg0;
|
|
155
122
|
const ret = typeof v === "boolean" ? v : void 0;
|
|
156
123
|
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
157
124
|
},
|
|
158
125
|
__wbg___wbindgen_debug_string_a57024b9c6e4a48b: function(arg0, arg1) {
|
|
159
|
-
const ptr1 = passStringToWasm0(debugString(
|
|
126
|
+
const ptr1 = passStringToWasm0(debugString(arg1), wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
127
|
const len1 = WASM_VECTOR_LEN;
|
|
161
128
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
162
129
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
163
130
|
},
|
|
164
131
|
__wbg___wbindgen_in_ac983077f137f2e6: function(arg0, arg1) {
|
|
165
|
-
return
|
|
132
|
+
return arg0 in arg1;
|
|
166
133
|
},
|
|
167
134
|
__wbg___wbindgen_is_bigint_8ffbbef442139384: function(arg0) {
|
|
168
|
-
return typeof
|
|
135
|
+
return typeof arg0 === "bigint";
|
|
169
136
|
},
|
|
170
137
|
__wbg___wbindgen_is_function_5e4570eb24ffa122: function(arg0) {
|
|
171
|
-
return typeof
|
|
138
|
+
return typeof arg0 === "function";
|
|
172
139
|
},
|
|
173
140
|
__wbg___wbindgen_is_object_a2790eb24c211ea0: function(arg0) {
|
|
174
|
-
const val =
|
|
141
|
+
const val = arg0;
|
|
175
142
|
return typeof val === "object" && val !== null;
|
|
176
143
|
},
|
|
177
144
|
__wbg___wbindgen_is_string_e6f02f0ea5f20a32: function(arg0) {
|
|
178
|
-
return typeof
|
|
145
|
+
return typeof arg0 === "string";
|
|
179
146
|
},
|
|
180
147
|
__wbg___wbindgen_is_undefined_6cff064c44e0d823: function(arg0) {
|
|
181
|
-
return
|
|
148
|
+
return arg0 === void 0;
|
|
182
149
|
},
|
|
183
150
|
__wbg___wbindgen_jsval_eq_0a18949a61670320: function(arg0, arg1) {
|
|
184
|
-
return
|
|
151
|
+
return arg0 === arg1;
|
|
185
152
|
},
|
|
186
153
|
__wbg___wbindgen_jsval_loose_eq_acf2776254a8d832: function(arg0, arg1) {
|
|
187
|
-
return
|
|
154
|
+
return arg0 == arg1;
|
|
188
155
|
},
|
|
189
156
|
__wbg___wbindgen_number_get_136b9679cab35cfb: function(arg0, arg1) {
|
|
190
|
-
const obj =
|
|
157
|
+
const obj = arg1;
|
|
191
158
|
const ret = typeof obj === "number" ? obj : void 0;
|
|
192
159
|
getDataViewMemory0().setFloat64(arg0 + 8, isLikeNone(ret) ? 0 : ret, true);
|
|
193
160
|
getDataViewMemory0().setInt32(arg0 + 0, !isLikeNone(ret), true);
|
|
194
161
|
},
|
|
195
162
|
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
196
|
-
const obj =
|
|
163
|
+
const obj = arg1;
|
|
197
164
|
const ret = typeof obj === "string" ? obj : void 0;
|
|
198
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.
|
|
165
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
199
166
|
var len1 = WASM_VECTOR_LEN;
|
|
200
167
|
getDataViewMemory0().setInt32(arg0 + 4, len1, true);
|
|
201
168
|
getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);
|
|
@@ -205,36 +172,33 @@ function __wbg_get_imports() {
|
|
|
205
172
|
},
|
|
206
173
|
__wbg_call_1c5886ab9c57d1c7: function() {
|
|
207
174
|
return handleError(function(arg0, arg1) {
|
|
208
|
-
return
|
|
175
|
+
return arg0.call(arg1);
|
|
209
176
|
}, arguments);
|
|
210
177
|
},
|
|
211
178
|
__wbg_done_669171204c3dcae2: function(arg0) {
|
|
212
|
-
return
|
|
179
|
+
return arg0.done;
|
|
213
180
|
},
|
|
214
181
|
__wbg_entries_7774d489e1da5f4f: function(arg0) {
|
|
215
|
-
return
|
|
182
|
+
return Object.entries(arg0);
|
|
216
183
|
},
|
|
217
184
|
__wbg_get_c0c8f8d7da0c03dd: function(arg0, arg1) {
|
|
218
|
-
|
|
219
|
-
return addHeapObject(ret);
|
|
185
|
+
return arg0[arg1 >>> 0];
|
|
220
186
|
},
|
|
221
187
|
__wbg_get_d173c0308df22d37: function() {
|
|
222
188
|
return handleError(function(arg0, arg1) {
|
|
223
|
-
return
|
|
189
|
+
return Reflect.get(arg0, arg1);
|
|
224
190
|
}, arguments);
|
|
225
191
|
},
|
|
226
192
|
__wbg_get_unchecked_e20b893aeafc3fca: function(arg0, arg1) {
|
|
227
|
-
|
|
228
|
-
return addHeapObject(ret);
|
|
193
|
+
return arg0[arg1 >>> 0];
|
|
229
194
|
},
|
|
230
195
|
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
231
|
-
|
|
232
|
-
return addHeapObject(ret);
|
|
196
|
+
return arg0[arg1];
|
|
233
197
|
},
|
|
234
198
|
__wbg_instanceof_ArrayBuffer_993d02d2d254cad1: function(arg0) {
|
|
235
199
|
let result;
|
|
236
200
|
try {
|
|
237
|
-
result =
|
|
201
|
+
result = arg0 instanceof ArrayBuffer;
|
|
238
202
|
} catch (_) {
|
|
239
203
|
result = false;
|
|
240
204
|
}
|
|
@@ -243,7 +207,7 @@ function __wbg_get_imports() {
|
|
|
243
207
|
__wbg_instanceof_Map_9a4d6ead180ae3a9: function(arg0) {
|
|
244
208
|
let result;
|
|
245
209
|
try {
|
|
246
|
-
result =
|
|
210
|
+
result = arg0 instanceof Map;
|
|
247
211
|
} catch (_) {
|
|
248
212
|
result = false;
|
|
249
213
|
}
|
|
@@ -252,79 +216,79 @@ function __wbg_get_imports() {
|
|
|
252
216
|
__wbg_instanceof_Uint8Array_f935dbb0aa7cdeed: function(arg0) {
|
|
253
217
|
let result;
|
|
254
218
|
try {
|
|
255
|
-
result =
|
|
219
|
+
result = arg0 instanceof Uint8Array;
|
|
256
220
|
} catch (_) {
|
|
257
221
|
result = false;
|
|
258
222
|
}
|
|
259
223
|
return result;
|
|
260
224
|
},
|
|
261
225
|
__wbg_isArray_6339f732981044bf: function(arg0) {
|
|
262
|
-
return Array.isArray(
|
|
226
|
+
return Array.isArray(arg0);
|
|
263
227
|
},
|
|
264
228
|
__wbg_isSafeInteger_f3d6cd19ccfe4512: function(arg0) {
|
|
265
|
-
return Number.isSafeInteger(
|
|
229
|
+
return Number.isSafeInteger(arg0);
|
|
266
230
|
},
|
|
267
231
|
__wbg_iterator_5cebbb86e33c6dd6: function() {
|
|
268
|
-
|
|
269
|
-
return addHeapObject(ret);
|
|
232
|
+
return Symbol.iterator;
|
|
270
233
|
},
|
|
271
234
|
__wbg_length_36bd29c6848c2144: function(arg0) {
|
|
272
|
-
return
|
|
235
|
+
return arg0.length;
|
|
273
236
|
},
|
|
274
237
|
__wbg_length_ecfa2c63d3d0d82c: function(arg0) {
|
|
275
|
-
return
|
|
238
|
+
return arg0.length;
|
|
276
239
|
},
|
|
277
240
|
__wbg_new_116be93542d39019: function() {
|
|
278
|
-
return
|
|
241
|
+
return new Array();
|
|
279
242
|
},
|
|
280
243
|
__wbg_new_358857d90afd5a2d: function(arg0, arg1) {
|
|
281
|
-
return
|
|
244
|
+
return new Error(getStringFromWasm0(arg0, arg1));
|
|
282
245
|
},
|
|
283
246
|
__wbg_new_77cc4f4f472aeb81: function(arg0) {
|
|
284
|
-
return
|
|
247
|
+
return new Uint8Array(arg0);
|
|
285
248
|
},
|
|
286
249
|
__wbg_new_ebe3e0f6837f0879: function() {
|
|
287
|
-
return
|
|
250
|
+
return /* @__PURE__ */ new Object();
|
|
288
251
|
},
|
|
289
252
|
__wbg_next_42cf16ee0dafc9e2: function() {
|
|
290
253
|
return handleError(function(arg0) {
|
|
291
|
-
return
|
|
254
|
+
return arg0.next();
|
|
292
255
|
}, arguments);
|
|
293
256
|
},
|
|
294
257
|
__wbg_next_8f26b64fa5e9f64b: function(arg0) {
|
|
295
|
-
|
|
296
|
-
return addHeapObject(ret);
|
|
258
|
+
return arg0.next;
|
|
297
259
|
},
|
|
298
260
|
__wbg_prototypesetcall_de8e0d9553586985: function(arg0, arg1, arg2) {
|
|
299
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1),
|
|
261
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
300
262
|
},
|
|
301
263
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
302
|
-
|
|
264
|
+
arg0[arg1] = arg2;
|
|
303
265
|
},
|
|
304
266
|
__wbg_set_a80955eb93b145c6: function(arg0, arg1, arg2) {
|
|
305
|
-
|
|
267
|
+
arg0[arg1 >>> 0] = arg2;
|
|
306
268
|
},
|
|
307
269
|
__wbg_value_1e2369fab29b420e: function(arg0) {
|
|
308
|
-
|
|
309
|
-
return addHeapObject(ret);
|
|
270
|
+
return arg0.value;
|
|
310
271
|
},
|
|
311
272
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
312
|
-
return
|
|
273
|
+
return arg0;
|
|
313
274
|
},
|
|
314
275
|
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
315
|
-
return
|
|
276
|
+
return arg0;
|
|
316
277
|
},
|
|
317
278
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
318
|
-
return
|
|
279
|
+
return getStringFromWasm0(arg0, arg1);
|
|
319
280
|
},
|
|
320
281
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
321
|
-
return
|
|
322
|
-
},
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
282
|
+
return BigInt.asUintN(64, arg0);
|
|
283
|
+
},
|
|
284
|
+
__wbindgen_init_externref_table: function() {
|
|
285
|
+
const table = wasm.__wbindgen_externrefs;
|
|
286
|
+
const offset = table.grow(4);
|
|
287
|
+
table.set(0, void 0);
|
|
288
|
+
table.set(offset + 0, void 0);
|
|
289
|
+
table.set(offset + 1, null);
|
|
290
|
+
table.set(offset + 2, true);
|
|
291
|
+
table.set(offset + 3, false);
|
|
328
292
|
}
|
|
329
293
|
}
|
|
330
294
|
};
|
|
@@ -333,11 +297,9 @@ const PdfRendererFinalization = typeof FinalizationRegistry === "undefined" ? {
|
|
|
333
297
|
register: () => {},
|
|
334
298
|
unregister: () => {}
|
|
335
299
|
} : new FinalizationRegistry((ptr) => wasm.__wbg_pdfrenderer_free(ptr, 1));
|
|
336
|
-
function
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
heap_next = heap[idx];
|
|
340
|
-
heap[idx] = obj;
|
|
300
|
+
function addToExternrefTable0(obj) {
|
|
301
|
+
const idx = wasm.__externref_table_alloc();
|
|
302
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
341
303
|
return idx;
|
|
342
304
|
}
|
|
343
305
|
function debugString(val) {
|
|
@@ -374,11 +336,6 @@ function debugString(val) {
|
|
|
374
336
|
if (val instanceof Error) return `${val.name}: ${val.message}\n${val.stack}`;
|
|
375
337
|
return className;
|
|
376
338
|
}
|
|
377
|
-
function dropObject(idx) {
|
|
378
|
-
if (idx < 1028) return;
|
|
379
|
-
heap[idx] = heap_next;
|
|
380
|
-
heap_next = idx;
|
|
381
|
-
}
|
|
382
339
|
function getArrayU8FromWasm0(ptr, len) {
|
|
383
340
|
ptr = ptr >>> 0;
|
|
384
341
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -396,26 +353,23 @@ function getUint8ArrayMemory0() {
|
|
|
396
353
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
397
354
|
return cachedUint8ArrayMemory0;
|
|
398
355
|
}
|
|
399
|
-
function getObject(idx) {
|
|
400
|
-
return heap[idx];
|
|
401
|
-
}
|
|
402
356
|
function handleError(f, args) {
|
|
403
357
|
try {
|
|
404
358
|
return f.apply(this, args);
|
|
405
359
|
} catch (e) {
|
|
406
|
-
|
|
360
|
+
const idx = addToExternrefTable0(e);
|
|
361
|
+
wasm.__wbindgen_exn_store(idx);
|
|
407
362
|
}
|
|
408
363
|
}
|
|
409
|
-
let heap = new Array(1024).fill(void 0);
|
|
410
|
-
heap.push(void 0, null, true, false);
|
|
411
|
-
let heap_next = heap.length;
|
|
412
364
|
function isLikeNone(x) {
|
|
413
365
|
return x === void 0 || x === null;
|
|
414
366
|
}
|
|
415
367
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
416
368
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
417
|
-
|
|
418
|
-
|
|
369
|
+
for (let i = 0; i < array.length; i++) {
|
|
370
|
+
const add = addToExternrefTable0(array[i]);
|
|
371
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
372
|
+
}
|
|
419
373
|
WASM_VECTOR_LEN = array.length;
|
|
420
374
|
return ptr;
|
|
421
375
|
}
|
|
@@ -447,10 +401,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
447
401
|
WASM_VECTOR_LEN = offset;
|
|
448
402
|
return ptr;
|
|
449
403
|
}
|
|
450
|
-
function
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
return
|
|
404
|
+
function takeFromExternrefTable0(idx) {
|
|
405
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
406
|
+
wasm.__externref_table_dealloc(idx);
|
|
407
|
+
return value;
|
|
454
408
|
}
|
|
455
409
|
let cachedTextDecoder = new TextDecoder("utf-8", {
|
|
456
410
|
ignoreBOM: true,
|
|
@@ -486,6 +440,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
486
440
|
wasm = instance.exports;
|
|
487
441
|
cachedDataViewMemory0 = null;
|
|
488
442
|
cachedUint8ArrayMemory0 = null;
|
|
443
|
+
wasm.__wbindgen_start();
|
|
489
444
|
return wasm;
|
|
490
445
|
}
|
|
491
446
|
async function __wbg_load(module, imports) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "takumi-pdf",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Render paged PDFs from JSX, HTML, and CSS. No headless browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chromium-free",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"publish-lint": "attw --pack . && publint --strict ."
|
|
144
144
|
},
|
|
145
145
|
"dependencies": {
|
|
146
|
-
"@takumi-rs/helpers": "2.13.
|
|
146
|
+
"@takumi-rs/helpers": "2.13.7"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
149
|
"@types/bun": "^1.4.0",
|
|
Binary file
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_pdfrenderer_free: (a: number, b: number) => void;
|
|
5
|
-
export const counterCharacters: (a: number, b: number
|
|
6
|
-
export const pdfrenderer_measure: (a: number, b:
|
|
7
|
-
export const pdfrenderer_new: (
|
|
8
|
-
export const pdfrenderer_registerFont: (a: number, b: number,
|
|
9
|
-
export const pdfrenderer_render: (a: number, b:
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
5
|
+
export const counterCharacters: (a: number, b: number) => [number, number];
|
|
6
|
+
export const pdfrenderer_measure: (a: number, b: any, c: number) => [number, number, number];
|
|
7
|
+
export const pdfrenderer_new: () => [number, number, number];
|
|
8
|
+
export const pdfrenderer_registerFont: (a: number, b: any) => [number, number, number];
|
|
9
|
+
export const pdfrenderer_render: (a: number, b: any, c: number) => [number, number, number, number];
|
|
10
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
13
|
+
export const __externref_table_alloc: () => number;
|
|
14
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
16
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|