@schukai/monster 3.76.0 → 3.77.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/change-button.mjs +1 -1
  4. package/source/components/datatable/columnbar.mjs +1 -1
  5. package/source/components/datatable/dataset.mjs +1 -1
  6. package/source/components/datatable/datasource/dom.mjs +1 -1
  7. package/source/components/datatable/datasource/rest.mjs +1 -1
  8. package/source/components/datatable/datasource.mjs +1 -1
  9. package/source/components/datatable/datatable.mjs +1 -1
  10. package/source/components/datatable/filter/date-range.mjs +1 -1
  11. package/source/components/datatable/filter/input.mjs +1 -1
  12. package/source/components/datatable/filter/range.mjs +1 -1
  13. package/source/components/datatable/filter/select.mjs +1 -1
  14. package/source/components/datatable/filter-button.mjs +1 -1
  15. package/source/components/datatable/filter.mjs +1 -1
  16. package/source/components/datatable/pagination.mjs +1 -1
  17. package/source/components/datatable/save-button.mjs +1 -1
  18. package/source/components/datatable/status.mjs +1 -1
  19. package/source/components/form/action-button.mjs +1 -1
  20. package/source/components/form/api-button.mjs +1 -1
  21. package/source/components/form/button-bar.mjs +1 -1
  22. package/source/components/form/button.mjs +1 -1
  23. package/source/components/form/confirm-button.mjs +1 -1
  24. package/source/components/form/context-error.mjs +2 -2
  25. package/source/components/form/context-help.mjs +1 -1
  26. package/source/components/form/field-set.mjs +31 -44
  27. package/source/components/form/message-state-button.mjs +1 -1
  28. package/source/components/form/popper-button.mjs +1 -1
  29. package/source/components/form/reload.mjs +1 -1
  30. package/source/components/form/select.mjs +1 -1
  31. package/source/components/form/shadow-reload.mjs +1 -1
  32. package/source/components/form/state-button.mjs +1 -1
  33. package/source/components/form/style/field-set.pcss +164 -70
  34. package/source/components/form/stylesheet/field-set.mjs +7 -14
  35. package/source/components/form/template.mjs +1 -1
  36. package/source/components/form/toggle-switch.mjs +321 -340
  37. package/source/components/form/tree-select.mjs +1 -1
  38. package/source/components/host/call-button.mjs +1 -1
  39. package/source/components/host/collapse.mjs +1 -1
  40. package/source/components/host/config-manager.mjs +1 -1
  41. package/source/components/host/host.mjs +1 -1
  42. package/source/components/host/overlay.mjs +1 -1
  43. package/source/components/host/toggle-button.mjs +1 -1
  44. package/source/components/host/viewer.mjs +1 -1
  45. package/source/components/layout/collapse.mjs +21 -21
  46. package/source/components/layout/details.mjs +11 -11
  47. package/source/components/layout/iframe.mjs +1 -1
  48. package/source/components/layout/panel.mjs +1 -1
  49. package/source/components/layout/popper.mjs +1 -1
  50. package/source/components/layout/slider.mjs +1 -1
  51. package/source/components/layout/split-panel.mjs +1 -1
  52. package/source/components/layout/tabs.mjs +1 -1
  53. package/source/components/layout/width-toggle.mjs +17 -9
  54. package/source/components/navigation/table-of-content.mjs +1 -1
  55. package/source/components/state/log.mjs +167 -153
  56. package/source/components/state/state.mjs +9 -33
  57. package/source/components/stylesheet/form.mjs +6 -13
@@ -12,19 +12,19 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import { instanceSymbol } from "../../constants.mjs";
15
+ import {instanceSymbol} from "../../constants.mjs";
16
16
  import {
17
- assembleMethodSymbol,
18
- CustomElement,
19
- getSlottedElements,
20
- registerCustomElement,
17
+ assembleMethodSymbol,
18
+ CustomElement,
19
+ getSlottedElements,
20
+ registerCustomElement,
21
21
  } from "../../dom/customelement.mjs";
22
- import { LogStyleSheet } from "./stylesheet/log.mjs";
23
- import { Entry } from "./log/entry.mjs";
24
- import { validateInstance } from "../../types/validate.mjs";
22
+ import {LogStyleSheet} from "./stylesheet/log.mjs";
23
+ import {Entry} from "./log/entry.mjs";
24
+ import {validateInstance} from "../../types/validate.mjs";
25
25
  import "./state.mjs";
26
26
 
27
- export { Log };
27
+ export {Log};
28
28
 
29
29
  /**
30
30
  * @private
@@ -71,118 +71,138 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
71
71
  * @memberOf Monster.Components.State
72
72
  * @summary Log is a control to show a log message.
73
73
  */
74
+
75
+
76
+ /**
77
+ * A Log component
78
+ *
79
+ * @fragments /fragments/components/layout/collapse/
80
+ *
81
+ * @example /examples/components/layout/collapse-simple
82
+ *
83
+ * @since 3.74.0
84
+ * @copyright schukai GmbH
85
+ * @summary A Log component to show a log message.
86
+ */
74
87
  class Log extends CustomElement {
75
- /**
76
- *
77
- * @return {Monster.Components.State.State}
78
- */
79
- [assembleMethodSymbol]() {
80
- super[assembleMethodSymbol]();
81
-
82
- initControlReferences.call(this);
83
- initEventHandler.call(this);
84
- }
85
-
86
- /**
87
- * This method is called by the `instanceof` operator.
88
- * @returns {symbol}
89
- */
90
- static get [instanceSymbol]() {
91
- return Symbol.for("@schukai/component-state/log");
92
- }
93
-
94
- /**
95
- * To set the options via the html tag the attribute `data-monster-options` must be used.
96
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
97
- *
98
- * The individual configuration values can be found in the table.
99
- *
100
- * @property {Object} templates Template definitions
101
- * @property {string} templates.main Main template
102
- * @property {Object} labels Labels
103
- * @property {string} labels.nothingToReport Label for empty state
104
- */
105
- get defaults() {
106
- return Object.assign({}, super.defaults, {
107
- templates: {
108
- main: getTemplate(),
109
- },
110
-
111
- labels: {
112
- nothingToReport: "There is nothing to report yet.",
113
- },
114
-
115
- entries: [],
116
- });
117
- }
118
-
119
- connectedCallback() {
120
- super.connectedCallback();
121
-
122
- const slottedElements = getSlottedElements.call(this);
123
- if (slottedElements.size > 0) {
124
- this[emptyStateElementSymbol].style.display = "none";
125
- }
126
- }
127
-
128
- /**
129
- * Clear the log
130
- *
131
- * @return {Log}
132
- */
133
- clear() {
134
- this[logElementSymbol].innerHTML = "";
135
- this[emptyStateElementSymbol].style.display = "block";
136
- return this;
137
- }
138
-
139
- addEntry(entry) {
140
- validateInstance(entry, Entry);
141
-
142
- const entries = this.getOption("entries");
143
- entries.push(entry);
144
-
145
- /** this field is not used, but triggers a change event */
146
- this.setOption("length", entries.length - 1);
147
-
148
- return this;
149
- }
150
-
151
- /**
152
- * Add a log message
153
- *
154
- * @param {string} message
155
- * @return {Log}
156
- */
157
- addMessage(message, date) {
158
- if (!date) {
159
- date = new Date();
160
- }
161
-
162
- this.addEntry(
163
- new Entry({
164
- message: message,
165
- date: date,
166
- }),
167
- );
168
-
169
- return this;
170
- }
171
-
172
- /**
173
- *
174
- * @return {string}
175
- */
176
- static getTag() {
177
- return "monster-log";
178
- }
179
-
180
- /**
181
- * @return {CSSStyleSheet[]}
182
- */
183
- static getCSSStyleSheet() {
184
- return [LogStyleSheet];
185
- }
88
+ /**
89
+ * @return {void}
90
+ */
91
+ [assembleMethodSymbol]() {
92
+ super[assembleMethodSymbol]();
93
+
94
+ initControlReferences.call(this);
95
+ initEventHandler.call(this);
96
+ }
97
+
98
+ /**
99
+ * This method is called by the `instanceof` operator.
100
+ * @returns {symbol}
101
+ */
102
+ static get [instanceSymbol]() {
103
+ return Symbol.for("@schukai/monster/components/state/log@@instance");
104
+ }
105
+
106
+ /**
107
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
108
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
109
+ *
110
+ * The individual configuration values can be found in the table.
111
+ *
112
+ * @property {Object} templates Template definitions
113
+ * @property {string} templates.main Main template
114
+ * @property {Object} labels Labels
115
+ * @property {string} labels.nothingToReport Label for empty state
116
+ */
117
+ get defaults() {
118
+ return Object.assign({}, super.defaults, {
119
+ templates: {
120
+ main: getTemplate(),
121
+ },
122
+
123
+ labels: {
124
+ nothingToReport: "There is nothing to report yet.",
125
+ },
126
+
127
+ entries: [],
128
+ });
129
+ }
130
+
131
+ /**
132
+ * @return {void}
133
+ */
134
+ connectedCallback() {
135
+ super.connectedCallback();
136
+
137
+ const slottedElements = getSlottedElements.call(this);
138
+ if (slottedElements.size > 0) {
139
+ this[emptyStateElementSymbol].style.display = "none";
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Clear the log
145
+ *
146
+ * @return {Log}
147
+ */
148
+ clear() {
149
+ this[logElementSymbol].innerHTML = "";
150
+ this[emptyStateElementSymbol].style.display = "block";
151
+ return this;
152
+ }
153
+
154
+ /**
155
+ * Add an entry to the log
156
+ * @param entry
157
+ * @returns {Log}
158
+ */
159
+ addEntry(entry) {
160
+ validateInstance(entry, Entry);
161
+
162
+ const entries = this.getOption("entries");
163
+ entries.push(entry);
164
+
165
+ /** this field is not used, but triggers a change event */
166
+ this.setOption("length", entries.length - 1);
167
+
168
+ return this;
169
+ }
170
+
171
+ /**
172
+ * Add a log message
173
+ * @param message
174
+ * @param date
175
+ * @returns {Log}
176
+ */
177
+ addMessage(message, date) {
178
+ if (!date) {
179
+ date = new Date();
180
+ }
181
+
182
+ this.addEntry(
183
+ new Entry({
184
+ message: message,
185
+ date: date,
186
+ }),
187
+ );
188
+
189
+ return this;
190
+ }
191
+
192
+ /**
193
+ *
194
+ * @return {string}
195
+ */
196
+ static getTag() {
197
+ return "monster-log";
198
+ }
199
+
200
+ /**
201
+ * @return {CSSStyleSheet[]}
202
+ */
203
+ static getCSSStyleSheet() {
204
+ return [LogStyleSheet];
205
+ }
186
206
  }
187
207
 
188
208
  /**
@@ -191,43 +211,37 @@ class Log extends CustomElement {
191
211
  * @throws {Error} no shadow-root is defined
192
212
  */
193
213
  function initControlReferences() {
194
- if (!this.shadowRoot) {
195
- throw new Error("no shadow-root is defined");
196
- }
197
-
198
- this[logElementSymbol] = this.shadowRoot.querySelector(
199
- "[data-monster-role=control]",
200
- );
201
- this[emptyStateElementSymbol] = this.shadowRoot.querySelector(
202
- "[data-monster-role=empty-state]",
203
- );
214
+ if (!this.shadowRoot) {
215
+ throw new Error("no shadow-root is defined");
216
+ }
217
+
218
+ this[logElementSymbol] = this.shadowRoot.querySelector(
219
+ "[data-monster-role=control]",
220
+ );
221
+ this[emptyStateElementSymbol] = this.shadowRoot.querySelector(
222
+ "[data-monster-role=empty-state]",
223
+ );
204
224
  }
205
225
 
206
226
  /**
207
227
  * @private
208
228
  */
209
229
  function initEventHandler() {
210
- if (!this.shadowRoot) {
211
- throw new Error("no shadow-root is defined");
212
- }
213
-
214
- this.shadowRoot.addEventListener("slotchange", (event) => {
215
- const slottedElements = getSlottedElements.call(this);
216
-
217
- if (slottedElements.size > 0) {
218
- this[emptyStateElementSymbol].style.display = "none";
219
- } else {
220
- this[emptyStateElementSymbol].style.display = "block";
221
- }
222
- });
223
-
224
- // self[buttonEventHandlerSymbol] = (event) => {
225
- // self.toggle();
226
- // }
227
- //
228
- // self[buttonElementSymbol].addEventListener('click', self[buttonEventHandlerSymbol]);
229
-
230
- return this;
230
+ if (!this.shadowRoot) {
231
+ throw new Error("no shadow-root is defined");
232
+ }
233
+
234
+ this.shadowRoot.addEventListener("slotchange", (event) => {
235
+ const slottedElements = getSlottedElements.call(this);
236
+
237
+ if (slottedElements.size > 0) {
238
+ this[emptyStateElementSymbol].style.display = "none";
239
+ } else {
240
+ this[emptyStateElementSymbol].style.display = "block";
241
+ }
242
+ });
243
+
244
+ return this;
231
245
  }
232
246
 
233
247
  /**
@@ -235,8 +249,8 @@ function initEventHandler() {
235
249
  * @return {string}
236
250
  */
237
251
  function getTemplate() {
238
- // language=HTML
239
- return `
252
+ // language=HTML
253
+ return `
240
254
  <template id="entry">
241
255
  <li data-monster-role="entry">
242
256
  <span></span>
@@ -29,44 +29,20 @@ export { State };
29
29
  export const stateElementSymbol = Symbol("state");
30
30
 
31
31
  /**
32
- * States tell users that there’s a state. that s it!
32
+ * A state component
33
33
  *
34
- * <img src="./images/state.png">
34
+ * @fragments /fragments/components/state/state/
35
35
  *
36
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
37
- *
38
- * You can create this control either by specifying the HTML tag <monster-state />` directly in the HTML or using
39
- * Javascript via the `document.createElement('monster-state');` method.
40
- *
41
- * ```html
42
- * <monster-state></monster-state>
43
- * ```
44
- *
45
- * Or you can create this CustomControl directly in Javascript:
46
- *
47
- * ```js
48
- * import {State} from '@schukai/component-state/source/state.js';
49
- * document.createElement('monster-state');
50
- * ```
51
- *
52
- * @externalExample ../../../example/components/state/state.mjs
53
- * @startuml state.png
54
- * skinparam monochrome true
55
- * skinparam shadowing false
56
- * HTMLElement <|-- CustomElement
57
- * CustomElement <|-- CustomControl
58
- * CustomControl <|-- State
59
- * @enduml
36
+ * @example /examples/components/state/state-simple
60
37
  *
61
38
  * @since 1.5.0
62
39
  * @copyright schukai GmbH
63
- * @memberOf Monster.Components.State
64
- * @summary States tell users that there’s a state. that s it!
65
- */
40
+ * @summary States tell users that there’s a state. That's it!
41
+ * @summary The state control is used in the log control, among other things.
42
+ **/
66
43
  class State extends CustomControl {
67
44
  /**
68
- *
69
- * @return {Monster.Components.State.State}
45
+ * @return {void}
70
46
  */
71
47
  [assembleMethodSymbol]() {
72
48
  super[assembleMethodSymbol]();
@@ -77,11 +53,11 @@ class State extends CustomControl {
77
53
  * @returns {symbol}
78
54
  */
79
55
  static get [instanceSymbol]() {
80
- return Symbol.for("@schukai/component-state/state");
56
+ return Symbol.for("@schukai/monster/components/state/state@@instance");
81
57
  }
82
58
 
83
59
  /**
84
- * To set the options via the html tag the attribute `data-monster-options` must be used.
60
+ * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
85
61
  * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
86
62
  *
87
63
  * The individual configuration values can be found in the table.
@@ -10,10 +10,10 @@
10
10
  * For more information about purchasing a commercial license, please contact schukai GmbH.
11
11
  */
12
12
 
13
- import { addAttributeToken } from "../../dom/attributes.mjs";
14
- import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
13
+ import {addAttributeToken} from "../../dom/attributes.mjs";
14
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
15
15
 
16
- export { FormStyleSheet };
16
+ export {FormStyleSheet}
17
17
 
18
18
  /**
19
19
  * @private
@@ -22,17 +22,10 @@ export { FormStyleSheet };
22
22
  const FormStyleSheet = new CSSStyleSheet();
23
23
 
24
24
  try {
25
- FormStyleSheet.insertRule(
26
- `
25
+ FormStyleSheet.insertRule(`
27
26
  @layer form {
28
27
  input,meter,progress,select,textarea{accent-color:var(--monster-color-secondary-2);background-color:var(--monster-bg-color-primary-1);border-color:var(--monster-theme-control-border-color);border-radius:var(--monster-theme-control-border-radius);border-style:var(--monster-theme-control-border-style);border-width:var(--monster-theme-control-border-width);box-sizing:border-box;color:var(--monster-color-primary-1);font-family:inherit;font-size:100%;margin:0;outline:none}input,select,textarea{height:-moz-fit-content;height:fit-content;padding:.4rem .6rem}textarea{min-height:6rem;resize:vertical}input[type=color]{height:2rem;margin:0;padding:.1rem;width:2rem}input:hover:not([type=radio]):not([type=checkbox]):not([type=range]),select:hover,textarea:hover{box-shadow:var(--monster-box-shadow-2);transition:background .8s,color .25s .0833333333s}input:focus,select:focus,textarea:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:3px}
29
- }`,
30
- 0,
31
- );
28
+ }`, 0);
32
29
  } catch (e) {
33
- addAttributeToken(
34
- document.getRootNode().querySelector("html"),
35
- ATTRIBUTE_ERRORMESSAGE,
36
- e + "",
37
- );
30
+ addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
38
31
  }