@microsoft/webui 0.0.25 → 0.0.27
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 +74 -30
- package/bin/webui +0 -0
- package/dist/index.d.ts +115 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -42
- package/dist/index.js.map +1 -1
- package/dist/install.js.map +1 -1
- package/dist/platform.js.map +1 -1
- package/dist/projection/adapters/esbuild.d.ts.map +1 -1
- package/dist/projection/adapters/esbuild.js +33 -8
- package/dist/projection/adapters/esbuild.js.map +1 -1
- package/dist/projection/compiler.d.ts.map +1 -1
- package/dist/projection/compiler.js +51 -86
- package/dist/projection/compiler.js.map +1 -1
- package/dist/projection/concurrency.d.ts +8 -0
- package/dist/projection/concurrency.d.ts.map +1 -0
- package/dist/projection/concurrency.js +44 -0
- package/dist/projection/concurrency.js.map +1 -0
- package/dist/projection/diagnostics.d.ts.map +1 -1
- package/dist/projection/diagnostics.js.map +1 -1
- package/dist/projection/fixtures/conformance.d.ts +1 -1
- package/dist/projection/fixtures/conformance.js +1 -1
- package/dist/projection/fixtures/conformance.js.map +1 -1
- package/dist/projection/index.d.ts +1 -1
- package/dist/projection/loader.d.ts.map +1 -1
- package/dist/projection/loader.js +13 -1
- package/dist/projection/loader.js.map +1 -1
- package/dist/projection/typescript-api.d.ts +17 -0
- package/dist/projection/typescript-api.d.ts.map +1 -0
- package/dist/projection/typescript-api.js +185 -0
- package/dist/projection/typescript-api.js.map +1 -0
- package/dist/projection/typescript-version.d.ts +4 -0
- package/dist/projection/typescript-version.d.ts.map +1 -0
- package/dist/projection/typescript-version.js +76 -0
- package/dist/projection/typescript-version.js.map +1 -0
- package/package.json +10 -9
- package/wasm/all/README.md +37 -1
- package/wasm/all/package.json +1 -1
- package/wasm/all/webui_wasm_all.d.ts +34 -38
- package/wasm/all/webui_wasm_all.js +78 -97
- package/wasm/all/webui_wasm_all_bg.wasm +0 -0
- package/wasm/all/webui_wasm_all_bg.wasm.d.ts +4 -7
- package/wasm/handler/README.md +37 -1
- package/wasm/handler/package.json +1 -1
- package/wasm/handler/webui_wasm_handler.d.ts +29 -36
- package/wasm/handler/webui_wasm_handler.js +68 -93
- package/wasm/handler/webui_wasm_handler_bg.wasm +0 -0
- package/wasm/handler/webui_wasm_handler_bg.wasm.d.ts +3 -6
- package/wasm/parser/README.md +37 -1
- package/wasm/parser/package.json +1 -1
- package/wasm/parser/webui_wasm_parser.d.ts +5 -2
- package/wasm/parser/webui_wasm_parser.js +10 -4
- package/wasm/parser/webui_wasm_parser_bg.wasm +0 -0
- package/wasm/parser/webui_wasm_parser_bg.wasm.d.ts +1 -1
|
@@ -42,19 +42,26 @@ export class Protocol {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* A progressive HTML response driven one
|
|
45
|
+
* A progressive HTML response driven one semantic step at a time from JavaScript.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* `start()`, `resume()`, and `advance()` return
|
|
48
|
+
* `{ bytes, done, boundary? }`, where `bytes` is a `Uint8Array` and a boundary is
|
|
49
|
+
* `{ instanceId, declarationId, owner, name, key }`. Boundary keys retain
|
|
50
|
+
* their authored JSON type: strings are JavaScript strings and finite numbers
|
|
51
|
+
* are JavaScript numbers.
|
|
50
52
|
*
|
|
51
53
|
* ```js
|
|
52
54
|
* const session = protocol.streamResponse('index.html', '/');
|
|
53
|
-
*
|
|
54
|
-
* controller.enqueue(
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
55
|
+
* let step = session.start(JSON.stringify(shellState));
|
|
56
|
+
* controller.enqueue(step.bytes);
|
|
57
|
+
* while (!step.done) {
|
|
58
|
+
* const { instanceId, name, key } = step.boundary;
|
|
59
|
+
* const state = await loadBoundary(name, key);
|
|
60
|
+
* step = session.resume(instanceId, JSON.stringify(state), 'updatable');
|
|
61
|
+
* controller.enqueue(step.bytes);
|
|
62
|
+
* step = session.advance();
|
|
63
|
+
* controller.enqueue(step.bytes);
|
|
64
|
+
* }
|
|
58
65
|
* ```
|
|
59
66
|
*/
|
|
60
67
|
export class StreamingSession {
|
|
@@ -62,38 +69,27 @@ export class StreamingSession {
|
|
|
62
69
|
free(): void;
|
|
63
70
|
[Symbol.dispose](): void;
|
|
64
71
|
/**
|
|
65
|
-
*
|
|
72
|
+
* Write the parent bytes after the committed occurrence.
|
|
66
73
|
*
|
|
67
|
-
*
|
|
74
|
+
* Valid only after `resume()`. Returns the next boundary occurrence or
|
|
75
|
+
* completes the document tail.
|
|
68
76
|
*/
|
|
69
|
-
|
|
77
|
+
advance(): object;
|
|
70
78
|
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
finish(state_json: string): Uint8Array;
|
|
74
|
-
/**
|
|
75
|
-
* Push a projected state patch to a committed updatable boundary.
|
|
76
|
-
*/
|
|
77
|
-
update(boundary: number, state_json: string): Uint8Array;
|
|
78
|
-
/**
|
|
79
|
-
* Render and commit the next boundary in declaration order.
|
|
79
|
+
* Commit the pending occurrence through its checkpoint, then stop.
|
|
80
80
|
*
|
|
81
81
|
* `mode` is `"final"` (default) or `"updatable"`. Only updatable
|
|
82
82
|
* boundaries accept later `update()` calls.
|
|
83
83
|
*/
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Render everything before the first boundary.
|
|
87
|
-
*/
|
|
88
|
-
writeShell(state_json: string): Uint8Array;
|
|
84
|
+
resume(instance_id: number, state_json: string, mode?: string | null): object;
|
|
89
85
|
/**
|
|
90
|
-
*
|
|
86
|
+
* Render until the first runtime boundary occurrence or terminal.
|
|
91
87
|
*/
|
|
92
|
-
|
|
88
|
+
start(state_json: string): object;
|
|
93
89
|
/**
|
|
94
|
-
*
|
|
90
|
+
* Push a projected state patch to a committed updatable boundary.
|
|
95
91
|
*/
|
|
96
|
-
|
|
92
|
+
update(instance_id: number, patch_json: string): Uint8Array;
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -109,13 +105,10 @@ export interface InitOutput {
|
|
|
109
105
|
readonly protocol_renderStream: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
110
106
|
readonly protocol_streamResponse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
111
107
|
readonly protocol_tokens: (a: number, b: number) => void;
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly streamingsession_finished: (a: number) => number;
|
|
108
|
+
readonly streamingsession_advance: (a: number, b: number) => void;
|
|
109
|
+
readonly streamingsession_resume: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
110
|
+
readonly streamingsession_start: (a: number, b: number, c: number, d: number) => void;
|
|
116
111
|
readonly streamingsession_update: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
117
|
-
readonly streamingsession_writeBoundary: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
118
|
-
readonly streamingsession_writeShell: (a: number, b: number, c: number, d: number) => void;
|
|
119
112
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
120
113
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
121
114
|
readonly __wbindgen_export3: (a: number) => void;
|
|
@@ -219,19 +219,26 @@ export class Protocol {
|
|
|
219
219
|
if (Symbol.dispose) Protocol.prototype[Symbol.dispose] = Protocol.prototype.free;
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
* A progressive HTML response driven one
|
|
222
|
+
* A progressive HTML response driven one semantic step at a time from JavaScript.
|
|
223
223
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
224
|
+
* `start()`, `resume()`, and `advance()` return
|
|
225
|
+
* `{ bytes, done, boundary? }`, where `bytes` is a `Uint8Array` and a boundary is
|
|
226
|
+
* `{ instanceId, declarationId, owner, name, key }`. Boundary keys retain
|
|
227
|
+
* their authored JSON type: strings are JavaScript strings and finite numbers
|
|
228
|
+
* are JavaScript numbers.
|
|
227
229
|
*
|
|
228
230
|
* ```js
|
|
229
231
|
* const session = protocol.streamResponse('index.html', '/');
|
|
230
|
-
*
|
|
231
|
-
* controller.enqueue(
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
232
|
+
* let step = session.start(JSON.stringify(shellState));
|
|
233
|
+
* controller.enqueue(step.bytes);
|
|
234
|
+
* while (!step.done) {
|
|
235
|
+
* const { instanceId, name, key } = step.boundary;
|
|
236
|
+
* const state = await loadBoundary(name, key);
|
|
237
|
+
* step = session.resume(instanceId, JSON.stringify(state), 'updatable');
|
|
238
|
+
* controller.enqueue(step.bytes);
|
|
239
|
+
* step = session.advance();
|
|
240
|
+
* controller.enqueue(step.bytes);
|
|
241
|
+
* }
|
|
235
242
|
* ```
|
|
236
243
|
*/
|
|
237
244
|
export class StreamingSession {
|
|
@@ -252,139 +259,90 @@ export class StreamingSession {
|
|
|
252
259
|
wasm.__wbg_streamingsession_free(ptr, 0);
|
|
253
260
|
}
|
|
254
261
|
/**
|
|
255
|
-
*
|
|
262
|
+
* Write the parent bytes after the committed occurrence.
|
|
256
263
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
* @returns {
|
|
264
|
+
* Valid only after `resume()`. Returns the next boundary occurrence or
|
|
265
|
+
* completes the document tail.
|
|
266
|
+
* @returns {object}
|
|
260
267
|
*/
|
|
261
|
-
|
|
268
|
+
advance() {
|
|
262
269
|
try {
|
|
263
270
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
264
|
-
|
|
265
|
-
const len0 = WASM_VECTOR_LEN;
|
|
266
|
-
wasm.streamingsession_boundary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
271
|
+
wasm.streamingsession_advance(retptr, this.__wbg_ptr);
|
|
267
272
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
268
273
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
269
274
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
270
275
|
if (r2) {
|
|
271
276
|
throw takeObject(r1);
|
|
272
277
|
}
|
|
273
|
-
return r0
|
|
274
|
-
} finally {
|
|
275
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Number of compile-time boundaries declared by this entry.
|
|
280
|
-
* @returns {number}
|
|
281
|
-
*/
|
|
282
|
-
get boundaryCount() {
|
|
283
|
-
const ret = wasm.streamingsession_boundaryCount(this.__wbg_ptr);
|
|
284
|
-
return ret >>> 0;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Render the document tail and emit the terminal record.
|
|
288
|
-
* @param {string} state_json
|
|
289
|
-
* @returns {Uint8Array}
|
|
290
|
-
*/
|
|
291
|
-
finish(state_json) {
|
|
292
|
-
try {
|
|
293
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
294
|
-
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
295
|
-
const len0 = WASM_VECTOR_LEN;
|
|
296
|
-
wasm.streamingsession_finish(retptr, this.__wbg_ptr, ptr0, len0);
|
|
297
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
298
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
299
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
300
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
301
|
-
if (r3) {
|
|
302
|
-
throw takeObject(r2);
|
|
303
|
-
}
|
|
304
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
305
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
306
|
-
return v2;
|
|
278
|
+
return takeObject(r0);
|
|
307
279
|
} finally {
|
|
308
280
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
309
281
|
}
|
|
310
282
|
}
|
|
311
283
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return ret !== 0;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Push a projected state patch to a committed updatable boundary.
|
|
321
|
-
* @param {number} boundary
|
|
284
|
+
* Commit the pending occurrence through its checkpoint, then stop.
|
|
285
|
+
*
|
|
286
|
+
* `mode` is `"final"` (default) or `"updatable"`. Only updatable
|
|
287
|
+
* boundaries accept later `update()` calls.
|
|
288
|
+
* @param {number} instance_id
|
|
322
289
|
* @param {string} state_json
|
|
323
|
-
* @
|
|
290
|
+
* @param {string | null} [mode]
|
|
291
|
+
* @returns {object}
|
|
324
292
|
*/
|
|
325
|
-
|
|
293
|
+
resume(instance_id, state_json, mode) {
|
|
326
294
|
try {
|
|
327
295
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
328
296
|
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
329
297
|
const len0 = WASM_VECTOR_LEN;
|
|
330
|
-
|
|
298
|
+
var ptr1 = isLikeNone(mode) ? 0 : passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
299
|
+
var len1 = WASM_VECTOR_LEN;
|
|
300
|
+
wasm.streamingsession_resume(retptr, this.__wbg_ptr, instance_id, ptr0, len0, ptr1, len1);
|
|
331
301
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
332
302
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
333
303
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
throw takeObject(r2);
|
|
304
|
+
if (r2) {
|
|
305
|
+
throw takeObject(r1);
|
|
337
306
|
}
|
|
338
|
-
|
|
339
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
340
|
-
return v2;
|
|
307
|
+
return takeObject(r0);
|
|
341
308
|
} finally {
|
|
342
309
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
343
310
|
}
|
|
344
311
|
}
|
|
345
312
|
/**
|
|
346
|
-
* Render
|
|
347
|
-
*
|
|
348
|
-
* `mode` is `"final"` (default) or `"updatable"`. Only updatable
|
|
349
|
-
* boundaries accept later `update()` calls.
|
|
350
|
-
* @param {number} boundary
|
|
313
|
+
* Render until the first runtime boundary occurrence or terminal.
|
|
351
314
|
* @param {string} state_json
|
|
352
|
-
* @
|
|
353
|
-
* @returns {Uint8Array}
|
|
315
|
+
* @returns {object}
|
|
354
316
|
*/
|
|
355
|
-
|
|
317
|
+
start(state_json) {
|
|
356
318
|
try {
|
|
357
319
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
358
320
|
const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
359
321
|
const len0 = WASM_VECTOR_LEN;
|
|
360
|
-
|
|
361
|
-
var len1 = WASM_VECTOR_LEN;
|
|
362
|
-
wasm.streamingsession_writeBoundary(retptr, this.__wbg_ptr, boundary, ptr0, len0, ptr1, len1);
|
|
322
|
+
wasm.streamingsession_start(retptr, this.__wbg_ptr, ptr0, len0);
|
|
363
323
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
364
324
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
365
325
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
throw takeObject(r2);
|
|
326
|
+
if (r2) {
|
|
327
|
+
throw takeObject(r1);
|
|
369
328
|
}
|
|
370
|
-
|
|
371
|
-
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
372
|
-
return v3;
|
|
329
|
+
return takeObject(r0);
|
|
373
330
|
} finally {
|
|
374
331
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
375
332
|
}
|
|
376
333
|
}
|
|
377
334
|
/**
|
|
378
|
-
*
|
|
379
|
-
* @param {
|
|
335
|
+
* Push a projected state patch to a committed updatable boundary.
|
|
336
|
+
* @param {number} instance_id
|
|
337
|
+
* @param {string} patch_json
|
|
380
338
|
* @returns {Uint8Array}
|
|
381
339
|
*/
|
|
382
|
-
|
|
340
|
+
update(instance_id, patch_json) {
|
|
383
341
|
try {
|
|
384
342
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
|
-
const ptr0 = passStringToWasm0(
|
|
343
|
+
const ptr0 = passStringToWasm0(patch_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
386
344
|
const len0 = WASM_VECTOR_LEN;
|
|
387
|
-
wasm.
|
|
345
|
+
wasm.streamingsession_update(retptr, this.__wbg_ptr, instance_id, ptr0, len0);
|
|
388
346
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
389
347
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
390
348
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -533,6 +491,14 @@ function __wbg_get_imports() {
|
|
|
533
491
|
const ret = new Uint8Array(getObject(arg0));
|
|
534
492
|
return addHeapObject(ret);
|
|
535
493
|
},
|
|
494
|
+
__wbg_new_da52cf8fe3429cb2: function() {
|
|
495
|
+
const ret = new Object();
|
|
496
|
+
return addHeapObject(ret);
|
|
497
|
+
},
|
|
498
|
+
__wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
|
|
499
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
500
|
+
return addHeapObject(ret);
|
|
501
|
+
},
|
|
536
502
|
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
537
503
|
const ret = getObject(arg0).next;
|
|
538
504
|
return addHeapObject(ret);
|
|
@@ -544,6 +510,10 @@ function __wbg_get_imports() {
|
|
|
544
510
|
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
545
511
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
546
512
|
},
|
|
513
|
+
__wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
|
|
514
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
515
|
+
return ret;
|
|
516
|
+
}, arguments); },
|
|
547
517
|
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
548
518
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
549
519
|
},
|
|
@@ -551,7 +521,12 @@ function __wbg_get_imports() {
|
|
|
551
521
|
const ret = getObject(arg0).value;
|
|
552
522
|
return addHeapObject(ret);
|
|
553
523
|
},
|
|
554
|
-
__wbindgen_cast_0000000000000001: function(arg0
|
|
524
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
525
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
526
|
+
const ret = arg0;
|
|
527
|
+
return addHeapObject(ret);
|
|
528
|
+
},
|
|
529
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
555
530
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
556
531
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
557
532
|
return addHeapObject(ret);
|
|
Binary file
|
|
@@ -10,13 +10,10 @@ export const protocol_renderPartial: (a: number, b: number, c: number, d: number
|
|
|
10
10
|
export const protocol_renderStream: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
11
|
export const protocol_streamResponse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
12
12
|
export const protocol_tokens: (a: number, b: number) => void;
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const streamingsession_finished: (a: number) => number;
|
|
13
|
+
export const streamingsession_advance: (a: number, b: number) => void;
|
|
14
|
+
export const streamingsession_resume: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
15
|
+
export const streamingsession_start: (a: number, b: number, c: number, d: number) => void;
|
|
17
16
|
export const streamingsession_update: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
18
|
-
export const streamingsession_writeBoundary: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
19
|
-
export const streamingsession_writeShell: (a: number, b: number, c: number, d: number) => void;
|
|
20
17
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
21
18
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
22
19
|
export const __wbindgen_export3: (a: number) => void;
|
package/wasm/parser/README.md
CHANGED
|
@@ -15,10 +15,46 @@ WebAssembly bindings for the [WebUI](https://github.com/microsoft/webui) framewo
|
|
|
15
15
|
The default feature is `all`, which powers the online playground. Consumers that only need to render prebuilt protobuf protocol bytes should use the handler bundle to avoid shipping parser code.
|
|
16
16
|
|
|
17
17
|
Construct `Protocol` once from protocol bytes. It exposes `render`,
|
|
18
|
-
`renderStream`, `renderPartial`, `renderComponentTemplates`,
|
|
18
|
+
`renderStream`, `renderPartial`, `renderComponentTemplates`, `tokens`, and
|
|
19
|
+
`streamResponse`.
|
|
19
20
|
Streaming callbacks are coalesced around a 16 KiB target before crossing into
|
|
20
21
|
JavaScript.
|
|
21
22
|
|
|
23
|
+
`Protocol.streamResponse(entry, requestPath, options)` returns a host-driven
|
|
24
|
+
`StreamingSession`. State and patch arguments are JSON strings. `start`,
|
|
25
|
+
`resume`, and `advance` return:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
{
|
|
29
|
+
bytes: Uint8Array,
|
|
30
|
+
done: boolean,
|
|
31
|
+
boundary?: { instanceId, declarationId, owner, name, key }
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| Method | Result |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `start(stateJson)` | Shell bytes through the first descriptor or terminal |
|
|
38
|
+
| `resume(instanceId, stateJson, mode)` | Only the pending occurrence's bytes through its checkpoint |
|
|
39
|
+
| `advance()` | Following parent bytes through the next descriptor or terminal |
|
|
40
|
+
| `update(instanceId, patchJson)` | Projected state bytes for an updatable occurrence |
|
|
41
|
+
|
|
42
|
+
A descriptor means call `resume`; no descriptor with `done: false` means call
|
|
43
|
+
`advance`; `done: true` means complete. Boundary-only `resume` lets the host
|
|
44
|
+
enqueue the checkpoint immediately. `advance` renders following parent or tail
|
|
45
|
+
bytes, so no sibling boundary workaround is needed.
|
|
46
|
+
|
|
47
|
+
`mode` is `"final"` (the default) or `"updatable"`. A committed updatable
|
|
48
|
+
occurrence accepts `update(instanceId, patch)`, including between its `resume`
|
|
49
|
+
and `advance`, and returns a `Uint8Array`. Optional boundary keys preserve JSON
|
|
50
|
+
identity: string keys are JavaScript strings and finite numeric keys are
|
|
51
|
+
JavaScript numbers. A key is required when one component-owned declaration is
|
|
52
|
+
reached from multiple static callsites in one entry traversal. Boundaries are
|
|
53
|
+
discovered through entries, reusable components, runtime branches, and selected
|
|
54
|
+
routes. A boundary-bearing subtree under `<for>` fails with
|
|
55
|
+
`boundary-in-repeat`; one boundary may wrap the whole `<for>`. The step with
|
|
56
|
+
`done: true` already contains terminal and document-tail bytes.
|
|
57
|
+
|
|
22
58
|
## Building
|
|
23
59
|
|
|
24
60
|
```bash
|
package/wasm/parser/package.json
CHANGED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Build protocol protobuf bytes from virtual files without rendering.
|
|
6
6
|
*
|
|
7
|
+
* `dom` accepts `"shadow"` (default) or `"light"` for unwrapped components;
|
|
8
|
+
* authored open Shadow roots remain Shadow in either mode.
|
|
9
|
+
*
|
|
7
10
|
* Returns the serialized `WebUIProtocol` as protobuf bytes.
|
|
8
11
|
*/
|
|
9
|
-
export function build_protocol(files: any, entry: string, projection_manifests?: any | null): Uint8Array;
|
|
12
|
+
export function build_protocol(files: any, entry: string, projection_manifests?: any | null, dom?: string | null): Uint8Array;
|
|
10
13
|
|
|
11
14
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
12
15
|
|
|
13
16
|
export interface InitOutput {
|
|
14
17
|
readonly memory: WebAssembly.Memory;
|
|
15
|
-
readonly build_protocol: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
18
|
+
readonly build_protocol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
16
19
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
17
20
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
18
21
|
readonly __wbindgen_export3: (a: number) => void;
|
|
@@ -3,18 +3,24 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Build protocol protobuf bytes from virtual files without rendering.
|
|
5
5
|
*
|
|
6
|
+
* `dom` accepts `"shadow"` (default) or `"light"` for unwrapped components;
|
|
7
|
+
* authored open Shadow roots remain Shadow in either mode.
|
|
8
|
+
*
|
|
6
9
|
* Returns the serialized `WebUIProtocol` as protobuf bytes.
|
|
7
10
|
* @param {any} files
|
|
8
11
|
* @param {string} entry
|
|
9
12
|
* @param {any | null} [projection_manifests]
|
|
13
|
+
* @param {string | null} [dom]
|
|
10
14
|
* @returns {Uint8Array}
|
|
11
15
|
*/
|
|
12
|
-
export function build_protocol(files, entry, projection_manifests) {
|
|
16
|
+
export function build_protocol(files, entry, projection_manifests, dom) {
|
|
13
17
|
try {
|
|
14
18
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
15
19
|
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
16
20
|
const len0 = WASM_VECTOR_LEN;
|
|
17
|
-
|
|
21
|
+
var ptr1 = isLikeNone(dom) ? 0 : passStringToWasm0(dom, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
22
|
+
var len1 = WASM_VECTOR_LEN;
|
|
23
|
+
wasm.build_protocol(retptr, addHeapObject(files), ptr0, len0, isLikeNone(projection_manifests) ? 0 : addHeapObject(projection_manifests), ptr1, len1);
|
|
18
24
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
19
25
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
20
26
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -22,9 +28,9 @@ export function build_protocol(files, entry, projection_manifests) {
|
|
|
22
28
|
if (r3) {
|
|
23
29
|
throw takeObject(r2);
|
|
24
30
|
}
|
|
25
|
-
var
|
|
31
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
26
32
|
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
27
|
-
return
|
|
33
|
+
return v3;
|
|
28
34
|
} finally {
|
|
29
35
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
30
36
|
}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const build_protocol: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
4
|
+
export const build_protocol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
5
5
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
6
6
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
7
7
|
export const __wbindgen_export3: (a: number) => void;
|