yxuse 3.0.38 → 3.0.40
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/lib/api.cjs.js +1 -1
- package/lib/api.es.js +9 -9
- package/lib/app.cjs.js +1 -1
- package/lib/app.es.js +1 -1
- package/lib/components.cjs.js +1 -1
- package/lib/components.es.js +15 -17
- package/lib/directives.cjs.js +1 -1
- package/lib/directives.es.js +3 -3
- package/lib/hooks.cjs.js +1 -1
- package/lib/hooks.es.js +2 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs10.js +1 -1
- package/lib/index.cjs11.js +1 -0
- package/lib/index.cjs11.js.gz +0 -0
- package/lib/index.cjs12.js +1 -0
- package/lib/index.cjs13.js +1 -0
- package/lib/index.cjs2.js +1 -42
- package/lib/index.cjs3.js +1 -1
- package/lib/index.cjs4.js +1 -1
- package/lib/index.cjs5.js +22 -1
- package/lib/index.cjs5.js.gz +0 -0
- package/lib/index.cjs6.js +1 -1
- package/lib/index.cjs6.js.gz +0 -0
- package/lib/index.cjs7.js +1 -3
- package/lib/index.cjs8.js +1 -1
- package/lib/index.cjs9.js +1 -1
- package/lib/index.es.js +49 -20
- package/lib/index.es10.js +313 -9
- package/lib/index.es10.js.gz +0 -0
- package/lib/index.es11.js +2390 -0
- package/lib/index.es11.js.gz +0 -0
- package/lib/index.es12.js +202 -0
- package/lib/index.es13.js +22 -0
- package/lib/index.es2.js +14 -8230
- package/lib/index.es3.js +59 -131
- package/lib/index.es4.js +47 -42
- package/lib/index.es5.js +11117 -35
- package/lib/index.es5.js.gz +0 -0
- package/lib/index.es6.js +1098 -300
- package/lib/index.es6.js.gz +0 -0
- package/lib/index.es7.js +17 -1669
- package/lib/index.es8.js +4 -15
- package/lib/index.es9.js +9 -20
- package/lib/theme.cjs.js +1 -1
- package/lib/theme.es.js +17 -20
- package/lib/translate.cjs.js +1 -1
- package/lib/translate.es.js +10 -13
- package/lib/utils.cjs.js +1 -1
- package/lib/utils.es.js +11 -11
- package/lib/yxIcon.cjs.js +1 -1
- package/lib/yxIcon.es.js +4 -4
- package/package.json +2 -1
- package/types/bc/index.d.ts +5 -0
- package/types/config/index.d.ts +3 -0
- package/types/index.d.ts +3 -2
- package/lib/index.cjs2.js.gz +0 -0
- package/lib/index.cjs7.js.gz +0 -0
- package/lib/index.es2.js.gz +0 -0
- package/lib/index.es7.js.gz +0 -0
|
Binary file
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
const notifyMessageToSystems = (message) => {
|
|
8
|
+
const themeBc = new BroadcastChannel("YXUSE_BC");
|
|
9
|
+
themeBc.postMessage(message);
|
|
10
|
+
};
|
|
11
|
+
const receiveMessage = (callback) => {
|
|
12
|
+
const themeBc = new BroadcastChannel("YXUSE_BC");
|
|
13
|
+
themeBc.onmessage = () => {
|
|
14
|
+
callback();
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getSelectOptions = (arr, labelKey, valueKey, isValueToNumber) => {
|
|
18
|
+
if (!Array.isArray(arr))
|
|
19
|
+
return [];
|
|
20
|
+
return arr.map((item) => {
|
|
21
|
+
return {
|
|
22
|
+
label: item == null ? void 0 : item[labelKey],
|
|
23
|
+
value: isValueToNumber ? +item[valueKey] : item[valueKey]
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const enumToArray = (enumObject) => {
|
|
28
|
+
const result = [];
|
|
29
|
+
for (const key in enumObject) {
|
|
30
|
+
if (isNaN(Number(key))) {
|
|
31
|
+
result.push({ label: key, value: enumObject[key] });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
const isDarkColor = (color) => {
|
|
37
|
+
const parseColor = (color2) => {
|
|
38
|
+
let r2 = 0, g2 = 0, b2 = 0, a = 1;
|
|
39
|
+
if (color2.startsWith("#")) {
|
|
40
|
+
color2 = color2.slice(1);
|
|
41
|
+
if (color2.length === 3) {
|
|
42
|
+
r2 = parseInt(color2[0] + color2[0], 16);
|
|
43
|
+
g2 = parseInt(color2[1] + color2[1], 16);
|
|
44
|
+
b2 = parseInt(color2[2] + color2[2], 16);
|
|
45
|
+
} else if (color2.length === 6) {
|
|
46
|
+
r2 = parseInt(color2.slice(0, 2), 16);
|
|
47
|
+
g2 = parseInt(color2.slice(2, 4), 16);
|
|
48
|
+
b2 = parseInt(color2.slice(4, 6), 16);
|
|
49
|
+
} else {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
} else if (color2.startsWith("rgb")) {
|
|
53
|
+
const rgbaMatch = color2.match(/(\d+(\.\d+)?)/g);
|
|
54
|
+
if (rgbaMatch) {
|
|
55
|
+
r2 = parseFloat(rgbaMatch[0]);
|
|
56
|
+
g2 = parseFloat(rgbaMatch[1]);
|
|
57
|
+
b2 = parseFloat(rgbaMatch[2]);
|
|
58
|
+
if (rgbaMatch.length > 3) {
|
|
59
|
+
a = parseFloat(rgbaMatch[3]);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return [r2, g2, b2, a];
|
|
68
|
+
};
|
|
69
|
+
const colorComponents = parseColor(color);
|
|
70
|
+
if (!colorComponents) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const [r, g, b, _] = colorComponents;
|
|
74
|
+
const normalizedR = r / 255;
|
|
75
|
+
const normalizedG = g / 255;
|
|
76
|
+
const normalizedB = b / 255;
|
|
77
|
+
const max = Math.max(normalizedR, normalizedG, normalizedB);
|
|
78
|
+
const min = Math.min(normalizedR, normalizedG, normalizedB);
|
|
79
|
+
let l = (max + min) / 2;
|
|
80
|
+
return l < 0.5;
|
|
81
|
+
};
|
|
82
|
+
const areColorsSimilar = (color1, color2, threshold = 100) => {
|
|
83
|
+
const getColorComponents = (color) => {
|
|
84
|
+
let r, g, b, a = 1;
|
|
85
|
+
if (color.startsWith("#")) {
|
|
86
|
+
color = color.slice(1);
|
|
87
|
+
if (color.length === 3) {
|
|
88
|
+
r = parseInt(color[0] + color[0], 16);
|
|
89
|
+
g = parseInt(color[1] + color[1], 16);
|
|
90
|
+
b = parseInt(color[2] + color[2], 16);
|
|
91
|
+
} else if (color.length === 6) {
|
|
92
|
+
r = parseInt(color.slice(0, 2), 16);
|
|
93
|
+
g = parseInt(color.slice(2, 4), 16);
|
|
94
|
+
b = parseInt(color.slice(4, 6), 16);
|
|
95
|
+
} else {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
} else if (color.startsWith("rgb")) {
|
|
99
|
+
const rgbaMatch = color.match(/(\d+(\.\d+)?)/g);
|
|
100
|
+
r = parseFloat(rgbaMatch[0]);
|
|
101
|
+
g = parseFloat(rgbaMatch[1]);
|
|
102
|
+
b = parseFloat(rgbaMatch[2]);
|
|
103
|
+
if (rgbaMatch.length > 3) {
|
|
104
|
+
a = parseFloat(rgbaMatch[3]);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return [r, g, b, a];
|
|
110
|
+
};
|
|
111
|
+
const color1Components = getColorComponents(color1);
|
|
112
|
+
const color2Components = getColorComponents(color2);
|
|
113
|
+
if (!color1Components || !color2Components) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const euclideanDistance = Math.sqrt(
|
|
117
|
+
Math.pow(color1Components[0] - color2Components[0], 2) + Math.pow(color1Components[1] - color2Components[1], 2) + Math.pow(color1Components[2] - color2Components[2], 2) + Math.pow(color1Components[3] - color2Components[3], 2)
|
|
118
|
+
);
|
|
119
|
+
console.log(euclideanDistance);
|
|
120
|
+
return euclideanDistance <= threshold;
|
|
121
|
+
};
|
|
122
|
+
const isColorEqual = (color1, color2) => {
|
|
123
|
+
function toRGBA(color) {
|
|
124
|
+
if (color.toLowerCase().startsWith("rgba")) {
|
|
125
|
+
return color.toLowerCase();
|
|
126
|
+
} else if (color.toLowerCase().startsWith("rgb")) {
|
|
127
|
+
return color.replace("rgb", "rgba").replace(")", ", 1)");
|
|
128
|
+
} else if (color.length === 7) {
|
|
129
|
+
const r = parseInt(color.substring(1, 3), 16);
|
|
130
|
+
const g = parseInt(color.substring(3, 5), 16);
|
|
131
|
+
const b = parseInt(color.substring(5, 7), 16);
|
|
132
|
+
return `rgba(${r}, ${g}, ${b}, 1)`;
|
|
133
|
+
} else if (color.length === 9 && color.toLowerCase().startsWith("rrggbbaa")) {
|
|
134
|
+
const r = parseInt(color.substring(1, 3), 16);
|
|
135
|
+
const g = parseInt(color.substring(3, 5), 16);
|
|
136
|
+
const b = parseInt(color.substring(5, 7), 16);
|
|
137
|
+
const a = Math.round(parseInt(color.substring(7, 9), 16) / 255 * 100) / 100;
|
|
138
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
139
|
+
} else {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const rgbaColor1 = toRGBA(convertShortHexToLongHex(color1));
|
|
144
|
+
const rgbaColor2 = toRGBA(convertShortHexToLongHex(color2));
|
|
145
|
+
if (!rgbaColor1 || !rgbaColor2) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
return rgbaColor1 === rgbaColor2;
|
|
149
|
+
};
|
|
150
|
+
const convertShortHexToLongHex = (shortHex) => {
|
|
151
|
+
if (shortHex.length === 4 && shortHex[0] === "#") {
|
|
152
|
+
const r = shortHex[1];
|
|
153
|
+
const g = shortHex[2];
|
|
154
|
+
const b = shortHex[3];
|
|
155
|
+
const longHex = `#${r}${r}${g}${g}${b}${b}`;
|
|
156
|
+
return longHex;
|
|
157
|
+
} else {
|
|
158
|
+
return shortHex;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
class YxSubscribe {
|
|
162
|
+
constructor() {
|
|
163
|
+
__publicField(this, "subscribers");
|
|
164
|
+
this.subscribers = {};
|
|
165
|
+
}
|
|
166
|
+
subscribe(sub, fn) {
|
|
167
|
+
if (!this.subscribers[sub]) {
|
|
168
|
+
this.subscribers[sub] = [];
|
|
169
|
+
}
|
|
170
|
+
this.subscribers[sub].push(fn);
|
|
171
|
+
}
|
|
172
|
+
unsubscribe(sub, fn) {
|
|
173
|
+
const subscribers = this.subscribers[sub];
|
|
174
|
+
if (!fn)
|
|
175
|
+
return this.subscribers[sub] = [];
|
|
176
|
+
if (subscribers) {
|
|
177
|
+
const index = subscribers.indexOf(fn);
|
|
178
|
+
if (index !== -1) {
|
|
179
|
+
subscribers.splice(index, 1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
publish(message) {
|
|
184
|
+
const subscribers = this.subscribers[message.type];
|
|
185
|
+
if (subscribers) {
|
|
186
|
+
subscribers.forEach((fn) => {
|
|
187
|
+
fn(message.data);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const yxSubscribe = new YxSubscribe();
|
|
193
|
+
export {
|
|
194
|
+
areColorsSimilar as a,
|
|
195
|
+
isDarkColor as b,
|
|
196
|
+
enumToArray as e,
|
|
197
|
+
getSelectOptions as g,
|
|
198
|
+
isColorEqual as i,
|
|
199
|
+
notifyMessageToSystems as n,
|
|
200
|
+
receiveMessage as r,
|
|
201
|
+
yxSubscribe as y
|
|
202
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { h as http, U as URL } from "./index.es11.js";
|
|
2
|
+
const uploadResourceApi = (params, config) => http.post(`${URL["ttc"].INTEGRATED_BASE_URL}/file/upload`, params, config);
|
|
3
|
+
const getGroupListApi = () => http.get(
|
|
4
|
+
`${URL["ttc"].INTEGRATED_BASE_URL}/resource/group/list`,
|
|
5
|
+
{},
|
|
6
|
+
{
|
|
7
|
+
headers: { noLoading: true }
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
const getResourceListApi = (groupUuid, sign) => http.get(`${URL["ttc"].INTEGRATED_BASE_URL}/resource/file/list/${sign}/${groupUuid}`, {}, { headers: { noLoading: true } });
|
|
11
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
12
|
+
__proto__: null,
|
|
13
|
+
getGroupListApi,
|
|
14
|
+
getResourceListApi,
|
|
15
|
+
uploadResourceApi
|
|
16
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
+
export {
|
|
18
|
+
getResourceListApi as a,
|
|
19
|
+
getGroupListApi as g,
|
|
20
|
+
index as i,
|
|
21
|
+
uploadResourceApi as u
|
|
22
|
+
};
|