@schukai/monster 3.63.2 → 3.63.3

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 CHANGED
@@ -1,4 +1,15 @@
1
1
 
2
+ ## [3.63.3] - 2024-04-01
3
+
4
+ ### Bug Fixes
5
+
6
+ - include state-button [#183](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/183)
7
+ ### Changes
8
+
9
+ - update devenv
10
+ - update issue templates
11
+ - update template and create showroom section
12
+
2
13
  ## [3.63.2] - 2024-03-28
3
14
 
4
15
  ### Bug Fixes
@@ -6,6 +17,7 @@
6
17
  - colors and more, add igrnore change to savebutton [#181](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/181) [#180](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/180)
7
18
  ### Changes
8
19
 
20
+ - release and publish to npm new version 3.63.2
9
21
  - reorganize playground
10
22
 
11
23
  ## [3.63.1] - 2024-03-27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schukai/monster",
3
- "version": "3.63.2",
3
+ "version": "3.63.3",
4
4
  "description": "Monster is a simple library for creating fast, robust and lightweight websites.",
5
5
  "keywords": [
6
6
  "framework",
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  import { instanceSymbol } from "../../constants.mjs";
7
- import { diff } from "../../data/diff.mjs";
8
7
  import { addAttributeToken } from "../../dom/attributes.mjs";
9
8
  import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
10
9
  import {
@@ -12,10 +11,9 @@ import {
12
11
  CustomElement,
13
12
  registerCustomElement,
14
13
  } from "../../dom/customelement.mjs";
15
- import { isString, isArray } from "../../types/is.mjs";
16
- import { Observer } from "../../types/observer.mjs";
17
- import { clone } from "../../util/clone.mjs";
14
+ import { isString } from "../../types/is.mjs";
18
15
  import { State } from "../form/types/state.mjs";
16
+ import "../form/state-button.mjs";
19
17
  import { ATTRIBUTE_DATASOURCE_SELECTOR } from "./constants.mjs";
20
18
  import { ChangeButtonStyleSheet } from "./stylesheet/change-button.mjs";
21
19
 
@@ -38,6 +36,47 @@ const datasetLinkedElementSymbol = Symbol("datasetLinkedElement");
38
36
  */
39
37
  const overlayLinkedElementSymbol = Symbol("overlayLinkedElement");
40
38
 
39
+
40
+
41
+ /**
42
+ * The ColumnBar component is used to show and configure the columns of a datatable.
43
+ *
44
+ * <img src="./images/change-button.png">
45
+ *
46
+ * You can create this control either by specifying the HTML tag <monster-datatable-change-button />` directly in the HTML or using
47
+ * Javascript via the `document.createElement('monster-datatable-change-button');` method.
48
+ *
49
+ * ```html
50
+ * <monster-datatable-change-button></monster-datatable-change-button>
51
+ * ```
52
+ *
53
+ * Or you can create this CustomControl directly in Javascript:
54
+ *
55
+ * ```js
56
+ * import '@schukai/monster/components/datatable/change-button.mjs';
57
+ * document.createElement('monster-datatable-change-button');
58
+ * ```
59
+ *
60
+ * The Body should have a class "hidden" to ensure that the
61
+ * styles are applied correctly.
62
+ *
63
+ * ```css
64
+ * body.hidden {
65
+ * visibility: hidden;
66
+ * }
67
+ * ```
68
+ *
69
+ * @startuml change-button.png
70
+ * skinparam monochrome true
71
+ * skinparam shadowing false
72
+ * HTMLElement <|-- CustomElement
73
+ * CustomElement <|-- ChangeButton
74
+ * @enduml
75
+ *
76
+ * @copyright schukai GmbH
77
+ * @memberOf Monster.Components.Datatable
78
+ * @summary A data set
79
+ */
41
80
  class ChangeButton extends CustomElement {
42
81
  /**
43
82
  * This method is called by the `instanceof` operator.
@@ -51,8 +51,6 @@ const popperInstanceSymbol = Symbol("popperInstance");
51
51
  *
52
52
  * <img src="./images/column-bar.png">
53
53
  *
54
- * Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
55
- *
56
54
  * You can create this control either by specifying the HTML tag <monster-column-bar />` directly in the HTML or using
57
55
  * Javascript via the `document.createElement('monster-column-bar');` method.
58
56
  *
@@ -63,7 +61,7 @@ const popperInstanceSymbol = Symbol("popperInstance");
63
61
  * Or you can create this CustomControl directly in Javascript:
64
62
  *
65
63
  * ```js
66
- * import '@schukai/component-datatable/source/columnbar.mjs';
64
+ * import '@schukai/monster/components/datatable/column-bar.mjs';
67
65
  * document.createElement('monster-column-bar');
68
66
  * ```
69
67
  *
@@ -10,17 +10,34 @@
10
10
  background-size: cover;
11
11
  width: 1rem;
12
12
  height: 1rem;
13
+ position: absolute;
14
+ right: 0;
15
+ top: -1rem;
16
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3C/svg%3E");
17
+ cursor: pointer;
18
+ transition: right 0.5s ease-in-out;
13
19
  }
14
20
 
15
21
  [data-monster-role="toggle"][data-monster-state="wide"] {
16
- mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-arrows-angle-contract' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M.172 15.828a.5.5 0 0 0 .707 0l4.096-4.096V14.5a.5.5 0 1 0 1 0v-3.975a.5.5 0 0 0-.5-.5H1.5a.5.5 0 0 0 0 1h2.768L.172 15.121a.5.5 0 0 0 0 .707M15.828.172a.5.5 0 0 0-.707 0l-4.096 4.096V1.5a.5.5 0 1 0-1 0v3.975a.5.5 0 0 0 .5.5H14.5a.5.5 0 0 0 0-1h-2.768L15.828.879a.5.5 0 0 0 0-.707'/%3E%3C/svg%3E")
22
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M.172 15.828a.5.5 0 0 0 .707 0l4.096-4.096V14.5a.5.5 0 1 0 1 0v-3.975a.5.5 0 0 0-.5-.5H1.5a.5.5 0 0 0 0 1h2.768L.172 15.121a.5.5 0 0 0 0 .707M15.828.172a.5.5 0 0 0-.707 0l-4.096 4.096V1.5a.5.5 0 1 0-1 0v3.975a.5.5 0 0 0 .5.5H14.5a.5.5 0 0 0 0-1h-2.768L15.828.879a.5.5 0 0 0 0-.707'/%3E%3C/svg%3E")
17
23
  }
18
24
 
19
25
  [data-monster-role="toggle"][data-monster-state="small"] {
20
- mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-arrows-angle-expand' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707m4.344-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707'/%3E%3C/svg%3E");
26
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707m4.344-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707'/%3E%3C/svg%3E");
21
27
  }
22
28
 
23
- [data-monster-role="container"] {
29
+ [data-monster-role=container] {
24
30
  box-sizing: border-box;
25
- transition: width 0.5s ease-in-out;
26
- }
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ position: relative;
35
+
36
+ & [data-monster-role="inside"] {
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ transition: width 0.5s ease-in-out;
41
+ }
42
+
43
+ }
@@ -20,7 +20,7 @@ const WidthToggleStyleSheet = new CSSStyleSheet();
20
20
  try {
21
21
  WidthToggleStyleSheet.insertRule(`
22
22
  @layer widthtoggle {
23
-
23
+ [data-monster-role=toggle]{background-color:var(--monster-bg-color-primary-4);background-position:50%;background-repeat:no-repeat;background-size:cover;cursor:pointer;height:1rem;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'/%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'/%3E\");position:absolute;right:0;top:-1rem;transition:right .5s ease-in-out;width:1rem}[data-monster-role=toggle][data-monster-state=wide]{-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M.172 15.828a.5.5 0 0 0 .707 0l4.096-4.096V14.5a.5.5 0 1 0 1 0v-3.975a.5.5 0 0 0-.5-.5H1.5a.5.5 0 0 0 0 1h2.768L.172 15.121a.5.5 0 0 0 0 .707M15.828.172a.5.5 0 0 0-.707 0l-4.096 4.096V1.5a.5.5 0 1 0-1 0v3.975a.5.5 0 0 0 .5.5H14.5a.5.5 0 0 0 0-1h-2.768L15.828.879a.5.5 0 0 0 0-.707'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M.172 15.828a.5.5 0 0 0 .707 0l4.096-4.096V14.5a.5.5 0 1 0 1 0v-3.975a.5.5 0 0 0-.5-.5H1.5a.5.5 0 0 0 0 1h2.768L.172 15.121a.5.5 0 0 0 0 .707M15.828.172a.5.5 0 0 0-.707 0l-4.096 4.096V1.5a.5.5 0 1 0-1 0v3.975a.5.5 0 0 0 .5.5H14.5a.5.5 0 0 0 0-1h-2.768L15.828.879a.5.5 0 0 0 0-.707'/%3E%3C/svg%3E\")}[data-monster-role=toggle][data-monster-state=small]{-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707m4.344-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.828 10.172a.5.5 0 0 0-.707 0l-4.096 4.096V11.5a.5.5 0 0 0-1 0v3.975a.5.5 0 0 0 .5.5H4.5a.5.5 0 0 0 0-1H1.732l4.096-4.096a.5.5 0 0 0 0-.707m4.344-4.344a.5.5 0 0 0 .707 0l4.096-4.096V4.5a.5.5 0 1 0 1 0V.525a.5.5 0 0 0-.5-.5H11.5a.5.5 0 0 0 0 1h2.768l-4.096 4.096a.5.5 0 0 0 0 .707'/%3E%3C/svg%3E\")}[data-monster-role=container]{align-items:center;box-sizing:border-box;display:flex;justify-content:center;position:relative}[data-monster-role=container] [data-monster-role=inside]{align-items:center;display:flex;justify-content:center;transition:width .5s ease-in-out}
24
24
  }`, 0);
25
25
  } catch (e) {
26
26
  addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
@@ -3,19 +3,20 @@
3
3
  * SPDX-License-Identifier: AGPL-3.0
4
4
  */
5
5
 
6
+ import {addAttributeToken} from "../../dom/attributes.mjs";
7
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
6
8
  import {
7
9
  assembleMethodSymbol,
8
10
  CustomElement,
9
11
  registerCustomElement,
10
12
  } from "../../dom/customelement.mjs";
11
- import "../notify/notify.mjs";
12
13
  import {fireCustomEvent} from "../../dom/events.mjs";
13
14
  import {Observer} from "../../types/observer.mjs";
14
15
  import {WidthToggleStyleSheet} from "./stylesheet/width-toggle.mjs";
15
16
  import {instanceSymbol} from "../../constants.mjs";
16
17
  import {internalSymbol} from "../../constants.mjs";
17
18
 
18
- export {WidthToggle, TYPE_VERTICAL, TYPE_HORIZONTAL};
19
+ export {WidthToggle, MODE_SMALL, MODE_WIDE};
19
20
 
20
21
  /**
21
22
  * @private
@@ -28,6 +29,22 @@ const widthToggleElementSymbol = Symbol("WidthToggleElement");
28
29
  * @type {symbol}
29
30
  */
30
31
  const toggleElementSymbol = Symbol("toggleElement");
32
+ /**
33
+ * @private
34
+ * @type {symbol}
35
+ */
36
+ const insideElementSymbol = Symbol("insideElement");
37
+
38
+ /**
39
+ *
40
+ * @type {string}
41
+ */
42
+ const MODE_SMALL = "small";
43
+ /**
44
+ *
45
+ * @type {string}
46
+ */
47
+ const MODE_WIDE = "wide";
31
48
 
32
49
  /**
33
50
  * The WidthToggle component is used to change the width of a panel.
@@ -38,14 +55,14 @@ const toggleElementSymbol = Symbol("toggleElement");
38
55
  * Javascript via the `document.createElement('monster-split-screen');` method.
39
56
  *
40
57
  * ```html
41
- * <monster-split-screen></monster-split-screen>
58
+ * <monster-width-toggle></monster-width-toggle>
42
59
  * ```
43
60
  *
44
61
  * Or you can create this CustomControl directly in Javascript:
45
62
  *
46
63
  * ```js
47
- * import '@schukai/monster/components/layout/split-screen.mjs';
48
- * document.createElement('monster-split-screen');
64
+ * import '@schukai/monster/components/layout/width-toggle.mjs';
65
+ * document.createElement('monster-width-toggle');
49
66
  * ```
50
67
  *
51
68
  * @startuml widthToggle.png
@@ -76,7 +93,7 @@ class WidthToggle extends CustomElement {
76
93
  * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
77
94
  *
78
95
  * The individual configuration values can be found in the table.
79
- *
96
+ *
80
97
  * @property {Object} templates Template definitions
81
98
  * @property {string} templates.main Main template
82
99
  * @property {string} splitType Split type (vertical or horizontal)
@@ -90,36 +107,14 @@ class WidthToggle extends CustomElement {
90
107
  templates: {
91
108
  main: getTemplate(),
92
109
  },
93
- splitType: TYPE_VERTICAL,
94
- dimension: {
95
- initial: "60%",
96
- max: "80%",
97
- min: "20%",
110
+ width: {
111
+ small: "40%",
112
+ wide: "95%",
98
113
  },
114
+ default: MODE_SMALL,
99
115
  });
100
116
  }
101
117
 
102
- fullStartScreen() {
103
- this.setDimension("100%");
104
- return this;
105
- }
106
-
107
- fullEndScreen() {
108
- this.setDimension("0%");
109
- return this;
110
- }
111
-
112
- resetScreen() {
113
- this.setDimension(this.getOption("dimension").initial);
114
- return this;
115
- }
116
-
117
-
118
- setContent(html) {
119
- this.setOption("content", html);
120
- return this;
121
- }
122
-
123
118
  /**
124
119
  *
125
120
  * @returns {Monster.Components.Host.Viewer}
@@ -129,27 +124,19 @@ class WidthToggle extends CustomElement {
129
124
 
130
125
  initControlReferences.call(this);
131
126
  initEventHandler.call(this);
132
- //applyContainerWidth.call(this);
133
- this.setDimension(this.getOption("dimension").initial);
127
+ applyContainerWidth.call(this, this.getOption("default"));
128
+
134
129
  }
135
130
 
136
131
  /**
137
132
  * Check if the dimension is a percentage and within a valid range, then set the dimension option.
138
133
  *
139
- * @param {string} width - The dimension to be set, can be in percentage or absolute value.
134
+ * @param {string} mode - The mode of the panel. Possible values are "wide" or "small".
140
135
  * @return {Object} - Returns the current object instance for chaining.
136
+ * @throws {Error} - If the mode is not supported.
141
137
  */
142
- setWidth(width) {
143
- // check if percent and greater than100
144
- if (width.includes("%")) {
145
- if (parseInt(width) > 100) {
146
- throw new Error("width must be less than 100%");
147
- } else if (parseInt(width) < 0) {
148
- throw new Error("width must be greater than 0%");
149
- }
150
- }
151
-
152
- this.setOption("width", width);
138
+ setWidth(mode) {
139
+ applyContainerWidth.call(this, mode);
153
140
  return this;
154
141
  }
155
142
 
@@ -173,21 +160,36 @@ class WidthToggle extends CustomElement {
173
160
 
174
161
  /**
175
162
  * Set the dimensions of the panel based on the split type.
163
+ * @param {string} mode - The mode of the panel. Possible values are "wide" or "small".
176
164
  * @fires Monster.Components.Layout.event:monster-dimension-changed
177
165
  */
178
- function applyContainerWidth() {
166
+ function applyContainerWidth(mode) {
179
167
 
180
- let width = this.getOption("width");
168
+ const width = this.getOption("width." + mode)
181
169
  if (!width) {
182
- width = "100%";
170
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
171
+ throw new Error("unsupported mode");
183
172
  }
184
173
 
185
- this[widthToggleElementSymbol].style.width = width;
174
+ switch (mode) {
175
+ case MODE_SMALL:
176
+ case MODE_WIDE:
186
177
 
187
- fireCustomEvent(this, "monster-dimension-changed", {
188
- controller: this,
189
- dimension: width
190
- });
178
+ this[toggleElementSymbol].style.right = "calc( 50% - (" + width + " / 2) + 1rem)"
179
+ this[toggleElementSymbol].setAttribute("data-monster-state", mode);
180
+ this[insideElementSymbol].style.width = width;
181
+
182
+ fireCustomEvent(this, "monster-dimension-changed", {
183
+ controller: this,
184
+ dimension: width
185
+ });
186
+ break;
187
+
188
+ default:
189
+ const error = new Error("unsupported mode")
190
+ addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.message);
191
+ throw error;
192
+ }
191
193
 
192
194
  }
193
195
 
@@ -202,8 +204,9 @@ function initControlReferences() {
202
204
  throw new Error("no shadow-root is defined");
203
205
  }
204
206
 
205
- this[widthToggleElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=width-toggle]");
207
+ this[widthToggleElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=control]");
206
208
  this[toggleElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=toggle]");
209
+ this[insideElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=inside]");
207
210
 
208
211
 
209
212
  }
@@ -214,10 +217,10 @@ function initControlReferences() {
214
217
  function initEventHandler() {
215
218
  const self = this;
216
219
 
217
- this[internalSymbol].attachObserver(
218
- new Observer(() => {
219
- applyContainerWidth.call(self);
220
- }));
220
+ this[toggleElementSymbol].addEventListener("click", function () {
221
+ const mode = self[toggleElementSymbol].getAttribute("data-monster-state") === MODE_SMALL ? MODE_WIDE : MODE_SMALL;
222
+ applyContainerWidth.call(self, mode);
223
+ });
221
224
 
222
225
 
223
226
  return this;
@@ -231,10 +234,12 @@ function initEventHandler() {
231
234
  function getTemplate() {
232
235
  // language=HTML
233
236
  return `
234
- <div data-monster-role="width-toggle" part="control">
237
+ <div data-monster-role="control" part="control">
235
238
  <div part="container" data-monster-role="container">
236
- <div data-monster-role="toggle">ICON</div>
237
- <slot></slot>
239
+ <div part="toggle" data-monster-role="toggle" data-monster-state="wide"></div>
240
+ <div part="inside" data-monster-role="inside">
241
+ <slot></slot>
242
+ </div>
238
243
  </div>
239
244
  </div>`;
240
245
  }
@@ -152,7 +152,7 @@ function getMonsterVersion() {
152
152
  }
153
153
 
154
154
  /** don't touch, replaced by make with package.json version */
155
- monsterVersion = new Version("3.63.2");
155
+ monsterVersion = new Version("3.63.3");
156
156
 
157
157
  return monsterVersion;
158
158
  }
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("3.63.2")
10
+ monsterVersion = new Version("3.63.3")
11
11
 
12
12
  let m = getMonsterVersion();
13
13