@bitbybit-dev/base 0.19.6 → 0.19.8

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 +0 -1
  2. package/{index.js → index.ts} +2 -1
  3. package/lib/api/inputs/base-inputs.ts +18 -0
  4. package/lib/api/inputs/{color-inputs.d.ts → color-inputs.ts} +48 -26
  5. package/lib/api/inputs/{lists-inputs.d.ts → lists-inputs.ts} +190 -91
  6. package/lib/api/inputs/{logic-inputs.d.ts → logic-inputs.ts} +46 -24
  7. package/lib/api/inputs/{math-inputs.d.ts → math-inputs.ts} +97 -53
  8. package/lib/api/inputs/{point-inputs.d.ts → point-inputs.ts} +168 -77
  9. package/lib/api/inputs/text-inputs.ts +108 -0
  10. package/lib/api/inputs/{transforms-inputs.d.ts → transforms-inputs.ts} +64 -35
  11. package/lib/api/inputs/{vector-inputs.d.ts → vector-inputs.ts} +104 -48
  12. package/lib/api/services/color.test.ts +86 -0
  13. package/lib/api/services/{color.js → color.ts} +34 -15
  14. package/lib/api/services/{geometry-helper.js → geometry-helper.ts} +43 -31
  15. package/lib/api/services/{index.d.ts → index.ts} +1 -1
  16. package/lib/api/services/lists.test.ts +612 -0
  17. package/lib/api/services/{lists.js → lists.ts} +83 -59
  18. package/lib/api/services/logic.test.ts +187 -0
  19. package/lib/api/services/{logic.js → logic.ts} +32 -24
  20. package/lib/api/services/math.test.ts +622 -0
  21. package/lib/api/services/{math.js → math.ts} +136 -71
  22. package/lib/api/services/{point.js → point.ts} +67 -32
  23. package/lib/api/services/text.test.ts +55 -0
  24. package/lib/api/services/{text.js → text.ts} +17 -7
  25. package/lib/api/services/{transforms.js → transforms.ts} +83 -37
  26. package/lib/api/services/vector.test.ts +360 -0
  27. package/lib/api/services/{vector.js → vector.ts} +80 -42
  28. package/lib/{index.d.ts → index.ts} +1 -0
  29. package/package.json +1 -1
  30. package/tsconfig.bitbybit.json +26 -0
  31. package/tsconfig.json +24 -0
  32. package/babel.config.d.cts +0 -5
  33. package/index.d.ts +0 -1
  34. package/lib/api/index.js +0 -1
  35. package/lib/api/inputs/base-inputs.d.ts +0 -35
  36. package/lib/api/inputs/base-inputs.js +0 -1
  37. package/lib/api/inputs/color-inputs.js +0 -164
  38. package/lib/api/inputs/index.js +0 -9
  39. package/lib/api/inputs/inputs.js +0 -9
  40. package/lib/api/inputs/lists-inputs.js +0 -576
  41. package/lib/api/inputs/logic-inputs.js +0 -111
  42. package/lib/api/inputs/math-inputs.js +0 -391
  43. package/lib/api/inputs/point-inputs.js +0 -521
  44. package/lib/api/inputs/text-inputs.d.ts +0 -83
  45. package/lib/api/inputs/text-inputs.js +0 -120
  46. package/lib/api/inputs/transforms-inputs.js +0 -200
  47. package/lib/api/inputs/vector-inputs.js +0 -304
  48. package/lib/api/services/color.d.ts +0 -114
  49. package/lib/api/services/geometry-helper.d.ts +0 -15
  50. package/lib/api/services/index.js +0 -9
  51. package/lib/api/services/lists.d.ts +0 -287
  52. package/lib/api/services/logic.d.ts +0 -99
  53. package/lib/api/services/math.d.ts +0 -349
  54. package/lib/api/services/point.d.ts +0 -222
  55. package/lib/api/services/text.d.ts +0 -69
  56. package/lib/api/services/transforms.d.ts +0 -122
  57. package/lib/api/services/vector.d.ts +0 -320
  58. package/lib/index.js +0 -1
  59. /package/lib/api/{index.d.ts → index.ts} +0 -0
  60. /package/lib/api/inputs/{index.d.ts → index.ts} +0 -0
  61. /package/lib/api/inputs/{inputs.d.ts → inputs.ts} +0 -0
@@ -1,287 +0,0 @@
1
- import * as Inputs from "../inputs";
2
- /**
3
- * Contains various list methods.
4
- * <div>
5
- * <img src="../assets/images/blockly-images/math/math.svg" alt="Blockly Image"/>
6
- * </div>
7
- */
8
- export declare class Lists {
9
- /**
10
- * Gets an item from the list by using a 0 based index
11
- * @param inputs a list and an index
12
- * @returns item
13
- * @group get
14
- * @shortname item by index
15
- * @drawable false
16
- */
17
- getItem<T>(inputs: Inputs.Lists.ListItemDto<T>): T;
18
- /**
19
- * Gets items randomly by using a threshold
20
- * @param inputs a list and a threshold for randomization of items to remove
21
- * @returns list with remaining items
22
- * @group get
23
- * @shortname random get threshold
24
- * @drawable false
25
- */
26
- randomGetThreshold<T>(inputs: Inputs.Lists.RandomThresholdDto<T>): T[];
27
- /**
28
- * Gets a sub list between start and end indexes
29
- * @param inputs a list and start and end indexes
30
- * @returns sub list
31
- * @group get
32
- * @shortname sublist
33
- * @drawable false
34
- */
35
- getSubList<T>(inputs: Inputs.Lists.SubListDto<T>): T[];
36
- /**
37
- * Gets nth item in the list
38
- * @param inputs a list and index
39
- * @returns list with filtered items
40
- * @group get
41
- * @shortname every n-th
42
- * @drawable false
43
- */
44
- getNthItem<T>(inputs: Inputs.Lists.GetNthItemDto<T>): T[];
45
- /**
46
- * Gets elements by pattern
47
- * @param inputs a list and index
48
- * @returns list with filtered items
49
- * @group get
50
- * @shortname by pattern
51
- * @drawable false
52
- */
53
- getByPattern<T>(inputs: Inputs.Lists.GetByPatternDto<T>): T[];
54
- /**
55
- * Merge elements of lists on a given level and flatten output if needed
56
- * @param inputs lists, level and flatten data
57
- * @returns list with merged lists and flattened lists
58
- * @group get
59
- * @shortname merge levels
60
- * @drawable false
61
- */
62
- mergeElementsOfLists<T>(inputs: Inputs.Lists.MergeElementsOfLists<T[]>): T[];
63
- /**
64
- * Gets the longest list length from the list of lists
65
- * @param inputs a list of lists
66
- * @returns number of max length
67
- * @group get
68
- * @shortname longest list length
69
- * @drawable false
70
- */
71
- getLongestListLength<T>(inputs: Inputs.Lists.GetLongestListLength<T[]>): number;
72
- /**
73
- * Reverse the list
74
- * @param inputs a list and an index
75
- * @returns item
76
- * @group edit
77
- * @shortname reverse
78
- * @drawable false
79
- */
80
- reverse<T>(inputs: Inputs.Lists.ListCloneDto<T>): T[];
81
- /**
82
- * Flip 2d lists - every nth element of each list will form a separate list
83
- * @param inputs a list of lists to flip
84
- * @returns item
85
- * @group edit
86
- * @shortname flip lists
87
- * @drawable false
88
- */
89
- flipLists<T>(inputs: Inputs.Lists.ListCloneDto<T[]>): T[][];
90
- /**
91
- * Group in lists of n elements
92
- * @param inputs a list
93
- * @returns items grouped in lists of n elements
94
- * @group edit
95
- * @shortname group elements
96
- * @drawable false
97
- */
98
- groupNth<T>(inputs: Inputs.Lists.GroupListDto<T>): T[];
99
- /**
100
- * Get the depth of the list
101
- * @param inputs a list
102
- * @returns number of depth
103
- * @group get
104
- * @shortname max list depth
105
- * @drawable false
106
- */
107
- getListDepth(inputs: Inputs.Lists.ListCloneDto<[]>): number;
108
- /**
109
- * Gets the length of the list
110
- * @param inputs a length list
111
- * @returns a number
112
- * @group get
113
- * @shortname list length
114
- * @drawable false
115
- */
116
- listLength<T>(inputs: Inputs.Lists.ListCloneDto<T>): number;
117
- /**
118
- * Add item to the list
119
- * @param inputs a list, item and an index
120
- * @returns list with added item
121
- * @group add
122
- * @shortname add item
123
- * @drawable false
124
- */
125
- addItemAtIndex<T>(inputs: Inputs.Lists.AddItemAtIndexDto<T>): T[];
126
- /**
127
- * Adds item to the list of provided indexes
128
- * @param inputs a list, item and an indexes
129
- * @returns list with added item
130
- * @group add
131
- * @shortname add item at indexes
132
- * @drawable false
133
- */
134
- addItemAtIndexes<T>(inputs: Inputs.Lists.AddItemAtIndexesDto<T>): T[];
135
- /**
136
- * Adds items to the list of provided indexes matching 1:1, first item will go to first index provided, etc.
137
- * @param inputs a list, items and an indexes
138
- * @returns list with added items
139
- * @group add
140
- * @shortname add items
141
- * @drawable false
142
- */
143
- addItemsAtIndexes<T>(inputs: Inputs.Lists.AddItemsAtIndexesDto<T>): T[];
144
- /**
145
- * Remove item from the list
146
- * @param inputs a list and index
147
- * @returns list with removed item
148
- * @group remove
149
- * @shortname remove item
150
- * @drawable false
151
- */
152
- removeItemAtIndex<T>(inputs: Inputs.Lists.RemoveItemAtIndexDto<T>): T[];
153
- /**
154
- * Remove items from the list of provided indexes
155
- * @param inputs a list and indexes
156
- * @returns list with removed items
157
- * @group remove
158
- * @shortname remove items
159
- * @drawable false
160
- */
161
- removeItemsAtIndexes<T>(inputs: Inputs.Lists.RemoveItemsAtIndexesDto<T>): T[];
162
- /**
163
- * Remove all items from the list
164
- * @param inputs a list
165
- * @returns The length is set to 0 and same array memory object is returned
166
- * @group remove
167
- * @shortname remove all items
168
- * @drawable false
169
- */
170
- removeAllItems<T>(inputs: Inputs.Lists.ListDto<T>): T[];
171
- /**
172
- * Remove item from the list
173
- * @param inputs a list and index
174
- * @returns list with removed item
175
- * @group remove
176
- * @shortname every n-th
177
- * @drawable false
178
- */
179
- removeNthItem<T>(inputs: Inputs.Lists.RemoveNthItemDto<T>): T[];
180
- /**
181
- * Removes items randomly by using a threshold
182
- * @param inputs a list and a threshold for randomization of items to remove
183
- * @returns list with removed items
184
- * @group remove
185
- * @shortname random remove threshold
186
- * @drawable false
187
- */
188
- randomRemoveThreshold<T>(inputs: Inputs.Lists.RandomThresholdDto<T>): T[];
189
- /**
190
- * remove duplicate numbers from the list
191
- * @param inputs a list of numbers
192
- * @returns list with unique numbers
193
- * @group remove
194
- * @shortname remove duplicates
195
- * @drawable false
196
- */
197
- removeDuplicateNumbers(inputs: Inputs.Lists.RemoveDuplicatesDto<number>): number[];
198
- /**
199
- * remove duplicate numbers from the list with tolerance
200
- * @param inputs a list of numbers and the tolerance
201
- * @returns list with unique numbers
202
- * @group remove
203
- * @shortname remove duplicates tol
204
- * @drawable false
205
- */
206
- removeDuplicateNumbersTolerance(inputs: Inputs.Lists.RemoveDuplicatesToleranceDto<number>): number[];
207
- /**
208
- * Add item to the end of the list
209
- * @param inputs a list and an item
210
- * @returns list with added item
211
- * @group add
212
- * @shortname add item to list
213
- * @drawable false
214
- */
215
- addItem<T>(inputs: Inputs.Lists.AddItemDto<T>): T[];
216
- /**
217
- * Add item to the beginning of the list
218
- * @param inputs a list and an item
219
- * @returns list with added item
220
- * @group add
221
- * @shortname prepend item to list
222
- * @drawable false
223
- */
224
- prependItem<T>(inputs: Inputs.Lists.AddItemDto<T>): T[];
225
- /**
226
- * Add item to the beginning or the end of the list
227
- * @param inputs a list, item and an option for first or last position
228
- * @returns list with added item
229
- * @group add
230
- * @shortname item at first or last
231
- * @drawable false
232
- */
233
- addItemFirstLast<T>(inputs: Inputs.Lists.AddItemFirstLastDto<T>): T[];
234
- /**
235
- * Creates an empty list
236
- * @returns an empty array list
237
- * @group create
238
- * @shortname empty list
239
- * @drawable false
240
- */
241
- createEmptyList(): [];
242
- /**
243
- * Repeat the item and add it in the new list
244
- * @param inputs an item to multiply
245
- * @returns list
246
- * @group create
247
- * @shortname repeat
248
- * @drawable false
249
- */
250
- repeat<T>(inputs: Inputs.Lists.MultiplyItemDto<T>): T[];
251
- /**
252
- * Repeat the list items by adding them in the new list till the certain length of the list is reached
253
- * @param inputs a list to multiply and a length limit
254
- * @returns list
255
- * @group create
256
- * @shortname repeat in pattern
257
- * @drawable false
258
- */
259
- repeatInPattern<T>(inputs: Inputs.Lists.RepeatInPatternDto<T>): T[];
260
- /**
261
- * Sort the list of numbers in ascending or descending order
262
- * @param inputs a list of numbers to sort and an option for ascending or descending order
263
- * @returns list
264
- * @group sorting
265
- * @shortname sort numbers
266
- * @drawable false
267
- */
268
- sortNumber(inputs: Inputs.Lists.SortDto<number>): number[];
269
- /**
270
- * Sort the list of texts in ascending or descending order alphabetically
271
- * @param inputs a list of texts to sort and an option for ascending or descending order
272
- * @returns list
273
- * @group sorting
274
- * @shortname sort texts
275
- * @drawable false
276
- */
277
- sortTexts(inputs: Inputs.Lists.SortDto<string>): string[];
278
- /**
279
- * Sort by numeric JSON property value
280
- * @param inputs a list to sort, a property to sort by and an option for ascending or descending order
281
- * @returns list
282
- * @group sorting
283
- * @shortname sort json objects
284
- * @drawable false
285
- */
286
- sortByPropValue(inputs: Inputs.Lists.SortJsonDto<any>): any[];
287
- }
@@ -1,99 +0,0 @@
1
- import * as Inputs from "../inputs";
2
- /**
3
- * Contains various logic methods.
4
- */
5
- export declare class Logic {
6
- /**
7
- * Creates a boolean value - true or false
8
- * @param inputs a true or false boolean
9
- * @returns boolean
10
- * @group create
11
- * @shortname boolean
12
- * @drawable false
13
- */
14
- boolean(inputs: Inputs.Logic.BooleanDto): boolean;
15
- /**
16
- * Creates a random boolean list of predefined length
17
- * @param inputs a length and a threshold for randomization of true values
18
- * @returns booleans
19
- * @group create
20
- * @shortname random booleans
21
- * @drawable false
22
- */
23
- randomBooleans(inputs: Inputs.Logic.RandomBooleansDto): boolean[];
24
- /**
25
- * Creates a random boolean list of true and false values based on a list of numbers.
26
- * All values between true threshold will be true, all values above false threshold will be false,
27
- * and the rest will be distributed between true and false based on the number of levels in a gradient pattern.
28
- * That means that the closer the number gets to the false threshold the bigger the chance will be to get random false value.
29
- * @param inputs a length and a threshold for randomization of true values
30
- * @returns booleans
31
- * @group create
32
- * @shortname 2 threshold random gradient
33
- * @drawable false
34
- */
35
- twoThresholdRandomGradient(inputs: Inputs.Logic.TwoThresholdRandomGradientDto): boolean[];
36
- /**
37
- * Creates a boolean list based on a list of numbers and a threshold.
38
- * @param inputs a length and a threshold for randomization of true values
39
- * @returns booleans
40
- * @group create
41
- * @shortname threshold boolean list
42
- * @drawable false
43
- */
44
- thresholdBooleanList(inputs: Inputs.Logic.ThresholdBooleanListDto): boolean[];
45
- /**
46
- * Creates a boolean list based on a list of numbers and a gap thresholds. Gap thresholds are pairs of numbers that define a range of numbers that will be true.
47
- * @param inputs a length and a threshold for randomization of true values
48
- * @returns booleans
49
- * @group create
50
- * @shortname threshold gaps boolean list
51
- * @drawable false
52
- */
53
- thresholdGapsBooleanList(inputs: Inputs.Logic.ThresholdGapsBooleanListDto): boolean[];
54
- /**
55
- * Apply not operator on the boolean
56
- * @param inputs a true or false boolean
57
- * @returns boolean
58
- * @group edit
59
- * @shortname not
60
- * @drawable false
61
- */
62
- not(inputs: Inputs.Logic.BooleanDto): boolean;
63
- /**
64
- * Apply not operator on a list of booleans
65
- * @param inputs a list of true or false booleans
66
- * @returns booleans
67
- * @group edit
68
- * @shortname not list
69
- * @drawable false
70
- */
71
- notList(inputs: Inputs.Logic.BooleanListDto): boolean[];
72
- /**
73
- * Does comparison between first and second values
74
- * @param inputs two values to be compared
75
- * @returns Result of the comparison
76
- * @group operations
77
- * @shortname compare
78
- * @drawable false
79
- */
80
- compare<T>(inputs: Inputs.Logic.ComparisonDto<T>): boolean;
81
- /**
82
- * Transmits a value if boolean provided is true and undefined if boolean provided is false
83
- * @param inputs a value and a boolean value
84
- * @returns value or undefined
85
- * @group operations
86
- * @shortname value gate
87
- * @drawable false
88
- */
89
- valueGate<T>(inputs: Inputs.Logic.ValueGateDto<T>): T | undefined;
90
- /**
91
- * Returns first defined value out of two
92
- * @param inputs two values
93
- * @returns value or undefined
94
- * @group operations
95
- * @shortname first defined value gate
96
- * @drawable false
97
- */
98
- firstDefinedValueGate<T, U>(inputs: Inputs.Logic.TwoValueGateDto<T, U>): T | U | undefined;
99
- }