@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.
- package/babel.config.cjs +1 -0
- package/babel.config.d.cts +5 -0
- package/index.d.ts +1 -0
- package/{index.ts → index.js} +1 -2
- package/lib/api/index.js +1 -0
- package/lib/api/inputs/base-inputs.d.ts +35 -0
- package/lib/api/inputs/base-inputs.js +1 -0
- package/lib/api/inputs/{color-inputs.ts → color-inputs.d.ts} +26 -48
- package/lib/api/inputs/color-inputs.js +164 -0
- package/lib/api/inputs/index.js +9 -0
- package/lib/api/inputs/inputs.js +9 -0
- package/lib/api/inputs/{lists-inputs.ts → lists-inputs.d.ts} +91 -190
- package/lib/api/inputs/lists-inputs.js +576 -0
- package/lib/api/inputs/{logic-inputs.ts → logic-inputs.d.ts} +24 -46
- package/lib/api/inputs/logic-inputs.js +111 -0
- package/lib/api/inputs/{math-inputs.ts → math-inputs.d.ts} +53 -97
- package/lib/api/inputs/math-inputs.js +391 -0
- package/lib/api/inputs/{point-inputs.ts → point-inputs.d.ts} +77 -168
- package/lib/api/inputs/point-inputs.js +521 -0
- package/lib/api/inputs/text-inputs.d.ts +83 -0
- package/lib/api/inputs/text-inputs.js +120 -0
- package/lib/api/inputs/{transforms-inputs.ts → transforms-inputs.d.ts} +35 -64
- package/lib/api/inputs/transforms-inputs.js +200 -0
- package/lib/api/inputs/{vector-inputs.ts → vector-inputs.d.ts} +48 -104
- package/lib/api/inputs/vector-inputs.js +304 -0
- package/lib/api/services/color.d.ts +114 -0
- package/lib/api/services/{color.ts → color.js} +15 -34
- package/lib/api/services/geometry-helper.d.ts +15 -0
- package/lib/api/services/{geometry-helper.ts → geometry-helper.js} +31 -43
- package/lib/api/services/{index.ts → index.d.ts} +1 -1
- package/lib/api/services/index.js +9 -0
- package/lib/api/services/lists.d.ts +287 -0
- package/lib/api/services/{lists.ts → lists.js} +59 -83
- package/lib/api/services/logic.d.ts +99 -0
- package/lib/api/services/{logic.ts → logic.js} +24 -32
- package/lib/api/services/math.d.ts +349 -0
- package/lib/api/services/{math.ts → math.js} +71 -136
- package/lib/api/services/point.d.ts +222 -0
- package/lib/api/services/{point.ts → point.js} +32 -67
- package/lib/api/services/text.d.ts +69 -0
- package/lib/api/services/{text.ts → text.js} +7 -17
- package/lib/api/services/transforms.d.ts +122 -0
- package/lib/api/services/{transforms.ts → transforms.js} +37 -83
- package/lib/api/services/vector.d.ts +320 -0
- package/lib/api/services/{vector.ts → vector.js} +42 -80
- package/lib/{index.ts → index.d.ts} +0 -1
- package/lib/index.js +1 -0
- package/package.json +1 -1
- package/lib/api/inputs/base-inputs.ts +0 -18
- package/lib/api/inputs/text-inputs.ts +0 -108
- package/lib/api/services/color.test.ts +0 -86
- package/lib/api/services/lists.test.ts +0 -612
- package/lib/api/services/logic.test.ts +0 -187
- package/lib/api/services/math.test.ts +0 -622
- package/lib/api/services/text.test.ts +0 -55
- package/lib/api/services/vector.test.ts +0 -360
- package/tsconfig.bitbybit.json +0 -26
- package/tsconfig.json +0 -24
- /package/lib/api/{index.ts → index.d.ts} +0 -0
- /package/lib/api/inputs/{index.ts → index.d.ts} +0 -0
- /package/lib/api/inputs/{inputs.ts → inputs.d.ts} +0 -0
|
@@ -0,0 +1,287 @@
|
|
|
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
|
+
}
|