@twobirds/microcomponents 0.1.1 → 0.1.2
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/dist/MC.min.js +33 -52
- package/dist/elements.min.js +1 -1
- package/dist/formValues.min.js +1 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.min.js +1 -1
- package/package.json +11 -2
- package/.gitlab-ci.yml +0 -18
- package/.vscode/settings.json +0 -3
- package/MicroComponents.svg +0 -15
- package/assets/documentation/MC.md +0 -547
- package/assets/documentation/MicroComponents.svg +0 -15
- package/assets/documentation/ajaxian-1.png +0 -0
- package/assets/documentation/ajaxian-2.png +0 -0
- package/assets/documentation/ajaxian-3.png +0 -0
- package/assets/documentation/elements.md +0 -277
- package/assets/documentation/formvalues.md +0 -25
- package/assets/documentation/functional_requirements.md +0 -8
- package/assets/documentation/history.md +0 -436
- package/assets/documentation/klemmstein.png +0 -0
- package/assets/documentation/magic.md +0 -29
- package/assets/documentation/observables.md +0 -187
- package/assets/documentation/rnd0023-1.jpg +0 -0
- package/assets/documentation/rnd0023-2.jpg +0 -0
- package/assets/documentation/rnd0023-3.jpg +0 -0
- package/assets/documentation/tB_react.md +0 -207
- package/assets/documentation/usage.md +0 -142
- package/assets/documentation/why.md +0 -25
- package/assets/fiddle/MicroComponents.svg +0 -15
- package/assets/fiddle/fiddle.css +0 -0
- package/assets/fiddle/fiddle.js +0 -0
- package/assets/fiddle/index.html +0 -0
- package/assets/test/MicroComponents.svg +0 -15
- package/assets/test/grandparent.css +0 -16
- package/assets/test/myButton.css +0 -19
- package/assets/test/style.css +0 -8
- package/assets/test/test.html +0 -29
- package/assets/test/testform.json +0 -27
- package/public/.nojekyll +0 -1
- package/public/MC.d.ts +0 -39
- package/public/MC.d.ts.map +0 -1
- package/public/MC.js +0 -287
- package/public/MC.js.map +0 -1
- package/public/MC.min.js +0 -348
- package/public/MC.ts +0 -431
- package/public/MicroComponents.svg +0 -15
- package/public/documentation/MC.md +0 -547
- package/public/documentation/MicroComponents.svg +0 -15
- package/public/documentation/ajaxian-1.png +0 -0
- package/public/documentation/ajaxian-2.png +0 -0
- package/public/documentation/ajaxian-3.png +0 -0
- package/public/documentation/elements.md +0 -277
- package/public/documentation/formvalues.md +0 -25
- package/public/documentation/functional_requirements.md +0 -8
- package/public/documentation/history.md +0 -436
- package/public/documentation/klemmstein.png +0 -0
- package/public/documentation/magic.md +0 -29
- package/public/documentation/observables.md +0 -187
- package/public/documentation/rnd0023-1.jpg +0 -0
- package/public/documentation/rnd0023-2.jpg +0 -0
- package/public/documentation/rnd0023-3.jpg +0 -0
- package/public/documentation/tB_react.md +0 -207
- package/public/documentation/usage.md +0 -142
- package/public/documentation/why.md +0 -25
- package/public/elements.d.ts +0 -5
- package/public/elements.d.ts.map +0 -1
- package/public/elements.js +0 -68
- package/public/elements.js.map +0 -1
- package/public/elements.min.js +0 -1
- package/public/elements.ts +0 -119
- package/public/fiddle/MicroComponents.svg +0 -15
- package/public/fiddle/fiddle.css +0 -0
- package/public/fiddle/fiddle.js +0 -0
- package/public/fiddle/index.html +0 -0
- package/public/formValues.d.ts +0 -3
- package/public/formValues.d.ts.map +0 -1
- package/public/formValues.js +0 -162
- package/public/formValues.js.map +0 -1
- package/public/formValues.min.js +0 -1
- package/public/formValues.ts +0 -225
- package/public/helpers.d.ts +0 -14
- package/public/helpers.d.ts.map +0 -1
- package/public/helpers.js +0 -113
- package/public/helpers.js.map +0 -1
- package/public/helpers.ts +0 -149
- package/public/microcomponents.d.ts +0 -6
- package/public/microcomponents.d.ts.map +0 -1
- package/public/microcomponents.js +0 -7
- package/public/microcomponents.js.map +0 -1
- package/public/microcomponents.min.js +0 -1
- package/public/microcomponents.ts +0 -8
- package/public/observables.d.ts +0 -11
- package/public/observables.d.ts.map +0 -1
- package/public/observables.js +0 -244
- package/public/observables.js.map +0 -1
- package/public/observables.min.js +0 -1
- package/public/observables.ts +0 -416
- package/public/selectors._ts +0 -1269
- package/public/src/MC.d.ts +0 -39
- package/public/src/MC.d.ts.map +0 -1
- package/public/src/MC.js +0 -287
- package/public/src/MC.js.map +0 -1
- package/public/src/MC.ts +0 -431
- package/public/src/elements.d.ts +0 -5
- package/public/src/elements.d.ts.map +0 -1
- package/public/src/elements.js +0 -68
- package/public/src/elements.js.map +0 -1
- package/public/src/elements.ts +0 -119
- package/public/src/formValues.d.ts +0 -3
- package/public/src/formValues.d.ts.map +0 -1
- package/public/src/formValues.js +0 -162
- package/public/src/formValues.js.map +0 -1
- package/public/src/formValues.ts +0 -225
- package/public/src/helpers.d.ts +0 -14
- package/public/src/helpers.d.ts.map +0 -1
- package/public/src/helpers.js +0 -113
- package/public/src/helpers.js.map +0 -1
- package/public/src/helpers.ts +0 -149
- package/public/src/microcomponents.d.ts +0 -6
- package/public/src/microcomponents.d.ts.map +0 -1
- package/public/src/microcomponents.js +0 -7
- package/public/src/microcomponents.js.map +0 -1
- package/public/src/microcomponents.ts +0 -8
- package/public/src/observables.d.ts +0 -11
- package/public/src/observables.d.ts.map +0 -1
- package/public/src/observables.js +0 -244
- package/public/src/observables.js.map +0 -1
- package/public/src/observables.ts +0 -416
- package/public/src/selectors._ts +0 -1269
- package/public/src/test/grandparent.css +0 -14
- package/public/src/test/test/child.d.ts +0 -2
- package/public/src/test/test/child.d.ts.map +0 -1
- package/public/src/test/test/child.js +0 -26
- package/public/src/test/test/child.js.map +0 -1
- package/public/src/test/test/child.ts +0 -36
- package/public/src/test/test/grandchild.d.ts +0 -2
- package/public/src/test/test/grandchild.d.ts.map +0 -1
- package/public/src/test/test/grandchild.js +0 -22
- package/public/src/test/test/grandchild.js.map +0 -1
- package/public/src/test/test/grandchild.ts +0 -31
- package/public/src/test/test/grandparent.d.ts +0 -2
- package/public/src/test/test/grandparent.d.ts.map +0 -1
- package/public/src/test/test/grandparent.js +0 -1
- package/public/src/test/test/grandparent.js.map +0 -1
- package/public/src/test/test/grandparent.ts +0 -43
- package/public/src/test/test/greatgrandchild.d.ts +0 -2
- package/public/src/test/test/greatgrandchild.d.ts.map +0 -1
- package/public/src/test/test/greatgrandchild.js +0 -36
- package/public/src/test/test/greatgrandchild.js.map +0 -1
- package/public/src/test/test/greatgrandchild.ts +0 -51
- package/public/src/test/test/parent.d.ts +0 -2
- package/public/src/test/test/parent.d.ts.map +0 -1
- package/public/src/test/test/parent.js +0 -25
- package/public/src/test/test/parent.js.map +0 -1
- package/public/src/test/test/parent.ts +0 -35
- package/public/src/test/test/testform.d.ts +0 -2
- package/public/src/test/test/testform.d.ts.map +0 -1
- package/public/src/test/test/testform.js +0 -1
- package/public/src/test/test/testform.js.map +0 -1
- package/public/src/test/test/testform.ts +0 -153
- package/public/src/test/test/testfunction.d.ts +0 -3
- package/public/src/test/test/testfunction.d.ts.map +0 -1
- package/public/src/test/test/testfunction.js +0 -7
- package/public/src/test/test/testfunction.js.map +0 -1
- package/public/src/test/test/testfunction.ts +0 -12
- package/public/src/test/test/testmc.d.ts +0 -3
- package/public/src/test/test/testmc.d.ts.map +0 -1
- package/public/src/test/test/testmc.js +0 -10
- package/public/src/test/test/testmc.js.map +0 -1
- package/public/src/test/test/testmc.ts +0 -16
- package/public/src/test/test/testsimpleclass.d.ts +0 -3
- package/public/src/test/test/testsimpleclass.d.ts.map +0 -1
- package/public/src/test/test/testsimpleclass.js +0 -9
- package/public/src/test/test/testsimpleclass.js.map +0 -1
- package/public/src/test/test/testsimpleclass.ts +0 -15
- package/public/src/test/test.d.ts +0 -2
- package/public/src/test/test.d.ts.map +0 -1
- package/public/src/test/test.js +0 -72
- package/public/src/test/test.js.map +0 -1
- package/public/src/test/test.ts +0 -176
- package/public/src/test/testform.css +0 -47
- package/public/src/test/testform.html +0 -56
- package/public/src/test/testform.json +0 -27
- package/public/test/MC.d.ts +0 -39
- package/public/test/MC.d.ts.map +0 -1
- package/public/test/MC.js +0 -287
- package/public/test/MC.min.js +0 -348
- package/public/test/MC.ts +0 -431
- package/public/test/MicroComponents.svg +0 -15
- package/public/test/elements.d.ts +0 -5
- package/public/test/elements.d.ts.map +0 -1
- package/public/test/elements.js +0 -68
- package/public/test/elements.min.js +0 -1
- package/public/test/elements.ts +0 -119
- package/public/test/formValues.d.ts +0 -3
- package/public/test/formValues.d.ts.map +0 -1
- package/public/test/formValues.js +0 -162
- package/public/test/formValues.min.js +0 -1
- package/public/test/formValues.ts +0 -225
- package/public/test/grandparent.css +0 -14
- package/public/test/helpers.d.ts +0 -14
- package/public/test/helpers.d.ts.map +0 -1
- package/public/test/helpers.js +0 -113
- package/public/test/helpers.ts +0 -149
- package/public/test/microcomponents.d.ts +0 -6
- package/public/test/microcomponents.d.ts.map +0 -1
- package/public/test/microcomponents.js +0 -7
- package/public/test/microcomponents.min.js +0 -1
- package/public/test/microcomponents.ts +0 -8
- package/public/test/myButton.css +0 -19
- package/public/test/observables.d.ts +0 -11
- package/public/test/observables.d.ts.map +0 -1
- package/public/test/observables.js +0 -244
- package/public/test/observables.min.js +0 -1
- package/public/test/observables.ts +0 -416
- package/public/test/style.css +0 -8
- package/public/test/test/child.d.ts +0 -2
- package/public/test/test/child.d.ts.map +0 -1
- package/public/test/test/child.js +0 -26
- package/public/test/test/child.js.map +0 -1
- package/public/test/test/child.ts +0 -36
- package/public/test/test/grandchild.d.ts +0 -2
- package/public/test/test/grandchild.d.ts.map +0 -1
- package/public/test/test/grandchild.js +0 -22
- package/public/test/test/grandchild.js.map +0 -1
- package/public/test/test/grandchild.ts +0 -31
- package/public/test/test/grandparent.d.ts +0 -2
- package/public/test/test/grandparent.d.ts.map +0 -1
- package/public/test/test/grandparent.js +0 -1
- package/public/test/test/grandparent.js.map +0 -1
- package/public/test/test/grandparent.ts +0 -43
- package/public/test/test/greatgrandchild.d.ts +0 -2
- package/public/test/test/greatgrandchild.d.ts.map +0 -1
- package/public/test/test/greatgrandchild.js +0 -36
- package/public/test/test/greatgrandchild.js.map +0 -1
- package/public/test/test/greatgrandchild.ts +0 -51
- package/public/test/test/parent.d.ts +0 -2
- package/public/test/test/parent.d.ts.map +0 -1
- package/public/test/test/parent.js +0 -25
- package/public/test/test/parent.js.map +0 -1
- package/public/test/test/parent.ts +0 -35
- package/public/test/test/testform.d.ts +0 -2
- package/public/test/test/testform.d.ts.map +0 -1
- package/public/test/test/testform.js +0 -1
- package/public/test/test/testform.js.map +0 -1
- package/public/test/test/testform.ts +0 -153
- package/public/test/test/testfunction.d.ts +0 -3
- package/public/test/test/testfunction.d.ts.map +0 -1
- package/public/test/test/testfunction.js +0 -7
- package/public/test/test/testfunction.js.map +0 -1
- package/public/test/test/testfunction.ts +0 -12
- package/public/test/test/testmc.d.ts +0 -3
- package/public/test/test/testmc.d.ts.map +0 -1
- package/public/test/test/testmc.js +0 -10
- package/public/test/test/testmc.js.map +0 -1
- package/public/test/test/testmc.ts +0 -16
- package/public/test/test/testsimpleclass.d.ts +0 -3
- package/public/test/test/testsimpleclass.d.ts.map +0 -1
- package/public/test/test/testsimpleclass.js +0 -9
- package/public/test/test/testsimpleclass.js.map +0 -1
- package/public/test/test/testsimpleclass.ts +0 -15
- package/public/test/test.d.ts +0 -2
- package/public/test/test.d.ts.map +0 -1
- package/public/test/test.html +0 -29
- package/public/test/test.js +0 -72
- package/public/test/test.js.map +0 -1
- package/public/test/test.ts +0 -176
- package/public/test/testform.css +0 -47
- package/public/test/testform.html +0 -56
- package/public/test/testform.json +0 -27
- package/public/typedoc/.nojekyll +0 -1
- package/public/typedoc/assets/highlight.css +0 -106
- package/public/typedoc/assets/icons.js +0 -18
- package/public/typedoc/assets/icons.svg +0 -1
- package/public/typedoc/assets/main.js +0 -60
- package/public/typedoc/assets/navigation.js +0 -1
- package/public/typedoc/assets/search.js +0 -1
- package/public/typedoc/assets/style.css +0 -1493
- package/public/typedoc/classes/MC.DC.html +0 -13
- package/public/typedoc/classes/MC.MC.html +0 -3
- package/public/typedoc/classes/MC.McBase.html +0 -3
- package/public/typedoc/functions/MC.autoload.html +0 -1
- package/public/typedoc/functions/MC.off.html +0 -1
- package/public/typedoc/functions/MC.on.html +0 -1
- package/public/typedoc/functions/MC.one.html +0 -1
- package/public/typedoc/functions/MC.trigger.html +0 -1
- package/public/typedoc/functions/elements.defineCE.html +0 -1
- package/public/typedoc/functions/elements.getCE.html +0 -1
- package/public/typedoc/functions/formValues.formValues.html +0 -1
- package/public/typedoc/functions/observables.observe.html +0 -1
- package/public/typedoc/hierarchy.html +0 -1
- package/public/typedoc/index.html +0 -122
- package/public/typedoc/interfaces/MC.HTMLMcElement.html +0 -758
- package/public/typedoc/media/MicroComponents.svg +0 -15
- package/public/typedoc/modules/MC.html +0 -10
- package/public/typedoc/modules/elements.html +0 -3
- package/public/typedoc/modules/formValues.html +0 -2
- package/public/typedoc/modules/observables.html +0 -3
- package/public/typedoc/modules.html +0 -5
- package/public/typedoc/types/observables.Observable.html +0 -1
- package/src/MC.ts +0 -431
- package/src/elements.ts +0 -119
- package/src/formValues.ts +0 -225
- package/src/helpers.ts +0 -149
- package/src/microcomponents.ts +0 -8
- package/src/observables.ts +0 -416
- package/src/selectors._ts +0 -1269
- package/src/test/grandparent.css +0 -14
- package/src/test/test/child.ts +0 -36
- package/src/test/test/grandchild.ts +0 -31
- package/src/test/test/grandparent.ts +0 -43
- package/src/test/test/greatgrandchild.ts +0 -51
- package/src/test/test/parent.ts +0 -35
- package/src/test/test/testform.ts +0 -153
- package/src/test/test/testfunction.ts +0 -12
- package/src/test/test/testmc.ts +0 -16
- package/src/test/test/testsimpleclass.ts +0 -15
- package/src/test/test.ts +0 -176
- package/src/test/testform.css +0 -47
- package/src/test/testform.html +0 -56
- package/src/test/testform.json +0 -27
- package/tasks.md +0 -36
- package/tsconfig.json +0 -107
- package/typedoc.json +0 -7
- package/webpack.config.js +0 -346
package/public/test/MC.js
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
|
|
3
|
-
function isDOM(element) {
|
|
4
|
-
return element && element instanceof HTMLElement;
|
|
5
|
-
}
|
|
6
|
-
function add(target, key, element = {}) {
|
|
7
|
-
let node = target;
|
|
8
|
-
if (!node._mc) {
|
|
9
|
-
node._mc = new DC(target);
|
|
10
|
-
}
|
|
11
|
-
const _mc = node._mc;
|
|
12
|
-
if (key.length && !_mc[key]) {
|
|
13
|
-
_mc[key] = element;
|
|
14
|
-
if (target instanceof HTMLElement && !target.getAttribute('data-mc')) {
|
|
15
|
-
target.setAttribute('data-mc', '');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return node;
|
|
19
|
-
}
|
|
20
|
-
function remove(target, key) {
|
|
21
|
-
if (!key)
|
|
22
|
-
return;
|
|
23
|
-
const _mc = target?._mc || {};
|
|
24
|
-
if (_mc && _mc[key]) {
|
|
25
|
-
delete _mc[key];
|
|
26
|
-
}
|
|
27
|
-
if (!Object.keys(_mc).length &&
|
|
28
|
-
target instanceof HTMLElement &&
|
|
29
|
-
target.hasAttribute('data-mc')) {
|
|
30
|
-
target.removeAttribute('data-mc');
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
function init(element) {
|
|
35
|
-
setTimeout(() => {
|
|
36
|
-
if (element.constructor === DC)
|
|
37
|
-
return;
|
|
38
|
-
element.trigger('Init');
|
|
39
|
-
}, 0);
|
|
40
|
-
}
|
|
41
|
-
function getMcEventName(eventName) {
|
|
42
|
-
return '_mc' + eventName[0].toUpperCase() + eventName.substring(1);
|
|
43
|
-
}
|
|
44
|
-
function off(domNode, eventName, handler) {
|
|
45
|
-
domNode.removeEventListener(getMcEventName(eventName), handler);
|
|
46
|
-
}
|
|
47
|
-
function on(domNode, eventName, handler, once = false) {
|
|
48
|
-
domNode.addEventListener(getMcEventName(eventName), handler, { capture: false, once });
|
|
49
|
-
return handler;
|
|
50
|
-
}
|
|
51
|
-
function one(domNode, eventName, handler) {
|
|
52
|
-
on(domNode, eventName, handler, true);
|
|
53
|
-
return handler;
|
|
54
|
-
}
|
|
55
|
-
class BubbleController {
|
|
56
|
-
stopped = false;
|
|
57
|
-
constructor() {
|
|
58
|
-
}
|
|
59
|
-
stop() {
|
|
60
|
-
this.stopped = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function trigger(domNode, event, data = {}, bubble = 'l', controller) {
|
|
64
|
-
const eventName = /^_mc/.test(event) ? event : getMcEventName(event), bubbleController = !!controller ? controller : new BubbleController(), ev = new CustomEvent(eventName, { detail: { data, control: bubbleController }, bubbles: false });
|
|
65
|
-
if (bubbleController.stopped)
|
|
66
|
-
return;
|
|
67
|
-
domNode.dispatchEvent(ev);
|
|
68
|
-
ev.stopImmediatePropagation();
|
|
69
|
-
if (bubbleController.stopped)
|
|
70
|
-
return;
|
|
71
|
-
if (/[ud]/.test(bubble)) {
|
|
72
|
-
if (bubble.indexOf('l') === -1) {
|
|
73
|
-
bubble += 'l';
|
|
74
|
-
}
|
|
75
|
-
setTimeout(() => {
|
|
76
|
-
if (bubble.indexOf('u') > -1) {
|
|
77
|
-
let parentMc = domNode.parentElement?.closest('[data-mc]');
|
|
78
|
-
if (!!parentMc) {
|
|
79
|
-
parentMc?._mc.trigger(eventName, data, bubble, bubbleController);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (bubble.indexOf('d') > -1) {
|
|
83
|
-
let childNodes = domNode._mc.children();
|
|
84
|
-
if (!!childNodes) {
|
|
85
|
-
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, 0);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function autoAttachListeners(element) {
|
|
92
|
-
if (!isBrowser() || element.constructor === DC)
|
|
93
|
-
return;
|
|
94
|
-
const target = element.target;
|
|
95
|
-
if (target instanceof HTMLElement) {
|
|
96
|
-
let that = element;
|
|
97
|
-
Object.getOwnPropertyNames(that.constructor.prototype)
|
|
98
|
-
.filter((key) => /^on[A-Z]|one[A-Z]/.test(key) &&
|
|
99
|
-
typeof that.constructor.prototype[key] === 'function')
|
|
100
|
-
.forEach((key) => {
|
|
101
|
-
let once = /^one/.test(key), withoutOnOne = key.replace(/^on[e]{0,1}/, ''), nativeEventName = withoutOnOne.toLowerCase();
|
|
102
|
-
if (('on' + nativeEventName) in target) {
|
|
103
|
-
let listener = (ev) => {
|
|
104
|
-
that[key](ev);
|
|
105
|
-
};
|
|
106
|
-
target.addEventListener(nativeEventName, listener);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
let listener = (ev) => {
|
|
110
|
-
that[key](ev);
|
|
111
|
-
};
|
|
112
|
-
on(target, withoutOnOne, listener, once);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function getMcChildNodes(domNode) {
|
|
118
|
-
const id = Math.random().toString().replace('.', '');
|
|
119
|
-
const selector = '[data-mc]:not([temp_id="' + id + '"] [data-mc] [data-mc])';
|
|
120
|
-
domNode.setAttribute('temp_id', id);
|
|
121
|
-
const mcArray = [...domNode.querySelectorAll(selector)]
|
|
122
|
-
.filter((e) => !!e._mc)
|
|
123
|
-
.map(e => e._mc);
|
|
124
|
-
domNode.removeAttribute('temp_id');
|
|
125
|
-
return mcArray.length ? mcArray : null;
|
|
126
|
-
}
|
|
127
|
-
class McBase {
|
|
128
|
-
_target;
|
|
129
|
-
constructor(target) {
|
|
130
|
-
let element = this;
|
|
131
|
-
this._target = new WeakRef(target || {});
|
|
132
|
-
init(element);
|
|
133
|
-
autoAttachListeners(element);
|
|
134
|
-
}
|
|
135
|
-
get target() {
|
|
136
|
-
return this._target.deref();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
class MC extends McBase {
|
|
140
|
-
constructor(target) {
|
|
141
|
-
super(target);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
class DC extends McBase {
|
|
145
|
-
constructor(target) {
|
|
146
|
-
super(target);
|
|
147
|
-
}
|
|
148
|
-
static add(target, key, element = {}) {
|
|
149
|
-
return add(target, key, element);
|
|
150
|
-
}
|
|
151
|
-
;
|
|
152
|
-
static remove(target, key) {
|
|
153
|
-
remove(target, key);
|
|
154
|
-
}
|
|
155
|
-
off(eventName, handler) {
|
|
156
|
-
off(this.target, eventName, handler);
|
|
157
|
-
}
|
|
158
|
-
on(eventName, handler) {
|
|
159
|
-
return on(this.target, eventName, handler);
|
|
160
|
-
}
|
|
161
|
-
one(eventName, handler) {
|
|
162
|
-
return one(this.target, eventName, handler);
|
|
163
|
-
}
|
|
164
|
-
trigger(eventName, data = {}, bubble = 'l', controller) {
|
|
165
|
-
trigger(this.target, eventName, data, bubble, controller);
|
|
166
|
-
}
|
|
167
|
-
ancestors() {
|
|
168
|
-
let currentNode = this?.target, result = [];
|
|
169
|
-
if (!isDOM(currentNode))
|
|
170
|
-
return [];
|
|
171
|
-
while (currentNode = (currentNode.closest('[data-mc]'))) {
|
|
172
|
-
if (currentNode?._mc) {
|
|
173
|
-
result.push(currentNode?._mc);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return result.length ? result : null;
|
|
177
|
-
}
|
|
178
|
-
closest() {
|
|
179
|
-
let target = this.target;
|
|
180
|
-
if (!isDOM(target))
|
|
181
|
-
return null;
|
|
182
|
-
return target.closest('[data-mc]')?._mc || null;
|
|
183
|
-
}
|
|
184
|
-
children() {
|
|
185
|
-
let target = this?.target;
|
|
186
|
-
if (!isDOM(target))
|
|
187
|
-
return null;
|
|
188
|
-
return getMcChildNodes(target);
|
|
189
|
-
}
|
|
190
|
-
descendants() {
|
|
191
|
-
const target = this?.target;
|
|
192
|
-
if (!isDOM(target))
|
|
193
|
-
return [];
|
|
194
|
-
const mcArray = [...target.querySelectorAll('[data-mc]')]
|
|
195
|
-
.filter((e) => !!e._mc)
|
|
196
|
-
.map(e => e._mc);
|
|
197
|
-
return mcArray.length ? mcArray : null;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const loadingDCs = new Set();
|
|
201
|
-
function attachDC(element) {
|
|
202
|
-
return () => {
|
|
203
|
-
const elements = Array
|
|
204
|
-
.from(document.querySelectorAll(`[data-mc*="${element}"]`))
|
|
205
|
-
.filter(element => element instanceof HTMLElement);
|
|
206
|
-
if (elements.length === 0)
|
|
207
|
-
return;
|
|
208
|
-
const klass = customElements.get(element);
|
|
209
|
-
elements.forEach((node) => {
|
|
210
|
-
DC.add(node, klass.name, new klass(node));
|
|
211
|
-
const new_mc = node
|
|
212
|
-
.getAttribute('data-mc')
|
|
213
|
-
.split(' ')
|
|
214
|
-
.filter((name) => name !== element && name !== '')
|
|
215
|
-
.join(' ')
|
|
216
|
-
.trim();
|
|
217
|
-
node.setAttribute('data-mc', new_mc);
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
;
|
|
222
|
-
function makeLoadScript(element) {
|
|
223
|
-
if (loadingDCs.has(element))
|
|
224
|
-
return;
|
|
225
|
-
loadingDCs.add(element);
|
|
226
|
-
const fileName = './' + element.split('-').join('/') + '.js';
|
|
227
|
-
const se = document.createElement('script');
|
|
228
|
-
se.setAttribute('src', fileName);
|
|
229
|
-
se.setAttribute('blocking', 'render');
|
|
230
|
-
se.async = true;
|
|
231
|
-
se.setAttribute('type', 'module');
|
|
232
|
-
se.setAttribute('data-name', element);
|
|
233
|
-
se.setAttribute('loading', '');
|
|
234
|
-
const loadedPromise = customElements.whenDefined(element);
|
|
235
|
-
loadedPromise.then(attachDC(element));
|
|
236
|
-
se.addEventListener('load', (ev) => {
|
|
237
|
-
loadingDCs.delete(element);
|
|
238
|
-
document.head.querySelector(`script[data-name="${element}"]`)?.remove();
|
|
239
|
-
});
|
|
240
|
-
se.addEventListener('error', (ev) => {
|
|
241
|
-
console.error('could not load DC code from', fileName);
|
|
242
|
-
});
|
|
243
|
-
document.head.append(se);
|
|
244
|
-
}
|
|
245
|
-
function loadUndefinedMCs() {
|
|
246
|
-
[...document.querySelectorAll(':not(:defined)')]
|
|
247
|
-
.filter((element) => !!element
|
|
248
|
-
&& !customElements.get(element.tagName.toLowerCase())
|
|
249
|
-
&& !loadingDCs.has(element.tagName.toLowerCase()))
|
|
250
|
-
.forEach((el) => {
|
|
251
|
-
makeLoadScript(el.tagName.toLowerCase());
|
|
252
|
-
});
|
|
253
|
-
[...document.querySelectorAll('[data-mc]:not([data-mc=""]')]
|
|
254
|
-
.filter((element) => !!element)
|
|
255
|
-
.forEach((el) => {
|
|
256
|
-
const _mc = el.getAttribute('data-mc')?.split(' ').filter(name => name !== '');
|
|
257
|
-
_mc?.forEach(element => {
|
|
258
|
-
const isDefined = customElements.get(element);
|
|
259
|
-
if (!loadingDCs.has(element) && !isDefined) {
|
|
260
|
-
makeLoadScript(element);
|
|
261
|
-
}
|
|
262
|
-
else if (isDefined) {
|
|
263
|
-
attachDC(element)();
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
let autoloadEnabled = false;
|
|
269
|
-
let observer = null;
|
|
270
|
-
function autoload(enable = true) {
|
|
271
|
-
if (!enable) {
|
|
272
|
-
observer?.disconnect();
|
|
273
|
-
observer = null;
|
|
274
|
-
return autoloadEnabled;
|
|
275
|
-
}
|
|
276
|
-
autoloadEnabled = enable;
|
|
277
|
-
observer = new MutationObserver(loadUndefinedMCs);
|
|
278
|
-
setTimeout(() => {
|
|
279
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
280
|
-
loadUndefinedMCs();
|
|
281
|
-
}, 5);
|
|
282
|
-
window.autoload = window.autoload || autoload;
|
|
283
|
-
return autoloadEnabled;
|
|
284
|
-
}
|
|
285
|
-
autoload.state = loadingDCs;
|
|
286
|
-
export { McBase, MC, DC, autoload, on, one, off, trigger };
|
|
287
|
-
//# sourceMappingURL=MC.js.map
|
package/public/test/MC.min.js
DELETED
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory();
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
6
|
-
else if(typeof exports === 'object')
|
|
7
|
-
exports["MC"] = factory();
|
|
8
|
-
else
|
|
9
|
-
root["MC"] = factory();
|
|
10
|
-
})(this, () => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
12
|
-
/******/ "use strict";
|
|
13
|
-
/******/ // The require scope
|
|
14
|
-
/******/ var __webpack_require__ = {};
|
|
15
|
-
/******/
|
|
16
|
-
/************************************************************************/
|
|
17
|
-
/******/ /* webpack/runtime/define property getters */
|
|
18
|
-
/******/ (() => {
|
|
19
|
-
/******/ // define getter functions for harmony exports
|
|
20
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
21
|
-
/******/ for(var key in definition) {
|
|
22
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
23
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
24
|
-
/******/ }
|
|
25
|
-
/******/ }
|
|
26
|
-
/******/ };
|
|
27
|
-
/******/ })();
|
|
28
|
-
/******/
|
|
29
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
30
|
-
/******/ (() => {
|
|
31
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
32
|
-
/******/ })();
|
|
33
|
-
/******/
|
|
34
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
35
|
-
/******/ (() => {
|
|
36
|
-
/******/ // define __esModule on exports
|
|
37
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
38
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
39
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
40
|
-
/******/ }
|
|
41
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
42
|
-
/******/ };
|
|
43
|
-
/******/ })();
|
|
44
|
-
/******/
|
|
45
|
-
/************************************************************************/
|
|
46
|
-
var __webpack_exports__ = {};
|
|
47
|
-
__webpack_require__.r(__webpack_exports__);
|
|
48
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
49
|
-
/* harmony export */ DC: () => (/* binding */ DC),
|
|
50
|
-
/* harmony export */ MC: () => (/* binding */ MC),
|
|
51
|
-
/* harmony export */ McBase: () => (/* binding */ McBase),
|
|
52
|
-
/* harmony export */ autoload: () => (/* binding */ autoload),
|
|
53
|
-
/* harmony export */ off: () => (/* binding */ off),
|
|
54
|
-
/* harmony export */ on: () => (/* binding */ on),
|
|
55
|
-
/* harmony export */ one: () => (/* binding */ one),
|
|
56
|
-
/* harmony export */ trigger: () => (/* binding */ trigger)
|
|
57
|
-
/* harmony export */ });
|
|
58
|
-
|
|
59
|
-
const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
|
|
60
|
-
function isDOM(element) {
|
|
61
|
-
return element && element instanceof HTMLElement;
|
|
62
|
-
}
|
|
63
|
-
function add(target, key, element = {}) {
|
|
64
|
-
let node = target;
|
|
65
|
-
if (!node._mc) {
|
|
66
|
-
node._mc = new DC(target);
|
|
67
|
-
}
|
|
68
|
-
const _mc = node._mc;
|
|
69
|
-
if (key.length && !_mc[key]) {
|
|
70
|
-
_mc[key] = element;
|
|
71
|
-
if (target instanceof HTMLElement && !target.getAttribute('data-mc')) {
|
|
72
|
-
target.setAttribute('data-mc', '');
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return node;
|
|
76
|
-
}
|
|
77
|
-
function remove(target, key) {
|
|
78
|
-
if (!key)
|
|
79
|
-
return;
|
|
80
|
-
const _mc = target?._mc || {};
|
|
81
|
-
if (_mc && _mc[key]) {
|
|
82
|
-
delete _mc[key];
|
|
83
|
-
}
|
|
84
|
-
if (!Object.keys(_mc).length &&
|
|
85
|
-
target instanceof HTMLElement &&
|
|
86
|
-
target.hasAttribute('data-mc')) {
|
|
87
|
-
target.removeAttribute('data-mc');
|
|
88
|
-
}
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
function init(element) {
|
|
92
|
-
setTimeout(() => {
|
|
93
|
-
if (element.constructor === DC)
|
|
94
|
-
return;
|
|
95
|
-
element.trigger('Init');
|
|
96
|
-
}, 0);
|
|
97
|
-
}
|
|
98
|
-
function getMcEventName(eventName) {
|
|
99
|
-
return '_mc' + eventName[0].toUpperCase() + eventName.substring(1);
|
|
100
|
-
}
|
|
101
|
-
function off(domNode, eventName, handler) {
|
|
102
|
-
domNode.removeEventListener(getMcEventName(eventName), handler);
|
|
103
|
-
}
|
|
104
|
-
function on(domNode, eventName, handler, once = false) {
|
|
105
|
-
domNode.addEventListener(getMcEventName(eventName), handler, { capture: false, once });
|
|
106
|
-
return handler;
|
|
107
|
-
}
|
|
108
|
-
function one(domNode, eventName, handler) {
|
|
109
|
-
on(domNode, eventName, handler, true);
|
|
110
|
-
return handler;
|
|
111
|
-
}
|
|
112
|
-
class BubbleController {
|
|
113
|
-
stopped = false;
|
|
114
|
-
constructor() {
|
|
115
|
-
}
|
|
116
|
-
stop() {
|
|
117
|
-
this.stopped = true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function trigger(domNode, event, data = {}, bubble = 'l', controller) {
|
|
121
|
-
const eventName = /^_mc/.test(event) ? event : getMcEventName(event), bubbleController = !!controller ? controller : new BubbleController(), ev = new CustomEvent(eventName, { detail: { data, control: bubbleController }, bubbles: false });
|
|
122
|
-
if (bubbleController.stopped)
|
|
123
|
-
return;
|
|
124
|
-
domNode.dispatchEvent(ev);
|
|
125
|
-
ev.stopImmediatePropagation();
|
|
126
|
-
if (bubbleController.stopped)
|
|
127
|
-
return;
|
|
128
|
-
if (/[ud]/.test(bubble)) {
|
|
129
|
-
if (bubble.indexOf('l') === -1) {
|
|
130
|
-
bubble += 'l';
|
|
131
|
-
}
|
|
132
|
-
setTimeout(() => {
|
|
133
|
-
if (bubble.indexOf('u') > -1) {
|
|
134
|
-
let parentMc = domNode.parentElement?.closest('[data-mc]');
|
|
135
|
-
if (!!parentMc) {
|
|
136
|
-
parentMc?._mc.trigger(eventName, data, bubble, bubbleController);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (bubble.indexOf('d') > -1) {
|
|
140
|
-
let childNodes = domNode._mc.children();
|
|
141
|
-
if (!!childNodes) {
|
|
142
|
-
childNodes.forEach((_mc) => _mc.trigger(eventName, data, bubble));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}, 0);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function autoAttachListeners(element) {
|
|
149
|
-
if (!isBrowser() || element.constructor === DC)
|
|
150
|
-
return;
|
|
151
|
-
const target = element.target;
|
|
152
|
-
if (target instanceof HTMLElement) {
|
|
153
|
-
let that = element;
|
|
154
|
-
Object.getOwnPropertyNames(that.constructor.prototype)
|
|
155
|
-
.filter((key) => /^on[A-Z]|one[A-Z]/.test(key) &&
|
|
156
|
-
typeof that.constructor.prototype[key] === 'function')
|
|
157
|
-
.forEach((key) => {
|
|
158
|
-
let once = /^one/.test(key), withoutOnOne = key.replace(/^on[e]{0,1}/, ''), nativeEventName = withoutOnOne.toLowerCase();
|
|
159
|
-
if (('on' + nativeEventName) in target) {
|
|
160
|
-
let listener = (ev) => {
|
|
161
|
-
that[key](ev);
|
|
162
|
-
};
|
|
163
|
-
target.addEventListener(nativeEventName, listener);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
let listener = (ev) => {
|
|
167
|
-
that[key](ev);
|
|
168
|
-
};
|
|
169
|
-
on(target, withoutOnOne, listener, once);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function getMcChildNodes(domNode) {
|
|
175
|
-
const id = Math.random().toString().replace('.', '');
|
|
176
|
-
const selector = '[data-mc]:not([temp_id="' + id + '"] [data-mc] [data-mc])';
|
|
177
|
-
domNode.setAttribute('temp_id', id);
|
|
178
|
-
const mcArray = [...domNode.querySelectorAll(selector)]
|
|
179
|
-
.filter((e) => !!e._mc)
|
|
180
|
-
.map(e => e._mc);
|
|
181
|
-
domNode.removeAttribute('temp_id');
|
|
182
|
-
return mcArray.length ? mcArray : null;
|
|
183
|
-
}
|
|
184
|
-
class McBase {
|
|
185
|
-
_target;
|
|
186
|
-
constructor(target) {
|
|
187
|
-
let element = this;
|
|
188
|
-
this._target = new WeakRef(target || {});
|
|
189
|
-
init(element);
|
|
190
|
-
autoAttachListeners(element);
|
|
191
|
-
}
|
|
192
|
-
get target() {
|
|
193
|
-
return this._target.deref();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
class MC extends McBase {
|
|
197
|
-
constructor(target) {
|
|
198
|
-
super(target);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
class DC extends McBase {
|
|
202
|
-
constructor(target) {
|
|
203
|
-
super(target);
|
|
204
|
-
}
|
|
205
|
-
static add(target, key, element = {}) {
|
|
206
|
-
return add(target, key, element);
|
|
207
|
-
}
|
|
208
|
-
;
|
|
209
|
-
static remove(target, key) {
|
|
210
|
-
remove(target, key);
|
|
211
|
-
}
|
|
212
|
-
off(eventName, handler) {
|
|
213
|
-
off(this.target, eventName, handler);
|
|
214
|
-
}
|
|
215
|
-
on(eventName, handler) {
|
|
216
|
-
return on(this.target, eventName, handler);
|
|
217
|
-
}
|
|
218
|
-
one(eventName, handler) {
|
|
219
|
-
return one(this.target, eventName, handler);
|
|
220
|
-
}
|
|
221
|
-
trigger(eventName, data = {}, bubble = 'l', controller) {
|
|
222
|
-
trigger(this.target, eventName, data, bubble, controller);
|
|
223
|
-
}
|
|
224
|
-
ancestors() {
|
|
225
|
-
let currentNode = this?.target, result = [];
|
|
226
|
-
if (!isDOM(currentNode))
|
|
227
|
-
return [];
|
|
228
|
-
while (currentNode = (currentNode.closest('[data-mc]'))) {
|
|
229
|
-
if (currentNode?._mc) {
|
|
230
|
-
result.push(currentNode?._mc);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return result.length ? result : null;
|
|
234
|
-
}
|
|
235
|
-
closest() {
|
|
236
|
-
let target = this.target;
|
|
237
|
-
if (!isDOM(target))
|
|
238
|
-
return null;
|
|
239
|
-
return target.closest('[data-mc]')?._mc || null;
|
|
240
|
-
}
|
|
241
|
-
children() {
|
|
242
|
-
let target = this?.target;
|
|
243
|
-
if (!isDOM(target))
|
|
244
|
-
return null;
|
|
245
|
-
return getMcChildNodes(target);
|
|
246
|
-
}
|
|
247
|
-
descendants() {
|
|
248
|
-
const target = this?.target;
|
|
249
|
-
if (!isDOM(target))
|
|
250
|
-
return [];
|
|
251
|
-
const mcArray = [...target.querySelectorAll('[data-mc]')]
|
|
252
|
-
.filter((e) => !!e._mc)
|
|
253
|
-
.map(e => e._mc);
|
|
254
|
-
return mcArray.length ? mcArray : null;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
const loadingDCs = new Set();
|
|
258
|
-
function attachDC(element) {
|
|
259
|
-
return () => {
|
|
260
|
-
const elements = Array
|
|
261
|
-
.from(document.querySelectorAll(`[data-mc*="${element}"]`))
|
|
262
|
-
.filter(element => element instanceof HTMLElement);
|
|
263
|
-
if (elements.length === 0)
|
|
264
|
-
return;
|
|
265
|
-
const klass = customElements.get(element);
|
|
266
|
-
elements.forEach((node) => {
|
|
267
|
-
DC.add(node, klass.name, new klass(node));
|
|
268
|
-
const new_mc = node
|
|
269
|
-
.getAttribute('data-mc')
|
|
270
|
-
.split(' ')
|
|
271
|
-
.filter((name) => name !== element && name !== '')
|
|
272
|
-
.join(' ')
|
|
273
|
-
.trim();
|
|
274
|
-
node.setAttribute('data-mc', new_mc);
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
;
|
|
279
|
-
function makeLoadScript(element) {
|
|
280
|
-
if (loadingDCs.has(element))
|
|
281
|
-
return;
|
|
282
|
-
loadingDCs.add(element);
|
|
283
|
-
const fileName = './' + element.split('-').join('/') + '.js';
|
|
284
|
-
const se = document.createElement('script');
|
|
285
|
-
se.setAttribute('src', fileName);
|
|
286
|
-
se.setAttribute('blocking', 'render');
|
|
287
|
-
se.async = true;
|
|
288
|
-
se.setAttribute('type', 'module');
|
|
289
|
-
se.setAttribute('data-name', element);
|
|
290
|
-
se.setAttribute('loading', '');
|
|
291
|
-
const loadedPromise = customElements.whenDefined(element);
|
|
292
|
-
loadedPromise.then(attachDC(element));
|
|
293
|
-
se.addEventListener('load', (ev) => {
|
|
294
|
-
loadingDCs.delete(element);
|
|
295
|
-
document.head.querySelector(`script[data-name="${element}"]`)?.remove();
|
|
296
|
-
});
|
|
297
|
-
se.addEventListener('error', (ev) => {
|
|
298
|
-
console.error('could not load DC code from', fileName);
|
|
299
|
-
});
|
|
300
|
-
document.head.append(se);
|
|
301
|
-
}
|
|
302
|
-
function loadUndefinedMCs() {
|
|
303
|
-
[...document.querySelectorAll(':not(:defined)')]
|
|
304
|
-
.filter((element) => !!element
|
|
305
|
-
&& !customElements.get(element.tagName.toLowerCase())
|
|
306
|
-
&& !loadingDCs.has(element.tagName.toLowerCase()))
|
|
307
|
-
.forEach((el) => {
|
|
308
|
-
makeLoadScript(el.tagName.toLowerCase());
|
|
309
|
-
});
|
|
310
|
-
[...document.querySelectorAll('[data-mc]:not([data-mc=""]')]
|
|
311
|
-
.filter((element) => !!element)
|
|
312
|
-
.forEach((el) => {
|
|
313
|
-
const _mc = el.getAttribute('data-mc')?.split(' ').filter(name => name !== '');
|
|
314
|
-
_mc?.forEach(element => {
|
|
315
|
-
const isDefined = customElements.get(element);
|
|
316
|
-
if (!loadingDCs.has(element) && !isDefined) {
|
|
317
|
-
makeLoadScript(element);
|
|
318
|
-
}
|
|
319
|
-
else if (isDefined) {
|
|
320
|
-
attachDC(element)();
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
let autoloadEnabled = false;
|
|
326
|
-
let observer = null;
|
|
327
|
-
function autoload(enable = true) {
|
|
328
|
-
if (!enable) {
|
|
329
|
-
observer?.disconnect();
|
|
330
|
-
observer = null;
|
|
331
|
-
return autoloadEnabled;
|
|
332
|
-
}
|
|
333
|
-
autoloadEnabled = enable;
|
|
334
|
-
observer = new MutationObserver(loadUndefinedMCs);
|
|
335
|
-
setTimeout(() => {
|
|
336
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
337
|
-
loadUndefinedMCs();
|
|
338
|
-
}, 5);
|
|
339
|
-
window.autoload = window.autoload || autoload;
|
|
340
|
-
return autoloadEnabled;
|
|
341
|
-
}
|
|
342
|
-
autoload.state = loadingDCs;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
/******/ return __webpack_exports__;
|
|
346
|
-
/******/ })()
|
|
347
|
-
;
|
|
348
|
-
});
|