@schukai/monster 3.80.5 → 3.82.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.json +1 -1
  3. package/source/components/constants.mjs +0 -13
  4. package/source/components/datatable/change-button.mjs +0 -1
  5. package/source/components/datatable/columnbar.mjs +0 -1
  6. package/source/components/datatable/constants.mjs +0 -12
  7. package/source/components/datatable/dataset.mjs +0 -1
  8. package/source/components/datatable/datasource/dom.mjs +0 -1
  9. package/source/components/datatable/datasource/rest.mjs +0 -1
  10. package/source/components/datatable/datasource.mjs +0 -1
  11. package/source/components/datatable/datatable/header.mjs +0 -1
  12. package/source/components/datatable/datatable.mjs +0 -1
  13. package/source/components/datatable/embedded-pagination.mjs +0 -1
  14. package/source/components/datatable/filter/abstract-base.mjs +0 -1
  15. package/source/components/datatable/filter/date-range.mjs +0 -1
  16. package/source/components/datatable/filter/input.mjs +0 -1
  17. package/source/components/datatable/filter/range.mjs +0 -1
  18. package/source/components/datatable/filter/select.mjs +0 -1
  19. package/source/components/datatable/filter/settings.mjs +0 -2
  20. package/source/components/datatable/filter-button.mjs +0 -1
  21. package/source/components/datatable/filter.mjs +0 -1
  22. package/source/components/datatable/pagination.mjs +0 -1
  23. package/source/components/datatable/status.mjs +0 -1
  24. package/source/components/datatable/stylesheet/change-button.mjs +1 -1
  25. package/source/components/datatable/stylesheet/column-bar.mjs +1 -1
  26. package/source/components/datatable/stylesheet/dataset.mjs +1 -1
  27. package/source/components/datatable/stylesheet/datatable.mjs +1 -1
  28. package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
  29. package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
  30. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +1 -1
  31. package/source/components/datatable/stylesheet/filter-select.mjs +1 -1
  32. package/source/components/datatable/stylesheet/filter.mjs +1 -1
  33. package/source/components/datatable/stylesheet/pagination.mjs +1 -1
  34. package/source/components/datatable/stylesheet/save-button.mjs +1 -1
  35. package/source/components/datatable/stylesheet/status.mjs +1 -1
  36. package/source/components/form/action-button.mjs +0 -1
  37. package/source/components/form/api-button.mjs +0 -1
  38. package/source/components/form/button-bar.mjs +0 -1
  39. package/source/components/form/confirm-button.mjs +0 -2
  40. package/source/components/form/constants.mjs +0 -10
  41. package/source/components/form/context-error.mjs +0 -1
  42. package/source/components/form/message-state-button.mjs +0 -35
  43. package/source/components/form/popper-button.mjs +0 -2
  44. package/source/components/form/select.mjs +2 -4
  45. package/source/components/form/stylesheet/action-button.mjs +1 -1
  46. package/source/components/form/stylesheet/button-bar.mjs +1 -1
  47. package/source/components/form/stylesheet/context-error.mjs +1 -1
  48. package/source/components/form/stylesheet/context-help.mjs +1 -1
  49. package/source/components/form/stylesheet/select.mjs +1 -1
  50. package/source/components/form/template.mjs +0 -1
  51. package/source/components/form/tree-select.mjs +0 -2
  52. package/source/components/form/types/state.mjs +0 -2
  53. package/source/components/host/call-button.mjs +0 -3
  54. package/source/components/host/collapse.mjs +0 -1
  55. package/source/components/host/config-manager.mjs +0 -1
  56. package/source/components/host/constants.mjs +0 -1
  57. package/source/components/host/host.mjs +0 -1
  58. package/source/components/host/overlay.mjs +0 -1
  59. package/source/components/host/stylesheet/call-button.mjs +1 -1
  60. package/source/components/host/stylesheet/host.mjs +1 -1
  61. package/source/components/host/stylesheet/overlay.mjs +1 -1
  62. package/source/components/host/stylesheet/toggle-button.mjs +1 -1
  63. package/source/components/host/stylesheet/viewer.mjs +1 -1
  64. package/source/components/host/toggle-button.mjs +0 -1
  65. package/source/components/host/viewer.mjs +0 -1
  66. package/source/components/layout/iframe.mjs +264 -250
  67. package/source/components/layout/stylesheet/collapse.mjs +1 -1
  68. package/source/components/layout/stylesheet/details.mjs +1 -1
  69. package/source/components/layout/stylesheet/panel.mjs +1 -1
  70. package/source/components/layout/stylesheet/slider.mjs +1 -1
  71. package/source/components/layout/stylesheet/split-panel.mjs +1 -1
  72. package/source/components/layout/stylesheet/tabs.mjs +1 -1
  73. package/source/components/layout/stylesheet/width-toggle.mjs +1 -1
  74. package/source/components/navigation/stylesheet/table-of-content.mjs +1 -1
  75. package/source/components/notify/constants.mjs +0 -1
  76. package/source/components/notify/message.mjs +0 -1
  77. package/source/components/notify/notify.mjs +0 -1
  78. package/source/components/notify/stylesheet/message.mjs +1 -1
  79. package/source/components/state/log/entry.mjs +0 -1
  80. package/source/components/state/state.mjs +0 -6
  81. package/source/components/style/badge.css +2 -0
  82. package/source/components/style/border.css +2 -0
  83. package/source/components/style/button.css +2 -0
  84. package/source/components/style/card.css +2 -0
  85. package/source/components/style/color.css +2 -0
  86. package/source/components/style/common.css +2 -0
  87. package/source/components/style/control.css +2 -0
  88. package/source/components/style/data-grid.css +2 -0
  89. package/source/components/style/display.css +2 -0
  90. package/source/components/style/floating-ui.css +2 -0
  91. package/source/components/style/form.css +2 -0
  92. package/source/components/style/host.css +2 -0
  93. package/source/components/style/icons.css +2 -0
  94. package/source/components/style/link.css +2 -0
  95. package/source/components/style/normalize.css +2 -0
  96. package/source/components/style/popper.css +2 -0
  97. package/source/components/style/property.css +2 -0
  98. package/source/components/style/ripple.css +2 -0
  99. package/source/components/style/skeleton.css +2 -0
  100. package/source/components/style/space.css +2 -0
  101. package/source/components/style/spinner.css +2 -0
  102. package/source/components/style/table.css +2 -0
  103. package/source/components/style/theme.css +2 -0
  104. package/source/components/style/typography.css +2 -0
  105. package/source/components/stylesheet/card.mjs +1 -1
  106. package/source/components/stylesheet/icons.mjs +1 -1
  107. package/source/components/stylesheet/property.mjs +1 -1
  108. package/source/components/stylesheet/space.mjs +1 -1
  109. package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
  110. package/source/constants.mjs +0 -2
  111. package/source/constraints/abstract.mjs +0 -1
  112. package/source/constraints/abstractoperator.mjs +0 -1
  113. package/source/data/buildmap.mjs +0 -5
  114. package/source/data/buildtree.mjs +0 -1
  115. package/source/data/datasource/dom.mjs +0 -1
  116. package/source/data/datasource/server/restapi/data-fetch-error.mjs +0 -1
  117. package/source/data/datasource/server/restapi/writeerror.mjs +0 -1
  118. package/source/data/datasource/server/restapi.mjs +0 -2
  119. package/source/data/datasource/server/webconnect.mjs +0 -1
  120. package/source/data/datasource/server.mjs +0 -1
  121. package/source/data/datasource/storage/localstorage.mjs +0 -1
  122. package/source/data/datasource/storage/sessionstorage.mjs +0 -1
  123. package/source/data/datasource/storage.mjs +0 -1
  124. package/source/data/datasource.mjs +0 -2
  125. package/source/data/diff.mjs +0 -1
  126. package/source/data/extend.mjs +0 -1
  127. package/source/dom/assembler.mjs +0 -2
  128. package/source/dom/attributes.mjs +0 -13
  129. package/source/dom/constants.mjs +0 -59
  130. package/source/dom/customelement.mjs +0 -7
  131. package/source/dom/dimension.mjs +0 -2
  132. package/source/dom/events.mjs +0 -3
  133. package/source/dom/focusmanager.mjs +0 -1
  134. package/source/dom/locale.mjs +0 -1
  135. package/source/dom/ready.mjs +0 -2
  136. package/source/dom/resource/data.mjs +0 -1
  137. package/source/dom/resource/link/stylesheet.mjs +0 -1
  138. package/source/dom/resource/link.mjs +0 -1
  139. package/source/dom/resource/script.mjs +0 -1
  140. package/source/dom/resource.mjs +0 -1
  141. package/source/dom/resourcemanager.mjs +0 -1
  142. package/source/dom/template.mjs +0 -2
  143. package/source/dom/theme.mjs +0 -2
  144. package/source/dom/updater.mjs +0 -1
  145. package/source/dom/util.mjs +0 -7
  146. package/source/dom/worker/factory.mjs +0 -1
  147. package/source/i18n/locale.mjs +0 -3
  148. package/source/i18n/providers/fetch.mjs +0 -1
  149. package/source/logging/logentry.mjs +0 -1
  150. package/source/math/random.mjs +0 -1
  151. package/source/monster.mjs +0 -1
  152. package/source/net/webconnect.mjs +0 -1
  153. package/source/text/formatter.mjs +0 -1
  154. package/source/text/generate-range-comparison-expression.mjs +0 -1
  155. package/source/types/binary.mjs +0 -2
  156. package/source/types/global.mjs +0 -3
  157. package/source/types/id.mjs +0 -1
  158. package/source/types/internal.mjs +0 -1
  159. package/source/types/mediatype.mjs +0 -4
  160. package/source/types/node.mjs +0 -1
  161. package/source/types/validate.mjs +0 -10
  162. package/source/util/clone.mjs +0 -1
  163. package/source/util/comparator.mjs +0 -1
  164. package/source/util/freeze.mjs +0 -1
  165. package/source/util/runtime.mjs +0 -8
  166. package/source/util/trimspaces.mjs +0 -1
  167. package/source/components/stylesheet/mixin/form.mjs +0 -38
@@ -10,25 +10,20 @@
10
10
  * For more information about purchasing a commercial license, please contact schukai GmbH.
11
11
  */
12
12
 
13
- import { instanceSymbol } from "../../constants.mjs";
14
- import { addAttributeToken } from "../../dom/attributes.mjs";
13
+ import {instanceSymbol} from "../../constants.mjs";
14
+ import {ATTRIBUTE_ROLE} from "../../dom/constants.mjs";
15
+ import {CustomElement} from "../../dom/customelement.mjs";
15
16
  import {
16
- ATTRIBUTE_ERRORMESSAGE,
17
- ATTRIBUTE_ROLE,
18
- } from "../../dom/constants.mjs";
19
- import { CustomControl } from "../../dom/customcontrol.mjs";
20
- import { CustomElement } from "../../dom/customelement.mjs";
21
- import {
22
- assembleMethodSymbol,
23
- registerCustomElement,
17
+ assembleMethodSymbol,
18
+ registerCustomElement,
24
19
  } from "../../dom/customelement.mjs";
25
- import { findTargetElementFromEvent } from "../../dom/events.mjs";
26
- import { isFunction } from "../../types/is.mjs";
27
- import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
28
- import { IframeStyleSheet } from "./stylesheet/iframe.mjs";
29
- import { fireCustomEvent } from "../../dom/events.mjs";
20
+ import {findTargetElementFromEvent} from "../../dom/events.mjs";
21
+ import {isFunction} from "../../types/is.mjs";
22
+ import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
23
+ import {IframeStyleSheet} from "./stylesheet/iframe.mjs";
24
+ import {fireCustomEvent} from "../../dom/events.mjs";
30
25
 
31
- export { Iframe };
26
+ export {Iframe};
32
27
 
33
28
  /**
34
29
  * @private
@@ -67,125 +62,133 @@ const timerCallbackSymbol = Symbol("timerCallback");
67
62
  * @summary A cool and fancy Iframe that can make your life easier and also looks good.
68
63
  */
69
64
  class Iframe extends CustomElement {
70
- /**
71
- * This method is called by the `instanceof` operator.
72
- * @return {symbol}
73
- */
74
- static get [instanceSymbol]() {
75
- return Symbol.for("@schukai/monster/components/layout/iframe@@instance");
76
- }
77
-
78
- /**
79
- *
80
- * @return {Components.Layout.Iframe
81
- */
82
- [assembleMethodSymbol]() {
83
- super[assembleMethodSymbol]();
84
- initControlReferences.call(this);
85
- initEventHandler.call(this);
86
- calcHeight.call(this);
87
- return this;
88
- }
89
-
90
- /**
91
- * This method is called by the dom and should not be called directly.
92
- *
93
- * @return {void}
94
- */
95
- connectedCallback() {
96
- super.connectedCallback();
97
- attachResizeObserver.call(this);
98
-
99
- // disable scrolling in parent node
100
- if (this.parentNode && this.parentNode instanceof HTMLElement) {
101
- this.parentNode.style.overflow = "hidden";
102
- }
103
- }
104
-
105
- /**
106
- * This method is called by the dom and should not be called directly.
107
- *
108
- * @return {void}
109
- */
110
- disconnectedCallback() {
111
- super.disconnectedCallback();
112
- disconnectResizeObserver.call(this);
113
- }
114
-
115
- /**
116
- * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
117
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
118
- *
119
- * The individual configuration values can be found in the table.
120
- *
121
- * @property {Object} templates Template definitions
122
- * @property {string} templates.main Main template
123
- * @property {Object} labels Label definitions
124
- * @property {Object} actions Callbacks
125
- * @property {string} actions.click="throw Error" Callback when clicked
126
- * @property {Object} features Features
127
- * @property {Object} classes CSS classes
128
- * @property {boolean} disabled=false Disabled state
129
- */
130
- get defaults() {
131
- return Object.assign({}, super.defaults, {
132
- templates: {
133
- main: getTemplate(),
134
- },
135
- src: null,
136
-
137
- /* "allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation"*/
138
- sandbox: null,
139
-
140
- labels: {},
141
- classes: {},
142
-
143
- name: "",
144
-
145
- referrerpolicy: "no-referrer",
146
-
147
- disabled: false,
148
- features: {
149
- allowfullscreen: true,
150
- allowpaymentrequest: true,
151
- loading: "egager",
152
- },
153
- actions: {
154
- click: () => {
155
- throw new Error("the click action is not defined");
156
- },
157
- },
158
- });
159
- }
160
-
161
- /**
162
- * @return {string}
163
- */
164
- static getTag() {
165
- return "monster-iframe";
166
- }
167
-
168
- /**
169
- * @return {CSSStyleSheet[]}
170
- */
171
- static getCSSStyleSheet() {
172
- return [IframeStyleSheet];
173
- }
65
+ /**
66
+ * This method is called by the `instanceof` operator.
67
+ * @return {symbol}
68
+ */
69
+ static get [instanceSymbol]() {
70
+ return Symbol.for("@schukai/monster/components/layout/iframe@@instance");
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @return {Components.Layout.Iframe
76
+ */
77
+ [assembleMethodSymbol]() {
78
+ super[assembleMethodSymbol]();
79
+ initControlReferences.call(this);
80
+ initEventHandler.call(this);
81
+ calcHeight.call(this);
82
+ return this;
83
+ }
84
+
85
+ /**
86
+ * This method is called by the dom and should not be called directly.
87
+ *
88
+ * @return {void}
89
+ */
90
+ connectedCallback() {
91
+ super.connectedCallback();
92
+ attachResizeObserver.call(this);
93
+
94
+ // disable scrolling in parent node
95
+ if (this.parentNode && this.parentNode instanceof HTMLElement) {
96
+ this.parentNode.style.overflow = "hidden";
97
+ }
98
+ }
99
+
100
+ /**
101
+ * This method is called by the dom and should not be called directly.
102
+ *
103
+ * @return {void}
104
+ */
105
+ disconnectedCallback() {
106
+ super.disconnectedCallback();
107
+ disconnectResizeObserver.call(this);
108
+ }
109
+
110
+ /**
111
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
112
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
113
+ *
114
+ * The individual configuration values can be found in the table.
115
+ *
116
+ * @property {Object} templates Template definitions
117
+ * @property {string} templates.main Main template
118
+ * @property {Object} labels Label definitions
119
+ * @property {Object} actions Callbacks
120
+ * @property {string} actions.click="throw Error" Callback when clicked
121
+ * @property {Object} features Features
122
+ * @property {boolean} features.allowFullScreen=true Allow fullscreen
123
+ * @property {boolean} features.allowPaymentRequest=true Allow payment request
124
+ * @property {boolean} features.replaceTargets=true Replace parent target in iframe
125
+ * @property {string} loading="eager" Loading state
126
+ * @property {string} referrerPolicy="no-referrer" Referrer policy
127
+ * @property {string} src Source
128
+ * @property {Object} classes CSS classes
129
+ * @property {boolean} disabled=false Disabled state
130
+ */
131
+ get defaults() {
132
+ return Object.assign({}, super.defaults, {
133
+ templates: {
134
+ main: getTemplate(),
135
+ },
136
+ src: null,
137
+
138
+ /* "allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation"*/
139
+ sandbox: null,
140
+
141
+ labels: {},
142
+ classes: {},
143
+
144
+ name: "",
145
+
146
+ referrerPolicy: "no-referrer",
147
+
148
+ disabled: false,
149
+ features: {
150
+ allowFullScreen: true,
151
+ allowPaymentRequest: true,
152
+ replaceTargets: true,
153
+ },
154
+
155
+ loading: "eager",
156
+
157
+ actions: {
158
+ click: () => {
159
+ throw new Error("the click action is not defined");
160
+ },
161
+ },
162
+ });
163
+ }
164
+
165
+ /**
166
+ * @return {string}
167
+ */
168
+ static getTag() {
169
+ return "monster-iframe";
170
+ }
171
+
172
+ /**
173
+ * @return {CSSStyleSheet[]}
174
+ */
175
+ static getCSSStyleSheet() {
176
+ return [IframeStyleSheet];
177
+ }
174
178
  }
175
179
 
176
180
  /**
177
181
  * @private
178
182
  */
179
183
  function calcHeight() {
180
- this.style.boxSizing = "border-box";
184
+ this.style.boxSizing = "border-box";
181
185
 
182
- const height = calculateMaximumHeight.call(this, this.parentNode);
183
- console.log("height", height);
184
- if (height < 0 || isNaN(height)) {
185
- return;
186
- }
186
+ const height = calculateMaximumHeight.call(this, this.parentNode);
187
+ if (height < 0 || isNaN(height)) {
188
+ return;
189
+ }
187
190
 
188
- this[iframeElementSymbol].style.height = `${height}px`;
191
+ this[iframeElementSymbol].style.height = `${height}px`;
189
192
  }
190
193
 
191
194
  /**
@@ -194,90 +197,90 @@ function calcHeight() {
194
197
  * @return {*}
195
198
  */
196
199
  function calculateMaximumHeight(element) {
197
- let totalBottomBorder = 0;
198
- let totalBottomPadding = 0;
199
- let totalBottomMargin = 0;
200
- let totalOutlineHeight = 0;
201
- let totalBoxShadowHeight = 0;
202
- let currentElement = element;
203
-
204
- while (currentElement && currentElement !== document.body) {
205
- const style = window.getComputedStyle(currentElement);
206
- const boxSizing = style.boxSizing;
207
-
208
- const elementHeight = currentElement.getBoundingClientRect().height;
209
-
210
- const borderBottomWidth = parseFloat(style.borderBottomWidth);
211
- const paddingBottom = parseFloat(style.paddingBottom);
212
- const marginBottom = parseFloat(style.marginBottom);
213
-
214
- const outlineHeight = parseFloat(style.outlineWidth);
215
-
216
- totalBottomBorder += isNaN(borderBottomWidth) ? 0 : borderBottomWidth;
217
- totalBottomPadding +=
218
- isNaN(paddingBottom) || boxSizing === "border-box" ? 0 : paddingBottom;
219
- totalBottomMargin += isNaN(marginBottom) ? 0 : marginBottom;
220
- totalOutlineHeight += isNaN(outlineHeight) ? 0 : outlineHeight;
221
-
222
- const boxShadow = style.boxShadow;
223
- let boxShadowVerticalTotal = 0;
224
-
225
- if (boxShadow !== "none") {
226
- const boxShadowValues = boxShadow.split(" ");
227
- const verticalOffset = parseFloat(boxShadowValues[3]);
228
- const blurRadius = parseFloat(boxShadowValues[4]);
229
- const spreadRadius = parseFloat(boxShadowValues[5]);
230
-
231
- boxShadowVerticalTotal = verticalOffset + blurRadius + spreadRadius;
232
- }
233
-
234
- totalBoxShadowHeight += isNaN(boxShadowVerticalTotal)
235
- ? 0
236
- : boxShadowVerticalTotal;
237
-
238
- if (elementHeight > 200) {
239
- return (
240
- elementHeight -
241
- totalBottomBorder -
242
- totalBottomPadding -
243
- totalBottomMargin -
244
- totalOutlineHeight -
245
- totalBoxShadowHeight
246
- );
247
- }
248
-
249
- currentElement = currentElement.parentNode || currentElement.host;
250
- }
200
+ let totalBottomBorder = 0;
201
+ let totalBottomPadding = 0;
202
+ let totalBottomMargin = 0;
203
+ let totalOutlineHeight = 0;
204
+ let totalBoxShadowHeight = 0;
205
+ let currentElement = element;
206
+
207
+ while (currentElement && currentElement !== document.body) {
208
+ const style = window.getComputedStyle(currentElement);
209
+ const boxSizing = style.boxSizing;
210
+
211
+ const elementHeight = currentElement.getBoundingClientRect().height;
212
+
213
+ const borderBottomWidth = parseFloat(style.borderBottomWidth);
214
+ const paddingBottom = parseFloat(style.paddingBottom);
215
+ const marginBottom = parseFloat(style.marginBottom);
216
+
217
+ const outlineHeight = parseFloat(style.outlineWidth);
218
+
219
+ totalBottomBorder += isNaN(borderBottomWidth) ? 0 : borderBottomWidth;
220
+ totalBottomPadding +=
221
+ isNaN(paddingBottom) || boxSizing === "border-box" ? 0 : paddingBottom;
222
+ totalBottomMargin += isNaN(marginBottom) ? 0 : marginBottom;
223
+ totalOutlineHeight += isNaN(outlineHeight) ? 0 : outlineHeight;
224
+
225
+ const boxShadow = style.boxShadow;
226
+ let boxShadowVerticalTotal = 0;
227
+
228
+ if (boxShadow !== "none") {
229
+ const boxShadowValues = boxShadow.split(" ");
230
+ const verticalOffset = parseFloat(boxShadowValues[3]);
231
+ const blurRadius = parseFloat(boxShadowValues[4]);
232
+ const spreadRadius = parseFloat(boxShadowValues[5]);
233
+
234
+ boxShadowVerticalTotal = verticalOffset + blurRadius + spreadRadius;
235
+ }
236
+
237
+ totalBoxShadowHeight += isNaN(boxShadowVerticalTotal)
238
+ ? 0
239
+ : boxShadowVerticalTotal;
240
+
241
+ if (elementHeight > 200) {
242
+ return (
243
+ elementHeight -
244
+ totalBottomBorder -
245
+ totalBottomPadding -
246
+ totalBottomMargin -
247
+ totalOutlineHeight -
248
+ totalBoxShadowHeight
249
+ );
250
+ }
251
+
252
+ currentElement = currentElement.parentNode || currentElement.host;
253
+ }
251
254
  }
252
255
 
253
256
  /**
254
257
  * @private
255
258
  */
256
259
  function attachResizeObserver() {
257
- // against flickering
258
- this[resizeObserverSymbol] = new ResizeObserver(() => {
259
- if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
260
- try {
261
- this[timerCallbackSymbol].touch();
262
- return;
263
- } catch (e) {
264
- delete this[timerCallbackSymbol];
265
- }
266
- }
267
-
268
- this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
269
- calcHeight.call(this);
270
- });
271
- });
272
-
273
- this[resizeObserverSymbol].observe(this.ownerDocument.body);
274
- this[resizeObserverSymbol].observe(document.scrollingElement);
260
+ // against flickering
261
+ this[resizeObserverSymbol] = new ResizeObserver(() => {
262
+ if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
263
+ try {
264
+ this[timerCallbackSymbol].touch();
265
+ return;
266
+ } catch (e) {
267
+ delete this[timerCallbackSymbol];
268
+ }
269
+ }
270
+
271
+ this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
272
+ calcHeight.call(this);
273
+ });
274
+ });
275
+
276
+ this[resizeObserverSymbol].observe(this.ownerDocument.body);
277
+ this[resizeObserverSymbol].observe(document.scrollingElement);
275
278
  }
276
279
 
277
280
  function disconnectResizeObserver() {
278
- if (this[resizeObserverSymbol] instanceof ResizeObserver) {
279
- this[resizeObserverSymbol].disconnect();
280
- }
281
+ if (this[resizeObserverSymbol] instanceof ResizeObserver) {
282
+ this[resizeObserverSymbol].disconnect();
283
+ }
281
284
  }
282
285
 
283
286
  /**
@@ -286,36 +289,46 @@ function disconnectResizeObserver() {
286
289
  * @fires monster-iframe-clicked
287
290
  */
288
291
  function initEventHandler() {
289
- const self = this;
290
- const element = this[iframeElementSymbol];
291
-
292
- const type = "click";
293
-
294
- element.addEventListener(type, function (event) {
295
- const callback = self.getOption("actions.click");
296
-
297
- fireCustomEvent(self, "monster-iframe-clicked", {
298
- element: self,
299
- });
300
-
301
- if (!isFunction(callback)) {
302
- return;
303
- }
304
-
305
- const element = findTargetElementFromEvent(
306
- event,
307
- ATTRIBUTE_ROLE,
308
- "control",
309
- );
310
-
311
- if (!(element instanceof Node && self.hasNode(element))) {
312
- return;
313
- }
314
-
315
- callback.call(self, event);
316
- });
317
-
318
- return this;
292
+ const self = this;
293
+ const element = this[iframeElementSymbol];
294
+
295
+ const type = "click";
296
+
297
+ element.addEventListener(type, function (event) {
298
+ const callback = self.getOption("actions.click");
299
+
300
+ fireCustomEvent(self, "monster-iframe-clicked", {
301
+ element: self,
302
+ });
303
+
304
+ if (!isFunction(callback)) {
305
+ return;
306
+ }
307
+
308
+ const element = findTargetElementFromEvent(
309
+ event,
310
+ ATTRIBUTE_ROLE,
311
+ "control",
312
+ );
313
+
314
+ if (!(element instanceof Node && self.hasNode(element))) {
315
+ return;
316
+ }
317
+
318
+ callback.call(self, event);
319
+ });
320
+
321
+ this[iframeElementSymbol].addEventListener("load", () => {
322
+ calcHeight.call(this);
323
+ if (this.getOption("features.replaceParentTarget")) {
324
+ var links = this[iframeElementSymbol].contentDocument.querySelectorAll('a[target="_parent"], form[target="_parent"], a[target="_top"], form[target="_top"]');
325
+ links.forEach(function(link) {
326
+ link.target = '_self';
327
+ });
328
+ }
329
+ });
330
+
331
+ return this;
319
332
  }
320
333
 
321
334
  /**
@@ -323,17 +336,17 @@ function initEventHandler() {
323
336
  * @return {void}
324
337
  */
325
338
  function initControlReferences() {
326
- if (!this.shadowRoot) {
327
- throw new Error("no shadow-root is defined");
328
- }
339
+ if (!this.shadowRoot) {
340
+ throw new Error("no shadow-root is defined");
341
+ }
329
342
 
330
- this[PanelElementSymbol] = this.shadowRoot.querySelector(
331
- "[data-monster-role=control]",
332
- );
343
+ this[PanelElementSymbol] = this.shadowRoot.querySelector(
344
+ "[data-monster-role=control]",
345
+ );
333
346
 
334
- this[iframeElementSymbol] = this.shadowRoot.querySelector(
335
- `[${ATTRIBUTE_ROLE}="control"] iframe`,
336
- );
347
+ this[iframeElementSymbol] = this.shadowRoot.querySelector(
348
+ `[${ATTRIBUTE_ROLE}="control"] iframe`,
349
+ );
337
350
  }
338
351
 
339
352
  /**
@@ -341,18 +354,19 @@ function initControlReferences() {
341
354
  * @return {string}
342
355
  */
343
356
  function getTemplate() {
344
- // language=HTML
345
- return `
357
+ // language=HTML
358
+ return `
346
359
  <div data-monster-role="control" part="control">
347
- <iframe data-monster-role="iframe"
348
- data-monster-attributes="sandbox path:sandbox,
360
+ <iframe data-monster-role="iframe"
361
+ data-monster-attributes="sandbox path:sandbox,
349
362
  name path:name,
350
- referrerpolicy path:referrerpolicy,
351
- loading path:features.loading,
352
- allowpaymentrequest path:features.allowpaymentrequest,
353
- allowfullscreen path:features.allowfullscreen,
363
+ referrerpolicy path:referrerPolicy,
364
+ loading path:loading,
365
+ allowpaymentrequest path:features.allowPaymentRequest,
366
+ allowfullscreen path:features.allowFullScreen,
354
367
  src path:src"
355
- ></iframe></div>`;
368
+ ></iframe>
369
+ </div>`;
356
370
  }
357
371
 
358
372
  registerCustomElement(Iframe);