@iframe-resizer/core 5.5.9-beta.1 → 6.0.0-beta.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.
- package/LICENSE +2 -2
- package/README.md +1 -1
- package/index.cjs.js +34 -20
- package/index.cjs.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.esm.js +1001 -20
- package/index.esm.js.map +1 -1
- package/index.umd.js +37 -20
- package/index.umd.js.map +1 -1
- package/package.json +2 -1
- package/types.d.ts +130 -0
package/types.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for iframe-resizer.
|
|
3
|
+
* Canonical source of truth for the parent-side public API.
|
|
4
|
+
*/
|
|
5
|
+
export interface IFrameObject {
|
|
6
|
+
/** Remove the iframe from the page. */
|
|
7
|
+
close(): void;
|
|
8
|
+
/** Disconnect iframe-resizer from the iframe. */
|
|
9
|
+
disconnect(): void;
|
|
10
|
+
/** Move the page in the iframe to the specified anchor. */
|
|
11
|
+
moveToAnchor(anchor: string): void;
|
|
12
|
+
/** Tell iframe-resizer to re-measure the iframe. */
|
|
13
|
+
resize(): void;
|
|
14
|
+
/** Send a message to the iframe. */
|
|
15
|
+
sendMessage(message: any, targetOrigin?: string): void;
|
|
16
|
+
}
|
|
17
|
+
/** HTMLIFrameElement with the `iFrameResizer` control object attached. */
|
|
18
|
+
export interface IFrameComponent extends HTMLIFrameElement {
|
|
19
|
+
iFrameResizer: IFrameObject;
|
|
20
|
+
}
|
|
21
|
+
export interface IFrameMouseData {
|
|
22
|
+
iframe: IFrameComponent;
|
|
23
|
+
screenX: number;
|
|
24
|
+
screenY: number;
|
|
25
|
+
type: string;
|
|
26
|
+
}
|
|
27
|
+
export interface IFrameResizedData {
|
|
28
|
+
iframe: IFrameComponent;
|
|
29
|
+
height: number;
|
|
30
|
+
width: number;
|
|
31
|
+
type: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IFrameMessageData {
|
|
34
|
+
iframe: IFrameComponent;
|
|
35
|
+
message: any;
|
|
36
|
+
}
|
|
37
|
+
export interface IFrameScrollData {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}
|
|
41
|
+
export interface IFrameOptions {
|
|
42
|
+
/** Override the body background style in the iframe. */
|
|
43
|
+
bodyBackground?: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Override the default body margin style in the iframe.
|
|
46
|
+
* A string can be any valid value for the CSS margin attribute, for example '8px 3em'.
|
|
47
|
+
* A number value is converted into px.
|
|
48
|
+
*/
|
|
49
|
+
bodyMargin?: number | string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Override the default body padding style in the iframe.
|
|
52
|
+
* A string can be any valid value for the CSS padding attribute, for example '8px 3em'.
|
|
53
|
+
* A number value is converted into px.
|
|
54
|
+
*/
|
|
55
|
+
bodyPadding?: number | string | null;
|
|
56
|
+
/**
|
|
57
|
+
* When set to true, only allow incoming messages from the domain listed in the
|
|
58
|
+
* src property of the iframe tag. If your iframe navigates between different
|
|
59
|
+
* domains, ports or protocols; then you will need to provide an array of URLs
|
|
60
|
+
* or disable this option.
|
|
61
|
+
*/
|
|
62
|
+
checkOrigin?: boolean | string[];
|
|
63
|
+
/** Set the resizing direction of the iframe. */
|
|
64
|
+
direction?: 'vertical' | 'horizontal' | 'none' | 'both';
|
|
65
|
+
/** Custom iframe id. */
|
|
66
|
+
id?: string;
|
|
67
|
+
/**
|
|
68
|
+
* When enabled, in-page linking inside the iframe and from the iframe to the
|
|
69
|
+
* parent page will be enabled.
|
|
70
|
+
*/
|
|
71
|
+
inPageLinks?: boolean;
|
|
72
|
+
/** Set iframe-resizer license key. */
|
|
73
|
+
license: string;
|
|
74
|
+
/** Enable/disable console logging. */
|
|
75
|
+
log?: boolean | 'expanded' | 'collapsed' | number;
|
|
76
|
+
/** Set offset size of iframe content. */
|
|
77
|
+
offsetSize?: number;
|
|
78
|
+
/** Enable scroll bars in the iframe. */
|
|
79
|
+
scrolling?: boolean | 'auto' | 'omit';
|
|
80
|
+
/**
|
|
81
|
+
* Set the number of pixels the iframe content size has to change by,
|
|
82
|
+
* before triggering a resize of the iframe.
|
|
83
|
+
*/
|
|
84
|
+
tolerance?: number;
|
|
85
|
+
/** Wait for the iframe to load before initializing. */
|
|
86
|
+
waitForLoad?: boolean;
|
|
87
|
+
/** Timeout in ms before warning if iframe has not responded. */
|
|
88
|
+
warningTimeout?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Called before iframe is closed via parentIFrame.close() or
|
|
91
|
+
* iframe.iFrameResizer.close() methods. Returning false will prevent
|
|
92
|
+
* the iframe from closing.
|
|
93
|
+
*/
|
|
94
|
+
onBeforeClose?(iframeId: string): boolean | void;
|
|
95
|
+
/** Called after iframe is closed. */
|
|
96
|
+
onAfterClose?(iframeId: string): void;
|
|
97
|
+
/** Called when pointer enters the iframe. */
|
|
98
|
+
onMouseEnter?(data: IFrameMouseData): void;
|
|
99
|
+
/** Called when pointer leaves the iframe. */
|
|
100
|
+
onMouseLeave?(data: IFrameMouseData): void;
|
|
101
|
+
/** Called when iframe-resizer has been initialized. */
|
|
102
|
+
onReady?(iframe: IFrameComponent): void;
|
|
103
|
+
/**
|
|
104
|
+
* Receive message posted from the iframe with the
|
|
105
|
+
* parentIFrame.sendMessage() method.
|
|
106
|
+
*/
|
|
107
|
+
onMessage?(data: IFrameMessageData): void;
|
|
108
|
+
/**
|
|
109
|
+
* Called after iframe resized. Passes event data containing the iframe,
|
|
110
|
+
* height, width and the type of event that triggered the resize.
|
|
111
|
+
*/
|
|
112
|
+
onResized?(data: IFrameResizedData): void;
|
|
113
|
+
/**
|
|
114
|
+
* Called before the page is repositioned after a request from the iframe.
|
|
115
|
+
* If this function returns false, it will stop the library from
|
|
116
|
+
* repositioning the page, so that you can implement your own scrolling.
|
|
117
|
+
*/
|
|
118
|
+
onScroll?(data: IFrameScrollData): boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface MessageData {
|
|
121
|
+
id: string;
|
|
122
|
+
iframe: HTMLIFrameElement;
|
|
123
|
+
height: number;
|
|
124
|
+
width: number;
|
|
125
|
+
type: string;
|
|
126
|
+
msg?: string;
|
|
127
|
+
message?: string;
|
|
128
|
+
mode?: string;
|
|
129
|
+
[key: string]: any;
|
|
130
|
+
}
|