@iframe-resizer/child 6.0.0-beta.2 → 6.0.0-beta.3

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": "@iframe-resizer/child",
3
- "version": "6.0.0-beta.2",
3
+ "version": "6.0.0-beta.3",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
@@ -19,8 +19,8 @@
19
19
  },
20
20
  "main": "index.cjs.js",
21
21
  "module": "index.esm.js",
22
+ "types": "index.d.ts",
22
23
  "browser": "index.umd.js",
23
- "types": "iframe-resizer.child.d.ts",
24
24
  "keywords": [
25
25
  "iframe",
26
26
  "Resizing",
@@ -1,168 +0,0 @@
1
- /**
2
- * @fileoverview Type definitions for @iframe-resizer/child
3
- *
4
- * This is a fork of the DefinitelyTyped type definitions for iframe-resizer,
5
- * updated to include the new API methods/options and remove deprecated ones.
6
- * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/iframe-resizer/index.d.ts
7
- *
8
- * I'm not a TypeScript dev, so please feel free to submit PRs to improve this file.
9
- */
10
-
11
- declare module '@iframe-resizer/child' {
12
- namespace iframeResizer {
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
- interface IFramePageOptions {
15
- /**
16
- * This option allows you to restrict the domain of the parent page,
17
- * to prevent other sites mimicking your parent page.
18
- */
19
-
20
- ignoreSelector?: string | undefined
21
-
22
- offsetSize?: number | undefined
23
-
24
- sizeSelector?: string | undefined
25
-
26
- targetOrigin?: string | undefined
27
-
28
- /**
29
- * Called before new size is set. Return a number to modify the new size.
30
- */
31
- onBeforeResize?(
32
- newSize: number,
33
- event: string,
34
- direction: 'height' | 'width',
35
- ): number
36
-
37
- /**
38
- * Receive message posted from the parent page with the iframe.iframeResizer.sendMessage() method.
39
- */
40
- onMessage?(message: any): void
41
-
42
- /**
43
- * This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page.
44
- */
45
- onReady?(): void
46
- }
47
-
48
- // eslint-disable-next-line @typescript-eslint/naming-convention
49
- interface IFramePage {
50
- /**
51
- * Turn autoResizing of the iFrame on and off. Returns bool of current state.
52
- */
53
- autoResize(resize?: boolean): boolean
54
-
55
- /**
56
- * Remove the iFrame from the parent page.
57
- */
58
- close(): void
59
-
60
- /**
61
- * Returns the ID of the iFrame that the page is contained in.
62
- */
63
- getId(): string
64
-
65
- /**
66
- * Returns the origin of the parent page that the iFrame is contained in.
67
- */
68
- getParentOrigin(): string
69
-
70
- /**
71
- * Ask the containing page for its positioning coordinates.
72
- *
73
- * Your callback function will be recalled when the parent page is scrolled or resized.
74
- *
75
- * Pass false to disable the callback.
76
- */
77
- getParentProps(callback: (data: ParentProps) => void): () => void
78
-
79
- /**
80
- * Move to anchor in parent page.
81
- */
82
- moveToAnchor(hash: string): void
83
-
84
- /**
85
- * Scroll the parent page by x and y
86
- */
87
- scrollBy(x: number, y: number): void
88
-
89
- /**
90
- * Scroll the parent page to the coordinates x and y
91
- */
92
- scrollTo(x: number, y: number): void
93
-
94
- /**
95
- * Scroll the parent page to the coordinates x and y relative to the position of the iFrame.
96
- */
97
- scrollToOffset(x: number, y: number): void
98
-
99
- /**
100
- * Send data to the containing page, message can be any data type that can be serialized into JSON. The `targetOrigin`
101
- * option is used to restrict where the message is sent to; to stop an attacker mimicking your parent page.
102
- * See the MDN documentation on postMessage for more details.
103
- */
104
- sendMessage(message: any, targetOrigin?: string): void
105
-
106
- /**
107
- * Set offsetSize.
108
- */
109
- setOffsetSize(offsetSize: number): void
110
-
111
- /**
112
- * Set default target origin.
113
- */
114
- setTargetOrigin(targetOrigin: string): void
115
-
116
- /**
117
- * Manually force iFrame to resize. To use passed arguments you need first to disable the `autoResize` option to
118
- * prevent auto resizing and enable the `sizeWidth` option if you wish to set the width.
119
- */
120
- resize(customHeight?: string, customWidth?: string): void
121
- }
122
-
123
- interface ParentProps {
124
- /**
125
- * The values returned by iframe.getBoundingClientRect()
126
- */
127
- iframe: {
128
- x: number
129
- y: number
130
- width: number
131
- height: number
132
- top: number
133
- right: number
134
- bottom: number
135
- left: number
136
- }
137
-
138
- /**
139
- * The values returned by document.documentElement.scrollWidth and document.documentElement.scrollHeight
140
- */
141
- document: {
142
- scrollWidth: number
143
- scrollHeight: number
144
- }
145
-
146
- /**
147
- * The values returned by window.visualViewport
148
- */
149
- viewport: {
150
- width: number
151
- height: number
152
- offsetLeft: number
153
- offsetTop: number
154
- pageLeft: number
155
- pageTop: number
156
- scale: number
157
- }
158
- }
159
- }
160
-
161
- global {
162
- interface Window {
163
- iFrameResizer: iframeResizer.IFramePageOptions
164
- parentIFrame: iframeResizer.IFramePage
165
- }
166
- }
167
-
168
- }