fleuron 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.
- package/README.md +132 -0
- package/dist/client.d.ts +74 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +124 -0
- package/dist/client.js.map +1 -0
- package/dist/engine.d.ts +50 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +163 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/preview.d.ts +193 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +303 -0
- package/dist/preview.js.map +1 -0
- package/dist/protocol.d.ts +153 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +19 -0
- package/dist/protocol.js.map +1 -0
- package/dist/svg.d.ts +57 -0
- package/dist/svg.d.ts.map +1 -0
- package/dist/svg.js +210 -0
- package/dist/svg.js.map +1 -0
- package/dist/version.d.ts +8 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/dist/wire.d.ts +179 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +174 -0
- package/dist/wire.js.map +1 -0
- package/dist/worker.d.ts +16 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +23 -0
- package/dist/worker.js.map +1 -0
- package/package.json +45 -0
- package/wasm/fleuron.d.ts +221 -0
- package/wasm/fleuron.js +629 -0
- package/wasm/fleuron_bg.wasm +0 -0
- package/wasm/fleuron_bg.wasm.d.ts +30 -0
package/wasm/fleuron.js
ADDED
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
/* @ts-self-types="./fleuron.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A retained pipeline, held in the module between calls.
|
|
5
|
+
*
|
|
6
|
+
* The session keeps the content tree, the styling and every stage
|
|
7
|
+
* between them and the page, so a second render pays for what
|
|
8
|
+
* changed and not for the book. What the stages cost, and what
|
|
9
|
+
* survives which edit, is the engine's own contract.
|
|
10
|
+
*/
|
|
11
|
+
export class Session {
|
|
12
|
+
__destroy_into_raw() {
|
|
13
|
+
const ptr = this.__wbg_ptr;
|
|
14
|
+
this.__wbg_ptr = 0;
|
|
15
|
+
SessionFinalization.unregister(this);
|
|
16
|
+
return ptr;
|
|
17
|
+
}
|
|
18
|
+
free() {
|
|
19
|
+
const ptr = this.__destroy_into_raw();
|
|
20
|
+
wasm.__wbg_session_free(ptr, 0);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Registers a face from font bytes, and returns the ids it was
|
|
24
|
+
* registered under. A variable file names several cuts and
|
|
25
|
+
* yields one id each.
|
|
26
|
+
*
|
|
27
|
+
* The bytes stay in the module. A host sends a face once, not
|
|
28
|
+
* once per render.
|
|
29
|
+
* @param {Uint8Array} bytes
|
|
30
|
+
* @returns {Uint16Array}
|
|
31
|
+
*/
|
|
32
|
+
addFont(bytes) {
|
|
33
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
34
|
+
const len0 = WASM_VECTOR_LEN;
|
|
35
|
+
const ret = wasm.session_addFont(this.__wbg_ptr, ptr0, len0);
|
|
36
|
+
if (ret[3]) {
|
|
37
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
38
|
+
}
|
|
39
|
+
var v2 = getArrayU16FromWasm0(ret[0], ret[1]).slice();
|
|
40
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);
|
|
41
|
+
return v2;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Registers one image by the url the content tree names it by,
|
|
45
|
+
* and returns the index `DrawItem::Image.asset` will carry.
|
|
46
|
+
* `undefined` for bytes no probe recognises, which is a
|
|
47
|
+
* diagnostic on the next display structure and no image.
|
|
48
|
+
*
|
|
49
|
+
* The engine opens nothing, and a worker has nothing to open:
|
|
50
|
+
* the host fetches the file and hands the bytes over, as it does
|
|
51
|
+
* with a face. The bytes stay in the module, so an image crosses
|
|
52
|
+
* once rather than once per render.
|
|
53
|
+
* @param {string} url
|
|
54
|
+
* @param {Uint8Array} bytes
|
|
55
|
+
* @returns {number | undefined}
|
|
56
|
+
*/
|
|
57
|
+
addImage(url, bytes) {
|
|
58
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
59
|
+
const len0 = WASM_VECTOR_LEN;
|
|
60
|
+
const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
61
|
+
const len1 = WASM_VECTOR_LEN;
|
|
62
|
+
const ret = wasm.session_addImage(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
63
|
+
if (ret[2]) {
|
|
64
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
65
|
+
}
|
|
66
|
+
return ret[0] === Number.MAX_SAFE_INTEGER ? undefined : ret[0];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The same run as PDF bytes. Both painters read the stages the
|
|
70
|
+
* preview settled, so an export cannot contradict what is on
|
|
71
|
+
* screen.
|
|
72
|
+
* @returns {Uint8Array}
|
|
73
|
+
*/
|
|
74
|
+
exportPdf() {
|
|
75
|
+
const ret = wasm.session_exportPdf(this.__wbg_ptr);
|
|
76
|
+
if (ret[3]) {
|
|
77
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
78
|
+
}
|
|
79
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
80
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
81
|
+
return v1;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The file a face was registered from, for a painter that has
|
|
85
|
+
* to draw with the bytes the engine shaped with.
|
|
86
|
+
*
|
|
87
|
+
* The bundled face is the case that needs this: it is inside
|
|
88
|
+
* the module and there is no URL a host could fetch it from.
|
|
89
|
+
* A variable file answers for every cut it named, so the same
|
|
90
|
+
* bytes come back for each of them, and the face's variations
|
|
91
|
+
* on the display structure say which instance to draw.
|
|
92
|
+
* @param {number} font_id
|
|
93
|
+
* @returns {Uint8Array}
|
|
94
|
+
*/
|
|
95
|
+
fontBytes(font_id) {
|
|
96
|
+
const ret = wasm.session_fontBytes(this.__wbg_ptr, font_id);
|
|
97
|
+
if (ret[3]) {
|
|
98
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
99
|
+
}
|
|
100
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
101
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
102
|
+
return v1;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A session over the bundled face, with no content and the
|
|
106
|
+
* built-in sheet alone.
|
|
107
|
+
*/
|
|
108
|
+
constructor() {
|
|
109
|
+
const ret = wasm.session_new();
|
|
110
|
+
if (ret[2]) {
|
|
111
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
112
|
+
}
|
|
113
|
+
this.__wbg_ptr = ret[0];
|
|
114
|
+
SessionFinalization.register(this, this.__wbg_ptr, this);
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The display structure, postcard-encoded, version first.
|
|
119
|
+
* @returns {Uint8Array}
|
|
120
|
+
*/
|
|
121
|
+
preview() {
|
|
122
|
+
const ret = wasm.session_preview(this.__wbg_ptr);
|
|
123
|
+
if (ret[3]) {
|
|
124
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
125
|
+
}
|
|
126
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
127
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
128
|
+
return v1;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Drops every section that came from one source, and the
|
|
132
|
+
* complaints reading it raised.
|
|
133
|
+
* @param {string} name
|
|
134
|
+
*/
|
|
135
|
+
removeMarkdown(name) {
|
|
136
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
138
|
+
wasm.session_removeMarkdown(this.__wbg_ptr, ptr0, len0);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Sets the book from a content tree, as JSON.
|
|
142
|
+
*
|
|
143
|
+
* Markdown is the way in; this is the door for a host with a
|
|
144
|
+
* structured source of its own. Node ids are the engine's and
|
|
145
|
+
* are assigned on the way in, so a tree built by hand needs
|
|
146
|
+
* none.
|
|
147
|
+
* @param {string} json
|
|
148
|
+
*/
|
|
149
|
+
setContent(json) {
|
|
150
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
151
|
+
const len0 = WASM_VECTOR_LEN;
|
|
152
|
+
const ret = wasm.session_setContent(this.__wbg_ptr, ptr0, len0);
|
|
153
|
+
if (ret[1]) {
|
|
154
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Which markdown the sources are written in: `commonmark`,
|
|
159
|
+
* `gfm` or `obsidian`.
|
|
160
|
+
* @param {string} dialect
|
|
161
|
+
*/
|
|
162
|
+
setDialect(dialect) {
|
|
163
|
+
const ptr0 = passStringToWasm0(dialect, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
const ret = wasm.session_setDialect(this.__wbg_ptr, ptr0, len0);
|
|
166
|
+
if (ret[1]) {
|
|
167
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Reads one markdown source as the whole book, its frontmatter
|
|
172
|
+
* the book's metadata.
|
|
173
|
+
*
|
|
174
|
+
* Everything below box construction is invalidated: this is the
|
|
175
|
+
* manuscript arriving, not an edit to it.
|
|
176
|
+
* @param {string} name
|
|
177
|
+
* @param {string} text
|
|
178
|
+
*/
|
|
179
|
+
setMarkdown(name, text) {
|
|
180
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
181
|
+
const len0 = WASM_VECTOR_LEN;
|
|
182
|
+
const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
183
|
+
const len1 = WASM_VECTOR_LEN;
|
|
184
|
+
wasm.session_setMarkdown(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Names the book, from JSON: `title`, `author`, and an `extra`
|
|
188
|
+
* object for whatever else a frontend carries.
|
|
189
|
+
*
|
|
190
|
+
* A book read from several sources has no frontmatter of its
|
|
191
|
+
* own, so this is how it gets a title. Nothing between the
|
|
192
|
+
* content tree and the page reads metadata, so a book renamed
|
|
193
|
+
* between renders re-runs no stage; the PDF writer is the one
|
|
194
|
+
* thing that reads it.
|
|
195
|
+
* @param {string} json
|
|
196
|
+
*/
|
|
197
|
+
setMetadata(json) {
|
|
198
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
200
|
+
const ret = wasm.session_setMetadata(this.__wbg_ptr, ptr0, len0);
|
|
201
|
+
if (ret[1]) {
|
|
202
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Reads several markdown sources as one book, in the order
|
|
207
|
+
* given.
|
|
208
|
+
*
|
|
209
|
+
* A lone source is the whole book, so its frontmatter is the
|
|
210
|
+
* book's. Several are chapters: each file's frontmatter belongs
|
|
211
|
+
* to the section it became, and the book is left unnamed rather
|
|
212
|
+
* than named after whichever chapter came first, which is what
|
|
213
|
+
* [`Session::set_metadata`] is for.
|
|
214
|
+
* @param {string[]} names
|
|
215
|
+
* @param {string[]} texts
|
|
216
|
+
*/
|
|
217
|
+
setSources(names, texts) {
|
|
218
|
+
const ptr0 = passArrayJsValueToWasm0(names, wasm.__wbindgen_malloc);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
const ptr1 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_malloc);
|
|
221
|
+
const len1 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.session_setSources(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
223
|
+
if (ret[1]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Where a source's sections begin: at a heading of this level
|
|
229
|
+
* or shallower, or nowhere at all when the level is zero, which
|
|
230
|
+
* makes each file one section.
|
|
231
|
+
*
|
|
232
|
+
* Sections are what a page can start on, so this sets a book's
|
|
233
|
+
* page count before any styling does.
|
|
234
|
+
* @param {number} level
|
|
235
|
+
*/
|
|
236
|
+
setSplit(level) {
|
|
237
|
+
const ret = wasm.session_setSplit(this.__wbg_ptr, level);
|
|
238
|
+
if (ret[1]) {
|
|
239
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Sets the author styling from CSS text, cascading over the
|
|
244
|
+
* built-in sheet.
|
|
245
|
+
*
|
|
246
|
+
* Which stages this costs is the change's own business: a
|
|
247
|
+
* colour repaints nothing, page geometry re-fragments over the
|
|
248
|
+
* lines already broken, and only the measure or the face breaks
|
|
249
|
+
* them again.
|
|
250
|
+
* @param {string} css
|
|
251
|
+
*/
|
|
252
|
+
setStyle(css) {
|
|
253
|
+
const ptr0 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
254
|
+
const len0 = WASM_VECTOR_LEN;
|
|
255
|
+
wasm.session_setStyle(this.__wbg_ptr, ptr0, len0);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* How many times each stage has run since the session was made,
|
|
259
|
+
* as `[style, lines, flow, paint]`.
|
|
260
|
+
*
|
|
261
|
+
* What an edit cost, said in stage runs rather than
|
|
262
|
+
* milliseconds: a host watching this can see a cache serve
|
|
263
|
+
* where a clock would only see a fast machine.
|
|
264
|
+
* @returns {Uint32Array}
|
|
265
|
+
*/
|
|
266
|
+
stages() {
|
|
267
|
+
const ret = wasm.session_stages(this.__wbg_ptr);
|
|
268
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
269
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
270
|
+
return v1;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Replaces every section that came from one source, reparsing
|
|
274
|
+
* that source alone. A name the book does not carry appends
|
|
275
|
+
* instead, which is how a file it has not seen before arrives.
|
|
276
|
+
*
|
|
277
|
+
* This is the keystroke path: one file crosses, one file is
|
|
278
|
+
* read, and every other section keeps the lines it already has.
|
|
279
|
+
* @param {string} name
|
|
280
|
+
* @param {string} text
|
|
281
|
+
*/
|
|
282
|
+
updateMarkdown(name, text) {
|
|
283
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
285
|
+
const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
286
|
+
const len1 = WASM_VECTOR_LEN;
|
|
287
|
+
wasm.session_updateMarkdown(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* One markdown source and one stylesheet, laid out once: the batch
|
|
294
|
+
* case, over the same session a live preview keeps.
|
|
295
|
+
* @param {string} markdown
|
|
296
|
+
* @param {string} css
|
|
297
|
+
* @returns {Uint8Array}
|
|
298
|
+
*/
|
|
299
|
+
export function render(markdown, css) {
|
|
300
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
301
|
+
const len0 = WASM_VECTOR_LEN;
|
|
302
|
+
const ptr1 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
303
|
+
const len1 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.render(ptr0, len0, ptr1, len1);
|
|
305
|
+
if (ret[3]) {
|
|
306
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
307
|
+
}
|
|
308
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
309
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
310
|
+
return v3;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The same, as PDF bytes.
|
|
315
|
+
* @param {string} markdown
|
|
316
|
+
* @param {string} css
|
|
317
|
+
* @returns {Uint8Array}
|
|
318
|
+
*/
|
|
319
|
+
export function renderPdf(markdown, css) {
|
|
320
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
321
|
+
const len0 = WASM_VECTOR_LEN;
|
|
322
|
+
const ptr1 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
323
|
+
const len1 = WASM_VECTOR_LEN;
|
|
324
|
+
const ret = wasm.renderPdf(ptr0, len0, ptr1, len1);
|
|
325
|
+
if (ret[3]) {
|
|
326
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
327
|
+
}
|
|
328
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
329
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
330
|
+
return v3;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The version the display structure is encoded at. A host reads the same
|
|
335
|
+
* number off the front of every buffer and refuses one it does not
|
|
336
|
+
* know.
|
|
337
|
+
* @returns {number}
|
|
338
|
+
*/
|
|
339
|
+
export function wireVersion() {
|
|
340
|
+
const ret = wasm.wireVersion();
|
|
341
|
+
return ret;
|
|
342
|
+
}
|
|
343
|
+
function __wbg_get_imports() {
|
|
344
|
+
const import0 = {
|
|
345
|
+
__proto__: null,
|
|
346
|
+
__wbg_Error_408e67f47ca7b58b: function(arg0, arg1) {
|
|
347
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
348
|
+
return ret;
|
|
349
|
+
},
|
|
350
|
+
__wbg___wbindgen_string_get_d154f1e671052120: function(arg0, arg1) {
|
|
351
|
+
const obj = arg1;
|
|
352
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
353
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
354
|
+
var len1 = WASM_VECTOR_LEN;
|
|
355
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
356
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
357
|
+
},
|
|
358
|
+
__wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
|
|
359
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
360
|
+
},
|
|
361
|
+
__wbindgen_init_externref_table: function() {
|
|
362
|
+
const table = wasm.__wbindgen_externrefs;
|
|
363
|
+
const offset = table.grow(4);
|
|
364
|
+
table.set(0, undefined);
|
|
365
|
+
table.set(offset + 0, undefined);
|
|
366
|
+
table.set(offset + 1, null);
|
|
367
|
+
table.set(offset + 2, true);
|
|
368
|
+
table.set(offset + 3, false);
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
return {
|
|
372
|
+
__proto__: null,
|
|
373
|
+
"./fleuron_bg.js": import0,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
378
|
+
? { register: () => {}, unregister: () => {} }
|
|
379
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr, 1));
|
|
380
|
+
|
|
381
|
+
function addToExternrefTable0(obj) {
|
|
382
|
+
const idx = wasm.__externref_table_alloc();
|
|
383
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
384
|
+
return idx;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function getArrayU16FromWasm0(ptr, len) {
|
|
388
|
+
ptr = ptr >>> 0;
|
|
389
|
+
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
393
|
+
ptr = ptr >>> 0;
|
|
394
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
398
|
+
ptr = ptr >>> 0;
|
|
399
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
let cachedDataViewMemory0 = null;
|
|
403
|
+
function getDataViewMemory0() {
|
|
404
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
405
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
406
|
+
}
|
|
407
|
+
return cachedDataViewMemory0;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function getStringFromWasm0(ptr, len) {
|
|
411
|
+
return decodeText(ptr >>> 0, len);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
let cachedUint16ArrayMemory0 = null;
|
|
415
|
+
function getUint16ArrayMemory0() {
|
|
416
|
+
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
417
|
+
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
418
|
+
}
|
|
419
|
+
return cachedUint16ArrayMemory0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
let cachedUint32ArrayMemory0 = null;
|
|
423
|
+
function getUint32ArrayMemory0() {
|
|
424
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
425
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
426
|
+
}
|
|
427
|
+
return cachedUint32ArrayMemory0;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
let cachedUint8ArrayMemory0 = null;
|
|
431
|
+
function getUint8ArrayMemory0() {
|
|
432
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
433
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
434
|
+
}
|
|
435
|
+
return cachedUint8ArrayMemory0;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function isLikeNone(x) {
|
|
439
|
+
return x === undefined || x === null;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
443
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
444
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
445
|
+
WASM_VECTOR_LEN = arg.length;
|
|
446
|
+
return ptr;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
450
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
451
|
+
for (let i = 0; i < array.length; i++) {
|
|
452
|
+
const add = addToExternrefTable0(array[i]);
|
|
453
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
454
|
+
}
|
|
455
|
+
WASM_VECTOR_LEN = array.length;
|
|
456
|
+
return ptr;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
460
|
+
if (realloc === undefined) {
|
|
461
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
462
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
463
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
464
|
+
WASM_VECTOR_LEN = buf.length;
|
|
465
|
+
return ptr;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
let len = arg.length;
|
|
469
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
470
|
+
|
|
471
|
+
const mem = getUint8ArrayMemory0();
|
|
472
|
+
|
|
473
|
+
let offset = 0;
|
|
474
|
+
|
|
475
|
+
for (; offset < len; offset++) {
|
|
476
|
+
const code = arg.charCodeAt(offset);
|
|
477
|
+
if (code > 0x7F) break;
|
|
478
|
+
mem[ptr + offset] = code;
|
|
479
|
+
}
|
|
480
|
+
if (offset !== len) {
|
|
481
|
+
if (offset !== 0) {
|
|
482
|
+
arg = arg.slice(offset);
|
|
483
|
+
}
|
|
484
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
485
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
486
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
487
|
+
|
|
488
|
+
offset += ret.written;
|
|
489
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
WASM_VECTOR_LEN = offset;
|
|
493
|
+
return ptr;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function takeFromExternrefTable0(idx) {
|
|
497
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
498
|
+
wasm.__externref_table_dealloc(idx);
|
|
499
|
+
return value;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
503
|
+
cachedTextDecoder.decode();
|
|
504
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
505
|
+
let numBytesDecoded = 0;
|
|
506
|
+
function decodeText(ptr, len) {
|
|
507
|
+
numBytesDecoded += len;
|
|
508
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
509
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
510
|
+
cachedTextDecoder.decode();
|
|
511
|
+
numBytesDecoded = len;
|
|
512
|
+
}
|
|
513
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const cachedTextEncoder = new TextEncoder();
|
|
517
|
+
|
|
518
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
519
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
520
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
521
|
+
view.set(buf);
|
|
522
|
+
return {
|
|
523
|
+
read: arg.length,
|
|
524
|
+
written: buf.length
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
let WASM_VECTOR_LEN = 0;
|
|
530
|
+
|
|
531
|
+
let wasmModule, wasmInstance, wasm;
|
|
532
|
+
function __wbg_finalize_init(instance, module) {
|
|
533
|
+
wasmInstance = instance;
|
|
534
|
+
wasm = instance.exports;
|
|
535
|
+
wasmModule = module;
|
|
536
|
+
cachedDataViewMemory0 = null;
|
|
537
|
+
cachedUint16ArrayMemory0 = null;
|
|
538
|
+
cachedUint32ArrayMemory0 = null;
|
|
539
|
+
cachedUint8ArrayMemory0 = null;
|
|
540
|
+
wasm.__wbindgen_start();
|
|
541
|
+
return wasm;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
async function __wbg_load(module, imports) {
|
|
545
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
546
|
+
if (!module.ok) {
|
|
547
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
551
|
+
try {
|
|
552
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
553
|
+
} catch (e) {
|
|
554
|
+
const validResponse = expectedResponseType(module.type);
|
|
555
|
+
|
|
556
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
557
|
+
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);
|
|
558
|
+
|
|
559
|
+
} else { throw e; }
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const bytes = await module.arrayBuffer();
|
|
564
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
565
|
+
} else {
|
|
566
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
567
|
+
|
|
568
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
569
|
+
return { instance, module };
|
|
570
|
+
} else {
|
|
571
|
+
return instance;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function expectedResponseType(type) {
|
|
576
|
+
switch (type) {
|
|
577
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
578
|
+
}
|
|
579
|
+
return false;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function initSync(module) {
|
|
584
|
+
if (wasm !== undefined) return wasm;
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
if (module !== undefined) {
|
|
588
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
589
|
+
({module} = module)
|
|
590
|
+
} else {
|
|
591
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const imports = __wbg_get_imports();
|
|
596
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
597
|
+
module = new WebAssembly.Module(module);
|
|
598
|
+
}
|
|
599
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
600
|
+
return __wbg_finalize_init(instance, module);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
async function __wbg_init(module_or_path) {
|
|
604
|
+
if (wasm !== undefined) return wasm;
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
if (module_or_path !== undefined) {
|
|
608
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
609
|
+
({module_or_path} = module_or_path)
|
|
610
|
+
} else {
|
|
611
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (module_or_path === undefined) {
|
|
616
|
+
module_or_path = new URL('fleuron_bg.wasm', import.meta.url);
|
|
617
|
+
}
|
|
618
|
+
const imports = __wbg_get_imports();
|
|
619
|
+
|
|
620
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
621
|
+
module_or_path = fetch(module_or_path);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
625
|
+
|
|
626
|
+
return __wbg_finalize_init(instance, module);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_session_free: (a: number, b: number) => void;
|
|
5
|
+
export const render: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
6
|
+
export const renderPdf: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
7
|
+
export const session_addFont: (a: number, b: number, c: number) => [number, number, number, number];
|
|
8
|
+
export const session_addImage: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
9
|
+
export const session_exportPdf: (a: number) => [number, number, number, number];
|
|
10
|
+
export const session_fontBytes: (a: number, b: number) => [number, number, number, number];
|
|
11
|
+
export const session_new: () => [number, number, number];
|
|
12
|
+
export const session_preview: (a: number) => [number, number, number, number];
|
|
13
|
+
export const session_removeMarkdown: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const session_setContent: (a: number, b: number, c: number) => [number, number];
|
|
15
|
+
export const session_setDialect: (a: number, b: number, c: number) => [number, number];
|
|
16
|
+
export const session_setMarkdown: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
|
+
export const session_setMetadata: (a: number, b: number, c: number) => [number, number];
|
|
18
|
+
export const session_setSources: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
19
|
+
export const session_setSplit: (a: number, b: number) => [number, number];
|
|
20
|
+
export const session_setStyle: (a: number, b: number, c: number) => void;
|
|
21
|
+
export const session_stages: (a: number) => [number, number];
|
|
22
|
+
export const session_updateMarkdown: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
23
|
+
export const wireVersion: () => number;
|
|
24
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
25
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
26
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
27
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
28
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
29
|
+
export const __externref_table_alloc: () => number;
|
|
30
|
+
export const __wbindgen_start: () => void;
|