@schukai/monster 4.38.7 → 4.38.9
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 +19 -0
- package/package.json +1 -1
- package/source/components/content/viewer/message.mjs +40 -8
- package/source/components/datatable/datasource/dom.mjs +161 -161
- package/source/components/datatable/filter.mjs +1342 -1339
- package/source/components/datatable/pagination.mjs +490 -490
- package/source/components/style/property.css +264 -265
- package/source/components/tree-menu/tree-menu.mjs +444 -444
- package/source/dom/updater.mjs +842 -842
- package/source/monster.mjs +2 -0
- package/source/types/observer.mjs +111 -111
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +3 -3
package/source/monster.mjs
CHANGED
@@ -110,9 +110,11 @@ export * from "./components/accessibility/locale-picker.mjs";
|
|
110
110
|
export * from "./components/state/log/entry.mjs";
|
111
111
|
export * from "./components/state/state.mjs";
|
112
112
|
export * from "./components/state/log.mjs";
|
113
|
+
export * from "./components/navigation/wizard-navigation.mjs";
|
113
114
|
export * from "./components/navigation/table-of-content.mjs";
|
114
115
|
export * from "./components/data/metric-graph.mjs";
|
115
116
|
export * from "./components/data/metric.mjs";
|
117
|
+
export * from "./components/data/kpi-tile.mjs";
|
116
118
|
export * from "./components/constants.mjs";
|
117
119
|
export * from "./components/constants.mjs";
|
118
120
|
export * from "./text/formatter.mjs";
|
@@ -44,115 +44,115 @@ export { Observer };
|
|
44
44
|
* @since 1.0.0
|
45
45
|
*/
|
46
46
|
class Observer extends Base {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
47
|
+
/**
|
48
|
+
* Stores promises for updates that are scheduled but not yet executed.
|
49
|
+
* This prevents multiple executions for the same subject within one microtask cycle.
|
50
|
+
* @type {Map<object, Promise<*>>}
|
51
|
+
*/
|
52
|
+
#pendingUpdates = new Map();
|
53
|
+
#callback;
|
54
|
+
#arguments;
|
55
|
+
#tags = new TokenList();
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @param {function} callback The function to execute on update.
|
59
|
+
* @param {...*} args Additional arguments to pass to the callback.
|
60
|
+
*/
|
61
|
+
constructor(callback, ...args) {
|
62
|
+
super();
|
63
|
+
|
64
|
+
if (typeof callback !== "function") {
|
65
|
+
throw new Error("Observer callback must be a function.");
|
66
|
+
}
|
67
|
+
|
68
|
+
this.#callback = callback;
|
69
|
+
this.#arguments = args;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* This method is called by the `instanceof` operator.
|
74
|
+
* @returns {symbol}
|
75
|
+
* @since 2.1.0
|
76
|
+
*/
|
77
|
+
static get [instanceSymbol]() {
|
78
|
+
return Symbol.for("@schukai/monster/types/observer");
|
79
|
+
}
|
80
|
+
|
81
|
+
// Getter for properties for cleaner access if needed
|
82
|
+
get callback() {
|
83
|
+
return this.#callback;
|
84
|
+
}
|
85
|
+
|
86
|
+
get arguments() {
|
87
|
+
return this.#arguments;
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Schedules the callback for execution with the given subject.
|
92
|
+
* If multiple updates for the same subject are requested in the same event loop tick,
|
93
|
+
* the callback is only executed once. All callers will receive the same promise.
|
94
|
+
*
|
95
|
+
* @param {object} subject The subject object that triggered the update.
|
96
|
+
* @returns {Promise<*>} A promise that resolves with the return value of the callback,
|
97
|
+
* or rejects if the callback throws an error.
|
98
|
+
*/
|
99
|
+
update(subject) {
|
100
|
+
if (!isObject(subject)) {
|
101
|
+
return Promise.reject(new Error("Subject must be an object."));
|
102
|
+
}
|
103
|
+
|
104
|
+
if (this.#pendingUpdates.has(subject)) {
|
105
|
+
return this.#pendingUpdates.get(subject);
|
106
|
+
}
|
107
|
+
|
108
|
+
const promise = new Promise((resolve, reject) => {
|
109
|
+
queueMicrotask(async () => {
|
110
|
+
try {
|
111
|
+
const result = await this.#callback.apply(subject, this.#arguments);
|
112
|
+
resolve(result);
|
113
|
+
} catch (e) {
|
114
|
+
reject(e);
|
115
|
+
} finally {
|
116
|
+
this.#pendingUpdates.delete(subject);
|
117
|
+
}
|
118
|
+
});
|
119
|
+
});
|
120
|
+
|
121
|
+
this.#pendingUpdates.set(subject, promise);
|
122
|
+
|
123
|
+
return promise;
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @param {string} tag
|
128
|
+
* @returns {Observer}
|
129
|
+
*/
|
130
|
+
addTag(tag) {
|
131
|
+
this.#tags.add(tag);
|
132
|
+
return this;
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* @param {string} tag
|
137
|
+
* @returns {Observer}
|
138
|
+
*/
|
139
|
+
removeTag(tag) {
|
140
|
+
this.#tags.remove(tag);
|
141
|
+
return this;
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* @returns {string[]}
|
146
|
+
*/
|
147
|
+
getTags() {
|
148
|
+
return this.#tags.entries();
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* @param {string} tag
|
153
|
+
* @returns {boolean}
|
154
|
+
*/
|
155
|
+
hasTag(tag) {
|
156
|
+
return this.#tags.contains(tag);
|
157
|
+
}
|
158
158
|
}
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/web/test.html
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
12
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 4.38.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 4.38.8</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update Mi 27. Aug 12:13:30 CEST 2025</div>
|
14
14
|
</div>
|
15
15
|
<div id="mocha-errors"
|
16
16
|
style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>
|