@iframe-resizer/vue 5.0.0-alpha.2 → 5.0.0-beta.1

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/README.md CHANGED
@@ -22,4 +22,4 @@ yarn add @iframe-resizer/vue
22
22
 
23
23
  ---
24
24
 
25
- _iframe-resizer version 5.0.1 2024-05-27 - 18:04:32.155Z_
25
+ _iframe-resizer version 5.0.1 2024-05-28 - 19:45:39.232Z_
@@ -1,35 +1,79 @@
1
1
  <template>
2
- <div ref='IframeResizer'>
3
- <slot></slot>
4
- </div>
2
+ <iframe ref="iframe" v-bind="$attrs"></iframe>
5
3
  </template>
6
4
 
7
- <script lang="ts">
8
- // Rollup-plug-vue blows up with the types included!
9
-
5
+ <script setup>
10
6
  import connectResizer from '@iframe-resizer/core'
11
- // import { Directive, DirectiveBinding } from 'vue'
12
-
13
- // interface ResizableHTMLElement extends HTMLElement {
14
- // iframeResizer?: {
15
- // moveToAnchor: (string) => void
16
- // resize: (x: number, y: number) => void
17
- // sendMessage: (string) => void
18
- // }
19
- // }
20
-
21
- const iframeResizer /* : Directive */ = {
22
- mounted(el /* : HTMLElement */, binding /*: DirectiveBinding */) {
23
- const options = binding.value || {}
7
+
8
+ const emit = defineEmits(['onReady', 'onMessage', 'onResized'])
9
+
10
+ defineProps({
11
+ license: {
12
+ type: String,
13
+ required: true
14
+ },
15
+ bodyBackground: {
16
+ type: String,
17
+ },
18
+ bodyMargin: {
19
+ type: String,
20
+ },
21
+ bodyPadding: {
22
+ type: String,
23
+ },
24
+ checkOrigin: {
25
+ type: Boolean,
26
+ default: true,
27
+ },
28
+ direction: {
29
+ type: String,
30
+ },
31
+ inPageLinks: {
32
+ type: Boolean,
33
+ },
34
+ offset: {
35
+ type: Number,
36
+ },
37
+ scrolling: {
38
+ type: Boolean,
39
+ },
40
+ tolerance: {
41
+ type: Number,
42
+ },
43
+ warningTimeout: {
44
+ type: Number,
45
+ },
46
+ })
47
+
48
+ defineOptions({
49
+ name: 'IframeResizer',
50
+
51
+ mounted() {
52
+ const self = this
53
+ const { iframe } = this.$refs
54
+ const options = {
55
+ ...Object.fromEntries(
56
+ Object
57
+ .entries(this.$props)
58
+ .filter(([key, value]) => value !== undefined)
59
+ ),
60
+
61
+ onClose:() => false, // Disable close methods, use Vue to remove iframe
62
+ onReady: (...args) => self.$emit('onReady', ...args),
63
+ onMessage: (...args) => self.$emit('onMessage', ...args),
64
+ onResized: (...args) => self.$emit('onResized', ...args),
65
+ }
66
+
24
67
  const connectWithOptions = connectResizer(options)
25
- el.addEventListener('load', () => connectWithOptions(el))
26
- },
27
- unmounted(el /*: HTMLElement */) {
28
- const resizableEl = el /* as ResizableHTMLElement */
29
- resizableEl?.iframeResizer.disconnect()
30
- },
31
- }
32
68
 
33
- export default iframeResizer
69
+ iframe.addEventListener("load", () => connectWithOptions(iframe))
70
+ },
71
+
72
+ beforeDestroy() {
73
+ if (this.$refs.iframe.iFrameResizer) {
74
+ this.$refs.iframe.iFrameResizer.disconnect();
75
+ }
76
+ }
77
+ })
34
78
 
35
79
  </script>
package/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/vue 5.0.1 (cjs) - 2024-05-27
4
+ * @module iframe-resizer/vue 5.0.1 (cjs) - 2024-05-28
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -19,45 +19,97 @@
19
19
 
20
20
  'use strict';
21
21
 
22
- const connectResizer = require('@iframe-resizer/core');
23
22
  const vue = require('vue');
23
+ const connectResizer = require('@iframe-resizer/core');
24
24
 
25
- // import { Directive, DirectiveBinding } from 'vue'
25
+ const script = /*#__PURE__*/Object.assign({
26
+ name: 'IframeResizer',
27
+
28
+ mounted() {
29
+ const self = this;
30
+ const { iframe } = this.$refs;
31
+ const options = {
32
+ ...Object.fromEntries(
33
+ Object
34
+ .entries(this.$props)
35
+ .filter(([key, value]) => value !== undefined)
36
+ ),
26
37
 
27
- // interface ResizableHTMLElement extends HTMLElement {
28
- // iframeResizer?: {
29
- // moveToAnchor: (string) => void
30
- // resize: (x: number, y: number) => void
31
- // sendMessage: (string) => void
32
- // }
33
- // }
38
+ onClose:() => false, // Disable close methods, use Vue to remove iframe
39
+ onReady: (...args) => self.$emit('onReady', ...args),
40
+ onMessage: (...args) => self.$emit('onMessage', ...args),
41
+ onResized: (...args) => self.$emit('onResized', ...args),
42
+ };
34
43
 
35
- const iframeResizer /* : Directive */ = {
36
- mounted(el /* : HTMLElement */, binding /*: DirectiveBinding */) {
37
- const options = binding.value || {};
38
44
  const connectWithOptions = connectResizer(options);
39
- el.addEventListener('load', () => connectWithOptions(el));
45
+
46
+ iframe.addEventListener("load", () => connectWithOptions(iframe));
40
47
  },
41
- unmounted(el /*: HTMLElement */) {
42
- const resizableEl = el; /* as ResizableHTMLElement */
43
- resizableEl?.iframeResizer.disconnect();
48
+
49
+ beforeDestroy() {
50
+ if (this.$refs.iframe.iFrameResizer) {
51
+ this.$refs.iframe.iFrameResizer.disconnect();
52
+ }
53
+ }
54
+ }, {
55
+ __name: 'iframe-resizer',
56
+ props: {
57
+ license: {
58
+ type: String,
59
+ required: true
60
+ },
61
+ bodyBackground: {
62
+ type: String,
63
+ },
64
+ bodyMargin: {
65
+ type: String,
66
+ },
67
+ bodyPadding: {
68
+ type: String,
69
+ },
70
+ checkOrigin: {
71
+ type: Boolean,
72
+ default: true,
73
+ },
74
+ direction: {
75
+ type: String,
76
+ },
77
+ inPageLinks: {
78
+ type: Boolean,
79
+ },
80
+ offset: {
81
+ type: Number,
82
+ },
83
+ scrolling: {
84
+ type: Boolean,
85
+ },
86
+ tolerance: {
87
+ type: Number,
88
+ },
89
+ warningTimeout: {
90
+ type: Number,
91
+ },
44
92
  },
45
- };
93
+ emits: ['onReady', 'onMessage', 'onResized'],
94
+ setup(__props, { emit: __emit }) {
95
+
96
+
46
97
 
47
- const _hoisted_1 = { ref: "IframeResizer" };
98
+
48
99
 
49
- function render(_ctx, _cache, $props, $setup, $data, $options) {
50
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
51
- vue.renderSlot(_ctx.$slots, "default")
52
- ], 512 /* NEED_PATCH */))
100
+
101
+ return (_ctx, _cache) => {
102
+ return (vue.openBlock(), vue.createElementBlock("iframe", vue.mergeProps({ ref: "iframe" }, _ctx.$attrs), null, 16 /* FULL_PROPS */))
103
+ }
53
104
  }
54
105
 
55
- iframeResizer.render = render;
56
- iframeResizer.__file = "./iframe-resizer.vue";
106
+ });
107
+
108
+ script.__file = "./iframe-resizer.vue";
57
109
 
58
110
  const index = {
59
111
  install(Vue) {
60
- Vue.component('IframeResizer', iframeResizer);
112
+ Vue.component('IframeResizer', script);
61
113
  },
62
114
  };
63
115
 
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @preserve
3
3
  *
4
- * @module iframe-resizer/vue 5.0.1 (esm) - 2024-05-27
4
+ * @module iframe-resizer/vue 5.0.1 (esm) - 2024-05-28
5
5
  *
6
6
  * @license GPL-3.0 for non-commercial use only.
7
7
  * For commercial use, you must purchase a license from
@@ -17,45 +17,97 @@
17
17
  */
18
18
 
19
19
 
20
+ import { openBlock, createElementBlock, mergeProps } from 'vue';
20
21
  import connectResizer from '@iframe-resizer/core';
21
- import { openBlock, createElementBlock, renderSlot } from 'vue';
22
22
 
23
- // import { Directive, DirectiveBinding } from 'vue'
23
+ const script = /*#__PURE__*/Object.assign({
24
+ name: 'IframeResizer',
25
+
26
+ mounted() {
27
+ const self = this;
28
+ const { iframe } = this.$refs;
29
+ const options = {
30
+ ...Object.fromEntries(
31
+ Object
32
+ .entries(this.$props)
33
+ .filter(([key, value]) => value !== undefined)
34
+ ),
24
35
 
25
- // interface ResizableHTMLElement extends HTMLElement {
26
- // iframeResizer?: {
27
- // moveToAnchor: (string) => void
28
- // resize: (x: number, y: number) => void
29
- // sendMessage: (string) => void
30
- // }
31
- // }
36
+ onClose:() => false, // Disable close methods, use Vue to remove iframe
37
+ onReady: (...args) => self.$emit('onReady', ...args),
38
+ onMessage: (...args) => self.$emit('onMessage', ...args),
39
+ onResized: (...args) => self.$emit('onResized', ...args),
40
+ };
32
41
 
33
- const iframeResizer /* : Directive */ = {
34
- mounted(el /* : HTMLElement */, binding /*: DirectiveBinding */) {
35
- const options = binding.value || {};
36
42
  const connectWithOptions = connectResizer(options);
37
- el.addEventListener('load', () => connectWithOptions(el));
43
+
44
+ iframe.addEventListener("load", () => connectWithOptions(iframe));
38
45
  },
39
- unmounted(el /*: HTMLElement */) {
40
- const resizableEl = el; /* as ResizableHTMLElement */
41
- resizableEl?.iframeResizer.disconnect();
46
+
47
+ beforeDestroy() {
48
+ if (this.$refs.iframe.iFrameResizer) {
49
+ this.$refs.iframe.iFrameResizer.disconnect();
50
+ }
51
+ }
52
+ }, {
53
+ __name: 'iframe-resizer',
54
+ props: {
55
+ license: {
56
+ type: String,
57
+ required: true
58
+ },
59
+ bodyBackground: {
60
+ type: String,
61
+ },
62
+ bodyMargin: {
63
+ type: String,
64
+ },
65
+ bodyPadding: {
66
+ type: String,
67
+ },
68
+ checkOrigin: {
69
+ type: Boolean,
70
+ default: true,
71
+ },
72
+ direction: {
73
+ type: String,
74
+ },
75
+ inPageLinks: {
76
+ type: Boolean,
77
+ },
78
+ offset: {
79
+ type: Number,
80
+ },
81
+ scrolling: {
82
+ type: Boolean,
83
+ },
84
+ tolerance: {
85
+ type: Number,
86
+ },
87
+ warningTimeout: {
88
+ type: Number,
89
+ },
42
90
  },
43
- };
91
+ emits: ['onReady', 'onMessage', 'onResized'],
92
+ setup(__props, { emit: __emit }) {
93
+
94
+
95
+
96
+
44
97
 
45
- const _hoisted_1 = { ref: "IframeResizer" };
46
98
 
47
- function render(_ctx, _cache, $props, $setup, $data, $options) {
48
- return (openBlock(), createElementBlock("div", _hoisted_1, [
49
- renderSlot(_ctx.$slots, "default")
50
- ], 512 /* NEED_PATCH */))
99
+ return (_ctx, _cache) => {
100
+ return (openBlock(), createElementBlock("iframe", mergeProps({ ref: "iframe" }, _ctx.$attrs), null, 16 /* FULL_PROPS */))
51
101
  }
102
+ }
103
+
104
+ });
52
105
 
53
- iframeResizer.render = render;
54
- iframeResizer.__file = "./iframe-resizer.vue";
106
+ script.__file = "./iframe-resizer.vue";
55
107
 
56
108
  const index = {
57
109
  install(Vue) {
58
- Vue.component('IframeResizer', iframeResizer);
110
+ Vue.component('IframeResizer', script);
59
111
  },
60
112
  };
61
113
 
package/index.umd.js ADDED
@@ -0,0 +1,119 @@
1
+ /*!
2
+ * @preserve
3
+ *
4
+ * @module iframe-resizer/vue 5.0.1 (umd) - 2024-05-28
5
+ *
6
+ * @license GPL-3.0 for non-commercial use only.
7
+ * For commercial use, you must purchase a license from
8
+ * https://iframe-resizer.com/pricing
9
+ *
10
+ * @desciption Keep same and cross domain iFrames sized to their content
11
+ *
12
+ * @author David J. Bradshaw <info@iframe-resizer.com>
13
+ *
14
+ * @see {@link https://iframe-resizer.com}
15
+ *
16
+ * @copyright (c) 2013 - 2024, David J. Bradshaw. All rights reserved.
17
+ */
18
+
19
+
20
+ (function (global, factory) {
21
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue'), require('@iframe-resizer/core')) :
22
+ typeof define === 'function' && define.amd ? define(['vue', '@iframe-resizer/core'], factory) :
23
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.IframeResizer = factory(global.vue, global.connectResizer));
24
+ })(this, (function (vue, connectResizer) { 'use strict';
25
+
26
+ const script = /*#__PURE__*/Object.assign({
27
+ name: 'IframeResizer',
28
+
29
+ mounted() {
30
+ const self = this;
31
+ const { iframe } = this.$refs;
32
+ const options = {
33
+ ...Object.fromEntries(
34
+ Object
35
+ .entries(this.$props)
36
+ .filter(([key, value]) => value !== undefined)
37
+ ),
38
+
39
+ onClose:() => false, // Disable close methods, use Vue to remove iframe
40
+ onReady: (...args) => self.$emit('onReady', ...args),
41
+ onMessage: (...args) => self.$emit('onMessage', ...args),
42
+ onResized: (...args) => self.$emit('onResized', ...args),
43
+ };
44
+
45
+ const connectWithOptions = connectResizer(options);
46
+
47
+ iframe.addEventListener("load", () => connectWithOptions(iframe));
48
+ },
49
+
50
+ beforeDestroy() {
51
+ if (this.$refs.iframe.iFrameResizer) {
52
+ this.$refs.iframe.iFrameResizer.disconnect();
53
+ }
54
+ }
55
+ }, {
56
+ __name: 'iframe-resizer',
57
+ props: {
58
+ license: {
59
+ type: String,
60
+ required: true
61
+ },
62
+ bodyBackground: {
63
+ type: String,
64
+ },
65
+ bodyMargin: {
66
+ type: String,
67
+ },
68
+ bodyPadding: {
69
+ type: String,
70
+ },
71
+ checkOrigin: {
72
+ type: Boolean,
73
+ default: true,
74
+ },
75
+ direction: {
76
+ type: String,
77
+ },
78
+ inPageLinks: {
79
+ type: Boolean,
80
+ },
81
+ offset: {
82
+ type: Number,
83
+ },
84
+ scrolling: {
85
+ type: Boolean,
86
+ },
87
+ tolerance: {
88
+ type: Number,
89
+ },
90
+ warningTimeout: {
91
+ type: Number,
92
+ },
93
+ },
94
+ emits: ['onReady', 'onMessage', 'onResized'],
95
+ setup(__props, { emit: __emit }) {
96
+
97
+
98
+
99
+
100
+
101
+
102
+ return (_ctx, _cache) => {
103
+ return (vue.openBlock(), vue.createElementBlock("iframe", vue.mergeProps({ ref: "iframe" }, _ctx.$attrs), null, 16 /* FULL_PROPS */))
104
+ }
105
+ }
106
+
107
+ });
108
+
109
+ script.__file = "./iframe-resizer.vue";
110
+
111
+ const index = {
112
+ install(Vue) {
113
+ Vue.component('IframeResizer', script);
114
+ },
115
+ };
116
+
117
+ return index;
118
+
119
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iframe-resizer/vue",
3
- "version": "5.0.0-alpha.2",
3
+ "version": "5.0.0-beta.1",
4
4
  "license": "GPL-3.0",
5
5
  "homepage": "https://iframe-resizer.com",
6
6
  "author": {
@@ -17,8 +17,11 @@
17
17
  "type": "individual",
18
18
  "url": "https://iframe-resizer.com/pricing/"
19
19
  },
20
- "main": "index.cjs.js",
20
+ "main": "index.umd.js",
21
21
  "module": "index.esm.js",
22
+ "browser": {
23
+ "./sfc": "iframe-resizer.vue"
24
+ },
22
25
  "peerDependencies": {
23
26
  "vue": "^2.6.0 || ^3.0.0"
24
27
  },