lumiverse-spindle-types 0.4.47 → 0.4.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.4.47",
3
+ "version": "0.4.48",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/dom.ts CHANGED
@@ -16,6 +16,15 @@ export interface SpindleDOMHelper {
16
16
  attrs?: Record<string, string>
17
17
  ): HTMLElementTagNameMap[K];
18
18
 
19
+ /**
20
+ * Create a host-managed sandboxed iframe for extension-owned HTML/CSS/JS.
21
+ *
22
+ * The host always applies `sandbox="allow-scripts"` without
23
+ * `allow-same-origin`, plus a strict child-document CSP and a narrow
24
+ * postMessage bridge. Use this instead of creating raw iframes.
25
+ */
26
+ createSandboxFrame(options: SpindleSandboxFrameOptions): SpindleSandboxFrameHandle;
27
+
19
28
  /** Query within this extension's own injected elements only */
20
29
  query(selector: string): Element | null;
21
30
 
@@ -161,6 +170,34 @@ export interface SpindleInputBarActionHandle {
161
170
  destroy(): void;
162
171
  }
163
172
 
173
+ // ── Sandboxed Frame ──
174
+
175
+ export interface SpindleSandboxFrameOptions {
176
+ /** HTML document or fragment rendered inside the sandboxed iframe. */
177
+ html: string;
178
+ /** Automatically resize the host iframe to fit the child content. Default: `true`. */
179
+ autoResize?: boolean;
180
+ /** Initial host iframe height in CSS pixels. Default: `minHeight` or `40`. */
181
+ initialHeight?: number;
182
+ /** Minimum host iframe height in CSS pixels. Default: `40`. */
183
+ minHeight?: number;
184
+ /** Maximum host iframe height in CSS pixels. Default: `4000`. */
185
+ maxHeight?: number;
186
+ }
187
+
188
+ export interface SpindleSandboxFrameHandle {
189
+ /** The sandboxed iframe element. Extensions may place and style it like any other element. */
190
+ element: HTMLIFrameElement;
191
+ /** Replace the child document contents. */
192
+ setContent(html: string): void;
193
+ /** Send a message payload into the child sandbox runtime. */
194
+ postMessage(payload: unknown): void;
195
+ /** Receive payloads sent from the child sandbox runtime. */
196
+ onMessage(handler: (payload: unknown) => void): () => void;
197
+ /** Destroy the sandbox and remove the iframe from the DOM. */
198
+ destroy(): void;
199
+ }
200
+
164
201
  export interface SpindleUploadFile {
165
202
  name: string;
166
203
  mimeType: string;
package/src/index.ts CHANGED
@@ -137,11 +137,13 @@ export type {
137
137
  SpindleDockPanelHandle,
138
138
  SpindleAppMountOptions,
139
139
  SpindleAppMountHandle,
140
- SpindleInputBarActionOptions,
141
- SpindleInputBarActionHandle,
142
- SpindleContextMenuOptions,
143
- SpindleContextMenuItemDef,
144
- SpindleContextMenuResult,
140
+ SpindleInputBarActionOptions,
141
+ SpindleInputBarActionHandle,
142
+ SpindleSandboxFrameOptions,
143
+ SpindleSandboxFrameHandle,
144
+ SpindleContextMenuOptions,
145
+ SpindleContextMenuItemDef,
146
+ SpindleContextMenuResult,
145
147
  SpindleModalOptions,
146
148
  SpindleModalHandle,
147
149
  SpindleConfirmVariant,