@yoyaflow/yoya-ui 0.3.2 → 0.3.3
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/README.md +347 -108
- package/README.zh-CN.md +321 -121
- package/dist/yoya-ui.umd.js +2 -2
- package/dist/yoya.core.js +845 -286
- package/dist/yoya.devtools.js +223 -0
- package/dist/yoya.echart.js +341 -84
- package/dist/yoya.ssr.js +1347 -759
- package/dist/yoya.ui.css +71 -0
- package/dist/yoya.ui.js +3358 -2480
- package/package.json +13 -1
- package/types/core.d.ts +122 -1
- package/types/data-display.d.ts +44 -2
- package/types/devtools.d.ts +156 -0
- package/types/feedback.d.ts +13 -0
- package/types/form.d.ts +1 -1
- package/types/ssr.d.ts +27 -7
- package/types/yoya.devtools.d.ts +5 -0
package/dist/yoya.echart.js
CHANGED
|
@@ -1,10 +1,99 @@
|
|
|
1
|
+
//#region src/core/access.js
|
|
2
|
+
var e = null;
|
|
3
|
+
function t(e) {
|
|
4
|
+
if (!e) return null;
|
|
5
|
+
if (typeof e == "object" && e.code) return {
|
|
6
|
+
code: e.code,
|
|
7
|
+
level: e.level === "write" ? "write" : "read"
|
|
8
|
+
};
|
|
9
|
+
let t = String(e).trim();
|
|
10
|
+
return t ? t.startsWith("w.") ? {
|
|
11
|
+
code: t.slice(2),
|
|
12
|
+
level: "write"
|
|
13
|
+
} : t.startsWith("r.") ? {
|
|
14
|
+
code: t.slice(2),
|
|
15
|
+
level: "read"
|
|
16
|
+
} : {
|
|
17
|
+
code: t,
|
|
18
|
+
level: "write"
|
|
19
|
+
} : null;
|
|
20
|
+
}
|
|
21
|
+
function n(t, n) {
|
|
22
|
+
let r = e;
|
|
23
|
+
e = t || r;
|
|
24
|
+
try {
|
|
25
|
+
return n();
|
|
26
|
+
} finally {
|
|
27
|
+
e = r;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function r() {
|
|
31
|
+
return e || null;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
1
34
|
//#region src/core/node.js
|
|
2
|
-
var
|
|
35
|
+
var i = Symbol.for("yoya.devtools.bridge");
|
|
36
|
+
function a() {
|
|
37
|
+
return typeof globalThis > "u" ? null : globalThis[i] || null;
|
|
38
|
+
}
|
|
39
|
+
function o() {
|
|
40
|
+
let e = a();
|
|
41
|
+
return e ? e.enabled() : !1;
|
|
42
|
+
}
|
|
43
|
+
function s(e) {
|
|
44
|
+
let t = a();
|
|
45
|
+
t && t.emit(e);
|
|
46
|
+
}
|
|
47
|
+
function c(e) {
|
|
48
|
+
let t = a();
|
|
49
|
+
t && t.unregister(e);
|
|
50
|
+
}
|
|
51
|
+
function l(e) {
|
|
52
|
+
let t = a();
|
|
53
|
+
t && t.captureScope(e);
|
|
54
|
+
}
|
|
55
|
+
function u(e) {
|
|
56
|
+
let t = a();
|
|
57
|
+
return t ? t.ensureId(e) : void 0;
|
|
58
|
+
}
|
|
59
|
+
function d(e, t, n) {
|
|
60
|
+
let r = a();
|
|
61
|
+
r && r.notify(e, t, n);
|
|
62
|
+
}
|
|
63
|
+
function f(e) {
|
|
64
|
+
let t = a();
|
|
65
|
+
t && t.commit(e);
|
|
66
|
+
}
|
|
67
|
+
var p = /* @__PURE__ */ new Set([
|
|
3
68
|
"checked",
|
|
4
69
|
"disabled",
|
|
5
70
|
"readonly",
|
|
6
71
|
"selected"
|
|
7
|
-
]),
|
|
72
|
+
]), m = /* @__PURE__ */ new Set([
|
|
73
|
+
"input",
|
|
74
|
+
"select",
|
|
75
|
+
"textarea",
|
|
76
|
+
"button",
|
|
77
|
+
"fieldset",
|
|
78
|
+
"option",
|
|
79
|
+
"optgroup",
|
|
80
|
+
"keygen"
|
|
81
|
+
]), h = /* @__PURE__ */ new Set(["input", "textarea"]), g = [];
|
|
82
|
+
function _() {
|
|
83
|
+
return g.length > 0 ? g[g.length - 1] : null;
|
|
84
|
+
}
|
|
85
|
+
function v(e, t) {
|
|
86
|
+
g.push(e);
|
|
87
|
+
try {
|
|
88
|
+
return t();
|
|
89
|
+
} finally {
|
|
90
|
+
g.pop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function y(e, t, n, r) {
|
|
94
|
+
throw TypeError(`vStateNode binding scope required for function value (${e}${t ? ` "${t}"` : ""})`);
|
|
95
|
+
}
|
|
96
|
+
var b = /* @__PURE__ */ new Set([
|
|
8
97
|
"area",
|
|
9
98
|
"base",
|
|
10
99
|
"br",
|
|
@@ -20,23 +109,23 @@ var e = /* @__PURE__ */ new Set([
|
|
|
20
109
|
"track",
|
|
21
110
|
"wbr"
|
|
22
111
|
]);
|
|
23
|
-
function
|
|
112
|
+
function x(e) {
|
|
24
113
|
return typeof e == "string" ? document.querySelector(e) : e;
|
|
25
114
|
}
|
|
26
|
-
function
|
|
115
|
+
function S(e) {
|
|
27
116
|
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
28
117
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
118
|
+
function C(e) {
|
|
119
|
+
return p.has(e);
|
|
31
120
|
}
|
|
32
|
-
function
|
|
121
|
+
function w(e, t, n) {
|
|
33
122
|
if (n == null || n === !1) {
|
|
34
123
|
if (e.removeAttribute(t), t in e) try {
|
|
35
124
|
e[t] = !1;
|
|
36
125
|
} catch {}
|
|
37
126
|
return;
|
|
38
127
|
}
|
|
39
|
-
if (n === !0 ||
|
|
128
|
+
if (n === !0 || C(t)) {
|
|
40
129
|
if (e.setAttribute(t, t), t in e) try {
|
|
41
130
|
e[t] = !0;
|
|
42
131
|
} catch {}
|
|
@@ -46,19 +135,36 @@ function a(e, t, n) {
|
|
|
46
135
|
e[t] = n;
|
|
47
136
|
} catch {}
|
|
48
137
|
}
|
|
49
|
-
function
|
|
50
|
-
return Object.entries(e).filter(([, e]) => e != null && e !== "").map(([e, t]) => `${
|
|
138
|
+
function T(e) {
|
|
139
|
+
return Object.entries(e).filter(([, e]) => e != null && e !== "").map(([e, t]) => `${E(e)}:${S(t)}`).join("; ");
|
|
51
140
|
}
|
|
52
|
-
function
|
|
141
|
+
function E(e) {
|
|
53
142
|
return String(e).replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
54
143
|
}
|
|
55
|
-
|
|
144
|
+
function D(e, t) {
|
|
145
|
+
return e === t ? !0 : !e || !t || typeof e != "object" || typeof t != "object" ? !1 : !!e.capture == !!t.capture && !!e.once == !!t.once && !!e.passive == !!t.passive;
|
|
146
|
+
}
|
|
147
|
+
var O = class e {
|
|
56
148
|
constructor(e = null) {
|
|
57
|
-
this._children = [], this._events = /* @__PURE__ */ new Map(), this._cleanup = [], this._states = {}, this._stateTypes = {}, this._stateHandlers = /* @__PURE__ */ new Map(), this._pendingRemovals = /* @__PURE__ */ new Set(), this._childrenDirty = !1, this._deleted = !1, e !== null && this.setup(e);
|
|
149
|
+
this._children = [], this._childKeys = /* @__PURE__ */ new Map(), this._events = /* @__PURE__ */ new Map(), this._domAdapters = /* @__PURE__ */ new Map(), this._cleanup = [], this._states = {}, this._stateTypes = {}, this._stateHandlers = /* @__PURE__ */ new Map(), this._pendingRemovals = /* @__PURE__ */ new Set(), this._childrenDirty = !1, this._deleted = !1, this._access = null, this._accessContext = r(), o() && l(this), e !== null && this.setup(e);
|
|
58
150
|
}
|
|
59
151
|
setup(t) {
|
|
60
152
|
return typeof t == "function" ? t(this) : t instanceof e ? this.child(t) : typeof t == "string" || typeof t == "number" ? this.text(t) : t && typeof t == "object" && this._setupObject(t), this;
|
|
61
153
|
}
|
|
154
|
+
access(e) {
|
|
155
|
+
let n = t(e);
|
|
156
|
+
return this._access = n ? {
|
|
157
|
+
code: n.code,
|
|
158
|
+
level: "write"
|
|
159
|
+
} : null, this;
|
|
160
|
+
}
|
|
161
|
+
_permissionState() {
|
|
162
|
+
let e = this._access ?? _();
|
|
163
|
+
if (!e) return "active";
|
|
164
|
+
let t = this._accessContext || r();
|
|
165
|
+
return t ? t.canRead(e.code) ? e.level === "write" && !t.canWrite(e.code) ? "readonly" : "active" : "hidden" : "active";
|
|
166
|
+
}
|
|
167
|
+
_applyAccessState(e) {}
|
|
62
168
|
_setupObject(e) {
|
|
63
169
|
e.children && this.child(e.children);
|
|
64
170
|
}
|
|
@@ -66,25 +172,79 @@ var c = class e {
|
|
|
66
172
|
return [...this._children];
|
|
67
173
|
}
|
|
68
174
|
clearChildren() {
|
|
69
|
-
|
|
175
|
+
let e = this._el && o() && !this._devtoolsRendering ? this._children.map((e) => u(e)) : [];
|
|
176
|
+
return this._dropChildKeys(this._children), this._children.forEach((e) => {
|
|
70
177
|
this._pendingRemovals.add(e);
|
|
71
|
-
}), this._children = [], this._childrenDirty = !0, this;
|
|
178
|
+
}), this._children = [], this._childrenDirty = !0, e.length > 0 && !this._devtoolsRendering && d(this, "child", { removed: e }), this;
|
|
179
|
+
}
|
|
180
|
+
addChild(e, t) {
|
|
181
|
+
let n = String(e);
|
|
182
|
+
if (this._childKeys.has(n)) throw TypeError(`duplicate key "${n}"`);
|
|
183
|
+
let r = j(t);
|
|
184
|
+
if (this._childKeys.set(n, r), typeof r.attr == "function" && r.attr("data-row-key", n), this._pendingRemovals.delete(r), this._children.push(r), this._childrenDirty = !0, this._el) {
|
|
185
|
+
let e = v(this._access ?? _(), () => r.renderDom());
|
|
186
|
+
e && e.parentNode !== this._el && this._el.appendChild(e), o() && !this._devtoolsRendering && d(this, "child", { added: [u(r)] });
|
|
187
|
+
}
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
190
|
+
getChild(e) {
|
|
191
|
+
return this._childKeys.get(String(e)) || null;
|
|
192
|
+
}
|
|
193
|
+
removeChild(e) {
|
|
194
|
+
let t = String(e), n = this._childKeys.get(t);
|
|
195
|
+
if (!n) return this;
|
|
196
|
+
this._childKeys.delete(t);
|
|
197
|
+
let r = this._children.indexOf(n);
|
|
198
|
+
r !== -1 && this._children.splice(r, 1), this._childrenDirty = !0;
|
|
199
|
+
let i = this._el && o() && !this._devtoolsRendering ? u(n) : null;
|
|
200
|
+
return n.destroy(), i !== null && d(this, "child", { removed: [i] }), this;
|
|
201
|
+
}
|
|
202
|
+
_dropChildKeys(e) {
|
|
203
|
+
let t = new Set(e);
|
|
204
|
+
this._childKeys.forEach((e, n) => {
|
|
205
|
+
t.has(e) && this._childKeys.delete(n);
|
|
206
|
+
});
|
|
72
207
|
}
|
|
73
208
|
child(...e) {
|
|
74
209
|
return e.flat(Infinity).forEach((e) => {
|
|
75
210
|
if (e == null) return;
|
|
76
|
-
let t =
|
|
211
|
+
let t = j(e);
|
|
77
212
|
this._pendingRemovals.delete(t), this._children.push(t), this._childrenDirty = !0;
|
|
78
213
|
}), this;
|
|
79
214
|
}
|
|
80
215
|
text(e) {
|
|
81
|
-
return this.child(new
|
|
216
|
+
return this.child(new k(e));
|
|
82
217
|
}
|
|
83
218
|
on(e, t, n) {
|
|
84
|
-
|
|
219
|
+
if (typeof t != "function") throw TypeError("ViewNode event handler must be a function");
|
|
220
|
+
let r = this._events.get(e);
|
|
221
|
+
return this._events.set(e, {
|
|
85
222
|
handler: t,
|
|
86
223
|
options: n
|
|
87
|
-
}), this._el &&
|
|
224
|
+
}), this._el && this._bindDomAdapter(e, r?.options, n), this;
|
|
225
|
+
}
|
|
226
|
+
off(e) {
|
|
227
|
+
this._events.delete(e);
|
|
228
|
+
let t = this._domAdapters.get(e);
|
|
229
|
+
return t && (t.cleanup(), this._removeCleanup(t.cleanup), this._domAdapters.delete(e)), this;
|
|
230
|
+
}
|
|
231
|
+
_bindDomAdapter(e, t, n) {
|
|
232
|
+
let r = this._domAdapters.get(e);
|
|
233
|
+
if (r) {
|
|
234
|
+
if (D(t, n)) return;
|
|
235
|
+
r.cleanup(), this._removeCleanup(r.cleanup), this._domAdapters.delete(e);
|
|
236
|
+
}
|
|
237
|
+
let i = (t) => {
|
|
238
|
+
let n = this._events.get(e);
|
|
239
|
+
!n || typeof n.handler != "function" || (n.handler.call(this, t), n.options?.once && this.off(e));
|
|
240
|
+
}, a = () => {
|
|
241
|
+
this._el && this._el.removeEventListener(e, i, n);
|
|
242
|
+
};
|
|
243
|
+
this._el.addEventListener(e, i, n), this._domAdapters.set(e, { cleanup: a }), this._cleanup.push(a);
|
|
244
|
+
}
|
|
245
|
+
_removeCleanup(e) {
|
|
246
|
+
let t = this._cleanup.indexOf(e);
|
|
247
|
+
t !== -1 && this._cleanup.splice(t, 1);
|
|
88
248
|
}
|
|
89
249
|
registerStateAttrs(...e) {
|
|
90
250
|
return e.forEach((e) => {
|
|
@@ -127,11 +287,14 @@ var c = class e {
|
|
|
127
287
|
this._pendingRemovals.forEach((e) => e.destroy()), this._pendingRemovals.clear(), this._childrenDirty = !1;
|
|
128
288
|
}
|
|
129
289
|
bindTo(e) {
|
|
130
|
-
let t =
|
|
131
|
-
return t &&
|
|
290
|
+
let t = x(e), n = this.renderDom();
|
|
291
|
+
return t && n && t.appendChild(n), this;
|
|
132
292
|
}
|
|
133
293
|
destroy() {
|
|
134
|
-
return
|
|
294
|
+
return o() && (s({
|
|
295
|
+
type: "destroy",
|
|
296
|
+
node: this
|
|
297
|
+
}), c(this)), this._deleted = !0, this._cleanup.forEach((e) => e()), this._cleanup = [], this._children.forEach((e) => e.destroy()), this._pendingRemovals.forEach((e) => e.destroy()), this._pendingRemovals.clear(), this._children = [], this._childKeys.clear(), this._el?.parentNode && this._el.parentNode.removeChild(this._el), this;
|
|
135
298
|
}
|
|
136
299
|
toHTML() {
|
|
137
300
|
return "";
|
|
@@ -139,55 +302,107 @@ var c = class e {
|
|
|
139
302
|
hydrateSnapshot() {
|
|
140
303
|
return this;
|
|
141
304
|
}
|
|
142
|
-
},
|
|
305
|
+
}, k = class extends O {
|
|
143
306
|
constructor(e = "") {
|
|
144
|
-
super(null), this._content =
|
|
307
|
+
if (super(null), this._content = "", this._textNode = null, typeof e == "function") {
|
|
308
|
+
y("text", null, e, (e) => this.textContent(e));
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
this._content = String(e);
|
|
145
312
|
}
|
|
146
313
|
textContent(e) {
|
|
147
|
-
|
|
314
|
+
if (e === void 0) return this._content;
|
|
315
|
+
if (typeof e == "function") return y("text", null, e, (e) => this.textContent(e)), this;
|
|
316
|
+
let t = this._content;
|
|
317
|
+
return this._content = String(e), this._textNode && (this._textNode.textContent = this._content), this._textNode && o() && !Object.is(t, this._content) && d(this, "text", {
|
|
318
|
+
from: t,
|
|
319
|
+
to: this._content
|
|
320
|
+
}), this;
|
|
148
321
|
}
|
|
149
322
|
renderDom() {
|
|
150
|
-
return this._deleted ? null : (this._textNode || (this._textNode = document.createTextNode(this._content), this._el = this._textNode), this._textNode);
|
|
323
|
+
return this._deleted || this._permissionState() === "hidden" ? null : (this._textNode || (this._textNode = document.createTextNode(this._content), this._el = this._textNode), this._textNode);
|
|
151
324
|
}
|
|
152
325
|
toHTML() {
|
|
153
|
-
return this._deleted ? "" :
|
|
326
|
+
return this._deleted || this._permissionState() === "hidden" ? "" : S(this._content);
|
|
154
327
|
}
|
|
155
|
-
},
|
|
328
|
+
}, A = class extends O {
|
|
156
329
|
constructor(e) {
|
|
157
|
-
super(null), this._component = e, this._resolved = null;
|
|
330
|
+
super(null), this._component = e, this._resolved = null, this._resolvedList = null, this._roots = null, this._fragmentDom = null;
|
|
158
331
|
}
|
|
159
332
|
_resolve() {
|
|
160
|
-
if (this.
|
|
161
|
-
let e = typeof this._component == "function" ? this._component() : this._component.render();
|
|
162
|
-
|
|
163
|
-
|
|
333
|
+
if (this._resolvedList) return this._resolved;
|
|
334
|
+
let e = n(this._accessContext || r(), () => typeof this._component == "function" ? this._component() : this._component.render()), t = Array.isArray(e) ? e.slice() : [e];
|
|
335
|
+
return t.forEach((e) => {
|
|
336
|
+
if (!(e instanceof O)) throw TypeError("Component render must return a ViewNode or an array of ViewNodes");
|
|
337
|
+
}), this._resolvedList = t, this._resolved = t[0] || null, this._roots = Array.isArray(e) ? t : null, this._component && typeof this._component == "object" && typeof this._component._attachHost == "function" && this._component._attachHost(this), this._resolved;
|
|
338
|
+
}
|
|
339
|
+
_resolveList() {
|
|
340
|
+
return this._resolve(), this._resolvedList || [];
|
|
341
|
+
}
|
|
342
|
+
_replaceResolved(e) {
|
|
343
|
+
let t = this._resolvedList || [], n = Array.isArray(e) ? e.slice() : [e];
|
|
344
|
+
if (n.forEach((e) => {
|
|
345
|
+
if (!(e instanceof O)) throw TypeError("Component render must return a ViewNode or an array of ViewNodes");
|
|
346
|
+
}), t.length === n.length && t.every((e, t) => e === n[t])) return;
|
|
347
|
+
let r = [];
|
|
348
|
+
if (this._fragmentDom && this._fragmentDom.length > 0) r.push(...this._fragmentDom);
|
|
349
|
+
else if (t.length > 0) {
|
|
350
|
+
let e = t[0]._el;
|
|
351
|
+
e && e.parentNode && r.push(e);
|
|
352
|
+
}
|
|
353
|
+
if (this._resolvedList = n, this._resolved = n[0] || null, this._roots = Array.isArray(e) ? n : null, this._fragmentDom = null, r.length === 0) {
|
|
354
|
+
t.forEach((e) => e.destroy());
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
let i = _(), a = r[0].parentNode, o = [];
|
|
358
|
+
n.forEach((e) => {
|
|
359
|
+
let t = v(this._access ?? i, () => e.renderDom());
|
|
360
|
+
t && o.push(t);
|
|
361
|
+
}), o.length > 0 && a && o.forEach((e) => a.insertBefore(e, r[0])), r.forEach((e) => {
|
|
362
|
+
e.parentNode === a && a.removeChild(e);
|
|
363
|
+
}), this._roots ? this._fragmentDom = o : this._el = o[0] || null, t.forEach((e) => e.destroy());
|
|
164
364
|
}
|
|
165
365
|
children() {
|
|
166
|
-
return this.
|
|
366
|
+
return this._resolvedList ? this._roots ? this._resolvedList.flatMap((e) => e.children()) : this._resolvedList[0] ? this._resolvedList[0].children() : [] : [];
|
|
167
367
|
}
|
|
168
368
|
textContent() {
|
|
169
|
-
|
|
170
|
-
return typeof e.textContent == "function" ? e.textContent() : "";
|
|
369
|
+
return this._resolveList().map((e) => typeof e.textContent == "function" ? e.textContent() : "").join("");
|
|
171
370
|
}
|
|
172
371
|
renderDom() {
|
|
173
|
-
if (this._deleted) return null;
|
|
174
|
-
let e =
|
|
175
|
-
|
|
372
|
+
if (this._deleted || this._permissionState() === "hidden") return null;
|
|
373
|
+
let e = _(), t = this._resolveList();
|
|
374
|
+
if (this._roots) {
|
|
375
|
+
if (this._fragmentDom) return null;
|
|
376
|
+
let n = [];
|
|
377
|
+
t.forEach((t) => {
|
|
378
|
+
let r = v(this._access ?? e, () => t.renderDom());
|
|
379
|
+
r && n.push(r);
|
|
380
|
+
}), this._fragmentDom = n;
|
|
381
|
+
let r = document.createDocumentFragment();
|
|
382
|
+
return n.forEach((e) => r.appendChild(e)), r;
|
|
383
|
+
}
|
|
384
|
+
let n = t[0];
|
|
385
|
+
return v(this._access ?? e, () => {
|
|
386
|
+
let e = n.renderDom();
|
|
387
|
+
return this._el = e, e;
|
|
388
|
+
});
|
|
176
389
|
}
|
|
177
390
|
toHTML() {
|
|
178
|
-
|
|
391
|
+
if (this._deleted || this._permissionState() === "hidden") return "";
|
|
392
|
+
let e = _(), t = this._resolveList();
|
|
393
|
+
return v(this._access ?? e, () => t.map((e) => e.toHTML()).join(""));
|
|
179
394
|
}
|
|
180
395
|
destroy() {
|
|
181
|
-
return this.
|
|
396
|
+
return this._component && typeof this._component == "object" && typeof this._component.destroy == "function" && this._component.destroy(), (this._resolvedList || []).forEach((e) => e.destroy()), this._fragmentDom = null, super.destroy();
|
|
182
397
|
}
|
|
183
398
|
};
|
|
184
|
-
function
|
|
185
|
-
if (e instanceof
|
|
186
|
-
if (typeof e == "function" || e && typeof e == "object" && typeof e.render == "function") return new
|
|
187
|
-
if (typeof e == "string" || typeof e == "number") return new
|
|
399
|
+
function j(e) {
|
|
400
|
+
if (e instanceof O) return e;
|
|
401
|
+
if (typeof e == "function" || e && typeof e == "object" && typeof e.render == "function") return new A(e);
|
|
402
|
+
if (typeof e == "string" || typeof e == "number") return new k(e);
|
|
188
403
|
throw TypeError("ViewNode child must be a ViewNode, component, string, or number");
|
|
189
404
|
}
|
|
190
|
-
function
|
|
405
|
+
function M(e = null, t = null, n = null) {
|
|
191
406
|
return typeof t == "function" && n == null ? {
|
|
192
407
|
first: e,
|
|
193
408
|
options: null,
|
|
@@ -198,10 +413,10 @@ function f(e = null, t = null, n = null) {
|
|
|
198
413
|
callback: n
|
|
199
414
|
};
|
|
200
415
|
}
|
|
201
|
-
function
|
|
416
|
+
function N(e, t) {
|
|
202
417
|
return !t || typeof t != "object" || Array.isArray(t) ? e : (t.attrs && typeof e.attr == "function" && e.attr(t.attrs), t.style && typeof e.styles == "function" && e.styles(t.style), e);
|
|
203
418
|
}
|
|
204
|
-
var
|
|
419
|
+
var P = class extends O {
|
|
205
420
|
constructor(e, t = null) {
|
|
206
421
|
super(null), this._tagName = e, this._attrs = {}, this._styles = {}, this._classes = /* @__PURE__ */ new Set(), this._el = null, t !== null && this.setup(t);
|
|
207
422
|
}
|
|
@@ -241,7 +456,15 @@ var m = class extends c {
|
|
|
241
456
|
return this._children.map((e) => typeof e.textContent == "function" ? e.textContent() : "").join("");
|
|
242
457
|
}
|
|
243
458
|
attr(e, t) {
|
|
244
|
-
|
|
459
|
+
if (t === void 0 && typeof e == "string") return this._attrs[e];
|
|
460
|
+
if (e && typeof e == "object") return Object.entries(e).forEach(([e, t]) => this.attr(e, t)), this;
|
|
461
|
+
if (typeof t == "function") return y("attr", e, t, (t) => this.attr(e, t)), this;
|
|
462
|
+
let n = this._attrs[e];
|
|
463
|
+
return t == null || t === !1 ? delete this._attrs[e] : this._attrs[e] = t, this._el && w(this._el, e, t), this._el && o() && !this._devtoolsRendering && !Object.is(n, t) && d(this, "attr", {
|
|
464
|
+
name: e,
|
|
465
|
+
previous: n,
|
|
466
|
+
next: t
|
|
467
|
+
}), this;
|
|
245
468
|
}
|
|
246
469
|
id(e) {
|
|
247
470
|
return e === void 0 ? this.attr("id") : this.attr("id", e);
|
|
@@ -261,39 +484,69 @@ var m = class extends c {
|
|
|
261
484
|
return !e || !t || e === t ? this : this._classes.has(e) ? (this._classes.delete(e), this.className(t)) : n ? this.className(t) : this;
|
|
262
485
|
}
|
|
263
486
|
style(e, t) {
|
|
264
|
-
|
|
487
|
+
if (t === void 0 && typeof e == "string") return this._styles[e];
|
|
488
|
+
if (e && typeof e == "object") return this.styles(e);
|
|
489
|
+
if (typeof t == "function") return y("style", e, t, (t) => this.style(e, t)), this;
|
|
490
|
+
let n = this._styles[e];
|
|
491
|
+
return t == null || t === "" ? delete this._styles[e] : this._styles[e] = t, this._el && (this._el.style[e] = t || ""), this._el && o() && !this._devtoolsRendering && !Object.is(n, t) && d(this, "style", {
|
|
492
|
+
name: e,
|
|
493
|
+
previous: n,
|
|
494
|
+
next: t
|
|
495
|
+
}), this;
|
|
265
496
|
}
|
|
266
497
|
styles(e) {
|
|
267
498
|
return Object.entries(e || {}).forEach(([e, t]) => this.style(e, t)), this;
|
|
268
499
|
}
|
|
269
500
|
child(...e) {
|
|
501
|
+
let t = this._el && o() && !this._devtoolsRendering ? [] : null;
|
|
270
502
|
return e.flat(Infinity).forEach((e) => {
|
|
271
503
|
if (e == null) return;
|
|
272
|
-
let
|
|
273
|
-
if (this._pendingRemovals.delete(
|
|
274
|
-
let e =
|
|
275
|
-
e && e.parentNode !== this._el && this._el.appendChild(e);
|
|
504
|
+
let n = j(e);
|
|
505
|
+
if (this._pendingRemovals.delete(n), this._children.push(n), this._childrenDirty = !0, this._el) {
|
|
506
|
+
let e = v(this._access ?? _(), () => n.renderDom());
|
|
507
|
+
e && e.parentNode !== this._el && this._el.appendChild(e), t && t.push(u(n));
|
|
276
508
|
}
|
|
277
|
-
}), this;
|
|
509
|
+
}), t && t.length > 0 && d(this, "child", { added: t }), this;
|
|
510
|
+
}
|
|
511
|
+
_applyAccessState(e) {
|
|
512
|
+
if (e === "readonly") {
|
|
513
|
+
this._accessAttrsApplied = !0;
|
|
514
|
+
let e = this._tagName;
|
|
515
|
+
m.has(e) && this.attr("disabled", !0), h.has(e) && this.attr("readonly", !0), this.attr("aria-disabled", "true");
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
this._accessAttrsApplied && (this._accessAttrsApplied = !1, this.attr("disabled", null), this.attr("readonly", null), this.attr("aria-disabled", null));
|
|
278
519
|
}
|
|
279
520
|
renderDom() {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
521
|
+
if (this._deleted) return null;
|
|
522
|
+
let e = this._permissionState();
|
|
523
|
+
if (e === "hidden") return null;
|
|
524
|
+
let t = this._access ?? _();
|
|
525
|
+
o() && (this._devtoolsRendering = !0);
|
|
526
|
+
try {
|
|
527
|
+
return this._el || (this._el = document.createElement(this._tagName), v(t, () => this._applySnapshotToElement())), this._applyAccessState(e), this._commitChildren(), this._children.forEach((e) => {
|
|
528
|
+
v(t, () => {
|
|
529
|
+
let t = e.renderDom();
|
|
530
|
+
t && t.parentNode !== this._el ? this._el.appendChild(t) : !t && e._el && e._el.parentNode === this._el && this._el.removeChild(e._el);
|
|
531
|
+
});
|
|
532
|
+
}), o() && f(this), this._el;
|
|
533
|
+
} finally {
|
|
534
|
+
this._devtoolsRendering = !1;
|
|
535
|
+
}
|
|
284
536
|
}
|
|
285
537
|
toHTML() {
|
|
286
538
|
if (this._deleted) return "";
|
|
287
|
-
let e = this.
|
|
288
|
-
return
|
|
539
|
+
let e = this._permissionState();
|
|
540
|
+
return e === "hidden" ? "" : (this._applyAccessState(e), v(this._access ?? _(), () => {
|
|
541
|
+
let e = this._serializeAttributes(), t = e ? `<${this._tagName} ${e}>` : `<${this._tagName}>`;
|
|
542
|
+
return b.has(this._tagName) ? t : `${t}${this._children.map((e) => e.toHTML()).join("")}</${this._tagName}>`;
|
|
543
|
+
}));
|
|
289
544
|
}
|
|
290
545
|
_applyBindingsToElement() {
|
|
291
|
-
Object.entries(this._attrs).forEach(([e, t]) =>
|
|
546
|
+
Object.entries(this._attrs).forEach(([e, t]) => w(this._el, e, t)), this._syncClassName(), Object.entries(this._styles).forEach(([e, t]) => {
|
|
292
547
|
this._el.style[e] = t;
|
|
293
548
|
}), this._events.forEach((e, t) => {
|
|
294
|
-
|
|
295
|
-
this._el.addEventListener(t, e, n), this._cleanup.push(() => this._el.removeEventListener(t, e, n));
|
|
296
|
-
});
|
|
549
|
+
this._bindDomAdapter(t, void 0, e.options);
|
|
297
550
|
});
|
|
298
551
|
}
|
|
299
552
|
_applySnapshotToElement() {
|
|
@@ -303,24 +556,28 @@ var m = class extends c {
|
|
|
303
556
|
});
|
|
304
557
|
}
|
|
305
558
|
_syncClassName() {
|
|
306
|
-
let e = [...this._classes].join(" ");
|
|
307
|
-
|
|
559
|
+
let e = this._attrs.class, t = [...this._classes].join(" ");
|
|
560
|
+
t ? this._attrs.class = t : delete this._attrs.class, this._el && (t ? this._el.className = t : this._el.removeAttribute("class"), o() && !this._devtoolsRendering && !Object.is(e, t) && d(this, "attr", {
|
|
561
|
+
name: "class",
|
|
562
|
+
previous: e,
|
|
563
|
+
next: t || void 0
|
|
564
|
+
}));
|
|
308
565
|
}
|
|
309
566
|
_serializeAttributes() {
|
|
310
567
|
let e = { ...this._attrs }, t = this._serializeStyles();
|
|
311
|
-
return t && (e.style = e.style ? `${e.style}; ${t}` : t), Object.entries(e).filter(([, e]) => e != null && e !== !1).map(([e, t]) => t === !0 ||
|
|
568
|
+
return t && (e.style = e.style ? `${e.style}; ${t}` : t), Object.entries(e).filter(([, e]) => e != null && e !== !1).map(([e, t]) => t === !0 || C(e) ? `${e}="${e}"` : `${e}="${S(t)}"`).join(" ");
|
|
312
569
|
}
|
|
313
570
|
_serializeStyles() {
|
|
314
|
-
return
|
|
571
|
+
return T(this._styles);
|
|
315
572
|
}
|
|
316
573
|
};
|
|
317
|
-
function
|
|
574
|
+
function F(e, t = P) {
|
|
318
575
|
return function(n = null, r = null, i = null) {
|
|
319
|
-
let a =
|
|
320
|
-
return
|
|
576
|
+
let a = M(n, r, i), o = new t(e, a.first);
|
|
577
|
+
return N(o, a.options), typeof a.callback == "function" && a.callback(o), o;
|
|
321
578
|
};
|
|
322
579
|
}
|
|
323
|
-
function
|
|
580
|
+
function I(e, t, n = {}) {
|
|
324
581
|
let { override: r = !1 } = n;
|
|
325
582
|
Object.entries(t).forEach(([t, n]) => {
|
|
326
583
|
!r && e.prototype[t] || (e.prototype[t] = function(...e) {
|
|
@@ -330,7 +587,7 @@ function g(e, t, n = {}) {
|
|
|
330
587
|
}
|
|
331
588
|
//#endregion
|
|
332
589
|
//#region src/html/index.js
|
|
333
|
-
var
|
|
590
|
+
var L = class extends P {}, R = [
|
|
334
591
|
"a",
|
|
335
592
|
"abbr",
|
|
336
593
|
"address",
|
|
@@ -452,17 +709,17 @@ var _ = class extends m {}, v = [
|
|
|
452
709
|
"video",
|
|
453
710
|
"wbr"
|
|
454
711
|
];
|
|
455
|
-
function
|
|
456
|
-
return
|
|
457
|
-
let { aliases: n = [], name: r, tagName: i } = W(t), a =
|
|
712
|
+
function z() {
|
|
713
|
+
return R.reduce((e, t) => {
|
|
714
|
+
let { aliases: n = [], name: r, tagName: i } = W(t), a = F(i, L);
|
|
458
715
|
return e[r] = a, n.forEach((t) => {
|
|
459
716
|
e[t] = a;
|
|
460
717
|
}), e;
|
|
461
718
|
}, {});
|
|
462
719
|
}
|
|
463
|
-
var
|
|
464
|
-
|
|
465
|
-
var { a: ee, abbr: te, address: ne, area: re, article: ie, aside: ae, audio: oe, b: se, base: ce, bdi: le, bdo: ue, blockquote: de, body:
|
|
720
|
+
var B = z();
|
|
721
|
+
I(L, B);
|
|
722
|
+
var { a: ee, abbr: te, address: ne, area: re, article: ie, aside: ae, audio: oe, b: se, base: ce, bdi: le, bdo: ue, blockquote: de, body: V, br: H, button: fe, canvas: pe, caption: me, cite: he, code: ge, col: _e, colgroup: ve, data: ye, datalist: be, dd: xe, del: Se, details: Ce, dfn: we, dialog: Te, div: Ee, dl: De, dt: Oe, em: ke, embed: Ae, fieldset: je, figcaption: Me, figure: Ne, footer: Pe, form: Fe, h1: Ie, h2: Le, h3: Re, h4: ze, h5: Be, h6: Ve, head: He, header: Ue, hgroup: We, hr: Ge, html: Ke, i: qe, iframe: Je, img: Ye, input: Xe, ins: Ze, kbd: Qe, label: $e, legend: et, li: tt, link: nt, main: rt, map: it, mark: at, menu: ot, meta: st, meter: ct, nav: lt, noscript: ut, object: dt, ol: ft, optgroup: pt, option: mt, output: ht, p: gt, picture: _t, pre: vt, progress: yt, q: bt, rp: xt, rt: St, ruby: Ct, s: wt, samp: Tt, script: Et, search: Dt, section: Ot, select: kt, selectedcontent: At, slot: jt, small: Mt, source: Nt, span: Pt, strong: Ft, style: It, styleTag: Lt, sub: Rt, summary: zt, sup: Bt, table: Vt, tbody: Ht, td: Ut, template: Wt, textarea: Gt, tfoot: Kt, th: qt, thead: Jt, time: Yt, title: Xt, tr: U, track: Zt, u: Qt, ul: $t, varTag: en, video: tn, wbr: nn } = B;
|
|
466
723
|
function W(e) {
|
|
467
724
|
return typeof e == "string" ? {
|
|
468
725
|
name: e,
|
|
@@ -480,10 +737,10 @@ function G(e, t, n = void 0) {
|
|
|
480
737
|
//#region src/components/shared.js
|
|
481
738
|
var K = "yoya-component";
|
|
482
739
|
function q(e = null, t = null, n = null) {
|
|
483
|
-
return
|
|
740
|
+
return M(e, t, n);
|
|
484
741
|
}
|
|
485
742
|
function J(e, t) {
|
|
486
|
-
return typeof e.attr == "function" || typeof e.styles == "function" ?
|
|
743
|
+
return typeof e.attr == "function" || typeof e.styles == "function" ? N(e, t) : (typeof e.render == "function" && N(e.render(), t), e);
|
|
487
744
|
}
|
|
488
745
|
function Y(e, t = null, n = null) {
|
|
489
746
|
return J(e, t), typeof n == "function" && n(e), e;
|
|
@@ -499,7 +756,7 @@ function Z(e) {
|
|
|
499
756
|
}
|
|
500
757
|
//#endregion
|
|
501
758
|
//#region src/chart/echart.js
|
|
502
|
-
var Q = class extends
|
|
759
|
+
var Q = class extends L {
|
|
503
760
|
constructor(e = null) {
|
|
504
761
|
super("div", null), this._autoResize = !0, this._chartInstance = null, this._devicePixelRatio = null, this._echartsLib = null, this._height = "400px", this._loading = !1, this._loadingText = "加载中...", this._onReadyCallbacks = [], this._onResizeCallbacks = [], this._option = null, this._renderer = "canvas", this._resizeObserver = null, this._theme = null, this._width = "100%", this.className(K, "yoya-vechart"), this.styles({
|
|
505
762
|
height: this._height,
|
|
@@ -638,6 +895,6 @@ var Q = class extends _ {
|
|
|
638
895
|
function $(e = null, t = null, n = null) {
|
|
639
896
|
return X(Q, e, t, n);
|
|
640
897
|
}
|
|
641
|
-
|
|
898
|
+
I(L, { vEchart: $ });
|
|
642
899
|
//#endregion
|
|
643
900
|
export { Q as VEchart, $ as vEchart };
|