yxuse 2.0.9 → 2.0.10

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.
Binary file
package/lib/index.es4.js CHANGED
@@ -1,6 +1,24 @@
1
- const e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2
- __proto__: null
1
+ import { g as s } from "./index.es3.js";
2
+ const c = {
3
+ mounted(t, e) {
4
+ n(t, e);
5
+ }
6
+ }, n = (t, e) => {
7
+ const r = e.value;
8
+ return s(r) ? "" : t.remove();
9
+ }, o = {
10
+ auth: c
11
+ }, i = {
12
+ install: function(t) {
13
+ Object.keys(o).forEach((e) => {
14
+ t.directive(e, o[e]);
15
+ });
16
+ }
17
+ }, l = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18
+ __proto__: null,
19
+ default: i
3
20
  }, Symbol.toStringTag, { value: "Module" }));
4
21
  export {
5
- e as i
22
+ i as a,
23
+ l as d
6
24
  };
package/lib/index.es5.js CHANGED
@@ -1,40 +1,137 @@
1
- var a = (t, r, s) => new Promise((d, l) => {
2
- var E = (e) => {
3
- try {
4
- o(s.next(e));
5
- } catch (i) {
6
- l(i);
7
- }
8
- }, _ = (e) => {
9
- try {
10
- o(s.throw(e));
11
- } catch (i) {
12
- l(i);
1
+ var $ = Object.defineProperty;
2
+ var w = (e, s, t) => s in e ? $(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var d = (e, s, t) => (w(e, typeof s != "symbol" ? s + "" : s, t), t);
4
+ import { h as y } from "./index.es3.js";
5
+ const S = (e) => {
6
+ new BroadcastChannel("YXUSE_BC").postMessage(e);
7
+ }, B = (e) => {
8
+ const s = new BroadcastChannel("YXUSE_BC");
9
+ s.onmessage = () => {
10
+ e();
11
+ };
12
+ }, F = (e, s, t, i) => Array.isArray(e) ? e.map((a) => ({
13
+ label: a == null ? void 0 : a[s],
14
+ value: i ? +a[t] : a[t]
15
+ })) : [], W = (e) => {
16
+ const s = [];
17
+ for (const t in e)
18
+ isNaN(Number(t)) && s.push({ label: t, value: e[t] });
19
+ return s;
20
+ }, _ = (e) => {
21
+ const t = ((u) => {
22
+ let f = 0, C = 0, I = 0, m = 1;
23
+ if (u.startsWith("#"))
24
+ if (u = u.slice(1), u.length === 3)
25
+ f = parseInt(u[0] + u[0], 16), C = parseInt(u[1] + u[1], 16), I = parseInt(u[2] + u[2], 16);
26
+ else if (u.length === 6)
27
+ f = parseInt(u.slice(0, 2), 16), C = parseInt(u.slice(2, 4), 16), I = parseInt(u.slice(4, 6), 16);
28
+ else
29
+ return null;
30
+ else if (u.startsWith("rgb")) {
31
+ const h = u.match(/(\d+(\.\d+)?)/g);
32
+ if (h)
33
+ f = parseFloat(h[0]), C = parseFloat(h[1]), I = parseFloat(h[2]), h.length > 3 && (m = parseFloat(h[3]));
34
+ else
35
+ return null;
36
+ } else
37
+ return null;
38
+ return [f, C, I, m];
39
+ })(e);
40
+ if (!t)
41
+ return null;
42
+ const [i, a, r, p] = t, n = i / 255, b = a / 255, l = r / 255, c = Math.max(n, b, l), o = Math.min(n, b, l);
43
+ return (c + o) / 2 < 0.5;
44
+ }, x = (e, s, t = 100) => {
45
+ const i = (n) => {
46
+ let b, l, c, o = 1;
47
+ if (n.startsWith("#"))
48
+ if (n = n.slice(1), n.length === 3)
49
+ b = parseInt(n[0] + n[0], 16), l = parseInt(n[1] + n[1], 16), c = parseInt(n[2] + n[2], 16);
50
+ else if (n.length === 6)
51
+ b = parseInt(n.slice(0, 2), 16), l = parseInt(n.slice(2, 4), 16), c = parseInt(n.slice(4, 6), 16);
52
+ else
53
+ return null;
54
+ else if (n.startsWith("rgb")) {
55
+ const g = n.match(/(\d+(\.\d+)?)/g);
56
+ b = parseFloat(g[0]), l = parseFloat(g[1]), c = parseFloat(g[2]), g.length > 3 && (o = parseFloat(g[3]));
57
+ } else
58
+ return null;
59
+ return [b, l, c, o];
60
+ }, a = i(e), r = i(s);
61
+ if (!a || !r)
62
+ return !1;
63
+ const p = Math.sqrt(
64
+ Math.pow(a[0] - r[0], 2) + Math.pow(a[1] - r[1], 2) + Math.pow(a[2] - r[2], 2) + Math.pow(a[3] - r[3], 2)
65
+ );
66
+ return console.log(p), p <= t;
67
+ }, L = (e, s) => {
68
+ function t(r) {
69
+ if (r.toLowerCase().startsWith("rgba"))
70
+ return r.toLowerCase();
71
+ if (r.toLowerCase().startsWith("rgb"))
72
+ return r.replace("rgb", "rgba").replace(")", ", 1)");
73
+ if (r.length === 7) {
74
+ const p = parseInt(r.substring(1, 3), 16), n = parseInt(r.substring(3, 5), 16), b = parseInt(r.substring(5, 7), 16);
75
+ return `rgba(${p}, ${n}, ${b}, 1)`;
76
+ } else if (r.length === 9 && r.toLowerCase().startsWith("rrggbbaa")) {
77
+ const p = parseInt(r.substring(1, 3), 16), n = parseInt(r.substring(3, 5), 16), b = parseInt(r.substring(5, 7), 16), l = Math.round(parseInt(r.substring(7, 9), 16) / 255 * 100) / 100;
78
+ return `rgba(${p}, ${n}, ${b}, ${l})`;
79
+ } else
80
+ return null;
81
+ }
82
+ const i = t(M(e)), a = t(M(s));
83
+ return !i || !a ? !1 : i === a;
84
+ }, M = (e) => {
85
+ if (e.length === 4 && e[0] === "#") {
86
+ const s = e[1], t = e[2], i = e[3];
87
+ return `#${s}${s}${t}${t}${i}${i}`;
88
+ } else
89
+ return e;
90
+ };
91
+ class v {
92
+ constructor() {
93
+ d(this, "subscribers");
94
+ this.subscribers = {};
95
+ }
96
+ subscribe(s, t) {
97
+ this.subscribers[s] || (this.subscribers[s] = []), this.subscribers[s].push(t);
98
+ }
99
+ unsubscribe(s, t) {
100
+ const i = this.subscribers[s];
101
+ if (!t)
102
+ return this.subscribers[s] = [];
103
+ if (i) {
104
+ const a = i.indexOf(t);
105
+ a !== -1 && i.splice(a, 1);
13
106
  }
14
- }, o = (e) => e.done ? d(e.value) : Promise.resolve(e.value).then(E, _);
15
- o((s = s.apply(t, r)).next());
16
- });
17
- import { N as n, U as c, P as g } from "./index.es6.js";
18
- const u = (t = "ttc") => a(void 0, null, function* () {
19
- return yield n.get(`${c[t].INTEGRATED_BASE_URL}/basic/data/satellite/select`);
20
- }), T = (t = "ttc") => a(void 0, null, function* () {
21
- return yield n.get(`${c[t].INTEGRATED_BASE_URL}/basic/data/ante/select`);
22
- }), U = (t = "ttc") => a(void 0, null, function* () {
23
- return yield n.get(`${c[t].INTEGRATED_BASE_URL}/theme/list`);
24
- }), m = (t = "ttc") => a(void 0, null, function* () {
25
- return yield n.get(`${c[t].INTEGRATED_BASE_URL}/workorder/comment/untreated/count`);
26
- }), S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
107
+ }
108
+ publish(s) {
109
+ const t = this.subscribers[s.type];
110
+ t && t.forEach((i) => {
111
+ i(s.data);
112
+ });
113
+ }
114
+ }
115
+ const z = new v(), T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
27
116
  __proto__: null,
28
- auth: g,
29
- getCommentUntreatedCount: m,
30
- getUserSelectAnteList: T,
31
- getUserSelectSatelliteList: u,
32
- getUserThemeList: U
117
+ areColorsSimilar: x,
118
+ enumToArray: W,
119
+ getSelectOptions: F,
120
+ http: y,
121
+ isColorEqual: L,
122
+ isDarkColor: _,
123
+ notifyMessageToSystems: S,
124
+ receiveMessage: B,
125
+ yxSubscribe: z
33
126
  }, Symbol.toStringTag, { value: "Module" }));
34
127
  export {
35
- U as a,
36
- S as b,
37
- u as c,
38
- T as d,
39
- m as g
128
+ _ as a,
129
+ x as b,
130
+ W as e,
131
+ F as g,
132
+ L as i,
133
+ S as n,
134
+ B as r,
135
+ T as u,
136
+ z as y
40
137
  };