@iframe-resizer/core 6.0.0-beta.2 → 6.0.0-beta.4

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/index.d.ts CHANGED
@@ -1,3 +1,165 @@
1
- export { LOG_COLLAPSED, LOG_DISABLED, LOG_EXPANDED } from '../common/consts';
2
- export type { Direction, IFrameComponent, IFrameMessageData, IFrameMouseData, IFrameObject, IFrameOptions, IFrameResizedData, IFrameScrollData, LogOption, MessageData, ScrollOption, } from './types';
3
- export default function connectResizer(options: Record<string, any>): (iframe: HTMLIFrameElement) => any;
1
+ declare const AUTO = "auto";
2
+
3
+ declare const BOTH = "both";
4
+
5
+ declare const COLLAPSE = "collapsed";
6
+
7
+ declare function connectResizer(options: Record<string, any>): (iframe: HTMLIFrameElement) => any;
8
+ export default connectResizer;
9
+
10
+ export declare type Direction = typeof VERTICAL | typeof HORIZONTAL | typeof NONE | typeof BOTH;
11
+
12
+ declare const EXPAND = "expanded";
13
+
14
+ declare const HORIZONTAL = "horizontal";
15
+
16
+ /** HTMLIFrameElement with the `iframeResizer` control object attached. */
17
+ export declare interface IframeComponent extends HTMLIFrameElement {
18
+ iframeResizer: IframeObject;
19
+ }
20
+
21
+ export declare interface IframeMessageData {
22
+ iframe: IframeComponent;
23
+ message: any;
24
+ }
25
+
26
+ export declare interface IframeMouseData {
27
+ iframe: IframeComponent;
28
+ screenX: number;
29
+ screenY: number;
30
+ type: string;
31
+ }
32
+
33
+ export declare interface IframeObject {
34
+ /** Remove the iframe from the page. */
35
+ close(): void;
36
+ /** Disconnect iframe-resizer from the iframe. */
37
+ disconnect(): void;
38
+ /** Move the page in the iframe to the specified anchor. */
39
+ moveToAnchor(anchor: string): void;
40
+ /** Send a message to the iframe. */
41
+ sendMessage(message: any, targetOrigin?: string): void;
42
+ }
43
+
44
+ export declare interface IframeOptions {
45
+ /** Override the body background style in the iframe. */
46
+ bodyBackground?: string | null;
47
+ /**
48
+ * Override the default body margin style in the iframe.
49
+ * A string can be any valid value for the CSS margin attribute, for example '8px 3em'.
50
+ * A number value is converted into px.
51
+ */
52
+ bodyMargin?: number | string | null;
53
+ /**
54
+ * Override the default body padding style in the iframe.
55
+ * A string can be any valid value for the CSS padding attribute, for example '8px 3em'.
56
+ * A number value is converted into px.
57
+ */
58
+ bodyPadding?: number | string | null;
59
+ /**
60
+ * When set to true, only allow incoming messages from the domain listed in the
61
+ * src property of the iframe tag. If your iframe navigates between different
62
+ * domains, ports or protocols; then you will need to provide an array of URLs
63
+ * or disable this option.
64
+ */
65
+ checkOrigin?: boolean | string[];
66
+ /** Set the resizing direction of the iframe. */
67
+ direction?: Direction;
68
+ /** Custom iframe id. */
69
+ id?: string;
70
+ /**
71
+ * When enabled, in-page linking inside the iframe and from the iframe to the
72
+ * parent page will be enabled.
73
+ */
74
+ inPageLinks?: boolean;
75
+ /** Set iframe-resizer license key. */
76
+ license: string;
77
+ /** Enable/disable console logging. */
78
+ log?: LogOption;
79
+ /** Set offset size of iframe content. */
80
+ offsetSize?: number;
81
+ /** Enable scroll bars in the iframe. */
82
+ scrolling?: ScrollOption;
83
+ /**
84
+ * Set the number of pixels the iframe content size has to change by,
85
+ * before triggering a resize of the iframe.
86
+ */
87
+ tolerance?: number;
88
+ /** Wait for the iframe to load before initializing. */
89
+ waitForLoad?: boolean;
90
+ /** Timeout in ms before warning if iframe has not responded. */
91
+ warningTimeout?: number;
92
+ /**
93
+ * Called before iframe is closed via parentIframe.close() or
94
+ * iframe.iframeResizer.close() methods. Returning false will prevent
95
+ * the iframe from closing.
96
+ */
97
+ onBeforeClose?(iframeId: string): boolean | void;
98
+ /** Called after iframe is closed. */
99
+ onAfterClose?(iframeId: string): void;
100
+ /** Called when pointer enters the iframe. */
101
+ onMouseEnter?(data: IframeMouseData): void;
102
+ /** Called when pointer leaves the iframe. */
103
+ onMouseLeave?(data: IframeMouseData): void;
104
+ /** Called when iframe-resizer has been initialized. */
105
+ onReady?(iframe: IframeComponent): void;
106
+ /**
107
+ * Receive message posted from the iframe with the
108
+ * parentIframe.sendMessage() method.
109
+ */
110
+ onMessage?(data: IframeMessageData): void;
111
+ /**
112
+ * Called after iframe resized. Passes event data containing the iframe,
113
+ * height, width and the type of event that triggered the resize.
114
+ */
115
+ onResized?(data: IframeResizedData): void;
116
+ /**
117
+ * Called before the page is repositioned after a request from the iframe.
118
+ * If this function returns false, it will stop the library from
119
+ * repositioning the page, so that you can implement your own scrolling.
120
+ */
121
+ onScroll?(data: IframeScrollData): boolean;
122
+ }
123
+
124
+ export declare interface IframeResizedData {
125
+ iframe: IframeComponent;
126
+ height: number;
127
+ width: number;
128
+ type: string;
129
+ }
130
+
131
+ export declare interface IframeScrollData {
132
+ iframe: IframeComponent;
133
+ top: number;
134
+ left: number;
135
+ }
136
+
137
+ export declare const LOG_COLLAPSED = 1;
138
+
139
+ export declare const LOG_DISABLED = 0;
140
+
141
+ export declare const LOG_EXPANDED = 2;
142
+
143
+ export declare type LogOption = boolean | typeof EXPAND | typeof COLLAPSE | number;
144
+
145
+ export declare interface MessageData {
146
+ id: string;
147
+ iframe: HTMLIFrameElement;
148
+ height: number;
149
+ width: number;
150
+ type: string;
151
+ msg?: string;
152
+ message?: string;
153
+ mode?: string;
154
+ [key: string]: any;
155
+ }
156
+
157
+ declare const NONE = "none";
158
+
159
+ declare const OMIT = "omit";
160
+
161
+ export declare type ScrollOption = boolean | typeof AUTO | typeof OMIT;
162
+
163
+ declare const VERTICAL = "vertical";
164
+
165
+ export { }