@mica-js/widget 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +342 -2
- package/dist/index.d.ts +407 -0
- package/dist/index.js +1228 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { CanvasBindingCatalog } from '@mica-js/core/canvas';
|
|
2
|
+
import { CanvasBindingTarget } from '@mica-js/core/canvas';
|
|
3
|
+
import { CanvasCommand } from '@mica-js/core/canvas';
|
|
4
|
+
import { CanvasDocument } from '@mica-js/core/canvas';
|
|
5
|
+
import { PayloadType } from '@mica-js/core/canvas';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Default sandbox over `@mica-js/sandbox`.
|
|
9
|
+
*
|
|
10
|
+
* The import stays dynamic on purpose: consumers that inject their own sandbox never load it, and
|
|
11
|
+
* Node-side consumers can import this package without a DOM.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createDefaultWidgetSandbox: WidgetSandboxFactory;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Loads every package up front and indexes its widgets under `<packageId>:<widgetId>`.
|
|
17
|
+
* Resolution never touches the file system again, and unknown references return `undefined`.
|
|
18
|
+
*
|
|
19
|
+
* @throws {WidgetLoadError}
|
|
20
|
+
*/
|
|
21
|
+
export declare function createPackageWidgetProvider(options: PackageWidgetProviderOptions): Promise<WidgetProvider>;
|
|
22
|
+
|
|
23
|
+
/** Provider over a fixed module table, used for builtin widgets and tests. */
|
|
24
|
+
export declare function createStaticWidgetProvider(modules: Readonly<Record<string, WidgetModule>>): WidgetProvider;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates the widget host.
|
|
28
|
+
*
|
|
29
|
+
* The document is the single source of truth: instances are mounted, resized, repropped and
|
|
30
|
+
* reordered to match it. The sandbox starts lazily on the first instance and every concurrent mount
|
|
31
|
+
* shares that one startup, so a host with no instances never pays for an iframe and a worker. After
|
|
32
|
+
* a crash the next reconciliation starts a fresh sandbox instead of rebuilding instances
|
|
33
|
+
* automatically.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createWidgetHost(options: WidgetHostOptions): WidgetHost;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Reads a package manifest, every declared widget definition and its paired implementation.
|
|
39
|
+
* Only the three declared path kinds are read; the package is never enumerated.
|
|
40
|
+
*
|
|
41
|
+
* @throws {WidgetLoadError}
|
|
42
|
+
*/
|
|
43
|
+
export declare function loadWidgetPackage(files: PackageFiles): Promise<WidgetPackage>;
|
|
44
|
+
|
|
45
|
+
/** Read-only view of the files that make up one package. */
|
|
46
|
+
export declare interface PackageFiles {
|
|
47
|
+
/** Human-readable label used in diagnostics. */
|
|
48
|
+
readonly label: string;
|
|
49
|
+
/** Reads a package-relative POSIX path and resolves to its bytes. */
|
|
50
|
+
read(path: string): Promise<Uint8Array>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare interface PackageWidgetProviderOptions {
|
|
54
|
+
readonly files: PackageFiles | readonly PackageFiles[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare interface PortDefinition {
|
|
58
|
+
readonly title?: string;
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
readonly direction: 'input' | 'output';
|
|
61
|
+
readonly type: PayloadType;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Property descriptor from the shared descriptor contract (#7); fields pass through untouched. */
|
|
65
|
+
declare interface PropertyDefinition_2 {
|
|
66
|
+
readonly type: string;
|
|
67
|
+
readonly default?: unknown;
|
|
68
|
+
readonly [key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
export { PropertyDefinition_2 as PropertyDefinition }
|
|
71
|
+
|
|
72
|
+
/** One payload a simulation published for an endpoint the canvas can bind to. */
|
|
73
|
+
export declare interface SimulationPublish {
|
|
74
|
+
readonly target: CanvasBindingTarget;
|
|
75
|
+
readonly payload: unknown;
|
|
76
|
+
readonly simTime: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** ESM guest runtime for widget instances, bundled at build time by `vite.plugins.ts`. */
|
|
80
|
+
export declare const WIDGET_RUNTIME_SOURCE: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Reads resources the host prefetched when the instance was mounted. Guests have no network and
|
|
84
|
+
* no DOM, so every byte a widget sees arrives through this interface.
|
|
85
|
+
*/
|
|
86
|
+
export declare interface WidgetAssetApi {
|
|
87
|
+
/**
|
|
88
|
+
* Resolves to a copy of the prefetched bytes for `src`; the widget may mutate it freely.
|
|
89
|
+
*
|
|
90
|
+
* Rejects when the resource was not prefetched: no `WidgetAssetProvider` was configured, the host
|
|
91
|
+
* failed to read it, or a property introduced it after mount. The first missing read per
|
|
92
|
+
* instance and `src` also reports `widget/asset-failed`. Callers must handle the rejection;
|
|
93
|
+
* ignoring it leaves an unhandled rejection in the guest worker.
|
|
94
|
+
*/
|
|
95
|
+
readBinary(src: string): Promise<Uint8Array>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Resolves the bytes behind an image / binary property value (`{ src, mode }`).
|
|
100
|
+
*
|
|
101
|
+
* The host prefetches every referenced resource when an instance mounts and hands the bytes to the
|
|
102
|
+
* guest, which has no network of its own. Not to be confused with `WidgetProvider`, which resolves
|
|
103
|
+
* widget definitions and code.
|
|
104
|
+
*/
|
|
105
|
+
export declare interface WidgetAssetProvider {
|
|
106
|
+
/**
|
|
107
|
+
* Resolves to the resource bytes. `inline` references are base64-decoded here, on the host, so
|
|
108
|
+
* the guest never sees encoded data. A rejection only skips this resource.
|
|
109
|
+
*/
|
|
110
|
+
resolve(ref: WidgetAssetRef): Promise<Uint8Array>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Image / binary property value from the shared descriptor contract (#7). */
|
|
114
|
+
export declare interface WidgetAssetRef {
|
|
115
|
+
readonly src: string;
|
|
116
|
+
readonly mode: 'file' | 'inline' | 'store';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export declare interface WidgetDefinition {
|
|
120
|
+
readonly properties: Readonly<Record<string, PropertyDefinition_2>>;
|
|
121
|
+
readonly ports: Readonly<Record<string, PortDefinition>>;
|
|
122
|
+
readonly displayName?: string;
|
|
123
|
+
readonly description?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Metadata passed to every port listener next to the payload. */
|
|
127
|
+
export declare interface WidgetDeliveryMeta {
|
|
128
|
+
/** Simulation time at which the host routed the payload. */
|
|
129
|
+
readonly simTime: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare interface WidgetDiagnostic {
|
|
133
|
+
readonly code: WidgetDiagnosticCode;
|
|
134
|
+
readonly instanceId?: string;
|
|
135
|
+
readonly widget?: string;
|
|
136
|
+
readonly message: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare type WidgetDiagnosticCode = 'widget/runtime-failed' | 'widget/unknown-widget' | 'widget/instance-exists' | 'widget/instance-not-found' | 'widget/mount-failed' | 'widget/render-failed' | 'widget/deliver-failed' | 'widget/asset-failed';
|
|
140
|
+
|
|
141
|
+
/** Default export of a widget implementation module. */
|
|
142
|
+
export declare type WidgetFactory = (api: WidgetInstanceApi) => WidgetInstance | void;
|
|
143
|
+
|
|
144
|
+
export declare interface WidgetHost {
|
|
145
|
+
/**
|
|
146
|
+
* Snapshot the host currently coordinates: the last document accepted by `loadDocument` or
|
|
147
|
+
* `applyCommand`. Starts as the empty document `{ version: 1, widgets: [] }`.
|
|
148
|
+
*
|
|
149
|
+
* Every call returns the current value, so a long-lived reference stays live.
|
|
150
|
+
*/
|
|
151
|
+
getDocument(): CanvasDocument;
|
|
152
|
+
/**
|
|
153
|
+
* Commits an already parsed document and mounts the instances it lists.
|
|
154
|
+
*
|
|
155
|
+
* Parsing stays with the caller (`parseCanvas`): the host still re-validates the snapshot it is
|
|
156
|
+
* handed, but it never guesses whether a value is text or a document.
|
|
157
|
+
*
|
|
158
|
+
* Resolves once the instances of this first pass finished mounting. A widget that fails to mount
|
|
159
|
+
* is reported through `onDiagnostic` and left out of `getLayers()` instead of rejecting this
|
|
160
|
+
* promise.
|
|
161
|
+
*
|
|
162
|
+
* @throws {SchematicError} when `document` is not a valid `.cnv` document or the bindings do not
|
|
163
|
+
* validate; neither the document nor the instances change in that case.
|
|
164
|
+
*/
|
|
165
|
+
loadDocument(document: CanvasDocument): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Applies one command to the current document.
|
|
168
|
+
*
|
|
169
|
+
* The new snapshot and the `onDocumentChange` notification happen synchronously; coordinating
|
|
170
|
+
* instances runs in the background and never rolls the document back. A rejected command leaves
|
|
171
|
+
* both the document and the instances untouched.
|
|
172
|
+
*
|
|
173
|
+
* @throws {SchematicError} when the command is invalid or the resulting bindings do not validate.
|
|
174
|
+
*/
|
|
175
|
+
applyCommand(command: CanvasCommand): void;
|
|
176
|
+
/** Subscribes to committed snapshots; returns the unsubscribe function. */
|
|
177
|
+
onDocumentChange(listener: (document: CanvasDocument) => void): () => void;
|
|
178
|
+
/**
|
|
179
|
+
* Drops every instance and mounts the current document again, so widgets restart from their
|
|
180
|
+
* initial state. Layers are emptied and repopulated.
|
|
181
|
+
*
|
|
182
|
+
* Each mount runs the widget factory again (fresh closure, canvas and subscriptions, initial
|
|
183
|
+
* props), but the guest keeps its module cache: a widget module is evaluated once per session.
|
|
184
|
+
* Module-level state is therefore not reset — the contract puts instance state in the factory.
|
|
185
|
+
*
|
|
186
|
+
* Resolves once every instance of the current document has mounted again. Failures are reported
|
|
187
|
+
* through `onDiagnostic` instead of rejecting, like every other coordination step.
|
|
188
|
+
*/
|
|
189
|
+
reset(): Promise<void>;
|
|
190
|
+
deliver(instanceId: string, port: string, payload: unknown, simTime: number): void;
|
|
191
|
+
dispatch(instanceId: string, event: WidgetInputEvent): void;
|
|
192
|
+
/** Bitmaps in document order; the same store for the lifetime of the host. */
|
|
193
|
+
getLayers(): WidgetLayers;
|
|
194
|
+
/** Changes the device pixel ratio of every layer and repaints all instances. */
|
|
195
|
+
resize(dpr: number): void;
|
|
196
|
+
/** Terminates the sandbox and closes every bitmap. */
|
|
197
|
+
dispose(): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export declare interface WidgetHostOptions {
|
|
201
|
+
readonly provider: WidgetProvider;
|
|
202
|
+
readonly container?: HTMLElement;
|
|
203
|
+
/** Device pixel ratio for new layers. Defaults to `devicePixelRatio`, or 1 outside a browser. */
|
|
204
|
+
readonly dpr?: number;
|
|
205
|
+
/** Receives failures that must not interrupt the caller. */
|
|
206
|
+
readonly onDiagnostic?: (diagnostic: WidgetDiagnostic) => void;
|
|
207
|
+
/** Receives port payloads published by widgets; topic routing is out of scope here. */
|
|
208
|
+
readonly onPublish?: (publish: WidgetPublish) => void;
|
|
209
|
+
/**
|
|
210
|
+
* Simulation the host is wired to: device publishes reach the widgets bound to their endpoint,
|
|
211
|
+
* and widget publishes reach the device bound to their port. Without it the host only reports
|
|
212
|
+
* publishes through `onPublish` and delivers what the host asks for.
|
|
213
|
+
*/
|
|
214
|
+
readonly simulation?: WidgetHostSimulation;
|
|
215
|
+
/**
|
|
216
|
+
* Prefetches image / binary property values when an instance mounts. Without it nothing is
|
|
217
|
+
* prefetched and `api.assets.readBinary` rejects.
|
|
218
|
+
*/
|
|
219
|
+
readonly assets?: WidgetAssetProvider;
|
|
220
|
+
/**
|
|
221
|
+
* Resolves widget definitions and schematic symbols for binding validation.
|
|
222
|
+
*
|
|
223
|
+
* Without it `loadDocument` / `applyCommand` only run the structural checks of the `.cnv`
|
|
224
|
+
* format; the reference checks that need the registry and the schematic are skipped.
|
|
225
|
+
*/
|
|
226
|
+
readonly catalog?: CanvasBindingCatalog;
|
|
227
|
+
/** Replaces the sandbox implementation; the default starts `@mica-js/sandbox` lazily. */
|
|
228
|
+
readonly sandbox?: WidgetSandboxFactory;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Simulation the host is connected to, so bound endpoints reach the widgets without a routing
|
|
233
|
+
* layer in between.
|
|
234
|
+
*
|
|
235
|
+
* Both sides live on this thread: the host resolves the binding synchronously and hands the
|
|
236
|
+
* payload to the widget sandbox, which is the only hop left (a microtask, not a worker). A
|
|
237
|
+
* `DeviceSimExecutor` from `@mica-js/simulator` satisfies this interface structurally.
|
|
238
|
+
*/
|
|
239
|
+
export declare interface WidgetHostSimulation {
|
|
240
|
+
/** Publishes from the simulation; the returned function unsubscribes. */
|
|
241
|
+
onPublish(listener: (publish: SimulationPublish) => void): () => void;
|
|
242
|
+
/** Forwards a widget payload to the endpoint its port is bound to. */
|
|
243
|
+
deliver(target: CanvasBindingTarget, payload: unknown): void;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Pointer or keyboard input forwarded to one instance. */
|
|
247
|
+
export declare interface WidgetInputEvent {
|
|
248
|
+
/** DOM event type, e.g. `pointerdown`, `pointermove` or `keydown`. */
|
|
249
|
+
readonly type: string;
|
|
250
|
+
/** Pointer position in logical widget units, for pointer events. */
|
|
251
|
+
readonly x?: number;
|
|
252
|
+
readonly y?: number;
|
|
253
|
+
readonly button?: number;
|
|
254
|
+
readonly buttons?: number;
|
|
255
|
+
/** `KeyboardEvent.key`, for keyboard events. */
|
|
256
|
+
readonly key?: string;
|
|
257
|
+
readonly code?: string;
|
|
258
|
+
readonly repeat?: boolean;
|
|
259
|
+
readonly altKey?: boolean;
|
|
260
|
+
readonly ctrlKey?: boolean;
|
|
261
|
+
readonly metaKey?: boolean;
|
|
262
|
+
readonly shiftKey?: boolean;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Object a widget factory may return. Every hook is optional, so a pure-logic widget can return
|
|
267
|
+
* nothing at all; an instance without `render` still produces one blank frame per repaint.
|
|
268
|
+
*/
|
|
269
|
+
export declare interface WidgetInstance {
|
|
270
|
+
/** Draws using logical units; the context is already scaled by the device pixel ratio. */
|
|
271
|
+
render?(context: OffscreenCanvasRenderingContext2D): void;
|
|
272
|
+
input?(event: WidgetInputEvent): void;
|
|
273
|
+
dispose?(): void;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Per-instance API handed to a widget factory. Sizes are logical units: the guest runtime applies
|
|
278
|
+
* the device pixel ratio, so widgets never multiply coordinates themselves.
|
|
279
|
+
*/
|
|
280
|
+
export declare interface WidgetInstanceApi {
|
|
281
|
+
readonly instanceId: string;
|
|
282
|
+
readonly width: number;
|
|
283
|
+
readonly height: number;
|
|
284
|
+
/** Document props merged over `definition.properties[*].default`. */
|
|
285
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
286
|
+
/** Prefetched image / binary resources for this instance. */
|
|
287
|
+
readonly assets: WidgetAssetApi;
|
|
288
|
+
/** Subscribes to one input port; the returned function unsubscribes. */
|
|
289
|
+
subscribe(port: string, listener: WidgetPortListener): () => void;
|
|
290
|
+
/**
|
|
291
|
+
* Sends a payload out of one output port.
|
|
292
|
+
*
|
|
293
|
+
* `simTime` is the simulation time the widget reacted to. The current host has no simulation
|
|
294
|
+
* clock, so an omitted value is published as `0`.
|
|
295
|
+
*/
|
|
296
|
+
publish(port: string, payload: unknown, simTime?: number): void;
|
|
297
|
+
/** Requests a repaint; repeated calls in the same tick coalesce into one frame. */
|
|
298
|
+
invalidate(): void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Read-only view of one mounted instance's latest frame. */
|
|
302
|
+
export declare interface WidgetLayer {
|
|
303
|
+
readonly instanceId: string;
|
|
304
|
+
readonly width: number;
|
|
305
|
+
readonly height: number;
|
|
306
|
+
readonly dpr: number;
|
|
307
|
+
/** Latest frame; `undefined` until the guest produces its first bitmap. */
|
|
308
|
+
readonly bitmap: ImageBitmap | undefined;
|
|
309
|
+
/** Increments with every new frame, so consumers know when to repaint. */
|
|
310
|
+
readonly sequence: number;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export declare type WidgetLayerChange = {
|
|
314
|
+
readonly type: 'added';
|
|
315
|
+
readonly instanceId: string;
|
|
316
|
+
} | {
|
|
317
|
+
readonly type: 'updated';
|
|
318
|
+
readonly instanceId: string;
|
|
319
|
+
} | {
|
|
320
|
+
readonly type: 'removed';
|
|
321
|
+
readonly instanceId: string;
|
|
322
|
+
}
|
|
323
|
+
/** Drawing order changed; no layer was mounted or unmounted. */
|
|
324
|
+
| {
|
|
325
|
+
readonly type: 'reordered';
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export declare interface WidgetLayers {
|
|
329
|
+
/** Document order (`document.widgets`), so the host or editor can composite in drawing order. */
|
|
330
|
+
list(): readonly WidgetLayer[];
|
|
331
|
+
get(instanceId: string): WidgetLayer | undefined;
|
|
332
|
+
subscribe(listener: (change: WidgetLayerChange) => void): () => void;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Thrown when a widget reference resolves to a package that cannot be turned into a module. */
|
|
336
|
+
export declare class WidgetLoadError extends Error {
|
|
337
|
+
readonly code: WidgetLoadErrorCode;
|
|
338
|
+
readonly packageId: string | undefined;
|
|
339
|
+
readonly path: string | undefined;
|
|
340
|
+
constructor(code: WidgetLoadErrorCode, message: string, options?: WidgetLoadErrorOptions);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export declare type WidgetLoadErrorCode = 'widget/package-not-found' | 'widget/invalid-manifest' | 'widget/invalid-definition' | 'widget/no-implementation' | 'widget/not-self-contained' | 'widget/load-failed';
|
|
344
|
+
|
|
345
|
+
export declare interface WidgetLoadErrorOptions {
|
|
346
|
+
/** Package id, when the package was already identified. */
|
|
347
|
+
readonly packageId?: string;
|
|
348
|
+
/** Package-relative path the failure refers to. */
|
|
349
|
+
readonly path?: string;
|
|
350
|
+
readonly cause?: unknown;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** A widget implementation and the data that describes it. */
|
|
354
|
+
export declare interface WidgetModule {
|
|
355
|
+
/** Ports and properties described by the widget definition. */
|
|
356
|
+
readonly definition: WidgetDefinition;
|
|
357
|
+
/** Widget implementation module source, passed through verbatim; the loader does not inspect it. */
|
|
358
|
+
readonly code: string;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export declare interface WidgetPackage {
|
|
362
|
+
readonly id: string;
|
|
363
|
+
readonly version: string;
|
|
364
|
+
/**
|
|
365
|
+
* SHA-256 (hex) over the `[widget id, source]` pairs in widget-id order, so distinct package
|
|
366
|
+
* contents never collide and reordering the manifest does not change the hash.
|
|
367
|
+
*/
|
|
368
|
+
readonly contentHash: string;
|
|
369
|
+
readonly modules: Readonly<Record<string, WidgetModule>>;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** Listener registered for one input port through `WidgetInstanceApi.subscribe`. */
|
|
373
|
+
export declare type WidgetPortListener = (payload: unknown, meta: WidgetDeliveryMeta) => void;
|
|
374
|
+
|
|
375
|
+
export declare interface WidgetProvider {
|
|
376
|
+
/** Resolves a module; an unknown reference returns `undefined`, a broken one throws. */
|
|
377
|
+
resolve(ref: string): Promise<WidgetModule | undefined>;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/** Port payload a widget published; routing belongs to a later layer. */
|
|
381
|
+
export declare interface WidgetPublish {
|
|
382
|
+
readonly instanceId: string;
|
|
383
|
+
readonly port: string;
|
|
384
|
+
readonly payload: unknown;
|
|
385
|
+
/** Simulation time the widget attached; `0` when it did not pass one. */
|
|
386
|
+
readonly simTime: number;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Minimal sandbox surface the host depends on. The default implementation wraps
|
|
391
|
+
* `@mica-js/sandbox` through `createSandbox`; tests inject a fake with the same shape.
|
|
392
|
+
*/
|
|
393
|
+
export declare interface WidgetSandbox {
|
|
394
|
+
readonly state: 'ready' | 'terminated';
|
|
395
|
+
call(method: string, ...args: unknown[]): Promise<unknown>;
|
|
396
|
+
on(type: string, listener: (payload: unknown) => void): () => void;
|
|
397
|
+
terminate(reason?: string): Promise<void>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export declare type WidgetSandboxFactory = (options: WidgetSandboxHostOptions) => Promise<WidgetSandbox>;
|
|
401
|
+
|
|
402
|
+
export declare interface WidgetSandboxHostOptions {
|
|
403
|
+
/** Element that hosts the hidden sandbox iframe. */
|
|
404
|
+
readonly container?: HTMLElement;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export { }
|