@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
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
//#region src/core/context.js
|
|
2
|
+
var e = [], t = null;
|
|
3
|
+
function n() {
|
|
4
|
+
let n = { ...t || {} };
|
|
5
|
+
return e.forEach((e) => Object.assign(n, e)), n;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/core/devtools.js
|
|
9
|
+
var r = !1, i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new Map(), s = 1, c = 1, l = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function u() {
|
|
11
|
+
return r = !0, !0;
|
|
12
|
+
}
|
|
13
|
+
function d() {
|
|
14
|
+
return r = !1, !1;
|
|
15
|
+
}
|
|
16
|
+
function f() {
|
|
17
|
+
return r;
|
|
18
|
+
}
|
|
19
|
+
function p(e) {
|
|
20
|
+
if (!r) return;
|
|
21
|
+
let t = {
|
|
22
|
+
seq: c,
|
|
23
|
+
...e
|
|
24
|
+
};
|
|
25
|
+
c += 1, t.node && typeof t.node == "object" && t.nodeId === void 0 && (t.nodeId = h(t.node)), t.node && typeof t.node == "object" && t.nodeLabel === void 0 && (t.nodeLabel = C(t.node)), i.forEach((e) => {
|
|
26
|
+
try {
|
|
27
|
+
e(t);
|
|
28
|
+
} catch {}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function m(e) {
|
|
32
|
+
return i.add(e), () => i.delete(e);
|
|
33
|
+
}
|
|
34
|
+
function h(e) {
|
|
35
|
+
let t = a.get(e);
|
|
36
|
+
return t === void 0 && (t = s, s += 1, a.set(e, t)), o.set(t, e), t;
|
|
37
|
+
}
|
|
38
|
+
function g(e) {
|
|
39
|
+
let t = a.get(e);
|
|
40
|
+
t !== void 0 && o.delete(t);
|
|
41
|
+
}
|
|
42
|
+
function _(e) {
|
|
43
|
+
let t = n();
|
|
44
|
+
e._devtoolsContext = Object.keys(t).length > 0 ? t : null;
|
|
45
|
+
}
|
|
46
|
+
function v(e) {
|
|
47
|
+
let t = o.get(e);
|
|
48
|
+
if (!t || t._deleted) return null;
|
|
49
|
+
let n = t._access, r = {
|
|
50
|
+
id: e,
|
|
51
|
+
access: n ? {
|
|
52
|
+
code: n.code,
|
|
53
|
+
level: n.level
|
|
54
|
+
} : null,
|
|
55
|
+
context: t._devtoolsContext || null,
|
|
56
|
+
i18n: null
|
|
57
|
+
};
|
|
58
|
+
return typeof t._permissionState == "function" && (r.permissionState = t._permissionState()), t._i18n && typeof t._i18n.getLanguage == "function" && (r.i18n = {
|
|
59
|
+
key: t._key ?? void 0,
|
|
60
|
+
language: t._i18n.getLanguage()
|
|
61
|
+
}), r;
|
|
62
|
+
}
|
|
63
|
+
function y(e) {
|
|
64
|
+
let t = o.get(e);
|
|
65
|
+
return !t || t._deleted || !("_el" in t) || !t._el ? null : t._el;
|
|
66
|
+
}
|
|
67
|
+
function b(e) {
|
|
68
|
+
return h(e);
|
|
69
|
+
}
|
|
70
|
+
function x(e) {
|
|
71
|
+
return typeof e._tagName == "string" && e._attrs ? "element" : typeof e._content == "string" && "_textNode" in e ? "text" : "_component" in e && "_resolvedList" in e ? "component" : "view";
|
|
72
|
+
}
|
|
73
|
+
function S(e, t) {
|
|
74
|
+
return t === "component" ? Array.isArray(e._resolvedList) ? e._resolvedList : [] : Array.isArray(e._children) ? e._children : [];
|
|
75
|
+
}
|
|
76
|
+
function C(e) {
|
|
77
|
+
let t = x(e);
|
|
78
|
+
if (t === "element") {
|
|
79
|
+
let t = (e._classes ? [...e._classes].slice(0, 2) : []).map((e) => String(e).replace(/\s+/g, "")).filter(Boolean).map((e) => `.${e}`).join("");
|
|
80
|
+
return `${e._tagName || "element"}${t}`;
|
|
81
|
+
}
|
|
82
|
+
if (t === "text") {
|
|
83
|
+
let t = typeof e._content == "string" ? e._content : "";
|
|
84
|
+
return `文本 "${t.length > 24 ? `${t.slice(0, 24)}…` : t}"`;
|
|
85
|
+
}
|
|
86
|
+
return t === "component" ? "组件" : "节点";
|
|
87
|
+
}
|
|
88
|
+
function w(e) {
|
|
89
|
+
let t = x(e), n = {
|
|
90
|
+
kind: t,
|
|
91
|
+
id: h(e)
|
|
92
|
+
};
|
|
93
|
+
return t === "element" ? {
|
|
94
|
+
...n,
|
|
95
|
+
tagName: e._tagName,
|
|
96
|
+
attrs: { ...e._attrs },
|
|
97
|
+
children: S(e, t).map((e) => w(e))
|
|
98
|
+
} : t === "text" ? {
|
|
99
|
+
...n,
|
|
100
|
+
text: e._content,
|
|
101
|
+
children: []
|
|
102
|
+
} : {
|
|
103
|
+
...n,
|
|
104
|
+
children: S(e, t).map((e) => w(e))
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function T(e) {
|
|
108
|
+
let t = x(e), n = h(e);
|
|
109
|
+
return t === "element" ? {
|
|
110
|
+
kind: t,
|
|
111
|
+
id: n,
|
|
112
|
+
attrs: { ...e._attrs },
|
|
113
|
+
styles: { ...e._styles },
|
|
114
|
+
childIds: (e._children || []).map((e) => h(e))
|
|
115
|
+
} : t === "text" ? {
|
|
116
|
+
kind: t,
|
|
117
|
+
id: n,
|
|
118
|
+
text: e._content
|
|
119
|
+
} : t === "component" ? {
|
|
120
|
+
kind: t,
|
|
121
|
+
id: n,
|
|
122
|
+
childIds: (e._resolvedList || []).map((e) => h(e))
|
|
123
|
+
} : {
|
|
124
|
+
kind: t,
|
|
125
|
+
id: n,
|
|
126
|
+
childIds: (e._children || []).map((e) => h(e))
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function E(e, t) {
|
|
130
|
+
let n = {};
|
|
131
|
+
return (/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])).forEach((r) => {
|
|
132
|
+
Object.is(e[r], t[r]) || (n[r] = {
|
|
133
|
+
previous: e[r],
|
|
134
|
+
next: t[r]
|
|
135
|
+
});
|
|
136
|
+
}), Object.keys(n).length > 0 ? n : null;
|
|
137
|
+
}
|
|
138
|
+
function D(e, t) {
|
|
139
|
+
let n = {};
|
|
140
|
+
if (e.kind === "element" && t.kind === "element") {
|
|
141
|
+
let r = E(e.attrs, t.attrs);
|
|
142
|
+
r && (n.attrs = r);
|
|
143
|
+
let i = E(e.styles, t.styles);
|
|
144
|
+
i && (n.styles = i);
|
|
145
|
+
}
|
|
146
|
+
e.kind === "text" && t.kind === "text" && !Object.is(e.text, t.text) && (n.text = {
|
|
147
|
+
from: e.text,
|
|
148
|
+
to: t.text
|
|
149
|
+
});
|
|
150
|
+
let r = e.childIds || [], i = t.childIds || [], a = new Set(r), o = new Set(i), s = i.filter((e) => !a.has(e)), c = r.filter((e) => !o.has(e)), l = c.length === 0 && s.length === 0 && i.length > 1 && i.some((e, t) => r[t] !== e);
|
|
151
|
+
return (s.length > 0 || c.length > 0 || l) && (n.children = {
|
|
152
|
+
added: s,
|
|
153
|
+
removed: c,
|
|
154
|
+
reordered: l
|
|
155
|
+
}), n;
|
|
156
|
+
}
|
|
157
|
+
function O(e) {
|
|
158
|
+
e && l.set(e, T(e));
|
|
159
|
+
}
|
|
160
|
+
function k(e, t, n) {
|
|
161
|
+
!r || !e || (p({
|
|
162
|
+
type: t,
|
|
163
|
+
node: e,
|
|
164
|
+
...n
|
|
165
|
+
}), O(e));
|
|
166
|
+
}
|
|
167
|
+
function A(e) {
|
|
168
|
+
if (!r || !e || e._deleted) return;
|
|
169
|
+
let t = T(e), n = l.get(e);
|
|
170
|
+
if (!n) {
|
|
171
|
+
p({
|
|
172
|
+
type: "commit",
|
|
173
|
+
kind: "mount",
|
|
174
|
+
node: e
|
|
175
|
+
}), l.set(e, t);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
let i = D(n, t);
|
|
179
|
+
Object.entries(i.attrs || {}).forEach(([t, n]) => {
|
|
180
|
+
p({
|
|
181
|
+
type: "attr",
|
|
182
|
+
node: e,
|
|
183
|
+
name: t,
|
|
184
|
+
...n
|
|
185
|
+
});
|
|
186
|
+
}), Object.entries(i.styles || {}).forEach(([t, n]) => {
|
|
187
|
+
p({
|
|
188
|
+
type: "style",
|
|
189
|
+
node: e,
|
|
190
|
+
name: t,
|
|
191
|
+
...n
|
|
192
|
+
});
|
|
193
|
+
}), i.children && p({
|
|
194
|
+
type: "child",
|
|
195
|
+
node: e,
|
|
196
|
+
...i.children
|
|
197
|
+
}), i.text && p({
|
|
198
|
+
type: "text",
|
|
199
|
+
node: e,
|
|
200
|
+
...i.text
|
|
201
|
+
}), l.set(e, t);
|
|
202
|
+
}
|
|
203
|
+
function j(e) {
|
|
204
|
+
return e ? w(e) : {
|
|
205
|
+
kind: "root",
|
|
206
|
+
children: []
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
var M = Symbol.for("yoya.devtools.bridge");
|
|
210
|
+
function N() {
|
|
211
|
+
typeof globalThis > "u" || (globalThis[M] = {
|
|
212
|
+
captureScope: _,
|
|
213
|
+
commit: A,
|
|
214
|
+
emit: p,
|
|
215
|
+
enabled: () => r,
|
|
216
|
+
ensureId: b,
|
|
217
|
+
notify: k,
|
|
218
|
+
unregister: g
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
N();
|
|
222
|
+
//#endregion
|
|
223
|
+
export { d as disableDevtools, u as enableDevtools, y as getDevtoolsDom, v as getDevtoolsScope, j as getDevtoolsSnapshot, f as isDevtoolsEnabled, m as subscribeDevtools };
|