@schukai/monster 3.63.3 → 3.64.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/CHANGELOG.md +25 -0
- package/package.json +1 -1
- package/source/components/datatable/stylesheet/change-button.mjs +8 -4
- package/source/components/datatable/stylesheet/column-bar.mjs +8 -4
- package/source/components/datatable/stylesheet/dataset.mjs +8 -4
- package/source/components/datatable/stylesheet/datasource.mjs +8 -4
- package/source/components/datatable/stylesheet/datatable.mjs +8 -4
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-button.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-date-range.mjs +8 -4
- package/source/components/datatable/stylesheet/filter-range.mjs +8 -4
- package/source/components/datatable/stylesheet/filter.mjs +8 -4
- package/source/components/datatable/stylesheet/pagination.mjs +8 -4
- package/source/components/datatable/stylesheet/save-button.mjs +8 -4
- package/source/components/datatable/stylesheet/select-filter.mjs +8 -4
- package/source/components/datatable/stylesheet/status.mjs +8 -4
- package/source/components/form/stylesheet/action-button.mjs +8 -4
- package/source/components/form/stylesheet/api-button.mjs +8 -4
- package/source/components/form/stylesheet/button-bar.mjs +8 -4
- package/source/components/form/stylesheet/button.mjs +8 -4
- package/source/components/form/stylesheet/confirm-button.mjs +8 -4
- package/source/components/form/stylesheet/context-error.mjs +8 -4
- package/source/components/form/stylesheet/context-help.mjs +8 -4
- package/source/components/form/stylesheet/form-field.mjs +8 -4
- package/source/components/form/stylesheet/form.mjs +8 -4
- package/source/components/form/stylesheet/message-state-button.mjs +8 -4
- package/source/components/form/stylesheet/popper-button.mjs +8 -4
- package/source/components/form/stylesheet/popper.mjs +8 -4
- package/source/components/form/stylesheet/select.mjs +8 -4
- package/source/components/form/stylesheet/state-button.mjs +8 -4
- package/source/components/form/stylesheet/toggle-switch.mjs +8 -4
- package/source/components/form/stylesheet/tree-select.mjs +8 -4
- package/source/components/host/stylesheet/call-button.mjs +8 -4
- package/source/components/host/stylesheet/collapse.mjs +8 -4
- package/source/components/host/stylesheet/config-manager.mjs +8 -4
- package/source/components/host/stylesheet/details.mjs +8 -4
- package/source/components/host/stylesheet/host.mjs +8 -4
- package/source/components/host/stylesheet/overlay.mjs +8 -4
- package/source/components/host/stylesheet/toggle-button.mjs +8 -4
- package/source/components/host/stylesheet/viewer.mjs +8 -4
- package/source/components/layout/panel.mjs +277 -0
- package/source/components/layout/{split-screen.mjs → split-panel.mjs} +77 -64
- package/source/components/layout/style/panel.pcss +38 -0
- package/source/components/layout/style/{split-screen.pcss → split-panel.pcss} +1 -1
- package/source/components/layout/stylesheet/panel.mjs +31 -0
- package/source/components/layout/stylesheet/split-panel.mjs +31 -0
- package/source/components/layout/stylesheet/tabs.mjs +8 -4
- package/source/components/layout/stylesheet/width-toggle.mjs +8 -4
- package/source/components/notify/stylesheet/message.mjs +8 -4
- package/source/components/notify/stylesheet/notify.mjs +8 -4
- package/source/components/state/stylesheet/log.mjs +8 -4
- package/source/components/state/stylesheet/state.mjs +8 -4
- package/source/components/stylesheet/badge.mjs +8 -4
- package/source/components/stylesheet/border.mjs +8 -4
- package/source/components/stylesheet/button.mjs +8 -4
- package/source/components/stylesheet/card.mjs +8 -4
- package/source/components/stylesheet/color.mjs +8 -4
- package/source/components/stylesheet/common.mjs +8 -4
- package/source/components/stylesheet/control.mjs +8 -4
- package/source/components/stylesheet/data-grid.mjs +8 -4
- package/source/components/stylesheet/display.mjs +8 -4
- package/source/components/stylesheet/floating-ui.mjs +8 -4
- package/source/components/stylesheet/form.mjs +8 -4
- package/source/components/stylesheet/host.mjs +8 -4
- package/source/components/stylesheet/icons.mjs +8 -4
- package/source/components/stylesheet/link.mjs +8 -4
- package/source/components/stylesheet/mixin/badge.mjs +31 -0
- package/source/components/stylesheet/mixin/button.mjs +31 -0
- package/source/components/stylesheet/mixin/form.mjs +31 -0
- package/source/components/stylesheet/mixin/hover.mjs +31 -0
- package/source/components/stylesheet/mixin/icon.mjs +31 -0
- package/source/components/stylesheet/mixin/media.mjs +31 -0
- package/source/components/stylesheet/mixin/property.mjs +31 -0
- package/source/components/stylesheet/mixin/skeleton.mjs +31 -0
- package/source/components/stylesheet/mixin/spinner.mjs +31 -0
- package/source/components/stylesheet/mixin/typography.mjs +31 -0
- package/source/components/stylesheet/normalize.mjs +8 -4
- package/source/components/stylesheet/popper.mjs +8 -4
- package/source/components/stylesheet/property.mjs +8 -4
- package/source/components/stylesheet/ripple.mjs +8 -4
- package/source/components/stylesheet/skeleton.mjs +8 -4
- package/source/components/stylesheet/space.mjs +8 -4
- package/source/components/stylesheet/spinner.mjs +8 -4
- package/source/components/stylesheet/table.mjs +8 -4
- package/source/components/stylesheet/theme.mjs +8 -4
- package/source/components/stylesheet/typography.mjs +8 -4
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +8 -4
- package/source/monster.mjs +26 -10
- package/source/types/version.mjs +1 -1
- package/test/cases/components/layout/{slit-screen.mjs → panel.mjs} +5 -5
- package/test/cases/components/layout/slit-panel.mjs +83 -0
- package/test/cases/monster.mjs +1 -1
- package/test/web/tests.js +1 -1
- package/source/components/layout/stylesheet/split-screen.mjs +0 -27
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
|
-
* Copyright schukai GmbH and
|
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2024. All rights reserved.
|
|
4
3
|
* Node module: @schukai/monster
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 schukai GmbH
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
assembleMethodSymbol,
|
|
8
|
+
CustomElement,
|
|
9
|
+
registerCustomElement,
|
|
10
|
+
} from "../../dom/customelement.mjs";
|
|
11
|
+
import {DeadMansSwitch} from "../../util/deadmansswitch.mjs";
|
|
12
|
+
|
|
13
|
+
import {PanelStyleSheet} from "./stylesheet/panel.mjs";
|
|
14
|
+
import {instanceSymbol} from "../../constants.mjs";
|
|
15
|
+
|
|
16
|
+
export {Panel};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @type {symbol}
|
|
21
|
+
*/
|
|
22
|
+
const PanelElementSymbol = Symbol("PanelElement");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* local symbol
|
|
26
|
+
* @private
|
|
27
|
+
* @type {symbol}
|
|
28
|
+
*/
|
|
29
|
+
const resizeObserverSymbol = Symbol("resizeObserver");
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @private
|
|
33
|
+
* @type {symbol}
|
|
34
|
+
*/
|
|
35
|
+
const timerCallbackSymbol = Symbol("timerCallback");
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The Panel component is used to display a panel, isn't that cool?
|
|
39
|
+
*
|
|
40
|
+
* <img src="./images/panel.png">
|
|
41
|
+
*
|
|
42
|
+
* You can create this control either by specifying the HTML tag <monster-panel />` directly in the HTML or using
|
|
43
|
+
* Javascript via the `document.createElement('monster-panel');` method.
|
|
44
|
+
*
|
|
45
|
+
* ```html
|
|
46
|
+
* <monster-panel></monster-panel>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Or you can create this CustomControl directly in Javascript:
|
|
50
|
+
*
|
|
51
|
+
* ```js
|
|
52
|
+
* import '@schukai/monster/components/layout/panel.mjs';
|
|
53
|
+
* document.createElement('monster-panel');
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @startuml panel.png
|
|
57
|
+
* skinparam monochrome true
|
|
58
|
+
* skinparam shadowing false
|
|
59
|
+
* HTMLElement <|-- CustomElement
|
|
60
|
+
* CustomElement <|-- CustomControl
|
|
61
|
+
* CustomControl <|-- Panel
|
|
62
|
+
* @enduml
|
|
63
|
+
*
|
|
64
|
+
* @copyright schukai GmbH
|
|
65
|
+
* @memberOf Monster.Components.Layout
|
|
66
|
+
* @summary A simple panel component
|
|
67
|
+
*/
|
|
68
|
+
class Panel extends CustomElement {
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* This method is called by the `instanceof` operator.
|
|
72
|
+
* @returns {symbol}
|
|
73
|
+
*/
|
|
74
|
+
static get [instanceSymbol]() {
|
|
75
|
+
return Symbol.for("@schukai/monster/components/layout/panel");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* To set the options via the html tag the attribute `data-monster-options` must be used.
|
|
80
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
81
|
+
*
|
|
82
|
+
* The individual configuration values can be found in the table.
|
|
83
|
+
*
|
|
84
|
+
* @property {Object} templates Template definitions
|
|
85
|
+
* @property {string} templates.main Main template
|
|
86
|
+
* @property {string} heightAdjustment Height adjustment
|
|
87
|
+
*/
|
|
88
|
+
get defaults() {
|
|
89
|
+
return Object.assign({}, super.defaults, {
|
|
90
|
+
templates: {
|
|
91
|
+
main: getTemplate(),
|
|
92
|
+
},
|
|
93
|
+
heightAdjustment: 4,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
* @returns {Monster.Components.Host.Viewer}
|
|
100
|
+
*/
|
|
101
|
+
[assembleMethodSymbol]() {
|
|
102
|
+
super[assembleMethodSymbol]();
|
|
103
|
+
|
|
104
|
+
initControlReferences.call(this);
|
|
105
|
+
initEventHandler.call(this);
|
|
106
|
+
|
|
107
|
+
calcHeight.call(this);
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* This method is called by the dom and should not be called directly.
|
|
113
|
+
*
|
|
114
|
+
* @return {void}
|
|
115
|
+
*/
|
|
116
|
+
connectedCallback() {
|
|
117
|
+
super.connectedCallback();
|
|
118
|
+
attachResizeObserver.call(this);
|
|
119
|
+
|
|
120
|
+
// disable scrolling in parent node
|
|
121
|
+
if (this.parentNode && this.parentNode instanceof HTMLElement) {
|
|
122
|
+
this.parentNode.style.overflow = "hidden";
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* This method is called by the dom and should not be called directly.
|
|
129
|
+
*
|
|
130
|
+
* @return {void}
|
|
131
|
+
*/
|
|
132
|
+
disconnectedCallback() {
|
|
133
|
+
super.disconnectedCallback();
|
|
134
|
+
disconnectResizeObserver.call(this);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @return {string}
|
|
139
|
+
*/
|
|
140
|
+
static getTag() {
|
|
141
|
+
return "monster-panel";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @return {CSSStyleSheet[]}
|
|
146
|
+
*/
|
|
147
|
+
static getCSSStyleSheet() {
|
|
148
|
+
return [PanelStyleSheet];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
function calcHeight() {
|
|
156
|
+
|
|
157
|
+
this.style.boxSizing = "border-box";
|
|
158
|
+
|
|
159
|
+
const height = calculateMaximumHeight.call(this, this);
|
|
160
|
+
if (height < 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
this.style.height = `${height}px`;
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function calculateMaximumHeight(element) {
|
|
169
|
+
let totalBottomBorder = 0;
|
|
170
|
+
let totalBottomPadding = 0;
|
|
171
|
+
let totalBottomMargin = 0;
|
|
172
|
+
let totalOutlineHeight = 0;
|
|
173
|
+
let totalBoxShadowHeight = 0;
|
|
174
|
+
let currentElement = element;
|
|
175
|
+
|
|
176
|
+
// Get the distance from the top of the element to the top of the viewport
|
|
177
|
+
const distanceFromTop = element.getBoundingClientRect().top;
|
|
178
|
+
|
|
179
|
+
// Loop through the elements up to the body to sum up the bottom borders, padding, and margin
|
|
180
|
+
while (currentElement && currentElement !== document.body) {
|
|
181
|
+
const style = window.getComputedStyle(currentElement);
|
|
182
|
+
|
|
183
|
+
// Box sizing
|
|
184
|
+
const boxSizing = style.boxSizing;
|
|
185
|
+
|
|
186
|
+
// Borders, padding, and margin
|
|
187
|
+
const borderBottomWidth = parseFloat(style.borderBottomWidth);
|
|
188
|
+
const paddingBottom = parseFloat(style.paddingBottom);
|
|
189
|
+
const marginBottom = parseFloat(style.marginBottom);
|
|
190
|
+
|
|
191
|
+
// Outline and box-shadow
|
|
192
|
+
const outlineHeight = parseFloat(style.outlineWidth);
|
|
193
|
+
// This is a simplification; box-shadow is more complex to parse
|
|
194
|
+
const boxShadowVertical = parseFloat(style.boxShadow.split(' ')[3] || 0);
|
|
195
|
+
|
|
196
|
+
// Accumulate values
|
|
197
|
+
totalBottomBorder += isNaN(borderBottomWidth) ? 0 : borderBottomWidth;
|
|
198
|
+
totalBottomPadding += (isNaN(paddingBottom) || boxSizing === 'border-box') ? 0 : paddingBottom;
|
|
199
|
+
totalBottomMargin += isNaN(marginBottom) ? 0 : marginBottom;
|
|
200
|
+
totalOutlineHeight += isNaN(outlineHeight) ? 0 : outlineHeight;
|
|
201
|
+
totalBoxShadowHeight += isNaN(boxShadowVertical) ? 0 : boxShadowVertical;
|
|
202
|
+
|
|
203
|
+
currentElement = currentElement.parentNode || currentElement.host;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Calculate the maximum height by subtracting the distance, borders, padding, margin, outline, and box-shadow from the window's inner height
|
|
207
|
+
const maximumHeight = window.innerHeight - distanceFromTop - totalBottomBorder - totalBottomPadding - totalBottomMargin - totalOutlineHeight - totalBoxShadowHeight;
|
|
208
|
+
return maximumHeight + this.getOption("heightAdjustment");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @private
|
|
214
|
+
*/
|
|
215
|
+
function attachResizeObserver() {
|
|
216
|
+
// against flickering
|
|
217
|
+
this[resizeObserverSymbol] = new ResizeObserver(() => {
|
|
218
|
+
if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
|
|
219
|
+
try {
|
|
220
|
+
this[timerCallbackSymbol].touch();
|
|
221
|
+
return;
|
|
222
|
+
} catch (e) {
|
|
223
|
+
delete this[timerCallbackSymbol];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
|
|
228
|
+
calcHeight.call(this);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
this[resizeObserverSymbol].observe(this.ownerDocument.body);
|
|
233
|
+
this[resizeObserverSymbol].observe(document.scrollingElement);
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function disconnectResizeObserver() {
|
|
238
|
+
if (this[resizeObserverSymbol] instanceof ResizeObserver) {
|
|
239
|
+
this[resizeObserverSymbol].disconnect();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @private
|
|
245
|
+
* @return {Select}
|
|
246
|
+
* @throws {Error} no shadow-root is defined
|
|
247
|
+
*/
|
|
248
|
+
function initControlReferences() {
|
|
249
|
+
if (!this.shadowRoot) {
|
|
250
|
+
throw new Error("no shadow-root is defined");
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
this[PanelElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=control]");
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
function initEventHandler() {
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @private
|
|
267
|
+
* @return {string}
|
|
268
|
+
*/
|
|
269
|
+
function getTemplate() {
|
|
270
|
+
// language=HTML
|
|
271
|
+
return `
|
|
272
|
+
<div data-monster-role="control" part="control">
|
|
273
|
+
<slot></slot>
|
|
274
|
+
</div>`;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
registerCustomElement(Panel);
|