@docvyu/sdk 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +47 -32
  2. package/dist/cdn/docvyu.js +2268 -120
  3. package/dist/cdn/docvyu.min.js +1 -1
  4. package/dist/cjs/DocvyuEditor-BOTw6i4d.js +1 -0
  5. package/dist/cjs/index.js +1 -1
  6. package/dist/cjs/react/index.js +1 -1
  7. package/dist/esm/DocvyuEditor-CDLqMpaq.js +1 -0
  8. package/dist/esm/index.js +1 -1
  9. package/dist/esm/react/index.js +1 -1
  10. package/dist/types/app/DocvyuApp.d.ts +187 -0
  11. package/dist/types/app/index.d.ts +0 -2
  12. package/dist/types/core/DocvyuEditor.d.ts +402 -57
  13. package/dist/types/core/index.d.ts +1 -1
  14. package/dist/types/i18n/types.d.ts +128 -0
  15. package/dist/wasm/docvyu_core.d.ts +8 -182
  16. package/dist/wasm/docvyu_core.js +1 -1
  17. package/dist/wasm/docvyu_core_bg.wasm +0 -0
  18. package/dist/wasm/docvyu_core_bg.wasm.d.ts +0 -56
  19. package/package.json +2 -2
  20. package/wasm/docvyu_core.d.ts +8 -182
  21. package/wasm/docvyu_core.js +1297 -200
  22. package/wasm/docvyu_core_bg.wasm +0 -0
  23. package/wasm/docvyu_core_bg.wasm.d.ts +0 -56
  24. package/dist/cjs/DocvyuEditor-CwMF2qhs.js +0 -1
  25. package/dist/esm/DocvyuEditor-CCAFPhSl.js +0 -1
  26. package/dist/types/app/DocvyuApp.test.d.ts +0 -1
  27. package/dist/types/app/styles.d.ts +0 -10
  28. package/dist/types/app/template.d.ts +0 -9
  29. package/dist/types/core/DocvyuEditor.test.d.ts +0 -4
  30. package/dist/types/i18n/I18nManager.test.d.ts +0 -4
  31. package/dist/types/license/LicenseManager.test.d.ts +0 -4
  32. package/dist/wasm/docuweave_core.d.ts +0 -207
  33. package/dist/wasm/docuweave_core.js +0 -988
  34. package/dist/wasm/docuweave_core_bg.wasm +0 -0
  35. package/dist/wasm/docuweave_core_bg.wasm.d.ts +0 -59
@@ -1,988 +0,0 @@
1
- let wasm;
2
-
3
- let heap = new Array(128).fill(undefined);
4
-
5
- heap.push(undefined, null, true, false);
6
-
7
- function getObject(idx) { return heap[idx]; }
8
-
9
- function debugString(val) {
10
- // primitive types
11
- const type = typeof val;
12
- if (type == 'number' || type == 'boolean' || val == null) {
13
- return `${val}`;
14
- }
15
- if (type == 'string') {
16
- return `"${val}"`;
17
- }
18
- if (type == 'symbol') {
19
- const description = val.description;
20
- if (description == null) {
21
- return 'Symbol';
22
- } else {
23
- return `Symbol(${description})`;
24
- }
25
- }
26
- if (type == 'function') {
27
- const name = val.name;
28
- if (typeof name == 'string' && name.length > 0) {
29
- return `Function(${name})`;
30
- } else {
31
- return 'Function';
32
- }
33
- }
34
- // objects
35
- if (Array.isArray(val)) {
36
- const length = val.length;
37
- let debug = '[';
38
- if (length > 0) {
39
- debug += debugString(val[0]);
40
- }
41
- for(let i = 1; i < length; i++) {
42
- debug += ', ' + debugString(val[i]);
43
- }
44
- debug += ']';
45
- return debug;
46
- }
47
- // Test for built-in
48
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
49
- let className;
50
- if (builtInMatches && builtInMatches.length > 1) {
51
- className = builtInMatches[1];
52
- } else {
53
- // Failed to match the standard '[object ClassName]'
54
- return toString.call(val);
55
- }
56
- if (className == 'Object') {
57
- // we're a user defined class or Object
58
- // JSON.stringify avoids problems with cycles, and is generally much
59
- // easier than looping through ownProperties of `val`.
60
- try {
61
- return 'Object(' + JSON.stringify(val) + ')';
62
- } catch (_) {
63
- return 'Object';
64
- }
65
- }
66
- // errors
67
- if (val instanceof Error) {
68
- return `${val.name}: ${val.message}\n${val.stack}`;
69
- }
70
- // TODO we could test for more things here, like `Set`s and `Map`s.
71
- return className;
72
- }
73
-
74
- let WASM_VECTOR_LEN = 0;
75
-
76
- let cachedUint8ArrayMemory0 = null;
77
-
78
- function getUint8ArrayMemory0() {
79
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
80
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
81
- }
82
- return cachedUint8ArrayMemory0;
83
- }
84
-
85
- const cachedTextEncoder = new TextEncoder();
86
-
87
- if (!('encodeInto' in cachedTextEncoder)) {
88
- cachedTextEncoder.encodeInto = function (arg, view) {
89
- const buf = cachedTextEncoder.encode(arg);
90
- view.set(buf);
91
- return {
92
- read: arg.length,
93
- written: buf.length
94
- };
95
- }
96
- }
97
-
98
- function passStringToWasm0(arg, malloc, realloc) {
99
-
100
- if (realloc === undefined) {
101
- const buf = cachedTextEncoder.encode(arg);
102
- const ptr = malloc(buf.length, 1) >>> 0;
103
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
104
- WASM_VECTOR_LEN = buf.length;
105
- return ptr;
106
- }
107
-
108
- let len = arg.length;
109
- let ptr = malloc(len, 1) >>> 0;
110
-
111
- const mem = getUint8ArrayMemory0();
112
-
113
- let offset = 0;
114
-
115
- for (; offset < len; offset++) {
116
- const code = arg.charCodeAt(offset);
117
- if (code > 0x7F) break;
118
- mem[ptr + offset] = code;
119
- }
120
-
121
- if (offset !== len) {
122
- if (offset !== 0) {
123
- arg = arg.slice(offset);
124
- }
125
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
126
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
127
- const ret = cachedTextEncoder.encodeInto(arg, view);
128
-
129
- offset += ret.written;
130
- ptr = realloc(ptr, len, offset, 1) >>> 0;
131
- }
132
-
133
- WASM_VECTOR_LEN = offset;
134
- return ptr;
135
- }
136
-
137
- let cachedDataViewMemory0 = null;
138
-
139
- function getDataViewMemory0() {
140
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
141
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
142
- }
143
- return cachedDataViewMemory0;
144
- }
145
-
146
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
147
-
148
- cachedTextDecoder.decode();
149
-
150
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
151
- let numBytesDecoded = 0;
152
- function decodeText(ptr, len) {
153
- numBytesDecoded += len;
154
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
155
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
156
- cachedTextDecoder.decode();
157
- numBytesDecoded = len;
158
- }
159
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
160
- }
161
-
162
- function getStringFromWasm0(ptr, len) {
163
- ptr = ptr >>> 0;
164
- return decodeText(ptr, len);
165
- }
166
-
167
- let heap_next = heap.length;
168
-
169
- function addHeapObject(obj) {
170
- if (heap_next === heap.length) heap.push(heap.length + 1);
171
- const idx = heap_next;
172
- heap_next = heap[idx];
173
-
174
- heap[idx] = obj;
175
- return idx;
176
- }
177
-
178
- function handleError(f, args) {
179
- try {
180
- return f.apply(this, args);
181
- } catch (e) {
182
- wasm.__wbindgen_export3(addHeapObject(e));
183
- }
184
- }
185
-
186
- function isLikeNone(x) {
187
- return x === undefined || x === null;
188
- }
189
-
190
- function dropObject(idx) {
191
- if (idx < 132) return;
192
- heap[idx] = heap_next;
193
- heap_next = idx;
194
- }
195
-
196
- function takeObject(idx) {
197
- const ret = getObject(idx);
198
- dropObject(idx);
199
- return ret;
200
- }
201
-
202
- function getArrayU8FromWasm0(ptr, len) {
203
- ptr = ptr >>> 0;
204
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
205
- }
206
-
207
- function passArray8ToWasm0(arg, malloc) {
208
- const ptr = malloc(arg.length * 1, 1) >>> 0;
209
- getUint8ArrayMemory0().set(arg, ptr / 1);
210
- WASM_VECTOR_LEN = arg.length;
211
- return ptr;
212
- }
213
- /**
214
- * Unit for ruler display
215
- * @enum {0 | 1}
216
- */
217
- export const RulerUnit = Object.freeze({
218
- Centimeters: 0, "0": "Centimeters",
219
- Inches: 1, "1": "Inches",
220
- });
221
-
222
- const EditorFinalization = (typeof FinalizationRegistry === 'undefined')
223
- ? { register: () => {}, unregister: () => {} }
224
- : new FinalizationRegistry(ptr => wasm.__wbg_editor_free(ptr >>> 0, 1));
225
-
226
- export class Editor {
227
-
228
- __destroy_into_raw() {
229
- const ptr = this.__wbg_ptr;
230
- this.__wbg_ptr = 0;
231
- EditorFinalization.unregister(this);
232
- return ptr;
233
- }
234
-
235
- free() {
236
- const ptr = this.__destroy_into_raw();
237
- wasm.__wbg_editor_free(ptr, 0);
238
- }
239
- /**
240
- * @param {boolean} enable
241
- */
242
- set_italic(enable) {
243
- wasm.editor_set_italic(this.__wbg_ptr, enable);
244
- }
245
- /**
246
- * @param {string} key
247
- */
248
- on_key_down(key) {
249
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
250
- const len0 = WASM_VECTOR_LEN;
251
- wasm.editor_on_key_down(this.__wbg_ptr, ptr0, len0);
252
- }
253
- select_word() {
254
- wasm.editor_select_word(this.__wbg_ptr);
255
- }
256
- /**
257
- * Get current page size name (or "custom" if not matching any preset)
258
- * @returns {string}
259
- */
260
- get_page_size() {
261
- let deferred1_0;
262
- let deferred1_1;
263
- try {
264
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
- wasm.editor_get_page_size(retptr, this.__wbg_ptr);
266
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
267
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
268
- deferred1_0 = r0;
269
- deferred1_1 = r1;
270
- return getStringFromWasm0(r0, r1);
271
- } finally {
272
- wasm.__wbindgen_add_to_stack_pointer(16);
273
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
274
- }
275
- }
276
- /**
277
- * Check if the current paragraph has any numbering
278
- * @returns {boolean}
279
- */
280
- has_numbering() {
281
- const ret = wasm.editor_has_numbering(this.__wbg_ptr);
282
- return ret !== 0;
283
- }
284
- /**
285
- * @param {number} click_x
286
- * @param {number} click_y
287
- */
288
- on_mouse_drag(click_x, click_y) {
289
- wasm.editor_on_mouse_drag(this.__wbg_ptr, click_x, click_y);
290
- }
291
- /**
292
- * @returns {Uint8Array}
293
- */
294
- save_document() {
295
- try {
296
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
297
- wasm.editor_save_document(retptr, this.__wbg_ptr);
298
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
299
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
300
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
301
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
302
- if (r3) {
303
- throw takeObject(r2);
304
- }
305
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
306
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
307
- return v1;
308
- } finally {
309
- wasm.__wbindgen_add_to_stack_pointer(16);
310
- }
311
- }
312
- /**
313
- * @param {number} size
314
- */
315
- set_font_size(size) {
316
- wasm.editor_set_font_size(this.__wbg_ptr, size);
317
- }
318
- /**
319
- * Set page size using predefined sizes
320
- * Sizes: "letter", "legal", "a4", "a5", "b5"
321
- * @param {string} size_name
322
- */
323
- set_page_size(size_name) {
324
- const ptr0 = passStringToWasm0(size_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
325
- const len0 = WASM_VECTOR_LEN;
326
- wasm.editor_set_page_size(this.__wbg_ptr, ptr0, len0);
327
- }
328
- /**
329
- * @param {boolean} enable
330
- */
331
- set_underline(enable) {
332
- wasm.editor_set_underline(this.__wbg_ptr, enable);
333
- }
334
- /**
335
- * Get current ruler unit
336
- * @returns {RulerUnit}
337
- */
338
- get_ruler_unit() {
339
- const ret = wasm.editor_get_ruler_unit(this.__wbg_ptr);
340
- return ret;
341
- }
342
- /**
343
- * @param {number} click_x
344
- * @param {number} click_y
345
- */
346
- on_mouse_click(click_x, click_y) {
347
- wasm.editor_on_mouse_click(this.__wbg_ptr, click_x, click_y);
348
- }
349
- /**
350
- * @param {string} color
351
- */
352
- set_font_color(color) {
353
- const ptr0 = passStringToWasm0(color, wasm.__wbindgen_export, wasm.__wbindgen_export2);
354
- const len0 = WASM_VECTOR_LEN;
355
- wasm.editor_set_font_color(this.__wbg_ptr, ptr0, len0);
356
- }
357
- /**
358
- * Set ruler unit (centimeters or inches)
359
- * @param {RulerUnit} unit
360
- */
361
- set_ruler_unit(unit) {
362
- wasm.editor_set_ruler_unit(this.__wbg_ptr, unit);
363
- }
364
- /**
365
- * Check if the current paragraph has bullet list numbering
366
- * @returns {boolean}
367
- */
368
- has_bullet_list() {
369
- const ret = wasm.editor_has_bullet_list(this.__wbg_ptr);
370
- return ret !== 0;
371
- }
372
- reset_font_size() {
373
- wasm.editor_reset_font_size(this.__wbg_ptr);
374
- }
375
- select_document() {
376
- wasm.editor_select_document(this.__wbg_ptr);
377
- }
378
- /**
379
- * Set bullet list for the current selection or cursor position
380
- * Uses num_id=101 by convention for bullet lists
381
- * @param {boolean} enable
382
- */
383
- set_bullet_list(enable) {
384
- wasm.editor_set_bullet_list(this.__wbg_ptr, enable);
385
- }
386
- /**
387
- * @param {string} family
388
- */
389
- set_font_family(family) {
390
- const ptr0 = passStringToWasm0(family, wasm.__wbindgen_export, wasm.__wbindgen_export2);
391
- const len0 = WASM_VECTOR_LEN;
392
- wasm.editor_set_font_family(this.__wbg_ptr, ptr0, len0);
393
- }
394
- /**
395
- * Remove numbering from the current selection or cursor position
396
- */
397
- remove_numbering() {
398
- wasm.editor_remove_numbering(this.__wbg_ptr);
399
- }
400
- reset_font_color() {
401
- wasm.editor_reset_font_color(this.__wbg_ptr);
402
- }
403
- select_paragraph() {
404
- wasm.editor_select_paragraph(this.__wbg_ptr);
405
- }
406
- /**
407
- * @param {number} left
408
- * @param {number} right
409
- * @param {number} top
410
- * @param {number} bottom
411
- */
412
- set_page_margins(left, right, top, bottom) {
413
- wasm.editor_set_page_margins(this.__wbg_ptr, left, right, top, bottom);
414
- }
415
- /**
416
- * Check if the current paragraph has numbered list numbering (not bullet)
417
- * @returns {boolean}
418
- */
419
- has_numbered_list() {
420
- const ret = wasm.editor_has_numbered_list(this.__wbg_ptr);
421
- return ret !== 0;
422
- }
423
- reset_font_family() {
424
- wasm.editor_reset_font_family(this.__wbg_ptr);
425
- }
426
- /**
427
- * Set numbered list for the current selection or cursor position
428
- * Uses num_id=102 by convention for numbered lists (1.)
429
- * @param {boolean} enable
430
- */
431
- set_numbered_list(enable) {
432
- wasm.editor_set_numbered_list(this.__wbg_ptr, enable);
433
- }
434
- /**
435
- * Toggle ruler unit between centimeters and inches
436
- */
437
- toggle_ruler_unit() {
438
- wasm.editor_toggle_ruler_unit(this.__wbg_ptr);
439
- }
440
- /**
441
- * @param {boolean} visible
442
- */
443
- set_cursor_visible(visible) {
444
- wasm.editor_set_cursor_visible(this.__wbg_ptr, visible);
445
- }
446
- /**
447
- * @param {Uint8Array} data
448
- */
449
- load_docx_and_render(data) {
450
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
451
- const len0 = WASM_VECTOR_LEN;
452
- wasm.editor_load_docx_and_render(this.__wbg_ptr, ptr0, len0);
453
- }
454
- /**
455
- * @returns {SelectionStyleState}
456
- */
457
- selection_style_state() {
458
- const ret = wasm.editor_selection_style_state(this.__wbg_ptr);
459
- return SelectionStyleState.__wrap(ret);
460
- }
461
- /**
462
- * Get the current numbering format ID (101-108 for standard, or mapped from document)
463
- * @returns {number | undefined}
464
- */
465
- get_numbering_format_id() {
466
- const ret = wasm.editor_get_numbering_format_id(this.__wbg_ptr);
467
- return ret === 0x100000001 ? undefined : ret;
468
- }
469
- /**
470
- * @param {string} alignment
471
- */
472
- set_paragraph_alignment(alignment) {
473
- const ptr0 = passStringToWasm0(alignment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
474
- const len0 = WASM_VECTOR_LEN;
475
- wasm.editor_set_paragraph_alignment(this.__wbg_ptr, ptr0, len0);
476
- }
477
- /**
478
- * Set numbered list with a specific format
479
- * Formats: "decimal" (1.), "decimal-paren" (1)), "decimal-paren-both" ((1)),
480
- * "upper-letter" (A.), "lower-letter" (a.),
481
- * "upper-roman" (I.), "lower-roman" (i.)
482
- * @param {string} format
483
- */
484
- set_numbered_list_format(format) {
485
- const ptr0 = passStringToWasm0(format, wasm.__wbindgen_export, wasm.__wbindgen_export2);
486
- const len0 = WASM_VECTOR_LEN;
487
- wasm.editor_set_numbered_list_format(this.__wbg_ptr, ptr0, len0);
488
- }
489
- /**
490
- * @param {string} canvas_id
491
- */
492
- constructor(canvas_id) {
493
- try {
494
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
495
- const ptr0 = passStringToWasm0(canvas_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
496
- const len0 = WASM_VECTOR_LEN;
497
- wasm.editor_new(retptr, ptr0, len0);
498
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
499
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
500
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
501
- if (r2) {
502
- throw takeObject(r1);
503
- }
504
- this.__wbg_ptr = r0 >>> 0;
505
- EditorFinalization.register(this, this.__wbg_ptr, this);
506
- return this;
507
- } finally {
508
- wasm.__wbindgen_add_to_stack_pointer(16);
509
- }
510
- }
511
- /**
512
- * Zoom in by 10%
513
- */
514
- zoom_in() {
515
- wasm.editor_zoom_in(this.__wbg_ptr);
516
- }
517
- /**
518
- * Get current zoom level (1.0 = 100%)
519
- * @returns {number}
520
- */
521
- get_zoom() {
522
- const ret = wasm.editor_get_zoom(this.__wbg_ptr);
523
- return ret;
524
- }
525
- /**
526
- * @param {boolean} enable
527
- */
528
- set_bold(enable) {
529
- wasm.editor_set_bold(this.__wbg_ptr, enable);
530
- }
531
- /**
532
- * Set zoom level (0.25 to 4.0, i.e., 25% to 400%)
533
- * @param {number} zoom
534
- */
535
- set_zoom(zoom) {
536
- wasm.editor_set_zoom(this.__wbg_ptr, zoom);
537
- }
538
- /**
539
- * Zoom out by 10%
540
- */
541
- zoom_out() {
542
- wasm.editor_zoom_out(this.__wbg_ptr);
543
- }
544
- }
545
- if (Symbol.dispose) Editor.prototype[Symbol.dispose] = Editor.prototype.free;
546
-
547
- const SelectionStyleStateFinalization = (typeof FinalizationRegistry === 'undefined')
548
- ? { register: () => {}, unregister: () => {} }
549
- : new FinalizationRegistry(ptr => wasm.__wbg_selectionstylestate_free(ptr >>> 0, 1));
550
-
551
- export class SelectionStyleState {
552
-
553
- static __wrap(ptr) {
554
- ptr = ptr >>> 0;
555
- const obj = Object.create(SelectionStyleState.prototype);
556
- obj.__wbg_ptr = ptr;
557
- SelectionStyleStateFinalization.register(obj, obj.__wbg_ptr, obj);
558
- return obj;
559
- }
560
-
561
- __destroy_into_raw() {
562
- const ptr = this.__wbg_ptr;
563
- this.__wbg_ptr = 0;
564
- SelectionStyleStateFinalization.unregister(this);
565
- return ptr;
566
- }
567
-
568
- free() {
569
- const ptr = this.__destroy_into_raw();
570
- wasm.__wbg_selectionstylestate_free(ptr, 0);
571
- }
572
- /**
573
- * @returns {string | undefined}
574
- */
575
- font_color() {
576
- try {
577
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
578
- wasm.selectionstylestate_font_color(retptr, this.__wbg_ptr);
579
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
580
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
581
- let v1;
582
- if (r0 !== 0) {
583
- v1 = getStringFromWasm0(r0, r1).slice();
584
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
585
- }
586
- return v1;
587
- } finally {
588
- wasm.__wbindgen_add_to_stack_pointer(16);
589
- }
590
- }
591
- /**
592
- * @returns {boolean}
593
- */
594
- italic_all() {
595
- const ret = wasm.selectionstylestate_italic_all(this.__wbg_ptr);
596
- return ret !== 0;
597
- }
598
- /**
599
- * @returns {boolean}
600
- */
601
- italic_any() {
602
- const ret = wasm.selectionstylestate_italic_any(this.__wbg_ptr);
603
- return ret !== 0;
604
- }
605
- /**
606
- * @returns {string | undefined}
607
- */
608
- font_family() {
609
- try {
610
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
611
- wasm.selectionstylestate_font_family(retptr, this.__wbg_ptr);
612
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
613
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
614
- let v1;
615
- if (r0 !== 0) {
616
- v1 = getStringFromWasm0(r0, r1).slice();
617
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
618
- }
619
- return v1;
620
- } finally {
621
- wasm.__wbindgen_add_to_stack_pointer(16);
622
- }
623
- }
624
- /**
625
- * @returns {boolean}
626
- */
627
- underline_all() {
628
- const ret = wasm.selectionstylestate_underline_all(this.__wbg_ptr);
629
- return ret !== 0;
630
- }
631
- /**
632
- * @returns {boolean}
633
- */
634
- underline_any() {
635
- const ret = wasm.selectionstylestate_underline_any(this.__wbg_ptr);
636
- return ret !== 0;
637
- }
638
- /**
639
- * @returns {string | undefined}
640
- */
641
- paragraph_alignment() {
642
- try {
643
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
644
- wasm.selectionstylestate_paragraph_alignment(retptr, this.__wbg_ptr);
645
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
646
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
647
- let v1;
648
- if (r0 !== 0) {
649
- v1 = getStringFromWasm0(r0, r1).slice();
650
- wasm.__wbindgen_export4(r0, r1 * 1, 1);
651
- }
652
- return v1;
653
- } finally {
654
- wasm.__wbindgen_add_to_stack_pointer(16);
655
- }
656
- }
657
- /**
658
- * @returns {boolean}
659
- */
660
- bold_all() {
661
- const ret = wasm.selectionstylestate_bold_all(this.__wbg_ptr);
662
- return ret !== 0;
663
- }
664
- /**
665
- * @returns {boolean}
666
- */
667
- bold_any() {
668
- const ret = wasm.selectionstylestate_bold_any(this.__wbg_ptr);
669
- return ret !== 0;
670
- }
671
- /**
672
- * @returns {number | undefined}
673
- */
674
- font_size() {
675
- try {
676
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
677
- wasm.selectionstylestate_font_size(retptr, this.__wbg_ptr);
678
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
679
- var r2 = getDataViewMemory0().getFloat64(retptr + 8 * 1, true);
680
- return r0 === 0 ? undefined : r2;
681
- } finally {
682
- wasm.__wbindgen_add_to_stack_pointer(16);
683
- }
684
- }
685
- }
686
- if (Symbol.dispose) SelectionStyleState.prototype[Symbol.dispose] = SelectionStyleState.prototype.free;
687
-
688
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
689
-
690
- async function __wbg_load(module, imports) {
691
- if (typeof Response === 'function' && module instanceof Response) {
692
- if (typeof WebAssembly.instantiateStreaming === 'function') {
693
- try {
694
- return await WebAssembly.instantiateStreaming(module, imports);
695
-
696
- } catch (e) {
697
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
698
-
699
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
700
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
701
-
702
- } else {
703
- throw e;
704
- }
705
- }
706
- }
707
-
708
- const bytes = await module.arrayBuffer();
709
- return await WebAssembly.instantiate(bytes, imports);
710
-
711
- } else {
712
- const instance = await WebAssembly.instantiate(module, imports);
713
-
714
- if (instance instanceof WebAssembly.Instance) {
715
- return { instance, module };
716
-
717
- } else {
718
- return instance;
719
- }
720
- }
721
- }
722
-
723
- function __wbg_get_imports() {
724
- const imports = {};
725
- imports.wbg = {};
726
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
727
- const ret = debugString(getObject(arg1));
728
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
729
- const len1 = WASM_VECTOR_LEN;
730
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
731
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
732
- };
733
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
734
- const ret = getObject(arg0) === undefined;
735
- return ret;
736
- };
737
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
738
- throw new Error(getStringFromWasm0(arg0, arg1));
739
- };
740
- imports.wbg.__wbg_beginPath_ae4169e263573dcd = function(arg0) {
741
- getObject(arg0).beginPath();
742
- };
743
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
744
- const ret = getObject(arg0).call(getObject(arg1));
745
- return addHeapObject(ret);
746
- }, arguments) };
747
- imports.wbg.__wbg_canvas_2e1c9769eb5260f2 = function(arg0) {
748
- const ret = getObject(arg0).canvas;
749
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
750
- };
751
- imports.wbg.__wbg_clearRect_155b2e12f737565e = function(arg0, arg1, arg2, arg3, arg4) {
752
- getObject(arg0).clearRect(arg1, arg2, arg3, arg4);
753
- };
754
- imports.wbg.__wbg_clip_7858b458fb895725 = function(arg0) {
755
- getObject(arg0).clip();
756
- };
757
- imports.wbg.__wbg_document_725ae06eb442a6db = function(arg0) {
758
- const ret = getObject(arg0).document;
759
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
760
- };
761
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
762
- let deferred0_0;
763
- let deferred0_1;
764
- try {
765
- deferred0_0 = arg0;
766
- deferred0_1 = arg1;
767
- console.error(getStringFromWasm0(arg0, arg1));
768
- } finally {
769
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
770
- }
771
- };
772
- imports.wbg.__wbg_fillRect_726041755e54e83d = function(arg0, arg1, arg2, arg3, arg4) {
773
- getObject(arg0).fillRect(arg1, arg2, arg3, arg4);
774
- };
775
- imports.wbg.__wbg_fillText_c2ae7e4487ec82dd = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
776
- getObject(arg0).fillText(getStringFromWasm0(arg1, arg2), arg3, arg4);
777
- }, arguments) };
778
- imports.wbg.__wbg_getContext_0b80ccb9547db509 = function() { return handleError(function (arg0, arg1, arg2) {
779
- const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
780
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
781
- }, arguments) };
782
- imports.wbg.__wbg_getElementById_c365dd703c4a88c3 = function(arg0, arg1, arg2) {
783
- const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
784
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
785
- };
786
- imports.wbg.__wbg_height_119077665279308c = function(arg0) {
787
- const ret = getObject(arg0).height;
788
- return ret;
789
- };
790
- imports.wbg.__wbg_instanceof_CanvasRenderingContext2d_c0728747cf1e699c = function(arg0) {
791
- let result;
792
- try {
793
- result = getObject(arg0) instanceof CanvasRenderingContext2D;
794
- } catch (_) {
795
- result = false;
796
- }
797
- const ret = result;
798
- return ret;
799
- };
800
- imports.wbg.__wbg_instanceof_HtmlCanvasElement_3e2e95b109dae976 = function(arg0) {
801
- let result;
802
- try {
803
- result = getObject(arg0) instanceof HTMLCanvasElement;
804
- } catch (_) {
805
- result = false;
806
- }
807
- const ret = result;
808
- return ret;
809
- };
810
- imports.wbg.__wbg_instanceof_Window_4846dbb3de56c84c = function(arg0) {
811
- let result;
812
- try {
813
- result = getObject(arg0) instanceof Window;
814
- } catch (_) {
815
- result = false;
816
- }
817
- const ret = result;
818
- return ret;
819
- };
820
- imports.wbg.__wbg_lineTo_1e83b5f2f38f15f9 = function(arg0, arg1, arg2) {
821
- getObject(arg0).lineTo(arg1, arg2);
822
- };
823
- imports.wbg.__wbg_log_6f7eeda98df65afe = function(arg0, arg1) {
824
- console.log(getStringFromWasm0(arg0, arg1));
825
- };
826
- imports.wbg.__wbg_measureText_d63127eb84829830 = function() { return handleError(function (arg0, arg1, arg2) {
827
- const ret = getObject(arg0).measureText(getStringFromWasm0(arg1, arg2));
828
- return addHeapObject(ret);
829
- }, arguments) };
830
- imports.wbg.__wbg_moveTo_8064f6a508217dcd = function(arg0, arg1, arg2) {
831
- getObject(arg0).moveTo(arg1, arg2);
832
- };
833
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
834
- const ret = new Error();
835
- return addHeapObject(ret);
836
- };
837
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
838
- const ret = new Function(getStringFromWasm0(arg0, arg1));
839
- return addHeapObject(ret);
840
- };
841
- imports.wbg.__wbg_rect_d2677b1857072f26 = function(arg0, arg1, arg2, arg3, arg4) {
842
- getObject(arg0).rect(arg1, arg2, arg3, arg4);
843
- };
844
- imports.wbg.__wbg_resetTransform_46c0daa03ff7d023 = function() { return handleError(function (arg0) {
845
- getObject(arg0).resetTransform();
846
- }, arguments) };
847
- imports.wbg.__wbg_restore_9e6a0f2c35799ecd = function(arg0) {
848
- getObject(arg0).restore();
849
- };
850
- imports.wbg.__wbg_save_62f4925fcc246f6c = function(arg0) {
851
- getObject(arg0).save();
852
- };
853
- imports.wbg.__wbg_scale_3871a59cbba989ce = function() { return handleError(function (arg0, arg1, arg2) {
854
- getObject(arg0).scale(arg1, arg2);
855
- }, arguments) };
856
- imports.wbg.__wbg_set_fillStyle_c41ec913f9f22a0c = function(arg0, arg1, arg2) {
857
- getObject(arg0).fillStyle = getStringFromWasm0(arg1, arg2);
858
- };
859
- imports.wbg.__wbg_set_font_bd9a29cab7b9db0c = function(arg0, arg1, arg2) {
860
- getObject(arg0).font = getStringFromWasm0(arg1, arg2);
861
- };
862
- imports.wbg.__wbg_set_height_89110f48f7fd0817 = function(arg0, arg1) {
863
- getObject(arg0).height = arg1 >>> 0;
864
- };
865
- imports.wbg.__wbg_set_lineWidth_4059ac6bb1d807f8 = function(arg0, arg1) {
866
- getObject(arg0).lineWidth = arg1;
867
- };
868
- imports.wbg.__wbg_set_strokeStyle_475a0c2a522e1c7e = function(arg0, arg1, arg2) {
869
- getObject(arg0).strokeStyle = getStringFromWasm0(arg1, arg2);
870
- };
871
- imports.wbg.__wbg_set_width_dcc02c61dd01cff6 = function(arg0, arg1) {
872
- getObject(arg0).width = arg1 >>> 0;
873
- };
874
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
875
- const ret = getObject(arg1).stack;
876
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
877
- const len1 = WASM_VECTOR_LEN;
878
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
879
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
880
- };
881
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
882
- const ret = typeof global === 'undefined' ? null : global;
883
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
884
- };
885
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
886
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
887
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
888
- };
889
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
890
- const ret = typeof self === 'undefined' ? null : self;
891
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
892
- };
893
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
894
- const ret = typeof window === 'undefined' ? null : window;
895
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
896
- };
897
- imports.wbg.__wbg_strokeRect_788876bb2e67b691 = function(arg0, arg1, arg2, arg3, arg4) {
898
- getObject(arg0).strokeRect(arg1, arg2, arg3, arg4);
899
- };
900
- imports.wbg.__wbg_stroke_2d2420886d092225 = function(arg0) {
901
- getObject(arg0).stroke();
902
- };
903
- imports.wbg.__wbg_width_619a651232e6844f = function(arg0) {
904
- const ret = getObject(arg0).width;
905
- return ret;
906
- };
907
- imports.wbg.__wbg_width_9ea2df52b5d2c909 = function(arg0) {
908
- const ret = getObject(arg0).width;
909
- return ret;
910
- };
911
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
912
- // Cast intrinsic for `Ref(String) -> Externref`.
913
- const ret = getStringFromWasm0(arg0, arg1);
914
- return addHeapObject(ret);
915
- };
916
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
917
- const ret = getObject(arg0);
918
- return addHeapObject(ret);
919
- };
920
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
921
- takeObject(arg0);
922
- };
923
-
924
- return imports;
925
- }
926
-
927
- function __wbg_finalize_init(instance, module) {
928
- wasm = instance.exports;
929
- __wbg_init.__wbindgen_wasm_module = module;
930
- cachedDataViewMemory0 = null;
931
- cachedUint8ArrayMemory0 = null;
932
-
933
-
934
-
935
- return wasm;
936
- }
937
-
938
- function initSync(module) {
939
- if (wasm !== undefined) return wasm;
940
-
941
-
942
- if (typeof module !== 'undefined') {
943
- if (Object.getPrototypeOf(module) === Object.prototype) {
944
- ({module} = module)
945
- } else {
946
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
947
- }
948
- }
949
-
950
- const imports = __wbg_get_imports();
951
-
952
- if (!(module instanceof WebAssembly.Module)) {
953
- module = new WebAssembly.Module(module);
954
- }
955
-
956
- const instance = new WebAssembly.Instance(module, imports);
957
-
958
- return __wbg_finalize_init(instance, module);
959
- }
960
-
961
- async function __wbg_init(module_or_path) {
962
- if (wasm !== undefined) return wasm;
963
-
964
-
965
- if (typeof module_or_path !== 'undefined') {
966
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
967
- ({module_or_path} = module_or_path)
968
- } else {
969
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
970
- }
971
- }
972
-
973
- if (typeof module_or_path === 'undefined') {
974
- module_or_path = new URL('docuweave_core_bg.wasm', import.meta.url);
975
- }
976
- const imports = __wbg_get_imports();
977
-
978
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
979
- module_or_path = fetch(module_or_path);
980
- }
981
-
982
- const { instance, module } = await __wbg_load(await module_or_path, imports);
983
-
984
- return __wbg_finalize_init(instance, module);
985
- }
986
-
987
- export { initSync };
988
- export default __wbg_init;