@schukai/monster 3.100.14 → 3.100.16
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/CHANGELOG.md +19 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +14 -1
- package/source/components/datatable/datatable.mjs +13 -1
- package/source/components/datatable/filter/date-range.mjs +12 -1
- package/source/components/form/button-bar.mjs +15 -2
- package/source/components/form/popper-button.mjs +14 -1
- package/source/components/form/select.mjs +14 -1
- package/source/components/form/state-button.mjs +2 -0
- package/source/components/host/call-button.mjs +125 -162
- package/source/components/host/config-manager.mjs +10 -0
- package/source/components/host/host.mjs +19 -45
- package/source/components/host/overlay.mjs +0 -34
- package/source/components/host/toggle-button.mjs +1 -35
- package/source/components/host/viewer.mjs +6 -27
- package/source/components/layout/popper.mjs +14 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.100.16] - 2025-01-20
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
- update resizeobserver
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [3.100.15] - 2025-01-20
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
- **datatable:** check if parent element exists for resize
|
18
|
+
### Changes
|
19
|
+
|
20
|
+
- documentation
|
21
|
+
|
22
|
+
|
23
|
+
|
5
24
|
## [3.100.14] - 2025-01-19
|
6
25
|
|
7
26
|
### Bug Fixes
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.100.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.100.16"}
|
@@ -267,7 +267,20 @@ function attachResizeObserver() {
|
|
267
267
|
});
|
268
268
|
});
|
269
269
|
|
270
|
-
|
270
|
+
requestAnimationFrame(() => {
|
271
|
+
|
272
|
+
let parent = this.parentNode;
|
273
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
274
|
+
parent = parent.parentNode;
|
275
|
+
}
|
276
|
+
|
277
|
+
if (parent instanceof HTMLElement) {
|
278
|
+
this[resizeObserverSymbol].observe(parent);
|
279
|
+
}
|
280
|
+
|
281
|
+
|
282
|
+
});
|
283
|
+
|
271
284
|
}
|
272
285
|
|
273
286
|
/**
|
@@ -290,7 +290,19 @@ class DataTable extends CustomElement {
|
|
290
290
|
updateGrid.call(self);
|
291
291
|
});
|
292
292
|
|
293
|
-
|
293
|
+
requestAnimationFrame(() => {
|
294
|
+
|
295
|
+
let parent = this.parentNode;
|
296
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
297
|
+
parent = parent.parentNode;
|
298
|
+
}
|
299
|
+
|
300
|
+
if (parent instanceof HTMLElement) {
|
301
|
+
this[resizeObserverSymbol].observe(parent);
|
302
|
+
}
|
303
|
+
|
304
|
+
|
305
|
+
});
|
294
306
|
}
|
295
307
|
|
296
308
|
/**
|
@@ -689,7 +689,18 @@ function attachResizeObserver() {
|
|
689
689
|
});
|
690
690
|
});
|
691
691
|
|
692
|
-
|
692
|
+
requestAnimationFrame(() => {
|
693
|
+
|
694
|
+
let parent = this.parentNode;
|
695
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
696
|
+
parent = parent.parentNode;
|
697
|
+
}
|
698
|
+
|
699
|
+
if (parent instanceof HTMLElement) {
|
700
|
+
this[resizeObserverSymbol].observe(parent);
|
701
|
+
}
|
702
|
+
});
|
703
|
+
|
693
704
|
}
|
694
705
|
|
695
706
|
function disconnectResizeObserver() {
|
@@ -567,8 +567,21 @@ function updateResizeObserverObservation() {
|
|
567
567
|
this[resizeObserverSymbol].observe(node);
|
568
568
|
});
|
569
569
|
|
570
|
-
|
571
|
-
|
570
|
+
requestAnimationFrame(() => {
|
571
|
+
|
572
|
+
let parent = this.parentNode;
|
573
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
574
|
+
parent = parent.parentNode;
|
575
|
+
}
|
576
|
+
|
577
|
+
if (parent instanceof HTMLElement) {
|
578
|
+
this[resizeObserverSymbol].observe(parent);
|
579
|
+
}
|
580
|
+
|
581
|
+
|
582
|
+
});
|
583
|
+
|
584
|
+
|
572
585
|
}
|
573
586
|
|
574
587
|
/**
|
@@ -345,7 +345,20 @@ function attachResizeObserver() {
|
|
345
345
|
});
|
346
346
|
});
|
347
347
|
|
348
|
-
|
348
|
+
requestAnimationFrame(() => {
|
349
|
+
|
350
|
+
let parent = this.parentNode;
|
351
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
352
|
+
parent = parent.parentNode;
|
353
|
+
}
|
354
|
+
|
355
|
+
if (parent instanceof HTMLElement) {
|
356
|
+
this[resizeObserverSymbol].observe(parent);
|
357
|
+
}
|
358
|
+
|
359
|
+
|
360
|
+
});
|
361
|
+
|
349
362
|
}
|
350
363
|
|
351
364
|
function disconnectResizeObserver() {
|
@@ -1097,7 +1097,20 @@ function attachResizeObserver() {
|
|
1097
1097
|
});
|
1098
1098
|
});
|
1099
1099
|
|
1100
|
-
|
1100
|
+
requestAnimationFrame(() => {
|
1101
|
+
|
1102
|
+
let parent = this.parentNode;
|
1103
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
1104
|
+
parent = parent.parentNode;
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
if (parent instanceof HTMLElement) {
|
1108
|
+
this[resizeObserverSymbol].observe(parent);
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
|
1112
|
+
});
|
1113
|
+
|
1101
1114
|
}
|
1102
1115
|
|
1103
1116
|
/**
|
@@ -69,11 +69,13 @@ class StateButton extends Button {
|
|
69
69
|
templates: {
|
70
70
|
main: getTemplate(),
|
71
71
|
},
|
72
|
+
|
72
73
|
states: {
|
73
74
|
successful: getStateInstanceFor("successful"),
|
74
75
|
activity: getStateInstanceFor("activity"),
|
75
76
|
failed: getStateInstanceFor("failed"),
|
76
77
|
},
|
78
|
+
|
77
79
|
current: getStateInstanceFor("stateless"),
|
78
80
|
|
79
81
|
aria: {
|
@@ -12,21 +12,20 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {
|
15
|
+
import {instanceSymbol} from "../../constants.mjs";
|
16
16
|
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
assembleMethodSymbol,
|
18
|
+
CustomElement,
|
19
|
+
registerCustomElement,
|
20
20
|
} from "../../dom/customelement.mjs";
|
21
|
-
import {
|
22
|
-
import {
|
21
|
+
import {CallButtonStyleSheet} from "./stylesheet/call-button.mjs";
|
22
|
+
import {isArray, isObject, isFunction} from "../../types/is.mjs";
|
23
23
|
import {
|
24
|
-
|
25
|
-
getDocument,
|
24
|
+
findElementWithSelectorUpwards,
|
26
25
|
} from "../../dom/util.mjs";
|
27
|
-
import {
|
26
|
+
import {ATTRIBUTE_PREFIX} from "../../dom/constants.mjs";
|
28
27
|
|
29
|
-
export {
|
28
|
+
export {CallButton};
|
30
29
|
|
31
30
|
/**
|
32
31
|
* @private
|
@@ -46,109 +45,73 @@ const ATTRIBUTE_CALL = `${ATTRIBUTE_PREFIX}call`;
|
|
46
45
|
/**
|
47
46
|
* The call button component is used to call a method of another element.
|
48
47
|
*
|
49
|
-
* <img src="./images/call-button.png">
|
50
|
-
*
|
51
|
-
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
52
|
-
*
|
53
|
-
* You can create this control either by specifying the HTML tag <monster-call-button />` directly in the HTML or using
|
54
|
-
* Javascript via the `document.createElement('monster-call-button');` method.
|
55
|
-
*
|
56
|
-
* ```html
|
57
|
-
* <monster-call-button></monster-call-button>
|
58
|
-
* ```
|
59
|
-
*
|
60
|
-
* Or you can create this CustomControl directly in Javascript:
|
61
|
-
*
|
62
|
-
* ```js
|
63
|
-
* import '@schukai/component-host/source/filter.mjs';
|
64
|
-
* document.createElement('monster-call-button');
|
65
|
-
* ```
|
66
|
-
*
|
67
|
-
* The Body should have a class "hidden" to ensure that the styles are applied correctly.
|
68
|
-
*
|
69
|
-
* ```css
|
70
|
-
* body.hidden {
|
71
|
-
* visibility: hidden;
|
72
|
-
* }
|
73
|
-
* ```
|
74
|
-
*
|
75
|
-
* @startuml call-button.png
|
76
|
-
* skinparam monochrome true
|
77
|
-
* skinparam shadowing false
|
78
|
-
* HTMLElement <|-- CustomElement
|
79
|
-
* CustomElement <|-- CallButton
|
80
|
-
* @enduml
|
81
|
-
*
|
82
48
|
* @copyright schukai GmbH
|
83
|
-
* @summary A
|
49
|
+
* @summary A call button component that can call a method of another element.
|
84
50
|
*/
|
85
51
|
class CallButton extends CustomElement {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
static getCSSStyleSheet() {
|
150
|
-
return [CallButtonStyleSheet];
|
151
|
-
}
|
52
|
+
/**
|
53
|
+
* This method is called by the `instanceof` operator.
|
54
|
+
* @return {symbol}
|
55
|
+
*/
|
56
|
+
static get [instanceSymbol]() {
|
57
|
+
return Symbol.for("@schukai/component-host/call-button@@instance");
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
62
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
63
|
+
*
|
64
|
+
* The individual configuration values can be found in the table.
|
65
|
+
*
|
66
|
+
* @property {Object} templates Template definitions
|
67
|
+
* @property {string} templates.main Main template
|
68
|
+
*/
|
69
|
+
get defaults() {
|
70
|
+
return Object.assign(
|
71
|
+
{},
|
72
|
+
super.defaults,
|
73
|
+
{
|
74
|
+
templates: {
|
75
|
+
main: getTemplate(),
|
76
|
+
},
|
77
|
+
references: {
|
78
|
+
callableSelector: undefined,
|
79
|
+
},
|
80
|
+
|
81
|
+
call: undefined,
|
82
|
+
|
83
|
+
labels: {
|
84
|
+
button: "<slot>Toggle</slot>",
|
85
|
+
},
|
86
|
+
},
|
87
|
+
initOptionsFromArguments.call(this),
|
88
|
+
);
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
*
|
93
|
+
* @return {string}
|
94
|
+
*/
|
95
|
+
static getTag() {
|
96
|
+
return "monster-call-button";
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* @return {CallButton}
|
101
|
+
*/
|
102
|
+
[assembleMethodSymbol]() {
|
103
|
+
super[assembleMethodSymbol]();
|
104
|
+
|
105
|
+
initControlReferences.call(this);
|
106
|
+
initEventHandler.call(this);
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* @return {Array}
|
111
|
+
*/
|
112
|
+
static getCSSStyleSheet() {
|
113
|
+
return [CallButtonStyleSheet];
|
114
|
+
}
|
152
115
|
}
|
153
116
|
|
154
117
|
/**
|
@@ -156,14 +119,14 @@ class CallButton extends CustomElement {
|
|
156
119
|
* @return {CallButton}
|
157
120
|
*/
|
158
121
|
function initControlReferences() {
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
122
|
+
if (!this.shadowRoot) {
|
123
|
+
throw new Error("no shadow-root is defined");
|
124
|
+
}
|
125
|
+
|
126
|
+
this[callButtonElementSymbol] = this.shadowRoot.querySelector(
|
127
|
+
"[data-monster-role=control]",
|
128
|
+
);
|
129
|
+
return this;
|
167
130
|
}
|
168
131
|
|
169
132
|
/**
|
@@ -173,26 +136,26 @@ function initControlReferences() {
|
|
173
136
|
* @throws {Error} the datasource could not be initialized
|
174
137
|
*/
|
175
138
|
function initOptionsFromArguments() {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
139
|
+
const options = {};
|
140
|
+
const value = this.getAttribute(ATTRIBUTE_REFERENCE);
|
141
|
+
if (value) {
|
142
|
+
if (!isObject(options.references)) {
|
143
|
+
options.references = {};
|
144
|
+
}
|
145
|
+
const selectors = value.split(",");
|
146
|
+
if (isArray(selectors) && selectors.length === 0) {
|
147
|
+
throw new TypeError("incorrect arguments passed for the datasource");
|
148
|
+
}
|
149
|
+
|
150
|
+
options.references.callableSelector = selectors;
|
151
|
+
}
|
152
|
+
|
153
|
+
const call = this.getAttribute(ATTRIBUTE_CALL);
|
154
|
+
if (call) {
|
155
|
+
options.call = call;
|
156
|
+
}
|
157
|
+
|
158
|
+
return options;
|
196
159
|
}
|
197
160
|
|
198
161
|
/**
|
@@ -200,28 +163,28 @@ function initOptionsFromArguments() {
|
|
200
163
|
* @throws {Error} The option references.callableSelector must be an array
|
201
164
|
*/
|
202
165
|
function initEventHandler() {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
166
|
+
this[callButtonElementSymbol].addEventListener("click", (event) => {
|
167
|
+
event.preventDefault();
|
168
|
+
|
169
|
+
const selectors = this.getOption("references.callableSelector");
|
170
|
+
if (!isArray(selectors)) {
|
171
|
+
throw new Error(
|
172
|
+
"The option references.callableSelector must be an array",
|
173
|
+
);
|
174
|
+
}
|
175
|
+
|
176
|
+
const call = this.getOption("call");
|
177
|
+
if (!call) {
|
178
|
+
throw new Error("The option call must be defined");
|
179
|
+
}
|
180
|
+
|
181
|
+
for (const selector of selectors) {
|
182
|
+
const element = findElementWithSelectorUpwards(this, selector);
|
183
|
+
if (element instanceof HTMLElement && isFunction(element?.[call])) {
|
184
|
+
element[call]();
|
185
|
+
}
|
186
|
+
}
|
187
|
+
});
|
225
188
|
}
|
226
189
|
|
227
190
|
/**
|
@@ -229,8 +192,8 @@ function initEventHandler() {
|
|
229
192
|
* @return {string}
|
230
193
|
*/
|
231
194
|
function getTemplate() {
|
232
|
-
|
233
|
-
|
195
|
+
// language=HTML
|
196
|
+
return `
|
234
197
|
<div data-monster-role="control" part="control"
|
235
198
|
data-monster-attributes="class path:references.callableSelector | ?::hidden">
|
236
199
|
<a href="#" data-monster-role="call-button" data-monster-replace="path:labels.button"></a>
|
@@ -172,6 +172,10 @@ class ConfigManager extends CustomElement {
|
|
172
172
|
}
|
173
173
|
}
|
174
174
|
|
175
|
+
/**
|
176
|
+
* @private
|
177
|
+
* @returns {Promise<unknown>}
|
178
|
+
*/
|
175
179
|
function openDatabase() {
|
176
180
|
const window = getWindow();
|
177
181
|
|
@@ -280,6 +284,12 @@ function deleteBlob(key) {
|
|
280
284
|
});
|
281
285
|
}
|
282
286
|
|
287
|
+
/**
|
288
|
+
* @private
|
289
|
+
* @param key
|
290
|
+
* @param blob
|
291
|
+
* @returns {Promise<unknown>}
|
292
|
+
*/
|
283
293
|
function setBlob(key, blob) {
|
284
294
|
const store = getObjectStore.call(this, MODE_READ_WRITE);
|
285
295
|
|
@@ -71,43 +71,10 @@ const resourceManagerSymbol = Symbol("resourceManager");
|
|
71
71
|
/**
|
72
72
|
* The Host component is used to encapsulate the content of a web app.
|
73
73
|
*
|
74
|
-
* <img src="./images/host.png">
|
75
|
-
*
|
76
|
-
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
77
|
-
*
|
78
|
-
* You can create this control either by specifying the HTML tag <monster-host />` directly in the HTML or using
|
79
|
-
* Javascript via the `document.createElement('monster-host');` method.
|
80
|
-
*
|
81
|
-
* ```html
|
82
|
-
* <monster-host></monster-host>
|
83
|
-
* ```
|
84
|
-
*
|
85
|
-
* Or you can create this CustomControl directly in Javascript:
|
86
|
-
*
|
87
|
-
* ```js
|
88
|
-
* import '@schukai/component-state/source/host.mjs';
|
89
|
-
* document.createElement('monster-host');
|
90
|
-
* ```
|
91
|
-
*
|
92
|
-
* The Body should have a class "hidden" to ensure that the styles are applied correctly.
|
93
|
-
*
|
94
|
-
* ```css
|
95
|
-
* body.hidden {
|
96
|
-
* visibility: hidden;
|
97
|
-
* }
|
98
|
-
* ```
|
99
|
-
*
|
100
|
-
* @startuml host.png
|
101
|
-
* skinparam monochrome true
|
102
|
-
* skinparam shadowing false
|
103
|
-
* HTMLElement <|-- CustomElement
|
104
|
-
* CustomElement <|-- Host
|
105
|
-
* @enduml
|
106
|
-
*
|
107
74
|
* @copyright schukai GmbH
|
108
75
|
* @summary A simple host component
|
109
|
-
* @fires
|
110
|
-
* @fires
|
76
|
+
* @fires monster-host-connected
|
77
|
+
* @fires monster-host-disconnected
|
111
78
|
*/
|
112
79
|
class Host extends CustomElement {
|
113
80
|
/**
|
@@ -119,9 +86,6 @@ class Host extends CustomElement {
|
|
119
86
|
}
|
120
87
|
|
121
88
|
/**
|
122
|
-
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
123
|
-
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
124
|
-
*
|
125
89
|
* The individual configuration values can be found in the table.
|
126
90
|
*
|
127
91
|
* @property {Object} templates Template definitions
|
@@ -147,6 +111,10 @@ class Host extends CustomElement {
|
|
147
111
|
return this[configManagerElementSymbol].getConfig(key);
|
148
112
|
}
|
149
113
|
|
114
|
+
/**
|
115
|
+
* @param {string} key
|
116
|
+
* @returns {*}
|
117
|
+
*/
|
150
118
|
hasConfig(key) {
|
151
119
|
if (this[configManagerElementSymbol] instanceof HTMLElement === false) {
|
152
120
|
throw new Error("There is no config manager element");
|
@@ -154,6 +122,11 @@ class Host extends CustomElement {
|
|
154
122
|
return this[configManagerElementSymbol].hasConfig(key);
|
155
123
|
}
|
156
124
|
|
125
|
+
/**
|
126
|
+
*
|
127
|
+
* @param {key} key
|
128
|
+
* @returns {*}
|
129
|
+
*/
|
157
130
|
deleteConfig(key) {
|
158
131
|
if (this[configManagerElementSymbol] instanceof HTMLElement === false) {
|
159
132
|
throw new Error("There is no config manager element");
|
@@ -177,7 +150,7 @@ class Host extends CustomElement {
|
|
177
150
|
|
178
151
|
/**
|
179
152
|
* @private
|
180
|
-
* @fires
|
153
|
+
* @fires Host#monster-host-connected
|
181
154
|
*/
|
182
155
|
connectedCallback() {
|
183
156
|
super.connectedCallback();
|
@@ -199,7 +172,7 @@ class Host extends CustomElement {
|
|
199
172
|
|
200
173
|
/**
|
201
174
|
* @private
|
202
|
-
* @fires
|
175
|
+
* @fires Host#monster-host-disconnected
|
203
176
|
*/
|
204
177
|
disconnectedCallback() {
|
205
178
|
super.disconnectedCallback();
|
@@ -231,7 +204,7 @@ class Host extends CustomElement {
|
|
231
204
|
|
232
205
|
/**
|
233
206
|
*
|
234
|
-
* @return {
|
207
|
+
* @return {Host}
|
235
208
|
*/
|
236
209
|
[assembleMethodSymbol]() {
|
237
210
|
this[promisesSymbol] = [];
|
@@ -302,7 +275,7 @@ class Host extends CustomElement {
|
|
302
275
|
|
303
276
|
/**
|
304
277
|
*
|
305
|
-
* @return {
|
278
|
+
* @return {Host}
|
306
279
|
* @throws {Error} There is no overlay element defined.
|
307
280
|
*/
|
308
281
|
toggleOverlay() {
|
@@ -341,7 +314,6 @@ class Host extends CustomElement {
|
|
341
314
|
}
|
342
315
|
|
343
316
|
/**
|
344
|
-
*
|
345
317
|
* @return {string}
|
346
318
|
*/
|
347
319
|
static getTag() {
|
@@ -356,8 +328,7 @@ class Host extends CustomElement {
|
|
356
328
|
}
|
357
329
|
|
358
330
|
/**
|
359
|
-
*
|
360
|
-
* @return {Monster.I18n.Locale}
|
331
|
+
* @return {Locale}
|
361
332
|
*/
|
362
333
|
get locale() {
|
363
334
|
return getLocaleOfDocument();
|
@@ -402,6 +373,9 @@ function initControlReferences() {
|
|
402
373
|
);
|
403
374
|
}
|
404
375
|
|
376
|
+
/**
|
377
|
+
* @private
|
378
|
+
*/
|
405
379
|
function initTranslations() {
|
406
380
|
if (isIterable(this[promisesSymbol]) === false) {
|
407
381
|
this[promisesSymbol] = [];
|
@@ -67,40 +67,6 @@ const ATTRIBUTE_VALUE_OVERLAY_OPEN = "overlay-open";
|
|
67
67
|
/**
|
68
68
|
* The Overlay component is used to show an overlay and a button to open the overlay.
|
69
69
|
*
|
70
|
-
* <img src="./images/overlay.png">
|
71
|
-
*
|
72
|
-
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
73
|
-
*
|
74
|
-
* You can create this control either by specifying the HTML tag <monster-overlay />` directly in the HTML or using
|
75
|
-
* Javascript via the `document.createElement('monster-overlay');` method.
|
76
|
-
*
|
77
|
-
* ```html
|
78
|
-
* <monster-overlay></monster-overlay>
|
79
|
-
* ```
|
80
|
-
*
|
81
|
-
* Or you can create this CustomControl directly in Javascript:
|
82
|
-
*
|
83
|
-
* ```js
|
84
|
-
* import '@schukai/component-state/source/overlay.mjs';
|
85
|
-
* document.createElement('monster-overlay');
|
86
|
-
* ```
|
87
|
-
*
|
88
|
-
* The Body should have a class "hidden" to ensure that the styles are applied correctly.
|
89
|
-
*
|
90
|
-
* ```css
|
91
|
-
* body.hidden {
|
92
|
-
* visibility: hidden;
|
93
|
-
* }
|
94
|
-
* ```
|
95
|
-
*
|
96
|
-
* @startuml overlay.png
|
97
|
-
* skinparam monochrome true
|
98
|
-
* skinparam shadowing false
|
99
|
-
* HTMLElement <|-- CustomElement
|
100
|
-
* CustomElement <|-- CustomControl
|
101
|
-
* CustomControl <|-- Overlay
|
102
|
-
* @enduml
|
103
|
-
*
|
104
70
|
* @copyright schukai GmbH
|
105
71
|
* @summary A simple overlay component
|
106
72
|
* @fires monster-overlay-before-open
|
@@ -19,41 +19,7 @@ import { CallButton } from "./call-button.mjs";
|
|
19
19
|
export { ToggleButton };
|
20
20
|
|
21
21
|
/**
|
22
|
-
* The Toggle Button component is used toggle a other element
|
23
|
-
*
|
24
|
-
* <img src="./images/toggle-button.png">
|
25
|
-
*
|
26
|
-
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
27
|
-
*
|
28
|
-
* You can create this control either by specifying the HTML tag <monster-toggle-button />` directly in the HTML or using
|
29
|
-
* Javascript via the `document.createElement('monster-toggle-button');` method.
|
30
|
-
*
|
31
|
-
* ```html
|
32
|
-
* <monster-toggle-button></monster-toggle-button>
|
33
|
-
* ```
|
34
|
-
*
|
35
|
-
* Or you can create this CustomControl directly in Javascript:
|
36
|
-
*
|
37
|
-
* ```js
|
38
|
-
* import '@schukai/component-host/source/filter.mjs';
|
39
|
-
* document.createElement('monster-toggle-button');
|
40
|
-
* ```
|
41
|
-
*
|
42
|
-
* The Body should have a class "hidden" to ensure that the styles are applied correctly.
|
43
|
-
*
|
44
|
-
* ```css
|
45
|
-
* body.hidden {
|
46
|
-
* visibility: hidden;
|
47
|
-
* }
|
48
|
-
* ```
|
49
|
-
*
|
50
|
-
* @startuml toggle-button.png
|
51
|
-
* skinparam monochrome true
|
52
|
-
* skinparam shadowing false
|
53
|
-
* HTMLElement <|-- CustomElement
|
54
|
-
* CustomElement <|-- CallButton
|
55
|
-
* CallButton <|-- ToggleButton
|
56
|
-
* @enduml
|
22
|
+
* The Toggle Button component is used toggle a other element wich has a method called toggle.
|
57
23
|
*
|
58
24
|
* @copyright schukai GmbH
|
59
25
|
* @summary A toggle button
|
@@ -34,32 +34,6 @@ const viewerElementSymbol = Symbol("viewerElement");
|
|
34
34
|
/**
|
35
35
|
* The Viewer component is used to show a PDF, HTML or Image.
|
36
36
|
*
|
37
|
-
* <img src="./images/viewer.png">
|
38
|
-
*
|
39
|
-
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
|
40
|
-
*
|
41
|
-
* You can create this control either by specifying the HTML tag <monster-viewer />` directly in the HTML or using
|
42
|
-
* Javascript via the `document.createElement('monster-viewer');` method.
|
43
|
-
*
|
44
|
-
* ```html
|
45
|
-
* <monster-viewer></monster-viewer>
|
46
|
-
* ```
|
47
|
-
*
|
48
|
-
* Or you can create this CustomControl directly in Javascript:
|
49
|
-
*
|
50
|
-
* ```js
|
51
|
-
* import '@schukai/monster/components/host/viewer.mjs';
|
52
|
-
* document.createElement('monster-viewer');
|
53
|
-
* ```
|
54
|
-
*
|
55
|
-
* @startuml viewer.png
|
56
|
-
* skinparam monochrome true
|
57
|
-
* skinparam shadowing false
|
58
|
-
* HTMLElement <|-- CustomElement
|
59
|
-
* CustomElement <|-- CustomControl
|
60
|
-
* CustomControl <|-- Viewer
|
61
|
-
* @enduml
|
62
|
-
*
|
63
37
|
* @copyright schukai GmbH
|
64
38
|
* @summary A simple viewer component
|
65
39
|
*/
|
@@ -96,6 +70,11 @@ class Viewer extends CustomElement {
|
|
96
70
|
});
|
97
71
|
}
|
98
72
|
|
73
|
+
/**
|
74
|
+
*
|
75
|
+
* @param html
|
76
|
+
* @returns {Viewer}
|
77
|
+
*/
|
99
78
|
setContent(html) {
|
100
79
|
this.setOption("content", html);
|
101
80
|
return this;
|
@@ -208,7 +187,7 @@ class Viewer extends CustomElement {
|
|
208
187
|
|
209
188
|
/**
|
210
189
|
*
|
211
|
-
* @return {
|
190
|
+
* @return {Viewer}
|
212
191
|
*/
|
213
192
|
[assembleMethodSymbol]() {
|
214
193
|
super[assembleMethodSymbol]();
|
@@ -357,7 +357,20 @@ function attachResizeObserver() {
|
|
357
357
|
});
|
358
358
|
});
|
359
359
|
|
360
|
-
|
360
|
+
requestAnimationFrame(() => {
|
361
|
+
|
362
|
+
let parent = this.parentNode;
|
363
|
+
while(!(parent instanceof HTMLElement) && parent !== null) {
|
364
|
+
parent = parent.parentNode;
|
365
|
+
}
|
366
|
+
|
367
|
+
if (parent instanceof HTMLElement) {
|
368
|
+
this[resizeObserverSymbol].observe(parent);
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
});
|
373
|
+
|
361
374
|
}
|
362
375
|
|
363
376
|
function disconnectResizeObserver() {
|