UNPKG

3.41 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 * Loading for the iFrame
23 *
24 * ### Notes
25 * By default, 'eager' loading is chosen
26 *
27 * For more information, see
28 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/loading
29 */
30 get loading(): IFrame.Loading;
31 set loading(value: IFrame.Loading);
32 /**
33 * Exceptions to the sandboxing.
34 *
35 * #### Notes
36 * By default, all sandboxing security policies are enabled.
37 * This setting allows the user to selectively disable these
38 * policies. This should be done with care, as it can
39 * introduce security risks, and possibly allow malicious
40 * sites to execute code in a JupyterLab session.
41 *
42 * For more information, see
43 * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
44 */
45 get sandbox(): IFrame.SandboxExceptions[];
46 set sandbox(values: IFrame.SandboxExceptions[]);
47 /**
48 * The url of the IFrame.
49 */
50 get url(): string;
51 set url(url: string);
52 private _sandbox;
53 private _referrerPolicy;
54 private _loading;
55}
56/**
57 * A namespace for IFrame widget statics.
58 */
59export declare namespace IFrame {
60 /**
61 * Referrer policy for the iframe.
62 *
63 * User documentation for the policies can be found here:
64 * https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
65 */
66 type ReferrerPolicy = 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
67 /**
68 * Exceptions to the iframe sandboxing policies.
69 * These are specified here:
70 * https://www.w3.org/TR/2011/WD-html5-20110525/the-iframe-element.html#attr-iframe-sandbox
71 *
72 * More user-friendly documentation can be found here:
73 * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
74 */
75 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';
76 /**
77 * The loading attribute for the iframe.
78 * It can be either 'eager' or 'lazy'.
79 */
80 type Loading = 'eager' | 'lazy';
81 /**
82 * Options for creating a new IFrame widget.
83 */
84 interface IOptions {
85 /**
86 * Exceptions for the iframe sandbox.
87 */
88 sandbox?: SandboxExceptions[];
89 /**
90 * Referrer policy for the iframe.
91 */
92 referrerPolicy?: ReferrerPolicy;
93 /**
94 * The loading attribute for the iframe.
95 */
96 loading?: Loading;
97 }
98}