yxuse 3.0.8 → 3.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.es3.js CHANGED
@@ -1,61 +1,82 @@
1
- var n = Object.defineProperty;
2
- var o = (r, s, e) => s in r ? n(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
- var i = (r, s, e) => (o(r, typeof s != "symbol" ? s + "" : s, e), e);
4
- import { h as b } from "./index.es6.js";
5
- const a = (r) => {
6
- new BroadcastChannel("YXUSE_BC").postMessage(r);
7
- }, u = (r) => {
8
- const s = new BroadcastChannel("YXUSE_BC");
9
- s.onmessage = () => {
10
- r();
1
+ var b = Object.defineProperty;
2
+ var c = (s, e, t) => e in s ? b(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var i = (s, e, t) => (c(s, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { h as l } from "./index.es6.js";
5
+ const h = (s) => {
6
+ new BroadcastChannel("YXUSE_BC").postMessage(s);
7
+ }, p = (s) => {
8
+ const e = new BroadcastChannel("YXUSE_BC");
9
+ e.onmessage = () => {
10
+ s();
11
11
  };
12
- }, h = (r, s, e, c) => Array.isArray(r) ? r.map((t) => ({
13
- label: t == null ? void 0 : t[s],
14
- value: c ? +t[e] : t[e]
15
- })) : [], l = (r) => {
16
- const s = [];
17
- for (const e in r)
18
- isNaN(Number(e)) && s.push({ label: e, value: r[e] });
19
- return s;
12
+ }, f = (s, e, t, r) => Array.isArray(s) ? s.map((n) => ({
13
+ label: n == null ? void 0 : n[e],
14
+ value: r ? +n[t] : n[t]
15
+ })) : [], g = (s) => {
16
+ const e = [];
17
+ for (const t in s)
18
+ isNaN(Number(t)) && e.push({ label: t, value: s[t] });
19
+ return e;
20
+ }, o = (s) => {
21
+ if (!s)
22
+ return !1;
23
+ let e, t, r;
24
+ if (s.startsWith("#"))
25
+ if (s = s.slice(1), s.length === 3)
26
+ e = parseInt(s[0] + s[0], 16), t = parseInt(s[1] + s[1], 16), r = parseInt(s[2] + s[2], 16);
27
+ else if (s.length === 6)
28
+ e = parseInt(s.slice(0, 2), 16), t = parseInt(s.slice(2, 4), 16), r = parseInt(s.slice(4, 6), 16);
29
+ else
30
+ return null;
31
+ else if (s.startsWith("rgba")) {
32
+ const a = s.match(/(\d+(\.\d+)?)/g);
33
+ e = parseFloat(a[0]), t = parseFloat(a[1]), r = parseFloat(a[2]);
34
+ } else
35
+ return null;
36
+ e /= 255, t /= 255, r /= 255;
37
+ const n = Math.max(e, t, r), u = Math.min(e, t, r);
38
+ return (n + u) / 2 < 0.5;
20
39
  };
21
- class f {
40
+ class y {
22
41
  constructor() {
23
42
  i(this, "subscribers");
24
43
  this.subscribers = {};
25
44
  }
26
- subscribe(s, e) {
27
- this.subscribers[s] || (this.subscribers[s] = []), this.subscribers[s].push(e);
45
+ subscribe(e, t) {
46
+ this.subscribers[e] || (this.subscribers[e] = []), this.subscribers[e].push(t);
28
47
  }
29
- unsubscribe(s, e) {
30
- const c = this.subscribers[s];
31
- if (!e)
32
- return this.subscribers[s] = [];
33
- if (c) {
34
- const t = c.indexOf(e);
35
- t !== -1 && c.splice(t, 1);
48
+ unsubscribe(e, t) {
49
+ const r = this.subscribers[e];
50
+ if (!t)
51
+ return this.subscribers[e] = [];
52
+ if (r) {
53
+ const n = r.indexOf(t);
54
+ n !== -1 && r.splice(n, 1);
36
55
  }
37
56
  }
38
- publish(s) {
39
- const e = this.subscribers[s.type];
40
- e && e.forEach((c) => {
41
- c(s.data);
57
+ publish(e) {
58
+ const t = this.subscribers[e.type];
59
+ t && t.forEach((r) => {
60
+ r(e.data);
42
61
  });
43
62
  }
44
63
  }
45
- const p = new f(), d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
64
+ const d = new y(), B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
46
65
  __proto__: null,
47
- enumToArray: l,
48
- getSelectOptions: h,
49
- http: b,
50
- notifyMessageToSystems: a,
51
- receiveMessage: u,
52
- yxSubscribe: p
66
+ enumToArray: g,
67
+ getSelectOptions: f,
68
+ http: l,
69
+ isDarkColor: o,
70
+ notifyMessageToSystems: h,
71
+ receiveMessage: p,
72
+ yxSubscribe: d
53
73
  }, Symbol.toStringTag, { value: "Module" }));
54
74
  export {
55
- l as e,
56
- h as g,
57
- a as n,
58
- u as r,
59
- d as u,
60
- p as y
75
+ g as e,
76
+ f as g,
77
+ o as i,
78
+ h as n,
79
+ p as r,
80
+ B as u,
81
+ d as y
61
82
  };