@bitbybit-dev/base 0.19.8 → 0.19.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 (61) hide show
  1. package/babel.config.cjs +1 -0
  2. package/babel.config.d.cts +5 -0
  3. package/index.d.ts +1 -0
  4. package/{index.ts → index.js} +1 -2
  5. package/lib/api/index.js +1 -0
  6. package/lib/api/inputs/base-inputs.d.ts +35 -0
  7. package/lib/api/inputs/base-inputs.js +1 -0
  8. package/lib/api/inputs/{color-inputs.ts → color-inputs.d.ts} +26 -48
  9. package/lib/api/inputs/color-inputs.js +164 -0
  10. package/lib/api/inputs/index.js +9 -0
  11. package/lib/api/inputs/inputs.js +9 -0
  12. package/lib/api/inputs/{lists-inputs.ts → lists-inputs.d.ts} +91 -190
  13. package/lib/api/inputs/lists-inputs.js +576 -0
  14. package/lib/api/inputs/{logic-inputs.ts → logic-inputs.d.ts} +24 -46
  15. package/lib/api/inputs/logic-inputs.js +111 -0
  16. package/lib/api/inputs/{math-inputs.ts → math-inputs.d.ts} +53 -97
  17. package/lib/api/inputs/math-inputs.js +391 -0
  18. package/lib/api/inputs/{point-inputs.ts → point-inputs.d.ts} +77 -168
  19. package/lib/api/inputs/point-inputs.js +521 -0
  20. package/lib/api/inputs/text-inputs.d.ts +83 -0
  21. package/lib/api/inputs/text-inputs.js +120 -0
  22. package/lib/api/inputs/{transforms-inputs.ts → transforms-inputs.d.ts} +35 -64
  23. package/lib/api/inputs/transforms-inputs.js +200 -0
  24. package/lib/api/inputs/{vector-inputs.ts → vector-inputs.d.ts} +48 -104
  25. package/lib/api/inputs/vector-inputs.js +304 -0
  26. package/lib/api/services/color.d.ts +114 -0
  27. package/lib/api/services/{color.ts → color.js} +15 -34
  28. package/lib/api/services/geometry-helper.d.ts +15 -0
  29. package/lib/api/services/{geometry-helper.ts → geometry-helper.js} +31 -43
  30. package/lib/api/services/{index.ts → index.d.ts} +1 -1
  31. package/lib/api/services/index.js +9 -0
  32. package/lib/api/services/lists.d.ts +287 -0
  33. package/lib/api/services/{lists.ts → lists.js} +59 -83
  34. package/lib/api/services/logic.d.ts +99 -0
  35. package/lib/api/services/{logic.ts → logic.js} +24 -32
  36. package/lib/api/services/math.d.ts +349 -0
  37. package/lib/api/services/{math.ts → math.js} +71 -136
  38. package/lib/api/services/point.d.ts +222 -0
  39. package/lib/api/services/{point.ts → point.js} +32 -67
  40. package/lib/api/services/text.d.ts +69 -0
  41. package/lib/api/services/{text.ts → text.js} +7 -17
  42. package/lib/api/services/transforms.d.ts +122 -0
  43. package/lib/api/services/{transforms.ts → transforms.js} +37 -83
  44. package/lib/api/services/vector.d.ts +320 -0
  45. package/lib/api/services/{vector.ts → vector.js} +42 -80
  46. package/lib/{index.ts → index.d.ts} +0 -1
  47. package/lib/index.js +1 -0
  48. package/package.json +1 -1
  49. package/lib/api/inputs/base-inputs.ts +0 -18
  50. package/lib/api/inputs/text-inputs.ts +0 -108
  51. package/lib/api/services/color.test.ts +0 -86
  52. package/lib/api/services/lists.test.ts +0 -612
  53. package/lib/api/services/logic.test.ts +0 -187
  54. package/lib/api/services/math.test.ts +0 -622
  55. package/lib/api/services/text.test.ts +0 -55
  56. package/lib/api/services/vector.test.ts +0 -360
  57. package/tsconfig.bitbybit.json +0 -26
  58. package/tsconfig.json +0 -24
  59. /package/lib/api/{index.ts → index.d.ts} +0 -0
  60. /package/lib/api/inputs/{index.ts → index.d.ts} +0 -0
  61. /package/lib/api/inputs/{inputs.ts → inputs.d.ts} +0 -0
@@ -1,86 +0,0 @@
1
- import { Color } from "./color";
2
- import { MathBitByBit } from "./math";
3
-
4
- describe("Color unit tests", () => {
5
- let color: Color;
6
-
7
- beforeAll(async () => {
8
- const math = new MathBitByBit();
9
- color = new Color(math);
10
- });
11
-
12
- it("should create hex color", () => {
13
- const res = color.hexColor({ color: "#ff0000" });
14
- expect(res).toEqual("#ff0000");
15
- });
16
-
17
- it("should convert hex to rgb", () => {
18
- const res = color.hexToRgb({ color: "#ff0000" });
19
- expect(res).toEqual({ r: 255, g: 0, b: 0 });
20
- });
21
-
22
- it("should convert hex to rgb mapped", () => {
23
- const res = color.hexToRgbMapped({ color: "#ff0000", from: 0, to: 1 });
24
- expect(res).toEqual({ r: 1, g: 0, b: 0 });
25
- });
26
-
27
- it("should get red param", () => {
28
- const res = color.getRedParam({ color: "#ff0000", from: 0, to: 1 });
29
- expect(res).toEqual(1);
30
- });
31
-
32
- it("should get green param", () => {
33
- const res = color.getGreenParam({ color: "#00ff00", from: 0, to: 1 });
34
- expect(res).toEqual(1);
35
- });
36
-
37
- it("should get blue param", () => {
38
- const res = color.getBlueParam({ color: "#0000ff", from: 0, to: 1 });
39
- expect(res).toEqual(1);
40
- });
41
-
42
- it("should convert rgb to hex", () => {
43
- const res = color.rgbToHex({ r: 255, g: 150, b: 23, min: 0, max: 255 });
44
- expect(res).toEqual("#ff9617");
45
- });
46
-
47
- it("should convert rgb to hex", () => {
48
- const res = color.rgbToHex({ r: 1, g: 0.3, b: 0.6, min: 0, max: 1 });
49
- expect(res).toEqual("#ff4d99");
50
- });
51
-
52
- it("should convert rgb obj to hex", () => {
53
- const res = color.rgbObjToHex({ rgb: { r: 1, g: 0.3, b: 0.6 }, min: 0, max: 1 });
54
- expect(res).toEqual("#ff4d99");
55
- });
56
-
57
- it("should get R from rgb obj", () => {
58
- const res = color.rgbToRed({ rgb: { r: 1, g: 0.3, b: 0.6 } });
59
- expect(res).toEqual(1);
60
- });
61
-
62
- it("should get G from rgb obj", () => {
63
- const res = color.rgbToGreen({ rgb: { r: 1, g: 0.3, b: 0.6 } });
64
- expect(res).toEqual(0.3);
65
- });
66
-
67
- it("should get B from rgb obj", () => {
68
- const res = color.rgbToBlue({ rgb: { r: 1, g: 0.3, b: 0.6 } });
69
- expect(res).toEqual(0.6);
70
- });
71
-
72
- it("should invert colors", () => {
73
- const res = color.invert({ color: "#ff4d99", blackAndWhite: false });
74
- expect(res).toEqual("#00b266");
75
- });
76
-
77
- it("should invert colors to black and white", () => {
78
- const res = color.invert({ color: "#ff4d99", blackAndWhite: true });
79
- expect(res).toEqual("#ffffff");
80
- });
81
-
82
- it("should invert colors to black and white", () => {
83
- const res = color.invert({ color: "#ffeeaa", blackAndWhite: true });
84
- expect(res).toEqual("#000000");
85
- });
86
- });