@f-office/core 0.2.1 → 0.2.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/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/wasm/f_office_wasm.d.ts +470 -0
- package/dist/wasm/f_office_wasm.js +1226 -113
- package/dist/wasm/f_office_wasm_bg.wasm +0 -0
- package/dist/wasm/f_office_wasm_bg.wasm.d.ts +52 -0
- package/package.json +5 -1
|
@@ -221,6 +221,65 @@ export class Document {
|
|
|
221
221
|
}
|
|
222
222
|
if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A drawn page for JavaScript: its width, height and RGBA pixels.
|
|
226
|
+
*/
|
|
227
|
+
export class Drawing {
|
|
228
|
+
static __wrap(ptr) {
|
|
229
|
+
const obj = Object.create(Drawing.prototype);
|
|
230
|
+
obj.__wbg_ptr = ptr;
|
|
231
|
+
DrawingFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
232
|
+
return obj;
|
|
233
|
+
}
|
|
234
|
+
__destroy_into_raw() {
|
|
235
|
+
const ptr = this.__wbg_ptr;
|
|
236
|
+
this.__wbg_ptr = 0;
|
|
237
|
+
DrawingFinalization.unregister(this);
|
|
238
|
+
return ptr;
|
|
239
|
+
}
|
|
240
|
+
free() {
|
|
241
|
+
const ptr = this.__destroy_into_raw();
|
|
242
|
+
wasm.__wbg_drawing_free(ptr, 0);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The height in pixels.
|
|
246
|
+
* @returns {number}
|
|
247
|
+
*/
|
|
248
|
+
get height() {
|
|
249
|
+
const ret = wasm.drawing_height(this.__wbg_ptr);
|
|
250
|
+
return ret >>> 0;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The pixels, four bytes each, row by row from the top, as a new array.
|
|
254
|
+
* @returns {Uint8Array}
|
|
255
|
+
*/
|
|
256
|
+
get pixels() {
|
|
257
|
+
const ret = wasm.drawing_pixels(this.__wbg_ptr);
|
|
258
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
259
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
260
|
+
return v1;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Consumes and returns the RGBA pixels without cloning inside WebAssembly.
|
|
264
|
+
* @returns {Uint8Array}
|
|
265
|
+
*/
|
|
266
|
+
takePixels() {
|
|
267
|
+
const ret = wasm.drawing_takePixels(this.__wbg_ptr);
|
|
268
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
269
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
270
|
+
return v1;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The width in pixels.
|
|
274
|
+
* @returns {number}
|
|
275
|
+
*/
|
|
276
|
+
get width() {
|
|
277
|
+
const ret = wasm.drawing_width(this.__wbg_ptr);
|
|
278
|
+
return ret >>> 0;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (Symbol.dispose) Drawing.prototype[Symbol.dispose] = Drawing.prototype.free;
|
|
282
|
+
|
|
224
283
|
/**
|
|
225
284
|
* A font that a document's text asks for and the families that the target tries for it.
|
|
226
285
|
*/
|
|
@@ -748,165 +807,1213 @@ export class SearchMatch {
|
|
|
748
807
|
if (Symbol.dispose) SearchMatch.prototype[Symbol.dispose] = SearchMatch.prototype.free;
|
|
749
808
|
|
|
750
809
|
/**
|
|
751
|
-
*
|
|
752
|
-
* glyphs from its font's ascender to its descender, and its glyphs.
|
|
810
|
+
* The viewer's session for JavaScript, as [`Session`] says.
|
|
753
811
|
*/
|
|
754
|
-
export class
|
|
755
|
-
static __wrap(ptr) {
|
|
756
|
-
const obj = Object.create(TextRun.prototype);
|
|
757
|
-
obj.__wbg_ptr = ptr;
|
|
758
|
-
TextRunFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
759
|
-
return obj;
|
|
760
|
-
}
|
|
812
|
+
export class Session {
|
|
761
813
|
__destroy_into_raw() {
|
|
762
814
|
const ptr = this.__wbg_ptr;
|
|
763
815
|
this.__wbg_ptr = 0;
|
|
764
|
-
|
|
816
|
+
SessionFinalization.unregister(this);
|
|
765
817
|
return ptr;
|
|
766
818
|
}
|
|
767
819
|
free() {
|
|
768
820
|
const ptr = this.__destroy_into_raw();
|
|
769
|
-
wasm.
|
|
821
|
+
wasm.__wbg_session_free(ptr, 0);
|
|
770
822
|
}
|
|
771
823
|
/**
|
|
772
|
-
*
|
|
824
|
+
* Takes the ICU4X word dictionaries from an external postcard data blob, for the open
|
|
825
|
+
* document and the ones that it opens later.
|
|
826
|
+
*
|
|
827
|
+
* # Errors
|
|
828
|
+
*
|
|
829
|
+
* Throws when the data holds no word dictionaries.
|
|
830
|
+
* @param {Uint8Array | number[]} blob
|
|
831
|
+
*/
|
|
832
|
+
addDictionaries(blob) {
|
|
833
|
+
const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_malloc);
|
|
834
|
+
const len0 = WASM_VECTOR_LEN;
|
|
835
|
+
const ret = wasm.session_addDictionaries(this.__wbg_ptr, ptr0, len0);
|
|
836
|
+
if (ret[1]) {
|
|
837
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Adds the faces of a font file and returns how many it holds.
|
|
842
|
+
*
|
|
843
|
+
* # Errors
|
|
844
|
+
*
|
|
845
|
+
* Throws when the data is no font.
|
|
846
|
+
* @param {Uint8Array | number[]} data
|
|
773
847
|
* @returns {number}
|
|
774
848
|
*/
|
|
775
|
-
|
|
776
|
-
const
|
|
777
|
-
|
|
849
|
+
addFont(data) {
|
|
850
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
851
|
+
const len0 = WASM_VECTOR_LEN;
|
|
852
|
+
const ret = wasm.session_addFont(this.__wbg_ptr, ptr0, len0);
|
|
853
|
+
if (ret[2]) {
|
|
854
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
855
|
+
}
|
|
856
|
+
return ret[0] >>> 0;
|
|
778
857
|
}
|
|
779
858
|
/**
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
859
|
+
* Begins opening the previously staged document incrementally, laying out Page 1 first.
|
|
860
|
+
*
|
|
861
|
+
* # Errors
|
|
862
|
+
*
|
|
863
|
+
* Throws when no document is staged or opening fails.
|
|
864
|
+
* @returns {string}
|
|
783
865
|
*/
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
866
|
+
beginOpenStaged() {
|
|
867
|
+
let deferred2_0;
|
|
868
|
+
let deferred2_1;
|
|
869
|
+
try {
|
|
870
|
+
const ret = wasm.session_beginOpenStaged(this.__wbg_ptr);
|
|
871
|
+
var ptr1 = ret[0];
|
|
872
|
+
var len1 = ret[1];
|
|
873
|
+
if (ret[3]) {
|
|
874
|
+
ptr1 = 0; len1 = 0;
|
|
875
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
876
|
+
}
|
|
877
|
+
deferred2_0 = ptr1;
|
|
878
|
+
deferred2_1 = len1;
|
|
879
|
+
return getStringFromWasm0(ptr1, len1);
|
|
880
|
+
} finally {
|
|
881
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
882
|
+
}
|
|
789
883
|
}
|
|
790
884
|
/**
|
|
791
|
-
*
|
|
792
|
-
*
|
|
885
|
+
* Ends a press because the window lost the focus, and returns what it did, as JSON
|
|
886
|
+
* ([`handled_json`]).
|
|
887
|
+
*
|
|
888
|
+
* # Errors
|
|
889
|
+
*
|
|
890
|
+
* Throws when no document is open.
|
|
891
|
+
* @returns {string}
|
|
793
892
|
*/
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
893
|
+
blur() {
|
|
894
|
+
let deferred2_0;
|
|
895
|
+
let deferred2_1;
|
|
896
|
+
try {
|
|
897
|
+
const ret = wasm.session_blur(this.__wbg_ptr);
|
|
898
|
+
var ptr1 = ret[0];
|
|
899
|
+
var len1 = ret[1];
|
|
900
|
+
if (ret[3]) {
|
|
901
|
+
ptr1 = 0; len1 = 0;
|
|
902
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
903
|
+
}
|
|
904
|
+
deferred2_0 = ptr1;
|
|
905
|
+
deferred2_1 = len1;
|
|
906
|
+
return getStringFromWasm0(ptr1, len1);
|
|
907
|
+
} finally {
|
|
908
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
909
|
+
}
|
|
799
910
|
}
|
|
800
911
|
/**
|
|
801
|
-
*
|
|
802
|
-
*
|
|
912
|
+
* Clears all caller-supplied highlights, or only those matching `kind`.
|
|
913
|
+
*
|
|
914
|
+
* # Errors
|
|
915
|
+
*
|
|
916
|
+
* Throws when no document is open.
|
|
917
|
+
* @param {string | null} [kind]
|
|
803
918
|
*/
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
var
|
|
807
|
-
wasm.
|
|
808
|
-
|
|
919
|
+
clearHighlights(kind) {
|
|
920
|
+
var ptr0 = isLikeNone(kind) ? 0 : passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
921
|
+
var len0 = WASM_VECTOR_LEN;
|
|
922
|
+
const ret = wasm.session_clearHighlights(this.__wbg_ptr, ptr0, len0);
|
|
923
|
+
if (ret[1]) {
|
|
924
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
925
|
+
}
|
|
809
926
|
}
|
|
810
927
|
/**
|
|
811
|
-
*
|
|
812
|
-
*
|
|
928
|
+
* Clears the selection.
|
|
929
|
+
*
|
|
930
|
+
* # Errors
|
|
931
|
+
*
|
|
932
|
+
* Throws when no document is open.
|
|
813
933
|
*/
|
|
814
|
-
|
|
815
|
-
const ret = wasm.
|
|
816
|
-
|
|
934
|
+
clearSelection() {
|
|
935
|
+
const ret = wasm.session_clearSelection(this.__wbg_ptr);
|
|
936
|
+
if (ret[1]) {
|
|
937
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
938
|
+
}
|
|
817
939
|
}
|
|
818
940
|
/**
|
|
819
|
-
*
|
|
820
|
-
*
|
|
941
|
+
* Draws a page at a resolution, and counts the drawing as the shell's.
|
|
942
|
+
*
|
|
943
|
+
* # Errors
|
|
944
|
+
*
|
|
945
|
+
* Throws when no document is open, or the page does not exist or cannot be drawn.
|
|
946
|
+
* @param {number} page
|
|
947
|
+
* @param {number} dpi
|
|
948
|
+
* @returns {Drawing}
|
|
821
949
|
*/
|
|
822
|
-
|
|
823
|
-
const ret = wasm.
|
|
824
|
-
|
|
950
|
+
draw(page, dpi) {
|
|
951
|
+
const ret = wasm.session_draw(this.__wbg_ptr, page, dpi);
|
|
952
|
+
if (ret[2]) {
|
|
953
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
954
|
+
}
|
|
955
|
+
return Drawing.__wrap(ret[0]);
|
|
825
956
|
}
|
|
826
957
|
/**
|
|
827
|
-
*
|
|
958
|
+
* Ends a zoom gesture, so that the next frame asks for the drawings at its zoom.
|
|
959
|
+
*
|
|
960
|
+
* # Errors
|
|
961
|
+
*
|
|
962
|
+
* Throws when no document is open.
|
|
963
|
+
*/
|
|
964
|
+
endGesture() {
|
|
965
|
+
const ret = wasm.session_endGesture(this.__wbg_ptr);
|
|
966
|
+
if (ret[1]) {
|
|
967
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Makes the next match current when `forward` is set, and the match before it when not.
|
|
972
|
+
*
|
|
973
|
+
* # Errors
|
|
974
|
+
*
|
|
975
|
+
* Throws when no document is open.
|
|
976
|
+
* @param {boolean} forward
|
|
977
|
+
*/
|
|
978
|
+
findStep(forward) {
|
|
979
|
+
const ret = wasm.session_findStep(this.__wbg_ptr, forward);
|
|
980
|
+
if (ret[1]) {
|
|
981
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Searches the document for `query`, and returns the number of matches.
|
|
986
|
+
*
|
|
987
|
+
* # Errors
|
|
988
|
+
*
|
|
989
|
+
* Throws when no document is open.
|
|
990
|
+
* @param {string} query
|
|
828
991
|
* @returns {number}
|
|
829
992
|
*/
|
|
830
|
-
|
|
831
|
-
const
|
|
832
|
-
|
|
993
|
+
find(query) {
|
|
994
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
995
|
+
const len0 = WASM_VECTOR_LEN;
|
|
996
|
+
const ret = wasm.session_find(this.__wbg_ptr, ptr0, len0);
|
|
997
|
+
if (ret[2]) {
|
|
998
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
999
|
+
}
|
|
1000
|
+
return ret[0] >>> 0;
|
|
833
1001
|
}
|
|
834
1002
|
/**
|
|
835
|
-
*
|
|
1003
|
+
* Fast-forwards any remaining incremental layout slices to completion.
|
|
1004
|
+
*
|
|
1005
|
+
* # Errors
|
|
1006
|
+
*
|
|
1007
|
+
* Throws when no document is open or layout fails.
|
|
836
1008
|
* @returns {string}
|
|
837
1009
|
*/
|
|
838
|
-
|
|
839
|
-
let
|
|
840
|
-
let
|
|
1010
|
+
finishLayout() {
|
|
1011
|
+
let deferred2_0;
|
|
1012
|
+
let deferred2_1;
|
|
841
1013
|
try {
|
|
842
|
-
const ret = wasm.
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1014
|
+
const ret = wasm.session_finishLayout(this.__wbg_ptr);
|
|
1015
|
+
var ptr1 = ret[0];
|
|
1016
|
+
var len1 = ret[1];
|
|
1017
|
+
if (ret[3]) {
|
|
1018
|
+
ptr1 = 0; len1 = 0;
|
|
1019
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1020
|
+
}
|
|
1021
|
+
deferred2_0 = ptr1;
|
|
1022
|
+
deferred2_1 = len1;
|
|
1023
|
+
return getStringFromWasm0(ptr1, len1);
|
|
846
1024
|
} finally {
|
|
847
|
-
wasm.__wbindgen_free(
|
|
1025
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
848
1026
|
}
|
|
849
1027
|
}
|
|
850
1028
|
/**
|
|
851
|
-
* The
|
|
852
|
-
*
|
|
1029
|
+
* The fonts that a random-access DOCX source asks for on `target`, as JSON, without copying
|
|
1030
|
+
* the whole archive into WASM linear memory ([`Session::fonts_needed_source`]).
|
|
1031
|
+
*
|
|
1032
|
+
* # Errors
|
|
1033
|
+
*
|
|
1034
|
+
* Throws when `byteLength` is invalid, no target has the ID, or the source cannot be opened.
|
|
1035
|
+
* @param {number} byte_length
|
|
1036
|
+
* @param {Function} read_at
|
|
1037
|
+
* @param {string | null} [target]
|
|
1038
|
+
* @returns {string}
|
|
853
1039
|
*/
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
1040
|
+
static fontsNeededSource(byte_length, read_at, target) {
|
|
1041
|
+
let deferred4_0;
|
|
1042
|
+
let deferred4_1;
|
|
1043
|
+
try {
|
|
1044
|
+
const val2 = +byte_length;
|
|
1045
|
+
var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1046
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1047
|
+
const ret = wasm.session_fontsNeededSource(val2, read_at, ptr0, len0);
|
|
1048
|
+
var ptr3 = ret[0];
|
|
1049
|
+
var len3 = ret[1];
|
|
1050
|
+
if (ret[3]) {
|
|
1051
|
+
ptr3 = 0; len3 = 0;
|
|
1052
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1053
|
+
}
|
|
1054
|
+
deferred4_0 = ptr3;
|
|
1055
|
+
deferred4_1 = len3;
|
|
1056
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1057
|
+
} finally {
|
|
1058
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1059
|
+
}
|
|
857
1060
|
}
|
|
858
1061
|
/**
|
|
859
|
-
* The
|
|
860
|
-
*
|
|
1062
|
+
* The fonts that `docx` asks for on `target`, as JSON ([`Session::fonts_needed`]).
|
|
1063
|
+
*
|
|
1064
|
+
* # Errors
|
|
1065
|
+
*
|
|
1066
|
+
* Throws when no target has the ID or the file cannot be opened.
|
|
1067
|
+
* @param {Uint8Array | number[]} docx
|
|
1068
|
+
* @param {string | null} [target]
|
|
1069
|
+
* @returns {string}
|
|
861
1070
|
*/
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (Symbol.dispose) TextRun.prototype[Symbol.dispose] = TextRun.prototype.free;
|
|
868
|
-
function __wbg_get_imports() {
|
|
869
|
-
const import0 = {
|
|
870
|
-
__proto__: null,
|
|
871
|
-
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
872
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
873
|
-
return ret;
|
|
874
|
-
},
|
|
875
|
-
__wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
|
|
876
|
-
const ret = debugString(arg1);
|
|
877
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
878
|
-
const len1 = WASM_VECTOR_LEN;
|
|
879
|
-
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
880
|
-
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
881
|
-
},
|
|
882
|
-
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
883
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
884
|
-
},
|
|
885
|
-
__wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
|
|
886
|
-
const ret = arg0.call(arg1, arg2);
|
|
887
|
-
return ret;
|
|
888
|
-
}, arguments); },
|
|
889
|
-
__wbg_call_fc92fee6137d452d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
890
|
-
const ret = arg0.call(arg1, arg2, arg3);
|
|
891
|
-
return ret;
|
|
892
|
-
}, arguments); },
|
|
893
|
-
__wbg_fontneed_new: function(arg0) {
|
|
894
|
-
const ret = FontNeed.__wrap(arg0);
|
|
895
|
-
return ret;
|
|
896
|
-
},
|
|
897
|
-
__wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
|
|
898
|
-
let result;
|
|
1071
|
+
static fontsNeeded(docx, target) {
|
|
1072
|
+
let deferred4_0;
|
|
1073
|
+
let deferred4_1;
|
|
1074
|
+
try {
|
|
1075
|
+
let ptr0, len0, ptr1, len1;
|
|
899
1076
|
try {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1077
|
+
ptr0 = passArray8ToWasm0(docx, wasm.__wbindgen_malloc);
|
|
1078
|
+
len0 = WASM_VECTOR_LEN;
|
|
1079
|
+
ptr1 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1080
|
+
len1 = WASM_VECTOR_LEN;
|
|
1081
|
+
} catch (e) {
|
|
1082
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1083
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1084
|
+
throw e;
|
|
903
1085
|
}
|
|
904
|
-
const ret =
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1086
|
+
const ret = wasm.session_fontsNeeded(ptr0, len0, ptr1, len1);
|
|
1087
|
+
var ptr3 = ret[0];
|
|
1088
|
+
var len3 = ret[1];
|
|
1089
|
+
if (ret[3]) {
|
|
1090
|
+
ptr3 = 0; len3 = 0;
|
|
1091
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1092
|
+
}
|
|
1093
|
+
deferred4_0 = ptr3;
|
|
1094
|
+
deferred4_1 = len3;
|
|
1095
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1096
|
+
} finally {
|
|
1097
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Forgets the drawings that the worker was asked for and has not drawn.
|
|
1102
|
+
*
|
|
1103
|
+
* # Errors
|
|
1104
|
+
*
|
|
1105
|
+
* Throws when no document is open.
|
|
1106
|
+
*/
|
|
1107
|
+
forgetRequests() {
|
|
1108
|
+
const ret = wasm.session_forgetRequests(this.__wbg_ptr);
|
|
1109
|
+
if (ret[1]) {
|
|
1110
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* What the shell shows now, as JSON ([`frame_json`]).
|
|
1115
|
+
*
|
|
1116
|
+
* # Errors
|
|
1117
|
+
*
|
|
1118
|
+
* Throws when no document is open.
|
|
1119
|
+
* @returns {string}
|
|
1120
|
+
*/
|
|
1121
|
+
frame() {
|
|
1122
|
+
let deferred2_0;
|
|
1123
|
+
let deferred2_1;
|
|
1124
|
+
try {
|
|
1125
|
+
const ret = wasm.session_frame(this.__wbg_ptr);
|
|
1126
|
+
var ptr1 = ret[0];
|
|
1127
|
+
var len1 = ret[1];
|
|
1128
|
+
if (ret[3]) {
|
|
1129
|
+
ptr1 = 0; len1 = 0;
|
|
1130
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1131
|
+
}
|
|
1132
|
+
deferred2_0 = ptr1;
|
|
1133
|
+
deferred2_1 = len1;
|
|
1134
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1135
|
+
} finally {
|
|
1136
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Zooms to `factor` during a zoom gesture, around the viewport's point at `anchor_x` and
|
|
1141
|
+
* `anchor_y`: the frames ask for no drawing until [`Session::end_gesture`].
|
|
1142
|
+
*
|
|
1143
|
+
* # Errors
|
|
1144
|
+
*
|
|
1145
|
+
* Throws when no document is open.
|
|
1146
|
+
* @param {number} factor
|
|
1147
|
+
* @param {number | null} [anchor_x]
|
|
1148
|
+
* @param {number | null} [anchor_y]
|
|
1149
|
+
*/
|
|
1150
|
+
gestureZoom(factor, anchor_x, anchor_y) {
|
|
1151
|
+
const ret = wasm.session_gestureZoom(this.__wbg_ptr, factor, !isLikeNone(anchor_x), isLikeNone(anchor_x) ? 0 : anchor_x, !isLikeNone(anchor_y), isLikeNone(anchor_y) ? 0 : anchor_y);
|
|
1152
|
+
if (ret[1]) {
|
|
1153
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Scrolls to the line where the bookmark `name` starts, and returns whether it went.
|
|
1158
|
+
*
|
|
1159
|
+
* # Errors
|
|
1160
|
+
*
|
|
1161
|
+
* Throws when no document is open.
|
|
1162
|
+
* @param {string} name
|
|
1163
|
+
* @returns {boolean}
|
|
1164
|
+
*/
|
|
1165
|
+
goToBookmark(name) {
|
|
1166
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1168
|
+
const ret = wasm.session_goToBookmark(this.__wbg_ptr, ptr0, len0);
|
|
1169
|
+
if (ret[2]) {
|
|
1170
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1171
|
+
}
|
|
1172
|
+
return ret[0] !== 0;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Scrolls to the first line of a heading of the outline, by its index in the outline, and
|
|
1176
|
+
* makes it the frame's `currentHeading` until the next scroll.
|
|
1177
|
+
*
|
|
1178
|
+
* # Errors
|
|
1179
|
+
*
|
|
1180
|
+
* Throws when no document is open.
|
|
1181
|
+
* @param {number} index
|
|
1182
|
+
*/
|
|
1183
|
+
goToHeading(index) {
|
|
1184
|
+
const ret = wasm.session_goToHeading(this.__wbg_ptr, index);
|
|
1185
|
+
if (ret[1]) {
|
|
1186
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Scrolls the top of a page, counted from 0, to the top of the viewport.
|
|
1191
|
+
*
|
|
1192
|
+
* # Errors
|
|
1193
|
+
*
|
|
1194
|
+
* Throws when no document is open.
|
|
1195
|
+
* @param {number} page
|
|
1196
|
+
*/
|
|
1197
|
+
goToPage(page) {
|
|
1198
|
+
const ret = wasm.session_goToPage(this.__wbg_ptr, page);
|
|
1199
|
+
if (ret[1]) {
|
|
1200
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* The innermost hyperlink under the viewport's point `x`, `y`, as JSON: its `target`, an
|
|
1205
|
+
* `external` `address` or a `bookmark` `name`, and its `tooltip`; null away from a link.
|
|
1206
|
+
*
|
|
1207
|
+
* # Errors
|
|
1208
|
+
*
|
|
1209
|
+
* Throws when no document is open.
|
|
1210
|
+
* @param {number} x
|
|
1211
|
+
* @param {number} y
|
|
1212
|
+
* @returns {string}
|
|
1213
|
+
*/
|
|
1214
|
+
linkAt(x, y) {
|
|
1215
|
+
let deferred2_0;
|
|
1216
|
+
let deferred2_1;
|
|
1217
|
+
try {
|
|
1218
|
+
const ret = wasm.session_linkAt(this.__wbg_ptr, x, y);
|
|
1219
|
+
var ptr1 = ret[0];
|
|
1220
|
+
var len1 = ret[1];
|
|
1221
|
+
if (ret[3]) {
|
|
1222
|
+
ptr1 = 0; len1 = 0;
|
|
1223
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1224
|
+
}
|
|
1225
|
+
deferred2_0 = ptr1;
|
|
1226
|
+
deferred2_1 = len1;
|
|
1227
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1228
|
+
} finally {
|
|
1229
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* A session with no fonts and no document.
|
|
1234
|
+
*/
|
|
1235
|
+
constructor() {
|
|
1236
|
+
const ret = wasm.session_new();
|
|
1237
|
+
this.__wbg_ptr = ret;
|
|
1238
|
+
SessionFinalization.register(this, this.__wbg_ptr, this);
|
|
1239
|
+
return this;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Opens a random-access DOCX source for `target` without copying the full archive into WASM
|
|
1243
|
+
* linear memory ([`Session::open_source`]).
|
|
1244
|
+
*
|
|
1245
|
+
* # Errors
|
|
1246
|
+
*
|
|
1247
|
+
* Throws when `byteLength` is invalid, no target has the ID, or the source cannot be opened.
|
|
1248
|
+
* @param {number} byte_length
|
|
1249
|
+
* @param {Function} read_at
|
|
1250
|
+
* @param {string | null} [target]
|
|
1251
|
+
* @returns {string}
|
|
1252
|
+
*/
|
|
1253
|
+
openSource(byte_length, read_at, target) {
|
|
1254
|
+
let deferred4_0;
|
|
1255
|
+
let deferred4_1;
|
|
1256
|
+
try {
|
|
1257
|
+
const val2 = +byte_length;
|
|
1258
|
+
var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1259
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1260
|
+
const ret = wasm.session_openSource(this.__wbg_ptr, val2, read_at, ptr0, len0);
|
|
1261
|
+
var ptr3 = ret[0];
|
|
1262
|
+
var len3 = ret[1];
|
|
1263
|
+
if (ret[3]) {
|
|
1264
|
+
ptr3 = 0; len3 = 0;
|
|
1265
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1266
|
+
}
|
|
1267
|
+
deferred4_0 = ptr3;
|
|
1268
|
+
deferred4_1 = len3;
|
|
1269
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1270
|
+
} finally {
|
|
1271
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Opens `docx` for `target`, and returns its page count and outline as JSON
|
|
1276
|
+
* ([`Session::open`]).
|
|
1277
|
+
*
|
|
1278
|
+
* # Errors
|
|
1279
|
+
*
|
|
1280
|
+
* Throws when no target has the ID or the file cannot be opened.
|
|
1281
|
+
* @param {Uint8Array | number[]} docx
|
|
1282
|
+
* @param {string | null} [target]
|
|
1283
|
+
* @returns {string}
|
|
1284
|
+
*/
|
|
1285
|
+
open(docx, target) {
|
|
1286
|
+
let deferred4_0;
|
|
1287
|
+
let deferred4_1;
|
|
1288
|
+
try {
|
|
1289
|
+
let ptr0, len0, ptr1, len1;
|
|
1290
|
+
try {
|
|
1291
|
+
ptr0 = passArray8ToWasm0(docx, wasm.__wbindgen_malloc);
|
|
1292
|
+
len0 = WASM_VECTOR_LEN;
|
|
1293
|
+
ptr1 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1294
|
+
len1 = WASM_VECTOR_LEN;
|
|
1295
|
+
} catch (e) {
|
|
1296
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1297
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1298
|
+
throw e;
|
|
1299
|
+
}
|
|
1300
|
+
const ret = wasm.session_open(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1301
|
+
var ptr3 = ret[0];
|
|
1302
|
+
var len3 = ret[1];
|
|
1303
|
+
if (ret[3]) {
|
|
1304
|
+
ptr3 = 0; len3 = 0;
|
|
1305
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1306
|
+
}
|
|
1307
|
+
deferred4_0 = ptr3;
|
|
1308
|
+
deferred4_1 = len3;
|
|
1309
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1310
|
+
} finally {
|
|
1311
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Whether the viewport's point `x`, `y` lies on a line of text.
|
|
1316
|
+
*
|
|
1317
|
+
* # Errors
|
|
1318
|
+
*
|
|
1319
|
+
* Throws when no document is open.
|
|
1320
|
+
* @param {number} x
|
|
1321
|
+
* @param {number} y
|
|
1322
|
+
* @returns {boolean}
|
|
1323
|
+
*/
|
|
1324
|
+
overText(x, y) {
|
|
1325
|
+
const ret = wasm.session_overText(this.__wbg_ptr, x, y);
|
|
1326
|
+
if (ret[2]) {
|
|
1327
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1328
|
+
}
|
|
1329
|
+
return ret[0] !== 0;
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* The hyperlinks of a page, counted from 0, as JSON: in reading order, each with its
|
|
1333
|
+
* `target`, `tooltip`, `text` and `boxes`, the boxes as shares of the page's width and
|
|
1334
|
+
* height.
|
|
1335
|
+
*
|
|
1336
|
+
* # Errors
|
|
1337
|
+
*
|
|
1338
|
+
* Throws when no document is open.
|
|
1339
|
+
* @param {number} page
|
|
1340
|
+
* @returns {string}
|
|
1341
|
+
*/
|
|
1342
|
+
pageLinks(page) {
|
|
1343
|
+
let deferred2_0;
|
|
1344
|
+
let deferred2_1;
|
|
1345
|
+
try {
|
|
1346
|
+
const ret = wasm.session_pageLinks(this.__wbg_ptr, page);
|
|
1347
|
+
var ptr1 = ret[0];
|
|
1348
|
+
var len1 = ret[1];
|
|
1349
|
+
if (ret[3]) {
|
|
1350
|
+
ptr1 = 0; len1 = 0;
|
|
1351
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1352
|
+
}
|
|
1353
|
+
deferred2_0 = ptr1;
|
|
1354
|
+
deferred2_1 = len1;
|
|
1355
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1356
|
+
} finally {
|
|
1357
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Writes the open document's pages as a PDF file, for printing.
|
|
1362
|
+
*
|
|
1363
|
+
* # Errors
|
|
1364
|
+
*
|
|
1365
|
+
* Throws when no document is open, or the pages cannot be written as PDF.
|
|
1366
|
+
* @returns {Uint8Array}
|
|
1367
|
+
*/
|
|
1368
|
+
pdf() {
|
|
1369
|
+
const ret = wasm.session_pdf(this.__wbg_ptr);
|
|
1370
|
+
if (ret[3]) {
|
|
1371
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1372
|
+
}
|
|
1373
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1374
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1375
|
+
return v1;
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Ends a press that the platform cancelled or whose capture it lost, and returns what it
|
|
1379
|
+
* did, as JSON ([`handled_json`]).
|
|
1380
|
+
*
|
|
1381
|
+
* # Errors
|
|
1382
|
+
*
|
|
1383
|
+
* Throws when no document is open.
|
|
1384
|
+
* @returns {string}
|
|
1385
|
+
*/
|
|
1386
|
+
pointerCancel() {
|
|
1387
|
+
let deferred2_0;
|
|
1388
|
+
let deferred2_1;
|
|
1389
|
+
try {
|
|
1390
|
+
const ret = wasm.session_pointerCancel(this.__wbg_ptr);
|
|
1391
|
+
var ptr1 = ret[0];
|
|
1392
|
+
var len1 = ret[1];
|
|
1393
|
+
if (ret[3]) {
|
|
1394
|
+
ptr1 = 0; len1 = 0;
|
|
1395
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1396
|
+
}
|
|
1397
|
+
deferred2_0 = ptr1;
|
|
1398
|
+
deferred2_1 = len1;
|
|
1399
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1400
|
+
} finally {
|
|
1401
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Takes a press at the viewport's point `x`, `y` at `time` milliseconds: whether of the
|
|
1406
|
+
* `primary` button, by a `pointer` of kind `mouse`, `pen` or `touch`, with `shift`, on a
|
|
1407
|
+
* `hit` of kind `page`, `gap`, `scroll-bar`, `start-handle` or `end-handle`. Returns what it did, as JSON
|
|
1408
|
+
* ([`handled_json`]).
|
|
1409
|
+
*
|
|
1410
|
+
* # Errors
|
|
1411
|
+
*
|
|
1412
|
+
* Throws when no document is open or a kind has another name.
|
|
1413
|
+
* @param {number} x
|
|
1414
|
+
* @param {number} y
|
|
1415
|
+
* @param {boolean} primary
|
|
1416
|
+
* @param {string} pointer
|
|
1417
|
+
* @param {boolean} shift
|
|
1418
|
+
* @param {number} time
|
|
1419
|
+
* @param {string} hit
|
|
1420
|
+
* @returns {string}
|
|
1421
|
+
*/
|
|
1422
|
+
pointerDown(x, y, primary, pointer, shift, time, hit) {
|
|
1423
|
+
let deferred9_0;
|
|
1424
|
+
let deferred9_1;
|
|
1425
|
+
try {
|
|
1426
|
+
const val3 = +x;
|
|
1427
|
+
const val4 = +y;
|
|
1428
|
+
const val5 = +primary;
|
|
1429
|
+
const val6 = +shift;
|
|
1430
|
+
const val7 = +time;
|
|
1431
|
+
let ptr0, len0, ptr1, len1;
|
|
1432
|
+
try {
|
|
1433
|
+
ptr0 = passStringToWasm0(pointer, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1434
|
+
len0 = WASM_VECTOR_LEN;
|
|
1435
|
+
ptr1 = passStringToWasm0(hit, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1436
|
+
len1 = WASM_VECTOR_LEN;
|
|
1437
|
+
} catch (e) {
|
|
1438
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1439
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1440
|
+
throw e;
|
|
1441
|
+
}
|
|
1442
|
+
const ret = wasm.session_pointerDown(this.__wbg_ptr, val3, val4, val5, ptr0, len0, val6, val7, ptr1, len1);
|
|
1443
|
+
var ptr8 = ret[0];
|
|
1444
|
+
var len8 = ret[1];
|
|
1445
|
+
if (ret[3]) {
|
|
1446
|
+
ptr8 = 0; len8 = 0;
|
|
1447
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1448
|
+
}
|
|
1449
|
+
deferred9_0 = ptr8;
|
|
1450
|
+
deferred9_1 = len8;
|
|
1451
|
+
return getStringFromWasm0(ptr8, len8);
|
|
1452
|
+
} finally {
|
|
1453
|
+
wasm.__wbindgen_free(deferred9_0, deferred9_1, 1);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Moves a press's pointer to the viewport's point `x`, `y` at `time` milliseconds, and
|
|
1458
|
+
* returns what it did, as JSON ([`handled_json`]).
|
|
1459
|
+
*
|
|
1460
|
+
* # Errors
|
|
1461
|
+
*
|
|
1462
|
+
* Throws when no document is open.
|
|
1463
|
+
* @param {number} x
|
|
1464
|
+
* @param {number} y
|
|
1465
|
+
* @param {number} time
|
|
1466
|
+
* @returns {string}
|
|
1467
|
+
*/
|
|
1468
|
+
pointerMove(x, y, time) {
|
|
1469
|
+
let deferred2_0;
|
|
1470
|
+
let deferred2_1;
|
|
1471
|
+
try {
|
|
1472
|
+
const ret = wasm.session_pointerMove(this.__wbg_ptr, x, y, time);
|
|
1473
|
+
var ptr1 = ret[0];
|
|
1474
|
+
var len1 = ret[1];
|
|
1475
|
+
if (ret[3]) {
|
|
1476
|
+
ptr1 = 0; len1 = 0;
|
|
1477
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1478
|
+
}
|
|
1479
|
+
deferred2_0 = ptr1;
|
|
1480
|
+
deferred2_1 = len1;
|
|
1481
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1482
|
+
} finally {
|
|
1483
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Ends a press at the viewport's point `x`, `y` at `time` milliseconds, and returns what
|
|
1488
|
+
* it did, as JSON ([`handled_json`]).
|
|
1489
|
+
*
|
|
1490
|
+
* # Errors
|
|
1491
|
+
*
|
|
1492
|
+
* Throws when no document is open.
|
|
1493
|
+
* @param {number} x
|
|
1494
|
+
* @param {number} y
|
|
1495
|
+
* @param {number} time
|
|
1496
|
+
* @returns {string}
|
|
1497
|
+
*/
|
|
1498
|
+
pointerUp(x, y, time) {
|
|
1499
|
+
let deferred2_0;
|
|
1500
|
+
let deferred2_1;
|
|
1501
|
+
try {
|
|
1502
|
+
const ret = wasm.session_pointerUp(this.__wbg_ptr, x, y, time);
|
|
1503
|
+
var ptr1 = ret[0];
|
|
1504
|
+
var len1 = ret[1];
|
|
1505
|
+
if (ret[3]) {
|
|
1506
|
+
ptr1 = 0; len1 = 0;
|
|
1507
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1508
|
+
}
|
|
1509
|
+
deferred2_0 = ptr1;
|
|
1510
|
+
deferred2_1 = len1;
|
|
1511
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1512
|
+
} finally {
|
|
1513
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Draws a page at a resolution for the browser's own Print, without counting the
|
|
1518
|
+
* drawing as the shell's.
|
|
1519
|
+
*
|
|
1520
|
+
* # Errors
|
|
1521
|
+
*
|
|
1522
|
+
* Throws when no document is open, or the page does not exist or cannot be drawn.
|
|
1523
|
+
* @param {number} page
|
|
1524
|
+
* @param {number} dpi
|
|
1525
|
+
* @returns {Drawing}
|
|
1526
|
+
*/
|
|
1527
|
+
printPage(page, dpi) {
|
|
1528
|
+
const ret = wasm.session_printPage(this.__wbg_ptr, page, dpi);
|
|
1529
|
+
if (ret[2]) {
|
|
1530
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1531
|
+
}
|
|
1532
|
+
return Drawing.__wrap(ret[0]);
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* The reading text of a page, counted from 0, as JSON: its paragraphs in reading order,
|
|
1536
|
+
* each with its `text` and its outline `level` or null.
|
|
1537
|
+
*
|
|
1538
|
+
* # Errors
|
|
1539
|
+
*
|
|
1540
|
+
* Throws when no document is open.
|
|
1541
|
+
* @param {number} page
|
|
1542
|
+
* @returns {string}
|
|
1543
|
+
*/
|
|
1544
|
+
readingText(page) {
|
|
1545
|
+
let deferred2_0;
|
|
1546
|
+
let deferred2_1;
|
|
1547
|
+
try {
|
|
1548
|
+
const ret = wasm.session_readingText(this.__wbg_ptr, page);
|
|
1549
|
+
var ptr1 = ret[0];
|
|
1550
|
+
var len1 = ret[1];
|
|
1551
|
+
if (ret[3]) {
|
|
1552
|
+
ptr1 = 0; len1 = 0;
|
|
1553
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1554
|
+
}
|
|
1555
|
+
deferred2_0 = ptr1;
|
|
1556
|
+
deferred2_1 = len1;
|
|
1557
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1558
|
+
} finally {
|
|
1559
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Gives the viewer the viewport's size in CSS pixels and the device pixel ratio.
|
|
1564
|
+
*
|
|
1565
|
+
* # Errors
|
|
1566
|
+
*
|
|
1567
|
+
* Throws when no document is open.
|
|
1568
|
+
* @param {number} width
|
|
1569
|
+
* @param {number} height
|
|
1570
|
+
* @param {number} ratio
|
|
1571
|
+
*/
|
|
1572
|
+
resize(width, height, ratio) {
|
|
1573
|
+
const ret = wasm.session_resize(this.__wbg_ptr, width, height, ratio);
|
|
1574
|
+
if (ret[1]) {
|
|
1575
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Scrolls to `page`, optionally focusing a point-space rectangle with `block` placement.
|
|
1580
|
+
*
|
|
1581
|
+
* # Errors
|
|
1582
|
+
*
|
|
1583
|
+
* Throws when no document is open.
|
|
1584
|
+
* @param {number} page
|
|
1585
|
+
* @param {number | null} [left]
|
|
1586
|
+
* @param {number | null} [top]
|
|
1587
|
+
* @param {number | null} [width]
|
|
1588
|
+
* @param {number | null} [height]
|
|
1589
|
+
* @param {string | null} [block]
|
|
1590
|
+
*/
|
|
1591
|
+
scrollToRect(page, left, top, width, height, block) {
|
|
1592
|
+
const val2 = +page;
|
|
1593
|
+
const val3 = +(isLikeNone(left) ? 0 : left);
|
|
1594
|
+
const val4 = +(isLikeNone(top) ? 0 : top);
|
|
1595
|
+
const val5 = +(isLikeNone(width) ? 0 : width);
|
|
1596
|
+
const val6 = +(isLikeNone(height) ? 0 : height);
|
|
1597
|
+
var ptr0 = isLikeNone(block) ? 0 : passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1598
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1599
|
+
const ret = wasm.session_scrollToRect(this.__wbg_ptr, val2, !isLikeNone(left), val3, !isLikeNone(top), val4, !isLikeNone(width), val5, !isLikeNone(height), val6, ptr0, len0);
|
|
1600
|
+
if (ret[1]) {
|
|
1601
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Scrolls the viewport's top left corner to `(left, top)`.
|
|
1606
|
+
*
|
|
1607
|
+
* # Errors
|
|
1608
|
+
*
|
|
1609
|
+
* Throws when no document is open.
|
|
1610
|
+
* @param {number} left
|
|
1611
|
+
* @param {number} top
|
|
1612
|
+
*/
|
|
1613
|
+
scrollTo(left, top) {
|
|
1614
|
+
const ret = wasm.session_scrollTo(this.__wbg_ptr, left, top);
|
|
1615
|
+
if (ret[1]) {
|
|
1616
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Selects the whole story of the last press.
|
|
1621
|
+
*
|
|
1622
|
+
* # Errors
|
|
1623
|
+
*
|
|
1624
|
+
* Throws when no document is open.
|
|
1625
|
+
*/
|
|
1626
|
+
selectAll() {
|
|
1627
|
+
const ret = wasm.session_selectAll(this.__wbg_ptr);
|
|
1628
|
+
if (ret[1]) {
|
|
1629
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* The selected text, as a copy gives it.
|
|
1634
|
+
*
|
|
1635
|
+
* # Errors
|
|
1636
|
+
*
|
|
1637
|
+
* Throws when no document is open.
|
|
1638
|
+
* @returns {string}
|
|
1639
|
+
*/
|
|
1640
|
+
selectedText() {
|
|
1641
|
+
let deferred2_0;
|
|
1642
|
+
let deferred2_1;
|
|
1643
|
+
try {
|
|
1644
|
+
const ret = wasm.session_selectedText(this.__wbg_ptr);
|
|
1645
|
+
var ptr1 = ret[0];
|
|
1646
|
+
var len1 = ret[1];
|
|
1647
|
+
if (ret[3]) {
|
|
1648
|
+
ptr1 = 0; len1 = 0;
|
|
1649
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1650
|
+
}
|
|
1651
|
+
deferred2_0 = ptr1;
|
|
1652
|
+
deferred2_1 = len1;
|
|
1653
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1654
|
+
} finally {
|
|
1655
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Replaces caller-supplied highlights from a JSON array string.
|
|
1660
|
+
*
|
|
1661
|
+
* # Errors
|
|
1662
|
+
*
|
|
1663
|
+
* Throws when no document is open or JSON is malformed.
|
|
1664
|
+
* @param {string} items_json
|
|
1665
|
+
*/
|
|
1666
|
+
setHighlights(items_json) {
|
|
1667
|
+
const ptr0 = passStringToWasm0(items_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1668
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1669
|
+
const ret = wasm.session_setHighlights(this.__wbg_ptr, ptr0, len0);
|
|
1670
|
+
if (ret[1]) {
|
|
1671
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Enables or disables two-pass progressive drawing (fast 96 DPI draft before `HiDPI`).
|
|
1676
|
+
* @param {boolean} enabled
|
|
1677
|
+
*/
|
|
1678
|
+
setProgressiveDraft(enabled) {
|
|
1679
|
+
wasm.session_setProgressiveDraft(this.__wbg_ptr, enabled);
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Sets the zoom, `fixed` at `factor`, `fit-width` or `fit-page`, around the anchor or the
|
|
1683
|
+
* viewport's middle ([`Session::set_zoom`]).
|
|
1684
|
+
*
|
|
1685
|
+
* # Errors
|
|
1686
|
+
*
|
|
1687
|
+
* Throws when no document is open or the kind is no zoom.
|
|
1688
|
+
* @param {string} kind
|
|
1689
|
+
* @param {number} factor
|
|
1690
|
+
* @param {number | null} [anchor_x]
|
|
1691
|
+
* @param {number | null} [anchor_y]
|
|
1692
|
+
*/
|
|
1693
|
+
setZoom(kind, factor, anchor_x, anchor_y) {
|
|
1694
|
+
const val2 = +factor;
|
|
1695
|
+
const val3 = +(isLikeNone(anchor_x) ? 0 : anchor_x);
|
|
1696
|
+
const val4 = +(isLikeNone(anchor_y) ? 0 : anchor_y);
|
|
1697
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1698
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1699
|
+
const ret = wasm.session_setZoom(this.__wbg_ptr, ptr0, len0, val2, !isLikeNone(anchor_x), val3, !isLikeNone(anchor_y), val4);
|
|
1700
|
+
if (ret[1]) {
|
|
1701
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Scrolls a point in points of a page, counted from 0, to the viewport's top left corner,
|
|
1706
|
+
* as the frame's `place` gave it.
|
|
1707
|
+
*
|
|
1708
|
+
* # Errors
|
|
1709
|
+
*
|
|
1710
|
+
* Throws when no document is open.
|
|
1711
|
+
* @param {number} page
|
|
1712
|
+
* @param {number} x
|
|
1713
|
+
* @param {number} y
|
|
1714
|
+
*/
|
|
1715
|
+
showPlace(page, x, y) {
|
|
1716
|
+
const ret = wasm.session_showPlace(this.__wbg_ptr, page, x, y);
|
|
1717
|
+
if (ret[1]) {
|
|
1718
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
/**
|
|
1722
|
+
* Opens and parses `docx` once, stages it on the session for [`JsSession::begin_open_staged`],
|
|
1723
|
+
* and returns its font needs as JSON without running a dummy layout pass.
|
|
1724
|
+
*
|
|
1725
|
+
* # Errors
|
|
1726
|
+
*
|
|
1727
|
+
* Throws when no target has the ID or the file cannot be opened.
|
|
1728
|
+
* @param {Uint8Array | number[]} docx
|
|
1729
|
+
* @param {string | null} [target]
|
|
1730
|
+
* @returns {string}
|
|
1731
|
+
*/
|
|
1732
|
+
stageDocx(docx, target) {
|
|
1733
|
+
let deferred4_0;
|
|
1734
|
+
let deferred4_1;
|
|
1735
|
+
try {
|
|
1736
|
+
let ptr0, len0, ptr1, len1;
|
|
1737
|
+
try {
|
|
1738
|
+
ptr0 = passArray8ToWasm0(docx, wasm.__wbindgen_malloc);
|
|
1739
|
+
len0 = WASM_VECTOR_LEN;
|
|
1740
|
+
ptr1 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1741
|
+
len1 = WASM_VECTOR_LEN;
|
|
1742
|
+
} catch (e) {
|
|
1743
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1744
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
1745
|
+
throw e;
|
|
1746
|
+
}
|
|
1747
|
+
const ret = wasm.session_stageDocx(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1748
|
+
var ptr3 = ret[0];
|
|
1749
|
+
var len3 = ret[1];
|
|
1750
|
+
if (ret[3]) {
|
|
1751
|
+
ptr3 = 0; len3 = 0;
|
|
1752
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1753
|
+
}
|
|
1754
|
+
deferred4_0 = ptr3;
|
|
1755
|
+
deferred4_1 = len3;
|
|
1756
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1757
|
+
} finally {
|
|
1758
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Opens and parses a random-access DOCX source once, stages it on the session for
|
|
1763
|
+
* [`JsSession::begin_open_staged`], and returns its font needs as JSON without running a
|
|
1764
|
+
* dummy layout pass.
|
|
1765
|
+
*
|
|
1766
|
+
* # Errors
|
|
1767
|
+
*
|
|
1768
|
+
* Throws when `byteLength` is invalid, no target has the ID, or the source cannot be opened.
|
|
1769
|
+
* @param {number} byte_length
|
|
1770
|
+
* @param {Function} read_at
|
|
1771
|
+
* @param {string | null} [target]
|
|
1772
|
+
* @returns {string}
|
|
1773
|
+
*/
|
|
1774
|
+
stageSource(byte_length, read_at, target) {
|
|
1775
|
+
let deferred4_0;
|
|
1776
|
+
let deferred4_1;
|
|
1777
|
+
try {
|
|
1778
|
+
const val2 = +byte_length;
|
|
1779
|
+
var ptr0 = isLikeNone(target) ? 0 : passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1780
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1781
|
+
const ret = wasm.session_stageSource(this.__wbg_ptr, val2, read_at, ptr0, len0);
|
|
1782
|
+
var ptr3 = ret[0];
|
|
1783
|
+
var len3 = ret[1];
|
|
1784
|
+
if (ret[3]) {
|
|
1785
|
+
ptr3 = 0; len3 = 0;
|
|
1786
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1787
|
+
}
|
|
1788
|
+
deferred4_0 = ptr3;
|
|
1789
|
+
deferred4_1 = len3;
|
|
1790
|
+
return getStringFromWasm0(ptr3, len3);
|
|
1791
|
+
} finally {
|
|
1792
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Advances incremental layout by up to `maxBlocks` body blocks and returns updated page
|
|
1797
|
+
* count, outline, invalidated pages, and completion progress as JSON.
|
|
1798
|
+
*
|
|
1799
|
+
* # Errors
|
|
1800
|
+
*
|
|
1801
|
+
* Throws when no document is open or layout fails.
|
|
1802
|
+
* @param {number} max_blocks
|
|
1803
|
+
* @returns {string}
|
|
1804
|
+
*/
|
|
1805
|
+
stepLayout(max_blocks) {
|
|
1806
|
+
let deferred2_0;
|
|
1807
|
+
let deferred2_1;
|
|
1808
|
+
try {
|
|
1809
|
+
const ret = wasm.session_stepLayout(this.__wbg_ptr, max_blocks);
|
|
1810
|
+
var ptr1 = ret[0];
|
|
1811
|
+
var len1 = ret[1];
|
|
1812
|
+
if (ret[3]) {
|
|
1813
|
+
ptr1 = 0; len1 = 0;
|
|
1814
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1815
|
+
}
|
|
1816
|
+
deferred2_0 = ptr1;
|
|
1817
|
+
deferred2_1 = len1;
|
|
1818
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1819
|
+
} finally {
|
|
1820
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Streams the open document's pages as a PDF to `onChunk(chunk: Uint8Array)` in bounded
|
|
1825
|
+
* 64 KiB chunks without allocating the full PDF in WASM linear memory.
|
|
1826
|
+
*
|
|
1827
|
+
* # Errors
|
|
1828
|
+
*
|
|
1829
|
+
* Throws when no document is open, or the pages cannot be written as PDF.
|
|
1830
|
+
* @param {Function} on_chunk
|
|
1831
|
+
*/
|
|
1832
|
+
writePdfTo(on_chunk) {
|
|
1833
|
+
const ret = wasm.session_writePdfTo(this.__wbg_ptr, on_chunk);
|
|
1834
|
+
if (ret[1]) {
|
|
1835
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Zooms one step in or out around the anchor or the viewport's middle.
|
|
1840
|
+
*
|
|
1841
|
+
* # Errors
|
|
1842
|
+
*
|
|
1843
|
+
* Throws when no document is open.
|
|
1844
|
+
* @param {boolean} inward
|
|
1845
|
+
* @param {number | null} [anchor_x]
|
|
1846
|
+
* @param {number | null} [anchor_y]
|
|
1847
|
+
*/
|
|
1848
|
+
zoomStep(inward, anchor_x, anchor_y) {
|
|
1849
|
+
const ret = wasm.session_zoomStep(this.__wbg_ptr, inward, !isLikeNone(anchor_x), isLikeNone(anchor_x) ? 0 : anchor_x, !isLikeNone(anchor_y), isLikeNone(anchor_y) ? 0 : anchor_y);
|
|
1850
|
+
if (ret[1]) {
|
|
1851
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* A run of upright text on a page, in points from the page's top left corner: the box of its
|
|
1859
|
+
* glyphs from its font's ascender to its descender, and its glyphs.
|
|
1860
|
+
*/
|
|
1861
|
+
export class TextRun {
|
|
1862
|
+
static __wrap(ptr) {
|
|
1863
|
+
const obj = Object.create(TextRun.prototype);
|
|
1864
|
+
obj.__wbg_ptr = ptr;
|
|
1865
|
+
TextRunFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1866
|
+
return obj;
|
|
1867
|
+
}
|
|
1868
|
+
__destroy_into_raw() {
|
|
1869
|
+
const ptr = this.__wbg_ptr;
|
|
1870
|
+
this.__wbg_ptr = 0;
|
|
1871
|
+
TextRunFinalization.unregister(this);
|
|
1872
|
+
return ptr;
|
|
1873
|
+
}
|
|
1874
|
+
free() {
|
|
1875
|
+
const ptr = this.__destroy_into_raw();
|
|
1876
|
+
wasm.__wbg_textrun_free(ptr, 0);
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* The baseline.
|
|
1880
|
+
* @returns {number}
|
|
1881
|
+
*/
|
|
1882
|
+
get baseline() {
|
|
1883
|
+
const ret = wasm.textrun_baseline(this.__wbg_ptr);
|
|
1884
|
+
return ret;
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* The end of each glyph's text in `text`, counted in UTF-16 code units as JavaScript
|
|
1888
|
+
* counts a string's characters.
|
|
1889
|
+
* @returns {Uint32Array}
|
|
1890
|
+
*/
|
|
1891
|
+
get glyphEnds() {
|
|
1892
|
+
const ret = wasm.textrun_glyphEnds(this.__wbg_ptr);
|
|
1893
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1894
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1895
|
+
return v1;
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* The left edge of each glyph's cell, in the order of the text.
|
|
1899
|
+
* @returns {Float64Array}
|
|
1900
|
+
*/
|
|
1901
|
+
get glyphLefts() {
|
|
1902
|
+
const ret = wasm.textrun_glyphLefts(this.__wbg_ptr);
|
|
1903
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1904
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1905
|
+
return v1;
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* The advance of each glyph.
|
|
1909
|
+
* @returns {Float64Array}
|
|
1910
|
+
*/
|
|
1911
|
+
get glyphWidths() {
|
|
1912
|
+
const ret = wasm.textrun_glyphWidths(this.__wbg_ptr);
|
|
1913
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1914
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1915
|
+
return v1;
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* The height of the box.
|
|
1919
|
+
* @returns {number}
|
|
1920
|
+
*/
|
|
1921
|
+
get height() {
|
|
1922
|
+
const ret = wasm.textrun_height(this.__wbg_ptr);
|
|
1923
|
+
return ret;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* The left edge of the box.
|
|
1927
|
+
* @returns {number}
|
|
1928
|
+
*/
|
|
1929
|
+
get left() {
|
|
1930
|
+
const ret = wasm.textrun_left(this.__wbg_ptr);
|
|
1931
|
+
return ret;
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* The font size.
|
|
1935
|
+
* @returns {number}
|
|
1936
|
+
*/
|
|
1937
|
+
get size() {
|
|
1938
|
+
const ret = wasm.textrun_size(this.__wbg_ptr);
|
|
1939
|
+
return ret;
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* The text that the glyphs show.
|
|
1943
|
+
* @returns {string}
|
|
1944
|
+
*/
|
|
1945
|
+
get text() {
|
|
1946
|
+
let deferred1_0;
|
|
1947
|
+
let deferred1_1;
|
|
1948
|
+
try {
|
|
1949
|
+
const ret = wasm.textrun_text(this.__wbg_ptr);
|
|
1950
|
+
deferred1_0 = ret[0];
|
|
1951
|
+
deferred1_1 = ret[1];
|
|
1952
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1953
|
+
} finally {
|
|
1954
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* The top edge of the box.
|
|
1959
|
+
* @returns {number}
|
|
1960
|
+
*/
|
|
1961
|
+
get top() {
|
|
1962
|
+
const ret = wasm.textrun_top(this.__wbg_ptr);
|
|
1963
|
+
return ret;
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* The width of the box.
|
|
1967
|
+
* @returns {number}
|
|
1968
|
+
*/
|
|
1969
|
+
get width() {
|
|
1970
|
+
const ret = wasm.textrun_width(this.__wbg_ptr);
|
|
1971
|
+
return ret;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
if (Symbol.dispose) TextRun.prototype[Symbol.dispose] = TextRun.prototype.free;
|
|
1975
|
+
function __wbg_get_imports() {
|
|
1976
|
+
const import0 = {
|
|
1977
|
+
__proto__: null,
|
|
1978
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
1979
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1980
|
+
return ret;
|
|
1981
|
+
},
|
|
1982
|
+
__wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
|
|
1983
|
+
const ret = debugString(arg1);
|
|
1984
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1985
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1986
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
1987
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
1988
|
+
},
|
|
1989
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
1990
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1991
|
+
},
|
|
1992
|
+
__wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1993
|
+
const ret = arg0.call(arg1, arg2);
|
|
1994
|
+
return ret;
|
|
1995
|
+
}, arguments); },
|
|
1996
|
+
__wbg_call_fc92fee6137d452d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1997
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1998
|
+
return ret;
|
|
1999
|
+
}, arguments); },
|
|
2000
|
+
__wbg_fontneed_new: function(arg0) {
|
|
2001
|
+
const ret = FontNeed.__wrap(arg0);
|
|
2002
|
+
return ret;
|
|
2003
|
+
},
|
|
2004
|
+
__wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
|
|
2005
|
+
let result;
|
|
2006
|
+
try {
|
|
2007
|
+
result = arg0 instanceof Uint8Array;
|
|
2008
|
+
} catch (_) {
|
|
2009
|
+
result = false;
|
|
2010
|
+
}
|
|
2011
|
+
const ret = result;
|
|
2012
|
+
return ret;
|
|
2013
|
+
},
|
|
2014
|
+
__wbg_length_186163212ffe79c3: function(arg0) {
|
|
2015
|
+
const ret = arg0.length;
|
|
2016
|
+
return ret;
|
|
910
2017
|
},
|
|
911
2018
|
__wbg_new_from_slice_b8daf545a41c6aa0: function(arg0, arg1) {
|
|
912
2019
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
@@ -963,6 +2070,9 @@ function __wbg_get_imports() {
|
|
|
963
2070
|
const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
964
2071
|
? { register: () => {}, unregister: () => {} }
|
|
965
2072
|
: new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr, 1));
|
|
2073
|
+
const DrawingFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2074
|
+
? { register: () => {}, unregister: () => {} }
|
|
2075
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_drawing_free(ptr, 1));
|
|
966
2076
|
const FontNeedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
967
2077
|
? { register: () => {}, unregister: () => {} }
|
|
968
2078
|
: new FinalizationRegistry(ptr => wasm.__wbg_fontneed_free(ptr, 1));
|
|
@@ -978,6 +2088,9 @@ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
978
2088
|
const SearchMatchFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
979
2089
|
? { register: () => {}, unregister: () => {} }
|
|
980
2090
|
: new FinalizationRegistry(ptr => wasm.__wbg_searchmatch_free(ptr, 1));
|
|
2091
|
+
const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2092
|
+
? { register: () => {}, unregister: () => {} }
|
|
2093
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr, 1));
|
|
981
2094
|
const TextRunFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
982
2095
|
? { register: () => {}, unregister: () => {} }
|
|
983
2096
|
: new FinalizationRegistry(ptr => wasm.__wbg_textrun_free(ptr, 1));
|