@vorplex/core 0.0.4 → 0.0.9

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 (187) hide show
  1. package/dist/consts/mime-type.const.d.ts +456 -0
  2. package/dist/consts/mime-type.const.js +456 -0
  3. package/dist/consts/unit.const.d.ts +22 -0
  4. package/dist/consts/unit.const.js +22 -0
  5. package/dist/functions/debounce.function.d.ts +1 -0
  6. package/dist/functions/debounce.function.js +12 -0
  7. package/dist/functions/is-node-environment.function.d.ts +1 -0
  8. package/dist/functions/is-node-environment.function.js +3 -0
  9. package/dist/functions/parse-path-selector.function.d.ts +2 -0
  10. package/dist/functions/parse-path-selector.function.js +17 -0
  11. package/dist/functions/parse-url.function.d.ts +12 -0
  12. package/dist/functions/parse-url.function.js +25 -0
  13. package/dist/index.d.ts +92 -0
  14. package/dist/index.js +93 -0
  15. package/dist/interfaces/group.interface.d.ts +4 -0
  16. package/dist/interfaces/group.interface.js +0 -0
  17. package/dist/interfaces/key-value.interface.d.ts +4 -0
  18. package/dist/interfaces/key-value.interface.js +0 -0
  19. package/dist/modules/api/socket.model.d.ts +26 -0
  20. package/dist/modules/api/socket.model.js +66 -0
  21. package/dist/modules/api/web-client.model.d.ts +16 -0
  22. package/dist/modules/api/web-client.model.js +34 -0
  23. package/dist/modules/array/array.util.d.ts +17 -0
  24. package/dist/modules/array/array.util.js +105 -0
  25. package/dist/modules/changes/changes.util.d.ts +45 -0
  26. package/dist/modules/changes/changes.util.js +330 -0
  27. package/dist/modules/color/color-data.interface.d.ts +10 -0
  28. package/dist/modules/color/color-data.interface.js +0 -0
  29. package/dist/modules/color/color-formats.const.d.ts +9 -0
  30. package/dist/modules/color/color-formats.const.js +8 -0
  31. package/dist/modules/color/color.type.d.ts +4 -0
  32. package/dist/modules/color/color.type.js +0 -0
  33. package/dist/modules/color/color.util.d.ts +41 -0
  34. package/dist/modules/color/color.util.js +327 -0
  35. package/dist/modules/color/colors.const.d.ts +151 -0
  36. package/dist/modules/color/colors.const.js +150 -0
  37. package/dist/modules/color/hsl.interface.d.ts +6 -0
  38. package/dist/modules/color/hsl.interface.js +0 -0
  39. package/dist/modules/color/hsv.interface.d.ts +6 -0
  40. package/dist/modules/color/hsv.interface.js +0 -0
  41. package/dist/modules/color/rgb.interface.d.ts +6 -0
  42. package/dist/modules/color/rgb.interface.js +0 -0
  43. package/dist/modules/compression/compression.util.d.ts +4 -0
  44. package/dist/modules/compression/compression.util.js +52 -0
  45. package/dist/modules/date/date.util.d.ts +37 -0
  46. package/dist/modules/date/date.util.js +84 -0
  47. package/dist/modules/enum/enum.util.d.ts +17 -0
  48. package/dist/modules/enum/enum.util.js +69 -0
  49. package/dist/modules/hash/hash.util.d.ts +3 -0
  50. package/dist/modules/hash/hash.util.js +9 -0
  51. package/dist/modules/id/id.util.d.ts +7 -0
  52. package/dist/modules/id/id.util.js +33 -0
  53. package/dist/modules/injector/decorators/inject-token.decorator.d.ts +14 -0
  54. package/dist/modules/injector/decorators/inject-token.decorator.js +12 -0
  55. package/dist/modules/injector/decorators/injectable.decorator.d.ts +9 -0
  56. package/dist/modules/injector/decorators/injectable.decorator.js +7 -0
  57. package/dist/modules/injector/injector.model.d.ts +25 -0
  58. package/dist/modules/injector/injector.model.js +152 -0
  59. package/dist/modules/injector/provider-scopes.enum.d.ts +5 -0
  60. package/dist/modules/injector/provider-scopes.enum.js +6 -0
  61. package/dist/modules/injector/provider.interface.d.ts +10 -0
  62. package/dist/modules/injector/provider.interface.js +0 -0
  63. package/dist/modules/json-filter/json-filter.function.d.ts +41 -0
  64. package/dist/modules/json-filter/json-filter.function.js +75 -0
  65. package/dist/modules/logging/console-logger.model.d.ts +36 -0
  66. package/dist/modules/logging/console-logger.model.js +44 -0
  67. package/dist/modules/logging/logger.model.d.ts +6 -0
  68. package/dist/modules/logging/logger.model.js +7 -0
  69. package/dist/modules/logging/task.d.ts +38 -0
  70. package/dist/modules/logging/task.js +133 -0
  71. package/dist/modules/math/line.d.ts +12 -0
  72. package/dist/modules/math/line.js +50 -0
  73. package/dist/modules/math/point.d.ts +34 -0
  74. package/dist/modules/math/point.js +71 -0
  75. package/dist/modules/math/polygon.d.ts +45 -0
  76. package/dist/modules/math/polygon.js +273 -0
  77. package/dist/modules/math/rect.d.ts +6 -0
  78. package/dist/modules/math/rect.js +0 -0
  79. package/dist/modules/math/size.d.ts +4 -0
  80. package/dist/modules/math/size.js +0 -0
  81. package/dist/modules/number/number.util.d.ts +9 -0
  82. package/dist/modules/number/number.util.js +27 -0
  83. package/dist/modules/object/object.util.d.ts +7 -0
  84. package/dist/modules/object/object.util.js +63 -0
  85. package/dist/modules/path/path.util.d.ts +11 -0
  86. package/dist/modules/path/path.util.js +59 -0
  87. package/dist/modules/random/random.util.d.ts +17 -0
  88. package/dist/modules/random/random.util.js +57 -0
  89. package/dist/modules/readable-stream/readable-stream.util.d.ts +3 -0
  90. package/dist/modules/readable-stream/readable-stream.util.js +26 -0
  91. package/dist/modules/reflection/interfaces/parameter.interface.d.ts +4 -0
  92. package/dist/modules/reflection/interfaces/parameter.interface.js +0 -0
  93. package/dist/modules/reflection/models/attribute.model.d.ts +12 -0
  94. package/dist/modules/reflection/models/attribute.model.js +17 -0
  95. package/dist/modules/reflection/models/class-attribute.model.d.ts +4 -0
  96. package/dist/modules/reflection/models/class-attribute.model.js +6 -0
  97. package/dist/modules/reflection/models/method-attribute.model.d.ts +5 -0
  98. package/dist/modules/reflection/models/method-attribute.model.js +8 -0
  99. package/dist/modules/reflection/models/parameter-attribute.model.d.ts +7 -0
  100. package/dist/modules/reflection/models/parameter-attribute.model.js +21 -0
  101. package/dist/modules/reflection/models/property-attribute.model.d.ts +5 -0
  102. package/dist/modules/reflection/models/property-attribute.model.js +8 -0
  103. package/dist/modules/reflection/models/property-proxy-attribute.model.d.ts +15 -0
  104. package/dist/modules/reflection/models/property-proxy-attribute.model.js +19 -0
  105. package/dist/modules/reflection/types/constructor.type.d.ts +2 -0
  106. package/dist/modules/reflection/types/constructor.type.js +0 -0
  107. package/dist/modules/reflection/types/instance.type.d.ts +7 -0
  108. package/dist/modules/reflection/types/instance.type.js +0 -0
  109. package/dist/modules/reflection/types/type.type.d.ts +2 -0
  110. package/dist/modules/reflection/types/type.type.js +0 -0
  111. package/dist/modules/reflection/utils/decorator.util.d.ts +70 -0
  112. package/dist/modules/reflection/utils/decorator.util.js +135 -0
  113. package/dist/modules/reflection/utils/reflection.util.d.ts +140 -0
  114. package/dist/modules/reflection/utils/reflection.util.js +311 -0
  115. package/dist/modules/router/router.util.d.ts +33 -0
  116. package/dist/modules/router/router.util.js +59 -0
  117. package/dist/modules/state/adaptors/array/array-adaptor.util.d.ts +25 -0
  118. package/dist/modules/state/adaptors/array/array-adaptor.util.js +97 -0
  119. package/dist/modules/state/adaptors/entity/entity-adaptor.util.d.ts +35 -0
  120. package/dist/modules/state/adaptors/entity/entity-adaptor.util.js +158 -0
  121. package/dist/modules/state/adaptors/entity/entity-map.type.d.ts +4 -0
  122. package/dist/modules/state/adaptors/entity/entity-map.type.js +0 -0
  123. package/dist/modules/state/adaptors/entity/entity.interface.d.ts +3 -0
  124. package/dist/modules/state/adaptors/entity/entity.interface.js +0 -0
  125. package/dist/modules/state/state.model.d.ts +46 -0
  126. package/dist/modules/state/state.model.js +129 -0
  127. package/dist/modules/state/update.type.d.ts +2 -0
  128. package/dist/modules/state/update.type.js +0 -0
  129. package/dist/modules/string/string.util.d.ts +11 -0
  130. package/dist/modules/string/string.util.js +42 -0
  131. package/dist/modules/subscribable/subscribable.model.d.ts +10 -0
  132. package/dist/modules/subscribable/subscribable.model.js +34 -0
  133. package/dist/modules/subscribable/subscription.interface.d.ts +3 -0
  134. package/dist/modules/subscribable/subscription.interface.js +0 -0
  135. package/dist/modules/tson/error.d.ts +8 -0
  136. package/dist/modules/tson/error.js +13 -0
  137. package/dist/modules/tson/schema.d.ts +10 -0
  138. package/dist/modules/tson/schema.js +0 -0
  139. package/dist/modules/tson/schemas/any.d.ts +14 -0
  140. package/dist/modules/tson/schemas/any.js +27 -0
  141. package/dist/modules/tson/schemas/array.d.ts +21 -0
  142. package/dist/modules/tson/schemas/array.js +80 -0
  143. package/dist/modules/tson/schemas/boolean.d.ts +14 -0
  144. package/dist/modules/tson/schemas/boolean.js +38 -0
  145. package/dist/modules/tson/schemas/enum.d.ts +15 -0
  146. package/dist/modules/tson/schemas/enum.js +43 -0
  147. package/dist/modules/tson/schemas/number.d.ts +20 -0
  148. package/dist/modules/tson/schemas/number.js +66 -0
  149. package/dist/modules/tson/schemas/object.d.ts +33 -0
  150. package/dist/modules/tson/schemas/object.js +88 -0
  151. package/dist/modules/tson/schemas/schema-base.d.ts +12 -0
  152. package/dist/modules/tson/schemas/schema-base.js +14 -0
  153. package/dist/modules/tson/schemas/string.d.ts +19 -0
  154. package/dist/modules/tson/schemas/string.js +60 -0
  155. package/dist/modules/tson/schemas/union.d.ts +16 -0
  156. package/dist/modules/tson/schemas/union.js +56 -0
  157. package/dist/modules/tson/tson.d.ts +41 -0
  158. package/dist/modules/tson/tson.js +138 -0
  159. package/dist/modules/tson/type.d.ts +53 -0
  160. package/dist/modules/tson/type.js +0 -0
  161. package/dist/modules/value/value.util.d.ts +18 -0
  162. package/dist/modules/value/value.util.js +180 -0
  163. package/dist/types/awaitable.type.d.ts +1 -0
  164. package/dist/types/awaitable.type.js +0 -0
  165. package/dist/types/camel-to-kebab.type.d.ts +1 -0
  166. package/dist/types/camel-to-kebab.type.js +0 -0
  167. package/dist/types/has-key.type.d.ts +3 -0
  168. package/dist/types/has-key.type.js +0 -0
  169. package/dist/types/is-union.type.d.ts +1 -0
  170. package/dist/types/is-union.type.js +0 -0
  171. package/dist/types/keys-of-type.type.d.ts +5 -0
  172. package/dist/types/keys-of-type.type.js +0 -0
  173. package/dist/types/keys-with-fix.type.d.ts +3 -0
  174. package/dist/types/keys-with-fix.type.js +0 -0
  175. package/dist/types/optional-keys.type.d.ts +6 -0
  176. package/dist/types/optional-keys.type.js +0 -0
  177. package/dist/types/partial.type.d.ts +6 -0
  178. package/dist/types/partial.type.js +0 -0
  179. package/dist/types/predicate.type.d.ts +1 -0
  180. package/dist/types/predicate.type.js +0 -0
  181. package/dist/types/recursive-readonly.type.d.ts +3 -0
  182. package/dist/types/recursive-readonly.type.js +0 -0
  183. package/dist/types/recursive-value.type.d.ts +3 -0
  184. package/dist/types/recursive-value.type.js +0 -0
  185. package/dist/types/selector.type.d.ts +1 -0
  186. package/dist/types/selector.type.js +0 -0
  187. package/package.json +1 -1
@@ -0,0 +1,327 @@
1
+ import { $Enum } from '../enum/enum.util';
2
+ import { $Number } from '../number/number.util';
3
+ import { $Object } from '../object/object.util';
4
+ import { ColorFormats } from './color-formats.const';
5
+ import { Colors } from './colors.const';
6
+ export class $Color {
7
+ constructor() { }
8
+ static random(format = '#') {
9
+ let hex = `#${Math.random().toString(16).slice(2, 8).toUpperCase()}`;
10
+ if (format === '0x')
11
+ hex = $Color.convertHexToHex0(hex);
12
+ return hex;
13
+ }
14
+ static from(value = '#ffffffff') {
15
+ if (!value) {
16
+ return $Color.parse('black');
17
+ }
18
+ else if ($Color.isRgb(value)) {
19
+ value = value;
20
+ return {
21
+ hex0: $Color.convertRgbToHex(value, '0x'),
22
+ hex: $Color.convertRgbToHex(value),
23
+ rgb: value,
24
+ hsl: $Color.convertRgbToHsl(value),
25
+ hsv: $Color.convertRgbToHsv(value),
26
+ };
27
+ }
28
+ else if ($Color.isHsl(value)) {
29
+ value = value;
30
+ return {
31
+ hex0: $Color.convertHslToHex(value, '0x'),
32
+ hex: $Color.convertHslToHex(value),
33
+ rgb: $Color.convertHslToRgb(value),
34
+ hsl: value,
35
+ hsv: $Color.convertHslToHsv(value),
36
+ };
37
+ }
38
+ else if ($Color.isHsv(value)) {
39
+ value = value;
40
+ return {
41
+ hex0: $Color.convertHsvToHex(value, '0x'),
42
+ hex: $Color.convertHsvToHex(value),
43
+ rgb: $Color.convertHsvToRgb(value),
44
+ hsl: $Color.convertHsvToHsl(value),
45
+ hsv: value,
46
+ };
47
+ }
48
+ else if ($Color.isHex(value)) {
49
+ value = value;
50
+ return {
51
+ hex0: $Color.convertHexToHex0(value),
52
+ hex: value,
53
+ rgb: $Color.convertHexToRgb(value),
54
+ hsl: $Color.convertHexToHsl(value),
55
+ hsv: $Color.convertHexToHsv(value),
56
+ };
57
+ }
58
+ else if (typeof value === 'string' && !value.startsWith('0x')) {
59
+ const hex = $Color.convertNameToHex(value);
60
+ return {
61
+ hex0: $Color.convertHexToHex0(hex),
62
+ hex,
63
+ rgb: $Color.convertHexToRgb(hex),
64
+ hsl: $Color.convertHexToHsl(hex),
65
+ hsv: $Color.convertHexToHsv(hex),
66
+ };
67
+ }
68
+ else {
69
+ const hex = $Color.convertHex0ToHex(value);
70
+ return {
71
+ hex0: Number(value),
72
+ hex,
73
+ rgb: $Color.convertHexToRgb(hex),
74
+ hsl: $Color.convertHexToHsl(hex),
75
+ hsv: $Color.convertHexToHsv(hex),
76
+ };
77
+ }
78
+ }
79
+ static equal(target, value) {
80
+ return $Color.from(target).hex === $Color.from(value).hex;
81
+ }
82
+ static isRgb(value) {
83
+ return $Object.hasKeys(value, 'r', 'g', 'b', 'a');
84
+ }
85
+ static isHsl(value) {
86
+ return $Object.hasKeys(value, 'h', 's', 'l', 'a');
87
+ }
88
+ static isHsv(value) {
89
+ return $Object.hasKeys(value, 'h', 's', 'v', 'a');
90
+ }
91
+ static isHex(value) {
92
+ return typeof value === 'string' && value.startsWith('#');
93
+ }
94
+ static convertHexToHex0(hex) {
95
+ return Number(hex?.replace('#', '0x'));
96
+ }
97
+ static convertHex0ToHex(hex) {
98
+ return hex.toString(16);
99
+ }
100
+ static convertHexToRgb(hex) {
101
+ return {
102
+ r: parseInt(hex.slice(1, 3), 16),
103
+ g: parseInt(hex.slice(3, 5), 16),
104
+ b: parseInt(hex.slice(5, 7), 16),
105
+ a: hex.length > 7 ? parseInt(hex.slice(7, hex.length), 16) / 255 : 1,
106
+ };
107
+ }
108
+ static convertRgbToCss(rgb) {
109
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${Math.round(rgb.a * 100)}%)`;
110
+ }
111
+ static convertHslToCss(hsl) {
112
+ return `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%, ${Math.round(hsl.a * 100)}%)`;
113
+ }
114
+ static convertRgbToHsl(rgb) {
115
+ const r = rgb.r / 255, g = rgb.g / 255, b = rgb.b / 255;
116
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
117
+ const d = max - min;
118
+ let h = 0;
119
+ if (d) {
120
+ switch (max) {
121
+ case r:
122
+ h = (g - b) / d + (g < b ? 6 : 0);
123
+ break;
124
+ case g:
125
+ h = (b - r) / d + 2;
126
+ break;
127
+ default:
128
+ h = (r - g) / d + 4;
129
+ }
130
+ h *= 60;
131
+ }
132
+ const l = (max + min) / 2;
133
+ const s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1));
134
+ return { h: Math.round(h), s, l, a: rgb.a };
135
+ }
136
+ static convertHslToRgb(hsl) {
137
+ const h = ((hsl.h % 360) + 360) % 360;
138
+ const s = $Number.clamp(hsl.s, 0, 1), l = $Number.clamp(hsl.l, 0, 1);
139
+ const c = (1 - Math.abs(2 * l - 1)) * s;
140
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
141
+ const m = l - c / 2;
142
+ let r = 0, g = 0, b = 0;
143
+ if (h < 60)
144
+ [r, g] = [c, x];
145
+ else if (h < 120)
146
+ [r, g] = [x, c];
147
+ else if (h < 180)
148
+ [g, b] = [c, x];
149
+ else if (h < 240)
150
+ [g, b] = [x, c];
151
+ else if (h < 300)
152
+ [r, b] = [x, c];
153
+ else
154
+ [r, b] = [c, x];
155
+ return {
156
+ r: Math.round((r + m) * 255),
157
+ g: Math.round((g + m) * 255),
158
+ b: Math.round((b + m) * 255),
159
+ a: $Number.clamp(hsl.a, 0, 1),
160
+ };
161
+ }
162
+ static convertHslToHsv(hsl) {
163
+ return $Color.convertRgbToHsv($Color.convertHslToRgb(hsl));
164
+ }
165
+ static convertHsvToHsl(hsv) {
166
+ return $Color.convertRgbToHsl($Color.convertHsvToRgb(hsv));
167
+ }
168
+ static convertHexToHsv(hex) {
169
+ return $Color.convertRgbToHsv($Color.convertHexToRgb(hex));
170
+ }
171
+ static convertHslToHex(hsl, type = '#') {
172
+ return $Color.convertRgbToHex($Color.convertHslToRgb(hsl), type);
173
+ }
174
+ static convertHexToHsl(hex) {
175
+ return $Color.convertRgbToHsl($Color.convertHexToRgb(hex));
176
+ }
177
+ static convertHsvToRgb(hsv) {
178
+ const h = ((hsv.h % 360) + 360) % 360;
179
+ const s = $Number.clamp(hsv.s, 0, 1), v = $Number.clamp(hsv.v, 0, 1);
180
+ const c = v * s;
181
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
182
+ const m = v - c;
183
+ let r = 0, g = 0, b = 0;
184
+ if (h < 60)
185
+ [r, g] = [c, x];
186
+ else if (h < 120)
187
+ [r, g] = [x, c];
188
+ else if (h < 180)
189
+ [g, b] = [c, x];
190
+ else if (h < 240)
191
+ [g, b] = [x, c];
192
+ else if (h < 300)
193
+ [r, b] = [x, c];
194
+ else
195
+ [r, b] = [c, x];
196
+ return {
197
+ r: Math.round((r + m) * 255),
198
+ g: Math.round((g + m) * 255),
199
+ b: Math.round((b + m) * 255),
200
+ a: $Number.clamp(hsv.a, 0, 1),
201
+ };
202
+ }
203
+ static convertHsvToHex(hsv, type = '#') {
204
+ return $Color.convertRgbToHex($Color.convertHsvToRgb(hsv), type);
205
+ }
206
+ static convertRgbToHex(rgb, type = '#') {
207
+ const convert = (x) => {
208
+ const hex = Number(x).toString(16);
209
+ return hex.length < 2 ? '0' + hex : hex;
210
+ };
211
+ const hex = `#${convert(rgb.r)}${convert(rgb.g)}${convert(rgb.b)}${Math.round(rgb.a * 255).toString(16)}`;
212
+ return type === '#' ? hex : $Color.convertHexToHex0(hex);
213
+ }
214
+ static convertRgbToHsv(rgb) {
215
+ const r = rgb.r / 255, g = rgb.g / 255, b = rgb.b / 255;
216
+ const max = Math.max(r, g, b), min = Math.min(r, g, b), d = max - min;
217
+ const s = max === 0 ? 0 : d / max;
218
+ let h = 0;
219
+ if (d) {
220
+ switch (max) {
221
+ case r:
222
+ h = (g - b) / d + (g < b ? 6 : 0);
223
+ break;
224
+ case g:
225
+ h = (b - r) / d + 2;
226
+ break;
227
+ default:
228
+ h = (r - g) / d + 4;
229
+ }
230
+ h *= 60;
231
+ }
232
+ return { h: Math.round(h), s, v: max, a: rgb.a };
233
+ }
234
+ static convertHexToName(hex) {
235
+ return Object.entries(Colors).find(([, color]) => hex.toLowerCase().startsWith(color))?.[0];
236
+ }
237
+ static convertNameToHex(name, type = '#') {
238
+ const color = $Enum.getItems(Colors).find((item) => item.key.toLowerCase() === name.toLowerCase());
239
+ return type === '#' ? color?.value : $Color.convertHexToHex0(color?.value);
240
+ }
241
+ static getFormat(color) {
242
+ if (color === null || color === undefined)
243
+ return null;
244
+ if (typeof color === 'number' || (typeof color === 'string' && color.startsWith('0x')))
245
+ return ColorFormats.Hex0;
246
+ if (typeof color === 'string') {
247
+ if (color.startsWith('#'))
248
+ return ColorFormats.Hex;
249
+ if (color.startsWith('hsv'))
250
+ return ColorFormats.HSV;
251
+ if (color.startsWith('rgb'))
252
+ return ColorFormats.RGB;
253
+ if (color.startsWith('hsl'))
254
+ return ColorFormats.HSL;
255
+ return ColorFormats.Name;
256
+ }
257
+ return null;
258
+ }
259
+ static parse(color) {
260
+ if (!color) {
261
+ return $Color.from();
262
+ }
263
+ else if (typeof color === 'number' || color.startsWith('0x')) {
264
+ return $Color.from(color);
265
+ }
266
+ else if (color.startsWith('#')) {
267
+ return $Color.from(color);
268
+ }
269
+ else if (color.startsWith('rgba')) {
270
+ const matches = /rgba?\(((25[0-5]|2[0-4]\d|1\d{1,2}|\d\d?)\s*,\s*?){2}(25[0-5]|2[0-4]\d|1\d{1,2}|\d\d?)\s*,?\s*([01]\.?\d*?)?\)/.exec(color);
271
+ return $Color.from({
272
+ r: Number(matches[1]),
273
+ g: Number(matches[2]),
274
+ b: Number(matches[3]),
275
+ a: Number(matches[4]),
276
+ });
277
+ }
278
+ else if (color.startsWith('rgb')) {
279
+ const matches = /rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/.exec(color);
280
+ return $Color.from({
281
+ r: Number(matches[1]),
282
+ g: Number(matches[2]),
283
+ b: Number(matches[3]),
284
+ a: 1,
285
+ });
286
+ }
287
+ else if (color.startsWith('hsla')) {
288
+ const matches = /^hsla\((\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/.exec(color);
289
+ return $Color.from({
290
+ h: Number(matches[1]),
291
+ s: Number(matches[2]),
292
+ l: Number(matches[3]),
293
+ a: Number(matches[4]),
294
+ });
295
+ }
296
+ else if (color.startsWith('hsl')) {
297
+ const matches = /hsl\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/.exec(color);
298
+ return $Color.from({
299
+ h: Number(matches[1]),
300
+ s: Number(matches[2]),
301
+ l: Number(matches[3]),
302
+ a: 1,
303
+ });
304
+ }
305
+ else if (color.startsWith('hsva')) {
306
+ const matches = /^hsva\((\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d*(?:\.\d+)?)\)$/.exec(color);
307
+ return $Color.from({
308
+ h: Number(matches[1]),
309
+ s: Number(matches[2]),
310
+ v: Number(matches[3]),
311
+ a: Number(matches[4]),
312
+ });
313
+ }
314
+ else if (color.startsWith('hsv')) {
315
+ const matches = /hsv\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/.exec(color);
316
+ return $Color.from({
317
+ h: Number(matches[1]),
318
+ s: Number(matches[2]),
319
+ v: Number(matches[3]),
320
+ a: 1,
321
+ });
322
+ }
323
+ else {
324
+ return $Color.from($Color.convertNameToHex(color));
325
+ }
326
+ }
327
+ }
@@ -0,0 +1,151 @@
1
+ export declare const Colors: {
2
+ readonly AliceBlue: "#f0f8ff";
3
+ readonly AntiqueWhite: "#faebd7";
4
+ readonly Aqua: "#00ffff";
5
+ readonly Aquamarine: "#7fffd4";
6
+ readonly Azure: "#f0ffff";
7
+ readonly Beige: "#f5f5dc";
8
+ readonly Bisque: "#ffe4c4";
9
+ readonly Black: "#000000";
10
+ readonly BlanchedAlmond: "#ffebcd";
11
+ readonly Blue: "#0000ff";
12
+ readonly BlueViolet: "#8a2be2";
13
+ readonly Brown: "#a52a2a";
14
+ readonly BurlyWood: "#deb887";
15
+ readonly CadetBlue: "#5f9ea0";
16
+ readonly Chartreuse: "#7fff00";
17
+ readonly Chocolate: "#d2691e";
18
+ readonly Coral: "#ff7f50";
19
+ readonly CornflowerBlue: "#6495ed";
20
+ readonly Cornsilk: "#fff8dc";
21
+ readonly Crimson: "#dc143c";
22
+ readonly Cyan: "#00ffff";
23
+ readonly DarkBlue: "#00008b";
24
+ readonly DarkCyan: "#008b8b";
25
+ readonly DarkGoldenRod: "#b8860b";
26
+ readonly DarkGray: "#a9a9a9";
27
+ readonly DarkGrey: "#a9a9a9";
28
+ readonly DarkGreen: "#006400";
29
+ readonly DarkKhaki: "#bdb76b";
30
+ readonly DarkMagenta: "#8b008b";
31
+ readonly DarkOliveGreen: "#556b2f";
32
+ readonly DarkOrange: "#ff8c00";
33
+ readonly DarkOrchid: "#9932cc";
34
+ readonly DarkRed: "#8b0000";
35
+ readonly DarkSalmon: "#e9967a";
36
+ readonly DarkSeaGreen: "#8fbc8f";
37
+ readonly DarkSlateBlue: "#483d8b";
38
+ readonly DarkSlateGray: "#2f4f4f";
39
+ readonly DarkSlateGrey: "#2f4f4f";
40
+ readonly DarkTurquoise: "#00ced1";
41
+ readonly DarkViolet: "#9400d3";
42
+ readonly DeepPink: "#ff1493";
43
+ readonly DeepSkyBlue: "#00bfff";
44
+ readonly DimGray: "#696969";
45
+ readonly DimGrey: "#696969";
46
+ readonly DodgerBlue: "#1e90ff";
47
+ readonly FireBrick: "#b22222";
48
+ readonly FloralWhite: "#fffaf0";
49
+ readonly ForestGreen: "#228b22";
50
+ readonly Fuchsia: "#ff00ff";
51
+ readonly Gainsboro: "#dcdcdc";
52
+ readonly GhostWhite: "#f8f8ff";
53
+ readonly Gold: "#ffd700";
54
+ readonly GoldenRod: "#daa520";
55
+ readonly Gray: "#808080";
56
+ readonly Grey: "#808080";
57
+ readonly Green: "#008000";
58
+ readonly GreenYellow: "#adff2f";
59
+ readonly HoneyDew: "#f0fff0";
60
+ readonly HotPink: "#ff69b4";
61
+ readonly IndianRed: "#cd5c5c";
62
+ readonly Indigo: "#4b0082";
63
+ readonly Ivory: "#fffff0";
64
+ readonly Khaki: "#f0e68c";
65
+ readonly Lavender: "#e6e6fa";
66
+ readonly LavenderBlush: "#fff0f5";
67
+ readonly LawnGreen: "#7cfc00";
68
+ readonly LemonChiffon: "#fffacd";
69
+ readonly LightBlue: "#add8e6";
70
+ readonly LightCoral: "#f08080";
71
+ readonly LightCyan: "#e0ffff";
72
+ readonly LightGoldenRodYellow: "#fafad2";
73
+ readonly LightGray: "#d3d3d3";
74
+ readonly LightGrey: "#d3d3d3";
75
+ readonly LightGreen: "#90ee90";
76
+ readonly LightPink: "#ffb6c1";
77
+ readonly LightSalmon: "#ffa07a";
78
+ readonly LightSeaGreen: "#20b2aa";
79
+ readonly LightSkyBlue: "#87cefa";
80
+ readonly LightSlateGray: "#778899";
81
+ readonly LightSlateGrey: "#778899";
82
+ readonly LightSteelBlue: "#b0c4de";
83
+ readonly LightYellow: "#ffffe0";
84
+ readonly Lime: "#00ff00";
85
+ readonly LimeGreen: "#32cd32";
86
+ readonly Linen: "#faf0e6";
87
+ readonly Magenta: "#ff00ff";
88
+ readonly Maroon: "#800000";
89
+ readonly MediumAquaMarine: "#66cdaa";
90
+ readonly MediumBlue: "#0000cd";
91
+ readonly MediumOrchid: "#ba55d3";
92
+ readonly MediumPurple: "#9370db";
93
+ readonly MediumSeaGreen: "#3cb371";
94
+ readonly MediumSlateBlue: "#7b68ee";
95
+ readonly MediumSpringGreen: "#00fa9a";
96
+ readonly MediumTurquoise: "#48d1cc";
97
+ readonly MediumVioletRed: "#c71585";
98
+ readonly MidnightBlue: "#191970";
99
+ readonly MintCream: "#f5fffa";
100
+ readonly MistyRose: "#ffe4e1";
101
+ readonly Moccasin: "#ffe4b5";
102
+ readonly NavajoWhite: "#ffdead";
103
+ readonly Navy: "#000080";
104
+ readonly OldLace: "#fdf5e6";
105
+ readonly Olive: "#808000";
106
+ readonly OliveDrab: "#6b8e23";
107
+ readonly Orange: "#ffa500";
108
+ readonly OrangeRed: "#ff4500";
109
+ readonly Orchid: "#da70d6";
110
+ readonly PaleGoldenRod: "#eee8aa";
111
+ readonly PaleGreen: "#98fb98";
112
+ readonly PaleTurquoise: "#afeeee";
113
+ readonly PaleVioletRed: "#db7093";
114
+ readonly PapayaWhip: "#ffefd5";
115
+ readonly PeachPuff: "#ffdab9";
116
+ readonly Peru: "#cd853f";
117
+ readonly Pink: "#ffc0cb";
118
+ readonly Plum: "#dda0dd";
119
+ readonly PowderBlue: "#b0e0e6";
120
+ readonly Purple: "#800080";
121
+ readonly RebeccaPurple: "#663399";
122
+ readonly Red: "#ff0000";
123
+ readonly RosyBrown: "#bc8f8f";
124
+ readonly RoyalBlue: "#4169e1";
125
+ readonly SaddleBrown: "#8b4513";
126
+ readonly Salmon: "#fa8072";
127
+ readonly SandyBrown: "#f4a460";
128
+ readonly SeaGreen: "#2e8b57";
129
+ readonly SeaShell: "#fff5ee";
130
+ readonly Sienna: "#a0522d";
131
+ readonly Silver: "#c0c0c0";
132
+ readonly SkyBlue: "#87ceeb";
133
+ readonly SlateBlue: "#6a5acd";
134
+ readonly SlateGray: "#708090";
135
+ readonly SlateGrey: "#708090";
136
+ readonly Snow: "#fffafa";
137
+ readonly SpringGreen: "#00ff7f";
138
+ readonly SteelBlue: "#4682b4";
139
+ readonly Tan: "#d2b48c";
140
+ readonly Teal: "#008080";
141
+ readonly Thistle: "#d8bfd8";
142
+ readonly Tomato: "#ff6347";
143
+ readonly Turquoise: "#40e0d0";
144
+ readonly Violet: "#ee82ee";
145
+ readonly Wheat: "#f5deb3";
146
+ readonly White: "#ffffff";
147
+ readonly WhiteSmoke: "#f5f5f5";
148
+ readonly Yellow: "#ffff00";
149
+ readonly YellowGreen: "#9acd32";
150
+ };
151
+ export type Colors = (typeof Colors)[keyof typeof Colors];
@@ -0,0 +1,150 @@
1
+ export const Colors = {
2
+ AliceBlue: '#f0f8ff',
3
+ AntiqueWhite: '#faebd7',
4
+ Aqua: '#00ffff',
5
+ Aquamarine: '#7fffd4',
6
+ Azure: '#f0ffff',
7
+ Beige: '#f5f5dc',
8
+ Bisque: '#ffe4c4',
9
+ Black: '#000000',
10
+ BlanchedAlmond: '#ffebcd',
11
+ Blue: '#0000ff',
12
+ BlueViolet: '#8a2be2',
13
+ Brown: '#a52a2a',
14
+ BurlyWood: '#deb887',
15
+ CadetBlue: '#5f9ea0',
16
+ Chartreuse: '#7fff00',
17
+ Chocolate: '#d2691e',
18
+ Coral: '#ff7f50',
19
+ CornflowerBlue: '#6495ed',
20
+ Cornsilk: '#fff8dc',
21
+ Crimson: '#dc143c',
22
+ Cyan: '#00ffff',
23
+ DarkBlue: '#00008b',
24
+ DarkCyan: '#008b8b',
25
+ DarkGoldenRod: '#b8860b',
26
+ DarkGray: '#a9a9a9',
27
+ DarkGrey: '#a9a9a9',
28
+ DarkGreen: '#006400',
29
+ DarkKhaki: '#bdb76b',
30
+ DarkMagenta: '#8b008b',
31
+ DarkOliveGreen: '#556b2f',
32
+ DarkOrange: '#ff8c00',
33
+ DarkOrchid: '#9932cc',
34
+ DarkRed: '#8b0000',
35
+ DarkSalmon: '#e9967a',
36
+ DarkSeaGreen: '#8fbc8f',
37
+ DarkSlateBlue: '#483d8b',
38
+ DarkSlateGray: '#2f4f4f',
39
+ DarkSlateGrey: '#2f4f4f',
40
+ DarkTurquoise: '#00ced1',
41
+ DarkViolet: '#9400d3',
42
+ DeepPink: '#ff1493',
43
+ DeepSkyBlue: '#00bfff',
44
+ DimGray: '#696969',
45
+ DimGrey: '#696969',
46
+ DodgerBlue: '#1e90ff',
47
+ FireBrick: '#b22222',
48
+ FloralWhite: '#fffaf0',
49
+ ForestGreen: '#228b22',
50
+ Fuchsia: '#ff00ff',
51
+ Gainsboro: '#dcdcdc',
52
+ GhostWhite: '#f8f8ff',
53
+ Gold: '#ffd700',
54
+ GoldenRod: '#daa520',
55
+ Gray: '#808080',
56
+ Grey: '#808080',
57
+ Green: '#008000',
58
+ GreenYellow: '#adff2f',
59
+ HoneyDew: '#f0fff0',
60
+ HotPink: '#ff69b4',
61
+ IndianRed: '#cd5c5c',
62
+ Indigo: '#4b0082',
63
+ Ivory: '#fffff0',
64
+ Khaki: '#f0e68c',
65
+ Lavender: '#e6e6fa',
66
+ LavenderBlush: '#fff0f5',
67
+ LawnGreen: '#7cfc00',
68
+ LemonChiffon: '#fffacd',
69
+ LightBlue: '#add8e6',
70
+ LightCoral: '#f08080',
71
+ LightCyan: '#e0ffff',
72
+ LightGoldenRodYellow: '#fafad2',
73
+ LightGray: '#d3d3d3',
74
+ LightGrey: '#d3d3d3',
75
+ LightGreen: '#90ee90',
76
+ LightPink: '#ffb6c1',
77
+ LightSalmon: '#ffa07a',
78
+ LightSeaGreen: '#20b2aa',
79
+ LightSkyBlue: '#87cefa',
80
+ LightSlateGray: '#778899',
81
+ LightSlateGrey: '#778899',
82
+ LightSteelBlue: '#b0c4de',
83
+ LightYellow: '#ffffe0',
84
+ Lime: '#00ff00',
85
+ LimeGreen: '#32cd32',
86
+ Linen: '#faf0e6',
87
+ Magenta: '#ff00ff',
88
+ Maroon: '#800000',
89
+ MediumAquaMarine: '#66cdaa',
90
+ MediumBlue: '#0000cd',
91
+ MediumOrchid: '#ba55d3',
92
+ MediumPurple: '#9370db',
93
+ MediumSeaGreen: '#3cb371',
94
+ MediumSlateBlue: '#7b68ee',
95
+ MediumSpringGreen: '#00fa9a',
96
+ MediumTurquoise: '#48d1cc',
97
+ MediumVioletRed: '#c71585',
98
+ MidnightBlue: '#191970',
99
+ MintCream: '#f5fffa',
100
+ MistyRose: '#ffe4e1',
101
+ Moccasin: '#ffe4b5',
102
+ NavajoWhite: '#ffdead',
103
+ Navy: '#000080',
104
+ OldLace: '#fdf5e6',
105
+ Olive: '#808000',
106
+ OliveDrab: '#6b8e23',
107
+ Orange: '#ffa500',
108
+ OrangeRed: '#ff4500',
109
+ Orchid: '#da70d6',
110
+ PaleGoldenRod: '#eee8aa',
111
+ PaleGreen: '#98fb98',
112
+ PaleTurquoise: '#afeeee',
113
+ PaleVioletRed: '#db7093',
114
+ PapayaWhip: '#ffefd5',
115
+ PeachPuff: '#ffdab9',
116
+ Peru: '#cd853f',
117
+ Pink: '#ffc0cb',
118
+ Plum: '#dda0dd',
119
+ PowderBlue: '#b0e0e6',
120
+ Purple: '#800080',
121
+ RebeccaPurple: '#663399',
122
+ Red: '#ff0000',
123
+ RosyBrown: '#bc8f8f',
124
+ RoyalBlue: '#4169e1',
125
+ SaddleBrown: '#8b4513',
126
+ Salmon: '#fa8072',
127
+ SandyBrown: '#f4a460',
128
+ SeaGreen: '#2e8b57',
129
+ SeaShell: '#fff5ee',
130
+ Sienna: '#a0522d',
131
+ Silver: '#c0c0c0',
132
+ SkyBlue: '#87ceeb',
133
+ SlateBlue: '#6a5acd',
134
+ SlateGray: '#708090',
135
+ SlateGrey: '#708090',
136
+ Snow: '#fffafa',
137
+ SpringGreen: '#00ff7f',
138
+ SteelBlue: '#4682b4',
139
+ Tan: '#d2b48c',
140
+ Teal: '#008080',
141
+ Thistle: '#d8bfd8',
142
+ Tomato: '#ff6347',
143
+ Turquoise: '#40e0d0',
144
+ Violet: '#ee82ee',
145
+ Wheat: '#f5deb3',
146
+ White: '#ffffff',
147
+ WhiteSmoke: '#f5f5f5',
148
+ Yellow: '#ffff00',
149
+ YellowGreen: '#9acd32',
150
+ };
@@ -0,0 +1,6 @@
1
+ export interface HSL {
2
+ h: number;
3
+ s: number;
4
+ l: number;
5
+ a: number;
6
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ export interface HSV {
2
+ h: number;
3
+ s: number;
4
+ v: number;
5
+ a: number;
6
+ }
File without changes
@@ -0,0 +1,6 @@
1
+ export interface RGB {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ export declare class Compression {
2
+ static compressString(string: string): string;
3
+ static decompressString(string: string): string;
4
+ }