@schukai/monster 3.92.2 → 3.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +1 -1
- package/source/components/datatable/datasource/rest.mjs +17 -0
- package/source/components/form/select.mjs +5 -2
- package/source/components/navigation/table-of-content.mjs +1 -1
- package/source/components/notify/message.mjs +12 -56
- package/source/components/notify/notify.mjs +22 -76
- package/source/components/notify/style/notify.pcss +11 -6
- package/source/components/notify/stylesheet/notify.mjs +7 -14
- package/source/components/state/log/entry.mjs +4 -4
- package/source/components/state/log.mjs +46 -43
- package/source/components/state/style/log.pcss +18 -67
- package/source/components/state/stylesheet/log.mjs +7 -14
- package/source/data/transformer.mjs +806 -789
- package/source/dom/updater.mjs +767 -767
- package/source/i18n/time-ago.mjs +671 -0
- package/test/cases/i18n/time-ago.mjs +33 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,23 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.93.0] - 2024-12-22
|
6
|
+
|
7
|
+
### Add Features
|
8
|
+
|
9
|
+
- **log:** update the apearance of the log [#270](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/270)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [3.92.3] - 2024-12-20
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
- **notify:** update small issues [#269](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/269)
|
18
|
+
- **select:** update value() to return only value
|
19
|
+
|
20
|
+
|
21
|
+
|
5
22
|
## [3.92.2] - 2024-12-20
|
6
23
|
|
7
24
|
### Bug Fixes
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.93.0"}
|
@@ -81,6 +81,9 @@ const filterObserverSymbol = Symbol("filterObserver");
|
|
81
81
|
* @copyright schukai GmbH
|
82
82
|
* @summary A rest api datasource
|
83
83
|
*/
|
84
|
+
|
85
|
+
|
86
|
+
|
84
87
|
class Rest extends Datasource {
|
85
88
|
/**
|
86
89
|
* the constructor of the class
|
@@ -453,6 +456,13 @@ function initFilter() {
|
|
453
456
|
filterControl.attachObserver(this[filterObserverSymbol]);
|
454
457
|
}
|
455
458
|
|
459
|
+
/**
|
460
|
+
* @private
|
461
|
+
* @param json
|
462
|
+
* @param response
|
463
|
+
* @param filterControl
|
464
|
+
* @returns {Promise<never>|Promise<Awaited<unknown>>}
|
465
|
+
*/
|
456
466
|
function handleIntersectionObserver(json, response, filterControl) {
|
457
467
|
const path = new Pathfinder(json);
|
458
468
|
|
@@ -495,6 +505,9 @@ function initAutoInit() {
|
|
495
505
|
});
|
496
506
|
}
|
497
507
|
|
508
|
+
/**
|
509
|
+
* @private
|
510
|
+
*/
|
498
511
|
function initEventHandler() {
|
499
512
|
this[intersectionObserverHandlerSymbol] = (entries) => {
|
500
513
|
entries.forEach((entry) => {
|
@@ -515,6 +528,9 @@ function initEventHandler() {
|
|
515
528
|
};
|
516
529
|
}
|
517
530
|
|
531
|
+
/**
|
532
|
+
* @private
|
533
|
+
*/
|
518
534
|
function initIntersectionObserver() {
|
519
535
|
this.classList.add("intersection-observer");
|
520
536
|
|
@@ -528,6 +544,7 @@ function initIntersectionObserver() {
|
|
528
544
|
this[intersectionObserverHandlerSymbol],
|
529
545
|
options,
|
530
546
|
);
|
547
|
+
|
531
548
|
this[intersectionObserverObserverSymbol].observe(this);
|
532
549
|
}
|
533
550
|
|
@@ -2046,14 +2046,17 @@ function convertSelectionToValue(selection) {
|
|
2046
2046
|
if (isArray(selection)) {
|
2047
2047
|
for (const obj of selection) {
|
2048
2048
|
const v = obj?.["value"];
|
2049
|
-
if (v !== undefined) value.push(v);
|
2049
|
+
if (v !== undefined) value.push(`${v}`);
|
2050
2050
|
}
|
2051
2051
|
}
|
2052
2052
|
|
2053
2053
|
if (value.length === 0) {
|
2054
2054
|
return "";
|
2055
2055
|
} else if (value.length === 1) {
|
2056
|
-
|
2056
|
+
const v= value.pop();
|
2057
|
+
if (v === undefined) return "";
|
2058
|
+
if (v === null) return "";
|
2059
|
+
return `${v}`;
|
2057
2060
|
}
|
2058
2061
|
|
2059
2062
|
return value.join(",");
|
@@ -71,7 +71,7 @@ const scrollableEventHandlerSymbol = Symbol("scrollableEventHandler");
|
|
71
71
|
/**
|
72
72
|
* A TableOfContent
|
73
73
|
*
|
74
|
-
* @fragments /fragments/components/form/table-of-content
|
74
|
+
* @fragments /fragments/components/form/table-of-content
|
75
75
|
*
|
76
76
|
* @example /examples/components/form/table-of-content-simple
|
77
77
|
*
|
@@ -66,35 +66,17 @@ const mouseleaveEventHandlerSymbol = Symbol("mouseleaveEventHandler");
|
|
66
66
|
const removeEventHandlerSymbol = Symbol("removeEventHandler");
|
67
67
|
|
68
68
|
/**
|
69
|
-
*
|
69
|
+
* A Message is a notification element that can be used to display messages to the user.
|
70
70
|
*
|
71
|
-
*
|
71
|
+
* @fragments /fragments/components/notify/message
|
72
72
|
*
|
73
|
-
*
|
73
|
+
* @example /examples/components/notify/message-simple
|
74
74
|
*
|
75
|
-
*
|
75
|
+
* @issue https://localhost.alvine.dev:8443/development/issues/closed/269.html
|
76
76
|
*
|
77
|
-
* ```html
|
78
|
-
* <monster-notify-message></monster-notify-message>
|
79
|
-
* ```
|
80
|
-
*
|
81
|
-
* or using Javascript via the `document.createElement('monster-notify');` method.
|
82
|
-
*
|
83
|
-
* ```javascript
|
84
|
-
* import '@schukai/monster/source/components/notify/message.js';
|
85
|
-
* document.createElement('monster-notify-message');
|
86
|
-
* ```
|
87
|
-
*
|
88
|
-
* @externalExample ../../../example/components/notify/message.mjs
|
89
|
-
* @startuml message.png
|
90
|
-
* skinparam monochrome true
|
91
|
-
* skinparam shadowing false
|
92
|
-
* HTMLElement <|-- CustomElement
|
93
|
-
* CustomElement <|-- Message
|
94
|
-
* @enduml
|
95
77
|
* @since 1.0.0
|
96
78
|
* @copyright schukai GmbH
|
97
|
-
* @summary
|
79
|
+
* @summary The message is a notification element that can be used to display messages to the user. Typically, it is only used in conjunction with the notify container.
|
98
80
|
*/
|
99
81
|
class Message extends CustomElement {
|
100
82
|
/**
|
@@ -117,14 +99,13 @@ class Message extends CustomElement {
|
|
117
99
|
* })),'application/json',true).toString()
|
118
100
|
* ```
|
119
101
|
*
|
120
|
-
* @property {string} templates Template definitions
|
121
102
|
* @property {Object} templates Template definitions
|
122
|
-
* @property {integer} timeout time in milliseconds until the message should be removed. The timeout can be disabled via the feature `disappear`.
|
123
|
-
* @property {Object} features
|
124
|
-
* @property {boolean} features.close show close button
|
125
|
-
* @property {boolean} features.disappear automatically remove the message after the timeout
|
126
103
|
* @property {string} templates.main Main template
|
127
|
-
*
|
104
|
+
* @property {number} timeout The time in milliseconds after which the message disappears
|
105
|
+
* @property {Object} features The features of the message
|
106
|
+
* @property {boolean} features.close Whether the message can be closed
|
107
|
+
* @property {boolean} features.disappear Whether the message disappears after a certain time
|
108
|
+
* @property {string} content The content of the message
|
128
109
|
*/
|
129
110
|
get defaults() {
|
130
111
|
return Object.assign(
|
@@ -141,7 +122,6 @@ class Message extends CustomElement {
|
|
141
122
|
main: getTemplate(),
|
142
123
|
},
|
143
124
|
},
|
144
|
-
initOptionsFromArguments.call(this),
|
145
125
|
);
|
146
126
|
}
|
147
127
|
|
@@ -152,7 +132,7 @@ class Message extends CustomElement {
|
|
152
132
|
[assembleMethodSymbol]() {
|
153
133
|
super[assembleMethodSymbol]();
|
154
134
|
initControlReferences.call(this);
|
155
|
-
|
135
|
+
initEventHandler.call(this);
|
156
136
|
return this;
|
157
137
|
}
|
158
138
|
|
@@ -244,30 +224,6 @@ function stopFadeout() {
|
|
244
224
|
}
|
245
225
|
}
|
246
226
|
|
247
|
-
/**
|
248
|
-
* This attribute can be used to pass a URL to this select.
|
249
|
-
*
|
250
|
-
* @private
|
251
|
-
* @return {object}
|
252
|
-
*/
|
253
|
-
function initOptionsFromArguments() {
|
254
|
-
const options = {};
|
255
|
-
|
256
|
-
const timeout = this.getAttribute(ATTRIBUTE_PREFIX + "timeout");
|
257
|
-
if (isString(timeout)) {
|
258
|
-
try {
|
259
|
-
options["timeout"] = parseInt(timeout, 10);
|
260
|
-
} catch (e) {
|
261
|
-
this.setAttribute(
|
262
|
-
ATTRIBUTE_ERRORMESSAGE,
|
263
|
-
this.getAttribute(ATTRIBUTE_ERRORMESSAGE + ", " + e.toString()),
|
264
|
-
);
|
265
|
-
}
|
266
|
-
}
|
267
|
-
|
268
|
-
return options;
|
269
|
-
}
|
270
|
-
|
271
227
|
/**
|
272
228
|
* @private
|
273
229
|
* @return {Message}
|
@@ -289,7 +245,7 @@ function initControlReferences() {
|
|
289
245
|
/**
|
290
246
|
* @private
|
291
247
|
*/
|
292
|
-
function
|
248
|
+
function initEventHandler() {
|
293
249
|
/**
|
294
250
|
* @param {Event} event
|
295
251
|
*/
|
@@ -45,44 +45,18 @@ const containerElementSymbol = Symbol("containerElement");
|
|
45
45
|
const queueSymbol = Symbol("queue");
|
46
46
|
|
47
47
|
/**
|
48
|
-
*
|
48
|
+
* The Notify control
|
49
49
|
*
|
50
|
-
*
|
50
|
+
* @fragments /fragments/components/notify/notify
|
51
51
|
*
|
52
|
-
*
|
52
|
+
* @example /examples/components/notify/notify-simple
|
53
|
+
* @example /examples/components/notify/notify-inline
|
53
54
|
*
|
54
|
-
*
|
55
|
-
*
|
56
|
-
* ```html
|
57
|
-
* <monster-notify></monster-notify>
|
58
|
-
* ```
|
59
|
-
*
|
60
|
-
* or using Javascript via the `document.createElement('monster-notify');` method.
|
61
|
-
*
|
62
|
-
* ```js
|
63
|
-
* import '@schukai/monster/source/components/notify/notify.js';
|
64
|
-
* document.createElement('monster-notify');
|
65
|
-
* ```
|
66
|
-
*
|
67
|
-
* ## Events
|
68
|
-
*
|
69
|
-
* The CustomEvent has the property [`detail`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail).
|
70
|
-
*
|
71
|
-
* ```
|
72
|
-
* node.addEventListener('monster-notify-message',(e)=>console.log(e.detail))
|
73
|
-
* ```
|
74
|
-
*
|
75
|
-
* @externalExample ../../../example/components/notify/notify.mjs
|
76
|
-
* @startuml notify.png
|
77
|
-
* skinparam monochrome true
|
78
|
-
* skinparam shadowing false
|
79
|
-
* HTMLElement <|-- CustomElement
|
80
|
-
* CustomElement <|-- Notify
|
81
|
-
* @enduml
|
55
|
+
* @issue https://localhost.alvine.dev:8443/development/issues/closed/269.html
|
82
56
|
*
|
83
57
|
* @since 1.0.0
|
84
58
|
* @copyright schukai GmbH
|
85
|
-
* @summary
|
59
|
+
* @summary The Notify control is a notification container that can be used to display messages to the user.
|
86
60
|
*/
|
87
61
|
class Notify extends CustomElement {
|
88
62
|
constructor() {
|
@@ -91,24 +65,12 @@ class Notify extends CustomElement {
|
|
91
65
|
}
|
92
66
|
|
93
67
|
/**
|
94
|
-
* The
|
95
|
-
*
|
96
|
-
*
|
97
|
-
*
|
98
|
-
*
|
99
|
-
*
|
100
|
-
*
|
101
|
-
* Since 1.18.0 the JSON can be specified as a DataURI.
|
102
|
-
*
|
103
|
-
* ```
|
104
|
-
* new Monster.Types.DataUrl(btoa(JSON.stringify({
|
105
|
-
* orientation: 'right top'
|
106
|
-
* })),'application/json',true).toString()
|
107
|
-
* ```
|
108
|
-
*
|
109
|
-
* @property {string} templates Template definitions
|
110
|
-
* @property {Object} templates Template definitions
|
111
|
-
* @property {string} templates.main Main template
|
68
|
+
* @property {string} orientation The orientation of the notify element. Allowed values for horizontal orientation are "left", "center", "right". Allowed values for vertical orientation are "top" and "bottom".
|
69
|
+
* @property {object} templates The templates of the notify element.
|
70
|
+
* @property {string} templates.main The main template of the notify element.
|
71
|
+
* @property {object} classes The classes of the notify element.
|
72
|
+
* @property {string} classes.container The container class of the notify element.
|
73
|
+
* @property {string} classes.control The control class of the notify element.
|
112
74
|
*/
|
113
75
|
get defaults() {
|
114
76
|
return Object.assign(
|
@@ -119,13 +81,15 @@ class Notify extends CustomElement {
|
|
119
81
|
templates: {
|
120
82
|
main: getTemplate(),
|
121
83
|
},
|
84
|
+
classes: {
|
85
|
+
container: "",
|
86
|
+
control: "center"
|
87
|
+
}
|
122
88
|
},
|
123
|
-
initOptionsFromArguments.call(this),
|
124
89
|
);
|
125
90
|
}
|
126
91
|
|
127
92
|
/**
|
128
|
-
*
|
129
93
|
* @return {Notify}
|
130
94
|
*/
|
131
95
|
[assembleMethodSymbol]() {
|
@@ -142,7 +106,6 @@ class Notify extends CustomElement {
|
|
142
106
|
}
|
143
107
|
|
144
108
|
/**
|
145
|
-
*
|
146
109
|
* @return {string}
|
147
110
|
*/
|
148
111
|
static getTag() {
|
@@ -158,9 +121,8 @@ class Notify extends CustomElement {
|
|
158
121
|
}
|
159
122
|
|
160
123
|
/**
|
161
|
-
*
|
162
|
-
* @
|
163
|
-
* @return {Monster.Components.Notify.Notify}
|
124
|
+
* @param {Massage|String} message
|
125
|
+
* @return {Notify}
|
164
126
|
*/
|
165
127
|
push(message) {
|
166
128
|
let messageElement = message;
|
@@ -188,22 +150,6 @@ class Notify extends CustomElement {
|
|
188
150
|
}
|
189
151
|
}
|
190
152
|
|
191
|
-
/**
|
192
|
-
* This attribute can be used to pass a URL to this select.
|
193
|
-
*
|
194
|
-
* ```
|
195
|
-
* <monster-select data-monster-url="https://example.com/"></monster-select>
|
196
|
-
* ```
|
197
|
-
*
|
198
|
-
* @private
|
199
|
-
* @return {object}
|
200
|
-
*/
|
201
|
-
function initOptionsFromArguments() {
|
202
|
-
const options = {};
|
203
|
-
|
204
|
-
return options;
|
205
|
-
}
|
206
|
-
|
207
153
|
/**
|
208
154
|
* @private
|
209
155
|
* @return {Select}
|
@@ -229,10 +175,10 @@ function initControlReferences() {
|
|
229
175
|
function getTemplate() {
|
230
176
|
// language=HTML
|
231
177
|
return `
|
232
|
-
<div data-monster-role="control" part="control"
|
233
|
-
data-monster-attributes="data-monster-orientation path:orientation">
|
234
|
-
|
235
|
-
|
178
|
+
<div data-monster-role="control" part="control"
|
179
|
+
data-monster-attributes="data-monster-orientation path:orientation, class path:classes.control">
|
180
|
+
<div data-monster-attributes="class path:classes.container" part="container"
|
181
|
+
data-monster-role="container"></div>
|
236
182
|
</div>
|
237
183
|
`;
|
238
184
|
}
|
@@ -19,7 +19,6 @@ div[data-monster-role=control] {
|
|
19
19
|
max-height: 100vH;
|
20
20
|
margin: 0;
|
21
21
|
|
22
|
-
position: absolute;
|
23
22
|
top: 0;
|
24
23
|
right: 0;
|
25
24
|
|
@@ -31,6 +30,14 @@ div[data-monster-role=control] {
|
|
31
30
|
}
|
32
31
|
|
33
32
|
|
33
|
+
div[data-monster-role=control]:not(.inline) {
|
34
|
+
position: absolute;
|
35
|
+
}
|
36
|
+
|
37
|
+
div[data-monster-role=control].inline {
|
38
|
+
--monster-message-border-shadow: none;
|
39
|
+
}
|
40
|
+
|
34
41
|
[data-monster-role=control][data-monster-orientation*=left] {
|
35
42
|
left: 0;
|
36
43
|
right: auto;
|
@@ -65,11 +72,9 @@ div[data-monster-role=control] {
|
|
65
72
|
width: 100%;
|
66
73
|
}
|
67
74
|
|
68
|
-
|
69
75
|
[data-monster-role=message] {
|
70
76
|
|
71
77
|
display: flex;
|
72
|
-
pointer-events: auto;
|
73
78
|
user-select: text;
|
74
79
|
width: 100%;
|
75
80
|
max-height: 200px;
|
@@ -98,7 +103,7 @@ div[data-monster-role=control] {
|
|
98
103
|
font-size: .875rem;
|
99
104
|
pointer-events: auto;
|
100
105
|
|
101
|
-
box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 15%);
|
106
|
+
box-shadow: var(--monster-message-border-shadow, 0 0.5rem 1rem rgb(0 0 0 / 15%));
|
102
107
|
|
103
108
|
}
|
104
109
|
|
@@ -109,8 +114,8 @@ div[data-monster-role=control] {
|
|
109
114
|
[data-monster-role=message].fadeout {
|
110
115
|
transition: all 0.2s cubic-bezier(1, -0.04, 0, 1.03);
|
111
116
|
max-height: 0;
|
112
|
-
margin-top:
|
113
|
-
margin-bottom:
|
117
|
+
margin-top: 0;
|
118
|
+
margin-bottom: 0;
|
114
119
|
padding-top: 0;
|
115
120
|
padding-bottom: 0;
|
116
121
|
border: 0;
|
@@ -10,10 +10,10 @@
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import {
|
14
|
-
import {
|
13
|
+
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
14
|
+
import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
|
15
15
|
|
16
|
-
export {
|
16
|
+
export {NotifyStyleSheet}
|
17
17
|
|
18
18
|
/**
|
19
19
|
* @private
|
@@ -22,17 +22,10 @@ export { NotifyStyleSheet };
|
|
22
22
|
const NotifyStyleSheet = new CSSStyleSheet();
|
23
23
|
|
24
24
|
try {
|
25
|
-
|
26
|
-
`
|
25
|
+
NotifyStyleSheet.insertRule(`
|
27
26
|
@layer notify {
|
28
|
-
.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)}[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}div[data-monster-role=control]{align-items:flex-start;border:0;box-sizing:border-box;display:flex;flex-direction:row;justify-content:space-between;margin:0;max-height:100vH;pointer-events:none;
|
29
|
-
}`,
|
30
|
-
0,
|
31
|
-
);
|
27
|
+
.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)}[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}div[data-monster-role=control]{align-items:flex-start;border:0;box-sizing:border-box;display:flex;flex-direction:row;justify-content:space-between;margin:0;max-height:100vH;pointer-events:none;right:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:25rem;z-index:var(--monster-z-index-modal-overlay)}div[data-monster-role=control]:not(.inline){position:absolute}div[data-monster-role=control].inline{--monster-message-border-shadow:none}[data-monster-role=control][data-monster-orientation*=left]{left:0;right:auto}[data-monster-role=control][data-monster-orientation*=right]{left:auto;right:0}[data-monster-role=control][data-monster-orientation*=center]{left:50%;transform:translate(-50%)}[data-monster-role=control][data-monster-orientation*=bottom]{align-items:flex-end;bottom:0}[data-monster-role=control][data-monster-orientation*=top]{align-items:flex-start;top:0}[data-monster-role=container]{width:100%}[data-monster-role=message]{background-clip:padding-box;background-color:var(--monster-bg-color-primary-1);border-color:var(--monster-message-border-color,rgba(0,0,0,.1));border-radius:var(--monster-message-border-radius,.25rem);border-style:var(--monster-message-border-style,solid);border-width:var(--monster-message-border-width,1px);box-shadow:var(--monster-message-border-shadow,0 .5rem 1rem rgba(0,0,0,.15));color:var(--monster-color-primary-1);display:flex;font-size:.875rem;margin:var(--monster-message-margin-top,15px) var(--monster-message-margin-right,5px) var(--monster-message-margin-bottom,0) var(--monster-message-margin-left,0);max-height:200px;max-width:100%;overflow:hidden;padding:var(--monster-message-padding-top,5px) var(--monster-message-padding-right,5px) var(--monster-message-padding-bottom,5px) var(--monster-message-padding-left,5px);pointer-events:auto;position:relative;text-overflow:ellipsis;-webkit-user-select:text;-moz-user-select:text;user-select:text;width:100%}[data-monster-role=message]:first-child{margin-top:0}[data-monster-role=message].fadeout{border:0;margin-bottom:0;margin-top:0;max-height:0;padding-bottom:0;padding-top:0;transition:all .2s cubic-bezier(1,-.04,0,1.03)}
|
28
|
+
}`, 0);
|
32
29
|
} catch (e) {
|
33
|
-
|
34
|
-
document.getRootNode().querySelector("html"),
|
35
|
-
ATTRIBUTE_ERRORMESSAGE,
|
36
|
-
e + "",
|
37
|
-
);
|
30
|
+
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
|
38
31
|
}
|
@@ -21,7 +21,7 @@ import {
|
|
21
21
|
} from "../../dom/customelement.mjs";
|
22
22
|
import { LogStyleSheet } from "./stylesheet/log.mjs";
|
23
23
|
import { Entry } from "./log/entry.mjs";
|
24
|
-
import {
|
24
|
+
import {validateInstance, validateString} from "../../types/validate.mjs";
|
25
25
|
import "./state.mjs";
|
26
26
|
|
27
27
|
export { Log };
|
@@ -39,14 +39,16 @@ const logElementSymbol = Symbol("logElement");
|
|
39
39
|
const emptyStateElementSymbol = Symbol("emptyStateElement");
|
40
40
|
|
41
41
|
/**
|
42
|
-
* A
|
42
|
+
* A log entry
|
43
43
|
*
|
44
|
-
* @fragments /fragments/components/
|
44
|
+
* @fragments /fragments/components/state/log
|
45
|
+
*
|
46
|
+
* @example /examples/components/state/log-simple
|
45
47
|
*
|
46
48
|
* @since 3.74.0
|
47
49
|
* @copyright schukai GmbH
|
48
|
-
* @summary
|
49
|
-
|
50
|
+
* @summary The log entry is a single entry in the log.
|
51
|
+
**/
|
50
52
|
class Log extends CustomElement {
|
51
53
|
/**
|
52
54
|
* @return {void}
|
@@ -116,7 +118,7 @@ class Log extends CustomElement {
|
|
116
118
|
|
117
119
|
/**
|
118
120
|
* Add an entry to the log
|
119
|
-
* @param entry
|
121
|
+
* @param {Entry} entry
|
120
122
|
* @return {Log}
|
121
123
|
*/
|
122
124
|
addEntry(entry) {
|
@@ -133,15 +135,19 @@ class Log extends CustomElement {
|
|
133
135
|
|
134
136
|
/**
|
135
137
|
* Add a log message
|
136
|
-
*
|
137
|
-
* @param
|
138
|
+
*
|
139
|
+
* @param {string} message
|
140
|
+
* @param {Date} date
|
138
141
|
* @return {Log}
|
142
|
+
* @throws {TypeError} message is not a string
|
139
143
|
*/
|
140
144
|
addMessage(message, date) {
|
141
145
|
if (!date) {
|
142
146
|
date = new Date();
|
143
147
|
}
|
144
148
|
|
149
|
+
validateString(message);
|
150
|
+
|
145
151
|
this.addEntry(
|
146
152
|
new Entry({
|
147
153
|
message: message,
|
@@ -213,43 +219,40 @@ function initEventHandler() {
|
|
213
219
|
*/
|
214
220
|
function getTemplate() {
|
215
221
|
// language=HTML
|
216
|
-
return
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
<
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
<path d="m404.800781 68.175781c2.628907 0 5.199219-1.070312 7.070313-2.933593 1.859375-1.859376 2.929687-4.4375 2.929687-7.066407 0-2.632812-1.070312-5.210937-2.929687-7.070312-1.859375-1.863281-4.441406-2.929688-7.070313-2.929688-2.640625 0-5.210937 1.066407-7.070312 2.929688-1.871094 1.859375-2.929688 4.4375-2.929688 7.070312 0 2.628907 1.058594 5.207031 2.929688 7.066407 1.859375 1.863281 4.441406 2.933593 7.070312 2.933593zm0 0"/>
|
240
|
-
<path d="m256 314.925781c-2.628906 0-5.210938 1.066407-7.070312 2.929688-1.859376 1.867187-2.929688 4.4375-2.929688 7.070312 0 2.636719 1.070312 5.207031 2.929688 7.078125 1.859374 1.859375 4.441406 2.921875 7.070312 2.921875s5.210938-1.0625 7.070312-2.921875c1.859376-1.871094 2.929688-4.441406 2.929688-7.078125 0-2.632812-1.070312-5.203125-2.929688-7.070312-1.859374-1.863281-4.441406-2.929688-7.070312-2.929688zm0 0"/>
|
241
|
-
</svg>
|
242
|
-
</div>
|
243
|
-
<div part="content" monster-replace="path:labels.nothingToReport">
|
244
|
-
There is nothing to report yet.
|
245
|
-
</div>
|
246
|
-
</monster-state>
|
222
|
+
return `<template id="entry">
|
223
|
+
<li data-monster-role="entry">
|
224
|
+
<span data-monster-replace="path:entry.user"
|
225
|
+
data-monster-attributes="class path:entry.user | ?:user:hidden"></span>
|
226
|
+
<span data-monster-replace="path:entry.title"
|
227
|
+
data-monster-attributes="class path:entry.title | ?:title:hidden"></span>
|
228
|
+
<span data-monster-replace="path:entry.message"
|
229
|
+
data-monster-attributes="class path:entry.message | ?:message:hidden"></span>
|
230
|
+
<span data-monster-replace="path:entry.date | time-ago" data-monster-attributes="title path:entry.date | datetime"></span>
|
231
|
+
|
232
|
+
</li>
|
233
|
+
</template>
|
234
|
+
|
235
|
+
<div part="control" data-monster-role="control">
|
236
|
+
<div data-monster-role="empty-state" data-monster-attributes="class path:entries | has-entries | ?:hidden:">
|
237
|
+
<monster-state>
|
238
|
+
<div part="visual">
|
239
|
+
<svg width="4rem" height="4rem" viewBox="0 -12 512.00032 512"
|
240
|
+
xmlns="http://www.w3.org/2000/svg">
|
241
|
+
<path d="m455.074219 172.613281 53.996093-53.996093c2.226563-2.222657 3.273438-5.367188 2.828126-8.480469-.441407-3.113281-2.328126-5.839844-5.085938-7.355469l-64.914062-35.644531c-4.839844-2.65625-10.917969-.886719-13.578126 3.953125-2.65625 4.84375-.890624 10.921875 3.953126 13.578125l53.234374 29.230469-46.339843 46.335937-166.667969-91.519531 46.335938-46.335938 46.839843 25.722656c4.839844 2.65625 10.921875.890626 13.578125-3.953124 2.660156-4.839844.890625-10.921876-3.953125-13.578126l-53.417969-29.335937c-3.898437-2.140625-8.742187-1.449219-11.882812 1.695313l-54 54-54-54c-3.144531-3.144532-7.988281-3.832032-11.882812-1.695313l-184.929688 101.546875c-2.757812 1.515625-4.644531 4.238281-5.085938 7.355469-.445312 3.113281.601563 6.257812 2.828126 8.480469l53.996093 53.996093-53.996093 53.992188c-2.226563 2.226562-3.273438 5.367187-2.828126 8.484375.441407 3.113281 2.328126 5.839844 5.085938 7.351562l55.882812 30.6875v102.570313c0 3.652343 1.988282 7.011719 5.1875 8.769531l184.929688 101.542969c1.5.824219 3.15625 1.234375 4.8125 1.234375s3.3125-.410156 4.8125-1.234375l184.929688-101.542969c3.199218-1.757812 5.1875-5.117188 5.1875-8.769531v-102.570313l55.882812-30.683594c2.757812-1.515624 4.644531-4.242187 5.085938-7.355468.445312-3.113282-.601563-6.257813-2.828126-8.480469zm-199.074219 90.132813-164.152344-90.136719 164.152344-90.140625 164.152344 90.140625zm-62.832031-240.367188 46.332031 46.335938-166.667969 91.519531-46.335937-46.335937zm-120.328125 162.609375 166.667968 91.519531-46.339843 46.339844-166.671875-91.519531zm358.089844 184.796875-164.929688 90.5625v-102.222656c0-5.523438-4.476562-10-10-10s-10 4.476562-10 10v102.222656l-164.929688-90.5625v-85.671875l109.046876 59.878907c1.511718.828124 3.167968 1.234374 4.808593 1.234374 2.589844 0 5.152344-1.007812 7.074219-2.929687l54-54 54 54c1.921875 1.925781 4.484375 2.929687 7.074219 2.929687 1.640625 0 3.296875-.40625 4.808593-1.234374l109.046876-59.878907zm-112.09375-46.9375-46.339844-46.34375 166.667968-91.515625 46.34375 46.335938zm0 0"/>
|
242
|
+
<path d="m404.800781 68.175781c2.628907 0 5.199219-1.070312 7.070313-2.933593 1.859375-1.859376 2.929687-4.4375 2.929687-7.066407 0-2.632812-1.070312-5.210937-2.929687-7.070312-1.859375-1.863281-4.441406-2.929688-7.070313-2.929688-2.640625 0-5.210937 1.066407-7.070312 2.929688-1.871094 1.859375-2.929688 4.4375-2.929688 7.070312 0 2.628907 1.058594 5.207031 2.929688 7.066407 1.859375 1.863281 4.441406 2.933593 7.070312 2.933593zm0 0"/>
|
243
|
+
<path d="m256 314.925781c-2.628906 0-5.210938 1.066407-7.070312 2.929688-1.859376 1.867187-2.929688 4.4375-2.929688 7.070312 0 2.636719 1.070312 5.207031 2.929688 7.078125 1.859374 1.859375 4.441406 2.921875 7.070312 2.921875s5.210938-1.0625 7.070312-2.921875c1.859376-1.871094 2.929688-4.441406 2.929688-7.078125 0-2.632812-1.070312-5.203125-2.929688-7.070312-1.859374-1.863281-4.441406-2.929688-7.070312-2.929688zm0 0"/>
|
244
|
+
</svg>
|
247
245
|
</div>
|
248
|
-
<div data-monster-
|
249
|
-
|
250
|
-
</ul>
|
246
|
+
<div part="content" data-monster-replace="path:labels.nothingToReport">
|
247
|
+
There is nothing to report yet.
|
251
248
|
</div>
|
252
|
-
</
|
249
|
+
</monster-state>
|
250
|
+
</div>
|
251
|
+
<div data-monster-role="entries">
|
252
|
+
<ul data-monster-insert="entry path:entries">
|
253
|
+
</ul>
|
254
|
+
</div>
|
255
|
+
</div>
|
253
256
|
`;
|
254
257
|
}
|
255
258
|
|