@open-iframe-resizer/angular 2.2.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.md +20 -0
- package/README.md +42 -0
- package/fesm2022/open-iframe-resizer-angular.mjs +91 -0
- package/fesm2022/open-iframe-resizer-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/iframe-resizer.directive.d.ts +21 -0
- package/package.json +44 -0
- package/public-api.d.ts +1 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2012-2024 Scott Chacon and others
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Open Iframe Resizer Angular
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`iframe-resizer` is a modern, lightweight library for resizing iframes dynamically. It is shipped under the MIT license, making it usable in commercial projects.
|
|
6
|
+
|
|
7
|
+
If you found this plugin helpful, please consider starring the repository!
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @open-iframe-resizer/angular
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
Import the module in your Angular application:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { IframeResizerDirective } from '@open-iframe-resizer/angular';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: "app-root",
|
|
26
|
+
imports: [IframeResizerDirective, CommonModule],
|
|
27
|
+
templateUrl: "./app.component.html",
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
Add the directive to your iframe:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<iframe
|
|
39
|
+
oirIframeResizer
|
|
40
|
+
src="/iframe-content.html"
|
|
41
|
+
></iframe>
|
|
42
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Input, Directive } from '@angular/core';
|
|
3
|
+
import { initialize } from '@open-iframe-resizer/core';
|
|
4
|
+
|
|
5
|
+
// biome-ignore lint/style/useImportType: ng does not like it
|
|
6
|
+
class IframeResizerDirective {
|
|
7
|
+
el;
|
|
8
|
+
constructor(el) {
|
|
9
|
+
this.el = el;
|
|
10
|
+
}
|
|
11
|
+
offsetSize;
|
|
12
|
+
enableLegacyLibSupport;
|
|
13
|
+
checkOrigin;
|
|
14
|
+
onIframeResize;
|
|
15
|
+
onBeforeIframeResize;
|
|
16
|
+
targetElementSelector;
|
|
17
|
+
bodyMargin;
|
|
18
|
+
bodyPadding;
|
|
19
|
+
unsubscribeIframeRef = [];
|
|
20
|
+
isDestroyed = false;
|
|
21
|
+
ngAfterViewInit() {
|
|
22
|
+
const iframe = this.el.nativeElement;
|
|
23
|
+
if (!iframe) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// biome-ignore lint/suspicious/noExplicitAny: Compile fail if no key exhaustiveness
|
|
27
|
+
const settings = {
|
|
28
|
+
offsetSize: this.offsetSize,
|
|
29
|
+
enableLegacyLibSupport: this.enableLegacyLibSupport,
|
|
30
|
+
checkOrigin: this.checkOrigin,
|
|
31
|
+
onIframeResize: this.onIframeResize,
|
|
32
|
+
onBeforeIframeResize: this.onBeforeIframeResize,
|
|
33
|
+
targetElementSelector: this.targetElementSelector,
|
|
34
|
+
bodyMargin: this.bodyMargin,
|
|
35
|
+
bodyPadding: this.bodyPadding,
|
|
36
|
+
};
|
|
37
|
+
initialize(settings, iframe).then((results) => {
|
|
38
|
+
if (this.isDestroyed) {
|
|
39
|
+
for (const c of results) {
|
|
40
|
+
c.unsubscribe();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.unsubscribeIframeRef = results;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
ngOnDestroy() {
|
|
49
|
+
this.isDestroyed = true;
|
|
50
|
+
for (const c of this.unsubscribeIframeRef) {
|
|
51
|
+
c.unsubscribe();
|
|
52
|
+
}
|
|
53
|
+
this.unsubscribeIframeRef = [];
|
|
54
|
+
}
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: IframeResizerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
56
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: IframeResizerDirective, isStandalone: true, selector: "iframe[oirIframeResizer]", inputs: { offsetSize: "offsetSize", enableLegacyLibSupport: "enableLegacyLibSupport", checkOrigin: "checkOrigin", onIframeResize: "onIframeResize", onBeforeIframeResize: "onBeforeIframeResize", targetElementSelector: "targetElementSelector", bodyMargin: "bodyMargin", bodyPadding: "bodyPadding" }, ngImport: i0 });
|
|
57
|
+
}
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: IframeResizerDirective, decorators: [{
|
|
59
|
+
type: Directive,
|
|
60
|
+
args: [{
|
|
61
|
+
selector: "iframe[oirIframeResizer]",
|
|
62
|
+
standalone: true,
|
|
63
|
+
}]
|
|
64
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { offsetSize: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], enableLegacyLibSupport: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], checkOrigin: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], onIframeResize: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], onBeforeIframeResize: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], targetElementSelector: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], bodyMargin: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], bodyPadding: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}] } });
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* Public API Surface of lib
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Generated bundle index. Do not edit.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
export { IframeResizerDirective };
|
|
91
|
+
//# sourceMappingURL=open-iframe-resizer-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-iframe-resizer-angular.mjs","sources":["../../../projects/lib/src/lib/iframe-resizer.directive.ts","../../../projects/lib/src/public-api.ts","../../../projects/lib/src/open-iframe-resizer-angular.ts"],"sourcesContent":["// biome-ignore lint/style/useImportType: ng does not like it\nimport { type AfterViewInit, Directive, ElementRef, Input, type OnDestroy } from \"@angular/core\";\n\nimport { type BeforeResizeContext, type InitializeResult, initialize, type ResizeContext, type Settings } from \"@open-iframe-resizer/core\";\n\n@Directive({\n selector: \"iframe[oirIframeResizer]\",\n standalone: true,\n})\nexport class IframeResizerDirective implements AfterViewInit, OnDestroy {\n constructor(private el: ElementRef<HTMLIFrameElement>) { }\n\n @Input() offsetSize?: number;\n @Input() enableLegacyLibSupport?: boolean;\n @Input() checkOrigin?: boolean;\n @Input() onIframeResize?: (context: ResizeContext) => void;\n @Input() onBeforeIframeResize?: (context: BeforeResizeContext) => boolean | undefined;\n @Input() targetElementSelector?: string;\n @Input() bodyMargin?: string;\n @Input() bodyPadding?: string;\n\n private unsubscribeIframeRef: InitializeResult[] = [];\n private isDestroyed = false;\n\n ngAfterViewInit(): void {\n const iframe = this.el.nativeElement;\n\n if (!iframe) {\n return;\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: Compile fail if no key exhaustiveness\n const settings: Required<{ [K in keyof Settings]: any }> = {\n offsetSize: this.offsetSize,\n enableLegacyLibSupport: this.enableLegacyLibSupport,\n checkOrigin: this.checkOrigin,\n onIframeResize: this.onIframeResize,\n onBeforeIframeResize: this.onBeforeIframeResize,\n targetElementSelector: this.targetElementSelector,\n bodyMargin: this.bodyMargin,\n bodyPadding: this.bodyPadding,\n };\n\n\n initialize(settings, iframe).then((results) => {\n if (this.isDestroyed) {\n for (const c of results) {\n c.unsubscribe();\n }\n } else {\n this.unsubscribeIframeRef = results;\n }\n });\n }\n\n ngOnDestroy(): void {\n this.isDestroyed = true;\n for (const c of this.unsubscribeIframeRef) {\n c.unsubscribe();\n }\n this.unsubscribeIframeRef = [];\n }\n}\n","/*\n * Public API Surface of lib\n */\n\nexport * from \"./lib/iframe-resizer.directive\";\n","/**\n * Generated bundle index. Do not edit.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,IAAI,CAAC,oBAAoB,EAAE;YACzC,CAAC,CAAC,WAAW,EAAE;QACjB;AACA,QAAA,IAAI,CAAC,oBAAoB,GAAG,EAAE;IAChC;wGApDW,sBAAsB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAtB,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0BAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,sBAAA,EAAA,wBAAA,EAAA,WAAA,EAAA,aAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,oBAAA,EAAA,sBAAA,EAAA,qBAAA,EAAA,uBAAA,EAAA,UAAA,EAAA,YAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,0BAA0B;AACpC,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;+EAIU,UAAU,EAAA,CAAA;sBAAlB;gBACQ,sBAAsB,EAAA,CAAA;sBAA9B;gBACQ,WAAW,EAAA,CAAA;sBAAnB;gBACQ,cAAc,EAAA,CAAA;sBAAtB;gBACQ,oBAAoB,EAAA,CAAA;sBAA5B;gBACQ,qBAAqB,EAAA,CAAA;sBAA7B;gBACQ,UAAU,EAAA,CAAA;sBAAlB;gBACQ,WAAW,EAAA,CAAA;sBAAnB;;;ACnBH;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AfterViewInit, ElementRef, type OnDestroy } from "@angular/core";
|
|
2
|
+
import { type BeforeResizeContext, type ResizeContext } from "@open-iframe-resizer/core";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class IframeResizerDirective implements AfterViewInit, OnDestroy {
|
|
5
|
+
private el;
|
|
6
|
+
constructor(el: ElementRef<HTMLIFrameElement>);
|
|
7
|
+
offsetSize?: number;
|
|
8
|
+
enableLegacyLibSupport?: boolean;
|
|
9
|
+
checkOrigin?: boolean;
|
|
10
|
+
onIframeResize?: (context: ResizeContext) => void;
|
|
11
|
+
onBeforeIframeResize?: (context: BeforeResizeContext) => boolean | undefined;
|
|
12
|
+
targetElementSelector?: string;
|
|
13
|
+
bodyMargin?: string;
|
|
14
|
+
bodyPadding?: string;
|
|
15
|
+
private unsubscribeIframeRef;
|
|
16
|
+
private isDestroyed;
|
|
17
|
+
ngAfterViewInit(): void;
|
|
18
|
+
ngOnDestroy(): void;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IframeResizerDirective, never>;
|
|
20
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<IframeResizerDirective, "iframe[oirIframeResizer]", never, { "offsetSize": { "alias": "offsetSize"; "required": false; }; "enableLegacyLibSupport": { "alias": "enableLegacyLibSupport"; "required": false; }; "checkOrigin": { "alias": "checkOrigin"; "required": false; }; "onIframeResize": { "alias": "onIframeResize"; "required": false; }; "onBeforeIframeResize": { "alias": "onBeforeIframeResize"; "required": false; }; "targetElementSelector": { "alias": "targetElementSelector"; "required": false; }; "bodyMargin": { "alias": "bodyMargin"; "required": false; }; "bodyPadding": { "alias": "bodyPadding"; "required": false; }; }, {}, never, never, true, never>;
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-iframe-resizer/angular",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "2.2.0",
|
|
5
|
+
"description": "Open-source modern iframe resizer component",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Lemick/open-iframe-resizer.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"iframe",
|
|
13
|
+
"Resizing",
|
|
14
|
+
"Resizer",
|
|
15
|
+
"resize",
|
|
16
|
+
"cross",
|
|
17
|
+
"same",
|
|
18
|
+
"domain",
|
|
19
|
+
"width",
|
|
20
|
+
"height",
|
|
21
|
+
"responsive",
|
|
22
|
+
"react"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@angular/common": ">=14.0.0 <20.0.0",
|
|
26
|
+
"@angular/core": ">=14.0.0 <20.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@open-iframe-resizer/core": "2.2.0",
|
|
30
|
+
"tslib": "^2.3.0"
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"module": "fesm2022/open-iframe-resizer-angular.mjs",
|
|
34
|
+
"typings": "index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
"./package.json": {
|
|
37
|
+
"default": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./index.d.ts",
|
|
41
|
+
"default": "./fesm2022/open-iframe-resizer-angular.mjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/iframe-resizer.directive";
|