UNPKG

2.84 kBTypeScriptView Raw
1import { Widget } from '@lumino/widgets';
2/**
3 * A Lumino widget which wraps an IFrame.
4 */
5export declare class IFrame extends Widget {
6 /**
7 * Create a new IFrame widget.
8 */
9 constructor(options?: IFrame.IOptions);
10 /**
11 * Referrer policy for the iframe.
12 *
13 * #### Notes
14 * By default, `no-referrer` is chosen.
15 *
16 * For more information, see
17 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
18 */
19 get referrerPolicy(): IFrame.ReferrerPolicy;
20 set referrerPolicy(value: IFrame.ReferrerPolicy);
21 /**
22 * Exceptions to the sandboxing.
23 *
24 * #### Notes
25 * By default, all sandboxing security policies are enabled.
26 * This setting allows the user to selectively disable these
27 * policies. This should be done with care, as it can
28 * introduce security risks, and possibly allow malicious
29 * sites to execute code in a JupyterLab session.
30 *
31 * For more information, see
32 * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
33 */
34 get sandbox(): IFrame.SandboxExceptions[];
35 set sandbox(values: IFrame.SandboxExceptions[]);
36 /**
37 * The url of the IFrame.
38 */
39 get url(): string;
40 set url(url: string);
41 private _sandbox;
42 private _referrerPolicy;
43}
44/**
45 * A namespace for IFrame widget statics.
46 */
47export declare namespace IFrame {
48 /**
49 * Referrer policy for the iframe.
50 *
51 * User documentation for the policies can be found here:
52 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
53 */
54 type ReferrerPolicy = 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
55 /**
56 * Exceptions to the iframe sandboxing policies.
57 * These are specified here:
58 * https://www.w3.org/TR/2011/WD-html5-20110525/the-iframe-element.html#attr-iframe-sandbox
59 *
60 * More user-friendly documentation can be found here:
61 * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
62 */
63 type SandboxExceptions = 'allow-downloads' | 'allow-forms' | 'allow-modals' | 'allow-orientation-lock' | 'allow-pointer-lock' | 'allow-popups' | 'popups-to-escape-sandbox' | 'allow-presentation' | 'allow-same-origin' | 'allow-scripts' | 'allow-storage-access-by-user-activation' | 'allow-top-navigation' | 'allow-top-navigation-by-user-activation';
64 /**
65 * Options for creating a new IFrame widget.
66 */
67 interface IOptions {
68 /**
69 * Exceptions for the iframe sandbox.
70 */
71 sandbox?: SandboxExceptions[];
72 /**
73 * Referrer policy for the iframe.
74 */
75 referrerPolicy?: ReferrerPolicy;
76 }
77}