@schukai/monster 3.5.0 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/source/constants.mjs +4 -9
- package/source/constraints/abstract.mjs +4 -6
- package/source/constraints/abstractoperator.mjs +6 -12
- package/source/constraints/andoperator.mjs +3 -6
- package/source/constraints/invalid.mjs +3 -6
- package/source/constraints/isarray.mjs +6 -9
- package/source/constraints/isobject.mjs +4 -7
- package/source/constraints/namespace.mjs +1 -3
- package/source/constraints/oroperator.mjs +26 -25
- package/source/constraints/valid.mjs +3 -6
- package/source/data/buildmap.mjs +20 -36
- package/source/data/buildtree.mjs +29 -29
- package/source/data/datasource/namespace.mjs +1 -1
- package/source/data/datasource/server/restapi/writeerror.mjs +6 -6
- package/source/data/datasource/server/restapi.mjs +51 -65
- package/source/data/datasource/server/webconnect.mjs +26 -35
- package/source/data/datasource/server.mjs +16 -20
- package/source/data/datasource/storage/localstorage.mjs +8 -11
- package/source/data/datasource/storage/sessionstorage.mjs +8 -10
- package/source/data/datasource/storage.mjs +18 -22
- package/source/data/datasource.mjs +27 -43
- package/source/data/diff.mjs +20 -32
- package/source/data/extend.mjs +20 -14
- package/source/data/namespace.mjs +1 -3
- package/source/data/pathfinder.mjs +40 -67
- package/source/data/pipe.mjs +6 -10
- package/source/data/transformer.mjs +141 -157
- package/source/dom/assembler.mjs +6 -9
- package/source/dom/attributes.mjs +36 -48
- package/source/dom/constants.mjs +55 -71
- package/source/dom/customcontrol.mjs +16 -21
- package/source/dom/customelement.mjs +140 -164
- package/source/dom/events.mjs +17 -24
- package/source/dom/focusmanager.mjs +30 -48
- package/source/dom/locale.mjs +16 -19
- package/source/dom/namespace.mjs +1 -1
- package/source/dom/ready.mjs +7 -10
- package/source/dom/resource/data.mjs +38 -46
- package/source/dom/resource/link/namespace.mjs +1 -3
- package/source/dom/resource/link/stylesheet.mjs +7 -11
- package/source/dom/resource/link.mjs +36 -17
- package/source/dom/resource/namespace.mjs +1 -1
- package/source/dom/resource/script.mjs +23 -13
- package/source/dom/resource.mjs +47 -60
- package/source/dom/resourcemanager.mjs +36 -43
- package/source/dom/template.mjs +17 -24
- package/source/dom/theme.mjs +8 -12
- package/source/dom/updater.mjs +150 -196
- package/source/dom/util.mjs +11 -12
- package/source/dom/worker/factory.mjs +21 -25
- package/source/dom/worker/namespace.mjs +1 -1
- package/source/i18n/formatter.mjs +20 -24
- package/source/i18n/locale.mjs +40 -42
- package/source/i18n/namespace.mjs +1 -1
- package/source/i18n/provider.mjs +4 -7
- package/source/i18n/providers/embed.mjs +16 -26
- package/source/i18n/providers/fetch.mjs +30 -36
- package/source/i18n/translations.mjs +15 -22
- package/source/logging/handler/console.mjs +6 -10
- package/source/logging/handler.mjs +15 -18
- package/source/logging/logentry.mjs +8 -9
- package/source/logging/logger.mjs +73 -55
- package/source/logging/namespace.mjs +1 -1
- package/source/math/namespace.mjs +1 -1
- package/source/math/random.mjs +13 -14
- package/source/monster.mjs +132 -100
- package/source/net/namespace.mjs +1 -3
- package/source/net/webconnect/message.mjs +6 -8
- package/source/net/webconnect/namespace.mjs +1 -3
- package/source/net/webconnect.mjs +28 -39
- package/source/text/formatter.mjs +44 -55
- package/source/types/base.mjs +16 -26
- package/source/types/basewithoptions.mjs +8 -14
- package/source/types/binary.mjs +4 -5
- package/source/types/dataurl.mjs +19 -27
- package/source/types/global.mjs +14 -26
- package/source/types/id.mjs +4 -6
- package/source/types/is.mjs +11 -16
- package/source/types/mediatype.mjs +29 -44
- package/source/types/namespace.mjs +0 -1
- package/source/types/node.mjs +16 -22
- package/source/types/nodelist.mjs +10 -14
- package/source/types/noderecursiveiterator.mjs +11 -14
- package/source/types/observablequeue.mjs +13 -16
- package/source/types/observer.mjs +16 -23
- package/source/types/observerlist.mjs +18 -21
- package/source/types/proxyobserver.mjs +24 -37
- package/source/types/queue.mjs +8 -13
- package/source/types/randomid.mjs +10 -10
- package/source/types/regex.mjs +3 -5
- package/source/types/stack.mjs +4 -8
- package/source/types/tokenlist.mjs +24 -31
- package/source/types/typeof.mjs +5 -7
- package/source/types/uniquequeue.mjs +8 -13
- package/source/types/uuid.mjs +18 -25
- package/source/types/validate.mjs +26 -27
- package/source/types/version.mjs +17 -25
- package/source/util/clone.mjs +23 -32
- package/source/util/comparator.mjs +7 -15
- package/source/util/deadmansswitch.mjs +16 -23
- package/source/util/freeze.mjs +5 -7
- package/source/util/namespace.mjs +1 -1
- package/source/util/processing.mjs +33 -39
- package/source/util/trimspaces.mjs +17 -24
- package/test/cases/monster.mjs +1 -1
package/source/dom/constants.mjs
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
|
9
8
|
export {
|
10
9
|
DEFAULT_THEME,
|
11
10
|
ATTRIBUTE_PREFIX,
|
@@ -59,16 +58,15 @@ export {
|
|
59
58
|
ATTRIBUTE_EXPORTPARTS,
|
60
59
|
ATTRIBUTE_HIDDEN,
|
61
60
|
objectUpdaterLinkSymbol,
|
62
|
-
customElementUpdaterLinkSymbol
|
63
|
-
|
64
|
-
}
|
61
|
+
customElementUpdaterLinkSymbol,
|
62
|
+
};
|
65
63
|
|
66
64
|
/**
|
67
65
|
* default theme
|
68
66
|
* @memberOf Monster.DOM
|
69
67
|
* @type {string}
|
70
68
|
*/
|
71
|
-
const DEFAULT_THEME =
|
69
|
+
const DEFAULT_THEME = "monster";
|
72
70
|
|
73
71
|
/**
|
74
72
|
* @memberOf Monster.DOM
|
@@ -76,7 +74,7 @@ const DEFAULT_THEME = 'monster';
|
|
76
74
|
* @since 1.8.0
|
77
75
|
* @type {string}
|
78
76
|
*/
|
79
|
-
const ATTRIBUTE_PREFIX =
|
77
|
+
const ATTRIBUTE_PREFIX = "data-monster-";
|
80
78
|
|
81
79
|
/**
|
82
80
|
* This is the name of the attribute to pass options to a control
|
@@ -86,7 +84,7 @@ const ATTRIBUTE_PREFIX = 'data-monster-';
|
|
86
84
|
* @since 1.8.0
|
87
85
|
* @type {string}
|
88
86
|
*/
|
89
|
-
const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX
|
87
|
+
const ATTRIBUTE_OPTIONS = `${ATTRIBUTE_PREFIX}options`;
|
90
88
|
|
91
89
|
/**
|
92
90
|
* This is the name of the attribute to pass options to a control
|
@@ -96,7 +94,7 @@ const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options';
|
|
96
94
|
* @since 1.30.0
|
97
95
|
* @type {string}
|
98
96
|
*/
|
99
|
-
const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX
|
97
|
+
const ATTRIBUTE_OPTIONS_SELECTOR = `${ATTRIBUTE_PREFIX}options-selector`;
|
100
98
|
|
101
99
|
/**
|
102
100
|
* @memberOf Monster.DOM
|
@@ -104,13 +102,13 @@ const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector';
|
|
104
102
|
* @license AGPLv3
|
105
103
|
* @since 1.8.0
|
106
104
|
*/
|
107
|
-
const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX
|
105
|
+
const ATTRIBUTE_THEME_PREFIX = `${ATTRIBUTE_PREFIX}theme-`;
|
108
106
|
|
109
107
|
/**
|
110
108
|
* @memberOf Monster.DOM
|
111
109
|
* @type {string}
|
112
110
|
*/
|
113
|
-
const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX
|
111
|
+
const ATTRIBUTE_THEME_NAME = `${ATTRIBUTE_THEME_PREFIX}name`;
|
114
112
|
|
115
113
|
/**
|
116
114
|
* @memberOf Monster.DOM
|
@@ -118,7 +116,7 @@ const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name';
|
|
118
116
|
* @license AGPLv3
|
119
117
|
* @since 1.8.0
|
120
118
|
*/
|
121
|
-
const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX
|
119
|
+
const ATTRIBUTE_UPDATER_ATTRIBUTES = `${ATTRIBUTE_PREFIX}attributes`;
|
122
120
|
|
123
121
|
/**
|
124
122
|
* @memberOf Monster.DOM
|
@@ -126,7 +124,7 @@ const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes';
|
|
126
124
|
* @license AGPLv3
|
127
125
|
* @since 1.27.1
|
128
126
|
*/
|
129
|
-
const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX
|
127
|
+
const ATTRIBUTE_UPDATER_SELECT_THIS = `${ATTRIBUTE_PREFIX}select-this`;
|
130
128
|
|
131
129
|
/**
|
132
130
|
* @memberOf Monster.DOM
|
@@ -134,7 +132,7 @@ const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this';
|
|
134
132
|
* @license AGPLv3
|
135
133
|
* @since 1.8.0
|
136
134
|
*/
|
137
|
-
const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX
|
135
|
+
const ATTRIBUTE_UPDATER_REPLACE = `${ATTRIBUTE_PREFIX}replace`;
|
138
136
|
|
139
137
|
/**
|
140
138
|
* @memberOf Monster.DOM
|
@@ -142,7 +140,7 @@ const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace';
|
|
142
140
|
* @license AGPLv3
|
143
141
|
* @since 1.8.0
|
144
142
|
*/
|
145
|
-
const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX
|
143
|
+
const ATTRIBUTE_UPDATER_INSERT = `${ATTRIBUTE_PREFIX}insert`;
|
146
144
|
|
147
145
|
/**
|
148
146
|
* @memberOf Monster.DOM
|
@@ -150,7 +148,7 @@ const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert';
|
|
150
148
|
* @license AGPLv3
|
151
149
|
* @since 1.8.0
|
152
150
|
*/
|
153
|
-
const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX
|
151
|
+
const ATTRIBUTE_UPDATER_INSERT_REFERENCE = `${ATTRIBUTE_PREFIX}insert-reference`;
|
154
152
|
|
155
153
|
/**
|
156
154
|
* @memberOf Monster.DOM
|
@@ -158,7 +156,7 @@ const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX + 'insert-reference'
|
|
158
156
|
* @license AGPLv3
|
159
157
|
* @since 1.8.0
|
160
158
|
*/
|
161
|
-
const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX
|
159
|
+
const ATTRIBUTE_UPDATER_REMOVE = `${ATTRIBUTE_PREFIX}remove`;
|
162
160
|
|
163
161
|
/**
|
164
162
|
* @memberOf Monster.DOM
|
@@ -166,7 +164,7 @@ const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove';
|
|
166
164
|
* @license AGPLv3
|
167
165
|
* @since 1.9.0
|
168
166
|
*/
|
169
|
-
const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX
|
167
|
+
const ATTRIBUTE_UPDATER_BIND = `${ATTRIBUTE_PREFIX}bind`;
|
170
168
|
|
171
169
|
/**
|
172
170
|
* @memberOf Monster.DOM
|
@@ -174,7 +172,7 @@ const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind';
|
|
174
172
|
* @license AGPLv3
|
175
173
|
* @since 1.27.0
|
176
174
|
*/
|
177
|
-
const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX
|
175
|
+
const ATTRIBUTE_TEMPLATE_PREFIX = `${ATTRIBUTE_PREFIX}template-prefix`;
|
178
176
|
|
179
177
|
/**
|
180
178
|
* @memberOf Monster.DOM
|
@@ -182,7 +180,7 @@ const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix';
|
|
182
180
|
* @license AGPLv3
|
183
181
|
* @since 1.14.0
|
184
182
|
*/
|
185
|
-
const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX
|
183
|
+
const ATTRIBUTE_ROLE = `${ATTRIBUTE_PREFIX}role`;
|
186
184
|
|
187
185
|
/**
|
188
186
|
* @memberOf Monster.DOM
|
@@ -190,7 +188,7 @@ const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role';
|
|
190
188
|
* @license AGPLv3
|
191
189
|
* @since 1.24.0
|
192
190
|
*/
|
193
|
-
const ATTRIBUTE_DISABLED =
|
191
|
+
const ATTRIBUTE_DISABLED = "disabled";
|
194
192
|
|
195
193
|
/**
|
196
194
|
* @memberOf Monster.DOM
|
@@ -198,7 +196,7 @@ const ATTRIBUTE_DISABLED = 'disabled';
|
|
198
196
|
* @license AGPLv3
|
199
197
|
* @since 1.24.0
|
200
198
|
*/
|
201
|
-
const ATTRIBUTE_VALUE =
|
199
|
+
const ATTRIBUTE_VALUE = "value";
|
202
200
|
|
203
201
|
/**
|
204
202
|
* @memberOf Monster.DOM
|
@@ -206,7 +204,7 @@ const ATTRIBUTE_VALUE = 'value';
|
|
206
204
|
* @license AGPLv3
|
207
205
|
* @since 1.9.0
|
208
206
|
*/
|
209
|
-
const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX
|
207
|
+
const ATTRIBUTE_OBJECTLINK = `${ATTRIBUTE_PREFIX}objectlink`;
|
210
208
|
|
211
209
|
/**
|
212
210
|
* @memberOf Monster.DOM
|
@@ -214,7 +212,7 @@ const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink';
|
|
214
212
|
* @license AGPLv3
|
215
213
|
* @since 1.24.0
|
216
214
|
*/
|
217
|
-
const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX
|
215
|
+
const ATTRIBUTE_ERRORMESSAGE = `${ATTRIBUTE_PREFIX}error`;
|
218
216
|
|
219
217
|
/**
|
220
218
|
* @memberOf Monster.DOM
|
@@ -222,7 +220,7 @@ const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error';
|
|
222
220
|
* @license AGPLv3
|
223
221
|
* @since 1.24.0
|
224
222
|
*/
|
225
|
-
const objectUpdaterLinkSymbol = Symbol.for(
|
223
|
+
const objectUpdaterLinkSymbol = Symbol.for("@schukai/monster/dom/@@object-updater-link");
|
226
224
|
|
227
225
|
/**
|
228
226
|
* @memberOf Monster.DOM
|
@@ -230,7 +228,7 @@ const objectUpdaterLinkSymbol = Symbol.for('@schukai/monster/dom/@@object-update
|
|
230
228
|
* @license AGPLv3
|
231
229
|
* @since 1.24.0
|
232
230
|
*/
|
233
|
-
const customElementUpdaterLinkSymbol = Symbol.for(
|
231
|
+
const customElementUpdaterLinkSymbol = Symbol.for("@schukai/monster/dom/custom-element@@options-updater-link");
|
234
232
|
|
235
233
|
/**
|
236
234
|
* @memberOf Monster.DOM
|
@@ -238,7 +236,7 @@ const customElementUpdaterLinkSymbol = Symbol.for('@schukai/monster/dom/custom-e
|
|
238
236
|
* @license AGPLv3
|
239
237
|
* @since 1.25.0
|
240
238
|
*/
|
241
|
-
const TAG_SCRIPT =
|
239
|
+
const TAG_SCRIPT = "script";
|
242
240
|
|
243
241
|
/**
|
244
242
|
* @memberOf Monster.DOM
|
@@ -246,7 +244,7 @@ const TAG_SCRIPT = 'script';
|
|
246
244
|
* @license AGPLv3
|
247
245
|
* @since 1.25.0
|
248
246
|
*/
|
249
|
-
const TAG_STYLE =
|
247
|
+
const TAG_STYLE = "style";
|
250
248
|
|
251
249
|
/**
|
252
250
|
* @memberOf Monster.DOM
|
@@ -254,7 +252,7 @@ const TAG_STYLE = 'style';
|
|
254
252
|
* @license AGPLv3
|
255
253
|
* @since 1.25.0
|
256
254
|
*/
|
257
|
-
const TAG_LINK =
|
255
|
+
const TAG_LINK = "link";
|
258
256
|
|
259
257
|
/**
|
260
258
|
* @memberOf Monster.DOM
|
@@ -263,7 +261,7 @@ const TAG_LINK = 'link';
|
|
263
261
|
* @since 1.25.0
|
264
262
|
*/
|
265
263
|
|
266
|
-
const ATTRIBUTE_ID =
|
264
|
+
const ATTRIBUTE_ID = "id";
|
267
265
|
|
268
266
|
/**
|
269
267
|
* @memberOf Monster.DOM
|
@@ -272,7 +270,7 @@ const ATTRIBUTE_ID = 'id';
|
|
272
270
|
* @since 1.25.0
|
273
271
|
*/
|
274
272
|
|
275
|
-
const ATTRIBUTE_CLASS =
|
273
|
+
const ATTRIBUTE_CLASS = "class";
|
276
274
|
|
277
275
|
/**
|
278
276
|
* @memberOf Monster.DOM
|
@@ -280,7 +278,7 @@ const ATTRIBUTE_CLASS = 'class';
|
|
280
278
|
* @license AGPLv3
|
281
279
|
* @since 1.25.0
|
282
280
|
*/
|
283
|
-
const ATTRIBUTE_TITLE =
|
281
|
+
const ATTRIBUTE_TITLE = "title";
|
284
282
|
|
285
283
|
/**
|
286
284
|
* @memberOf Monster.DOM
|
@@ -288,14 +286,14 @@ const ATTRIBUTE_TITLE = 'title';
|
|
288
286
|
* @license AGPLv3
|
289
287
|
* @since 1.25.0
|
290
288
|
*/
|
291
|
-
const ATTRIBUTE_SRC =
|
289
|
+
const ATTRIBUTE_SRC = "src";
|
292
290
|
/**
|
293
291
|
* @memberOf Monster.DOM
|
294
292
|
* @type {string}
|
295
293
|
* @license AGPLv3
|
296
294
|
* @since 1.25.0
|
297
295
|
*/
|
298
|
-
const ATTRIBUTE_HREF =
|
296
|
+
const ATTRIBUTE_HREF = "href";
|
299
297
|
|
300
298
|
/**
|
301
299
|
* @memberOf Monster.DOM
|
@@ -303,7 +301,7 @@ const ATTRIBUTE_HREF = 'href';
|
|
303
301
|
* @license AGPLv3
|
304
302
|
* @since 1.25.0
|
305
303
|
*/
|
306
|
-
const ATTRIBUTE_TYPE =
|
304
|
+
const ATTRIBUTE_TYPE = "type";
|
307
305
|
|
308
306
|
/**
|
309
307
|
* @memberOf Monster.DOM
|
@@ -311,7 +309,7 @@ const ATTRIBUTE_TYPE = 'type';
|
|
311
309
|
* @license AGPLv3
|
312
310
|
* @since 1.25.0
|
313
311
|
*/
|
314
|
-
const ATTRIBUTE_NONCE =
|
312
|
+
const ATTRIBUTE_NONCE = "nonce";
|
315
313
|
|
316
314
|
/**
|
317
315
|
* @memberOf Monster.DOM
|
@@ -319,8 +317,7 @@ const ATTRIBUTE_NONCE = 'nonce';
|
|
319
317
|
* @license AGPLv3
|
320
318
|
* @since 1.25.0
|
321
319
|
*/
|
322
|
-
const ATTRIBUTE_TRANSLATE =
|
323
|
-
|
320
|
+
const ATTRIBUTE_TRANSLATE = "translate";
|
324
321
|
|
325
322
|
/**
|
326
323
|
* @memberOf Monster.DOM
|
@@ -328,8 +325,7 @@ const ATTRIBUTE_TRANSLATE = 'translate';
|
|
328
325
|
* @license AGPLv3
|
329
326
|
* @since 1.25.0
|
330
327
|
*/
|
331
|
-
const ATTRIBUTE_TABINDEX =
|
332
|
-
|
328
|
+
const ATTRIBUTE_TABINDEX = "tabindex";
|
333
329
|
|
334
330
|
/**
|
335
331
|
* @memberOf Monster.DOM
|
@@ -337,8 +333,7 @@ const ATTRIBUTE_TABINDEX = 'tabindex';
|
|
337
333
|
* @license AGPLv3
|
338
334
|
* @since 1.25.0
|
339
335
|
*/
|
340
|
-
const ATTRIBUTE_SPELLCHECK =
|
341
|
-
|
336
|
+
const ATTRIBUTE_SPELLCHECK = "spellcheck";
|
342
337
|
|
343
338
|
/**
|
344
339
|
* @memberOf Monster.DOM
|
@@ -346,8 +341,7 @@ const ATTRIBUTE_SPELLCHECK = 'spellcheck';
|
|
346
341
|
* @license AGPLv3
|
347
342
|
* @since 1.25.0
|
348
343
|
*/
|
349
|
-
const ATTRIBUTE_SLOT =
|
350
|
-
|
344
|
+
const ATTRIBUTE_SLOT = "slot";
|
351
345
|
|
352
346
|
/**
|
353
347
|
* @memberOf Monster.DOM
|
@@ -355,8 +349,7 @@ const ATTRIBUTE_SLOT = 'slot';
|
|
355
349
|
* @license AGPLv3
|
356
350
|
* @since 1.25.0
|
357
351
|
*/
|
358
|
-
const ATTRIBUTE_PART =
|
359
|
-
|
352
|
+
const ATTRIBUTE_PART = "part";
|
360
353
|
|
361
354
|
/**
|
362
355
|
* @memberOf Monster.DOM
|
@@ -364,8 +357,7 @@ const ATTRIBUTE_PART = 'part';
|
|
364
357
|
* @license AGPLv3
|
365
358
|
* @since 1.25.0
|
366
359
|
*/
|
367
|
-
const ATTRIBUTE_LANG =
|
368
|
-
|
360
|
+
const ATTRIBUTE_LANG = "lang";
|
369
361
|
|
370
362
|
/**
|
371
363
|
* @memberOf Monster.DOM
|
@@ -373,8 +365,7 @@ const ATTRIBUTE_LANG = 'lang';
|
|
373
365
|
* @license AGPLv3
|
374
366
|
* @since 1.25.0
|
375
367
|
*/
|
376
|
-
const ATTRIBUTE_ITEMTYPE =
|
377
|
-
|
368
|
+
const ATTRIBUTE_ITEMTYPE = "itemtype";
|
378
369
|
|
379
370
|
/**
|
380
371
|
* @memberOf Monster.DOM
|
@@ -382,8 +373,7 @@ const ATTRIBUTE_ITEMTYPE = 'itemtype';
|
|
382
373
|
* @license AGPLv3
|
383
374
|
* @since 1.25.0
|
384
375
|
*/
|
385
|
-
const ATTRIBUTE_ITEMSCOPE =
|
386
|
-
|
376
|
+
const ATTRIBUTE_ITEMSCOPE = "itemscope";
|
387
377
|
|
388
378
|
/**
|
389
379
|
* @memberOf Monster.DOM
|
@@ -391,8 +381,7 @@ const ATTRIBUTE_ITEMSCOPE = 'itemscope';
|
|
391
381
|
* @license AGPLv3
|
392
382
|
* @since 1.25.0
|
393
383
|
*/
|
394
|
-
const ATTRIBUTE_ITEMREF =
|
395
|
-
|
384
|
+
const ATTRIBUTE_ITEMREF = "itemref";
|
396
385
|
|
397
386
|
/**
|
398
387
|
* @memberOf Monster.DOM
|
@@ -400,8 +389,7 @@ const ATTRIBUTE_ITEMREF = 'itemref';
|
|
400
389
|
* @license AGPLv3
|
401
390
|
* @since 1.25.0
|
402
391
|
*/
|
403
|
-
const ATTRIBUTE_ITEMID =
|
404
|
-
|
392
|
+
const ATTRIBUTE_ITEMID = "itemid";
|
405
393
|
|
406
394
|
/**
|
407
395
|
* @memberOf Monster.DOM
|
@@ -409,8 +397,7 @@ const ATTRIBUTE_ITEMID = 'itemid';
|
|
409
397
|
* @license AGPLv3
|
410
398
|
* @since 1.25.0
|
411
399
|
*/
|
412
|
-
const ATTRIBUTE_ITEMPROP =
|
413
|
-
|
400
|
+
const ATTRIBUTE_ITEMPROP = "itemprop";
|
414
401
|
|
415
402
|
/**
|
416
403
|
* @memberOf Monster.DOM
|
@@ -418,8 +405,7 @@ const ATTRIBUTE_ITEMPROP = 'itemprop';
|
|
418
405
|
* @license AGPLv3
|
419
406
|
* @since 1.25.0
|
420
407
|
*/
|
421
|
-
const ATTRIBUTE_IS =
|
422
|
-
|
408
|
+
const ATTRIBUTE_IS = "is";
|
423
409
|
|
424
410
|
/**
|
425
411
|
* @memberOf Monster.DOM
|
@@ -427,8 +413,7 @@ const ATTRIBUTE_IS = 'is';
|
|
427
413
|
* @license AGPLv3
|
428
414
|
* @since 1.25.0
|
429
415
|
*/
|
430
|
-
const ATTRIBUTE_INPUTMODE =
|
431
|
-
|
416
|
+
const ATTRIBUTE_INPUTMODE = "inputmode";
|
432
417
|
|
433
418
|
/**
|
434
419
|
* @memberOf Monster.DOM
|
@@ -436,7 +421,7 @@ const ATTRIBUTE_INPUTMODE = 'inputmode';
|
|
436
421
|
* @license AGPLv3
|
437
422
|
* @since 1.25.0
|
438
423
|
*/
|
439
|
-
const ATTRIBUTE_ACCESSKEY =
|
424
|
+
const ATTRIBUTE_ACCESSKEY = "accesskey";
|
440
425
|
|
441
426
|
/**
|
442
427
|
* @memberOf Monster.DOM
|
@@ -444,7 +429,7 @@ const ATTRIBUTE_ACCESSKEY = 'accesskey';
|
|
444
429
|
* @license AGPLv3
|
445
430
|
* @since 1.25.0
|
446
431
|
*/
|
447
|
-
const ATTRIBUTE_AUTOCAPITALIZE =
|
432
|
+
const ATTRIBUTE_AUTOCAPITALIZE = "autocapitalize";
|
448
433
|
|
449
434
|
/**
|
450
435
|
* @memberOf Monster.DOM
|
@@ -452,7 +437,7 @@ const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize';
|
|
452
437
|
* @license AGPLv3
|
453
438
|
* @since 1.25.0
|
454
439
|
*/
|
455
|
-
const ATTRIBUTE_AUTOFOCUS =
|
440
|
+
const ATTRIBUTE_AUTOFOCUS = "autofocus";
|
456
441
|
|
457
442
|
/**
|
458
443
|
* @memberOf Monster.DOM
|
@@ -460,7 +445,7 @@ const ATTRIBUTE_AUTOFOCUS = 'autofocus';
|
|
460
445
|
* @license AGPLv3
|
461
446
|
* @since 1.25.0
|
462
447
|
*/
|
463
|
-
const ATTRIBUTE_CONTENTEDITABLE =
|
448
|
+
const ATTRIBUTE_CONTENTEDITABLE = "contenteditable";
|
464
449
|
|
465
450
|
/**
|
466
451
|
* @memberOf Monster.DOM
|
@@ -468,7 +453,7 @@ const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable';
|
|
468
453
|
* @license AGPLv3
|
469
454
|
* @since 1.25.0
|
470
455
|
*/
|
471
|
-
const ATTRIBUTE_DIR =
|
456
|
+
const ATTRIBUTE_DIR = "dir";
|
472
457
|
|
473
458
|
/**
|
474
459
|
* @memberOf Monster.DOM
|
@@ -476,8 +461,7 @@ const ATTRIBUTE_DIR = 'dir';
|
|
476
461
|
* @license AGPLv3
|
477
462
|
* @since 1.25.0
|
478
463
|
*/
|
479
|
-
const ATTRIBUTE_DRAGGABLE =
|
480
|
-
|
464
|
+
const ATTRIBUTE_DRAGGABLE = "draggable";
|
481
465
|
|
482
466
|
/**
|
483
467
|
* @memberOf Monster.DOM
|
@@ -485,18 +469,18 @@ const ATTRIBUTE_DRAGGABLE = 'draggable';
|
|
485
469
|
* @license AGPLv3
|
486
470
|
* @since 1.25.0
|
487
471
|
*/
|
488
|
-
const ATTRIBUTE_ENTERKEYHINT =
|
472
|
+
const ATTRIBUTE_ENTERKEYHINT = "enterkeyhint";
|
489
473
|
/**
|
490
474
|
* @memberOf Monster.DOM
|
491
475
|
* @type {string}
|
492
476
|
* @license AGPLv3
|
493
477
|
* @since 1.25.0
|
494
478
|
*/
|
495
|
-
const ATTRIBUTE_EXPORTPARTS =
|
479
|
+
const ATTRIBUTE_EXPORTPARTS = "exportparts";
|
496
480
|
/**
|
497
481
|
* @memberOf Monster.DOM
|
498
482
|
* @type {string}
|
499
483
|
* @license AGPLv3
|
500
484
|
* @since 1.25.0
|
501
485
|
*/
|
502
|
-
const ATTRIBUTE_HIDDEN =
|
486
|
+
const ATTRIBUTE_HIDDEN = "hidden";
|
@@ -5,17 +5,17 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {extend} from "../data/extend.mjs";
|
9
|
-
import {ATTRIBUTE_VALUE} from "./constants.mjs";
|
10
|
-
import {CustomElement, attributeObserverSymbol} from "./customelement.mjs";
|
11
|
-
import {instanceSymbol} from
|
12
|
-
export {CustomControl}
|
8
|
+
import { extend } from "../data/extend.mjs";
|
9
|
+
import { ATTRIBUTE_VALUE } from "./constants.mjs";
|
10
|
+
import { CustomElement, attributeObserverSymbol } from "./customelement.mjs";
|
11
|
+
import { instanceSymbol } from "../constants.mjs";
|
12
|
+
export { CustomControl };
|
13
13
|
|
14
14
|
/**
|
15
15
|
* @private
|
16
16
|
* @type {symbol}
|
17
17
|
*/
|
18
|
-
const attachedInternalSymbol = Symbol(
|
18
|
+
const attachedInternalSymbol = Symbol("attachedInternal");
|
19
19
|
|
20
20
|
/**
|
21
21
|
* To define a new HTML control we need the power of CustomElement
|
@@ -47,7 +47,6 @@ const attachedInternalSymbol = Symbol('attachedInternal');
|
|
47
47
|
* @memberOf Monster.DOM
|
48
48
|
*/
|
49
49
|
class CustomControl extends CustomElement {
|
50
|
-
|
51
50
|
/**
|
52
51
|
* IMPORTANT: CustomControls instances are not created via the constructor, but either via a tag in the HTML or via <code>document.createElement()</code>.
|
53
52
|
*
|
@@ -57,7 +56,7 @@ class CustomControl extends CustomElement {
|
|
57
56
|
constructor() {
|
58
57
|
super();
|
59
58
|
|
60
|
-
if (typeof this[
|
59
|
+
if (typeof this["attachInternals"] === "function") {
|
61
60
|
/**
|
62
61
|
* currently only supported by chrome
|
63
62
|
* @property {Object}
|
@@ -67,7 +66,6 @@ class CustomControl extends CustomElement {
|
|
67
66
|
}
|
68
67
|
|
69
68
|
initObserver.call(this);
|
70
|
-
|
71
69
|
}
|
72
70
|
|
73
71
|
/**
|
@@ -79,7 +77,6 @@ class CustomControl extends CustomElement {
|
|
79
77
|
return Symbol.for("@schukai/monster/dom/custom-control");
|
80
78
|
}
|
81
79
|
|
82
|
-
|
83
80
|
/**
|
84
81
|
* This method determines which attributes are to be monitored by `attributeChangedCallback()`.
|
85
82
|
*
|
@@ -90,8 +87,8 @@ class CustomControl extends CustomElement {
|
|
90
87
|
const list = super.observedAttributes;
|
91
88
|
list.push(ATTRIBUTE_VALUE);
|
92
89
|
return list;
|
93
|
-
}
|
94
|
-
|
90
|
+
}
|
91
|
+
|
95
92
|
/**
|
96
93
|
*
|
97
94
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
|
@@ -131,7 +128,7 @@ class CustomControl extends CustomElement {
|
|
131
128
|
* @throws {Error} the value getter must be overwritten by the derived class
|
132
129
|
*/
|
133
130
|
get value() {
|
134
|
-
throw Error(
|
131
|
+
throw Error("the value getter must be overwritten by the derived class");
|
135
132
|
}
|
136
133
|
|
137
134
|
/**
|
@@ -144,7 +141,7 @@ class CustomControl extends CustomElement {
|
|
144
141
|
* @throws {Error} the value setter must be overwritten by the derived class
|
145
142
|
*/
|
146
143
|
set value(value) {
|
147
|
-
throw Error(
|
144
|
+
throw Error("the value setter must be overwritten by the derived class");
|
148
145
|
}
|
149
146
|
|
150
147
|
/**
|
@@ -165,7 +162,7 @@ class CustomControl extends CustomElement {
|
|
165
162
|
* @return {string|null}
|
166
163
|
*/
|
167
164
|
get name() {
|
168
|
-
return this.getAttribute(
|
165
|
+
return this.getAttribute("name");
|
169
166
|
}
|
170
167
|
|
171
168
|
/**
|
@@ -301,7 +298,6 @@ class CustomControl extends CustomElement {
|
|
301
298
|
reportValidity() {
|
302
299
|
return getInternal.call(this)?.reportValidity();
|
303
300
|
}
|
304
|
-
|
305
301
|
}
|
306
302
|
|
307
303
|
/**
|
@@ -314,7 +310,7 @@ function getInternal() {
|
|
314
310
|
const self = this;
|
315
311
|
|
316
312
|
if (!(attachedInternalSymbol in this)) {
|
317
|
-
throw new Error(
|
313
|
+
throw new Error("ElementInternals is not supported and a polyfill is necessary");
|
318
314
|
}
|
319
315
|
|
320
316
|
return this[attachedInternalSymbol];
|
@@ -329,8 +325,7 @@ function initObserver() {
|
|
329
325
|
const self = this;
|
330
326
|
|
331
327
|
// value
|
332
|
-
self[attributeObserverSymbol][
|
333
|
-
self.setOption(
|
334
|
-
}
|
335
|
-
|
328
|
+
self[attributeObserverSymbol]["value"] = () => {
|
329
|
+
self.setOption("value", self.getAttribute("value"));
|
330
|
+
};
|
336
331
|
}
|