@schukai/monster 3.64.0 → 3.65.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/example/components/form/button.mjs +1 -1
  3. package/example/components/form/field-set.mjs +4 -0
  4. package/example/components/form/select.mjs +1 -1
  5. package/package.json +2 -1
  6. package/source/components/datatable/datatable/header.mjs +228 -221
  7. package/source/components/datatable/style/dataset.pcss +1 -0
  8. package/source/components/datatable/style/datatable.pcss +1 -0
  9. package/source/components/datatable/stylesheet/change-button.mjs +8 -4
  10. package/source/components/datatable/stylesheet/column-bar.mjs +8 -4
  11. package/source/components/datatable/stylesheet/dataset.mjs +9 -5
  12. package/source/components/datatable/stylesheet/datasource.mjs +8 -4
  13. package/source/components/datatable/stylesheet/datatable.mjs +9 -5
  14. package/source/components/datatable/stylesheet/embedded-pagination.mjs +8 -4
  15. package/source/components/datatable/stylesheet/filter-button.mjs +8 -4
  16. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +8 -4
  17. package/source/components/datatable/stylesheet/filter-date-range.mjs +8 -4
  18. package/source/components/datatable/stylesheet/filter-range.mjs +8 -4
  19. package/source/components/datatable/stylesheet/filter.mjs +8 -4
  20. package/source/components/datatable/stylesheet/pagination.mjs +8 -4
  21. package/source/components/datatable/stylesheet/save-button.mjs +8 -4
  22. package/source/components/datatable/stylesheet/select-filter.mjs +8 -4
  23. package/source/components/datatable/stylesheet/status.mjs +8 -4
  24. package/source/components/form/button.mjs +263 -281
  25. package/source/components/form/field-set.mjs +300 -0
  26. package/source/components/form/popper.mjs +13 -480
  27. package/source/components/form/style/field-set.pcss +13 -0
  28. package/source/components/form/stylesheet/action-button.mjs +8 -4
  29. package/source/components/form/stylesheet/api-button.mjs +8 -4
  30. package/source/components/form/stylesheet/button-bar.mjs +9 -5
  31. package/source/components/form/stylesheet/button.mjs +8 -4
  32. package/source/components/form/stylesheet/confirm-button.mjs +9 -5
  33. package/source/components/form/stylesheet/context-error.mjs +8 -4
  34. package/source/components/form/stylesheet/context-help.mjs +8 -4
  35. package/source/components/form/stylesheet/field-set.mjs +31 -0
  36. package/source/components/form/stylesheet/form.mjs +9 -5
  37. package/source/components/form/stylesheet/message-state-button.mjs +8 -4
  38. package/source/components/form/stylesheet/popper-button.mjs +8 -4
  39. package/source/components/form/stylesheet/select.mjs +8 -4
  40. package/source/components/form/stylesheet/state-button.mjs +8 -4
  41. package/source/components/form/stylesheet/toggle-switch.mjs +8 -4
  42. package/source/components/form/stylesheet/tree-select.mjs +8 -4
  43. package/source/components/host/collapse.mjs +14 -516
  44. package/source/components/host/config-manager.mjs +9 -2
  45. package/source/components/host/constants.mjs +9 -4
  46. package/source/components/host/details.mjs +14 -253
  47. package/source/components/host/stylesheet/call-button.mjs +8 -4
  48. package/source/components/host/stylesheet/config-manager.mjs +8 -4
  49. package/source/components/host/stylesheet/host.mjs +9 -5
  50. package/source/components/host/stylesheet/overlay.mjs +9 -5
  51. package/source/components/host/stylesheet/toggle-button.mjs +8 -4
  52. package/source/components/host/stylesheet/viewer.mjs +8 -4
  53. package/source/components/layout/collapse.mjs +542 -0
  54. package/source/components/layout/details.mjs +271 -0
  55. package/source/components/layout/panel.mjs +6 -0
  56. package/source/components/layout/popper.mjs +476 -0
  57. package/source/components/{host → layout}/stylesheet/collapse.mjs +8 -4
  58. package/source/components/{host → layout}/stylesheet/details.mjs +8 -4
  59. package/source/components/layout/stylesheet/panel.mjs +8 -4
  60. package/source/components/{form → layout}/stylesheet/popper.mjs +8 -4
  61. package/source/components/layout/stylesheet/split-panel.mjs +8 -4
  62. package/source/components/layout/stylesheet/tabs.mjs +8 -4
  63. package/source/components/layout/stylesheet/width-toggle.mjs +8 -4
  64. package/source/components/layout/tabs.mjs +3 -3
  65. package/source/components/layout/width-toggle.mjs +3 -3
  66. package/source/components/navigation/style/table-of-content.pcss +84 -0
  67. package/source/components/navigation/stylesheet/table-of-content.mjs +31 -0
  68. package/source/components/navigation/table-of-content.mjs +418 -0
  69. package/source/components/notify/stylesheet/message.mjs +8 -4
  70. package/source/components/notify/stylesheet/notify.mjs +8 -4
  71. package/source/components/state/stylesheet/log.mjs +8 -4
  72. package/source/components/state/stylesheet/state.mjs +9 -5
  73. package/source/components/style/link.pcss +0 -1
  74. package/source/components/style/mixin/typography.pcss +7 -7
  75. package/source/components/style/typography.pcss +1 -1
  76. package/source/components/stylesheet/badge.mjs +8 -4
  77. package/source/components/stylesheet/border.mjs +8 -4
  78. package/source/components/stylesheet/button.mjs +8 -4
  79. package/source/components/stylesheet/card.mjs +8 -4
  80. package/source/components/stylesheet/color.mjs +8 -4
  81. package/source/components/stylesheet/common.mjs +8 -4
  82. package/source/components/stylesheet/control.mjs +8 -4
  83. package/source/components/stylesheet/data-grid.mjs +8 -4
  84. package/source/components/stylesheet/display.mjs +8 -4
  85. package/source/components/stylesheet/floating-ui.mjs +8 -4
  86. package/source/components/stylesheet/form.mjs +8 -4
  87. package/source/components/stylesheet/host.mjs +8 -4
  88. package/source/components/stylesheet/icons.mjs +8 -4
  89. package/source/components/stylesheet/link.mjs +8 -4
  90. package/source/components/stylesheet/mixin/badge.mjs +31 -0
  91. package/source/components/stylesheet/mixin/button.mjs +31 -0
  92. package/source/components/stylesheet/mixin/form.mjs +31 -0
  93. package/source/components/stylesheet/mixin/hover.mjs +31 -0
  94. package/source/components/stylesheet/mixin/icon.mjs +31 -0
  95. package/source/components/stylesheet/mixin/media.mjs +31 -0
  96. package/source/components/stylesheet/mixin/property.mjs +31 -0
  97. package/source/components/stylesheet/mixin/skeleton.mjs +31 -0
  98. package/source/components/stylesheet/mixin/spinner.mjs +31 -0
  99. package/source/components/stylesheet/mixin/typography.mjs +31 -0
  100. package/source/components/stylesheet/normalize.mjs +8 -4
  101. package/source/components/stylesheet/popper.mjs +8 -4
  102. package/source/components/stylesheet/property.mjs +8 -4
  103. package/source/components/stylesheet/ripple.mjs +8 -4
  104. package/source/components/stylesheet/skeleton.mjs +8 -4
  105. package/source/components/stylesheet/space.mjs +8 -4
  106. package/source/components/stylesheet/spinner.mjs +8 -4
  107. package/source/components/stylesheet/table.mjs +8 -4
  108. package/source/components/stylesheet/theme.mjs +8 -4
  109. package/source/components/stylesheet/typography.mjs +9 -5
  110. package/source/components/tree-menu/stylesheet/tree-menu.mjs +8 -4
  111. package/source/dom/ready.mjs +10 -4
  112. package/source/monster.mjs +17 -80
  113. package/source/types/proxyobserver.mjs +4 -2
  114. package/source/types/version.mjs +1 -1
  115. package/test/cases/monster.mjs +1 -1
  116. package/test/web/tests.js +4 -4
  117. package/source/components/form/form-field.mjs +0 -341
  118. package/source/components/form/style/form-field.pcss +0 -4
  119. package/source/components/form/stylesheet/form-field.mjs +0 -27
  120. /package/source/components/{host → layout}/style/collapse.pcss +0 -0
  121. /package/source/components/{host → layout}/style/details.pcss +0 -0
  122. /package/source/components/{form → layout}/style/popper.pcss +0 -0
@@ -1,29 +1,35 @@
1
1
  /**
2
- * Copyright schukai GmbH and contributors 2023. All Rights Reserved.
2
+ * Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
3
3
  * Node module: @schukai/monster
4
- * This file is licensed under the AGPLv3 License.
5
- * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
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.
6
11
  */
7
- import { instanceSymbol } from "../../constants.mjs";
8
- import { addAttributeToken } from "../../dom/attributes.mjs";
12
+
13
+ import {instanceSymbol} from "../../constants.mjs";
14
+ import {addAttributeToken} from "../../dom/attributes.mjs";
9
15
  import {
10
- ATTRIBUTE_ERRORMESSAGE,
11
- ATTRIBUTE_ROLE,
16
+ ATTRIBUTE_ERRORMESSAGE,
17
+ ATTRIBUTE_ROLE,
12
18
  } from "../../dom/constants.mjs";
13
- import { CustomControl } from "../../dom/customcontrol.mjs";
19
+ import {CustomControl} from "../../dom/customcontrol.mjs";
14
20
  import {
15
- assembleMethodSymbol,
16
- attributeObserverSymbol,
17
- registerCustomElement,
21
+ assembleMethodSymbol,
22
+ attributeObserverSymbol,
23
+ registerCustomElement,
18
24
  } from "../../dom/customelement.mjs";
19
- import { findTargetElementFromEvent } from "../../dom/events.mjs";
20
- import { isFunction } from "../../types/is.mjs";
21
- import { ATTRIBUTE_BUTTON_CLASS } from "./constants.mjs";
22
- import { ButtonStyleSheet } from "./stylesheet/button.mjs";
23
- import { RippleStyleSheet } from "../stylesheet/ripple.mjs";
24
- import { fireCustomEvent } from "../../dom/events.mjs";
25
+ import {findTargetElementFromEvent} from "../../dom/events.mjs";
26
+ import {isFunction} from "../../types/is.mjs";
27
+ import {ATTRIBUTE_BUTTON_CLASS} from "./constants.mjs";
28
+ import {ButtonStyleSheet} from "./stylesheet/button.mjs";
29
+ import {RippleStyleSheet} from "../stylesheet/ripple.mjs";
30
+ import {fireCustomEvent} from "../../dom/events.mjs";
25
31
 
26
- export { Button };
32
+ export {Button};
27
33
 
28
34
  /**
29
35
  * @private
@@ -32,281 +38,257 @@ export { Button };
32
38
  export const buttonElementSymbol = Symbol("buttonElement");
33
39
 
34
40
  /**
35
- * This CustomControl creates a button element with a variety of options.
36
- *
37
- * <img src="./images/button.png">
38
- *
39
- * You can create this control either by specifying the HTML tag <monster-button />` directly in the HTML or using
40
- * Javascript via the `document.createElement('monster-button');` method.
41
- *
42
- * ```html
43
- * <monster-button></monster-button>
44
- * ```
45
- *
46
- * Or you can create this CustomControl directly in Javascript:
47
- *
48
- * ```js
49
- * import {Button} from '@schukai/monster/components/form/button.mjs';
50
- * document.createElement('monster-button');
51
- * ```
52
- *
53
- * The `data-monster-button-class` attribute can be used to change the CSS class of the button.
54
- *
55
- * @externalExample ../../../example/components/form/button.mjs
56
- * @startuml button.png
57
- * skinparam monochrome true
58
- * skinparam shadowing false
59
- * HTMLElement <|-- CustomElement
60
- * CustomElement <|-- CustomControl
61
- * CustomControl <|-- Button
62
- * @enduml
63
- *
41
+ * A button
42
+ *
43
+ * @fragments /fragments/components/form/button/
44
+ *
45
+ * @example /examples/components/form/button-simple
46
+ * @example /examples/components/form/button-with-click-event
47
+ *
64
48
  * @since 1.5.0
65
49
  * @copyright schukai GmbH
66
- * @memberOf Monster.Components.Form
67
- * @summary A simple button
50
+ * @summary A beautiful button that can make your life easier and also looks good.
51
+ * @fires monster-button-clicked this event is triggered when the button is clicked. It contains the field {button} with the button instance.
52
+ *
68
53
  */
69
54
  class Button extends CustomControl {
70
- /**
71
- * This method is called by the `instanceof` operator.
72
- * @returns {symbol}
73
- * @since 2.1.0
74
- */
75
- static get [instanceSymbol]() {
76
- return Symbol.for("@schukai/monster/components/form/button@@instance");
77
- }
78
-
79
- /**
80
- *
81
- * @return {Monster.Components.Form.Button}
82
- */
83
- [assembleMethodSymbol]() {
84
- super[assembleMethodSymbol]();
85
- initControlReferences.call(this);
86
- initEventHandler.call(this);
87
- return this;
88
- }
89
-
90
- /**
91
- * The Button.click() method simulates a click on the internal button element.
92
- *
93
- * @since 3.27.0
94
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
95
- */
96
- click() {
97
- if (this.getOption("disabled") === true) {
98
- return;
99
- }
100
-
101
- if (
102
- this[buttonElementSymbol] &&
103
- isFunction(this[buttonElementSymbol].click)
104
- ) {
105
- this[buttonElementSymbol].click();
106
- }
107
- }
108
-
109
- /**
110
- * The Button.focus() method sets focus on the internal button element.
111
- *
112
- * @since 3.27.0
113
- * @param {Object} options
114
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
115
- */
116
- focus(options) {
117
- if (this.getOption("disabled") === true) {
118
- return;
119
- }
120
-
121
- if (
122
- this[buttonElementSymbol] &&
123
- isFunction(this[buttonElementSymbol].focus)
124
- ) {
125
- this[buttonElementSymbol].focus(options);
126
- }
127
- }
128
-
129
- /**
130
- * The Button.blur() method removes focus from the internal button element.
131
- */
132
- blur() {
133
- if (
134
- this[buttonElementSymbol] &&
135
- isFunction(this[buttonElementSymbol].blur)
136
- ) {
137
- this[buttonElementSymbol].blur();
138
- }
139
- }
140
-
141
- /**
142
- * This method determines which attributes are to be monitored by `attributeChangedCallback()`.
143
- *
144
- * @return {string[]}
145
- */
146
- static get observedAttributes() {
147
- const attributes = super.observedAttributes;
148
- attributes.push(ATTRIBUTE_BUTTON_CLASS);
149
- return attributes;
150
- }
151
-
152
- /**
153
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
154
- * @return {boolean}
155
- */
156
- static get formAssociated() {
157
- return true;
158
- }
159
-
160
- /**
161
- * The current selection of the Select
162
- *
163
- * ```
164
- * e = document.querySelector('monster-select');
165
- * console.log(e.value)
166
- * // ↦ 1
167
- * // ↦ ['1','2']
168
- * ```
169
- *
170
- * @property {string|array}
171
- */
172
- get value() {
173
- return this.getOption("value");
174
- }
175
-
176
- /**
177
- * Set selection
178
- *
179
- * ```
180
- * e = document.querySelector('monster-select');
181
- * e.value=1
182
- * ```
183
- *
184
- * @property {string|array} value
185
- * @since 1.2.0
186
- * @throws {Error} unsupported type
187
- */
188
- set value(value) {
189
- this.setOption("value", value);
190
- try {
191
- this?.setFormValue(this.value);
192
- } catch (e) {
193
- addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
194
- }
195
- }
196
-
197
- /**
198
- * To set the options via the html tag the attribute `data-monster-options` must be used.
199
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
200
- *
201
- * The individual configuration values can be found in the table.
202
- *
203
- * @property {Object} templates Template definitions
204
- * @property {string} templates.main Main template
205
- * @property {Object} labels Labels
206
- * @property {string} labels.button=<slot></slot> Button label
207
- * @property {Object} actions Callbacks
208
- * @property {string} actions.click="throw Error" Callback when clicked
209
- * @property {Object} classes CSS classes
210
- * @property {string} classes.button="monster-button-primary" CSS class for the button
211
- * @property {boolean} disabled=false Disabled state
212
- * @property {Object} effects Effects
213
- * @property {boolean} effects.ripple=true Ripple effect
214
- */
215
- get defaults() {
216
- return Object.assign({}, super.defaults, {
217
- templates: {
218
- main: getTemplate(),
219
- },
220
- labels: {
221
- button: "<slot></slot>",
222
- },
223
- classes: {
224
- button: "monster-button-primary",
225
- },
226
- disabled: false,
227
- actions: {
228
- click: () => {
229
- throw new Error("the click action is not defined");
230
- },
231
- },
232
- effects: {
233
- ripple: true,
234
- },
235
- value: null,
236
- });
237
- }
238
-
239
- /**
240
- *
241
- * @return {string}
242
- */
243
- static getTag() {
244
- return "monster-button";
245
- }
246
-
247
- /**
248
- *
249
- * @return {Array<CSSStyleSheet>}
250
- */
251
- static getCSSStyleSheet() {
252
- return [RippleStyleSheet, ButtonStyleSheet];
253
- }
55
+ /**
56
+ * This method is called by the <code>instanceof</code> operator.
57
+ * @return {symbol}
58
+ * @since 2.1.0
59
+ */
60
+ static get [instanceSymbol]() {
61
+ return Symbol.for("@schukai/monster/components/form/button@@instance");
62
+ }
63
+
64
+ /**
65
+ *
66
+ * @return {Button}
67
+ */
68
+ [assembleMethodSymbol]() {
69
+ super[assembleMethodSymbol]();
70
+ initControlReferences.call(this);
71
+ initEventHandler.call(this);
72
+ return this;
73
+ }
74
+
75
+ /**
76
+ * The <code>Button.click()</code> method simulates a click on the internal button element.
77
+ *
78
+ * @since 3.27.0
79
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click}
80
+ */
81
+ click() {
82
+ if (this.getOption("disabled") === true) {
83
+ return;
84
+ }
85
+
86
+ if (
87
+ this[buttonElementSymbol] &&
88
+ isFunction(this[buttonElementSymbol].click)
89
+ ) {
90
+ this[buttonElementSymbol].click();
91
+ }
92
+ }
93
+
94
+ /**
95
+ * The Button.focus() method sets focus on the internal button element.
96
+ *
97
+ * @since 3.27.0
98
+ * @param {Object} options
99
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus}
100
+ */
101
+ focus(options) {
102
+ if (this.getOption("disabled") === true) {
103
+ return;
104
+ }
105
+
106
+ if (
107
+ this[buttonElementSymbol] &&
108
+ isFunction(this[buttonElementSymbol].focus)
109
+ ) {
110
+ this[buttonElementSymbol].focus(options);
111
+ }
112
+ }
113
+
114
+ /**
115
+ * The Button.blur() method removes focus from the internal button element.
116
+ */
117
+ blur() {
118
+ if (
119
+ this[buttonElementSymbol] &&
120
+ isFunction(this[buttonElementSymbol].blur)
121
+ ) {
122
+ this[buttonElementSymbol].blur();
123
+ }
124
+ }
125
+
126
+ /**
127
+ * This method determines which attributes are to be monitored by `attributeChangedCallback()`.
128
+ *
129
+ * @return {string[]}
130
+ */
131
+ static get observedAttributes() {
132
+ const attributes = super.observedAttributes;
133
+ attributes.push(ATTRIBUTE_BUTTON_CLASS);
134
+ return attributes;
135
+ }
136
+
137
+ /**
138
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
139
+ * @return {boolean}
140
+ */
141
+ static get formAssociated() {
142
+ return true;
143
+ }
144
+
145
+ /**
146
+ * The current value of the button.
147
+ *
148
+ * ```javascript
149
+ * e = document.querySelector('monster-button');
150
+ * console.log(e.value)
151
+ * ```
152
+ *
153
+ * @return {string} The value of the button
154
+ */
155
+ get value() {
156
+ return this.getOption("value");
157
+ }
158
+
159
+ /**
160
+ * Set the value of the button.
161
+ *
162
+ * ```javascript
163
+ * e = document.querySelector('monster-button');
164
+ * e.value=1
165
+ * ```
166
+ *
167
+ * @param {string} value
168
+ * @return {void}
169
+ * @throws {Error} unsupported type
170
+ */
171
+ set value(value) {
172
+ this.setOption("value", value);
173
+ try {
174
+ this?.setFormValue(this.value);
175
+ } catch (e) {
176
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
177
+ }
178
+ }
179
+
180
+ /**
181
+ * To set the options via the html tag the attribute `data-monster-options` must be used.
182
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
183
+ *
184
+ * The individual configuration values can be found in the table.
185
+ *
186
+ * @property {Object} templates Template definitions
187
+ * @property {string} templates.main Main template
188
+ * @property {Object} labels Labels
189
+ * @property {string} labels.button="<slot></slot>" Button label
190
+ * @property {Object} actions Callbacks
191
+ * @property {string} actions.click="throw Error" Callback when clicked
192
+ * @property {Object} classes CSS classes
193
+ * @property {string} classes.button="monster-button-primary" CSS class for the button
194
+ * @property {boolean} disabled=false Disabled state
195
+ * @property {Object} effects Effects
196
+ * @property {boolean} effects.ripple=true Ripple effect
197
+ */
198
+ get defaults() {
199
+ return Object.assign({}, super.defaults, {
200
+ templates: {
201
+ main: getTemplate(),
202
+ },
203
+ labels: {
204
+ button: "<slot></slot>",
205
+ },
206
+ classes: {
207
+ button: "monster-button-primary",
208
+ },
209
+ disabled: false,
210
+ actions: {
211
+ click: () => {
212
+ throw new Error("the click action is not defined");
213
+ },
214
+ },
215
+ effects: {
216
+ ripple: true,
217
+ },
218
+ value: null,
219
+ });
220
+ }
221
+
222
+ /**
223
+ *
224
+ * @return {string}
225
+ */
226
+ static getTag() {
227
+ return "monster-button";
228
+ }
229
+
230
+ /**
231
+ *
232
+ * @return {CSSStyleSheet[]}
233
+ */
234
+ static getCSSStyleSheet() {
235
+ return [RippleStyleSheet, ButtonStyleSheet];
236
+ }
254
237
  }
255
238
 
256
239
  /**
257
240
  * @private
258
241
  * @return {initEventHandler}
259
- * @fires Monster.Components.Form.event:monster-button-clicked
260
242
  */
261
243
  function initEventHandler() {
262
- const self = this;
263
- const button = this[buttonElementSymbol];
244
+ const self = this;
245
+ const button = this[buttonElementSymbol];
264
246
 
265
- const type = "click";
247
+ const type = "click";
266
248
 
267
- button.addEventListener(type, function (event) {
268
- const callback = self.getOption("actions.click");
249
+ button.addEventListener(type, function (event) {
250
+ const callback = self.getOption("actions.click");
269
251
 
270
- fireCustomEvent(self, "monster-button-clicked", {
271
- button: self,
272
- });
252
+ fireCustomEvent(self, "monster-button-clicked", {
253
+ button: self,
254
+ });
273
255
 
274
- if (!isFunction(callback)) {
275
- return;
276
- }
256
+ if (!isFunction(callback)) {
257
+ return;
258
+ }
277
259
 
278
- const element = findTargetElementFromEvent(
279
- event,
280
- ATTRIBUTE_ROLE,
281
- "control",
282
- );
260
+ const element = findTargetElementFromEvent(
261
+ event,
262
+ ATTRIBUTE_ROLE,
263
+ "control",
264
+ );
283
265
 
284
- if (!(element instanceof Node && self.hasNode(element))) {
285
- return;
286
- }
266
+ if (!(element instanceof Node && self.hasNode(element))) {
267
+ return;
268
+ }
287
269
 
288
- callback.call(self, event);
289
- });
270
+ callback.call(self, event);
271
+ });
290
272
 
291
- if (self.getOption("effects.ripple")) {
292
- button.addEventListener("click", createRipple.bind(self));
293
- }
273
+ if (self.getOption("effects.ripple")) {
274
+ button.addEventListener("click", createRipple.bind(self));
275
+ }
294
276
 
295
- // data-monster-options
296
- self[attributeObserverSymbol][ATTRIBUTE_BUTTON_CLASS] = function (value) {
297
- self.setOption("classes.button", value);
298
- };
277
+ // data-monster-options
278
+ self[attributeObserverSymbol][ATTRIBUTE_BUTTON_CLASS] = function (value) {
279
+ self.setOption("classes.button", value);
280
+ };
299
281
 
300
- return this;
282
+ return this;
301
283
  }
302
284
 
303
285
  /**
304
286
  * @private
305
287
  */
306
288
  function initControlReferences() {
307
- this[buttonElementSymbol] = this.shadowRoot.querySelector(
308
- `[${ATTRIBUTE_ROLE}=button]`,
309
- );
289
+ this[buttonElementSymbol] = this.shadowRoot.querySelector(
290
+ `[${ATTRIBUTE_ROLE}=button]`,
291
+ );
310
292
  }
311
293
 
312
294
  /**
@@ -314,8 +296,8 @@ function initControlReferences() {
314
296
  * @return {string}
315
297
  */
316
298
  function getTemplate() {
317
- // language=HTML
318
- return `
299
+ // language=HTML
300
+ return `
319
301
  <div data-monster-role="control" part="control">
320
302
  <button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button"
321
303
  data-monster-role="button"
@@ -325,23 +307,23 @@ function getTemplate() {
325
307
  }
326
308
 
327
309
  function createRipple(event) {
328
- const button = this[buttonElementSymbol];
310
+ const button = this[buttonElementSymbol];
329
311
 
330
- const circle = document.createElement("span");
331
- const diameter = Math.max(button.clientWidth, button.clientHeight);
332
- const radius = diameter / 2;
312
+ const circle = document.createElement("span");
313
+ const diameter = Math.max(button.clientWidth, button.clientHeight);
314
+ const radius = diameter / 2;
333
315
 
334
- circle.style.width = circle.style.height = `${diameter}px`;
335
- circle.style.left = `${event.clientX - button.offsetLeft - radius}px`;
336
- circle.style.top = `${event.clientY - button.offsetTop - radius}px`;
337
- circle.classList.add("monster-fx-ripple");
316
+ circle.style.width = circle.style.height = `${diameter}px`;
317
+ circle.style.left = `${event.clientX - button.offsetLeft - radius}px`;
318
+ circle.style.top = `${event.clientY - button.offsetTop - radius}px`;
319
+ circle.classList.add("monster-fx-ripple");
338
320
 
339
- const ripples = button.getElementsByClassName("monster-fx-ripple");
340
- for (const ripple of ripples) {
341
- ripple.remove();
342
- }
321
+ const ripples = button.getElementsByClassName("monster-fx-ripple");
322
+ for (const ripple of ripples) {
323
+ ripple.remove();
324
+ }
343
325
 
344
- button.appendChild(circle);
326
+ button.appendChild(circle);
345
327
  }
346
328
 
347
329
  registerCustomElement(Button);