@aseity/idocs-preview 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +39 -3
- package/dist/core/display.d.ts +67 -0
- package/dist/core/editor.d.ts +172 -0
- package/dist/core/editor.js +527 -0
- package/dist/core/engine.js +132 -38
- package/dist/core/index.d.ts +6 -19
- package/dist/core/index.js +13 -17
- package/dist/core/protocol.d.ts +87 -0
- package/dist/core/protocol.js +13 -1
- package/dist/view/edit-selection.d.ts +80 -0
- package/dist/view/edit-selection.js +841 -0
- package/dist/view/editor.d.ts +77 -0
- package/dist/view/editor.js +1477 -0
- package/dist/view/find.d.ts +2 -1
- package/dist/view/find.js +7 -0
- package/dist/view/ime.d.ts +63 -0
- package/dist/view/ime.js +352 -0
- package/dist/view/index.d.ts +4 -0
- package/dist/view/index.js +3 -0
- package/dist/view/selection-layer.d.ts +1 -0
- package/dist/view/selection-layer.js +4 -4
- package/dist/view/workspace-styles.d.ts +1 -0
- package/dist/view/workspace-styles.js +879 -0
- package/dist/view/workspace.d.ts +70 -0
- package/dist/view/workspace.js +1028 -0
- package/package.json +2 -2
- package/wasm/idocs_wasm.d.ts +30 -0
- package/wasm/idocs_wasm.js +147 -0
- package/wasm/idocs_wasm_bg.wasm +0 -0
- package/wasm/idocs_wasm_bg.wasm.d.ts +13 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aseity/idocs-preview",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Browser preview and editor for iDocs source documents, with DOCX preview and export, Web Worker layout, and Canvas rendering.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
package/wasm/idocs_wasm.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
export class WasmEditorSession {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
apply(base: string, edit_json: string, assets: Map<any, any>, measure: Function): any;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
exportDocx(assets: Map<any, any>, measure: Function): any;
|
|
10
|
+
markSaved(revision: string): any;
|
|
11
|
+
constructor();
|
|
12
|
+
open(source: string, file_name: string, assets: Map<any, any>, measure: Function): any;
|
|
13
|
+
range(base: string, start_json: string, end_json: string): any;
|
|
14
|
+
redo(base: string, assets: Map<any, any>, measure: Function): any;
|
|
15
|
+
refresh(base: string, source: string, assets: Map<any, any>, measure: Function): any;
|
|
16
|
+
render(assets: Map<any, any>, measure: Function): any;
|
|
17
|
+
snapshot(): any;
|
|
18
|
+
undo(base: string, assets: Map<any, any>, measure: Function): any;
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
export function exportDocx(bytes: Uint8Array, file_name: string, assets: Map<any, any>, measure: Function): any;
|
|
5
22
|
|
|
6
23
|
/**
|
|
@@ -15,8 +32,21 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
15
32
|
|
|
16
33
|
export interface InitOutput {
|
|
17
34
|
readonly memory: WebAssembly.Memory;
|
|
35
|
+
readonly __wbg_wasmeditorsession_free: (a: number, b: number) => void;
|
|
18
36
|
readonly exportDocx: (a: number, b: number, c: number, d: number, e: any, f: any) => any;
|
|
19
37
|
readonly openDocument: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: number) => any;
|
|
38
|
+
readonly wasmeditorsession_apply: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
39
|
+
readonly wasmeditorsession_dispose: (a: number) => void;
|
|
40
|
+
readonly wasmeditorsession_exportDocx: (a: number, b: any, c: any) => any;
|
|
41
|
+
readonly wasmeditorsession_markSaved: (a: number, b: number, c: number) => any;
|
|
42
|
+
readonly wasmeditorsession_new: () => number;
|
|
43
|
+
readonly wasmeditorsession_open: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
44
|
+
readonly wasmeditorsession_range: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
45
|
+
readonly wasmeditorsession_redo: (a: number, b: number, c: number, d: any, e: any) => any;
|
|
46
|
+
readonly wasmeditorsession_refresh: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
47
|
+
readonly wasmeditorsession_render: (a: number, b: any, c: any) => any;
|
|
48
|
+
readonly wasmeditorsession_snapshot: (a: number) => any;
|
|
49
|
+
readonly wasmeditorsession_undo: (a: number, b: number, c: number, d: any, e: any) => any;
|
|
20
50
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
21
51
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
22
52
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/wasm/idocs_wasm.js
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
/* @ts-self-types="./idocs_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
export class WasmEditorSession {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
WasmEditorSessionFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_wasmeditorsession_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} base
|
|
16
|
+
* @param {string} edit_json
|
|
17
|
+
* @param {Map<any, any>} assets
|
|
18
|
+
* @param {Function} measure
|
|
19
|
+
* @returns {any}
|
|
20
|
+
*/
|
|
21
|
+
apply(base, edit_json, assets, measure) {
|
|
22
|
+
const ptr0 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
23
|
+
const len0 = WASM_VECTOR_LEN;
|
|
24
|
+
const ptr1 = passStringToWasm0(edit_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
25
|
+
const len1 = WASM_VECTOR_LEN;
|
|
26
|
+
const ret = wasm.wasmeditorsession_apply(this.__wbg_ptr, ptr0, len0, ptr1, len1, assets, measure);
|
|
27
|
+
return ret;
|
|
28
|
+
}
|
|
29
|
+
dispose() {
|
|
30
|
+
wasm.wasmeditorsession_dispose(this.__wbg_ptr);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @param {Map<any, any>} assets
|
|
34
|
+
* @param {Function} measure
|
|
35
|
+
* @returns {any}
|
|
36
|
+
*/
|
|
37
|
+
exportDocx(assets, measure) {
|
|
38
|
+
const ret = wasm.wasmeditorsession_exportDocx(this.__wbg_ptr, assets, measure);
|
|
39
|
+
return ret;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} revision
|
|
43
|
+
* @returns {any}
|
|
44
|
+
*/
|
|
45
|
+
markSaved(revision) {
|
|
46
|
+
const ptr0 = passStringToWasm0(revision, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
+
const len0 = WASM_VECTOR_LEN;
|
|
48
|
+
const ret = wasm.wasmeditorsession_markSaved(this.__wbg_ptr, ptr0, len0);
|
|
49
|
+
return ret;
|
|
50
|
+
}
|
|
51
|
+
constructor() {
|
|
52
|
+
const ret = wasm.wasmeditorsession_new();
|
|
53
|
+
this.__wbg_ptr = ret;
|
|
54
|
+
WasmEditorSessionFinalization.register(this, this.__wbg_ptr, this);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} source
|
|
59
|
+
* @param {string} file_name
|
|
60
|
+
* @param {Map<any, any>} assets
|
|
61
|
+
* @param {Function} measure
|
|
62
|
+
* @returns {any}
|
|
63
|
+
*/
|
|
64
|
+
open(source, file_name, assets, measure) {
|
|
65
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
66
|
+
const len0 = WASM_VECTOR_LEN;
|
|
67
|
+
const ptr1 = passStringToWasm0(file_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
68
|
+
const len1 = WASM_VECTOR_LEN;
|
|
69
|
+
const ret = wasm.wasmeditorsession_open(this.__wbg_ptr, ptr0, len0, ptr1, len1, assets, measure);
|
|
70
|
+
return ret;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {string} base
|
|
74
|
+
* @param {string} start_json
|
|
75
|
+
* @param {string} end_json
|
|
76
|
+
* @returns {any}
|
|
77
|
+
*/
|
|
78
|
+
range(base, start_json, end_json) {
|
|
79
|
+
const ptr0 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
80
|
+
const len0 = WASM_VECTOR_LEN;
|
|
81
|
+
const ptr1 = passStringToWasm0(start_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
|
+
const len1 = WASM_VECTOR_LEN;
|
|
83
|
+
const ptr2 = passStringToWasm0(end_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
|
+
const len2 = WASM_VECTOR_LEN;
|
|
85
|
+
const ret = wasm.wasmeditorsession_range(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
86
|
+
return ret;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @param {string} base
|
|
90
|
+
* @param {Map<any, any>} assets
|
|
91
|
+
* @param {Function} measure
|
|
92
|
+
* @returns {any}
|
|
93
|
+
*/
|
|
94
|
+
redo(base, assets, measure) {
|
|
95
|
+
const ptr0 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
|
97
|
+
const ret = wasm.wasmeditorsession_redo(this.__wbg_ptr, ptr0, len0, assets, measure);
|
|
98
|
+
return ret;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @param {string} base
|
|
102
|
+
* @param {string} source
|
|
103
|
+
* @param {Map<any, any>} assets
|
|
104
|
+
* @param {Function} measure
|
|
105
|
+
* @returns {any}
|
|
106
|
+
*/
|
|
107
|
+
refresh(base, source, assets, measure) {
|
|
108
|
+
const ptr0 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
110
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
111
|
+
const len1 = WASM_VECTOR_LEN;
|
|
112
|
+
const ret = wasm.wasmeditorsession_refresh(this.__wbg_ptr, ptr0, len0, ptr1, len1, assets, measure);
|
|
113
|
+
return ret;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @param {Map<any, any>} assets
|
|
117
|
+
* @param {Function} measure
|
|
118
|
+
* @returns {any}
|
|
119
|
+
*/
|
|
120
|
+
render(assets, measure) {
|
|
121
|
+
const ret = wasm.wasmeditorsession_render(this.__wbg_ptr, assets, measure);
|
|
122
|
+
return ret;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @returns {any}
|
|
126
|
+
*/
|
|
127
|
+
snapshot() {
|
|
128
|
+
const ret = wasm.wasmeditorsession_snapshot(this.__wbg_ptr);
|
|
129
|
+
return ret;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} base
|
|
133
|
+
* @param {Map<any, any>} assets
|
|
134
|
+
* @param {Function} measure
|
|
135
|
+
* @returns {any}
|
|
136
|
+
*/
|
|
137
|
+
undo(base, assets, measure) {
|
|
138
|
+
const ptr0 = passStringToWasm0(base, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
139
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140
|
+
const ret = wasm.wasmeditorsession_undo(this.__wbg_ptr, ptr0, len0, assets, measure);
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (Symbol.dispose) WasmEditorSession.prototype[Symbol.dispose] = WasmEditorSession.prototype.free;
|
|
145
|
+
|
|
3
146
|
/**
|
|
4
147
|
* @param {Uint8Array} bytes
|
|
5
148
|
* @param {string} file_name
|
|
@@ -140,6 +283,10 @@ function __wbg_get_imports() {
|
|
|
140
283
|
};
|
|
141
284
|
}
|
|
142
285
|
|
|
286
|
+
const WasmEditorSessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
287
|
+
? { register: () => {}, unregister: () => {} }
|
|
288
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmeditorsession_free(ptr, 1));
|
|
289
|
+
|
|
143
290
|
function addToExternrefTable0(obj) {
|
|
144
291
|
const idx = wasm.__externref_table_alloc();
|
|
145
292
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
package/wasm/idocs_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmeditorsession_free: (a: number, b: number) => void;
|
|
4
5
|
export const exportDocx: (a: number, b: number, c: number, d: number, e: any, f: any) => any;
|
|
5
6
|
export const openDocument: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any, i: number) => any;
|
|
7
|
+
export const wasmeditorsession_apply: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
8
|
+
export const wasmeditorsession_dispose: (a: number) => void;
|
|
9
|
+
export const wasmeditorsession_exportDocx: (a: number, b: any, c: any) => any;
|
|
10
|
+
export const wasmeditorsession_markSaved: (a: number, b: number, c: number) => any;
|
|
11
|
+
export const wasmeditorsession_new: () => number;
|
|
12
|
+
export const wasmeditorsession_open: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
13
|
+
export const wasmeditorsession_range: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
14
|
+
export const wasmeditorsession_redo: (a: number, b: number, c: number, d: any, e: any) => any;
|
|
15
|
+
export const wasmeditorsession_refresh: (a: number, b: number, c: number, d: number, e: number, f: any, g: any) => any;
|
|
16
|
+
export const wasmeditorsession_render: (a: number, b: any, c: any) => any;
|
|
17
|
+
export const wasmeditorsession_snapshot: (a: number) => any;
|
|
18
|
+
export const wasmeditorsession_undo: (a: number, b: number, c: number, d: any, e: any) => any;
|
|
6
19
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
7
20
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
8
21
|
export const __wbindgen_exn_store: (a: number) => void;
|