dev-classes 1.2.3 → 1.3.4

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.
Files changed (81) hide show
  1. package/README.md +250 -0
  2. package/dist/classes/Color/Color.d.ts +28 -37
  3. package/dist/classes/Color/Color.js +167 -205
  4. package/dist/classes/Color/Color.types.d.ts +36 -0
  5. package/dist/classes/Color/Color.types.js +1 -0
  6. package/dist/classes/Color/index.d.ts +2 -0
  7. package/dist/classes/Color/index.js +4 -0
  8. package/dist/classes/DateProcessing/DateProcessing.d.ts +30 -78
  9. package/dist/classes/DateProcessing/DateProcessing.js +2 -1
  10. package/dist/classes/DateProcessing/DateProcessing.types.d.ts +50 -0
  11. package/dist/classes/DateProcessing/DateProcessing.types.js +5 -0
  12. package/dist/classes/DateProcessing/index.d.ts +2 -0
  13. package/dist/classes/DateProcessing/index.js +4 -0
  14. package/dist/classes/DelaysPromise/DelaysPromise.d.ts +8 -0
  15. package/dist/classes/DelaysPromise/DelaysPromise.js +69 -0
  16. package/dist/classes/DelaysPromise/DelaysPromise.types.d.ts +28 -0
  17. package/dist/classes/DelaysPromise/DelaysPromise.types.js +1 -0
  18. package/dist/classes/DelaysPromise/index.d.ts +2 -0
  19. package/dist/classes/DelaysPromise/index.js +4 -0
  20. package/dist/classes/File/File.d.ts +8 -0
  21. package/dist/classes/File/File.js +22 -0
  22. package/dist/classes/File/File.types.d.ts +7 -0
  23. package/dist/classes/File/File.types.js +1 -0
  24. package/dist/classes/File/index.d.ts +2 -0
  25. package/dist/classes/File/index.js +4 -0
  26. package/dist/classes/HTTPSApi/HTTPSApi.d.ts +14 -4
  27. package/dist/classes/HTTPSApi/HTTPSApi.js +61 -38
  28. package/dist/classes/HTTPSApi/HTTPSApi.types.d.ts +3 -0
  29. package/dist/classes/HTTPSApi/index.d.ts +2 -0
  30. package/dist/classes/HTTPSApi/index.js +4 -0
  31. package/dist/classes/Numbers/Numbers.d.ts +5 -3
  32. package/dist/classes/Numbers/Numbers.js +17 -20
  33. package/dist/classes/Numbers/Numbers.types.d.ts +5 -0
  34. package/dist/classes/Numbers/Numbers.types.js +1 -0
  35. package/dist/classes/Numbers/index.d.ts +2 -0
  36. package/dist/classes/Numbers/index.js +4 -0
  37. package/dist/classes/SocketApi/SocketApi.d.ts +25 -38
  38. package/dist/classes/SocketApi/SocketApi.js +112 -84
  39. package/dist/classes/SocketApi/SocketApi.types.d.ts +6 -0
  40. package/dist/classes/SocketApi/SocketApi.types.js +1 -0
  41. package/dist/classes/SocketApi/deps/WsApi/WsApi.d.ts +31 -26
  42. package/dist/classes/SocketApi/deps/WsApi/WsApi.js +91 -69
  43. package/dist/classes/SocketApi/deps/WsApi/WsApi.types.d.ts +7 -22
  44. package/dist/classes/SocketApi/deps/WsApi/index.d.ts +1 -1
  45. package/dist/classes/SocketApi/index.d.ts +2 -0
  46. package/dist/classes/SocketApi/index.js +4 -0
  47. package/dist/classes/Utils/EventSubscribers/EventSubscribers.d.ts +14 -0
  48. package/dist/classes/Utils/EventSubscribers/EventSubscribers.js +33 -0
  49. package/dist/classes/Utils/EventSubscribers/EventSubscribers.types.d.ts +9 -0
  50. package/dist/classes/Utils/EventSubscribers/EventSubscribers.types.js +1 -0
  51. package/dist/classes/Utils/EventSubscribers/index.d.ts +2 -0
  52. package/dist/classes/Utils/EventSubscribers/index.js +4 -0
  53. package/dist/classes/Utils/NetworkInformation/NetworkInformation.d.ts +9 -0
  54. package/dist/classes/Utils/NetworkInformation/NetworkInformation.js +24 -0
  55. package/dist/classes/Utils/NetworkInformation/classes/InternetWatchers.d.ts +6 -0
  56. package/dist/classes/Utils/NetworkInformation/classes/InternetWatchers.js +39 -0
  57. package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationCordova.d.ts +11 -0
  58. package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationCordova.js +26 -0
  59. package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationPC.d.ts +11 -0
  60. package/dist/classes/Utils/NetworkInformation/classes/NetworkInformationPC.js +22 -0
  61. package/dist/classes/Utils/NetworkInformation/classes/index.d.ts +2 -0
  62. package/dist/classes/Utils/NetworkInformation/classes/index.js +6 -0
  63. package/dist/classes/Utils/NetworkInformation/classes/types/types.abscruct.d.ts +10 -0
  64. package/dist/classes/Utils/NetworkInformation/classes/types/types.abscruct.js +5 -0
  65. package/dist/classes/Utils/NetworkInformation/index.d.ts +4 -0
  66. package/dist/classes/Utils/NetworkInformation/index.js +10 -0
  67. package/dist/classes/Utils/Utils.d.ts +4 -4
  68. package/dist/classes/Utils/Utils.js +34 -39
  69. package/dist/classes/Utils/Utils.types.d.ts +17 -0
  70. package/dist/classes/Utils/Utils.types.js +1 -0
  71. package/dist/index.d.ts +9 -9
  72. package/dist/index.js +26 -20
  73. package/package.json +16 -2
  74. package/dist/classes/Delay/Delay.d.ts +0 -26
  75. package/dist/classes/Delay/Delay.js +0 -66
  76. package/dist/classes/DownloadFile/DownloadFile.d.ts +0 -8
  77. package/dist/classes/DownloadFile/DownloadFile.js +0 -23
  78. package/dist/classes/ProcessingWS/ProcessingWS.d.ts +0 -11
  79. package/dist/classes/ProcessingWS/ProcessingWS.js +0 -20
  80. package/dist/classes/SocketApi/deps/InternetWatcher/InternetWatcher.d.ts +0 -8
  81. package/dist/classes/SocketApi/deps/InternetWatcher/InternetWatcher.js +0 -24
@@ -1,211 +1,173 @@
1
- var M = Object.defineProperty;
2
- var b = (l, t, n) => t in l ? M(l, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[t] = n;
3
- var p = (l, t, n) => (b(l, typeof t != "symbol" ? t + "" : t, n), n);
4
- const o = class o {
5
- /**
6
- * https://stackoverflow.com/a/54070620/6758968
7
- * r, g, b in [0, 255]
8
- * @returns h in [0,360) and s, v in [0,1]
9
- */
10
- static rgbToHsv(t, n, e) {
11
- t /= 255, n /= 255, e /= 255;
12
- const r = Math.max(t, n, e), s = r - Math.min(t, n, e), a = s && (r === t ? (n - e) / s : r == n ? 2 + (e - t) / s : 4 + (t - n) / s);
13
- return [60 * (a < 0 ? a + 6 : a), r && s / r, r];
14
- }
15
- /**
16
- * https://stackoverflow.com/a/54024653/6758968
17
- * @param h [0, 360]
18
- * @param s [0, 1]
19
- * @param v [0, 1]
20
- * @returns r, g, b in [0, 255]
21
- */
22
- static hsvToRgb(t, n, e) {
23
- const r = (s, a = (s + t / 60) % 6) => Math.round((e - e * n * Math.max(Math.min(a, 4 - a, 1), 0)) * 255);
24
- return [r(5), r(3), r(1)];
25
- }
26
- /**
27
- * @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
28
- */
29
- static rgbaToHsla(t, n, e, r = 1) {
30
- t /= 255, n /= 255, e /= 255;
31
- const s = Math.max(t, n, e), a = Math.min(t, n, e);
32
- let i = 0, c;
33
- const h = (s + a) / 2;
34
- if (s === a)
35
- i = c = 0;
36
- else {
37
- const g = s - a;
38
- switch (c = h > 0.5 ? g / (2 - s - a) : g / (s + a), s) {
39
- case t:
40
- i = (n - e) / g + (n < e ? 6 : 0);
41
- break;
42
- case n:
43
- i = (e - t) / g + 2;
44
- break;
45
- case e:
46
- i = (t - n) / g + 4;
47
- break;
48
- }
49
- i /= 6;
50
- }
51
- return {
52
- h: i * 360,
53
- s: c * 100,
54
- l: h * 100,
55
- a: r
56
- };
57
- }
58
- // * https://stackoverflow.com/a/9493060/6758968
59
- /**
60
- * Converts an HSL color value to RGB. Conversion formula
61
- * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
62
- *
63
- * @param {number} h The hue [0, 360]
64
- * @param {number} s The saturation [0, 1]
65
- * @param {number} l The lightness [0, 1]
66
- * @return {Array} The RGB representation [0, 255]
67
- */
68
- static hslaToRgba(t, n, e, r) {
69
- t /= 360, n /= 100, e /= 100;
70
- let s, a, i;
71
- if (n === 0)
72
- s = a = i = e;
73
- else {
74
- const c = function(m, T, u) {
75
- return u < 0 && (u += 1), u > 1 && (u -= 1), u < 0.16666666666666666 ? m + (T - m) * 6 * u : u < 0.5 ? T : u < 0.6666666666666666 ? m + (T - m) * (0.6666666666666666 - u) * 6 : m;
76
- }, h = e < 0.5 ? e * (1 + n) : e + n - e * n, g = 2 * e - h;
77
- s = c(g, h, t + 1 / 3), a = c(g, h, t), i = c(g, h, t - 1 / 3);
78
- }
79
- return [s, a, i, r].map((c) => Math.round(c * 255));
80
- }
81
- static hslaStringToRgba(t) {
82
- const n = t.slice(5, -1).split(", "), e = Number(n.pop()), r = n.map((s) => s.endsWith("%") ? +s.slice(0, -1) : +s);
83
- return o.hslaToRgba(r[0], r[1], r[2], e);
84
- }
85
- static hexaToRgba(t) {
86
- const n = [], e = t[0] === "#" ? 1 : 0;
87
- if (t.length === 5 + e && (t = (e ? "#" : "") + "0" + t.slice(e)), t.length === 3 + e)
88
- for (let r = e; r < t.length; ++r)
89
- n.push(parseInt(t[r] + t[r], 16));
90
- else if (t.length === 4 + e) {
91
- for (let r = e; r < t.length - 1; ++r)
92
- n.push(parseInt(t[r] + t[r], 16));
93
- n.push(parseInt(t[t.length - 1], 16));
94
- } else
95
- for (let r = e; r < t.length; r += 2)
96
- n.push(parseInt(t.slice(r, r + 2), 16));
97
- return n;
98
- }
99
- static hexToRgb(t) {
100
- return o.hexaToRgba(t.slice(0, 7));
101
- }
102
- static hexaToHsla(t) {
103
- const n = o.hexaToRgba(t);
104
- return o.rgbaToHsla(n[0], n[1], n[2], n[3]);
105
- }
106
- static rgbaToHexa(t) {
107
- const n = [...t], e = n.pop(), r = Math.round(Math.min(Math.max(e ?? 1, 0), 1) * 255);
108
- return "#" + n.map((s) => ("0" + s.toString(16)).slice(-2)).join("") + r.toString(16);
109
- }
110
- static hslaStringToHexa(t) {
111
- return o.rgbaToHexa(o.hslaStringToRgba(t));
112
- }
113
- static hslaStringToHex(t) {
114
- return o.hslaStringToHexa(t).slice(0, -2);
115
- }
116
- /**
117
- * @param weight [0, 1]
118
- */
119
- static mixColors(t, n, e) {
120
- const r = new Array(3);
121
- for (let s = 0; s < 3; ++s) {
122
- const a = t[s], i = n[s];
123
- r[s] = Math.floor(i + (a - i) * e);
124
- }
125
- return r;
126
- }
127
- static getRgbByTypeBrightness(t) {
128
- return {
129
- BT601: [0.299, 0.587, 0.114],
130
- BT709: [0.2126, 0.7152, 0.0722],
131
- BT2020: [0.2627, 0.678, 0.0593]
132
- }[t];
133
- }
134
- static computePerceivedBrightness(t, n = "BT709") {
135
- const e = o.getRgbByTypeBrightness(n);
136
- return (t[0] * e[n][0] + t[1] * e[n][1] + t[2] * e[n][2]) / 255;
137
- }
138
- static getAverageColor(t, n) {
139
- return t.map((e, r) => Math.round((e + n[r]) / 2));
140
- }
141
- static getAccentColor(t, n, e) {
142
- const r = o.rgbToHsv(...n), s = o.rgbToHsv(...e), a = Math.min(1.5 * r[1] / t[1], 1);
143
- return r[0] = Math.min(360, s[0] - r[0] + t[0]), r[1] = Math.min(1, s[1] * t[1] / r[1]), r[2] = Math.min(1, (s[2] / r[2] + a - 1) * t[2] / a), r[2] < 0.3 ? e : o.hsvToRgb(...r);
144
- }
145
- static changeColorAccent(t, n, e, r) {
146
- const s = o.rgbToHsv(...e);
147
- if (Math.min(Math.abs(s[0] - t[0]), Math.abs(s[0] - t[0] - 360)) > 30)
148
- return e;
149
- const i = t[1] ? Math.min(1.5 * s[1] / t[1], 1) : 0;
150
- s[0] = Math.min(360, s[0] + n[0] - t[0]), s[1] = t[1] ? Math.min(1, s[1] * n[1] / t[1]) : 0, s[2] = t[2] ? Math.min(1, s[2] * (1 - i + i * n[2] / t[2])) : 0;
151
- let c = o.hsvToRgb(...s);
152
- const h = o.computePerceivedBrightness(e), g = o.computePerceivedBrightness(c);
153
- if (r ? h > g : h < g) {
154
- const T = 0.4 * h / g + 0.6;
155
- c = o.changeBrightness(c, T);
156
- }
157
- return c;
158
- }
159
- static changeBrightness(t, n) {
160
- return t.map((e) => o.clamp(Math.round(e * n), 0, 255));
161
- }
162
- static hexBrightness(t, n) {
163
- const e = o.hexToRgb(t), r = o.changeBrightness(e, n), [s, a, i] = r;
164
- return o.rgbToHex(s, a, i);
165
- }
166
- static getHexColorFromTelegramColor(t) {
167
- const n = (t < 0 ? 16777215 + t : t).toString(16);
168
- return "#" + (n.length >= 6 ? n : "0".repeat(6 - n.length) + n);
169
- }
170
- static getRgbColorFromTelegramColor(t) {
171
- return o.hexToRgb(o.getHexColorFromTelegramColor(t));
172
- }
173
- static getColorsFromWallPaper(t) {
174
- return t.settings ? [
175
- t.settings.background_color,
176
- t.settings.second_background_color,
177
- t.settings.third_background_color,
178
- t.settings.fourth_background_color
179
- ].filter(Boolean).map(o.getHexColorFromTelegramColor).join(",") : "";
180
- }
181
- static rgbaToRgb(t, n) {
182
- const e = t[3];
183
- return t.slice(0, 3).map((r, s) => o.clamp(Math.round((e * (r / 255) + e * (n[s] / 255)) * 255), 0, 255));
184
- }
185
- static calculateLuminance(t, n = "BT709") {
186
- const [e, r, s] = t, a = o.getRgbByTypeBrightness(n);
187
- return a[0] * e / 255 + a[1] * r / 255 + a[2] * s / 255;
188
- }
189
- static getTextColor(t) {
190
- return t > 0.5 ? [0, 0, 0] : [255, 255, 255];
191
- }
192
- static calculateOpacity(t, n) {
193
- const e = t > 0.5 ? 0 : 1, r = (t - e + n) / n;
194
- return +Math.max(0.5, Math.min(0.64, r)).toFixed(2);
195
- }
196
- static clamp(t, n, e) {
197
- return Math.min(e, Math.max(n, t));
198
- }
1
+ var b = Object.defineProperty;
2
+ var x = (p, t, n) => t in p ? b(p, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[t] = n;
3
+ var c = (p, t, n) => (x(p, typeof t != "symbol" ? t + "" : t, n), n);
4
+ const a = class a {
199
5
  };
200
6
  /*Проверить свои методы и возможно исключить т.к. функционал возможно повторяется */
201
- p(o, "componentToHex", (t) => {
202
- var n = t.toString(16);
7
+ c(a, "componentToHex", (t) => {
8
+ const n = t.toString(16);
203
9
  return n.length == 1 ? "0" + n : n;
204
- }), p(o, "getNumberRGB", (t) => {
205
- let n = t.match(/\d+/gi);
206
- return n != null && n.length ? n.map((e) => Number(e)) : n || [255, 255, 255];
207
- }), p(o, "rgbToHex", (t, n, e) => "#" + o.componentToHex(t) + o.componentToHex(n) + o.componentToHex(e));
208
- let f = o;
10
+ }), // static getNumberRGB = (getComputedStyleRGB) => {
11
+ // const arrSTRNumber = getComputedStyleRGB.match(/\d+/gi);
12
+ // if (arrSTRNumber?.length) {
13
+ // return arrSTRNumber.map((i) => Number(i));
14
+ // }
15
+ // return arrSTRNumber ? arrSTRNumber : [255, 255, 255];
16
+ // };
17
+ c(a, "rgbToHex", (t, n, e) => "#" + a.componentToHex(t) + a.componentToHex(n) + a.componentToHex(e)), /**
18
+ * https://stackoverflow.com/a/54070620/6758968
19
+ * r, g, b in [0, 255]
20
+ * @returns h in [0,360) and s, v in [0,1]
21
+ */
22
+ c(a, "rgbToHsv", (t, n, e) => {
23
+ t /= 255, n /= 255, e /= 255;
24
+ const s = Math.max(t, n, e), r = s - Math.min(t, n, e), i = r && (s === t ? (n - e) / r : s == n ? 2 + (e - t) / r : 4 + (t - n) / r);
25
+ return [60 * (i < 0 ? i + 6 : i), s && r / s, s];
26
+ }), /**
27
+ * https://stackoverflow.com/a/54024653/6758968
28
+ * @param h [0, 360]
29
+ * @param s [0, 1]
30
+ * @param v [0, 1]
31
+ * @returns r, g, b in [0, 255]
32
+ */
33
+ c(a, "hsvToRgb", (t, n, e) => {
34
+ const s = (r, i = (r + t / 60) % 6) => Math.round((e - e * n * Math.max(Math.min(i, 4 - i, 1), 0)) * 255);
35
+ return [s(5), s(3), s(1)];
36
+ }), /**
37
+ * @returns h [0, 360], s [0, 100], l [0, 100], a [0, 1]
38
+ */
39
+ c(a, "rgbaToHsla", (t, n, e, s = 1) => {
40
+ t /= 255, n /= 255, e /= 255;
41
+ const r = Math.max(t, n, e), i = Math.min(t, n, e);
42
+ let h = 0, o;
43
+ const u = (r + i) / 2;
44
+ if (r === i)
45
+ h = o = 0;
46
+ else {
47
+ const g = r - i;
48
+ switch (o = u > 0.5 ? g / (2 - r - i) : g / (r + i), r) {
49
+ case t:
50
+ h = (n - e) / g + (n < e ? 6 : 0);
51
+ break;
52
+ case n:
53
+ h = (e - t) / g + 2;
54
+ break;
55
+ case e:
56
+ h = (t - n) / g + 4;
57
+ break;
58
+ }
59
+ h /= 6;
60
+ }
61
+ return {
62
+ h: h * 360,
63
+ s: o * 100,
64
+ l: u * 100,
65
+ a: s
66
+ };
67
+ }), // * https://stackoverflow.com/a/9493060/6758968
68
+ /**
69
+ * Converts an HSL color value to RGB. Conversion formula
70
+ * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
71
+ *
72
+ * @param {number} h The hue [0, 360]
73
+ * @param {number} s The saturation [0, 1]
74
+ * @param {number} l The lightness [0, 1]
75
+ * @return {Array} The RGB representation [0, 255]
76
+ */
77
+ c(a, "hslaToRgba", (t, n, e, s) => {
78
+ t /= 360, n /= 100, e /= 100;
79
+ let r, i, h;
80
+ if (n === 0)
81
+ r = i = h = e;
82
+ else {
83
+ const o = function(T, l, m) {
84
+ return m < 0 && (m += 1), m > 1 && (m -= 1), m < 0.16666666666666666 ? T + (l - T) * 6 * m : m < 0.5 ? l : m < 0.6666666666666666 ? T + (l - T) * (0.6666666666666666 - m) * 6 : T;
85
+ }, u = e < 0.5 ? e * (1 + n) : e + n - e * n, g = 2 * e - u;
86
+ r = o(g, u, t + 1 / 3), i = o(g, u, t), h = o(g, u, t - 1 / 3);
87
+ }
88
+ return [r, i, h, s].map((o) => Math.round(o * 255));
89
+ }), c(a, "hslaStringToRgba", (t) => {
90
+ const n = t.slice(5, -1).split(", "), e = Number(n.pop()), s = n.map((r) => r.endsWith("%") ? +r.slice(0, -1) : +r);
91
+ return a.hslaToRgba(s[0], s[1], s[2], e);
92
+ }), c(a, "hexaToRgba", (t) => {
93
+ const n = [], e = t[0] === "#" ? 1 : 0;
94
+ if (t.length === 5 + e && (t = (e ? "#" : "") + "0" + t.slice(e)), t.length === 3 + e)
95
+ for (let s = e; s < t.length; ++s)
96
+ n.push(parseInt(t[s] + t[s], 16));
97
+ else if (t.length === 4 + e) {
98
+ for (let s = e; s < t.length - 1; ++s)
99
+ n.push(parseInt(t[s] + t[s], 16));
100
+ n.push(parseInt(t[t.length - 1], 16));
101
+ } else
102
+ for (let s = e; s < t.length; s += 2)
103
+ n.push(parseInt(t.slice(s, s + 2), 16));
104
+ return n;
105
+ }), c(a, "hexaToHsla", (t) => {
106
+ const n = a.hexaToRgba(t);
107
+ return a.rgbaToHsla(n[0], n[1], n[2], n[3]);
108
+ }), c(a, "hexToRgb", (t) => a.hexaToRgba(t.slice(0, 7))), c(a, "rgbaToHexa", (t) => {
109
+ const n = [...t], e = n.pop(), s = Math.round(Math.min(Math.max(e ?? 1, 0), 1) * 255);
110
+ return "#" + n.map((r) => ("0" + r.toString(16)).slice(-2)).join("") + s.toString(16);
111
+ }), c(a, "hslaStringToHexa", (t) => a.rgbaToHexa(a.hslaStringToRgba(t))), c(a, "hslaStringToHex", (t) => a.hslaStringToHexa(t).slice(0, -2)), /**
112
+ * @param weight [0, 1]
113
+ */
114
+ c(a, "mixColors", (t, n, e) => {
115
+ const s = new Array(3);
116
+ for (let r = 0; r < 3; ++r) {
117
+ const i = t[r], h = n[r];
118
+ s[r] = Math.floor(h + (i - h) * e);
119
+ }
120
+ return s;
121
+ }), c(a, "getRgbByTypeBrightness", (t) => ({
122
+ BT601: [0.299, 0.587, 0.114],
123
+ BT709: [0.2126, 0.7152, 0.0722],
124
+ BT2020: [0.2627, 0.678, 0.0593]
125
+ })[t]), c(a, "getAverageColor", (t, n) => t.map((e, s) => Math.round((e + n[s]) / 2))), c(a, "getAccentColor", (t, n, e) => {
126
+ const s = a.rgbToHsv(...n), r = a.rgbToHsv(...e), i = Math.min(1.5 * s[1] / t[1], 1);
127
+ return s[0] = Math.min(360, r[0] - s[0] + t[0]), s[1] = Math.min(1, r[1] * t[1] / s[1]), s[2] = Math.min(1, (r[2] / s[2] + i - 1) * t[2] / i), s[2] < 0.3 ? e : a.hsvToRgb(...s);
128
+ }), c(a, "changeColorAccent", (t, n, e, s) => {
129
+ const r = a.rgbToHsv(...e);
130
+ if (Math.min(Math.abs(r[0] - t[0]), Math.abs(r[0] - t[0] - 360)) > 30)
131
+ return e;
132
+ const h = t[1] ? Math.min(1.5 * r[1] / t[1], 1) : 0;
133
+ r[0] = Math.min(360, r[0] + n[0] - t[0]), r[1] = t[1] ? Math.min(1, r[1] * n[1] / t[1]) : 0, r[2] = t[2] ? Math.min(1, r[2] * (1 - h + h * n[2] / t[2])) : 0;
134
+ let o = a.hsvToRgb(...r);
135
+ const u = a.calculateBrightness(e), g = a.calculateBrightness(o);
136
+ if (s ? u > g : u < g) {
137
+ const l = 0.4 * u / g + 0.6;
138
+ o = a.changeBrightness(o, l);
139
+ }
140
+ return o;
141
+ }), c(a, "changeBrightness", (t, n) => t.map((e) => a.clamp(Math.round(e * n), 0, 255))), c(a, "hexBrightness", (t, n) => {
142
+ const e = a.hexToRgb(t), s = a.changeBrightness(e, n), [r, i, h] = s;
143
+ return a.rgbToHex(r, i, h);
144
+ }), c(a, "getHexColorFromTelegramColor", (t) => {
145
+ const n = (t < 0 ? 16777215 + t : t).toString(16);
146
+ return "#" + (n.length >= 6 ? n : "0".repeat(6 - n.length) + n);
147
+ }), c(a, "getRgbColorFromTelegramColor", (t) => a.hexToRgb(a.getHexColorFromTelegramColor(t))), // static getColorsFromWallPaper(wallPaper) {
148
+ // return wallPaper.settings
149
+ // ? [
150
+ // wallPaper.settings.background_color,
151
+ // wallPaper.settings.second_background_color,
152
+ // wallPaper.settings.third_background_color,
153
+ // wallPaper.settings.fourth_background_color,
154
+ // ]
155
+ // .filter(Boolean)
156
+ // .map(Color.getHexColorFromTelegramColor)
157
+ // .join(",")
158
+ // : "";
159
+ // }
160
+ c(a, "rgbaToRgb", (t, n) => {
161
+ const e = t[3];
162
+ return t.slice(0, 3).map((s, r) => a.clamp(Math.round((e * (s / 255) + e * (n[r] / 255)) * 255), 0, 255));
163
+ }), c(a, "calculateBrightness", (t, n = "BT709") => {
164
+ const [e, s, r] = t, i = a.getRgbByTypeBrightness(n);
165
+ return i[0] * e / 255 + i[1] * s / 255 + i[2] * r / 255;
166
+ }), c(a, "getTextColor", (t) => t > 0.5 ? [0, 0, 0] : [255, 255, 255]), c(a, "calculateOpacity", (t, n) => {
167
+ const e = t > 0.5 ? 0 : 1, s = (t - e + n) / n;
168
+ return +Math.max(0.5, Math.min(0.64, s)).toFixed(2);
169
+ }), c(a, "clamp", (t, n, e) => Math.min(e, Math.max(n, t)));
170
+ let f = a;
209
171
  export {
210
172
  f as Color
211
173
  };
@@ -0,0 +1,36 @@
1
+ export type ColorRgb = [number, number, number];
2
+ export interface Color_P {
3
+ ColorRgb: ColorRgb;
4
+ ColorRgba: [...ColorRgb, number];
5
+ ColorHsla: Record<"h" | "s" | "l" | "a", number>;
6
+ TypeBrightness_OR: "BT601" | "BT709" | "BT2020";
7
+ }
8
+ export interface ColorProps {
9
+ componentToHex: (c: number) => string;
10
+ rgbToHex(r: number, g: number, b: number): string;
11
+ rgbToHsv(r: number, g: number, b: number): Color_P['ColorRgb'];
12
+ hsvToRgb(h: number, s: number, v: number): Color_P['ColorRgb'];
13
+ rgbaToHsla(r: number, g: number, b: number, a: number): Color_P['ColorHsla'];
14
+ hslaToRgba(h: number, s: number, l: number, a: number): Color_P['ColorRgba'];
15
+ hslaStringToRgba(hsla: string): Color_P['ColorRgba'];
16
+ hexaToRgba(hexa: string): Color_P['ColorRgba'];
17
+ hexToRgb(hex: string): Color_P['ColorRgb'];
18
+ hexaToHsla(hexa: string): Color_P['ColorHsla'];
19
+ rgbaToHexa(rgba: Color_P['ColorRgba'] | Color_P['ColorRgb']): string;
20
+ hslaStringToHexa(hsla: string): string;
21
+ hslaStringToHex(hsla: string): string;
22
+ mixColors(color1: Color_P['ColorRgb'], color2: Color_P['ColorRgb'], weight: number): Color_P['ColorRgb'];
23
+ getRgbByTypeBrightness(type: Color_P['TypeBrightness_OR']): Color_P['ColorRgb'];
24
+ getAverageColor(color1: Color_P['ColorRgb'], color2: Color_P['ColorRgb']): Color_P['ColorRgb'];
25
+ getAccentColor(baseHsv: number[], baseColor: Color_P['ColorRgb'], elementColor: Color_P['ColorRgb']): Color_P['ColorRgb'];
26
+ changeColorAccent(baseHsv: number[], accentHsv: number[], color: Color_P['ColorRgb'], isDarkTheme: boolean): Color_P['ColorRgb'];
27
+ changeBrightness(color: Color_P['ColorRgb'], amount: number): Color_P['ColorRgb'];
28
+ hexBrightness(hex: string, amount: number): string;
29
+ getHexColorFromTelegramColor(color: number): string;
30
+ getRgbColorFromTelegramColor(color: number): Color_P['ColorRgb'];
31
+ rgbaToRgb(rgba: Color_P['ColorRgba'], bg: Color_P['ColorRgb']): Color_P['ColorRgb'];
32
+ calculateBrightness(rgb: Color_P['ColorRgb'], type?: Color_P['TypeBrightness_OR']): number;
33
+ getTextColor(luminance: number): Color_P['ColorRgb'];
34
+ calculateOpacity(luminance: number, targetContrast: number): number;
35
+ clamp(v: number, min: number, max: number): number;
36
+ }
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,2 @@
1
+ export * from './Color';
2
+ export type { ColorProps } from './Color.types';
@@ -0,0 +1,4 @@
1
+ import { Color as e } from "./Color.js";
2
+ export {
3
+ e as Color
4
+ };
@@ -1,87 +1,39 @@
1
- declare const itemsMonths: readonly ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
2
- declare const itemsWeek: readonly ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"];
3
- export interface DateProcessingI {
4
- getActiveColorClassInDiffDate(a: string, b: string, c: string): string;
5
- getClassByDifferenceDay(a: string, b: {
6
- className: string;
7
- diffDay: number;
8
- }[]): string;
9
- getMinMaxDate(a: string, b: string, c: string): Record<'minDate' | 'maxDate' | 'minMaxMonth', string>;
10
- splitDateFromTime(a: string): string[];
11
- getCorrectDateAndTime(a: string): [string, string];
12
- reverseDate(a: string): string;
13
- correctionDataISO8601(a: string): string;
14
- isDateDMY(a: string): boolean;
15
- correctionDateAndRemoveYear(a: string, b?: Partial<{
16
- isYear: boolean;
17
- }>): string;
18
- correctionDateWithOutCurrentYear(a: string, b?: Partial<{
19
- shortYear: boolean;
20
- }>): string;
21
- correctionShortYear(a: string): string;
22
- correctionDate(a: string, b?: Partial<Record<'isRemoveYear' | 'shortYear' | 'withOutCurrentYear', boolean>>): string;
23
- hasDateLessPeriod(a: string, b: string, c?: {
24
- dateMinMax: '<=' | '>=' | '<' | '>';
25
- }): boolean;
26
- hasDateLessPeriods(a: string, b: string, c: string, d?: {
27
- dateMinMax: '<=' | '>=' | '<' | '>';
28
- }): Record<'one' | 'two', boolean>;
29
- getDi(a: string, b: string): number;
30
- getDifferenceDates(a: string, b: string): number;
31
- hasDateLessInNumber(a: string, b: string, c: number): boolean;
32
- correctionCurrentYear(a: [string], b?: number): string[];
33
- getChunkFromDate(a: string, b: 'day' | 'month' | 'year', c?: {
34
- isBeforeZero: boolean;
35
- }): string;
36
- getNameMonthByNumber(a: number): (typeof itemsMonths)[number];
37
- minMaxMountStr(a: Record<'minDate' | 'maxDate', string>): {
38
- minMaxMonth: string;
39
- };
40
- getDatesToCurrentDate(a: string[]): string[];
41
- getDayOfWeek(a: string): (typeof itemsWeek)[number] | null;
42
- cropSecond(a: string): string;
43
- getRenderDate(a: string, b?: {
44
- withOutCurrentYear: boolean;
45
- }): 'Сегодня' | 'Вчера' | 'Позавчера' | string;
46
- getCurrentDate(): string;
47
- getDaysInMonth(a: number, b: number): number;
48
- getCurrentYear(): number;
49
- }
1
+ import { DateProcessingProps } from './DateProcessing.types';
2
+
50
3
  export declare class DateProcessing {
51
- static getActiveColorClassInDiffDate: DateProcessingI['getActiveColorClassInDiffDate'];
52
- static getClassByDifferenceDay: DateProcessingI['getClassByDifferenceDay'];
53
- static getMinMaxDate: DateProcessingI['getMinMaxDate'];
54
- static splitDateFromTime: DateProcessingI['splitDateFromTime'];
55
- static getCorrectDateAndTime: DateProcessingI['getCorrectDateAndTime'];
56
- static reverseDate: DateProcessingI['reverseDate'];
57
- static correctionDataISO8601: DateProcessingI['correctionDataISO8601'];
58
- static isDateDMY: DateProcessingI['isDateDMY'];
4
+ static getActiveColorClassInDiffDate: DateProcessingProps['getActiveColorClassInDiffDate'];
5
+ static getClassByDifferenceDay: DateProcessingProps['getClassByDifferenceDay'];
6
+ static getMinMaxDate: DateProcessingProps['getMinMaxDate'];
7
+ static splitDateFromTime: DateProcessingProps['splitDateFromTime'];
8
+ static getCorrectDateAndTime: DateProcessingProps['getCorrectDateAndTime'];
9
+ static reverseDate: DateProcessingProps['reverseDate'];
10
+ static correctionDataISO8601: DateProcessingProps['correctionDataISO8601'];
11
+ static isDateDMY: DateProcessingProps['isDateDMY'];
59
12
  static isDateISO8601: (date: string) => boolean;
60
- static correctionDateAndRemoveYear: DateProcessingI['correctionDateAndRemoveYear'];
61
- static correctionDateWithOutCurrentYear: DateProcessingI['correctionDateWithOutCurrentYear'];
62
- static correctionShortYear: DateProcessingI['correctionShortYear'];
63
- static correctionDate: DateProcessingI['correctionDate'];
64
- static hasDateLessPeriod: DateProcessingI['hasDateLessPeriod'];
65
- static hasDateLessPeriods: DateProcessingI['hasDateLessPeriods'];
66
- static getDifferenceDates: DateProcessingI['getDifferenceDates'];
67
- static hasDateLessInNumber: DateProcessingI['hasDateLessInNumber'];
68
- static correctionCurrentYear: DateProcessingI['correctionCurrentYear'];
69
- static getChunkFromDate: DateProcessingI['getChunkFromDate'];
70
- static getNameMonthByNumber: DateProcessingI['getNameMonthByNumber'];
71
- static minMaxMountStr: DateProcessingI['minMaxMountStr'];
72
- static getDatesToCurrentDate: DateProcessingI['getDatesToCurrentDate'];
73
- static getDayOfWeek: DateProcessingI['getDayOfWeek'];
74
- static cropSecond: DateProcessingI['cropSecond'];
75
- static getRenderDate: DateProcessingI['getRenderDate'];
76
- static getCurrentDate: DateProcessingI['getCurrentDate'];
77
- static getCurrentYear: DateProcessingI['getCurrentYear'];
78
- static getDaysInMonth: DateProcessingI['getDaysInMonth'];
13
+ static correctionDateAndRemoveYear: DateProcessingProps['correctionDateAndRemoveYear'];
14
+ static correctionDateWithOutCurrentYear: DateProcessingProps['correctionDateWithOutCurrentYear'];
15
+ static correctionShortYear: DateProcessingProps['correctionShortYear'];
16
+ static correctionDate: DateProcessingProps['correctionDate'];
17
+ static hasDateLessPeriod: DateProcessingProps['hasDateLessPeriod'];
18
+ static hasDateLessPeriods: DateProcessingProps['hasDateLessPeriods'];
19
+ static getDifferenceDates: DateProcessingProps['getDifferenceDates'];
20
+ static hasDateLessInNumber: DateProcessingProps['hasDateLessInNumber'];
21
+ static correctionCurrentYear: DateProcessingProps['correctionCurrentYear'];
22
+ static getChunkFromDate: DateProcessingProps['getChunkFromDate'];
23
+ static getNameMonthByNumber: DateProcessingProps['getNameMonthByNumber'];
24
+ static minMaxMountStr: DateProcessingProps['minMaxMountStr'];
25
+ static getDatesToCurrentDate: DateProcessingProps['getDatesToCurrentDate'];
26
+ static getDayOfWeek: DateProcessingProps['getDayOfWeek'];
27
+ static cropSecond: DateProcessingProps['cropSecond'];
28
+ static getRenderDate: DateProcessingProps['getRenderDate'];
29
+ static getCurrentDate: DateProcessingProps['getCurrentDate'];
30
+ static getCurrentYear: DateProcessingProps['getCurrentYear'];
31
+ static getDaysInMonth: DateProcessingProps['getDaysInMonth'];
79
32
  /**
80
33
  *
81
34
  * @param date example: '2022-01-01'
82
35
  * @param config example: {day: 1, month: 1, year: 1}
83
36
  * @returns example: '2023-02-02'
84
37
  */
85
- static getDateDeviation: (date: string, config: Partial<Record<"day" | "month" | "year", number>>) => string;
38
+ static getDateDeviation: DateProcessingProps['getDateDeviation'];
86
39
  }
87
- export {};
@@ -1,7 +1,8 @@
1
1
  var o = Object.defineProperty;
2
2
  var D = (e, t, r) => t in e ? o(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var a = (e, t, r) => (D(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- const itemsMonths = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], itemsWeek = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"], _DateProcessing = class _DateProcessing {
4
+ import { itemsMonths, itemsWeek } from "./DateProcessing.types.js";
5
+ const _DateProcessing = class _DateProcessing {
5
6
  };
6
7
  a(_DateProcessing, "getActiveColorClassInDiffDate", (e, t, r) => {
7
8
  let s = "";
@@ -0,0 +1,50 @@
1
+ export declare const itemsMonths: readonly ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"];
2
+ export declare const itemsWeek: readonly ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"];
3
+ export interface DateProcessingProps {
4
+ getActiveColorClassInDiffDate(a: string, b: string, c: string): string;
5
+ getClassByDifferenceDay(a: string, b: {
6
+ className: string;
7
+ diffDay: number;
8
+ }[]): string;
9
+ getMinMaxDate(a: string, b: string, c: string): Record<'minDate' | 'maxDate' | 'minMaxMonth', string>;
10
+ splitDateFromTime(a: string): string[];
11
+ getCorrectDateAndTime(a: string): [string, string];
12
+ reverseDate(a: string): string;
13
+ correctionDataISO8601(a: string): string;
14
+ isDateDMY(a: string): boolean;
15
+ correctionDateAndRemoveYear(a: string, b?: Partial<{
16
+ isYear: boolean;
17
+ }>): string;
18
+ correctionDateWithOutCurrentYear(a: string, b?: Partial<{
19
+ shortYear: boolean;
20
+ }>): string;
21
+ correctionShortYear(a: string): string;
22
+ correctionDate(a: string, b?: Partial<Record<'isRemoveYear' | 'shortYear' | 'withOutCurrentYear', boolean>>): string;
23
+ hasDateLessPeriod(a: string, b: string, c?: {
24
+ dateMinMax: '<=' | '>=' | '<' | '>';
25
+ }): boolean;
26
+ hasDateLessPeriods(a: string, b: string, c: string, d?: {
27
+ dateMinMax: '<=' | '>=' | '<' | '>';
28
+ }): Record<'one' | 'two', boolean>;
29
+ getDi(a: string, b: string): number;
30
+ getDifferenceDates(a: string, b: string): number;
31
+ hasDateLessInNumber(a: string, b: string, c: number): boolean;
32
+ correctionCurrentYear(a: [string], b?: number): string[];
33
+ getChunkFromDate(a: string, b: 'day' | 'month' | 'year', c?: {
34
+ isBeforeZero: boolean;
35
+ }): string;
36
+ getNameMonthByNumber(a: number): (typeof itemsMonths)[number];
37
+ minMaxMountStr(a: Record<'minDate' | 'maxDate', string>): {
38
+ minMaxMonth: string;
39
+ };
40
+ getDatesToCurrentDate(a: string[]): string[];
41
+ getDayOfWeek(a: string): (typeof itemsWeek)[number] | null;
42
+ cropSecond(a: string): string;
43
+ getRenderDate(a: string, b?: {
44
+ withOutCurrentYear: boolean;
45
+ }): 'Сегодня' | 'Вчера' | 'Позавчера' | string;
46
+ getCurrentDate(): string;
47
+ getDaysInMonth(a: number, b: number): number;
48
+ getCurrentYear(): number;
49
+ getDateDeviation(date: string, config: Partial<Record<"day" | "month" | "year", number>>): string;
50
+ }
@@ -0,0 +1,5 @@
1
+ const t = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"], e = ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"];
2
+ export {
3
+ t as itemsMonths,
4
+ e as itemsWeek
5
+ };
@@ -0,0 +1,2 @@
1
+ export * from './DateProcessing';
2
+ export type { DateProcessingProps } from './DateProcessing.types';
@@ -0,0 +1,4 @@
1
+ import { DateProcessing as r } from "./DateProcessing.js";
2
+ export {
3
+ r as DateProcessing
4
+ };
@@ -0,0 +1,8 @@
1
+ import { DelaysPromiseProps } from './DelaysPromise.types';
2
+
3
+ export declare class DelaysPromise {
4
+ private defaultProps;
5
+ startActionEvery: DelaysPromiseProps['startActionEvery'];
6
+ oneOf: DelaysPromiseProps['oneOf'];
7
+ oneOfPromise: DelaysPromiseProps['oneOfPromise'];
8
+ }