@schukai/monster 3.96.0 → 3.96.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +1 -1
- package/source/components/datatable/dataset.mjs +7 -7
- package/source/components/datatable/datasource/rest.mjs +3 -3
- package/source/components/datatable/pagination.mjs +1 -1
- package/source/components/form/api-bar.mjs +1 -1
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +1 -1
- package/source/components/form/button.mjs +2 -2
- package/source/components/form/confirm-button.mjs +1 -1
- package/source/components/form/form.mjs +7 -5
- package/source/components/form/select.mjs +2014 -2006
- package/source/components/form/style/field-set.pcss +9 -0
- package/source/components/form/style/toggle-switch.pcss +3 -0
- package/source/components/form/stylesheet/field-set.mjs +7 -14
- package/source/components/form/stylesheet/toggle-switch.mjs +7 -14
- package/source/components/form/toggle-switch.mjs +386 -330
- package/source/components/layout/tabs.mjs +3 -3
- package/source/components/layout/width-toggle.mjs +1 -1
- package/source/components/navigation/table-of-content.mjs +1 -1
- package/source/components/notify/message.mjs +1 -1
- package/source/components/notify/notify.mjs +2 -2
- package/source/components/state/log.mjs +1 -1
- package/source/components/state/state.mjs +1 -1
- package/source/components/style/theme.css +4 -4
- package/source/dom/constants.mjs +8 -5
- package/source/dom/updater.mjs +3 -6
- package/test/cases/components/form/toggle-switch.mjs +80 -65
@@ -145,9 +145,9 @@ const resizeObserverSymbol = Symbol("resizeObserver");
|
|
145
145
|
*
|
146
146
|
* @fragments /fragments/components/layout/tabs/
|
147
147
|
*
|
148
|
-
* @example /examples/components/layout/tabs-simple
|
149
|
-
* @example /examples/components/layout/tabs-active
|
150
|
-
* @example /examples/components/layout/tabs-removable
|
148
|
+
* @example /examples/components/layout/tabs-simple Simple Tabs
|
149
|
+
* @example /examples/components/layout/tabs-active Active Tabs
|
150
|
+
* @example /examples/components/layout/tabs-removable Removable Tabs
|
151
151
|
*
|
152
152
|
* @issue https://localhost.alvine.dev:8443/development/issues/closed/268.html
|
153
153
|
* @issue https://localhost.alvine.dev:8443/development/issues/closed/271.html
|
@@ -59,7 +59,7 @@ const MODE_WIDE = "wide";
|
|
59
59
|
*
|
60
60
|
* @fragments /fragments/components/layout/width-toggle/
|
61
61
|
*
|
62
|
-
* @example /examples/components/layout/width-toggle-simple
|
62
|
+
* @example /examples/components/layout/width-toggle-simple Toggle Width
|
63
63
|
*
|
64
64
|
* @since 3.57.0
|
65
65
|
* @copyright schukai GmbH
|
@@ -73,7 +73,7 @@ const scrollableEventHandlerSymbol = Symbol("scrollableEventHandler");
|
|
73
73
|
*
|
74
74
|
* @fragments /fragments/components/form/table-of-content
|
75
75
|
*
|
76
|
-
* @example /examples/components/form/table-of-content-simple
|
76
|
+
* @example /examples/components/form/table-of-content-simple Table of content
|
77
77
|
*
|
78
78
|
* @since 3.65.0
|
79
79
|
* @copyright schukai GmbH
|
@@ -70,7 +70,7 @@ const removeEventHandlerSymbol = Symbol("removeEventHandler");
|
|
70
70
|
*
|
71
71
|
* @fragments /fragments/components/notify/message
|
72
72
|
*
|
73
|
-
* @example /examples/components/notify/message-simple
|
73
|
+
* @example /examples/components/notify/message-simple Message
|
74
74
|
*
|
75
75
|
* @issue https://localhost.alvine.dev:8443/development/issues/closed/269.html
|
76
76
|
*
|
@@ -49,8 +49,8 @@ const queueSymbol = Symbol("queue");
|
|
49
49
|
*
|
50
50
|
* @fragments /fragments/components/notify/notify
|
51
51
|
*
|
52
|
-
* @example /examples/components/notify/notify-simple
|
53
|
-
* @example /examples/components/notify/notify-inline
|
52
|
+
* @example /examples/components/notify/notify-simple Notify
|
53
|
+
* @example /examples/components/notify/notify-inline Inline Notify
|
54
54
|
*
|
55
55
|
* @issue https://localhost.alvine.dev:8443/development/issues/closed/269.html
|
56
56
|
*
|
@@ -44,7 +44,7 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
|
|
44
44
|
*
|
45
45
|
* @fragments /fragments/components/state/log
|
46
46
|
*
|
47
|
-
* @example /examples/components/state/log-simple
|
47
|
+
* @example /examples/components/state/log-simple Log
|
48
48
|
*
|
49
49
|
* @issue https://localhost.alvine.dev:8444/development/issues/closed/270.html
|
50
50
|
*
|
@@ -36,7 +36,7 @@
|
|
36
36
|
color: var(--monster-color-selection-1);
|
37
37
|
}
|
38
38
|
.monster-border-color-1 {
|
39
|
-
border-color: var(--monster-color-
|
39
|
+
border-color: var(--monster-color-primary-4);
|
40
40
|
}
|
41
41
|
.monster-color-neutral-1 {
|
42
42
|
color: var(--monster-color-primary-1);
|
@@ -119,7 +119,7 @@
|
|
119
119
|
color: var(--monster-color-selection-2);
|
120
120
|
}
|
121
121
|
.monster-border-color-2 {
|
122
|
-
border-color: var(--monster-color-
|
122
|
+
border-color: var(--monster-color-primary-3);
|
123
123
|
}
|
124
124
|
.monster-color-neutral-2 {
|
125
125
|
color: var(--monster-color-primary-2);
|
@@ -202,7 +202,7 @@
|
|
202
202
|
color: var(--monster-color-selection-3);
|
203
203
|
}
|
204
204
|
.monster-border-color-3 {
|
205
|
-
border-color: var(--monster-color-
|
205
|
+
border-color: var(--monster-color-primary-2);
|
206
206
|
}
|
207
207
|
.monster-color-neutral-3 {
|
208
208
|
color: var(--monster-color-primary-3);
|
@@ -285,7 +285,7 @@
|
|
285
285
|
color: var(--monster-color-selection-4);
|
286
286
|
}
|
287
287
|
.monster-border-color-4 {
|
288
|
-
border-color: var(--monster-color-
|
288
|
+
border-color: var(--monster-color-primary-1);
|
289
289
|
}
|
290
290
|
.monster-color-neutral-4 {
|
291
291
|
color: var(--monster-color-primary-4);
|
package/source/dom/constants.mjs
CHANGED
@@ -196,23 +196,26 @@ const ATTRIBUTE_UPDATER_BIND = `${ATTRIBUTE_PREFIX}bind`;
|
|
196
196
|
/**
|
197
197
|
* @type {string}
|
198
198
|
* @license AGPLv3
|
199
|
-
* @since
|
199
|
+
* @since 1.9.0
|
200
200
|
*/
|
201
|
-
const
|
201
|
+
const ATTRIBUTE_UPDATER_BIND_TYPE = `${ATTRIBUTE_UPDATER_BIND}-type`;
|
202
202
|
|
203
203
|
/**
|
204
204
|
* @type {string}
|
205
205
|
* @license AGPLv3
|
206
|
+
* @deprecated since 2024-12-29
|
206
207
|
* @since 3.73.0
|
207
208
|
*/
|
208
|
-
const
|
209
|
+
const ATTRIBUTE_FORM_BIND = `${ATTRIBUTE_PREFIX}form-bind`;
|
209
210
|
|
210
211
|
/**
|
211
212
|
* @type {string}
|
212
213
|
* @license AGPLv3
|
213
|
-
* @since
|
214
|
+
* @since 3.73.0
|
215
|
+
* @deprecated since 2024-12-29
|
214
216
|
*/
|
215
|
-
const
|
217
|
+
const ATTRIBUTE_FORM_BIND_TYPE = `${ATTRIBUTE_PREFIX}form-bind-type`;
|
218
|
+
|
216
219
|
|
217
220
|
/**
|
218
221
|
* @type {string}
|
package/source/dom/updater.mjs
CHANGED
@@ -74,7 +74,7 @@ class Updater extends Base {
|
|
74
74
|
* @param {object|ProxyObserver|undefined} subject
|
75
75
|
* @throws {TypeError} value is not a object
|
76
76
|
* @throws {TypeError} value is not an instance of HTMLElement
|
77
|
-
* @see {@link
|
77
|
+
* @see {@link findDocumentTemplate}
|
78
78
|
*/
|
79
79
|
constructor(element, subject) {
|
80
80
|
super();
|
@@ -305,6 +305,7 @@ function getControlEventHandler() {
|
|
305
305
|
if (element === undefined) {
|
306
306
|
return;
|
307
307
|
}
|
308
|
+
|
308
309
|
queueMicrotask(() => {
|
309
310
|
retrieveAndSetValue.call(this, element);
|
310
311
|
});
|
@@ -850,11 +851,7 @@ function handleInputControlAttributeUpdate(element, name, value) {
|
|
850
851
|
switch (element.type) {
|
851
852
|
case "select-multiple":
|
852
853
|
for (const [index, opt] of Object.entries(element.options)) {
|
853
|
-
|
854
|
-
opt.selected = true;
|
855
|
-
} else {
|
856
|
-
opt.selected = false;
|
857
|
-
}
|
854
|
+
opt.selected = value.indexOf(opt.value) !== -1;
|
858
855
|
}
|
859
856
|
|
860
857
|
break;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import {getGlobal} from "../../../../source/types/global.mjs";
|
2
2
|
import * as chai from 'chai';
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import {chaiDom} from "../../../util/chai-dom.mjs";
|
4
|
+
import {initJSDOM} from "../../../util/jsdom.mjs";
|
5
5
|
|
6
6
|
let expect = chai.expect;
|
7
7
|
chai.use(chaiDom);
|
@@ -91,21 +91,24 @@ describe('ToggleSwitch', function () {
|
|
91
91
|
it('toggle to on', function () {
|
92
92
|
|
93
93
|
const toggleSwitch = document.createElement('monster-toggle-switch');
|
94
|
-
toggleSwitch.setOption('
|
95
|
-
toggleSwitch.setOption('
|
94
|
+
toggleSwitch.setOption('values.on', 'true');
|
95
|
+
toggleSwitch.setOption('values.off', 'false');
|
96
96
|
|
97
|
-
|
98
|
-
|
97
|
+
toggleSwitch.value = "true";
|
98
|
+
|
99
|
+
expect("true").is.equal(toggleSwitch.value);
|
100
|
+
expect("on").is.equal(toggleSwitch.state);
|
99
101
|
|
100
102
|
toggleSwitch.toggle();
|
101
103
|
|
102
|
-
expect(
|
103
|
-
expect(
|
104
|
+
expect("false").is.equal(toggleSwitch.value);
|
105
|
+
expect("off").is.equal(toggleSwitch.state);
|
104
106
|
|
105
107
|
toggleSwitch.toggle();
|
106
108
|
|
107
|
-
expect(
|
108
|
-
expect(
|
109
|
+
expect("true").is.equal(toggleSwitch.value);
|
110
|
+
expect("on").is.equal(toggleSwitch.state);
|
111
|
+
|
109
112
|
});
|
110
113
|
|
111
114
|
it('toggle on to off', function () {
|
@@ -156,37 +159,46 @@ describe('ToggleSwitch', function () {
|
|
156
159
|
*/
|
157
160
|
document.getElementById('mocks').appendChild(toggleSwitch);
|
158
161
|
|
159
|
-
/**
|
160
|
-
* expect that classes.on is set to Element Switch
|
161
|
-
*/
|
162
|
-
let hasClassA = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
163
|
-
expect(hasClassA).is.true;
|
164
|
-
|
165
|
-
/**
|
166
|
-
* switch off
|
167
|
-
*/
|
168
|
-
toggleSwitch.value = "off";
|
169
|
-
|
170
162
|
/**
|
171
163
|
* Updater prozess runs in setTimeout
|
172
164
|
* self[internalSymbol].attachObserver();
|
173
165
|
*/
|
174
166
|
setTimeout(() => {
|
175
|
-
|
176
|
-
/**
|
177
|
-
* expect that classes.on is removed from Element Switch
|
178
|
-
*/
|
179
|
-
let hasClassB = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
180
|
-
expect(hasClassB).is.false;
|
181
167
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
168
|
+
window.requestAnimationFrame(() => {
|
169
|
+
|
170
|
+
/**
|
171
|
+
* expect that classes.on is set to Element Switch
|
172
|
+
*/
|
173
|
+
let hasClassA = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
174
|
+
|
175
|
+
|
176
|
+
expect(hasClassA).is.true;
|
177
|
+
|
178
|
+
/**
|
179
|
+
* switch off
|
180
|
+
*/
|
181
|
+
toggleSwitch.value = "off";
|
187
182
|
|
183
|
+
window.requestAnimationFrame(() => {
|
184
|
+
/**
|
185
|
+
* expect that classes.on is removed from Element Switch
|
186
|
+
*/
|
187
|
+
let hasClassB = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.on'));
|
188
|
+
expect(hasClassB).is.false;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* expect that classes.off is set to Element Switch
|
192
|
+
*/
|
193
|
+
let hasClassC = toggleSwitch.shadowRoot.querySelectorAll('[data-monster-role="switch"]')[0].classList.contains(toggleSwitch.getOption('classes.off'));
|
194
|
+
expect(hasClassC).is.true;
|
195
|
+
|
196
|
+
|
197
|
+
done();
|
198
|
+
});
|
199
|
+
|
200
|
+
});
|
188
201
|
|
189
|
-
done();
|
190
202
|
}, 0);
|
191
203
|
|
192
204
|
})
|
@@ -212,16 +224,18 @@ describe('ToggleSwitch', function () {
|
|
212
224
|
* new Control
|
213
225
|
*/
|
214
226
|
let toggleSwitch = document.createElement('monster-toggle-switch');
|
227
|
+
window.requestAnimationFrame(() => {
|
215
228
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
229
|
+
/**
|
230
|
+
* the switch is off and provides the value for off
|
231
|
+
*/
|
232
|
+
expect(null).is.equal(toggleSwitch.value);
|
220
233
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
234
|
+
/**
|
235
|
+
* the switch is off
|
236
|
+
*/
|
237
|
+
expect(toggleSwitch.state).is.equal('off');
|
238
|
+
});
|
225
239
|
|
226
240
|
});
|
227
241
|
|
@@ -240,31 +254,33 @@ describe('ToggleSwitch', function () {
|
|
240
254
|
*/
|
241
255
|
toggleSwitch.value = "test";
|
242
256
|
|
243
|
-
|
244
|
-
* the switch is off and provides the value for off
|
245
|
-
*/
|
246
|
-
expect(toggleSwitch.value).is.equal('false');
|
257
|
+
window.requestAnimationFrame(() => {
|
247
258
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
259
|
+
/**
|
260
|
+
* the switch is off and provides the value for off
|
261
|
+
*/
|
262
|
+
expect(null).is.equal(toggleSwitch.value);
|
252
263
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
264
|
+
/**
|
265
|
+
* the switch is off
|
266
|
+
*/
|
267
|
+
expect(toggleSwitch.state).is.equal('off');
|
257
268
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
269
|
+
/**
|
270
|
+
* disabled attribute is only set when the element has been mounted in the DOM
|
271
|
+
*/
|
272
|
+
expect(toggleSwitch.hasAttribute('disabled')).is.false;
|
262
273
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
274
|
+
/**
|
275
|
+
* insert DOM
|
276
|
+
*/
|
277
|
+
document.getElementById('mocks').appendChild(toggleSwitch);
|
267
278
|
|
279
|
+
/**
|
280
|
+
* now the element is disabled
|
281
|
+
*/
|
282
|
+
expect(toggleSwitch.hasAttribute('disabled')).is.false;
|
283
|
+
});
|
268
284
|
|
269
285
|
});
|
270
286
|
|
@@ -294,8 +310,8 @@ describe('ToggleSwitch', function () {
|
|
294
310
|
expect(toggleSwitch.state).is.equal('on');
|
295
311
|
|
296
312
|
/**
|
297
|
-
|
298
|
-
|
313
|
+
* insert DOM
|
314
|
+
*/
|
299
315
|
document.getElementById('mocks').appendChild(toggleSwitch);
|
300
316
|
|
301
317
|
/**
|
@@ -308,5 +324,4 @@ describe('ToggleSwitch', function () {
|
|
308
324
|
});
|
309
325
|
|
310
326
|
|
311
|
-
|
312
327
|
});
|