typebulb 0.7.2 → 0.9.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.
@@ -0,0 +1,28 @@
1
+ export interface RenderBulbResult {
2
+ /** Complete standalone HTML document, ready for an iframe srcdoc. */
3
+ html?: string
4
+ /** Set instead of `html` when the source couldn't be rendered. */
5
+ error?: string
6
+ }
7
+
8
+ /** Compile a bulb source string to a standalone HTML document (client-only).
9
+ * Pass `theme` to force the embed's light/dark mode (e.g. match the host). */
10
+ export declare function renderBulb(source: string, opts?: { theme?: 'light' | 'dark' }): Promise<RenderBulbResult>
11
+
12
+ export interface BulbFrameOptions {
13
+ /** Force light/dark. Omit to inherit the host's `data-theme` automatically. */
14
+ theme?: 'light' | 'dark'
15
+ /** Floor for auto-height; the frame grows past it but never shrinks below. Default 320. */
16
+ minHeight?: number
17
+ /** Ceiling for auto-height; bounds an absurd height from a buggy/hostile embed. Default 100000. */
18
+ maxHeight?: number
19
+ /** Called with a message when the embed throws at runtime (post-mount). */
20
+ onError?: (message: string) => void
21
+ /** Abort to remove the frame's host-side `message` listener (host owns lifecycle). */
22
+ signal?: AbortSignal
23
+ }
24
+
25
+ /** Render a bulb and return a ready-to-mount, sandboxed iframe: owns the
26
+ * `allow-scripts` sandbox policy and the host<->embed protocol (auto-height +
27
+ * runtime-error forwarding). Rejects if the bulb can't compile. */
28
+ export declare function createBulbFrame(source: string, opts?: BulbFrameOptions): Promise<HTMLIFrameElement>