copious-mail 0.0.0-stage → 0.9.1
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/LICENSE +504 -0
- package/README.md +143 -2
- package/bin/index.js +345 -0
- package/client/copiousLogo.svg +123 -0
- package/client/hosted.html +5259 -0
- package/client/mail_styles.css +40 -0
- package/client/mikado.bundle.debug.js +1406 -0
- package/client/mikado.bundle.min.js +68 -0
- package/client/mikado.bundle.module.debug.js +1401 -0
- package/client/mikado.bundle.module.min.js +67 -0
- package/client/mikado.bundle.profiler.debug.js +1490 -0
- package/client/mikado.es5.debug.js +1995 -0
- package/client/mikado.es5.min.js +85 -0
- package/client/mikado.light.debug.js +535 -0
- package/client/mikado.light.min.js +29 -0
- package/client/mikado.light.module.debug.js +530 -0
- package/data/user_list.db +14 -0
- package/index.html +7242 -0
- package/index.js +5 -0
- package/jsconfig.json +32 -0
- package/lib/mail_repo_bridge_ops.js +1177 -0
- package/lib/utils.js +70 -0
- package/lib/websocket_con.js +249 -0
- package/mail_bridge.conf +10 -0
- package/package.json +41 -5
- package/svelte-src/App.svelte +2513 -0
- package/svelte-src/ContactGrid.svelte +98 -0
- package/svelte-src/FloatWindow.svelte +181 -0
- package/svelte-src/MessageDisplay.svelte +230 -0
- package/svelte-src/MessageEditor.svelte +664 -0
- package/svelte-src/MessageListEditor.svelte +133 -0
- package/svelte-src/Thing.svelte +190 -0
- package/svelte-src/ThingFull.svelte +117 -0
- package/svelte-src/ipfs_profile_proxy.js +923 -0
- package/svelte-src/main.js +10 -0
- package/svelte-src/search_box.js +69 -0
- package/svelte-src/utilities.js +180 -0
- package/test/c +28 -0
- package/test/copiousLogo.svg +123 -0
- package/test/index.html +4408 -0
- package/test/index.js +244 -0
- package/test/mail_styles.css +40 -0
- package/test/mikado.bundle.debug.js +1406 -0
- package/test/mikado.bundle.min.js +68 -0
- package/test/mikado.bundle.module.debug.js +1401 -0
- package/test/mikado.bundle.module.min.js +67 -0
- package/test/mikado.bundle.profiler.debug.js +1490 -0
- package/test/mikado.es5.debug.js +1995 -0
- package/test/mikado.es5.min.js +85 -0
- package/test/mikado.light.debug.js +535 -0
- package/test/mikado.light.min.js +29 -0
- package/test/mikado.light.module.debug.js +530 -0
- package/test/tpl/partial/attachment_edit.es5.js +1 -0
- package/test/tpl/partial/attachment_edit.html +5 -0
- package/test/tpl/partial/attachment_edit.js +1 -0
- package/test/tpl/partial/attachment_view.es5.js +1 -0
- package/test/tpl/partial/attachment_view.html +1 -0
- package/test/tpl/partial/attachment_view.js +1 -0
- package/test/tpl/partial/contact_list.es5.js +1 -0
- package/test/tpl/partial/contact_list.html +9 -0
- package/test/tpl/partial/contact_list.js +1 -0
- package/test/tpl/partial/draft_list.es5.js +1 -0
- package/test/tpl/partial/draft_list.html +8 -0
- package/test/tpl/partial/draft_list.js +1 -0
- package/test/tpl/partial/inbox_list.es5.js +1 -0
- package/test/tpl/partial/inbox_list.html +7 -0
- package/test/tpl/partial/inbox_list.js +1 -0
- package/test/tpl/partial/notify_list.es5.js +1 -0
- package/test/tpl/partial/notify_list.html +8 -0
- package/test/tpl/partial/notify_list.js +1 -0
- package/test/tpl/partial/sent_list.es5.js +1 -0
- package/test/tpl/partial/sent_list.html +7 -0
- package/test/tpl/partial/sent_list.js +1 -0
- package/test/tpl/partial/spam_list.es5.js +1 -0
- package/test/tpl/partial/spam_list.html +8 -0
- package/test/tpl/partial/spam_list.js +1 -0
- package/test/tpl/partial/trash_list.es5.js +1 -0
- package/test/tpl/partial/trash_list.html +7 -0
- package/test/tpl/partial/trash_list.js +1 -0
- package/test/tpl/partial/user.es5.js +1 -0
- package/test/tpl/partial/user.html +18 -0
- package/test/tpl/partial/user.js +1 -0
- package/tools/jsdoc.conf +47 -0
- package/tools/templates/docdash/publish.js +843 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/tools/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/tools/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/tools/templates/docdash/static/scripts/collapse.js +67 -0
- package/tools/templates/docdash/static/scripts/commonNav.js +28 -0
- package/tools/templates/docdash/static/scripts/linenumber.js +25 -0
- package/tools/templates/docdash/static/scripts/nav.js +12 -0
- package/tools/templates/docdash/static/scripts/polyfill.js +4 -0
- package/tools/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/tools/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
- package/tools/templates/docdash/static/scripts/prettify/prettify.js +28 -0
- package/tools/templates/docdash/static/scripts/search.js +99 -0
- package/tools/templates/docdash/static/styles/jsdoc.css +803 -0
- package/tools/templates/docdash/static/styles/prettify.css +80 -0
- package/tools/templates/docdash/tmpl/augments.tmpl +10 -0
- package/tools/templates/docdash/tmpl/container.tmpl +203 -0
- package/tools/templates/docdash/tmpl/details.tmpl +152 -0
- package/tools/templates/docdash/tmpl/example.tmpl +2 -0
- package/tools/templates/docdash/tmpl/examples.tmpl +13 -0
- package/tools/templates/docdash/tmpl/exceptions.tmpl +32 -0
- package/tools/templates/docdash/tmpl/layout.tmpl +102 -0
- package/tools/templates/docdash/tmpl/mainpage.tmpl +15 -0
- package/tools/templates/docdash/tmpl/members.tmpl +38 -0
- package/tools/templates/docdash/tmpl/method.tmpl +132 -0
- package/tools/templates/docdash/tmpl/modifies.tmpl +14 -0
- package/tools/templates/docdash/tmpl/namespace.tmpl +133 -0
- package/tools/templates/docdash/tmpl/params.tmpl +132 -0
- package/tools/templates/docdash/tmpl/properties.tmpl +107 -0
- package/tools/templates/docdash/tmpl/returns.tmpl +19 -0
- package/tools/templates/docdash/tmpl/source.tmpl +8 -0
- package/tools/templates/docdash/tmpl/tutorial.tmpl +19 -0
- package/tools/templates/docdash/tmpl/type.tmpl +26 -0
- package/tools/templates/templates/docdash/publish.js +843 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/tools/templates/templates/docdash/static/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/tools/templates/templates/docdash/static/scripts/collapse.js +67 -0
- package/tools/templates/templates/docdash/static/scripts/commonNav.js +28 -0
- package/tools/templates/templates/docdash/static/scripts/linenumber.js +25 -0
- package/tools/templates/templates/docdash/static/scripts/nav.js +12 -0
- package/tools/templates/templates/docdash/static/scripts/polyfill.js +4 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/lang-css.js +2 -0
- package/tools/templates/templates/docdash/static/scripts/prettify/prettify.js +28 -0
- package/tools/templates/templates/docdash/static/scripts/search.js +99 -0
- package/tools/templates/templates/docdash/static/styles/jsdoc.css +803 -0
- package/tools/templates/templates/docdash/static/styles/prettify.css +80 -0
- package/tools/templates/templates/docdash/tmpl/augments.tmpl +10 -0
- package/tools/templates/templates/docdash/tmpl/container.tmpl +203 -0
- package/tools/templates/templates/docdash/tmpl/details.tmpl +152 -0
- package/tools/templates/templates/docdash/tmpl/example.tmpl +2 -0
- package/tools/templates/templates/docdash/tmpl/examples.tmpl +13 -0
- package/tools/templates/templates/docdash/tmpl/exceptions.tmpl +32 -0
- package/tools/templates/templates/docdash/tmpl/layout.tmpl +102 -0
- package/tools/templates/templates/docdash/tmpl/mainpage.tmpl +15 -0
- package/tools/templates/templates/docdash/tmpl/members.tmpl +38 -0
- package/tools/templates/templates/docdash/tmpl/method.tmpl +132 -0
- package/tools/templates/templates/docdash/tmpl/modifies.tmpl +14 -0
- package/tools/templates/templates/docdash/tmpl/namespace.tmpl +133 -0
- package/tools/templates/templates/docdash/tmpl/params.tmpl +132 -0
- package/tools/templates/templates/docdash/tmpl/properties.tmpl +107 -0
- package/tools/templates/templates/docdash/tmpl/returns.tmpl +19 -0
- package/tools/templates/templates/docdash/tmpl/source.tmpl +8 -0
- package/tools/templates/templates/docdash/tmpl/tutorial.tmpl +19 -0
- package/tools/templates/templates/docdash/tmpl/type.tmpl +26 -0
- package/tpl/partial/user.es5.js +1 -0
- package/tpl/partial/user.html +10 -0
- package/tpl/partial/user.js +1 -0
|
@@ -0,0 +1,1490 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
* Mikado.js v0.8.327 (Bundle/Debug)
|
|
3
|
+
* Copyright 2019-2024 Nextapps GmbH
|
|
4
|
+
* Author: Thomas Wilkerling
|
|
5
|
+
* Licence: Apache-2.0
|
|
6
|
+
* https://github.com/nextapps-de/mikado
|
|
7
|
+
*/
|
|
8
|
+
(function(){'use strict';
|
|
9
|
+
function f(a) {
|
|
10
|
+
const b = window.profiler || (window.profiler = {});
|
|
11
|
+
b[a] || (b[a] = 0);
|
|
12
|
+
b[a]++;
|
|
13
|
+
}
|
|
14
|
+
;const m = {}, v = {}, x = Object.create(null), z = Object.create(null), B = document.documentElement || document.body.parentNode, C = "ontouchstart" in window, D = !C && window.PointerEvent && navigator.maxTouchPoints;
|
|
15
|
+
E.eventCache = !1;
|
|
16
|
+
E.eventBubble = !1;
|
|
17
|
+
let aa;
|
|
18
|
+
function F(a, b) {
|
|
19
|
+
const c = a.target;
|
|
20
|
+
if (c !== window && c !== B) {
|
|
21
|
+
f("event.trigger");
|
|
22
|
+
var d = E.eventCache, e = E.eventBubble;
|
|
23
|
+
b || (b = a.type);
|
|
24
|
+
var k;
|
|
25
|
+
d && (k = c["_mke" + b]);
|
|
26
|
+
if ("undefined" === typeof k) {
|
|
27
|
+
for (var h = c; h && h !== B;) {
|
|
28
|
+
f("event.bubble");
|
|
29
|
+
var g = void 0;
|
|
30
|
+
"click" === b && aa && (g = h.getAttribute("tap"));
|
|
31
|
+
g || (g = h.getAttribute(b));
|
|
32
|
+
if (g) {
|
|
33
|
+
var l = g.indexOf(":"), n = h;
|
|
34
|
+
if (-1 < l) {
|
|
35
|
+
const p = g.substring(0, l);
|
|
36
|
+
l = g.substring(l + 1);
|
|
37
|
+
for (g = ""; (n = n.parentElement) !== B;) {
|
|
38
|
+
if (f("event.bubble"), "root" === l ? n._mkr : n.hasAttribute(l)) {
|
|
39
|
+
g = p;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
g || console.warn("Event root '" + l + "' was not found for the event: '" + p + "'.");
|
|
44
|
+
}
|
|
45
|
+
if (g && (k || (k = [], d && (c["_mke" + b] = k)), k.push([g, n]), n = z[g], !e || n && (n.stop || n.cancel))) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
h = h.parentElement;
|
|
50
|
+
}
|
|
51
|
+
d && (k || (c["_mke" + b] = null));
|
|
52
|
+
} else {
|
|
53
|
+
f("event.cache");
|
|
54
|
+
}
|
|
55
|
+
if (k) {
|
|
56
|
+
for (let p = 0, q; p < k.length; p++) {
|
|
57
|
+
if (q = k[p], e = q[0], h = x[e]) {
|
|
58
|
+
g = q[1];
|
|
59
|
+
if (n = z[e]) {
|
|
60
|
+
n.prevent && a.preventDefault(), n.stop && a.stopImmediatePropagation(), n.once && (x[e] = null, d && (c["_mke" + b] = null));
|
|
61
|
+
}
|
|
62
|
+
f("route.call");
|
|
63
|
+
h(g, a);
|
|
64
|
+
} else {
|
|
65
|
+
console.warn("The route '" + e + "' is not defined for the event '" + b + "'.");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function ba(a, b) {
|
|
72
|
+
m[a] || (f("event.listen"), G(1, a, F, b), m[a] = 1, v[a] = b || null);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
let H, J, ca;
|
|
76
|
+
if (C || D) {
|
|
77
|
+
function a(d) {
|
|
78
|
+
var e = d;
|
|
79
|
+
(d = d.touches) && (e = d[0]);
|
|
80
|
+
H = e.clientX;
|
|
81
|
+
J = e.clientY;
|
|
82
|
+
}
|
|
83
|
+
function b(d) {
|
|
84
|
+
const e = H, k = J;
|
|
85
|
+
var h = d, g = d.changedTouches;
|
|
86
|
+
g && (h = g[0]);
|
|
87
|
+
H = h.clientX;
|
|
88
|
+
J = h.clientY;
|
|
89
|
+
15 > Math.abs(H - e) && 15 > Math.abs(J - k) && F(d, "tap");
|
|
90
|
+
}
|
|
91
|
+
const c = {passive:!1, capture:!0};
|
|
92
|
+
ca = function(d) {
|
|
93
|
+
G(d, D ? "pointerdown" : "touchstart", a, c);
|
|
94
|
+
G(d, D ? "pointerup" : "touchend", b, c);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function G(a, b, c, d) {
|
|
98
|
+
f(a ? "event.register" : "event.unregister");
|
|
99
|
+
if ("tap" === b) {
|
|
100
|
+
if (C || D) {
|
|
101
|
+
ca(a);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
aa = !0;
|
|
105
|
+
b = "click";
|
|
106
|
+
}
|
|
107
|
+
window[(a ? "add" : "remove") + "EventListener"](b, c, d || !1 === d ? d : !0);
|
|
108
|
+
}
|
|
109
|
+
;function K(a, b, c) {
|
|
110
|
+
f("factory.path");
|
|
111
|
+
let d;
|
|
112
|
+
c && (d = a._mkc) && (a._mkc = null);
|
|
113
|
+
const e = b.length, k = [], h = {};
|
|
114
|
+
for (let n = 0, p, q, r, t, w = null; n < e; n++) {
|
|
115
|
+
p = b[n];
|
|
116
|
+
if (q = p.v) {
|
|
117
|
+
if (t = r = h[q], !t) {
|
|
118
|
+
a: {
|
|
119
|
+
var g = a, l = q;
|
|
120
|
+
f("factory.resolve");
|
|
121
|
+
for (let u = 0, I = l.length, y = ""; u < I; u++) {
|
|
122
|
+
const A = l[u];
|
|
123
|
+
y += A;
|
|
124
|
+
if (h[y]) {
|
|
125
|
+
g = h[y];
|
|
126
|
+
} else {
|
|
127
|
+
if (">" === A) {
|
|
128
|
+
g = g.firstChild;
|
|
129
|
+
} else if ("|" === A) {
|
|
130
|
+
r = [g.firstChild, g];
|
|
131
|
+
break a;
|
|
132
|
+
} else if ("@" === A) {
|
|
133
|
+
r = [g.style, g];
|
|
134
|
+
break a;
|
|
135
|
+
} else {
|
|
136
|
+
g = g.nextSibling;
|
|
137
|
+
}
|
|
138
|
+
h[y] = g;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
r = [g];
|
|
142
|
+
}
|
|
143
|
+
t = r[0];
|
|
144
|
+
r = r[1] || t;
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
t = r = a;
|
|
148
|
+
}
|
|
149
|
+
c && (f("cache.transfer"), w = d ? d[n] : {}, r._mkc = w);
|
|
150
|
+
f("cache.create");
|
|
151
|
+
k[n] = new L(w, t, "");
|
|
152
|
+
}
|
|
153
|
+
return a._mkp = k;
|
|
154
|
+
}
|
|
155
|
+
function M(a, b, c, d, e, k) {
|
|
156
|
+
f("factory.construct");
|
|
157
|
+
k || (a.fullproxy = 1);
|
|
158
|
+
const h = e || (b.tag ? b.svg ? document.createElementNS("http://www.w3.org/2000/svg", b.tag) : document.createElement(b.tag) : document.createTextNode(b.text));
|
|
159
|
+
let g, l;
|
|
160
|
+
if (l = b.class) {
|
|
161
|
+
"object" === typeof l ? (f("cache.create"), c.push(new L(g = {_c:""}, h, d)), (l = l[0]) ? N(a, l, {fn:"_c", index:c.length - 1}) : a.fullproxy = 0) : e || (h.className = l);
|
|
162
|
+
}
|
|
163
|
+
if (l = b.attr) {
|
|
164
|
+
for (const p in l) {
|
|
165
|
+
let q = l[p];
|
|
166
|
+
"object" === typeof q ? (f("cache.create"), g || c.push(new L(g = {}, h, d)), g["_a" + p] = !1, (q = q[0]) ? N(a, q, {fn:"_a", index:c.length - 1, key:p}) : a.fullproxy = 0) : e || h.setAttribute(p, q);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (l = b.event) {
|
|
170
|
+
for (const p in l) {
|
|
171
|
+
e || h.setAttribute(p, l[p]), ba(p);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (l = b.style) {
|
|
175
|
+
"object" === typeof l ? (f("cache.create"), c.push(new L(g || (g = {}), h.style, d + "@")), g._s = "", (l = l[0]) ? N(a, l, {fn:"_s", index:c.length - 1}) : a.fullproxy = 0) : e || (h.style.cssText = l);
|
|
176
|
+
}
|
|
177
|
+
if (l = b.text) {
|
|
178
|
+
if ("object" === typeof l) {
|
|
179
|
+
var n = h;
|
|
180
|
+
l = l[0];
|
|
181
|
+
b.tag ? (d += "|", n = !e && h.firstChild, n || (n = document.createTextNode(l), h.appendChild(n))) : g = {};
|
|
182
|
+
(g || (g = {}))._t = l;
|
|
183
|
+
f("cache.create");
|
|
184
|
+
c.push(new L(g, n, d));
|
|
185
|
+
l ? N(a, l, {fn:"_t", index:c.length - 1}) : a.fullproxy = 0;
|
|
186
|
+
} else {
|
|
187
|
+
e || (b.tag ? h.textContent = l : h.nodeValue = l);
|
|
188
|
+
}
|
|
189
|
+
} else if (l = b.child) {
|
|
190
|
+
if (e && (e = e.firstChild, !e)) {
|
|
191
|
+
return console.warn("Hydration failed of template '" + a.name + "' because the existing DOM structure was incompatible. Falls back to factory construction instead."), null;
|
|
192
|
+
}
|
|
193
|
+
l.constructor !== Array && (l = [l]);
|
|
194
|
+
for (let p = 0, q, r = l.length; p < r; p++) {
|
|
195
|
+
if (q = l[p], d = p ? d + "+" : d + ">", b = M(a, q, c, d, e, 1), e) {
|
|
196
|
+
if (p < r - 1 && (e = e.nextSibling, !e)) {
|
|
197
|
+
return console.warn("Hydration failed of template '" + a.name + "' because the existing DOM structure was incompatible. Falls back to factory construction instead."), null;
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
h.appendChild(b);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} else if (l = b.html) {
|
|
204
|
+
"object" === typeof l ? (f("cache.create"), g || c.push(new L(g = {}, h, d)), g._h = "", (l = l[0]) ? N(a, l, {fn:"_h", index:c.length - 1}) : a.fullproxy = 0) : e || (h.innerHTML = l);
|
|
205
|
+
} else if (l = b.inc) {
|
|
206
|
+
f("cache.create");
|
|
207
|
+
f("template.include");
|
|
208
|
+
g || c.push(new L(null, h, d));
|
|
209
|
+
if ("string" === typeof l) {
|
|
210
|
+
n = O[l];
|
|
211
|
+
if (!n) {
|
|
212
|
+
throw Error("The partial template '" + l + "' which is included by the root template '" + a.name + "' was not registered. When using named includes make sure you register all your includes by Mikado.register(tpl) before instantiating the Mikado view instance.");
|
|
213
|
+
}
|
|
214
|
+
if (!(n instanceof E)) {
|
|
215
|
+
d = n[0];
|
|
216
|
+
if (b = n[1]) {
|
|
217
|
+
b.async = !1, e && (b.root = e, b.hydrate = !0);
|
|
218
|
+
}
|
|
219
|
+
O[l] = n = new E(d, b);
|
|
220
|
+
}
|
|
221
|
+
} else if (1 !== l) {
|
|
222
|
+
d = a.inc.length;
|
|
223
|
+
if (!a.tpl.fn.length) {
|
|
224
|
+
throw Error("The template '" + a.name + "|" + d + "' has conflicts. It should provide a handler entry, but wasn't found.");
|
|
225
|
+
}
|
|
226
|
+
n = new E({name:a.name + "|" + d, tpl:l, key:l.key, cache:l.cache, fn:a.tpl.fn}, {recycle:a.recycle, cache:a.cache, pool:!!a.pool, state:a.state, mount:h, hydrate:!!e});
|
|
227
|
+
}
|
|
228
|
+
1 !== l && a.inc.push(n);
|
|
229
|
+
}
|
|
230
|
+
g && (h._mkc = g);
|
|
231
|
+
k || (h._mkp = c);
|
|
232
|
+
return h;
|
|
233
|
+
}
|
|
234
|
+
function N(a, b, c) {
|
|
235
|
+
f("proxy.init");
|
|
236
|
+
a.proxy || (a.proxy = {});
|
|
237
|
+
(a.proxy[b] || (a.proxy[b] = [])).push(c);
|
|
238
|
+
}
|
|
239
|
+
const P = {checked:1, selected:1, hidden:1};
|
|
240
|
+
function L(a, b, c) {
|
|
241
|
+
this.c = a;
|
|
242
|
+
this.n = b;
|
|
243
|
+
this.v = c;
|
|
244
|
+
}
|
|
245
|
+
L.prototype._a = function(a, b, c, d, e) {
|
|
246
|
+
if (this.c) {
|
|
247
|
+
if (d) {
|
|
248
|
+
if (e || 0 === e) {
|
|
249
|
+
d = d[e] || (d[e] = {});
|
|
250
|
+
}
|
|
251
|
+
d["_a" + a] = b;
|
|
252
|
+
}
|
|
253
|
+
if (this.c["_a" + a] === b) {
|
|
254
|
+
f("cache.match");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
f("cache.miss");
|
|
258
|
+
f("cache.attr");
|
|
259
|
+
this.c["_a" + a] = b;
|
|
260
|
+
}
|
|
261
|
+
!P[a] || c && "selected" === a ? !1 === b ? this.n.removeAttribute(a) : this.n.setAttribute(a, b) : this.n[a] = b;
|
|
262
|
+
};
|
|
263
|
+
L.prototype._t = function(a, b, c) {
|
|
264
|
+
if (this.c) {
|
|
265
|
+
if (b) {
|
|
266
|
+
if (c || 0 === c) {
|
|
267
|
+
b = b[c] || (b[c] = {});
|
|
268
|
+
}
|
|
269
|
+
b._t = a;
|
|
270
|
+
}
|
|
271
|
+
if (this.c._t === a) {
|
|
272
|
+
f("cache.match");
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
f("cache.miss");
|
|
276
|
+
f("cache.text");
|
|
277
|
+
this.c._t = a;
|
|
278
|
+
}
|
|
279
|
+
this.n.nodeValue = a;
|
|
280
|
+
};
|
|
281
|
+
L.prototype._c = function(a, b, c) {
|
|
282
|
+
if (this.c) {
|
|
283
|
+
if (b) {
|
|
284
|
+
if (c || 0 === c) {
|
|
285
|
+
b = b[c] || (b[c] = {});
|
|
286
|
+
}
|
|
287
|
+
b._c = a;
|
|
288
|
+
}
|
|
289
|
+
if (this.c._c === a) {
|
|
290
|
+
f("cache.match");
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
f("cache.miss");
|
|
294
|
+
f("cache.class");
|
|
295
|
+
this.c._c = a;
|
|
296
|
+
}
|
|
297
|
+
this.n.className = a;
|
|
298
|
+
};
|
|
299
|
+
L.prototype._s = function(a, b, c) {
|
|
300
|
+
if (this.c) {
|
|
301
|
+
if (b) {
|
|
302
|
+
if (c || 0 === c) {
|
|
303
|
+
b = b[c] || (b[c] = {});
|
|
304
|
+
}
|
|
305
|
+
b._s = a;
|
|
306
|
+
}
|
|
307
|
+
if (this.c._s === a) {
|
|
308
|
+
f("cache.match");
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
f("cache.miss");
|
|
312
|
+
f("cache.style");
|
|
313
|
+
this.c._s = a;
|
|
314
|
+
}
|
|
315
|
+
this.n.cssText = a;
|
|
316
|
+
};
|
|
317
|
+
L.prototype._h = function(a, b, c) {
|
|
318
|
+
if (this.c) {
|
|
319
|
+
if (b) {
|
|
320
|
+
if (c || 0 === c) {
|
|
321
|
+
b = b[c] || (b[c] = {});
|
|
322
|
+
}
|
|
323
|
+
b._h = a;
|
|
324
|
+
}
|
|
325
|
+
if (this.c._h === a) {
|
|
326
|
+
f("cache.match");
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
f("cache.miss");
|
|
330
|
+
f("cache.html");
|
|
331
|
+
this.c._h = a;
|
|
332
|
+
}
|
|
333
|
+
this.n.innerHTML = a;
|
|
334
|
+
};
|
|
335
|
+
const ea = window.Proxy || function() {
|
|
336
|
+
function a(b, c) {
|
|
337
|
+
this.path = c.path;
|
|
338
|
+
this.fn = c.fn;
|
|
339
|
+
for (const d in b) {
|
|
340
|
+
this.define(b, d, b[d]);
|
|
341
|
+
}
|
|
342
|
+
b._mkx = this;
|
|
343
|
+
return b;
|
|
344
|
+
}
|
|
345
|
+
a.prototype.define = function(b, c, d) {
|
|
346
|
+
f("proxy.define");
|
|
347
|
+
const e = this;
|
|
348
|
+
Object.defineProperty(b, c, {get:function() {
|
|
349
|
+
f("proxy.read");
|
|
350
|
+
return d;
|
|
351
|
+
}, set:function(k) {
|
|
352
|
+
f("proxy.write");
|
|
353
|
+
da(e, d = k, c);
|
|
354
|
+
}});
|
|
355
|
+
};
|
|
356
|
+
return a;
|
|
357
|
+
}();
|
|
358
|
+
function fa(a, b) {
|
|
359
|
+
f("proxy.read");
|
|
360
|
+
return "_mkx" === b ? this : a[b];
|
|
361
|
+
}
|
|
362
|
+
function ha(a, b, c) {
|
|
363
|
+
f("proxy.write");
|
|
364
|
+
da(this, c, b);
|
|
365
|
+
a[b] = c;
|
|
366
|
+
return !0;
|
|
367
|
+
}
|
|
368
|
+
function da(a, b, c) {
|
|
369
|
+
if (c = a.fn[c]) {
|
|
370
|
+
for (let e = 0; e < c.length; e++) {
|
|
371
|
+
var d = c[e];
|
|
372
|
+
const k = d.fn, h = a.path[d.index];
|
|
373
|
+
d = d.key || "";
|
|
374
|
+
h.c && h.c[k + d] === b ? f("cache.match") : (f("cache.miss"), d ? h[k](d, b) : h[k](b));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
;const O = Object.create(null);
|
|
379
|
+
function E(a, b = {}) {
|
|
380
|
+
if (!(this instanceof E)) {
|
|
381
|
+
return new E(a, b);
|
|
382
|
+
}
|
|
383
|
+
f("mikado.new");
|
|
384
|
+
if ("string" === typeof a) {
|
|
385
|
+
var c = O[a];
|
|
386
|
+
if (!c) {
|
|
387
|
+
throw Error("The template '" + a + "' is not registered.");
|
|
388
|
+
}
|
|
389
|
+
if (c instanceof E) {
|
|
390
|
+
return c;
|
|
391
|
+
}
|
|
392
|
+
a = c[0];
|
|
393
|
+
b || (b = c[1]);
|
|
394
|
+
}
|
|
395
|
+
if (!a) {
|
|
396
|
+
throw Error("Initialization Error: Template is not defined.");
|
|
397
|
+
}
|
|
398
|
+
if (!a.tpl) {
|
|
399
|
+
throw Error("Initialization Error: Template isn't supported.");
|
|
400
|
+
}
|
|
401
|
+
this.dom = [];
|
|
402
|
+
this.length = 0;
|
|
403
|
+
this.root = b.root || b.mount || null;
|
|
404
|
+
this.recycle = !!b.recycle;
|
|
405
|
+
this.state = b.state || {};
|
|
406
|
+
this.shadow = b.shadow || !!a.cmp;
|
|
407
|
+
this.key = a.key || "";
|
|
408
|
+
this.live = {};
|
|
409
|
+
c = a.fn;
|
|
410
|
+
a.fc || c && (a.fc = c.slice());
|
|
411
|
+
this.apply = c && c.pop();
|
|
412
|
+
this.tpl = a;
|
|
413
|
+
this.name = a.name;
|
|
414
|
+
this.inc = [];
|
|
415
|
+
this.pool = (c = this.recycle || !!this.key) && b.pool ? 1 : 0;
|
|
416
|
+
this.pool_shared = [];
|
|
417
|
+
this.pool_keyed = new Map();
|
|
418
|
+
this.cache = c && (a.cache || !!b.cache);
|
|
419
|
+
this.async = !!b.async;
|
|
420
|
+
this.timer = 0;
|
|
421
|
+
this.on = b.on || null;
|
|
422
|
+
this.proxy = null;
|
|
423
|
+
this.fullproxy = 0;
|
|
424
|
+
(a = b.observe) && (new Q(a)).mount(this);
|
|
425
|
+
this.root ? this.mount(this.root, b.hydrate) : this.factory = null;
|
|
426
|
+
}
|
|
427
|
+
E.prototype.mount = function(a, b) {
|
|
428
|
+
f("view.mount");
|
|
429
|
+
if (!a) {
|
|
430
|
+
throw Error("No target was passed to .mount()");
|
|
431
|
+
}
|
|
432
|
+
this.timer && this.cancel();
|
|
433
|
+
if (this.shadow) {
|
|
434
|
+
var c = this.tpl.cmp;
|
|
435
|
+
a = a.shadowRoot || a.attachShadow({mode:"open"});
|
|
436
|
+
if (c && c.length) {
|
|
437
|
+
var d = a.lastElementChild;
|
|
438
|
+
if (d) {
|
|
439
|
+
a = d;
|
|
440
|
+
} else {
|
|
441
|
+
c.push({tag:"root"});
|
|
442
|
+
for (let k = 0, h; k < c.length; k++) {
|
|
443
|
+
h = M(this, c[k], [], ""), a.append(h), k === c.length - 1 && (a = h);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
c = a._mki;
|
|
449
|
+
d = this.root !== a;
|
|
450
|
+
if (c === this) {
|
|
451
|
+
if (!d) {
|
|
452
|
+
return this;
|
|
453
|
+
}
|
|
454
|
+
this.dom = a._mkd;
|
|
455
|
+
this.length = this.dom.length;
|
|
456
|
+
} else if (c) {
|
|
457
|
+
f("mikado.unmount");
|
|
458
|
+
c.clear();
|
|
459
|
+
a._mkd = this.dom = [];
|
|
460
|
+
this.length = 0;
|
|
461
|
+
a.firstChild && (f("mount.reset"), a.textContent = "");
|
|
462
|
+
var e = this.on && this.on.unmount;
|
|
463
|
+
e && e(a, c);
|
|
464
|
+
} else {
|
|
465
|
+
if (b) {
|
|
466
|
+
e = a.children;
|
|
467
|
+
f("collection_to_array");
|
|
468
|
+
const k = e.length, h = Array(k);
|
|
469
|
+
for (let g = 0; g < k; g++) {
|
|
470
|
+
h[g] = e[g];
|
|
471
|
+
}
|
|
472
|
+
this.dom = h;
|
|
473
|
+
this.length = this.dom.length;
|
|
474
|
+
} else {
|
|
475
|
+
this.dom = [], this.length = 0, a.firstChild && (f("mount.reset"), a.textContent = "");
|
|
476
|
+
}
|
|
477
|
+
a._mkd = this.dom;
|
|
478
|
+
}
|
|
479
|
+
if (this.key) {
|
|
480
|
+
if (d && this.root && (this.root._mkl = this.live), c === this) {
|
|
481
|
+
this.live = a._mkl;
|
|
482
|
+
} else {
|
|
483
|
+
d = {};
|
|
484
|
+
if (!c && b && this.length) {
|
|
485
|
+
for (let k = 0, h, g; k < this.length; k++) {
|
|
486
|
+
f("hydrate.count"), h = this.dom[k], (g = h.getAttribute("key")) || console.warn("The template '" + this.name + "' runs in keyed mode, but the hydrated component don't have the attribute 'key' exported."), h._mkk = g, d[g] = h;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
a._mkl = this.live = d;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
a._mki = this;
|
|
493
|
+
this.root = a;
|
|
494
|
+
this.factory || (b && this.length && (this.factory = this.dom[0].cloneNode(!0), M(this, this.tpl.tpl, [], "", this.factory) && R(this)), b && f(this.tpl ? "hydrate.error" : "hydrate.success"), this.tpl && (this.factory = M(this, this.tpl.tpl, [], ""), R(this)));
|
|
495
|
+
(b = this.on && this.on.mount) && b(a, this);
|
|
496
|
+
return this;
|
|
497
|
+
};
|
|
498
|
+
function R(a) {
|
|
499
|
+
a.tpl.fc && (a.tpl.fn = a.tpl.fc, a.tpl.fc = null);
|
|
500
|
+
a.tpl = null;
|
|
501
|
+
}
|
|
502
|
+
function ia(a, b, c, d, e) {
|
|
503
|
+
if (!a) {
|
|
504
|
+
throw Error("Root element is not defined.");
|
|
505
|
+
}
|
|
506
|
+
if (!b) {
|
|
507
|
+
throw Error("Template is not defined.");
|
|
508
|
+
}
|
|
509
|
+
var k;
|
|
510
|
+
if ("function" === typeof c || !0 === c) {
|
|
511
|
+
e = c, c = null;
|
|
512
|
+
} else if ("function" === typeof d || !0 === d) {
|
|
513
|
+
e = d, d = null;
|
|
514
|
+
}
|
|
515
|
+
if (e) {
|
|
516
|
+
return new Promise(function(g) {
|
|
517
|
+
requestAnimationFrame(function() {
|
|
518
|
+
ia(a, b, c, d);
|
|
519
|
+
"function" === typeof e && e();
|
|
520
|
+
g();
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
f("mikado.once");
|
|
525
|
+
var h = (k = b.cmp) && k.length;
|
|
526
|
+
k && !h && (a = a.shadowRoot || a.attachShadow({mode:"open"}));
|
|
527
|
+
if (c || h || b.fn) {
|
|
528
|
+
k = new E(b);
|
|
529
|
+
h && (a = k.mount(a).root);
|
|
530
|
+
if (c && Array.isArray(c)) {
|
|
531
|
+
for (h = 0; h < c.length; h++) {
|
|
532
|
+
a.append(k.create(c[h], d, h));
|
|
533
|
+
}
|
|
534
|
+
} else {
|
|
535
|
+
a.append(k.create(c, d));
|
|
536
|
+
}
|
|
537
|
+
k.destroy();
|
|
538
|
+
} else {
|
|
539
|
+
k = M({}, b.tpl, [], "", null, 1), a.append(k);
|
|
540
|
+
}
|
|
541
|
+
return E;
|
|
542
|
+
}
|
|
543
|
+
E.prototype.render = function(a, b, c, d) {
|
|
544
|
+
if (!this.root) {
|
|
545
|
+
throw Error("Template was not mounted or root was not found.");
|
|
546
|
+
}
|
|
547
|
+
if (this.root._mki !== this) {
|
|
548
|
+
throw Error("Another template is already assigned to this root. Please use '.mount(root_element)' before calling '.render()' to switch the context of a template.");
|
|
549
|
+
}
|
|
550
|
+
if (!d) {
|
|
551
|
+
var e;
|
|
552
|
+
if (b && (e = "function" === typeof b) || !0 === b) {
|
|
553
|
+
c = b, b = null;
|
|
554
|
+
}
|
|
555
|
+
this.timer && this.cancel();
|
|
556
|
+
if (this.async || c) {
|
|
557
|
+
const n = this;
|
|
558
|
+
e || (e = "function" === typeof c);
|
|
559
|
+
n.timer = requestAnimationFrame(function() {
|
|
560
|
+
n.timer = 0;
|
|
561
|
+
n.render(a, b, null, 1);
|
|
562
|
+
c();
|
|
563
|
+
});
|
|
564
|
+
return e ? this : new Promise(function(p) {
|
|
565
|
+
c = p;
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
f("view.render");
|
|
570
|
+
var k = this.length;
|
|
571
|
+
if (!a && !this.apply) {
|
|
572
|
+
return this.dom[0] || this.add(), this;
|
|
573
|
+
}
|
|
574
|
+
if (Array.isArray(a) || a instanceof Q) {
|
|
575
|
+
if (d = a.length, !d) {
|
|
576
|
+
return this.remove(0, k);
|
|
577
|
+
}
|
|
578
|
+
} else {
|
|
579
|
+
if (this.proxy) {
|
|
580
|
+
throw Error("When a template is using data bindings by an expression like {{= ... }} you will need to pass an array to the render() function, also when just one single item should be rendered. Because the array you will pass in is getting proxified after calling .render(arr), after then you can trigger bindings via arr[0].prop = 'value'.");
|
|
581
|
+
}
|
|
582
|
+
a = [a];
|
|
583
|
+
d = 1;
|
|
584
|
+
}
|
|
585
|
+
var h = this.key;
|
|
586
|
+
e = this.proxy;
|
|
587
|
+
!k || h || this.recycle || (this.remove(0, k), k = 0);
|
|
588
|
+
let g = k < d ? k : d, l = 0;
|
|
589
|
+
if (l < g) {
|
|
590
|
+
for (let n, p; l < g; l++) {
|
|
591
|
+
n = this.dom[l];
|
|
592
|
+
p = a[l];
|
|
593
|
+
if (h && n._mkk !== p[h]) {
|
|
594
|
+
return this.reconcile(a, b, l);
|
|
595
|
+
}
|
|
596
|
+
this.update(n, p, b, l);
|
|
597
|
+
e && !p._mkx && (a[l] = S(this, n, p));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (l < d) {
|
|
601
|
+
for (k = h || this.recycle; l < d; l++) {
|
|
602
|
+
h = a[l], this.add(h, b), !e || k && h._mkx || (a[l] = S(this, this.dom[l], h));
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
d < k && this.remove(d, k - d);
|
|
606
|
+
}
|
|
607
|
+
return this;
|
|
608
|
+
};
|
|
609
|
+
E.prototype.replace = function(a, b, c, d) {
|
|
610
|
+
f("view.replace");
|
|
611
|
+
"undefined" === typeof d && ("number" === typeof a ? (d = 0 > a ? this.length + a : a, a = this.dom[d]) : d = this.index(a));
|
|
612
|
+
var e;
|
|
613
|
+
if (this.key) {
|
|
614
|
+
var k = b[this.key];
|
|
615
|
+
if (e = this.live[k]) {
|
|
616
|
+
if (e !== a) {
|
|
617
|
+
k = this.index(e);
|
|
618
|
+
const h = k < d ? e : a, g = k < d ? a : e;
|
|
619
|
+
let l = this.dom[k < d ? k + 1 : d + 1];
|
|
620
|
+
this.dom[d] = e;
|
|
621
|
+
this.dom[k] = a;
|
|
622
|
+
l !== g ? this.root.insertBefore(h, g) : l = h;
|
|
623
|
+
this.root.insertBefore(g, l);
|
|
624
|
+
}
|
|
625
|
+
} else {
|
|
626
|
+
this.pool && (e = this.pool_keyed.get(k)) && (this.pool_keyed.delete(k), this.checkout(a), this.dom[d] = e, a.replaceWith(e));
|
|
627
|
+
}
|
|
628
|
+
} else {
|
|
629
|
+
this.recycle && (e = a);
|
|
630
|
+
}
|
|
631
|
+
e ? this.apply && (this.fullproxy && b._mkx || this.apply(b, c || this.state, d, e._mkp || K(e, this.factory._mkp, this.cache))) : (b = this.create(b, c, d, 1), (this.key || this.pool) && this.checkout(a), this.dom[d] = b, a.replaceWith(b));
|
|
632
|
+
(d = this.on && this.on.replace) && d(a, this);
|
|
633
|
+
return this;
|
|
634
|
+
};
|
|
635
|
+
E.prototype.update = function(a, b, c, d) {
|
|
636
|
+
if (!this.apply) {
|
|
637
|
+
return "number" !== typeof d && console.warn("The template '" + this.name + "' is a static template and should not be updated. Alternatively you can use .replace() to switch contents."), this;
|
|
638
|
+
}
|
|
639
|
+
if (this.fullproxy && b._mkx) {
|
|
640
|
+
return this;
|
|
641
|
+
}
|
|
642
|
+
f("view.update");
|
|
643
|
+
"undefined" === typeof d && ("number" === typeof a ? (d = 0 > a ? this.length + a - 1 : a, a = this.dom[d]) : d = this.index(a));
|
|
644
|
+
this.apply(b, c || this.state, d, a._mkp || K(a, this.factory._mkp, this.cache));
|
|
645
|
+
(b = this.on && this.on.update) && b(a, this);
|
|
646
|
+
return this;
|
|
647
|
+
};
|
|
648
|
+
E.prototype.cancel = function() {
|
|
649
|
+
f("view.cancel");
|
|
650
|
+
cancelAnimationFrame(this.timer);
|
|
651
|
+
this.timer = 0;
|
|
652
|
+
return this;
|
|
653
|
+
};
|
|
654
|
+
E.prototype.create = function(a, b, c, d) {
|
|
655
|
+
f("view.create");
|
|
656
|
+
const e = this.key, k = e && a[e];
|
|
657
|
+
let h;
|
|
658
|
+
var g;
|
|
659
|
+
let l, n;
|
|
660
|
+
this.pool && (e ? (g = this.pool_keyed) && (h = g.get(k)) && (f("pool.out"), g.delete(k), n = 1) : (g = this.pool_shared) && g.length && (f("pool.out"), h = g.pop()));
|
|
661
|
+
h || (h = l = this.factory, l || (this.factory = h = l = M(this, this.tpl.tpl, [], ""), R(this)));
|
|
662
|
+
let p;
|
|
663
|
+
this.apply && (g = h._mkp || K(h, this.factory._mkp, !!l || this.cache), p = l && this.cache && Array(g.length), this.apply(a, b || this.state, c, g, !!l, p));
|
|
664
|
+
l && (f("factory.clone"), h = l.cloneNode(!0), p && !0 !== p && (h._mkc = p), h._mkr = 1);
|
|
665
|
+
e && (n || (h._mkk = k), d && (this.live[k] = h));
|
|
666
|
+
(a = this.on && this.on[l ? "create" : "recycle"]) && a(h, this);
|
|
667
|
+
return h;
|
|
668
|
+
};
|
|
669
|
+
E.prototype.add = function(a, b, c) {
|
|
670
|
+
f("view.add");
|
|
671
|
+
let d;
|
|
672
|
+
"number" === typeof b ? (c = 0 > b ? this.length + b : b, b = null, d = c < this.length) : "number" === typeof c ? (0 > c && (c += this.length), d = c < this.length) : c = this.length;
|
|
673
|
+
a = this.create(a, b, c, 1);
|
|
674
|
+
d ? (this.root.insertBefore(a, this.dom[c]), ja(this.dom, this.length - 1, c, a), this.length++) : (this.root.appendChild(a), this.dom[this.length++] = a);
|
|
675
|
+
this.key && this.pool && this.pool < this.length && (this.pool = this.length);
|
|
676
|
+
(c = this.on && this.on.insert) && c(a, this);
|
|
677
|
+
return this;
|
|
678
|
+
};
|
|
679
|
+
function S(a, b, c) {
|
|
680
|
+
f("proxy.apply");
|
|
681
|
+
{
|
|
682
|
+
b = b._mkp || K(b, a.factory._mkp, a.cache);
|
|
683
|
+
a = a.proxy;
|
|
684
|
+
f("proxy.create");
|
|
685
|
+
const d = c._mkx;
|
|
686
|
+
d ? d.path = b : (f("proxy.new"), c = new ea(c, {path:b, fn:a, get:fa, set:ha}));
|
|
687
|
+
}
|
|
688
|
+
return c;
|
|
689
|
+
}
|
|
690
|
+
E.prototype.reconcile = function(a, b, c) {
|
|
691
|
+
f("view.reconcile");
|
|
692
|
+
const d = this.dom, e = this.live, k = this.key;
|
|
693
|
+
let h = a.length, g = d.length, l = g > h ? g : h, n = 0;
|
|
694
|
+
for (c || (c = 0); c < l; c++) {
|
|
695
|
+
var p = void 0;
|
|
696
|
+
if (c < h) {
|
|
697
|
+
var q = a[c], r = c >= g;
|
|
698
|
+
let t, w, u, I;
|
|
699
|
+
this.proxy && (q._mkx ? I = this.fullproxy : a[c] = S(this, d[c], q));
|
|
700
|
+
if (!r && (t = d[c], w = q[k], u = t._mkk, u === w)) {
|
|
701
|
+
I || this.update(t, q, b, c);
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
if (r || !e[w]) {
|
|
705
|
+
r || !this.pool ? (g++, l = g > h ? g : h, this.add(q, b, c)) : this.replace(t, q, b, c);
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
let y, A;
|
|
709
|
+
for (r = c + 1; r < l; r++) {
|
|
710
|
+
if (!y && r < g && d[r]._mkk === w && (y = r + 1), !A && r < h && a[r][k] === u && (A = r + 1), y && A) {
|
|
711
|
+
y >= A + n ? (p = d[y - 1], this.root.insertBefore(p, t), I || this.update(p, q, b, c), y === A ? (1 < r - c && this.root.insertBefore(t, d[y]), d[c] = d[r], (d[r] = t) || console.error("reconcile.error 1"), f("view.reconcile.steps")) : (y - 1 === c && console.error("reconcile.error 2"), ja(d, y - 1, c), n++)) : (q = A - 1 + n, this.root.insertBefore(t, d[q] || null), (q > g ? g : q) - 1 === c && console.error("reconcile.error 3"), ja(d, c, (q > g ? g : q) - 1), n--, c--);
|
|
712
|
+
f("view.reconcile.steps");
|
|
713
|
+
p = 1;
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
p || (this.remove(c), g--, l = g > h ? g : h, c--);
|
|
719
|
+
}
|
|
720
|
+
return this;
|
|
721
|
+
};
|
|
722
|
+
function ja(a, b, c, d) {
|
|
723
|
+
f("splice");
|
|
724
|
+
const e = d || a[b];
|
|
725
|
+
d && b++;
|
|
726
|
+
if (b < c) {
|
|
727
|
+
for (; b < c; b++) {
|
|
728
|
+
a[b] = a[b + 1];
|
|
729
|
+
}
|
|
730
|
+
} else {
|
|
731
|
+
for (; b > c; b--) {
|
|
732
|
+
a[b] = a[b - 1];
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
a[c] = e;
|
|
736
|
+
}
|
|
737
|
+
E.prototype.append = function(a, b, c) {
|
|
738
|
+
f("view.append");
|
|
739
|
+
let d;
|
|
740
|
+
"number" === typeof b ? (c = 0 > b ? this.length + b : b, b = null, d = 1) : "number" === typeof c && (0 > c && (c += this.length), d = 1);
|
|
741
|
+
const e = a.length;
|
|
742
|
+
for (let k = 0; k < e; k++) {
|
|
743
|
+
this.add(a[k], b, d ? c++ : null);
|
|
744
|
+
}
|
|
745
|
+
return this;
|
|
746
|
+
};
|
|
747
|
+
E.prototype.clear = function() {
|
|
748
|
+
f("view.clear");
|
|
749
|
+
this.length && this.remove(0, this.length);
|
|
750
|
+
return this;
|
|
751
|
+
};
|
|
752
|
+
E.prototype.remove = function(a, b) {
|
|
753
|
+
let c = this.length;
|
|
754
|
+
c && a && ("number" !== typeof a ? a = this.index(a) : 0 > a && (a = c + a));
|
|
755
|
+
if (!c || a >= c) {
|
|
756
|
+
return this;
|
|
757
|
+
}
|
|
758
|
+
b ? 0 > b && (a -= b + 1, 0 > a && (a = 0), b *= -1) : b = 1;
|
|
759
|
+
let d;
|
|
760
|
+
!a && b >= c ? (d = this.dom, b = d.length, this.root.textContent = "", this.root._mkd = this.dom = [], c = 0) : (d = this.dom.splice(a, b), c -= b);
|
|
761
|
+
const e = this.pool && !this.key, k = this.key || this.pool, h = this.on && this.on.remove;
|
|
762
|
+
(a = this.key && this.pool) && b >= a && (this.pool_keyed = new Map(), a = 0);
|
|
763
|
+
for (let g = 0, l; g < b; g++) {
|
|
764
|
+
f("view.remove"), l = d[e ? b - g - 1 : g], c && l.remove(), k && this.checkout(l, 1), h && h(l, this);
|
|
765
|
+
}
|
|
766
|
+
if (a && 0 < (a = this.pool_keyed.size - a)) {
|
|
767
|
+
for (b = this.pool_keyed.keys(); a--;) {
|
|
768
|
+
this.pool_keyed.delete(b.next().value);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
this.length = c;
|
|
772
|
+
return this;
|
|
773
|
+
};
|
|
774
|
+
E.prototype.index = function(a) {
|
|
775
|
+
f("view.index");
|
|
776
|
+
return a ? this.dom.indexOf(a) : -1;
|
|
777
|
+
};
|
|
778
|
+
E.prototype.node = function(a) {
|
|
779
|
+
f("view.node");
|
|
780
|
+
return this.dom[a];
|
|
781
|
+
};
|
|
782
|
+
E.prototype.checkout = function(a, b) {
|
|
783
|
+
f("view.checkout");
|
|
784
|
+
let c;
|
|
785
|
+
this.key && (c = a._mkk, this.live[c] = null);
|
|
786
|
+
this.pool && (c ? (f("pool.in"), this.pool_keyed.set(c, a), !b && this.pool_keyed.size > this.pool && (f("pool.resize"), this.pool_keyed.delete(this.pool_keyed.keys().next().value))) : (b = this.pool_shared.length, f("pool.in"), this.pool_shared[b] = a));
|
|
787
|
+
};
|
|
788
|
+
E.prototype.flush = function() {
|
|
789
|
+
f("view.flush");
|
|
790
|
+
this.pool_shared = [];
|
|
791
|
+
this.pool_keyed = new Map();
|
|
792
|
+
return this;
|
|
793
|
+
};
|
|
794
|
+
E.prototype.destroy = function() {
|
|
795
|
+
f("view.destroy");
|
|
796
|
+
for (let a = 0, b; a < this.inc.length; a++) {
|
|
797
|
+
b = this.inc[a], O[b.name] || b.destroy();
|
|
798
|
+
}
|
|
799
|
+
this.key && (this.root && (this.root._mkl = null), this.live = null);
|
|
800
|
+
this.root && (this.root._mkd = this.root._mki = null);
|
|
801
|
+
this.proxy = this.on = this.pool_keyed = this.pool_shared = this.dom = this.root = this.tpl = this.apply = this.inc = this.state = this.factory = null;
|
|
802
|
+
};
|
|
803
|
+
const T = Array.prototype, ka = window.Proxy;
|
|
804
|
+
let U = !1;
|
|
805
|
+
function V(a) {
|
|
806
|
+
if (!a) {
|
|
807
|
+
throw Error("The observable array was not assigned to a Mikado instance. You need to pass in the observable array when initiating a Mikado instance.");
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
function Q(a) {
|
|
811
|
+
if (a instanceof Q) {
|
|
812
|
+
return a;
|
|
813
|
+
}
|
|
814
|
+
if (!(this instanceof Q)) {
|
|
815
|
+
return new Q(a);
|
|
816
|
+
}
|
|
817
|
+
f("observer.create");
|
|
818
|
+
this.mikado = null;
|
|
819
|
+
const b = a ? a.length : 0;
|
|
820
|
+
if (ka) {
|
|
821
|
+
if (b) {
|
|
822
|
+
for (let c = 0; c < b; c++) {
|
|
823
|
+
this[c] = a[c];
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
this.length = b;
|
|
827
|
+
this.proto = {splice:T.splice.bind(this), pop:T.pop.bind(this), shift:T.shift.bind(this), unshift:T.unshift.bind(this), push:T.push.bind(this)};
|
|
828
|
+
return new Proxy(this, la);
|
|
829
|
+
}
|
|
830
|
+
this.proto = a || [];
|
|
831
|
+
for (a = 0; a <= b; a++) {
|
|
832
|
+
this.define(a);
|
|
833
|
+
}
|
|
834
|
+
this.define("length");
|
|
835
|
+
}
|
|
836
|
+
Q.prototype.mount = function(a) {
|
|
837
|
+
f("observer.mount");
|
|
838
|
+
this.mikado !== a && (this.mikado && a.mount(this.mikado.root), this.mikado = a);
|
|
839
|
+
return this;
|
|
840
|
+
};
|
|
841
|
+
Q.prototype.define = function(a) {
|
|
842
|
+
f("observer.define");
|
|
843
|
+
Object.defineProperty(this, a, {get:function() {
|
|
844
|
+
return this.proto[a];
|
|
845
|
+
}, set:function(b) {
|
|
846
|
+
"number" === typeof a && (a === this.length && this.define(a + 1), la.set(this, a, b));
|
|
847
|
+
}});
|
|
848
|
+
return this;
|
|
849
|
+
};
|
|
850
|
+
const la = {set:function(a, b, c) {
|
|
851
|
+
f("observer.write");
|
|
852
|
+
let d;
|
|
853
|
+
if ("number" === typeof b) {
|
|
854
|
+
d = !0;
|
|
855
|
+
} else {
|
|
856
|
+
var e = parseInt(b, 10);
|
|
857
|
+
b === "" + e && (d = !0);
|
|
858
|
+
}
|
|
859
|
+
e = a.mikado;
|
|
860
|
+
if (!U) {
|
|
861
|
+
U = !0;
|
|
862
|
+
if (e) {
|
|
863
|
+
var k = a.length;
|
|
864
|
+
if (d) {
|
|
865
|
+
V(e);
|
|
866
|
+
const h = e.length;
|
|
867
|
+
k !== h && (a.length = h);
|
|
868
|
+
b >= h ? (e.add(c), a.length++) : b < h && (k = e.dom[b], e.recycle || e.key && k._mkk === c[e.key] ? e.update(k, c, null, b) : e.replace(k, c, null, b));
|
|
869
|
+
} else {
|
|
870
|
+
"length" === b && c < k && e.remove(c, k - c);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
U = !1;
|
|
874
|
+
}
|
|
875
|
+
e && (k = e.recycle || e.key, !d || !e.proxy || k && c._mkx || (c = S(e, e.dom[b], c)));
|
|
876
|
+
(ka ? a : a.proto)[b] = c;
|
|
877
|
+
return !0;
|
|
878
|
+
}, get:function(a, b) {
|
|
879
|
+
f("observer.read");
|
|
880
|
+
return a[b];
|
|
881
|
+
}};
|
|
882
|
+
Q.prototype.set = function(a) {
|
|
883
|
+
f("observer.set");
|
|
884
|
+
const b = this.mikado;
|
|
885
|
+
b.recycle || b.key ? (U = !0, b.render(a), U = !1, this.length > a.length && this.splice(a.length)) : (this.splice(), this.concat(a));
|
|
886
|
+
return this;
|
|
887
|
+
};
|
|
888
|
+
Q.prototype.splice = function(a, b, c) {
|
|
889
|
+
f("observer.splice");
|
|
890
|
+
V(this.mikado);
|
|
891
|
+
U = !0;
|
|
892
|
+
a || (a = 0);
|
|
893
|
+
"undefined" === typeof b && (b = this.length - a, 0 > b && (b = 0));
|
|
894
|
+
b && this.mikado.remove(a, b);
|
|
895
|
+
b = c ? this.proto.splice(a, b, c) : this.proto.splice(a, b);
|
|
896
|
+
c && this.mikado.add(c, a);
|
|
897
|
+
U = !1;
|
|
898
|
+
return b;
|
|
899
|
+
};
|
|
900
|
+
Q.prototype.push = function(a) {
|
|
901
|
+
f("observer.push");
|
|
902
|
+
V(this.mikado);
|
|
903
|
+
U = !0;
|
|
904
|
+
this.mikado.add(a);
|
|
905
|
+
this[this.length] = a;
|
|
906
|
+
ka && this.length++;
|
|
907
|
+
U = !1;
|
|
908
|
+
};
|
|
909
|
+
Q.prototype.unshift = function(a) {
|
|
910
|
+
f("observer.unshift");
|
|
911
|
+
V(this.mikado);
|
|
912
|
+
U = !0;
|
|
913
|
+
this.mikado.add(a, 0);
|
|
914
|
+
this.proto.unshift(a);
|
|
915
|
+
U = !1;
|
|
916
|
+
};
|
|
917
|
+
Q.prototype.pop = function() {
|
|
918
|
+
f("observer.pop");
|
|
919
|
+
V(this.mikado);
|
|
920
|
+
U = !0;
|
|
921
|
+
this.mikado.remove(this.length - 1);
|
|
922
|
+
const a = this.proto.pop();
|
|
923
|
+
U = !1;
|
|
924
|
+
return a;
|
|
925
|
+
};
|
|
926
|
+
Q.prototype.shift = function() {
|
|
927
|
+
f("observer.shift");
|
|
928
|
+
V(this.mikado);
|
|
929
|
+
U = !0;
|
|
930
|
+
this.mikado.remove(0);
|
|
931
|
+
const a = this.proto.shift();
|
|
932
|
+
U = !1;
|
|
933
|
+
return a;
|
|
934
|
+
};
|
|
935
|
+
Q.prototype.concat = function(a) {
|
|
936
|
+
f("observer.concat");
|
|
937
|
+
const b = a.length;
|
|
938
|
+
for (let c = 0; c < b; c++) {
|
|
939
|
+
this.push(a[c]);
|
|
940
|
+
}
|
|
941
|
+
return this;
|
|
942
|
+
};
|
|
943
|
+
Q.prototype.sort = T.sort;
|
|
944
|
+
Q.prototype.reverse = T.reverse;
|
|
945
|
+
Q.prototype.slice = T.slice;
|
|
946
|
+
Q.prototype.map = function(a, b) {
|
|
947
|
+
f("observer.map");
|
|
948
|
+
b && (a = a.bind(this));
|
|
949
|
+
for (let c = 0, d = this.length; c < d; c++) {
|
|
950
|
+
this[c] = a(this[c]);
|
|
951
|
+
}
|
|
952
|
+
return this;
|
|
953
|
+
};
|
|
954
|
+
Q.prototype.filter = function(a, b) {
|
|
955
|
+
f("observer.filter");
|
|
956
|
+
b && (a = a.bind(this));
|
|
957
|
+
let c, d;
|
|
958
|
+
for (let e = 0, k = this.length; e < k; e++) {
|
|
959
|
+
a(this[e]) ? d && (this.splice(c, d), k -= d, e -= d, d = 0) : d ? d++ : (c = e, d = 1);
|
|
960
|
+
}
|
|
961
|
+
d && this.splice(c, d);
|
|
962
|
+
return this;
|
|
963
|
+
};
|
|
964
|
+
Q.prototype.indexOf = function(a) {
|
|
965
|
+
f("observer.indexOf");
|
|
966
|
+
for (let b = 0, c = this.length; b < c; b++) {
|
|
967
|
+
if (this[b] === a) {
|
|
968
|
+
return b;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return -1;
|
|
972
|
+
};
|
|
973
|
+
Q.prototype.lastIndexOf = function(a) {
|
|
974
|
+
f("observer.lastIndexOf");
|
|
975
|
+
for (let b = this.length - 1; 0 <= b; b--) {
|
|
976
|
+
if (this[b] === a) {
|
|
977
|
+
return b;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return -1;
|
|
981
|
+
};
|
|
982
|
+
Q.prototype.includes = T.includes;
|
|
983
|
+
Q.prototype.forEach = function(a) {
|
|
984
|
+
f("observer.forEach");
|
|
985
|
+
for (let b = 0, c = this.length; b < c; b++) {
|
|
986
|
+
a(this[b]);
|
|
987
|
+
}
|
|
988
|
+
return this;
|
|
989
|
+
};
|
|
990
|
+
Q.prototype.swap = function(a, b) {
|
|
991
|
+
f("observer.swap");
|
|
992
|
+
const c = this[b];
|
|
993
|
+
this[b] = this[a];
|
|
994
|
+
this[a] = c;
|
|
995
|
+
return this;
|
|
996
|
+
};
|
|
997
|
+
Q.prototype.transaction = function(a) {
|
|
998
|
+
f("observer.transaction");
|
|
999
|
+
V(this.mikado);
|
|
1000
|
+
U = !0;
|
|
1001
|
+
a();
|
|
1002
|
+
U = !1;
|
|
1003
|
+
const b = this.mikado, c = b.fullproxy;
|
|
1004
|
+
b.fullproxy = 0;
|
|
1005
|
+
b.async ? b.render(this).then(function() {
|
|
1006
|
+
b.fullproxy = c;
|
|
1007
|
+
}) : (b.render(this), b.fullproxy = c);
|
|
1008
|
+
};
|
|
1009
|
+
const W = document.createElement("div"), ma = document.createTextNode(""), X = document.createElement("div");
|
|
1010
|
+
W.appendChild(ma);
|
|
1011
|
+
E.prototype.move = E.prototype.moveTo = function(a, b) {
|
|
1012
|
+
let c;
|
|
1013
|
+
"number" === typeof a ? (c = a, a = this.dom[c]) : c = this.index(a);
|
|
1014
|
+
0 > b && (b = this.length + b - 1);
|
|
1015
|
+
c !== b && this.shift(a, b - c);
|
|
1016
|
+
return this;
|
|
1017
|
+
};
|
|
1018
|
+
E.prototype.shift = E.prototype.shiftBy = function(a, b) {
|
|
1019
|
+
if (!b) {
|
|
1020
|
+
return this;
|
|
1021
|
+
}
|
|
1022
|
+
if ("number" === typeof a) {
|
|
1023
|
+
var c = a;
|
|
1024
|
+
a = this.dom[a];
|
|
1025
|
+
} else {
|
|
1026
|
+
c = this.index(a);
|
|
1027
|
+
}
|
|
1028
|
+
const d = 0 > b;
|
|
1029
|
+
if (d && c || !d && c < this.length - 1) {
|
|
1030
|
+
b = d ? Math.max(c + b, 0) : Math.min(c + b, this.length - 1);
|
|
1031
|
+
const e = this.dom[b], k = d && 1 < c - b || !d && 1 < b - c;
|
|
1032
|
+
this.root.insertBefore(a, d ? e : this.dom[b + 1] || null);
|
|
1033
|
+
if (k) {
|
|
1034
|
+
a = this.dom[c];
|
|
1035
|
+
if (d) {
|
|
1036
|
+
for (; c > b; c--) {
|
|
1037
|
+
this.dom[c] = this.dom[c - 1];
|
|
1038
|
+
}
|
|
1039
|
+
} else {
|
|
1040
|
+
for (; c < b; c++) {
|
|
1041
|
+
this.dom[c] = this.dom[c + 1];
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
this.dom[b] = a;
|
|
1045
|
+
} else {
|
|
1046
|
+
this.dom[c] = e, this.dom[b] = a;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
return this;
|
|
1050
|
+
};
|
|
1051
|
+
E.prototype.up = function(a, b) {
|
|
1052
|
+
(!b || 0 < b) && this.shift(a, -(b || 1));
|
|
1053
|
+
return this;
|
|
1054
|
+
};
|
|
1055
|
+
E.prototype.down = function(a, b) {
|
|
1056
|
+
(!b || 0 < b) && this.shift(a, b || 1);
|
|
1057
|
+
return this;
|
|
1058
|
+
};
|
|
1059
|
+
E.prototype.first = function(a) {
|
|
1060
|
+
return this.shift(a, -this.length);
|
|
1061
|
+
};
|
|
1062
|
+
E.prototype.last = function(a) {
|
|
1063
|
+
return this.shift(a, this.length);
|
|
1064
|
+
};
|
|
1065
|
+
E.prototype.before = function(a, b) {
|
|
1066
|
+
"number" !== typeof a && (a = this.index(a));
|
|
1067
|
+
"number" !== typeof b && (b = this.index(b));
|
|
1068
|
+
b !== a + 1 && (0 > b && (b = this.length + b, 0 > a && b--), 0 > a && (a = this.length + a - 1), this.shift(a, b - a - 1));
|
|
1069
|
+
return this;
|
|
1070
|
+
};
|
|
1071
|
+
E.prototype.after = function(a, b) {
|
|
1072
|
+
"number" !== typeof a && (a = this.index(a));
|
|
1073
|
+
"number" !== typeof b && (b = this.index(b));
|
|
1074
|
+
b !== a - 1 && (0 > b && (b = this.length + b - 2, 0 > a && b++), 0 > a && (a = this.length + a - 1), this.shift(a, b - a + 1));
|
|
1075
|
+
return this;
|
|
1076
|
+
};
|
|
1077
|
+
E.prototype.swap = function(a, b) {
|
|
1078
|
+
if (a !== b) {
|
|
1079
|
+
let c, d;
|
|
1080
|
+
"number" === typeof a ? (c = 0 > a ? this.length + a : a, a = this.dom[c]) : c = this.index(a);
|
|
1081
|
+
"number" === typeof b ? (d = 0 > b ? this.length + b : b, b = this.dom[d]) : d = this.index(b);
|
|
1082
|
+
const e = c + 1 !== d;
|
|
1083
|
+
this.root.insertBefore(e ? a : b, e ? b : a);
|
|
1084
|
+
e && d + 1 !== c && this.root.insertBefore(b, this.dom[c + 1] || null);
|
|
1085
|
+
this.dom[c] = b;
|
|
1086
|
+
this.dom[d] = a;
|
|
1087
|
+
}
|
|
1088
|
+
return this;
|
|
1089
|
+
};
|
|
1090
|
+
const na = {tap:1, change:1, click:1, dblclick:1, input:1, keydown:1, keypress:1, keyup:1, mousedown:1, mouseenter:1, mouseleave:1, mousemove:1, mouseout:1, mouseover:1, mouseup:1, mousewheel:1, touchstart:1, touchmove:1, touchend:1, touchcancel:1, reset:1, select:1, submit:1, toggle:1, blur:1, error:1, focus:1, load:1, resize:1, scroll:1};
|
|
1091
|
+
let oa = 0, pa = 0;
|
|
1092
|
+
function qa(a, b, c, d, e, k) {
|
|
1093
|
+
oa || (oa = 1, console.info("If this page has set a Content-Security-Policy (CSP) header field, using the inline compiler has disadvantage when not configure \"script-src 'unsafe-eval'\". It is recommended to use the Mikado native compiler, which is CSP-friendly and also can optimize your templates more powerful."));
|
|
1094
|
+
if (b) {
|
|
1095
|
+
return new Promise(function(w) {
|
|
1096
|
+
const u = qa(a);
|
|
1097
|
+
"function" === typeof b && b(u);
|
|
1098
|
+
w(u);
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
e || (d = [], c = [d], d.index = e = {current:-1, count:0, last:-1, inc:0, included:!1});
|
|
1102
|
+
const h = k ? {} : {tpl:{}}, g = k ? h : h.tpl;
|
|
1103
|
+
if (!k) {
|
|
1104
|
+
if ("string" === typeof a) {
|
|
1105
|
+
if (/<.*>/.test(a)) {
|
|
1106
|
+
var l = document.createElement("div");
|
|
1107
|
+
l.innerHTML = a;
|
|
1108
|
+
a = l.firstElementChild;
|
|
1109
|
+
} else {
|
|
1110
|
+
h.name = a, a = document.getElementById(a);
|
|
1111
|
+
}
|
|
1112
|
+
if (!a) {
|
|
1113
|
+
throw Error("The template was not found.");
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
a.content && (h.name || (h.name = a.id || a.getAttribute("name")), a = a.content.firstElementChild);
|
|
1117
|
+
}
|
|
1118
|
+
l = a.tagName;
|
|
1119
|
+
if (!l || "SCRIPT" === l) {
|
|
1120
|
+
var n;
|
|
1121
|
+
if ((n = (l ? a.firstChild : a).nodeValue) && n && n.trim()) {
|
|
1122
|
+
if (n.includes("{{@")) {
|
|
1123
|
+
var p = n.replace(/{{@([\s\S]+)}}/g, "$1").trim();
|
|
1124
|
+
n = /{{[\s\S]+}}/.test(p) ? p.replace(/{{([\s\S]+)}}/g, "{{$1}}") : "";
|
|
1125
|
+
p && (p = p.replace(/{{([\s\S]+)}}/g, ""));
|
|
1126
|
+
p && d.push(p);
|
|
1127
|
+
if ("SCRIPT" === l) {
|
|
1128
|
+
return n.trim() && (g.text = n, g.tag = l), g;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
n && n.trim() && (n.includes("{{#") ? ra(g, "html", n, !1, null, e, c, d) : (e.count++, ra(g, "text", n, !1, null, e, c, d)));
|
|
1132
|
+
}
|
|
1133
|
+
if (!l) {
|
|
1134
|
+
return n && n.trim() ? g : null;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
l && (g.tag = l);
|
|
1138
|
+
if ((n = a.attributes) && n.length) {
|
|
1139
|
+
l = {};
|
|
1140
|
+
for (p = 0; p < n.length; p++) {
|
|
1141
|
+
let w = n[p].nodeName, u = a.getAttribute(w);
|
|
1142
|
+
"include" === w && (w = "inc");
|
|
1143
|
+
l[w] = u;
|
|
1144
|
+
}
|
|
1145
|
+
n = l;
|
|
1146
|
+
for (var q in n) {
|
|
1147
|
+
l = n[q];
|
|
1148
|
+
var r = void 0, t = void 0;
|
|
1149
|
+
switch(q) {
|
|
1150
|
+
case "class":
|
|
1151
|
+
case "style":
|
|
1152
|
+
r = q;
|
|
1153
|
+
break;
|
|
1154
|
+
case "include":
|
|
1155
|
+
q = "inc";
|
|
1156
|
+
case "inc":
|
|
1157
|
+
r = q;
|
|
1158
|
+
break;
|
|
1159
|
+
case "if":
|
|
1160
|
+
r = q;
|
|
1161
|
+
break;
|
|
1162
|
+
case "foreach":
|
|
1163
|
+
r = q = "for";
|
|
1164
|
+
break;
|
|
1165
|
+
case "js":
|
|
1166
|
+
break;
|
|
1167
|
+
case "key":
|
|
1168
|
+
h.key = l.replace(/({{|}})/g, "").trim().replace("data.", "");
|
|
1169
|
+
break;
|
|
1170
|
+
case "cache":
|
|
1171
|
+
break;
|
|
1172
|
+
default:
|
|
1173
|
+
na[q] ? t = g.event || (g.event = {}) : (k || "id" !== q && "name" !== q || h.name || /{{[\s\S]+}}/.test(l) || (h.name = l), t = g.attr || (g.attr = {})), r = q;
|
|
1174
|
+
}
|
|
1175
|
+
r && ra(t || g, r, l, !!t, n, e, c, d);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
q = (a.content || a).childNodes;
|
|
1179
|
+
r = q.length;
|
|
1180
|
+
e.included && (e.included = !1, e.inc++, d = [], (g.for || g.if) && c.unshift(d), g.child || (g.child = g.text ? {text:g.text} : g.html ? {html:g.html} : null), r ? (d.root = g, d.inc = g.child || (g.child = []), d.index = e = {current:-1, count:0, last:-1, inc:0, included:!1}) : d.inc = g.inc, delete g.for, delete g.if, delete g.text, delete g.html);
|
|
1181
|
+
if (r) {
|
|
1182
|
+
for (let w = 0, u; w < r; w++) {
|
|
1183
|
+
if (u = q[w], 8 !== u.nodeType && (e.count++, t = qa(u, null, c, d, e, 1))) {
|
|
1184
|
+
1 !== r || 3 !== u.nodeType && t.text || g.js && t.js ? (t.text || t.tag) && (g.child || (g.child = [])).push(t) : (t.js && (g.js = t.js), t.html && (g.html = t.html), t.text && (g.text = t.text));
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
g.child && 1 === g.child.length && (g.child = g.child[0]);
|
|
1188
|
+
}
|
|
1189
|
+
if (!k) {
|
|
1190
|
+
h.name || (h.name = "tpl-" + pa++);
|
|
1191
|
+
if ("COMPONENT" === g.tag) {
|
|
1192
|
+
d = g.child;
|
|
1193
|
+
e = [];
|
|
1194
|
+
for (let w = 0, u; w < d.length; w++) {
|
|
1195
|
+
u = d[w], "TEMPLATE" === u.tag ? (d = k = u.child.length ? u.child[0] : u.child, u.name && (k.name = u.name), u.id && (k.id = u.id), u.key && (k.key = u.key), u.cache && (k.cache = u.cache)) : e.push(u);
|
|
1196
|
+
}
|
|
1197
|
+
h.tpl = d;
|
|
1198
|
+
h.cmp = e;
|
|
1199
|
+
}
|
|
1200
|
+
if (1 === c.length && 0 === c[0].length) {
|
|
1201
|
+
h.fn = null;
|
|
1202
|
+
} else {
|
|
1203
|
+
for (d = 0; d < c.length; d++) {
|
|
1204
|
+
c[d].root && (c[d].root.inc = c[d].inc[0], delete c[d].root.child), c[d] = c[d].length ? Function("data", "state", "index", "_p", "_f", "_x", '"use strict";let _o,_v,_c;' + c[d].join(";")) : null;
|
|
1205
|
+
}
|
|
1206
|
+
h.fn = c.length ? c : null;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return h;
|
|
1210
|
+
}
|
|
1211
|
+
function ra(a, b, c, d, e, k, h, g) {
|
|
1212
|
+
if (/{{[\s\S]+}}/.test(c)) {
|
|
1213
|
+
h = /{{([!?#]+)?=/.test(c);
|
|
1214
|
+
let l = /{{!?\?/.test(c), n = /{{\??!/.test(c);
|
|
1215
|
+
if (h) {
|
|
1216
|
+
if (l || n) {
|
|
1217
|
+
c = c.replace(/{{[!?]+/g, "{{");
|
|
1218
|
+
}
|
|
1219
|
+
h = c.replace(/{{#?=+(.*)?}}/ig, "$1").trim().replace(/^data\./, "").replace(/^data\[['"](.*)['"]]/, "$1");
|
|
1220
|
+
}
|
|
1221
|
+
c = c.replace(/{{[!?#=]+/g, "{{").replace(/"(\s+)?{{(\s+)?/g, "(").replace(/(\s+)?}}(\s+)?"/g, ")").replace(/{{(\s+)?/g, "'+(").replace(/(\s+)?}}/g, ")+'").replace(/\s+/g, " ");
|
|
1222
|
+
c = ("'" + c + "'").replace(/^""\+/g, "").replace(/^''\+/g, "").replace(/\+''$/g, "").replace(/\+""$/g, "").replace(/"\)\+''\+\("/g, "").replace(/'\)\+''\+\('/g, "").replace(/\+''\+/g, "+").replace(/'(\s+)?\+(\s+)?'/g, "").replace(/"(\s+)?\+(\s+)?"/g, "").replace(/^\(([^ ]+)\)$/g, "$1").trim();
|
|
1223
|
+
l && (c = "(" + (c + "||" + c + "===0?" + c + ":'')"));
|
|
1224
|
+
"text" !== b && "style" !== b || !a.tag || k.count++;
|
|
1225
|
+
k.count !== k.last && (k.current++, k.last = k.count, g.push("_o=_p[" + k.current + "]"), g.push("_x&&(_x[" + k.current + "]=_c={})"));
|
|
1226
|
+
g.push("_v=" + c);
|
|
1227
|
+
d ? g.push('_c&&(_c["_a' + b + '"]=_v);if(!_o.c||_o.c["_a' + b + '"]!==_v){_o.c&&(_o.c["_a' + b + '"]=_v);' + (P[b] ? "selected" === b ? '_f?_o.n[_v===false?"removeAttribute":"setAttribute"]("' + b + '",_v):_o.n.' + b + "=_v" : "_o.n." + b + "=_v" : '_o.n[_v===false?"removeAttribute":"setAttribute"]("' + b + '",_v)') + "}") : "class" === b ? g.push("_c&&(_c._c=_v);if(!_o.c||_o.c._c!==_v){_o.c&&(_o.c._c=_v);_o.n.className=_v}") : "style" === b ? g.push("_c&&(_c._s=_v);if(!_o.c||_o.c._s!==_v){_o.c&&(_o.c._s=_v);_o.n.cssText=_v}") :
|
|
1228
|
+
"html" === b ? g.push("_c&&(_c._h=_v);if(!_o.c||_o.c._h!==_v){_o.c&&(_o.c._h=_v);_o.n.innerHTML=_v}") : "text" === b && g.push("_c&&(_c._t=_v);if(!_o.c||_o.c._t!==_v){_o.c&&(_o.c._t=_v);_o.n.nodeValue=_v}");
|
|
1229
|
+
a[b] = h ? [h] : [];
|
|
1230
|
+
} else {
|
|
1231
|
+
a[b] = c;
|
|
1232
|
+
}
|
|
1233
|
+
"for" !== b && "if" !== b && "inc" !== b || d || k.included || (k.count !== k.last && (k.current++, k.last = k.count, g.push("_o=_p[" + k.current + "]")), a = e.foreach ? e.foreach.trim() : "data", b = k.inc, e.if ? g.push("this.inc[" + b + "].mount(_o.n)[" + e.if.trim() + '?"render":"clear"](' + a + ",state)") : e.foreach ? g.push("this.inc[" + b + "].mount(_o.n).render(" + a + ",state)") : g.push("this.inc[" + b + "].mount(_o.n).render(data,state)"), k.included = !0);
|
|
1234
|
+
}
|
|
1235
|
+
;const sa = /[^;:]+/g, ta = / +/;
|
|
1236
|
+
function ua(a, b, c, d) {
|
|
1237
|
+
d["_a" + b] !== c ? (f("cache.miss"), f("cache.attr"), d["_a" + b] = c, P[b] ? a[b] = c : !1 === c ? a.removeAttribute(b) : a.setAttribute(b, c)) : f("cache.match");
|
|
1238
|
+
}
|
|
1239
|
+
function va(a, b, c) {
|
|
1240
|
+
!1 !== c["_a" + b] ? (f("cache.miss"), f("cache.attr"), c["_a" + b] = !1, P[b] ? a[b] = !1 : a.removeAttribute(b)) : f("cache.match");
|
|
1241
|
+
}
|
|
1242
|
+
function wa(a, b) {
|
|
1243
|
+
let c = a._mkc, d;
|
|
1244
|
+
c ? d = c["_a" + b] : a._mkc = c = {};
|
|
1245
|
+
"string" !== typeof d ? (f("cache.miss"), f("cache.attr"), d = P[b] ? a[b] : a.getAttribute(b), c["_a" + b] = d) : f("cache.match");
|
|
1246
|
+
return d;
|
|
1247
|
+
}
|
|
1248
|
+
function Y(a) {
|
|
1249
|
+
let b = a._mkc, c;
|
|
1250
|
+
b ? c = b._c : a._mkc = b = {};
|
|
1251
|
+
if (!c) {
|
|
1252
|
+
return b._c = {};
|
|
1253
|
+
}
|
|
1254
|
+
if ("string" === typeof c) {
|
|
1255
|
+
f("cache.transform");
|
|
1256
|
+
a = c.trim().split(ta);
|
|
1257
|
+
b._c = c = {};
|
|
1258
|
+
for (let d = 0, e; d < a.length; d++) {
|
|
1259
|
+
(e = a[d]) && (c[a[d]] = 1);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
return c;
|
|
1263
|
+
}
|
|
1264
|
+
function xa(a, b, c) {
|
|
1265
|
+
c[b] ? f("cache.match") : (f("cache.miss"), f("cache.class"), c[b] = 1, a.classList.add(b));
|
|
1266
|
+
}
|
|
1267
|
+
function ya(a, b, c) {
|
|
1268
|
+
0 !== c[b] ? (f("cache.miss"), f("cache.class"), c[b] = 0, a.classList.remove(b)) : f("cache.match");
|
|
1269
|
+
}
|
|
1270
|
+
function za(a, b, c, d) {
|
|
1271
|
+
let e = !!d[b];
|
|
1272
|
+
c = "undefined" === typeof c ? !e : !!c;
|
|
1273
|
+
e !== c ? (f("cache.miss"), f("cache.class"), d[b] = c ? 1 : 0, c ? a.classList.add(b) : a.classList.remove(b)) : f("cache.match");
|
|
1274
|
+
}
|
|
1275
|
+
function Aa(a) {
|
|
1276
|
+
var b = a._mkc;
|
|
1277
|
+
let c;
|
|
1278
|
+
b ? c = b._s : a._mkc = b = {};
|
|
1279
|
+
if (!c) {
|
|
1280
|
+
return b._s = {};
|
|
1281
|
+
}
|
|
1282
|
+
if ("string" === typeof c) {
|
|
1283
|
+
for (f("cache.transform"), a = c.match(sa), b._s = c = {}, b = 0; b < a.length; b += 2) {
|
|
1284
|
+
c[a[b].trim()] = a[b + 1].trim();
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return c;
|
|
1288
|
+
}
|
|
1289
|
+
function Ba(a, b, c, d, e) {
|
|
1290
|
+
e[b] !== c ? (f("cache.miss"), f("cache.style"), e[b] = c, (d || a.style).setProperty(b, c)) : f("cache.match");
|
|
1291
|
+
}
|
|
1292
|
+
;E.once = ia;
|
|
1293
|
+
E.register = function(a, b) {
|
|
1294
|
+
f("mikado.register");
|
|
1295
|
+
let c, d;
|
|
1296
|
+
if ("string" === typeof a) {
|
|
1297
|
+
if (c = d = a, a = O[c], a instanceof E || (a = a[0]), !a) {
|
|
1298
|
+
throw Error("The template '" + c + "' was not found.");
|
|
1299
|
+
}
|
|
1300
|
+
} else {
|
|
1301
|
+
c = a.name;
|
|
1302
|
+
}
|
|
1303
|
+
O[c] && (d ? console.info("The template '" + c + "' was replaced by a new definition.") : console.warn("The template '" + c + "' was already registered and is getting overwritten. When this isn't your intention, then please check your template names about uniqueness and collision!"));
|
|
1304
|
+
O[c] = [a, b];
|
|
1305
|
+
return E;
|
|
1306
|
+
};
|
|
1307
|
+
E.unregister = function(a) {
|
|
1308
|
+
f("mikado.unregister");
|
|
1309
|
+
"object" === typeof a && (a = a.name);
|
|
1310
|
+
const b = O[a];
|
|
1311
|
+
b && (b instanceof E && b.destroy(), O[a] = null);
|
|
1312
|
+
return E;
|
|
1313
|
+
};
|
|
1314
|
+
E.compile = qa;
|
|
1315
|
+
E.setText = function(a, b) {
|
|
1316
|
+
var c = a._mkc;
|
|
1317
|
+
let d;
|
|
1318
|
+
c ? d = c._t : a._mkc = c = {};
|
|
1319
|
+
d !== b ? (f("cache.miss"), f("cache.text"), c._t = b, c._h = null, (c = a.firstChild) ? c.nodeValue = b : a.appendChild(document.createTextNode(b))) : f("cache.match");
|
|
1320
|
+
};
|
|
1321
|
+
E.getText = function(a) {
|
|
1322
|
+
let b = a._mkc, c;
|
|
1323
|
+
b ? c = b._t : a._mkc = b = {};
|
|
1324
|
+
"string" !== typeof c ? (f("cache.miss"), f("cache.text"), a = a.firstChild, b._t = c = a ? a.nodeValue : "") : f("cache.match");
|
|
1325
|
+
return c;
|
|
1326
|
+
};
|
|
1327
|
+
E.setHtml = function(a, b) {
|
|
1328
|
+
let c = a._mkc, d;
|
|
1329
|
+
c ? d = c._h : a._mkc = c = {};
|
|
1330
|
+
d !== b ? (f("cache.miss"), f("cache.html"), a.innerHTML = b, c._h = b, c._t = null) : f("cache.match");
|
|
1331
|
+
};
|
|
1332
|
+
E.getHtml = function(a) {
|
|
1333
|
+
let b = a._mkc, c;
|
|
1334
|
+
b ? c = b._h || b._t : a._mkc = b = {};
|
|
1335
|
+
"string" !== typeof c ? (f("cache.miss"), f("cache.html"), b._h = c = a.innerHTML) : f("cache.match");
|
|
1336
|
+
return c;
|
|
1337
|
+
};
|
|
1338
|
+
E.setClass = function(a, b) {
|
|
1339
|
+
let c = a._mkc, d;
|
|
1340
|
+
c ? d = c._c : a._mkc = c = {};
|
|
1341
|
+
"object" === typeof b && (b = b.join(" "));
|
|
1342
|
+
d !== b ? (f("cache.miss"), f("cache.class"), c._c = b, a.className = b) : f("cache.match");
|
|
1343
|
+
};
|
|
1344
|
+
E.getClass = function(a) {
|
|
1345
|
+
let b = a._mkc, c;
|
|
1346
|
+
b ? c = b._c : a._mkc = b = {};
|
|
1347
|
+
"string" !== typeof c ? (f("cache.miss"), f("cache.class"), b._c = c = a.className) : f("cache.match");
|
|
1348
|
+
c = c.split(ta);
|
|
1349
|
+
return "" === c[0] ? [] : c;
|
|
1350
|
+
};
|
|
1351
|
+
E.hasClass = function(a, b) {
|
|
1352
|
+
const c = Y(a);
|
|
1353
|
+
let d = c[b];
|
|
1354
|
+
"number" !== typeof d ? (f("cache.miss"), f("cache.class"), c[b] = d = a.classList.contains(b) ? 1 : 0) : f("cache.match");
|
|
1355
|
+
return !!d;
|
|
1356
|
+
};
|
|
1357
|
+
E.toggleClass = function(a, b, c) {
|
|
1358
|
+
const d = Y(a);
|
|
1359
|
+
if ("object" === typeof b) {
|
|
1360
|
+
if (b.constructor === Array) {
|
|
1361
|
+
for (var e = 0; e < b.length; e++) {
|
|
1362
|
+
za(a, b[e], c, d);
|
|
1363
|
+
}
|
|
1364
|
+
} else {
|
|
1365
|
+
for (e in b) {
|
|
1366
|
+
za(a, e, b[e], d);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
} else {
|
|
1370
|
+
za(a, b, c, d);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
E.removeClass = function(a, b) {
|
|
1374
|
+
const c = Y(a);
|
|
1375
|
+
if ("object" === typeof b) {
|
|
1376
|
+
for (let d = 0; d < b.length; d++) {
|
|
1377
|
+
ya(a, b[d], c);
|
|
1378
|
+
}
|
|
1379
|
+
} else {
|
|
1380
|
+
ya(a, b, c);
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
E.addClass = function(a, b) {
|
|
1384
|
+
const c = Y(a);
|
|
1385
|
+
if ("object" === typeof b) {
|
|
1386
|
+
for (let d = 0; d < b.length; d++) {
|
|
1387
|
+
xa(a, b[d], c);
|
|
1388
|
+
}
|
|
1389
|
+
} else {
|
|
1390
|
+
xa(a, b, c);
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
E.setAttribute = function(a, b, c) {
|
|
1394
|
+
let d = a._mkc;
|
|
1395
|
+
d || (a._mkc = d = {});
|
|
1396
|
+
if ("object" === typeof b) {
|
|
1397
|
+
for (let e in b) {
|
|
1398
|
+
ua(a, e, b[e], d);
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
ua(a, b, c, d);
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
E.getAttribute = wa;
|
|
1405
|
+
E.hasAttribute = function(a, b) {
|
|
1406
|
+
a = wa(a, b);
|
|
1407
|
+
return !(!a && "" !== a);
|
|
1408
|
+
};
|
|
1409
|
+
E.removeAttribute = function(a, b) {
|
|
1410
|
+
let c = a._mkc;
|
|
1411
|
+
c || (a._mkc = c = {});
|
|
1412
|
+
if ("object" === typeof b) {
|
|
1413
|
+
for (let d = 0; d < b.length; d++) {
|
|
1414
|
+
va(a, b[d], c);
|
|
1415
|
+
}
|
|
1416
|
+
} else {
|
|
1417
|
+
va(a, b, c);
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
E.setCss = function(a, b) {
|
|
1421
|
+
let c = a._mkc, d;
|
|
1422
|
+
c ? d = c._s : a._mkc = c = {};
|
|
1423
|
+
d !== b ? (f("cache.miss"), f("cache.style"), c._s = b, a.style.cssText = b) : f("cache.match");
|
|
1424
|
+
};
|
|
1425
|
+
E.getCss = function(a) {
|
|
1426
|
+
let b = a._mkc, c;
|
|
1427
|
+
b ? c = b._s : a._mkc = b = {};
|
|
1428
|
+
"string" !== typeof c ? (f("cache.miss"), f("cache.css"), b._s = c = a.style.cssText) : f("cache.match");
|
|
1429
|
+
return c;
|
|
1430
|
+
};
|
|
1431
|
+
E.getStyle = function(a, b) {
|
|
1432
|
+
const c = Aa(a);
|
|
1433
|
+
let d = c[b];
|
|
1434
|
+
"string" !== typeof d ? (f("cache.miss"), f("cache.style"), c[b] = d = a.style.getPropertyValue(b)) : f("cache.match");
|
|
1435
|
+
return d;
|
|
1436
|
+
};
|
|
1437
|
+
E.setStyle = function(a, b, c) {
|
|
1438
|
+
const d = Aa(a), e = a.style;
|
|
1439
|
+
if ("object" === typeof b) {
|
|
1440
|
+
for (const k in b) {
|
|
1441
|
+
Ba(a, k, b[k], e, d);
|
|
1442
|
+
}
|
|
1443
|
+
} else {
|
|
1444
|
+
Ba(a, b, c, e, d);
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
E.escape = function(a) {
|
|
1448
|
+
W._text !== a && (ma.nodeValue = a, W._html = W.innerHTML, W._text = a);
|
|
1449
|
+
return W._html;
|
|
1450
|
+
};
|
|
1451
|
+
E.sanitize = function(a) {
|
|
1452
|
+
X._html !== a && (X.innerHTML = a, X._html = a, X._text = X.textContent);
|
|
1453
|
+
return X._text;
|
|
1454
|
+
};
|
|
1455
|
+
E.prototype.route = E.route = function(a, b, c) {
|
|
1456
|
+
f("route.set");
|
|
1457
|
+
if (!a) {
|
|
1458
|
+
throw Error("Missing route name.");
|
|
1459
|
+
}
|
|
1460
|
+
if (!b) {
|
|
1461
|
+
throw Error("The route '" + a + "' has no function assigned to it.");
|
|
1462
|
+
}
|
|
1463
|
+
x[a] && console.info("A new handler was re-assigned to the route '" + a + "'.");
|
|
1464
|
+
x[a] = b;
|
|
1465
|
+
z[a] = c || null;
|
|
1466
|
+
return this;
|
|
1467
|
+
};
|
|
1468
|
+
E.prototype.dispatch = E.dispatch = function(a, b, c) {
|
|
1469
|
+
f("route.dispatch");
|
|
1470
|
+
if (!a) {
|
|
1471
|
+
throw Error("Missing route name.");
|
|
1472
|
+
}
|
|
1473
|
+
if (!x[a]) {
|
|
1474
|
+
throw Error("Undefined route '" + a + "'.");
|
|
1475
|
+
}
|
|
1476
|
+
x[a](b || this, c || window.event);
|
|
1477
|
+
return this;
|
|
1478
|
+
};
|
|
1479
|
+
E.prototype.listen = E.listen = ba;
|
|
1480
|
+
E.prototype.unlisten = E.unlisten = function(a) {
|
|
1481
|
+
m[a] && (f("event.unlisten"), G(0, a, F, v[a]), m[a] = 0, v[a] = null);
|
|
1482
|
+
return this;
|
|
1483
|
+
};
|
|
1484
|
+
E.Array = Q;
|
|
1485
|
+
const Z = window;
|
|
1486
|
+
let Ca;
|
|
1487
|
+
(Ca = Z.define) && Ca.amd ? Ca([], function() {
|
|
1488
|
+
return E;
|
|
1489
|
+
}) : "object" === typeof Z.exports ? Z.exports = E : Z.Mikado = E;
|
|
1490
|
+
}).call(this);
|