@schukai/monster 3.39.1 → 3.42.1
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -5,19 +5,19 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import {
|
20
|
-
import {
|
8
|
+
import {internalSymbol} from "../constants.mjs";
|
9
|
+
import {extend} from "../data/extend.mjs";
|
10
|
+
import {Pathfinder} from "../data/pathfinder.mjs";
|
11
|
+
import {Formatter} from "../text/formatter.mjs";
|
12
|
+
|
13
|
+
import {parseDataURL} from "../types/dataurl.mjs";
|
14
|
+
import {getGlobalObject} from "../types/global.mjs";
|
15
|
+
import {isArray, isFunction, isIterable, isObject, isString} from "../types/is.mjs";
|
16
|
+
import {Observer} from "../types/observer.mjs";
|
17
|
+
import {ProxyObserver} from "../types/proxyobserver.mjs";
|
18
|
+
import {validateFunction, validateInstance, validateObject, validateString} from "../types/validate.mjs";
|
19
|
+
import {clone} from "../util/clone.mjs";
|
20
|
+
import {addAttributeToken, getLinkedObjects, hasObjectLink} from "./attributes.mjs";
|
21
21
|
import {
|
22
22
|
ATTRIBUTE_DISABLED,
|
23
23
|
ATTRIBUTE_ERRORMESSAGE,
|
@@ -25,11 +25,11 @@ import {
|
|
25
25
|
ATTRIBUTE_OPTIONS_SELECTOR,
|
26
26
|
customElementUpdaterLinkSymbol,
|
27
27
|
} from "./constants.mjs";
|
28
|
-
import {
|
29
|
-
import {
|
30
|
-
import {
|
31
|
-
import {
|
32
|
-
import {
|
28
|
+
import {findDocumentTemplate, Template} from "./template.mjs";
|
29
|
+
import {addObjectWithUpdaterToElement} from "./updater.mjs";
|
30
|
+
import {instanceSymbol} from "../constants.mjs";
|
31
|
+
import {getDocumentTranslations, Translations} from "../i18n/translations.mjs";
|
32
|
+
import {getSlottedElements} from "./slotted.mjs";
|
33
33
|
import {initOptionsFromAttributes} from "./util/init-options-from-attributes.mjs";
|
34
34
|
|
35
35
|
export {
|
@@ -203,6 +203,7 @@ class CustomElement extends HTMLElement {
|
|
203
203
|
this[internalSymbol] = new ProxyObserver({
|
204
204
|
options: initOptionsFromAttributes(this, extend({}, this.defaults)),
|
205
205
|
});
|
206
|
+
initAttributeChangeMutationObserver.call(this);
|
206
207
|
initOptionObserver.call(this);
|
207
208
|
this[initMethodSymbol]();
|
208
209
|
}
|
@@ -217,7 +218,9 @@ class CustomElement extends HTMLElement {
|
|
217
218
|
}
|
218
219
|
|
219
220
|
/**
|
220
|
-
* This method determines which attributes are to be
|
221
|
+
* This method determines which attributes are to be
|
222
|
+
* monitored by `attributeChangedCallback()`. Unfortunately, this method is static.
|
223
|
+
* Therefore, the `observedAttributes` property cannot be changed during runtime.
|
221
224
|
*
|
222
225
|
* @return {string[]}
|
223
226
|
* @since 1.15.0
|
@@ -421,7 +424,8 @@ class CustomElement extends HTMLElement {
|
|
421
424
|
|
422
425
|
try {
|
423
426
|
value = new Pathfinder(this[internalSymbol].getRealSubject()["options"]).getVia(path);
|
424
|
-
} catch (e) {
|
427
|
+
} catch (e) {
|
428
|
+
}
|
425
429
|
|
426
430
|
if (value === undefined) return defaultValue;
|
427
431
|
return value;
|
@@ -491,7 +495,8 @@ class CustomElement extends HTMLElement {
|
|
491
495
|
try {
|
492
496
|
initShadowRoot.call(self);
|
493
497
|
elements = self.shadowRoot.childNodes;
|
494
|
-
} catch (e) {
|
498
|
+
} catch (e) {
|
499
|
+
}
|
495
500
|
|
496
501
|
try {
|
497
502
|
initCSSStylesheet.call(this);
|
@@ -542,7 +547,8 @@ class CustomElement extends HTMLElement {
|
|
542
547
|
* @return {void}
|
543
548
|
* @since 1.7.0
|
544
549
|
*/
|
545
|
-
disconnectedCallback() {
|
550
|
+
disconnectedCallback() {
|
551
|
+
}
|
546
552
|
|
547
553
|
/**
|
548
554
|
* The custom element has been moved into a new document (e.g. someone called document.adoptNode(el)).
|
@@ -550,7 +556,8 @@ class CustomElement extends HTMLElement {
|
|
550
556
|
* @return {void}
|
551
557
|
* @since 1.7.0
|
552
558
|
*/
|
553
|
-
adoptedCallback() {
|
559
|
+
adoptedCallback() {
|
560
|
+
}
|
554
561
|
|
555
562
|
/**
|
556
563
|
* Called when an observed attribute has been added, removed, updated, or replaced. Also called for initial
|
@@ -595,6 +602,36 @@ class CustomElement extends HTMLElement {
|
|
595
602
|
}
|
596
603
|
}
|
597
604
|
|
605
|
+
/**
|
606
|
+
* This method is called when the element is first created.
|
607
|
+
*
|
608
|
+
* @private
|
609
|
+
* @this CustomElement
|
610
|
+
*/
|
611
|
+
function initAttributeChangeMutationObserver() {
|
612
|
+
const self = this;
|
613
|
+
|
614
|
+
if (self[attributeObserverSymbol] === undefined) {
|
615
|
+
self[attributeObserverSymbol] = {};
|
616
|
+
}
|
617
|
+
|
618
|
+
if(Object.keys(self[attributeObserverSymbol]).length === 0) {
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
|
622
|
+
new MutationObserver(function (mutations) {
|
623
|
+
for (const mutation of mutations) {
|
624
|
+
if (mutation.type === "attributes") {
|
625
|
+
self.attributeChangedCallback(mutation.attributeName, mutation.oldValue, mutation.target.getAttribute(mutation.attributeName));
|
626
|
+
}
|
627
|
+
}
|
628
|
+
}).observe(self, {
|
629
|
+
attributes: true,
|
630
|
+
attributeOldValue: true,
|
631
|
+
attributeFilter: Object.keys(self[attributeObserverSymbol]),
|
632
|
+
});
|
633
|
+
}
|
634
|
+
|
598
635
|
/**
|
599
636
|
* @this CustomElement
|
600
637
|
* @private
|
@@ -787,7 +824,8 @@ function parseOptionsJSON(data) {
|
|
787
824
|
try {
|
788
825
|
let dataUrl = parseDataURL(data);
|
789
826
|
data = dataUrl.content;
|
790
|
-
} catch (e) {
|
827
|
+
} catch (e) {
|
828
|
+
}
|
791
829
|
|
792
830
|
try {
|
793
831
|
obj = JSON.parse(data);
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED