@schukai/monster 3.63.2 → 3.64.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,27 @@
1
1
 
2
+ ## [3.64.0] - 2024-04-04
3
+
4
+ ### Add Features
5
+
6
+ - add new panel and rename switch-screen to switch-panel [#184](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/184)
7
+ ### Changes
8
+
9
+ - fix tests
10
+ - new command for create-issue, first step for theme generator
11
+ - test runners are now empowered to run selected files [#166](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/166)
12
+
13
+ ## [3.63.3] - 2024-04-01
14
+
15
+ ### Bug Fixes
16
+
17
+ - include state-button [#183](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/183)
18
+ ### Changes
19
+
20
+ - release and publish to npm new version 3.63.3
21
+ - update devenv
22
+ - update issue templates
23
+ - update template and create showroom section
24
+
2
25
  ## [3.63.2] - 2024-03-28
3
26
 
4
27
  ### Bug Fixes
@@ -6,6 +29,7 @@
6
29
  - 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
30
  ### Changes
8
31
 
32
+ - release and publish to npm new version 3.63.2
9
33
  - reorganize playground
10
34
 
11
35
  ## [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.64.0",
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
  *
@@ -0,0 +1,271 @@
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
+
121
+ /**
122
+ * This method is called by the dom and should not be called directly.
123
+ *
124
+ * @return {void}
125
+ */
126
+ disconnectedCallback() {
127
+ super.disconnectedCallback();
128
+ disconnectResizeObserver.call(this);
129
+ }
130
+
131
+ /**
132
+ * @return {string}
133
+ */
134
+ static getTag() {
135
+ return "monster-panel";
136
+ }
137
+
138
+ /**
139
+ * @return {CSSStyleSheet[]}
140
+ */
141
+ static getCSSStyleSheet() {
142
+ return [PanelStyleSheet];
143
+ }
144
+ }
145
+
146
+ /**
147
+ * @private
148
+ */
149
+ function calcHeight() {
150
+
151
+ this.style.boxSizing = "border-box";
152
+
153
+ const height = calculateMaximumHeight.call(this, this);
154
+ if (height < 0) {
155
+ return;
156
+ }
157
+
158
+ this.style.height = `${height}px`;
159
+
160
+ }
161
+
162
+ function calculateMaximumHeight(element) {
163
+ let totalBottomBorder = 0;
164
+ let totalBottomPadding = 0;
165
+ let totalBottomMargin = 0;
166
+ let totalOutlineHeight = 0;
167
+ let totalBoxShadowHeight = 0;
168
+ let currentElement = element;
169
+
170
+ // Get the distance from the top of the element to the top of the viewport
171
+ const distanceFromTop = element.getBoundingClientRect().top;
172
+
173
+ // Loop through the elements up to the body to sum up the bottom borders, padding, and margin
174
+ while (currentElement && currentElement !== document.body) {
175
+ const style = window.getComputedStyle(currentElement);
176
+
177
+ // Box sizing
178
+ const boxSizing = style.boxSizing;
179
+
180
+ // Borders, padding, and margin
181
+ const borderBottomWidth = parseFloat(style.borderBottomWidth);
182
+ const paddingBottom = parseFloat(style.paddingBottom);
183
+ const marginBottom = parseFloat(style.marginBottom);
184
+
185
+ // Outline and box-shadow
186
+ const outlineHeight = parseFloat(style.outlineWidth);
187
+ // This is a simplification; box-shadow is more complex to parse
188
+ const boxShadowVertical = parseFloat(style.boxShadow.split(' ')[3] || 0);
189
+
190
+ // Accumulate values
191
+ totalBottomBorder += isNaN(borderBottomWidth) ? 0 : borderBottomWidth;
192
+ totalBottomPadding += (isNaN(paddingBottom) || boxSizing === 'border-box') ? 0 : paddingBottom;
193
+ totalBottomMargin += isNaN(marginBottom) ? 0 : marginBottom;
194
+ totalOutlineHeight += isNaN(outlineHeight) ? 0 : outlineHeight;
195
+ totalBoxShadowHeight += isNaN(boxShadowVertical) ? 0 : boxShadowVertical;
196
+
197
+ currentElement = currentElement.parentNode || currentElement.host;
198
+ }
199
+
200
+ // Calculate the maximum height by subtracting the distance, borders, padding, margin, outline, and box-shadow from the window's inner height
201
+ const maximumHeight = window.innerHeight - distanceFromTop - totalBottomBorder - totalBottomPadding - totalBottomMargin - totalOutlineHeight - totalBoxShadowHeight;
202
+ return maximumHeight + this.getOption("heightAdjustment");
203
+ }
204
+
205
+
206
+ /**
207
+ * @private
208
+ */
209
+ function attachResizeObserver() {
210
+ // against flickering
211
+ this[resizeObserverSymbol] = new ResizeObserver(() => {
212
+ if (this[timerCallbackSymbol] instanceof DeadMansSwitch) {
213
+ try {
214
+ this[timerCallbackSymbol].touch();
215
+ return;
216
+ } catch (e) {
217
+ delete this[timerCallbackSymbol];
218
+ }
219
+ }
220
+
221
+ this[timerCallbackSymbol] = new DeadMansSwitch(200, () => {
222
+ calcHeight.call(this);
223
+ });
224
+ });
225
+
226
+ this[resizeObserverSymbol].observe(this.ownerDocument.body);
227
+ this[resizeObserverSymbol].observe(document.scrollingElement);
228
+
229
+ }
230
+
231
+ function disconnectResizeObserver() {
232
+ if (this[resizeObserverSymbol] instanceof ResizeObserver) {
233
+ this[resizeObserverSymbol].disconnect();
234
+ }
235
+ }
236
+
237
+ /**
238
+ * @private
239
+ * @return {Select}
240
+ * @throws {Error} no shadow-root is defined
241
+ */
242
+ function initControlReferences() {
243
+ if (!this.shadowRoot) {
244
+ throw new Error("no shadow-root is defined");
245
+ }
246
+
247
+ this[PanelElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=control]");
248
+
249
+
250
+ }
251
+
252
+ /**
253
+ * @private
254
+ */
255
+ function initEventHandler() {
256
+ return this;
257
+ }
258
+
259
+ /**
260
+ * @private
261
+ * @return {string}
262
+ */
263
+ function getTemplate() {
264
+ // language=HTML
265
+ return `
266
+ <div data-monster-role="control" part="control">
267
+ <slot></slot>
268
+ </div>`;
269
+ }
270
+
271
+ registerCustomElement(Panel);
@@ -11,11 +11,11 @@ import {
11
11
  import "../notify/notify.mjs";
12
12
  import {fireCustomEvent} from "../../dom/events.mjs";
13
13
  import {Observer} from "../../types/observer.mjs";
14
- import {SplitScreenStyleSheet} from "./stylesheet/split-screen.mjs";
14
+ import {SplitPanelStyleSheet} from "./stylesheet/split-panel.mjs";
15
15
  import {instanceSymbol} from "../../constants.mjs";
16
16
  import {internalSymbol} from "../../constants.mjs";
17
17
 
18
- export {SplitScreen, TYPE_VERTICAL, TYPE_HORIZONTAL};
18
+ export {SplitPanel, TYPE_VERTICAL, TYPE_HORIZONTAL};
19
19
 
20
20
  /**
21
21
  * @private
@@ -57,32 +57,43 @@ const TYPE_HORIZONTAL = "horizontal";
57
57
 
58
58
 
59
59
  /**
60
- * The SplitScreen control is a simple layout control that allows you to split the screen into two parts. The split can be
61
- * either vertical or horizontal. The control provides a draggable handle that allows you to adjust the size of the two
62
- * panels.
60
+ * The SplitPanel control is a simple layout control that allows you to split the screen
61
+ * into two parts. The split can be either vertical or horizontal. The control provides a
62
+ * draggable handle that allows you to adjust the size of the two panels.
63
63
  *
64
- * <img src="./images/splitscreen.png">
64
+ * <img src="./images/split-panel.png">
65
65
  *
66
- * You can create this control either by specifying the HTML tag <monster-splitscreen />` directly in the HTML or using
67
- * Javascript via the `document.createElement('monster-split-screen');` method.
66
+ * You can create this control either by specifying the HTML tag <monster-split-panel />`
67
+ * directly in the HTML or using Javascript via the `document.createElement('monster-split-panel');`
68
+ * method.
68
69
  *
69
70
  * ```html
70
- * <monster-split-screen></monster-split-screen>
71
+ * <monster-split-panel></monster-split-panel>
71
72
  * ```
72
73
  *
73
74
  * Or you can create this CustomControl directly in Javascript:
74
75
  *
75
76
  * ```js
76
- * import '@schukai/monster/components/layout/split-screen.mjs';
77
- * document.createElement('monster-split-screen');
77
+ * import '@schukai/monster/components/layout/split-panel.mjs';
78
+ * document.createElement('monster-split-panel');
79
+ * ```
80
+ *
81
+ * It is best to hide unregistered elements with the css property `visibility: hidden;`
82
+ *
83
+ * ```css
84
+ * <style>
85
+ * *:not(:defined) {
86
+ * visibility: hidden;
87
+ * }
88
+ * </style>
78
89
  * ```
79
90
  *
80
- * @startuml splitscreen.png
91
+ * @startuml split-panel.png
81
92
  * skinparam monochrome true
82
93
  * skinparam shadowing false
83
94
  * HTMLElement <|-- CustomElement
84
95
  * CustomElement <|-- CustomControl
85
- * CustomControl <|-- SplitScreen
96
+ * CustomControl <|-- SplitPanel
86
97
  * @enduml
87
98
  *
88
99
  * @copyright schukai GmbH
@@ -90,14 +101,14 @@ const TYPE_HORIZONTAL = "horizontal";
90
101
  * @summary A simple split screen layout
91
102
  * @fires Monster.Components.Layout.event:monster-dimension-changed
92
103
  */
93
- class SplitScreen extends CustomElement {
104
+ class SplitPanel extends CustomElement {
94
105
 
95
106
  /**
96
107
  * This method is called by the `instanceof` operator.
97
108
  * @returns {symbol}
98
109
  */
99
110
  static get [instanceSymbol]() {
100
- return Symbol.for("@schukai/monster/components/layout/splitscreen");
111
+ return Symbol.for("@schukai/monster/components/layout/split-panel");
101
112
  }
102
113
 
103
114
  /**
@@ -127,23 +138,22 @@ class SplitScreen extends CustomElement {
127
138
  },
128
139
  });
129
140
  }
130
-
141
+
131
142
  fullStartScreen() {
132
143
  this.setDimension("100%");
133
144
  return this;
134
145
  }
135
-
146
+
136
147
  fullEndScreen() {
137
148
  this.setDimension("0%");
138
149
  return this;
139
150
  }
140
-
151
+
141
152
  resetScreen() {
142
153
  this.setDimension(this.getOption("dimension").initial);
143
154
  return this;
144
155
  }
145
-
146
-
156
+
147
157
 
148
158
  setContent(html) {
149
159
  this.setOption("content", html);
@@ -189,14 +199,14 @@ class SplitScreen extends CustomElement {
189
199
  * @return {string}
190
200
  */
191
201
  static getTag() {
192
- return "monster-split-screen";
202
+ return "monster-split-panel";
193
203
  }
194
204
 
195
205
  /**
196
206
  * @return {CSSStyleSheet[]}
197
207
  */
198
208
  static getCSSStyleSheet() {
199
- return [SplitScreenStyleSheet];
209
+ return [SplitPanelStyleSheet];
200
210
  }
201
211
  }
202
212
 
@@ -230,7 +240,7 @@ function applyPanelDimensions() {
230
240
  controller: this,
231
241
  dimension: dimension
232
242
  });
233
-
243
+
234
244
  }
235
245
 
236
246
 
@@ -244,7 +254,7 @@ function initControlReferences() {
244
254
  throw new Error("no shadow-root is defined");
245
255
  }
246
256
 
247
- this[splitScreenElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=split-screen]");
257
+ this[splitScreenElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=split-panel]");
248
258
  this[draggerElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=dragger]");
249
259
  this[handleElementSymbol] = this.shadowRoot.querySelector("[data-monster-role=handle]");
250
260
 
@@ -264,31 +274,38 @@ function initEventHandler() {
264
274
 
265
275
  this[internalSymbol].getSubject().isDragging = false;
266
276
 
267
- this[draggerElementSymbol].addEventListener('dblclick', () => {
268
- self[internalSymbol].getSubject().isDragging = false;
269
- lastDimension = undefined;
270
-
271
- let currentDimension;
272
- if (self.getOption("splitType") === TYPE_VERTICAL) {
273
- const topPanel = self[startPanelElementSymbol];
274
- currentDimension = topPanel.style.width;
275
- } else {
276
- const topPanel = self[startPanelElementSymbol];
277
- currentDimension = topPanel.style.height;
278
- }
277
+ // @todo: add better touch support
278
+ const eventTypes = ["dblclick", "touchstart"];
279
+ for (const eventType of eventTypes) {
279
280
 
280
- if (currentDimension === self.getOption("dimension").initial) {
281
- self.setDimension(self.getOption("dimension").max);
282
- } else if (currentDimension === self.getOption("dimension").max) {
283
- self.setDimension(self.getOption("dimension").min);
284
- } else if (currentDimension === self.getOption("dimension").min) {
285
- self.setDimension(self.getOption("dimension").initial);
286
- } else {
287
- self.setDimension(self.getOption("dimension").initial);
288
- }
289
- });
290
281
 
291
- this[draggerElementSymbol].addEventListener('mousedown', () => {
282
+ this[draggerElementSymbol].addEventListener(eventType, () => {
283
+ self[internalSymbol].getSubject().isDragging = false;
284
+ lastDimension = undefined;
285
+
286
+ let currentDimension;
287
+ if (self.getOption("splitType") === TYPE_VERTICAL) {
288
+ const topPanel = self[startPanelElementSymbol];
289
+ currentDimension = topPanel.style.width;
290
+ } else {
291
+ const topPanel = self[startPanelElementSymbol];
292
+ currentDimension = topPanel.style.height;
293
+ }
294
+
295
+ if (currentDimension === self.getOption("dimension").initial) {
296
+ self.setDimension(self.getOption("dimension").max);
297
+ } else if (currentDimension === self.getOption("dimension").max) {
298
+ self.setDimension(self.getOption("dimension").min);
299
+ } else if (currentDimension === self.getOption("dimension").min) {
300
+ self.setDimension(self.getOption("dimension").initial);
301
+ } else {
302
+ self.setDimension(self.getOption("dimension").initial);
303
+ }
304
+ });
305
+
306
+ }
307
+
308
+ this[draggerElementSymbol].addEventListener("mousedown", () => {
292
309
  self[internalSymbol].getSubject().isDragging = true;
293
310
 
294
311
  const eventListener = (e) => {
@@ -311,25 +328,24 @@ function initEventHandler() {
311
328
  const bottomPanel = self[endPanelElementSymbol];
312
329
  let newTopHeight = e.clientY - containerOffsetTop;
313
330
 
314
- const min = this.getOption("dimension").min;
315
- const max = this.getOption("dimension").max;
331
+ const min = this.getOption("dimension").min;
332
+ const max = this.getOption("dimension").max;
316
333
 
317
334
  const topAsPercent = (newTopHeight / this[splitScreenElementSymbol].offsetHeight) * 100;
318
- if (parseInt(min) > topAsPercent) {
319
- newTopHeight = min;
320
- } else if (parseInt(max) < topAsPercent) {
321
- newTopHeight = max;
322
- } else {
323
- newTopHeight = topAsPercent + "%";
324
- }
325
-
326
- // calc new top height to pixel
335
+ if (parseInt(min) > topAsPercent) {
336
+ newTopHeight = min;
337
+ } else if (parseInt(max) < topAsPercent) {
338
+ newTopHeight = max;
339
+ } else {
340
+ newTopHeight = topAsPercent + "%";
341
+ }
342
+
343
+ // calc new top height to pixel
327
344
  const newTopHeightPx = (parseInt(newTopHeight) / 100) * this[splitScreenElementSymbol].offsetHeight;
328
345
 
329
346
  topPanel.style.height = `${newTopHeightPx}px`;
330
347
  bottomPanel.style.height = `calc(100% - ${newTopHeightPx}px - ${draggerWidth})`; // 5px is dragger height
331
348
 
332
-
333
349
  } else {
334
350
 
335
351
  const containerOffsetLeft = self[splitScreenElementSymbol].offsetLeft;
@@ -367,7 +383,6 @@ function initEventHandler() {
367
383
 
368
384
  });
369
385
 
370
-
371
386
  this[internalSymbol].attachObserver(
372
387
  new Observer(() => {
373
388
 
@@ -401,7 +416,7 @@ function initEventHandler() {
401
416
  function getTemplate() {
402
417
  // language=HTML
403
418
  return `
404
- <div data-monster-role="split-screen" part="control">
419
+ <div data-monster-role="split-panel" part="control">
405
420
  <div data-monster-role="startPanel" class="panel" part="startPanel">
406
421
  <slot name="start"></slot>
407
422
  </div>
@@ -411,9 +426,7 @@ function getTemplate() {
411
426
  <div data-monster-role="endPanel" class="panel" part="endPanel">
412
427
  <slot name="end"></slot>
413
428
  </div>
414
-
415
-
416
429
  </div>`;
417
430
  }
418
431
 
419
- registerCustomElement(SplitScreen);
432
+ registerCustomElement(SplitPanel);
@@ -0,0 +1,38 @@
1
+ @import "../../style/property.pcss";
2
+ @import "../../style/display.pcss";
3
+ @import "../../style/border.pcss";
4
+ @import "../../style/theme.pcss";
5
+ @import "../../style/popper.pcss";
6
+ @import "../../style/control.pcss";
7
+ @import "../../style/badge.pcss";
8
+ @import '../../style/mixin/button.pcss';
9
+ @import '../../style/mixin/typography.pcss';
10
+ @import '../../style/mixin/hover.pcss';
11
+
12
+ :host {
13
+ display: block;
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ overflow: auto;
17
+
18
+ }
19
+
20
+ [data-monster-role="control"] {
21
+ margin: 0;
22
+ padding: 0;
23
+ border: 0;
24
+ box-sizing: border-box;
25
+ outline: none;
26
+ overflow: auto;
27
+ scrollbar-width: thin;
28
+ scrollbar-color: var(--monster-color-primary-1) var(--monster-bg-color-primary-1);
29
+
30
+
31
+ //position: fixed;
32
+ //top: 0;
33
+ //left: 0;
34
+ //right: 0;
35
+ //bottom: 0;
36
+ //overflow: auto;
37
+ //box-sizing: border-box;
38
+ }
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- [data-monster-role="split-screen"] {
3
+ [data-monster-role="split-panel"] {
4
4
 
5
5
  box-sizing: border-box;
6
6
  display: flex;
@@ -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
+ }
@@ -0,0 +1,27 @@
1
+
2
+ /**
3
+ * Copyright schukai GmbH and contributors 2024. All Rights Reserved.
4
+ * Node module: @schukai/monster
5
+ * This file is licensed under the AGPLv3 License.
6
+ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
7
+ */
8
+
9
+ import {addAttributeToken} from "../../../dom/attributes.mjs";
10
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
11
+
12
+ export {PanelStyleSheet}
13
+
14
+ /**
15
+ * @private
16
+ * @type {CSSStyleSheet}
17
+ */
18
+ const PanelStyleSheet = new CSSStyleSheet();
19
+
20
+ try {
21
+ PanelStyleSheet.insertRule(`
22
+ @layer panel {
23
+ :after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-color-primary-1:var(--monster-color-cinnamon-6);--monster-color-primary-2:var(--monster-color-cinnamon-6);--monster-color-primary-3:var(--monster-color-cinnamon-1);--monster-color-primary-4:var(--monster-color-cinnamon-1);--monster-bg-color-primary-1:var(--monster-color-cinnamon-1);--monster-bg-color-primary-2:var(--monster-color-cinnamon-2);--monster-bg-color-primary-3:var(--monster-color-cinnamon-3);--monster-bg-color-primary-4:var(--monster-color-cinnamon-6);--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6);--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6);--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-theme-control-bg-color:var(--monster-gradient-tangerine-1);--monster-theme-control-color:var(--monster-gradient-tangerine-6);--monster-theme-control-border-color:var(--monster-gradient-tangerine-2);--monster-theme-control-hover-color:var(--monster-gradient-tangerine-6);--monster-theme-control-hover-bg-color:var(--monster-gradient-tangerine-2);--monster-theme-on-color:var(--monster-color-green-1);--monster-theme-on-bg-color:var(--monster-color-green-5);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-4);--monster-border-style:solid;--monster-border-width:2px;--monster-border-radius:0;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px;--monster-dragger-width:1px;--monster-dragger-handle-width:4px;--monster-dragger-handle-height:50px}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1);--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1);--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1);--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4);--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3);--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3);--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4);--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6);--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1);--monster-theme-control-bg-color:var(--monster-color-gray-5);--monster-theme-control-color:var(--monster-color-gray-1);--monster-theme-control-border-color:var(--monster-color-gray-3);--monster-theme-control-hover-color:var(--monster-color-gray-1);--monster-theme-control-hover-bg-color:var(--monster-color-gray-6);--monster-theme-on-color:var(--monster-color-gray-6);--monster-theme-on-bg-color:var(--monster-color-gray-1);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-5)}}.block{display:block}.inline{display:inline}.inline-block{display:inline-block}.grid{display:grid}.inline-grid{display:inline-grid}.flex{display:flex}.inline-flex{display:inline-flex}.hidden,.hide,.none{display:none}.visible{visibility:visible}.invisible{visibility:hidden}.monster-border-primary-1,.monster-border-primary-2,.monster-border-primary-3,.monster-border-primary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-0{border-radius:0;border-style:none;border-width:0}.monster-border-primary-1{border-color:var(--monster-bg-color-primary-1)}.monster-border-primary-2{border-color:var(--monster-bg-color-primary-2)}.monster-border-primary-3{border-color:var(--monster-bg-color-primary-3)}.monster-border-primary-4{border-color:var(--monster-bg-color-primary-4)}.monster-border-secondary-1,.monster-border-secondary-2,.monster-border-secondary-3,.monster-border-secondary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-secondary-1{border-color:var(--monster-bg-color-secondary-1)}.monster-border-secondary-2{border-color:var(--monster-bg-color-secondary-2)}.monster-border-secondary-3{border-color:var(--monster-bg-color-secondary-3)}.monster-border-secondary-4{border-color:var(--monster-bg-color-secondary-4)}.monster-border-tertiary-1,.monster-border-tertiary-2,.monster-border-tertiary-3,.monster-border-tertiary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-tertiary-1{border-color:var(--monster-bg-color-tertiary-1)}.monster-border-tertiary-2{border-color:var(--monster-bg-color-tertiary-2)}.monster-border-tertiary-3{border-color:var(--monster-bg-color-tertiary-3)}.monster-border-tertiary-4{border-color:var(--monster-bg-color-tertiary-4)}.monster-theme-primary-1{background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1)}.monster-theme-primary-disabled-1{background-color:var(--monster-bg-color-primary-disabled-1);color:var(--monster-color-primary-disabled-1)}.monster-theme-secondary-1{background-color:var(--monster-bg-color-secondary-1);color:var(--monster-color-secondary-1)}.monster-theme-tertiary-1{background-color:var(--monster-bg-color-tertiary-1);color:var(--monster-color-tertiary-1)}.monster-theme-destructive-1{background-color:var(--monster-bg-color-destructive-1);color:var(--monster-color-destructive-1)}.monster-theme-success-1{background-color:var(--monster-bg-color-success-1);color:var(--monster-color-success-1)}.monster-theme-warning-1{background-color:var(--monster-bg-color-warning-1);color:var(--monster-color-warning-1)}.monster-theme-error-1{background-color:var(--monster-bg-color-error-1);color:var(--monster-color-error-1)}.monster-theme-selection-1{background-color:var(--monster-bg-color-selection-1);color:var(--monster-color-selection-1)}.monster-border-color-1{border-color:var(--monster-color-border-1)}.monster-color-neutral-1{color:var(--monster-color-primary-1)}.monster-bg-color-primary-1{background-color:var(--monster-bg-color-primary-1)}.monster-bg-color-secondary-1{background-color:var(--monster-bg-color-secondary-1)}.monster-bg-color-tertiary-1{background-color:var(--monster-bg-color-tertiary-1)}.monster-color-primary-1{background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1)}.monster-color-secondary-1{background-color:var(--monster-bg-color-secondary-1);color:var(--monster-color-secondary-1)}.monster-color-tertiary-1{background-color:var(--monster-bg-color-tertiary-1);color:var(--monster-color-tertiary-1)}.monster-color-destructive-1{background-color:var(--monster-bg-color-destructive-1);color:var(--monster-color-destructive-1)}.monster-color-success-1{background-color:var(--monster-bg-color-success-1);color:var(--monster-color-success-1)}.monster-color-warning-1{background-color:var(--monster-bg-color-warning-1);color:var(--monster-color-warning-1)}.monster-color-error-1{background-color:var(--monster-bg-color-error-1);color:var(--monster-color-error-1)}.monster-color-selection-1{background-color:var(--monster-bg-color-selection-1);color:var(--monster-color-selection-1)}.monster-theme-primary-2{background-color:var(--monster-bg-color-primary-2);color:var(--monster-color-primary-2)}.monster-theme-primary-disabled-2{background-color:var(--monster-bg-color-primary-disabled-2);color:var(--monster-color-primary-disabled-2)}.monster-theme-secondary-2{background-color:var(--monster-bg-color-secondary-2);color:var(--monster-color-secondary-2)}.monster-theme-tertiary-2{background-color:var(--monster-bg-color-tertiary-2);color:var(--monster-color-tertiary-2)}.monster-theme-destructive-2{background-color:var(--monster-bg-color-destructive-2);color:var(--monster-color-destructive-2)}.monster-theme-success-2{background-color:var(--monster-bg-color-success-2);color:var(--monster-color-success-2)}.monster-theme-warning-2{background-color:var(--monster-bg-color-warning-2);color:var(--monster-color-warning-2)}.monster-theme-error-2{background-color:var(--monster-bg-color-error-2);color:var(--monster-color-error-2)}.monster-theme-selection-2{background-color:var(--monster-bg-color-selection-2);color:var(--monster-color-selection-2)}.monster-border-color-2{border-color:var(--monster-color-border-2)}.monster-color-neutral-2{color:var(--monster-color-primary-2)}.monster-bg-color-primary-2{background-color:var(--monster-bg-color-primary-2)}.monster-bg-color-secondary-2{background-color:var(--monster-bg-color-secondary-2)}.monster-bg-color-tertiary-2{background-color:var(--monster-bg-color-tertiary-2)}.monster-color-primary-2{background-color:var(--monster-bg-color-primary-2);color:var(--monster-color-primary-2)}.monster-color-secondary-2{background-color:var(--monster-bg-color-secondary-2);color:var(--monster-color-secondary-2)}.monster-color-tertiary-2{background-color:var(--monster-bg-color-tertiary-2);color:var(--monster-color-tertiary-2)}.monster-color-destructive-2{background-color:var(--monster-bg-color-destructive-2);color:var(--monster-color-destructive-2)}.monster-color-success-2{background-color:var(--monster-bg-color-success-2);color:var(--monster-color-success-2)}.monster-color-warning-2{background-color:var(--monster-bg-color-warning-2);color:var(--monster-color-warning-2)}.monster-color-error-2{background-color:var(--monster-bg-color-error-2);color:var(--monster-color-error-2)}.monster-color-selection-2{background-color:var(--monster-bg-color-selection-2);color:var(--monster-color-selection-2)}.monster-theme-primary-3{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3)}.monster-theme-primary-disabled-3{background-color:var(--monster-bg-color-primary-disabled-3);color:var(--monster-color-primary-disabled-3)}.monster-theme-secondary-3{background-color:var(--monster-bg-color-secondary-3);color:var(--monster-color-secondary-3)}.monster-theme-tertiary-3{background-color:var(--monster-bg-color-tertiary-3);color:var(--monster-color-tertiary-3)}.monster-theme-destructive-3{background-color:var(--monster-bg-color-destructive-3);color:var(--monster-color-destructive-3)}.monster-theme-success-3{background-color:var(--monster-bg-color-success-3);color:var(--monster-color-success-3)}.monster-theme-warning-3{background-color:var(--monster-bg-color-warning-3);color:var(--monster-color-warning-3)}.monster-theme-error-3{background-color:var(--monster-bg-color-error-3);color:var(--monster-color-error-3)}.monster-theme-selection-3{background-color:var(--monster-bg-color-selection-3);color:var(--monster-color-selection-3)}.monster-border-color-3{border-color:var(--monster-color-border-3)}.monster-color-neutral-3{color:var(--monster-color-primary-3)}.monster-bg-color-primary-3{background-color:var(--monster-bg-color-primary-3)}.monster-bg-color-secondary-3{background-color:var(--monster-bg-color-secondary-3)}.monster-bg-color-tertiary-3{background-color:var(--monster-bg-color-tertiary-3)}.monster-color-primary-3{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3)}.monster-color-secondary-3{background-color:var(--monster-bg-color-secondary-3);color:var(--monster-color-secondary-3)}.monster-color-tertiary-3{background-color:var(--monster-bg-color-tertiary-3);color:var(--monster-color-tertiary-3)}.monster-color-destructive-3{background-color:var(--monster-bg-color-destructive-3);color:var(--monster-color-destructive-3)}.monster-color-success-3{background-color:var(--monster-bg-color-success-3);color:var(--monster-color-success-3)}.monster-color-warning-3{background-color:var(--monster-bg-color-warning-3);color:var(--monster-color-warning-3)}.monster-color-error-3{background-color:var(--monster-bg-color-error-3);color:var(--monster-color-error-3)}.monster-color-selection-3{background-color:var(--monster-bg-color-selection-3);color:var(--monster-color-selection-3)}.monster-theme-primary-4{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4)}.monster-theme-primary-disabled-4{background-color:var(--monster-bg-color-primary-disabled-4);color:var(--monster-color-primary-disabled-4)}.monster-theme-secondary-4{background-color:var(--monster-bg-color-secondary-4);color:var(--monster-color-secondary-4)}.monster-theme-tertiary-4{background-color:var(--monster-bg-color-tertiary-4);color:var(--monster-color-tertiary-4)}.monster-theme-destructive-4{background-color:var(--monster-bg-color-destructive-4);color:var(--monster-color-destructive-4)}.monster-theme-success-4{background-color:var(--monster-bg-color-success-4);color:var(--monster-color-success-4)}.monster-theme-warning-4{background-color:var(--monster-bg-color-warning-4);color:var(--monster-color-warning-4)}.monster-theme-error-4{background-color:var(--monster-bg-color-error-4);color:var(--monster-color-error-4)}.monster-theme-selection-4{background-color:var(--monster-bg-color-selection-4);color:var(--monster-color-selection-4)}.monster-border-color-4{border-color:var(--monster-color-border-4)}.monster-color-neutral-4{color:var(--monster-color-primary-4)}.monster-bg-color-primary-4{background-color:var(--monster-bg-color-primary-4)}.monster-bg-color-secondary-4{background-color:var(--monster-bg-color-secondary-4)}.monster-bg-color-tertiary-4{background-color:var(--monster-bg-color-tertiary-4)}.monster-color-primary-4{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4)}.monster-color-secondary-4{background-color:var(--monster-bg-color-secondary-4);color:var(--monster-color-secondary-4)}.monster-color-tertiary-4{background-color:var(--monster-bg-color-tertiary-4);color:var(--monster-color-tertiary-4)}.monster-color-destructive-4{background-color:var(--monster-bg-color-destructive-4);color:var(--monster-color-destructive-4)}.monster-color-success-4{background-color:var(--monster-bg-color-success-4);color:var(--monster-color-success-4)}.monster-color-warning-4{background-color:var(--monster-bg-color-warning-4);color:var(--monster-color-warning-4)}.monster-color-error-4{background-color:var(--monster-bg-color-error-4);color:var(--monster-color-error-4)}.monster-color-selection-4{background-color:var(--monster-bg-color-selection-4);color:var(--monster-color-selection-4)}.monster-theme-control-container-1,.monster-theme-control-row-1{border:1px solid var(--monster-theme-control-border-color)}.monster-theme-control-container-1,.monster-theme-control-element,.monster-theme-control-row-1{background-color:var(--monster-theme-control-bg-color);color:var(--monster-theme-control-color)}.monster-theme-control-background{background-color:var(--monster-theme-control-bg-color)}.monster-theme-background-inherit{background-color:inherit!important}.monster-theme-on{background-color:var(--monster-theme-on-bg-color);color:var(--monster-theme-on-color)}.monster-theme-off{background-color:var(--monster-theme-off-bg-color);color:var(--monster-theme-off-color)}div[data-monster-role=popper]{background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;padding:1.1em;z-index:var(--monster-z-index-modal)}[data-popper-arrow],[data-popper-arrow]:before{background:inherit;height:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2);position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1*var(--monster-popper-witharrrow-distance))*2)}[data-popper-arrow]{visibility:hidden}[data-popper-arrow]:before{box-sizing:border-box;content:\"\";transform:rotate(45deg);visibility:visible}div[data-popper-placement^=top]>[data-popper-arrow]{bottom:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=top]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:transparent}div[data-popper-placement^=bottom]>[data-popper-arrow]{top:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=bottom]>[data-popper-arrow]:before{border-bottom:transparent;border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=left]>[data-popper-arrow]{right:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width))}div[data-popper-placement^=left]>[data-popper-arrow]:before{border-bottom:transparent;border-left:transparent;border-right:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-top:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4)}div[data-popper-placement^=right]>[data-popper-arrow]{left:calc(var(--monster-popper-witharrrow-distance) - var(--monster-border-width)/2)}div[data-popper-placement^=right]>[data-popper-arrow]:before{border-bottom:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-left:var(--monster-border-width) var(--monster-border-style) var(--monster-bg-color-primary-4);border-right:transparent;border-top:transparent}[data-monster-role=control]{width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}.monster-badge-primary{padding:.25em .4em}.monster-badge-primary,.monster-badge-primary-pill{background-color:var(--monster-bg-color-primary-4);border-radius:.25rem;color:var(--monster-color-primary-4);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-primary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-secondary{padding:.25em .4em}.monster-badge-secondary,.monster-badge-secondary-pill{background-color:var(--monster-bg-color-secondary-3);border-radius:.25rem;color:var(--monster-color-secondary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-secondary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-tertiary{padding:.25em .4em}.monster-badge-tertiary,.monster-badge-tertiary-pill{background-color:var(--monster-bg-color-tertiary-3);border-radius:.25rem;color:var(--monster-color-tertiary-3);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-tertiary-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-destructive{padding:.25em .4em}.monster-badge-destructive,.monster-badge-destructive-pill{background-color:var(--monster-bg-color-destructive-1);border-radius:.25rem;color:var(--monster-color-destructive-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-destructive-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-success{padding:.25em .4em}.monster-badge-success,.monster-badge-success-pill{background-color:var(--monster-bg-color-success-1);border-radius:.25rem;color:var(--monster-color-success-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-success-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-warning{padding:.25em .4em}.monster-badge-warning,.monster-badge-warning-pill{background-color:var(--monster-bg-color-warning-1);border-radius:.25rem;color:var(--monster-color-warning-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-warning-pill{border-radius:10rem;padding:.25em .6em}.monster-badge-error{padding:.25em .4em}.monster-badge-error,.monster-badge-error-pill{background-color:var(--monster-bg-color-error-1);border-radius:.25rem;color:var(--monster-color-error-1);display:inline-block;font-size:75%;font-weight:700;line-height:1;text-align:center;text-decoration:none;vertical-align:baseline;white-space:nowrap}.monster-badge-error-pill{border-radius:10rem;padding:.25em .6em}:host{box-sizing:border-box;display:block;overflow:auto;width:100%}[data-monster-role=control]{border:0;box-sizing:border-box;margin:0;outline:none;overflow:auto;padding:0;scrollbar-color:var(--monster-color-primary-1) var(--monster-bg-color-primary-1);scrollbar-width:thin;//position:fixed;//top:0;//left:0;//right:0;//bottom:0;//overflow:auto;//box-sizing:border-box}
24
+ }`, 0);
25
+ } catch (e) {
26
+ addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
27
+ }
@@ -0,0 +1,27 @@
1
+
2
+ /**
3
+ * Copyright schukai GmbH and contributors 2024. All Rights Reserved.
4
+ * Node module: @schukai/monster
5
+ * This file is licensed under the AGPLv3 License.
6
+ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
7
+ */
8
+
9
+ import {addAttributeToken} from "../../../dom/attributes.mjs";
10
+ import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
11
+
12
+ export {SplitPanelStyleSheet}
13
+
14
+ /**
15
+ * @private
16
+ * @type {CSSStyleSheet}
17
+ */
18
+ const SplitPanelStyleSheet = new CSSStyleSheet();
19
+
20
+ try {
21
+ SplitPanelStyleSheet.insertRule(`
22
+ @layer splitpanel {
23
+ [data-monster-role=split-panel]{box-sizing:border-box;display:flex;flex-direction:row;height:auto;margin:0;padding:0;width:100%}[data-monster-role=split-panel] .panel{flex-grow:1;overflow:auto}[data-monster-role=split-panel] [data-monster-role=dragger]{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4);height:auto;position:relative;width:var(--monster-dragger-width)}[data-monster-role=split-panel] [data-monster-role=dragger] [data-monster-role=handle]{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3);cursor:pointer;height:var(--monster-dragger-handle-height);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--monster-dragger-handle-width);z-index:var(--monster-z-index-outline)}.horizontal[data-monster-role=split-panel]{flex-direction:column}.horizontal[data-monster-role=split-panel] [data-monster-role=dragger]{height:var(--monster-dragger-width);width:100%}.horizontal[data-monster-role=split-panel] [data-monster-role=dragger] [data-monster-role=handle]{height:var(--monster-dragger-handle-width);width:var(--monster-dragger-handle-height)}
24
+ }`, 0);
25
+ } catch (e) {
26
+ addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
27
+ }
@@ -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
  }
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  export * from "./components/layout/tabs.mjs";
20
- export * from "./components/layout/split-screen.mjs";
20
+ export * from "./components/layout/split-panel.mjs";
21
21
  export * from "./components/layout/stylesheet/tabs.mjs";
22
22
  export * from "./components/layout/stylesheet/split-screen.mjs";
23
23
  export * from "./components/form/message-state-button.mjs";
@@ -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.64.0");
156
156
 
157
157
  return monsterVersion;
158
158
  }
@@ -11,9 +11,9 @@ const global = getGlobal();
11
11
 
12
12
  // language=html
13
13
  let html1 = `
14
- <monster-split-screen id="my-split-screen">
14
+ <monster-panel id="my-panel">
15
15
 
16
- </monster-split-screen>
16
+ </monster-panel>
17
17
  `;
18
18
 
19
19
  let SplitScreen;
@@ -34,8 +34,8 @@ describe('SplitScreen', function () {
34
34
  }));
35
35
  }
36
36
 
37
- promises.push(import("../../../../source/components/layout/split-screen.mjs").then((m) => {
38
- SplitScreen = m['SplitScreen'];
37
+ promises.push(import("../../../../source/components/layout/panel.mjs").then((m) => {
38
+ SplitScreen = m['Panel'];
39
39
  }))
40
40
 
41
41
  Promise.all(promises).then(()=>{
@@ -59,7 +59,7 @@ describe('SplitScreen', function () {
59
59
 
60
60
  setTimeout(() => {
61
61
  try {
62
- const SplitScreen = document.getElementById('my-split-screen')
62
+ const SplitScreen = document.getElementById('my-panel')
63
63
  expect(SplitScreen).is.instanceof(HTMLElement);
64
64
 
65
65
  setTimeout(() => {
@@ -0,0 +1,83 @@
1
+ import {getGlobal} from "../../../../source/types/global.mjs";
2
+ import chai from "chai"
3
+ import {chaiDom} from "../../../util/chai-dom.mjs";
4
+ import {initJSDOM} from "../../../util/jsdom.mjs";
5
+
6
+ let expect = chai.expect;
7
+ chai.use(chaiDom);
8
+
9
+ const global = getGlobal();
10
+
11
+
12
+ // language=html
13
+ let html1 = `
14
+ <monster-split-panel id="my-split-panel">
15
+
16
+ </monster-split-panel>
17
+ `;
18
+
19
+ let SplitScreen;
20
+
21
+ describe('SplitScreen', function () {
22
+
23
+ before(function (done) {
24
+ initJSDOM().then(() => {
25
+
26
+ import("element-internals-polyfill").catch(e => done(e));
27
+
28
+ let promises = []
29
+
30
+ if (!global['crypto']) {
31
+ promises.push(import("@peculiar/webcrypto").then((m) => {
32
+ const Crypto = m['Crypto'];
33
+ global['crypto'] = new Crypto();
34
+ }));
35
+ }
36
+
37
+ promises.push(import("../../../../source/components/layout/split-panel.mjs").then((m) => {
38
+ SplitScreen = m['SplitPanel'];
39
+ }))
40
+
41
+ Promise.all(promises).then(()=>{
42
+ done();
43
+ }).catch(e => done(e))
44
+
45
+ });
46
+ })
47
+
48
+ describe('document.createElement()', function () {
49
+
50
+ afterEach(() => {
51
+ let mocks = document.getElementById('mocks');
52
+ mocks.innerHTML = "";
53
+ })
54
+
55
+ it('should have buttons and SplitScreen', function (done) {
56
+
57
+ let mocks = document.getElementById('mocks');
58
+ mocks.innerHTML = html1;
59
+
60
+ setTimeout(() => {
61
+ try {
62
+ const SplitScreen = document.getElementById('my-split-panel')
63
+ expect(SplitScreen).is.instanceof(HTMLElement);
64
+
65
+ setTimeout(() => {
66
+ let div = SplitScreen.shadowRoot.querySelector('div');
67
+ expect(div.hasChildNodes()).to.be.true;
68
+ done();
69
+ }, 100)
70
+
71
+ } catch (e) {
72
+ return done(e);
73
+ }
74
+
75
+ }, 0)
76
+
77
+
78
+ });
79
+
80
+ });
81
+
82
+
83
+ });
@@ -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.64.0")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
package/test/web/tests.js CHANGED
@@ -35855,7 +35855,7 @@ span.monster-fx-ripple{animation:monster-fx-ripple .6s linear;background-color:h
35855
35855
  }));
35856
35856
  }
35857
35857
  promises.push(Promise.resolve().then(() => (init_split_screen2(), split_screen_exports)).then((m) => {
35858
- SplitScreen2 = m["SplitScreen"];
35858
+ SplitScreen2 = m["SplitPanel"];
35859
35859
  }));
35860
35860
  Promise.all(promises).then(() => {
35861
35861
  done();
@@ -1,27 +0,0 @@
1
-
2
- /**
3
- * Copyright schukai GmbH and contributors 2024. All Rights Reserved.
4
- * Node module: @schukai/monster
5
- * This file is licensed under the AGPLv3 License.
6
- * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
7
- */
8
-
9
- import {addAttributeToken} from "../../../dom/attributes.mjs";
10
- import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
11
-
12
- export {SplitScreenStyleSheet}
13
-
14
- /**
15
- * @private
16
- * @type {CSSStyleSheet}
17
- */
18
- const SplitScreenStyleSheet = new CSSStyleSheet();
19
-
20
- try {
21
- SplitScreenStyleSheet.insertRule(`
22
- @layer splitscreen {
23
- [data-monster-role=split-screen]{box-sizing:border-box;display:flex;flex-direction:row;height:auto;margin:0;padding:0;width:100%}[data-monster-role=split-screen] .panel{flex-grow:1;overflow:auto}[data-monster-role=split-screen] [data-monster-role=dragger]{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4);height:auto;position:relative;width:var(--monster-dragger-width)}[data-monster-role=split-screen] [data-monster-role=dragger] [data-monster-role=handle]{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3);cursor:pointer;height:var(--monster-dragger-handle-height);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--monster-dragger-handle-width);z-index:var(--monster-z-index-outline)}.horizontal[data-monster-role=split-screen]{flex-direction:column}.horizontal[data-monster-role=split-screen] [data-monster-role=dragger]{height:var(--monster-dragger-width);width:100%}.horizontal[data-monster-role=split-screen] [data-monster-role=dragger] [data-monster-role=handle]{height:var(--monster-dragger-handle-width);width:var(--monster-dragger-handle-height)}
24
- }`, 0);
25
- } catch (e) {
26
- addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
27
- }