@microsoft/webui 0.0.22 → 0.0.23

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.
Binary file
@@ -0,0 +1,25 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_protocol_free: (a: number, b: number) => void;
5
+ export const __wbg_streamingsession_free: (a: number, b: number) => void;
6
+ export const build_protocol: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const protocol_new: (a: number, b: number, c: number, d: number, e: number) => void;
8
+ export const protocol_render: (a: number, b: number, c: number, d: number, e: number) => void;
9
+ export const protocol_renderComponentTemplates: (a: number, b: number, c: number, d: number, e: number) => void;
10
+ export const protocol_renderPartial: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
11
+ export const protocol_renderStream: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
+ export const protocol_streamResponse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
+ export const protocol_tokens: (a: number, b: number) => void;
14
+ export const streamingsession_boundary: (a: number, b: number, c: number, d: number) => void;
15
+ export const streamingsession_boundaryCount: (a: number) => number;
16
+ export const streamingsession_finish: (a: number, b: number, c: number, d: number) => void;
17
+ export const streamingsession_finished: (a: number) => number;
18
+ export const streamingsession_update: (a: number, b: number, c: number, d: number, e: number) => void;
19
+ export const streamingsession_writeBoundary: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
20
+ export const streamingsession_writeShell: (a: number, b: number, c: number, d: number) => void;
21
+ export const __wbindgen_export: (a: number, b: number) => number;
22
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
23
+ export const __wbindgen_export3: (a: number) => void;
24
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
25
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
@@ -0,0 +1,36 @@
1
+ # microsoft-webui-wasm
2
+
3
+ WebAssembly bindings for the [WebUI](https://github.com/microsoft/webui) framework, built with `wasm-bindgen`.
4
+
5
+ ## Overview
6
+
7
+ `microsoft-webui-wasm` can be built as three browser bundles:
8
+
9
+ | Feature | Bundle | Exports |
10
+ |---------|--------|---------|
11
+ | `handler` | `webui_wasm_handler.js` | `Protocol` |
12
+ | `parser` | `webui_wasm_parser.js` | `build_protocol` |
13
+ | `all` | `webui_wasm_all.js` | Parser and handler exports |
14
+
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
+
17
+ Construct `Protocol` once from protocol bytes. It exposes `render`,
18
+ `renderStream`, `renderPartial`, `renderComponentTemplates`, and `tokens`.
19
+ Streaming callbacks are coalesced around a 16 KiB target before crossing into
20
+ JavaScript.
21
+
22
+ ## Building
23
+
24
+ ```bash
25
+ cargo xtask build-wasm
26
+ ```
27
+
28
+ This writes the three generated bundles under `docs/.webui-press/public/wasm/`.
29
+
30
+ ## Documentation
31
+
32
+ See the [WebUI repository](https://github.com/microsoft/webui) for full usage guides and examples.
33
+
34
+ ## License
35
+
36
+ MIT - Copyright (c) Microsoft Corporation.
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "microsoft-webui-wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Microsoft Edge"
6
+ ],
7
+ "description": "WebAssembly bindings for WebUI framework — powers the online playground",
8
+ "version": "0.0.23",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/microsoft/webui"
13
+ },
14
+ "files": [
15
+ "webui_wasm_handler_bg.wasm",
16
+ "webui_wasm_handler.js",
17
+ "webui_wasm_handler.d.ts"
18
+ ],
19
+ "main": "webui_wasm_handler.js",
20
+ "homepage": "https://microsoft.github.io/webui",
21
+ "types": "webui_wasm_handler.d.ts",
22
+ "sideEffects": [
23
+ "./snippets/*"
24
+ ],
25
+ "keywords": [
26
+ "webui",
27
+ "wasm",
28
+ "webassembly",
29
+ "ssr",
30
+ "rendering"
31
+ ]
32
+ }
@@ -0,0 +1,146 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A decoded protocol with reusable indices for repeated WASM renders.
6
+ */
7
+ export class Protocol {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Decode protobuf bytes once for repeated rendering.
12
+ */
13
+ constructor(protocol_bytes: Uint8Array, plugin?: string | null);
14
+ /**
15
+ * Render from an existing JSON string.
16
+ */
17
+ render(state_json: string, options?: object | null): string;
18
+ /**
19
+ * Return component template payloads for requested component tags.
20
+ */
21
+ renderComponentTemplates(component_tags: any, inventory_hex: string): string;
22
+ /**
23
+ * Produce a complete partial-navigation response.
24
+ */
25
+ renderPartial(state_json: string, entry_id: string, request_path: string, inventory_hex: string): string;
26
+ /**
27
+ * Stream from an existing JSON string in bounded chunks.
28
+ */
29
+ renderStream(state_json: string, on_chunk: Function, options?: object | null): void;
30
+ /**
31
+ * Open a host-driven progressive response for a streaming entry.
32
+ *
33
+ * Unlike `renderStream`, which pushes every chunk through one callback
34
+ * during a single synchronous call, the returned session hands each chunk
35
+ * back so the host owns the socket, the write order, and backpressure.
36
+ */
37
+ streamResponse(entry: string, request_path: string, options?: object | null): StreamingSession;
38
+ /**
39
+ * Return CSS token names in build order.
40
+ */
41
+ tokens(): any;
42
+ }
43
+
44
+ /**
45
+ * A progressive HTML response driven one chunk at a time from JavaScript.
46
+ *
47
+ * Every method returns the UTF-8 bytes it produced. Write them to the
48
+ * response and apply the host's own backpressure; the session holds no
49
+ * transport and never blocks on one.
50
+ *
51
+ * ```js
52
+ * const session = protocol.streamResponse('index.html', '/');
53
+ * const weather = session.boundary('weather-shell');
54
+ * controller.enqueue(session.writeShell(shellState));
55
+ * controller.enqueue(session.writeBoundary(weather, weatherState, 'updatable'));
56
+ * controller.enqueue(session.update(weather, forecast));
57
+ * controller.enqueue(session.finish(tailState));
58
+ * ```
59
+ */
60
+ export class StreamingSession {
61
+ private constructor();
62
+ free(): void;
63
+ [Symbol.dispose](): void;
64
+ /**
65
+ * Resolve an authored boundary name to a stable integer handle.
66
+ *
67
+ * Resolve once outside the write loop; the handle costs nothing to reuse.
68
+ */
69
+ boundary(name: string): number;
70
+ /**
71
+ * Render the document tail and emit the terminal record.
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.
80
+ *
81
+ * `mode` is `"final"` (default) or `"updatable"`. Only updatable
82
+ * boundaries accept later `update()` calls.
83
+ */
84
+ writeBoundary(boundary: number, state_json: string, mode?: string | null): Uint8Array;
85
+ /**
86
+ * Render everything before the first boundary.
87
+ */
88
+ writeShell(state_json: string): Uint8Array;
89
+ /**
90
+ * Number of compile-time boundaries declared by this entry.
91
+ */
92
+ readonly boundaryCount: number;
93
+ /**
94
+ * Whether the terminal record has been written.
95
+ */
96
+ readonly finished: boolean;
97
+ }
98
+
99
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
100
+
101
+ export interface InitOutput {
102
+ readonly memory: WebAssembly.Memory;
103
+ readonly __wbg_protocol_free: (a: number, b: number) => void;
104
+ readonly __wbg_streamingsession_free: (a: number, b: number) => void;
105
+ readonly protocol_new: (a: number, b: number, c: number, d: number, e: number) => void;
106
+ readonly protocol_render: (a: number, b: number, c: number, d: number, e: number) => void;
107
+ readonly protocol_renderComponentTemplates: (a: number, b: number, c: number, d: number, e: number) => void;
108
+ readonly protocol_renderPartial: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
109
+ readonly protocol_renderStream: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
110
+ readonly protocol_streamResponse: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
111
+ readonly protocol_tokens: (a: number, b: number) => void;
112
+ readonly streamingsession_boundary: (a: number, b: number, c: number, d: number) => void;
113
+ readonly streamingsession_boundaryCount: (a: number) => number;
114
+ readonly streamingsession_finish: (a: number, b: number, c: number, d: number) => void;
115
+ readonly streamingsession_finished: (a: number) => number;
116
+ 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
+ readonly __wbindgen_export: (a: number, b: number) => number;
120
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
121
+ readonly __wbindgen_export3: (a: number) => void;
122
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
123
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
124
+ }
125
+
126
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
127
+
128
+ /**
129
+ * Instantiates the given `module`, which can either be bytes or
130
+ * a precompiled `WebAssembly.Module`.
131
+ *
132
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
133
+ *
134
+ * @returns {InitOutput}
135
+ */
136
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
137
+
138
+ /**
139
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
140
+ * for everything else, calls `WebAssembly.instantiate` directly.
141
+ *
142
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
143
+ *
144
+ * @returns {Promise<InitOutput>}
145
+ */
146
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;