@nordcraft/std-lib 1.0.88 → 1.0.89

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/dist/lib.ts CHANGED
@@ -1,363 +1,261 @@
1
1
 
2
2
  export const formulas = {
3
- "@toddle/append": {
3
+ "@toddle/string": {
4
4
  "$schema": "../../schemas/libFormula.schema.json",
5
- "name": "Append",
6
- "description": "Add an element to the end of an Array.",
5
+ "name": "String",
6
+ "description": "Convert a value of any type to a String.",
7
7
  "arguments": [
8
8
  {
9
- "name": "Array",
10
- "type": {
11
- "type": "Array"
12
- },
13
- "description": "The Array to append to.",
14
- "formula": {
15
- "type": "array",
16
- "arguments": []
17
- }
18
- },
19
- {
20
- "name": "Item",
9
+ "name": "Input",
10
+ "description": "Value of any type.",
21
11
  "type": {
22
12
  "type": "Any"
23
13
  },
24
- "description": "The item to append to the Array.",
25
14
  "formula": {
26
15
  "type": "value",
27
- "value": "Item"
16
+ "value": "1"
28
17
  }
29
18
  }
30
19
  ],
31
20
  "output": {
32
- "description": "A new Array containing all elements from the input Array, including the new item.",
21
+ "description": "The input value converted to a String",
33
22
  "type": {
34
- "type": "Array"
23
+ "type": "String"
35
24
  }
36
25
  }
37
26
  },
38
- "@toddle/timestamp": {
27
+ "@toddle/languages": {
39
28
  "$schema": "../../schemas/libFormula.schema.json",
40
- "name": "Timestamp",
41
- "description": "Get the timestamp from a Date, e.g. 1633462980000.",
42
- "arguments": [
43
- {
44
- "name": "Date",
45
- "description": "The date to get the timestamp from.",
46
- "type": {
47
- "type": "Date"
48
- },
49
- "formula": {
50
- "type": "value",
51
- "value": null
52
- }
53
- }
54
- ],
29
+ "name": "Languages",
30
+ "description": "An array of the preferred languages for the user, based on the Navigator.languages property (on the client) or the Accept-Language header (on the server).",
31
+ "arguments": [],
55
32
  "output": {
56
- "description": "The timestamp from the date input.",
33
+ "description": "An array with the preferred languages for the user.",
57
34
  "type": {
58
- "type": "Number"
35
+ "type": "Array"
59
36
  }
60
37
  }
61
38
  },
62
- "@toddle/not": {
39
+ "@toddle/matches": {
63
40
  "$schema": "../../schemas/libFormula.schema.json",
64
- "name": "Not",
65
- "description": "Get the Boolean opposite of an input value.",
41
+ "name": "Matches",
42
+ "description": "Finds the (global) matches in a String based on a regular expression.",
66
43
  "arguments": [
67
44
  {
68
45
  "name": "Input",
69
46
  "formula": {
70
47
  "type": "value",
71
- "value": true
48
+ "value": ""
72
49
  },
73
- "description": "The input value.",
50
+ "description": "The string to search for matches in.",
74
51
  "type": {
75
- "type": "Boolean"
52
+ "type": "String"
76
53
  }
77
- }
78
- ],
79
- "output": {
80
- "description": "Returns True if the input value is False, and False if the input value is True.",
81
- "type": {
82
- "type": "Boolean"
83
- }
84
- }
85
- },
86
- "@toddle/some": {
87
- "$schema": "../../schemas/libFormula.schema.json",
88
- "name": "Some",
89
- "description": "Run a formula on all items of an Array to determine if any item matches a set of conditions.",
90
- "arguments": [
54
+ },
91
55
  {
92
- "name": "Array",
56
+ "name": "Regular expression",
93
57
  "formula": {
94
58
  "type": "value",
95
- "value": null
59
+ "value": ""
96
60
  },
97
- "description": "The Array of items to evaluate.",
61
+ "description": "The regular expression to use for matching.",
98
62
  "type": {
99
- "type": "Array"
63
+ "type": "String"
100
64
  }
101
65
  },
102
66
  {
103
- "name": "Formula",
104
- "isFunction": true,
67
+ "name": "Global search",
105
68
  "formula": {
106
- "type": "path",
107
- "path": [
108
- "Args",
109
- "item"
110
- ]
69
+ "type": "value",
70
+ "value": true
111
71
  },
112
- "description": "Predicate formula for evaluating each item.",
72
+ "description": "Test the regular expression against all possible matches in a string.",
113
73
  "type": {
114
- "type": "Formula"
74
+ "type": "Boolean"
115
75
  }
116
- }
117
- ],
118
- "output": {
119
- "description": "Returns True if the predicate formula returns True for any items in the Array, otherwise False.",
120
- "type": {
121
- "type": "Boolean"
122
- }
123
- }
124
- },
125
- "@toddle/includes": {
126
- "$schema": "../../schemas/libFormula.schema.json",
127
- "name": "Includes",
128
- "description": "Test if an Array or String includes a specific item or value.and [String.prototype.includes on MDN]() for more information.",
129
- "arguments": [
76
+ },
130
77
  {
131
- "name": "Array",
78
+ "name": "Case insensitive",
132
79
  "formula": {
133
80
  "type": "value",
134
- "value": ""
81
+ "value": false
135
82
  },
136
- "description": "The value to search.",
83
+ "description": "Ignore case while attempting a match in a string.",
137
84
  "type": {
138
- "type": "Array \\| String"
85
+ "type": "Boolean"
139
86
  }
140
87
  },
141
88
  {
142
- "name": "Item",
89
+ "name": "Multi line",
143
90
  "formula": {
144
91
  "type": "value",
145
- "value": ""
92
+ "value": false
146
93
  },
147
- "description": "The item or value to search for.",
94
+ "description": "Treat multiline strings as multiple lines.",
148
95
  "type": {
149
- "type": "Any"
96
+ "type": "Boolean"
150
97
  }
151
98
  }
152
99
  ],
153
100
  "output": {
154
- "description": "Returns True if the item or value exists in the Array or string. Returns False if no match is found.",
101
+ "description": "An Array of Strings",
155
102
  "type": {
156
- "type": "Boolean"
103
+ "type": "Array"
157
104
  }
158
105
  }
159
106
  },
160
- "@toddle/dateFromTimestamp": {
107
+ "@toddle/decodeURIComponent": {
161
108
  "$schema": "../../schemas/libFormula.schema.json",
162
- "name": "Date From Timestamp",
109
+ "name": "Decode URI Component",
110
+ "description": "Decode a URI component that was previously encoded with the Encode URI Component formula.",
163
111
  "arguments": [
164
112
  {
165
- "name": "Timestamp",
166
- "description": "A Number in milliseconds since 1st January, 1970 (EPOCH).",
167
- "type": {
168
- "type": "Number"
169
- },
113
+ "name": "EncodedURI",
170
114
  "formula": {
171
115
  "type": "value",
172
- "value": 1687787245933
173
- }
116
+ "value": null
117
+ },
118
+ "type": {
119
+ "type": "String"
120
+ },
121
+ "description": "The encoded URI to decode."
174
122
  }
175
123
  ],
176
- "description": "Convert a timestamp (milliseconds) to a Date.",
177
124
  "output": {
178
- "description": "The input value converted to a Date.",
125
+ "description": "The decoded URI component.",
179
126
  "type": {
180
- "type": "Date"
127
+ "type": "String"
181
128
  }
182
129
  }
183
130
  },
184
- "@toddle/sort_by": {
131
+ "@toddle/logarithm": {
185
132
  "$schema": "../../schemas/libFormula.schema.json",
186
- "name": "Sort by",
187
- "description": "Sort an Array using a formula.",
133
+ "name": "Logarithm",
134
+ "description": "Return the logarithm of a Number.",
188
135
  "arguments": [
189
136
  {
190
- "name": "Array",
137
+ "name": "Number",
191
138
  "formula": {
192
139
  "type": "value",
193
- "value": []
140
+ "value": 1
194
141
  },
142
+ "description": "A Number greater than or equal to 0.",
195
143
  "type": {
196
- "type": "Array"
197
- },
198
- "description": "The input Array."
144
+ "type": "Number"
145
+ }
146
+ }
147
+ ],
148
+ "output": {
149
+ "type": {
150
+ "type": "Number"
199
151
  },
152
+ "description": "The natural logarithm of the Number."
153
+ }
154
+ },
155
+ "@toddle/boolean": {
156
+ "$schema": "../../schemas/libFormula.schema.json",
157
+ "name": "Boolean",
158
+ "description": "Convert a value of any type to a Boolean.",
159
+ "arguments": [
200
160
  {
201
- "name": "Formula",
202
- "formula": {
203
- "type": "path",
204
- "path": [
205
- "Args",
206
- "item"
207
- ]
208
- },
161
+ "name": "Input",
162
+ "description": "Value of any type.",
209
163
  "type": {
210
- "type": "Formula"
164
+ "type": "Any"
211
165
  },
212
- "isFunction": true,
213
- "description": "The sorting formula. The output of this formula will determine the sort order of the items. If the formula returns an Array, the items will first be sorted by the first item, then the second, etc."
214
- },
215
- {
216
- "name": "Ascending?",
217
166
  "formula": {
218
167
  "type": "value",
219
- "value": true
220
- },
221
- "type": {
222
- "type": "Boolean"
223
- },
224
- "description": "Should the list be sorted in ascending order?"
168
+ "value": "1"
169
+ }
225
170
  }
226
171
  ],
227
172
  "output": {
228
- "description": "The input Array sorted by the value returned by the sorting formula.",
173
+ "description": "The input value converted to a Boolean. False and Null will return False, all other values will return True.",
229
174
  "type": {
230
- "type": "Number"
175
+ "type": "Boolean"
231
176
  }
232
177
  }
233
178
  },
234
- "@toddle/parseJSON": {
179
+ "@toddle/capitalize": {
235
180
  "$schema": "../../schemas/libFormula.schema.json",
236
- "name": "Parse JSON",
237
- "description": "Parse a String to JSON.",
181
+ "name": "Capitalize",
182
+ "description": "Capitalize a string: make the first letter uppercase whilst keeping the rest lowercase.",
238
183
  "arguments": [
239
184
  {
240
- "name": "JSON string",
185
+ "name": "String",
241
186
  "formula": {
242
187
  "type": "value",
243
- "value": null
188
+ "value": "string"
244
189
  },
245
- "description": "The String to be parsed.",
190
+ "description": "An input String.",
246
191
  "type": {
247
192
  "type": "String"
248
193
  }
249
194
  }
250
195
  ],
251
196
  "output": {
252
- "description": "The parsed JSON value. If the input is not a valid String, this returns Null.",
197
+ "description": "The capitalized String.",
253
198
  "type": {
254
- "type": "Any"
199
+ "type": "String"
255
200
  }
256
201
  }
257
202
  },
258
- "@toddle/dropLast": {
203
+ "@toddle/power": {
259
204
  "$schema": "../../schemas/libFormula.schema.json",
260
- "name": "Drop last",
261
- "description": "Remove item(s) from the end of an Array or String.",
205
+ "name": "Power",
206
+ "description": "Raise a number to a power.",
262
207
  "arguments": [
263
208
  {
264
- "name": "Array",
209
+ "name": "Base",
265
210
  "formula": {
266
211
  "type": "value",
267
- "value": null
212
+ "value": 3
268
213
  },
269
- "description": "The input value.",
214
+ "description": "The number to be raised to the exponent.",
270
215
  "type": {
271
- "type": "Array \\| String"
216
+ "type": "Number"
272
217
  }
273
218
  },
274
219
  {
275
- "name": "Count",
220
+ "name": "Exponent",
276
221
  "formula": {
277
222
  "type": "value",
278
- "value": 1
223
+ "value": 2
279
224
  },
225
+ "description": "The exponent to raise the base to.",
280
226
  "type": {
281
227
  "type": "Number"
282
- },
283
- "description": "Number of items to remove."
228
+ }
284
229
  }
285
230
  ],
286
231
  "output": {
287
- "description": "A copy of the list without the last item(s).",
288
- "type": {
289
- "type": "Array \\| String"
290
- }
291
- }
292
- },
293
- "@toddle/multiply": {
294
- "$schema": "../../schemas/libFormula.schema.json",
295
- "name": "Multiply",
296
- "description": "Multiply two or more Numbers.",
297
- "arguments": [
298
- {
299
- "name": "0",
300
- "formula": {
301
- "type": "value",
302
- "value": 1
303
- },
304
- "type": {
305
- "type": "Number"
306
- },
307
- "description": "Number to be multiplied."
308
- },
309
- {
310
- "name": "1",
311
- "formula": {
312
- "type": "value",
313
- "value": 1
314
- },
315
- "type": {
316
- "type": "Number"
317
- },
318
- "description": "Number to be multiplied."
319
- }
320
- ],
321
- "variableArguments": true,
322
- "output": {
323
- "description": "The product of multiplying the input Numbers.",
324
232
  "type": {
325
233
  "type": "Number"
326
- }
234
+ },
235
+ "description": "The result of raising the base to the exponent."
327
236
  }
328
237
  },
329
- "@toddle/lastIndexOf": {
238
+ "@toddle/encodeURIComponent": {
330
239
  "$schema": "../../schemas/libFormula.schema.json",
331
- "name": "Last Index of",
332
- "description": "Search an Array or String to find the index of the last occurrence of a specified item or substring.",
240
+ "name": "Encode URI Component",
241
+ "description": "Encode a URI component, escaping certain characters to their UTF-8 representation.",
333
242
  "arguments": [
334
243
  {
335
- "name": "Array",
336
- "formula": {
337
- "type": "value",
338
- "value": ""
339
- },
340
- "description": "The value to search.",
341
- "type": {
342
- "type": "Array \\| String"
343
- }
344
- },
345
- {
346
- "name": "Item",
244
+ "name": "URIComponent",
347
245
  "formula": {
348
246
  "type": "value",
349
- "value": ""
247
+ "value": null
350
248
  },
351
- "description": "The item or substring to search for.",
249
+ "description": "The URI component to encode.",
352
250
  "type": {
353
- "type": "Any"
251
+ "type": "String"
354
252
  }
355
253
  }
356
254
  ],
357
255
  "output": {
358
- "description": "If the item or substring exists in the Array, the last index of that item is returned. If the item is not found, -1 is returned.",
256
+ "description": "The encoded URI component.",
359
257
  "type": {
360
- "type": "Number"
258
+ "type": "String"
361
259
  }
362
260
  }
363
261
  },
@@ -385,247 +283,255 @@
385
283
  }
386
284
  }
387
285
  },
388
- "@toddle/reduce": {
286
+ "@toddle/encodeJSON": {
389
287
  "$schema": "../../schemas/libFormula.schema.json",
390
- "name": "Reduce",
391
- "description": "Reduce a group of items to a single value by applying each item to a reducer formula.",
288
+ "name": "Encode JSON",
289
+ "description": "Encode data as JSON.",
392
290
  "arguments": [
393
291
  {
394
- "name": "Array",
395
- "formula": {
396
- "type": "value",
397
- "value": null
398
- },
399
- "description": "The Array or Object of items to be reduced.",
400
- "type": {
401
- "type": "Array \\| Object"
402
- }
403
- },
404
- {
405
- "name": "Formula",
406
- "isFunction": true,
292
+ "name": "Data",
407
293
  "formula": {
408
294
  "type": "value",
409
295
  "value": null
410
296
  },
411
- "description": "The reducer formula. Each item in the Array is applied to the formula along with the accumulator. The result of this formula will be a new accumulator used for the next item.",
297
+ "description": "The data to convert.",
412
298
  "type": {
413
- "type": "Formula"
299
+ "type": "Any"
414
300
  }
415
301
  },
416
302
  {
417
- "name": "Accumulator",
303
+ "name": "Indent",
418
304
  "formula": {
419
305
  "type": "value",
420
- "value": null
306
+ "value": 2
421
307
  },
422
- "description": "The initial value of the accumulator. This value is passed to the reducer formula along with the first item in the Array, and the result is used as the accumulator for the next item.",
308
+ "description": "How many characters the encoded value will be indented.",
423
309
  "type": {
424
- "type": "Any"
310
+ "type": "Number"
425
311
  }
426
312
  }
427
313
  ],
428
314
  "output": {
429
- "description": "The value returned from applying the last item to the reducer formula.",
315
+ "description": "The encoded JSON value.",
430
316
  "type": {
431
- "type": "Any"
317
+ "type": "String"
432
318
  }
433
319
  }
434
320
  },
435
- "@toddle/defaultTo": {
321
+ "@toddle/takeLast": {
436
322
  "$schema": "../../schemas/libFormula.schema.json",
437
- "name": "Default to",
438
- "description": "Return the first value that is not False or Null.",
323
+ "name": "Take last",
324
+ "description": "Take items from the end of an Array or String.",
439
325
  "arguments": [
440
326
  {
441
- "name": "0",
327
+ "name": "Array",
442
328
  "formula": {
443
329
  "type": "value",
444
330
  "value": null
445
331
  },
446
- "description": "The inital value.",
332
+ "description": "The input value.",
447
333
  "type": {
448
- "type": "Any"
334
+ "type": "Array \\| String"
449
335
  }
450
336
  },
451
337
  {
452
- "name": "1",
453
- "description": "The first fallback value to be used if the primary value is Null or False.",
454
- "type": {
455
- "type": "Any"
456
- },
338
+ "name": "Count",
457
339
  "formula": {
458
340
  "type": "value",
459
- "value": "default"
341
+ "value": 1
342
+ },
343
+ "description": "Number of items to take.",
344
+ "type": {
345
+ "type": "Number"
460
346
  }
461
347
  }
462
348
  ],
463
- "variableArguments": true,
464
349
  "output": {
465
- "description": "Returns the first value that is not False or Null. Returns Null if no valid values is given.",
350
+ "description": "The last items from the Array or String.",
466
351
  "type": {
467
- "type": "Any"
352
+ "type": "Array \\| String"
468
353
  }
469
354
  }
470
355
  },
471
- "@toddle/indexOf": {
356
+ "@toddle/dateFromTimestamp": {
472
357
  "$schema": "../../schemas/libFormula.schema.json",
473
- "name": "Index of",
474
- "description": "Find the index of a specific item in an Array or String.and [String.prototype.indexOf on MDN]() for more information.",
358
+ "name": "Date From Timestamp",
475
359
  "arguments": [
476
360
  {
477
- "name": "Array",
478
- "formula": {
479
- "type": "value",
480
- "value": ""
481
- },
482
- "description": "The value to search.",
361
+ "name": "Timestamp",
362
+ "description": "A Number in milliseconds since 1st January, 1970 (EPOCH).",
483
363
  "type": {
484
- "type": "Array \\| String"
485
- }
486
- },
487
- {
488
- "name": "Item",
364
+ "type": "Number"
365
+ },
489
366
  "formula": {
490
367
  "type": "value",
491
- "value": ""
492
- },
493
- "description": "The items to search for.",
494
- "type": {
495
- "type": "Any"
368
+ "value": 1687787245933
496
369
  }
497
370
  }
498
371
  ],
372
+ "description": "Convert a timestamp (milliseconds) to a Date.",
499
373
  "output": {
500
- "description": "If the item exists in the Array, the index of that item is returned. If the item is not found, -1 is returned.",
374
+ "description": "The input value converted to a Date.",
501
375
  "type": {
502
- "type": "Number"
376
+ "type": "Date"
503
377
  }
504
378
  }
505
379
  },
506
- "@toddle/getHttpOnlyCookie": {
380
+ "@toddle/join": {
507
381
  "$schema": "../../schemas/libFormula.schema.json",
508
- "name": "Get Http-Only Cookie",
509
- "description": "Get the value of an Http-Only cookie by name. This formula is only intended to be used server-side for SSR/proxied API requests to read Http-Only cookies.",
382
+ "name": "Join",
383
+ "description": "Combine an Array of Strings into a single String.",
510
384
  "arguments": [
511
385
  {
512
- "name": "Cookie name",
386
+ "name": "Array",
513
387
  "formula": {
514
388
  "type": "value",
515
389
  "value": null
516
390
  },
517
- "description": "The name of the Http-Only cookie you want to get the value of.",
391
+ "description": "An array of Strings.",
518
392
  "type": {
519
- "type": "String"
393
+ "type": "Array"
520
394
  }
521
- }
522
- ],
523
- "output": {
524
- "description": "The value of the cookie. If no cookie is found, this will return Null. If you use this formula client-side, it will return a placeholder template string.",
525
- "type": {
526
- "type": "String"
527
- }
528
- }
529
- },
530
- "@toddle/shuffle": {
531
- "$schema": "../../schemas/libFormula.schema.json",
532
- "name": "Shuffle",
533
- "description": "Shuffle items in an Array or String.",
534
- "cache": false,
535
- "arguments": [
395
+ },
536
396
  {
537
- "name": "Array",
397
+ "name": "Separator",
538
398
  "formula": {
539
399
  "type": "value",
540
- "value": null
400
+ "value": ", "
541
401
  },
542
- "description": "The input value.",
402
+ "description": "A separator String that is inserted in between each item in the Array to join.",
543
403
  "type": {
544
- "type": "Array \\| String"
404
+ "type": "String"
545
405
  }
546
406
  }
547
407
  ],
548
408
  "output": {
549
- "description": "The shuffled Array or String.",
409
+ "description": "A String combining each item in the input Array separated by the separator String, e.g. joining [\"a\", \"b\", \"c\"] with a \",\" separator will return \"a,b,c\".",
550
410
  "type": {
551
- "type": "Array \\| String"
411
+ "type": "String"
552
412
  }
553
413
  }
554
414
  },
555
- "@toddle/lessThan": {
415
+ "@toddle/clamp": {
556
416
  "$schema": "../../schemas/libFormula.schema.json",
557
- "name": "Less than",
558
- "description": "Compute if a value is smaller than another value.",
417
+ "name": "Clamp",
418
+ "description": "Limit a value to a specified Min and Max value.",
559
419
  "arguments": [
560
420
  {
561
- "name": "First",
421
+ "name": "Value",
422
+ "type": {
423
+ "type": "Number"
424
+ },
562
425
  "formula": {
563
426
  "type": "value",
564
- "value": ""
427
+ "value": null
565
428
  },
566
- "description": "First Number to be compared.",
429
+ "description": "Number to round."
430
+ },
431
+ {
432
+ "name": "Min",
567
433
  "type": {
568
434
  "type": "Number"
435
+ },
436
+ "description": "The smallest allowed Number.",
437
+ "formula": {
438
+ "type": "value",
439
+ "value": 0
569
440
  }
570
441
  },
571
442
  {
572
- "name": "Second",
573
- "formula": {
574
- "type": "value",
575
- "value": ""
576
- },
577
- "description": "Second Number to be compared.",
443
+ "name": "Max",
578
444
  "type": {
579
445
  "type": "Number"
446
+ },
447
+ "description": "The largest allowed Number.",
448
+ "formula": {
449
+ "type": "value",
450
+ "value": 100
580
451
  }
581
452
  }
582
453
  ],
583
454
  "output": {
584
- "description": "Returns True if the First Number is smaller than the second Number, otherwise it returns False.",
585
455
  "type": {
586
- "type": "Boolean"
587
- }
456
+ "type": "Number"
457
+ },
458
+ "description": "Returns the input value if between the specified Min and Max. Otherwise, it returns the Min or Max value."
588
459
  }
589
460
  },
590
- "@toddle/modulo": {
461
+ "@toddle/roundDown": {
591
462
  "$schema": "../../schemas/libFormula.schema.json",
592
- "name": "Modulo",
593
- "description": "Get the remainder when dividing two Numbers.",
463
+ "name": "Round down",
464
+ "description": "Round a Number down to the nearest decimal point.",
594
465
  "arguments": [
595
466
  {
596
- "name": "Dividend",
597
- "formula": {
598
- "type": "value",
599
- "value": 1
600
- },
601
- "description": "The number to be divided.",
467
+ "name": "Input",
468
+ "description": "Number to round down.",
602
469
  "type": {
603
470
  "type": "Number"
471
+ },
472
+ "formula": {
473
+ "type": "value",
474
+ "value": 1
604
475
  }
605
476
  },
606
477
  {
607
- "name": "Divider",
478
+ "name": "Decimals",
479
+ "description": "Number of decimals to round to.",
480
+ "type": {
481
+ "type": "Number"
482
+ },
483
+ "formula": {
484
+ "type": "value",
485
+ "value": 0
486
+ }
487
+ }
488
+ ],
489
+ "output": {
490
+ "type": {
491
+ "type": "Number"
492
+ },
493
+ "description": "The rounded Number."
494
+ }
495
+ },
496
+ "@toddle/minus": {
497
+ "$schema": "../../schemas/libFormula.schema.json",
498
+ "name": "Minus",
499
+ "description": "Subtract a Number from a Number.",
500
+ "arguments": [
501
+ {
502
+ "name": "Minuend",
608
503
  "formula": {
609
504
  "type": "value",
610
505
  "value": 1
611
506
  },
612
- "description": "The number to divide by.",
507
+ "description": "The number to subtract from.",
508
+ "type": {
509
+ "type": "Number"
510
+ }
511
+ },
512
+ {
513
+ "name": "Substrahend",
514
+ "formula": {
515
+ "type": "value",
516
+ "value": 1
517
+ },
518
+ "description": "The number to subtract.",
613
519
  "type": {
614
520
  "type": "Number"
615
521
  }
616
522
  }
617
523
  ],
618
524
  "output": {
619
- "description": "The remainder when the Dividend is divided by the Divider.",
525
+ "description": "The result of subtracting the Substrahend from the Minuend.",
620
526
  "type": {
621
527
  "type": "Number"
622
528
  }
623
529
  }
624
530
  },
625
- "@toddle/unique": {
531
+ "@toddle/sort_by": {
626
532
  "$schema": "../../schemas/libFormula.schema.json",
627
- "name": "Unique",
628
- "description": "Remove duplicate values from an Array.",
533
+ "name": "Sort by",
534
+ "description": "Sort an Array using a formula.",
629
535
  "arguments": [
630
536
  {
631
537
  "name": "Array",
@@ -637,128 +543,198 @@
637
543
  "type": "Array"
638
544
  },
639
545
  "description": "The input Array."
546
+ },
547
+ {
548
+ "name": "Formula",
549
+ "formula": {
550
+ "type": "path",
551
+ "path": [
552
+ "Args",
553
+ "item"
554
+ ]
555
+ },
556
+ "type": {
557
+ "type": "Formula"
558
+ },
559
+ "isFunction": true,
560
+ "description": "The sorting formula. The output of this formula will determine the sort order of the items. If the formula returns an Array, the items will first be sorted by the first item, then the second, etc."
561
+ },
562
+ {
563
+ "name": "Ascending?",
564
+ "formula": {
565
+ "type": "value",
566
+ "value": true
567
+ },
568
+ "type": {
569
+ "type": "Boolean"
570
+ },
571
+ "description": "Should the list be sorted in ascending order?"
640
572
  }
641
573
  ],
642
574
  "output": {
643
- "description": "The input Array with all duplicate values removed.",
575
+ "description": "The input Array sorted by the value returned by the sorting formula.",
644
576
  "type": {
645
- "type": "Array"
577
+ "type": "Number"
646
578
  }
647
579
  }
648
580
  },
649
- "@toddle/trim": {
581
+ "@toddle/map": {
650
582
  "$schema": "../../schemas/libFormula.schema.json",
651
- "name": "Trim",
652
- "description": "Remove any leading and trailing white spaces from a String.",
583
+ "name": "Map",
584
+ "description": "Run a formula on each item of an Array to return a new Array.",
653
585
  "arguments": [
654
586
  {
655
- "name": "String",
587
+ "name": "Array",
656
588
  "formula": {
657
589
  "type": "value",
658
- "value": ""
590
+ "value": null
659
591
  },
660
- "description": "The String to trim.",
592
+ "description": "The Array of items.",
661
593
  "type": {
662
- "type": "String"
594
+ "type": "Array"
595
+ }
596
+ },
597
+ {
598
+ "name": "Formula",
599
+ "isFunction": true,
600
+ "formula": {
601
+ "type": "path",
602
+ "path": [
603
+ "Args",
604
+ "item"
605
+ ]
606
+ },
607
+ "description": "The formula to run on each item of the Array.",
608
+ "type": {
609
+ "type": "Formula"
663
610
  }
664
611
  }
665
612
  ],
666
613
  "output": {
667
- "description": "The trimmed String.",
614
+ "description": "A new Array containing all the values returned from running the provided formula on each item in the provided input Array.",
668
615
  "type": {
669
- "type": "String"
616
+ "type": "Array"
670
617
  }
671
618
  }
672
619
  },
673
- "@toddle/encodeJSON": {
620
+ "@toddle/every": {
674
621
  "$schema": "../../schemas/libFormula.schema.json",
675
- "name": "Encode JSON",
676
- "description": "Encode data as JSON.",
622
+ "name": "Every",
623
+ "description": "Run a formula returns for all items in an Array.",
677
624
  "arguments": [
678
625
  {
679
- "name": "Data",
626
+ "name": "Array",
680
627
  "formula": {
681
628
  "type": "value",
682
629
  "value": null
683
630
  },
684
- "description": "The data to convert.",
631
+ "description": "The array of items to evaluate.",
685
632
  "type": {
686
- "type": "Any"
633
+ "type": "Array"
687
634
  }
688
635
  },
689
636
  {
690
- "name": "Indent",
637
+ "name": "Formula",
638
+ "isFunction": true,
691
639
  "formula": {
692
- "type": "value",
693
- "value": 2
640
+ "type": "path",
641
+ "path": [
642
+ "Args",
643
+ "item"
644
+ ]
694
645
  },
695
- "description": "How many characters the encoded value will be indented.",
646
+ "description": "Predicate formula for evaluating each item.",
696
647
  "type": {
697
- "type": "Number"
648
+ "type": "Formula"
698
649
  }
699
650
  }
700
651
  ],
701
652
  "output": {
702
- "description": "The encoded JSON value.",
653
+ "description": "Returns True if the predicate formula returns true for all items in the Array, otherwise False.",
703
654
  "type": {
704
- "type": "String"
655
+ "type": "Array"
705
656
  }
706
657
  }
707
658
  },
708
- "@toddle/add": {
659
+ "@toddle/sum": {
709
660
  "$schema": "../../schemas/libFormula.schema.json",
710
- "name": "Add",
661
+ "name": "Sum",
662
+ "description": "Return the sum of an Array of numbers.",
711
663
  "arguments": [
712
664
  {
713
- "name": "0",
714
- "description": "Number to be added.",
665
+ "name": "Array",
715
666
  "type": {
716
- "type": "Number"
667
+ "type": "Array"
717
668
  },
669
+ "description": "The array of numbers to sum.",
718
670
  "formula": {
719
- "type": "value",
720
- "value": 1
671
+ "type": "array",
672
+ "arguments": []
721
673
  }
722
- },
674
+ }
675
+ ],
676
+ "output": {
677
+ "description": "The total sum from adding all the numbers in the Array.",
678
+ "type": {
679
+ "type": "Number"
680
+ }
681
+ }
682
+ },
683
+ "@toddle/randomNumber": {
684
+ "$schema": "../../schemas/libFormula.schema.json",
685
+ "name": "Random number",
686
+ "description": "Return a random Number between 0 and 1.",
687
+ "arguments": [],
688
+ "cache": false,
689
+ "output": {
690
+ "description": "A random Number between 0 and 1.",
691
+ "type": {
692
+ "type": "Number"
693
+ }
694
+ }
695
+ },
696
+ "@toddle/squareRoot": {
697
+ "$schema": "../../schemas/libFormula.schema.json",
698
+ "name": "Square root",
699
+ "description": "Get the square root of a Number.",
700
+ "arguments": [
723
701
  {
724
- "name": "1",
725
- "type": {
726
- "type": "Number"
727
- },
728
- "description": "Number to be added.",
702
+ "name": "Number",
729
703
  "formula": {
730
704
  "type": "value",
731
705
  "value": 1
706
+ },
707
+ "description": "The input Number.",
708
+ "type": {
709
+ "type": "Number"
732
710
  }
733
711
  }
734
712
  ],
735
- "variableArguments": true,
736
- "description": "Get the sum of multiple numbers.",
737
713
  "output": {
738
- "description": "The sum of all the input numbers.",
714
+ "description": "The square root of the input Number.",
739
715
  "type": {
740
716
  "type": "Number"
741
717
  }
742
718
  }
743
719
  },
744
- "@toddle/formatNumber": {
720
+ "@toddle/formatDate": {
745
721
  "$schema": "../../schemas/libFormula.schema.json",
746
- "name": "Format Number",
722
+ "name": "Format Date",
747
723
  "arguments": [
748
724
  {
749
- "name": "Input",
750
- "description": "Number to format.",
725
+ "name": "Date",
726
+ "description": "Date to format",
751
727
  "type": {
752
- "type": "Number"
728
+ "type": "Date"
753
729
  },
754
730
  "formula": {
755
731
  "type": "value",
756
- "value": 100
732
+ "value": null
757
733
  }
758
734
  },
759
735
  {
760
736
  "name": "Locale(s)",
761
- "description": "Optional locale to use for formatting the Number, e.g. \"en\" or \"fr\". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.",
737
+ "description": "Optional locale to use for formatting the Date, e.g. \"en\" or \"fr\". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.",
762
738
  "type": {
763
739
  "type": "Array \\| String"
764
740
  },
@@ -769,7 +745,7 @@
769
745
  },
770
746
  {
771
747
  "name": "Options",
772
- "description": "Optional Object for configuring the formatting of the output. See the [NumberFormat locale options on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locale_options).",
748
+ "description": "Optional Object for configuring the formatting of the output. See the [DateTimeFormat syntax on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#syntax).",
773
749
  "type": {
774
750
  "type": "Object"
775
751
  },
@@ -779,160 +755,244 @@
779
755
  }
780
756
  }
781
757
  ],
782
- "description": "Format a Number using the Intl.NumberFormat API. See the [NumberFormat docs on MDN]().",
758
+ "description": "Format a date using the Intl.DateTimeFormat API. See the [DateTimeFormat docs on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat).",
783
759
  "output": {
784
- "description": "The Number input formatted as a String.",
760
+ "description": "The Date input formatted as a String.",
785
761
  "type": {
786
762
  "type": "String"
787
763
  }
788
764
  }
789
765
  },
790
- "@toddle/getCookie": {
766
+ "@toddle/modulo": {
791
767
  "$schema": "../../schemas/libFormula.schema.json",
792
- "name": "Get Cookie",
793
- "description": "Get the value of a cookie by name. This formula is available both server-side and client-side. Http-Only cookies will only be available server-side.",
768
+ "name": "Modulo",
769
+ "description": "Get the remainder when dividing two Numbers.",
794
770
  "arguments": [
795
771
  {
796
- "name": "Cookie name",
772
+ "name": "Dividend",
797
773
  "formula": {
798
774
  "type": "value",
799
- "value": null
775
+ "value": 1
800
776
  },
801
- "description": "The name of the cookie you want to get the value of.",
777
+ "description": "The number to be divided.",
802
778
  "type": {
803
- "type": "String"
779
+ "type": "Number"
780
+ }
781
+ },
782
+ {
783
+ "name": "Divider",
784
+ "formula": {
785
+ "type": "value",
786
+ "value": 1
787
+ },
788
+ "description": "The number to divide by.",
789
+ "type": {
790
+ "type": "Number"
804
791
  }
805
792
  }
806
793
  ],
807
794
  "output": {
808
- "description": "The value of the cookie. If a value is not found, this return value will be Null.",
795
+ "description": "The remainder when the Dividend is divided by the Divider.",
809
796
  "type": {
810
- "type": "String"
797
+ "type": "Number"
811
798
  }
812
799
  }
813
800
  },
814
- "@toddle/range": {
801
+ "@toddle/now": {
815
802
  "$schema": "../../schemas/libFormula.schema.json",
816
- "name": "Range",
817
- "description": "Create an Array of numbers between a Min and Max value.",
803
+ "name": "Now",
804
+ "description": "Get a Date representing \"Now\".",
805
+ "arguments": [],
806
+ "cache": false,
807
+ "output": {
808
+ "description": "A Date object initialized at the current date/time.",
809
+ "type": {
810
+ "type": "Date"
811
+ }
812
+ }
813
+ },
814
+ "@toddle/prepend": {
815
+ "$schema": "../../schemas/libFormula.schema.json",
816
+ "name": "Prepend",
817
+ "description": "Add an element to the start of an Array.",
818
+ "arguments": [
819
+ {
820
+ "name": "Array",
821
+ "type": {
822
+ "type": "Array"
823
+ },
824
+ "description": "The Array to prepend to.",
825
+ "formula": {
826
+ "type": "array",
827
+ "arguments": []
828
+ }
829
+ },
830
+ {
831
+ "name": "Item",
832
+ "type": {
833
+ "type": "Any"
834
+ },
835
+ "description": "The item to prepend to the Array.",
836
+ "formula": {
837
+ "type": "value",
838
+ "value": "Item"
839
+ }
840
+ }
841
+ ],
842
+ "output": {
843
+ "description": "A new Array containing the new item and all the elements from the input Array.",
844
+ "type": {
845
+ "type": "Array"
846
+ }
847
+ }
848
+ },
849
+ "@toddle/groupBy": {
850
+ "$schema": "../../schemas/libFormula.schema.json",
851
+ "name": "Group by",
852
+ "description": "Group an Array of items into an Object based on a grouping formula.",
818
853
  "arguments": [
819
854
  {
855
+ "name": "Array",
820
856
  "formula": {
821
857
  "type": "value",
822
- "value": 0
858
+ "value": null
823
859
  },
824
- "name": "Min",
825
- "description": "The smallest value in the list.",
860
+ "description": "Array of items to be grouped.",
826
861
  "type": {
827
- "type": "Number"
862
+ "type": "Array"
828
863
  }
829
864
  },
830
865
  {
831
- "name": "Max",
866
+ "name": "Formula",
867
+ "isFunction": true,
832
868
  "formula": {
833
869
  "type": "value",
834
- "value": 10
870
+ "value": null
835
871
  },
836
- "description": "The largest value in the list.",
872
+ "description": "The grouping formula used to group the items. The String returned from the formula will match the key in the output Oject.",
837
873
  "type": {
838
- "type": "Number"
874
+ "type": "Formula"
839
875
  }
840
876
  }
841
877
  ],
842
878
  "output": {
843
- "description": "An Array containing all the numbers between Min and Max, inclusive.",
879
+ "description": "An Object where each key matches a value returned by the grouping formula, and each value is the list of items that share the return value.",
844
880
  "type": {
845
- "type": "Array"
881
+ "type": "Object"
846
882
  }
847
883
  }
848
884
  },
849
- "@toddle/string": {
885
+ "@toddle/last": {
850
886
  "$schema": "../../schemas/libFormula.schema.json",
851
- "name": "String",
852
- "description": "Convert a value of any type to a String.",
887
+ "name": "Last",
888
+ "description": "Get the last item in an Array or the last character in a String.",
853
889
  "arguments": [
854
890
  {
855
- "name": "Input",
856
- "description": "Value of any type.",
857
- "type": {
858
- "type": "Any"
859
- },
891
+ "name": "Array",
860
892
  "formula": {
861
893
  "type": "value",
862
- "value": "1"
863
- }
894
+ "value": []
895
+ },
896
+ "type": {
897
+ "type": "Array \\| String"
898
+ },
899
+ "description": "An array of items or a String."
864
900
  }
865
901
  ],
866
902
  "output": {
867
- "description": "The input value converted to a String",
903
+ "description": "The last item in the Array or the last character in the String.",
868
904
  "type": {
869
- "type": "String"
905
+ "type": "Any"
870
906
  }
871
907
  }
872
908
  },
873
- "@toddle/parseURL": {
909
+ "@toddle/parseJSON": {
874
910
  "$schema": "../../schemas/libFormula.schema.json",
875
- "name": "Parse URL",
876
- "description": "Parse a URL.",
911
+ "name": "Parse JSON",
912
+ "description": "Parse a String to JSON.",
877
913
  "arguments": [
878
914
  {
879
- "name": "URL",
915
+ "name": "JSON string",
880
916
  "formula": {
881
917
  "type": "value",
882
918
  "value": null
883
919
  },
884
- "description": "The URL value to parse.",
920
+ "description": "The String to be parsed.",
885
921
  "type": {
886
922
  "type": "String"
887
923
  }
888
- },
924
+ }
925
+ ],
926
+ "output": {
927
+ "description": "The parsed JSON value. If the input is not a valid String, this returns Null.",
928
+ "type": {
929
+ "type": "Any"
930
+ }
931
+ }
932
+ },
933
+ "@toddle/uppercase": {
934
+ "$schema": "../../schemas/libFormula.schema.json",
935
+ "name": "Uppercase",
936
+ "description": "Convert a String to uppercase.",
937
+ "arguments": [
889
938
  {
890
- "name": "Base",
939
+ "name": "String",
891
940
  "formula": {
892
941
  "type": "value",
893
- "value": null
942
+ "value": "string"
894
943
  },
895
- "description": "An optional base for the URL. Use this to resolve relative URLs.",
944
+ "description": "Input String.",
896
945
  "type": {
897
946
  "type": "String"
898
947
  }
899
948
  }
900
949
  ],
901
950
  "output": {
902
- "description": "An object containing: \"hostname\", \"searchParams\", \"path\", \"hash\", \"href\", \"protocol\", \"port\", \"origin\"",
951
+ "description": "The input String with all characters converted to uppercase.",
903
952
  "type": {
904
- "type": "Object"
953
+ "type": "String"
905
954
  }
906
955
  }
907
956
  },
908
- "@toddle/typeOf": {
957
+ "@toddle/round": {
909
958
  "$schema": "../../schemas/libFormula.schema.json",
910
- "name": "Type of",
911
- "description": "Get the type of a given input.",
959
+ "name": "Round",
960
+ "description": "Round a Number to the nearest decimal point.",
912
961
  "arguments": [
913
962
  {
914
963
  "name": "Input",
964
+ "description": "Number to round.",
965
+ "type": {
966
+ "type": "Number"
967
+ },
915
968
  "formula": {
916
969
  "type": "value",
917
970
  "value": 1
918
- },
919
- "description": "The input value.",
971
+ }
972
+ },
973
+ {
974
+ "name": "Decimals",
975
+ "description": "Number of decimals to round to.",
920
976
  "type": {
921
- "type": "Any"
977
+ "type": "Number"
978
+ },
979
+ "formula": {
980
+ "type": "value",
981
+ "value": 0
922
982
  }
923
983
  }
924
984
  ],
925
985
  "output": {
926
- "description": "The type of the input value. Types can be one of: String, Boolean, Number, Array, Object, or Null.",
927
986
  "type": {
928
- "type": "Any"
929
- }
987
+ "type": "Number"
988
+ },
989
+ "description": "The rounded Number."
930
990
  }
931
991
  },
932
- "@toddle/find": {
992
+ "@toddle/dropLast": {
933
993
  "$schema": "../../schemas/libFormula.schema.json",
934
- "name": "Find",
935
- "description": "Search through an Array of items and apply a formula to each item, to return the first item where the provided formula returns True.",
994
+ "name": "Drop last",
995
+ "description": "Remove item(s) from the end of an Array or String.",
936
996
  "arguments": [
937
997
  {
938
998
  "name": "Array",
@@ -940,31 +1000,27 @@
940
1000
  "type": "value",
941
1001
  "value": null
942
1002
  },
943
- "description": "The array to search through",
1003
+ "description": "The input value.",
944
1004
  "type": {
945
- "type": "Array"
1005
+ "type": "Array \\| String"
946
1006
  }
947
1007
  },
948
1008
  {
949
- "name": "Formula",
950
- "isFunction": true,
1009
+ "name": "Count",
951
1010
  "formula": {
952
- "type": "path",
953
- "path": [
954
- "Args",
955
- "item"
956
- ]
1011
+ "type": "value",
1012
+ "value": 1
957
1013
  },
958
- "description": "The predicate formula that each item in the array is passed to.",
959
1014
  "type": {
960
- "type": "Formula"
961
- }
1015
+ "type": "Number"
1016
+ },
1017
+ "description": "Number of items to remove."
962
1018
  }
963
1019
  ],
964
1020
  "output": {
965
- "description": "The first item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.",
1021
+ "description": "A copy of the list without the last item(s).",
966
1022
  "type": {
967
- "type": "Any"
1023
+ "type": "Array \\| String"
968
1024
  }
969
1025
  }
970
1026
  },
@@ -1008,261 +1064,234 @@
1008
1064
  }
1009
1065
  ]
1010
1066
  },
1011
- "@toddle/dateFromString": {
1067
+ "@toddle/fromEntries": {
1012
1068
  "$schema": "../../schemas/libFormula.schema.json",
1013
- "name": "Date From String",
1069
+ "name": "From entries",
1070
+ "description": "Transform an Array of key-value pairs into an Object. This formula is the reverse of Entries.",
1014
1071
  "arguments": [
1015
1072
  {
1016
- "name": "Date string",
1017
- "description": "A String representing a date, for example \"January 1, 1970\".",
1018
- "type": {
1019
- "type": "String"
1020
- },
1073
+ "name": "Array",
1021
1074
  "formula": {
1022
1075
  "type": "value",
1023
- "value": "January 1, 1970"
1076
+ "value": null
1077
+ },
1078
+ "description": "An Array of Objects. Each Object should have a `key` and `value` property named `key` and `value` respectively e.g. `[{ key: 'yourKey', value: 'yourValue' }]`.",
1079
+ "type": {
1080
+ "type": "Array"
1024
1081
  }
1025
1082
  }
1026
1083
  ],
1027
- "description": "Convert a string to a Date.",
1028
1084
  "output": {
1029
- "description": "The input value converted to a Date.",
1085
+ "description": "An Object containing all entries from the input Array in the format `{yourKey: yourValue}`.",
1030
1086
  "type": {
1031
- "type": "Date"
1087
+ "type": "Object"
1032
1088
  }
1033
1089
  }
1034
1090
  },
1035
- "@toddle/getElementById": {
1091
+ "@toddle/greaterThan": {
1036
1092
  "$schema": "../../schemas/libFormula.schema.json",
1037
- "name": "Get element by id",
1038
- "description": "Return a DOM element with a given id.",
1039
- "cache": false,
1093
+ "name": "Greater than",
1094
+ "description": "Compute if a value is larger than another value.",
1040
1095
  "arguments": [
1041
1096
  {
1042
- "name": "Id",
1097
+ "name": "First",
1043
1098
  "formula": {
1044
1099
  "type": "value",
1045
- "value": "element-id"
1100
+ "value": ""
1046
1101
  },
1102
+ "description": "First value to be compared.",
1047
1103
  "type": {
1048
- "type": "String"
1104
+ "type": "Number"
1105
+ }
1106
+ },
1107
+ {
1108
+ "name": "Second",
1109
+ "formula": {
1110
+ "type": "value",
1111
+ "value": ""
1049
1112
  },
1050
- "description": "The id of the DOM element to return."
1113
+ "description": "Second value to be compared.",
1114
+ "type": {
1115
+ "type": "Number"
1116
+ }
1051
1117
  }
1052
1118
  ],
1053
1119
  "output": {
1054
- "description": "The DOM element with the given id. If no DOM element is found, this will return Null.",
1120
+ "description": "Returns True if the first Number is larger than the second Number.",
1055
1121
  "type": {
1056
- "type": "Element"
1122
+ "type": "Boolean"
1057
1123
  }
1058
1124
  }
1059
1125
  },
1060
- "@toddle/flatten": {
1126
+ "@toddle/includes": {
1061
1127
  "$schema": "../../schemas/libFormula.schema.json",
1062
- "name": "Flatten",
1063
- "description": "Flatten a nested Array.",
1128
+ "name": "Includes",
1129
+ "description": "Test if an Array or String includes a specific item or value.and [String.prototype.includes on MDN]() for more information.",
1064
1130
  "arguments": [
1065
1131
  {
1066
1132
  "name": "Array",
1067
- "description": "An Array containing one or more Arrays.",
1068
- "type": {
1069
- "type": "Array"
1070
- },
1071
1133
  "formula": {
1072
- "type": "array",
1073
- "arguments": []
1074
- }
1075
- }
1076
- ],
1077
- "output": {
1078
- "description": "A flattened Array where all items in the original array are concatenated.",
1079
- "type": {
1080
- "type": "Array"
1081
- }
1082
- }
1083
- },
1084
- "@toddle/lowercase": {
1085
- "$schema": "../../schemas/libFormula.schema.json",
1086
- "name": "Lower case",
1087
- "description": "Convert a string to lowercase.",
1088
- "arguments": [
1134
+ "type": "value",
1135
+ "value": ""
1136
+ },
1137
+ "description": "The value to search.",
1138
+ "type": {
1139
+ "type": "Array \\| String"
1140
+ }
1141
+ },
1089
1142
  {
1090
- "name": "String",
1143
+ "name": "Item",
1091
1144
  "formula": {
1092
1145
  "type": "value",
1093
- "value": "string"
1146
+ "value": ""
1094
1147
  },
1095
- "description": "Input String",
1148
+ "description": "The item or value to search for.",
1096
1149
  "type": {
1097
- "type": "String"
1150
+ "type": "Any"
1098
1151
  }
1099
1152
  }
1100
1153
  ],
1101
1154
  "output": {
1102
- "description": "The input String with all characters converted to lowercase.",
1155
+ "description": "Returns True if the item or value exists in the Array or string. Returns False if no match is found.",
1103
1156
  "type": {
1104
- "type": "String"
1157
+ "type": "Boolean"
1105
1158
  }
1106
1159
  }
1107
1160
  },
1108
- "@toddle/reverse": {
1161
+ "@toddle/absolute": {
1109
1162
  "$schema": "../../schemas/libFormula.schema.json",
1110
- "name": "Reverse",
1111
- "description": "Reverse the order of an Array.",
1163
+ "name": "Absolute",
1164
+ "description": "Get the absolute value of a Number.",
1112
1165
  "arguments": [
1113
1166
  {
1114
- "name": "Array",
1167
+ "name": "Value",
1115
1168
  "formula": {
1116
1169
  "type": "value",
1117
- "value": null
1170
+ "value": -1
1118
1171
  },
1119
- "description": "The Array to be reversed.",
1120
1172
  "type": {
1121
- "type": "Array"
1122
- }
1173
+ "type": "Number"
1174
+ },
1175
+ "description": "The input Number."
1123
1176
  }
1124
1177
  ],
1125
1178
  "output": {
1179
+ "description": "The absolute value of the input.",
1126
1180
  "type": {
1127
- "type": "Array"
1128
- },
1129
- "description": "The reversed Array."
1181
+ "type": "Number"
1182
+ }
1130
1183
  }
1131
1184
  },
1132
- "@toddle/join": {
1185
+ "@toddle/isServer": {
1133
1186
  "$schema": "../../schemas/libFormula.schema.json",
1134
- "name": "Join",
1135
- "description": "Combine an Array of Strings into a single String.",
1187
+ "name": "Is Server",
1188
+ "description": "Get information about whether formulas are currently evaluated server-side or client-side.",
1189
+ "arguments": [],
1190
+ "output": {
1191
+ "description": "Returns True if formulas are evaluated server-side, and False if formulas are evaluated client-side.",
1192
+ "type": {
1193
+ "type": "Boolean"
1194
+ }
1195
+ }
1196
+ },
1197
+ "@toddle/parseURL": {
1198
+ "$schema": "../../schemas/libFormula.schema.json",
1199
+ "name": "Parse URL",
1200
+ "description": "Parse a URL.",
1136
1201
  "arguments": [
1137
1202
  {
1138
- "name": "Array",
1203
+ "name": "URL",
1139
1204
  "formula": {
1140
1205
  "type": "value",
1141
1206
  "value": null
1142
1207
  },
1143
- "description": "An array of Strings.",
1208
+ "description": "The URL value to parse.",
1144
1209
  "type": {
1145
- "type": "Array"
1210
+ "type": "String"
1146
1211
  }
1147
1212
  },
1148
1213
  {
1149
- "name": "Separator",
1214
+ "name": "Base",
1150
1215
  "formula": {
1151
1216
  "type": "value",
1152
- "value": ", "
1217
+ "value": null
1153
1218
  },
1154
- "description": "A separator String that is inserted in between each item in the Array to join.",
1219
+ "description": "An optional base for the URL. Use this to resolve relative URLs.",
1155
1220
  "type": {
1156
1221
  "type": "String"
1157
1222
  }
1158
1223
  }
1159
1224
  ],
1160
1225
  "output": {
1161
- "description": "A String combining each item in the input Array separated by the separator String, e.g. joining [\"a\", \"b\", \"c\"] with a \",\" separator will return \"a,b,c\".",
1226
+ "description": "An object containing: \"hostname\", \"searchParams\", \"path\", \"hash\", \"href\", \"protocol\", \"port\", \"origin\"",
1162
1227
  "type": {
1163
- "type": "String"
1228
+ "type": "Object"
1164
1229
  }
1165
1230
  }
1166
1231
  },
1167
- "@toddle/min": {
1232
+ "@toddle/lessOrEqual": {
1168
1233
  "$schema": "../../schemas/libFormula.schema.json",
1169
- "name": "Min",
1170
- "description": "Find the smallest Number from a list of inputs.",
1234
+ "name": "Less or equal",
1235
+ "description": "Compute if a value is smaller than or equal to another value.",
1171
1236
  "arguments": [
1172
1237
  {
1173
- "name": "0",
1238
+ "name": "First",
1174
1239
  "formula": {
1175
1240
  "type": "value",
1176
- "value": null
1241
+ "value": ""
1177
1242
  },
1178
- "description": "Input number",
1243
+ "description": "First Number to be compared.",
1179
1244
  "type": {
1180
1245
  "type": "Number"
1181
1246
  }
1182
1247
  },
1183
1248
  {
1184
- "name": "1",
1249
+ "name": "Second",
1185
1250
  "formula": {
1186
1251
  "type": "value",
1187
- "value": null
1252
+ "value": ""
1188
1253
  },
1189
- "description": "Input number",
1254
+ "description": "Second Number to be compared.",
1190
1255
  "type": {
1191
1256
  "type": "Number"
1192
1257
  }
1193
1258
  }
1194
1259
  ],
1195
- "variableArguments": true,
1196
1260
  "output": {
1197
- "description": "The smallest of the input Numbers.",
1261
+ "description": "Returns True if the First Number is smaller than or equal to the second Number, otherwise it returns False.",
1198
1262
  "type": {
1199
- "type": "Number"
1263
+ "type": "Boolean"
1200
1264
  }
1201
1265
  }
1202
1266
  },
1203
- "@toddle/number": {
1267
+ "@toddle/typeOf": {
1204
1268
  "$schema": "../../schemas/libFormula.schema.json",
1205
- "name": "Number",
1206
- "description": "Convert a value of any type to a Number.",
1269
+ "name": "Type of",
1270
+ "description": "Get the type of a given input.",
1207
1271
  "arguments": [
1208
1272
  {
1209
1273
  "name": "Input",
1210
- "description": "Value of any type",
1211
- "type": {
1212
- "type": "Any"
1213
- },
1214
- "formula": {
1215
- "type": "value",
1216
- "value": "1"
1217
- }
1218
- }
1219
- ],
1220
- "output": {
1221
- "description": "The input value converted to a Number.",
1222
- "type": {
1223
- "type": "Number"
1224
- }
1225
- }
1226
- },
1227
- "@toddle/power": {
1228
- "$schema": "../../schemas/libFormula.schema.json",
1229
- "name": "Power",
1230
- "description": "Raise a number to a power.",
1231
- "arguments": [
1232
- {
1233
- "name": "Base",
1234
- "formula": {
1235
- "type": "value",
1236
- "value": 3
1237
- },
1238
- "description": "The number to be raised to the exponent.",
1239
- "type": {
1240
- "type": "Number"
1241
- }
1242
- },
1243
- {
1244
- "name": "Exponent",
1245
1274
  "formula": {
1246
1275
  "type": "value",
1247
- "value": 2
1276
+ "value": 1
1248
1277
  },
1249
- "description": "The exponent to raise the base to.",
1278
+ "description": "The input value.",
1250
1279
  "type": {
1251
- "type": "Number"
1280
+ "type": "Any"
1252
1281
  }
1253
1282
  }
1254
1283
  ],
1255
1284
  "output": {
1285
+ "description": "The type of the input value. Types can be one of: String, Boolean, Number, Array, Object, or Null.",
1256
1286
  "type": {
1257
- "type": "Number"
1258
- },
1259
- "description": "The result of raising the base to the exponent."
1287
+ "type": "Any"
1288
+ }
1260
1289
  }
1261
1290
  },
1262
- "@toddle/map": {
1291
+ "@toddle/findLast": {
1263
1292
  "$schema": "../../schemas/libFormula.schema.json",
1264
- "name": "Map",
1265
- "description": "Run a formula on each item of an Array to return a new Array.",
1293
+ "name": "Find Last",
1294
+ "description": "Search through an Array of items and apply a formula to each item, to return the last item where the formula returns True.",
1266
1295
  "arguments": [
1267
1296
  {
1268
1297
  "name": "Array",
@@ -1270,7 +1299,7 @@
1270
1299
  "type": "value",
1271
1300
  "value": null
1272
1301
  },
1273
- "description": "The Array of items.",
1302
+ "description": "The array to search.",
1274
1303
  "type": {
1275
1304
  "type": "Array"
1276
1305
  }
@@ -1285,61 +1314,23 @@
1285
1314
  "item"
1286
1315
  ]
1287
1316
  },
1288
- "description": "The formula to run on each item of the Array.",
1317
+ "description": "The predicate formula that each item in the Array is passed to.",
1289
1318
  "type": {
1290
1319
  "type": "Formula"
1291
1320
  }
1292
1321
  }
1293
1322
  ],
1294
1323
  "output": {
1295
- "description": "A new Array containing all the values returned from running the provided formula on each item in the provided input Array.",
1324
+ "description": "The last item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.",
1296
1325
  "type": {
1297
- "type": "Array"
1298
- }
1299
- }
1300
- },
1301
- "@toddle/replaceAll": {
1302
- "$schema": "../../schemas/libFormula.schema.json",
1303
- "name": "Replace all",
1304
- "description": "Replace all occurrences of a substring in a String.",
1305
- "arguments": [
1306
- {
1307
- "name": "Input",
1308
- "description": "The input String to search in.",
1309
- "type": {
1310
- "type": "String"
1311
- },
1312
- "required": true
1313
- },
1314
- {
1315
- "name": "Search",
1316
- "description": "The substring to search for.",
1317
- "type": {
1318
- "type": "String"
1319
- },
1320
- "required": true
1321
- },
1322
- {
1323
- "name": "Replace with",
1324
- "description": "The replacement value.",
1325
- "type": {
1326
- "type": "String"
1327
- },
1328
- "required": true
1326
+ "type": "Any"
1329
1327
  }
1330
- ],
1331
- "output": {
1332
- "type": {
1333
- "type": "String"
1334
- },
1335
- "name": "Output",
1336
- "description": "The resulting String."
1337
1328
  }
1338
1329
  },
1339
- "@toddle/lessOrEqual": {
1330
+ "@toddle/lessThan": {
1340
1331
  "$schema": "../../schemas/libFormula.schema.json",
1341
- "name": "Less or equal",
1342
- "description": "Compute if a value is smaller than or equal to another value.",
1332
+ "name": "Less than",
1333
+ "description": "Compute if a value is smaller than another value.",
1343
1334
  "arguments": [
1344
1335
  {
1345
1336
  "name": "First",
@@ -1365,40 +1356,76 @@
1365
1356
  }
1366
1357
  ],
1367
1358
  "output": {
1368
- "description": "Returns True if the First Number is smaller than or equal to the second Number, otherwise it returns False.",
1359
+ "description": "Returns True if the First Number is smaller than the second Number, otherwise it returns False.",
1369
1360
  "type": {
1370
1361
  "type": "Boolean"
1371
1362
  }
1372
1363
  }
1373
1364
  },
1374
- "@toddle/absolute": {
1365
+ "@toddle/append": {
1375
1366
  "$schema": "../../schemas/libFormula.schema.json",
1376
- "name": "Absolute",
1377
- "description": "Get the absolute value of a Number.",
1367
+ "name": "Append",
1368
+ "description": "Add an element to the end of an Array.",
1378
1369
  "arguments": [
1379
1370
  {
1380
- "name": "Value",
1381
- "formula": {
1382
- "type": "value",
1383
- "value": -1
1371
+ "name": "Array",
1372
+ "type": {
1373
+ "type": "Array"
1384
1374
  },
1375
+ "description": "The Array to append to.",
1376
+ "formula": {
1377
+ "type": "array",
1378
+ "arguments": []
1379
+ }
1380
+ },
1381
+ {
1382
+ "name": "Item",
1385
1383
  "type": {
1386
- "type": "Number"
1384
+ "type": "Any"
1387
1385
  },
1388
- "description": "The input Number."
1386
+ "description": "The item to append to the Array.",
1387
+ "formula": {
1388
+ "type": "value",
1389
+ "value": "Item"
1390
+ }
1389
1391
  }
1390
1392
  ],
1391
1393
  "output": {
1392
- "description": "The absolute value of the input.",
1394
+ "description": "A new Array containing all elements from the input Array, including the new item.",
1393
1395
  "type": {
1394
- "type": "Number"
1396
+ "type": "Array"
1395
1397
  }
1396
1398
  }
1397
1399
  },
1398
- "@toddle/first": {
1400
+ "@toddle/getFromSessionStorage": {
1399
1401
  "$schema": "../../schemas/libFormula.schema.json",
1400
- "name": "First",
1401
- "description": "Return the first item in an Array or the first character in a String.",
1402
+ "name": "Get from Session Storage",
1403
+ "description": "Read a value from session storage with the provided key.",
1404
+ "cache": false,
1405
+ "arguments": [
1406
+ {
1407
+ "name": "Key",
1408
+ "formula": {
1409
+ "type": "value",
1410
+ "value": null
1411
+ },
1412
+ "description": "The key to read from session storage.",
1413
+ "type": {
1414
+ "type": "String"
1415
+ }
1416
+ }
1417
+ ],
1418
+ "output": {
1419
+ "description": "The value found in session storage.",
1420
+ "type": {
1421
+ "type": "Any"
1422
+ }
1423
+ }
1424
+ },
1425
+ "@toddle/unique": {
1426
+ "$schema": "../../schemas/libFormula.schema.json",
1427
+ "name": "Unique",
1428
+ "description": "Remove duplicate values from an Array.",
1402
1429
  "arguments": [
1403
1430
  {
1404
1431
  "name": "Array",
@@ -1406,16 +1433,75 @@
1406
1433
  "type": "value",
1407
1434
  "value": []
1408
1435
  },
1436
+ "type": {
1437
+ "type": "Array"
1438
+ },
1439
+ "description": "The input Array."
1440
+ }
1441
+ ],
1442
+ "output": {
1443
+ "description": "The input Array with all duplicate values removed.",
1444
+ "type": {
1445
+ "type": "Array"
1446
+ }
1447
+ }
1448
+ },
1449
+ "@toddle/concatenate": {
1450
+ "$schema": "../../schemas/libFormula.schema.json",
1451
+ "name": "Concatenate",
1452
+ "description": "Concatenate two or more values.",
1453
+ "arguments": [
1454
+ {
1455
+ "name": "0",
1456
+ "formula": {
1457
+ "type": "value",
1458
+ "value": ""
1459
+ },
1460
+ "type": {
1461
+ "type": "Array \\| String \\| Object"
1462
+ }
1463
+ }
1464
+ ],
1465
+ "variableArguments": true,
1466
+ "output": {
1467
+ "type": {
1468
+ "type": "Array \\| String \\| Object"
1469
+ },
1470
+ "description": "Returns a String, Array or Object containing all the specified input values."
1471
+ }
1472
+ },
1473
+ "@toddle/take": {
1474
+ "$schema": "../../schemas/libFormula.schema.json",
1475
+ "name": "Take",
1476
+ "description": "Take items from the start of an Array or String.",
1477
+ "arguments": [
1478
+ {
1479
+ "name": "Array",
1480
+ "formula": {
1481
+ "type": "value",
1482
+ "value": null
1483
+ },
1484
+ "description": "Input Array or String.",
1409
1485
  "type": {
1410
1486
  "type": "Array \\| String"
1487
+ }
1488
+ },
1489
+ {
1490
+ "name": "Count",
1491
+ "formula": {
1492
+ "type": "value",
1493
+ "value": 1
1411
1494
  },
1412
- "description": "An Array of items or a String."
1495
+ "type": {
1496
+ "type": "Number"
1497
+ },
1498
+ "description": "Number of items to take."
1413
1499
  }
1414
1500
  ],
1415
1501
  "output": {
1416
- "description": "The first item in the Array or the first character in the String.",
1502
+ "description": "The first items from the Array or String.",
1417
1503
  "type": {
1418
- "type": "Any"
1504
+ "type": "Array \\| String"
1419
1505
  }
1420
1506
  }
1421
1507
  },
@@ -1454,71 +1540,121 @@
1454
1540
  }
1455
1541
  }
1456
1542
  },
1457
- "@toddle/matches": {
1543
+ "@toddle/lowercase": {
1458
1544
  "$schema": "../../schemas/libFormula.schema.json",
1459
- "name": "Matches",
1460
- "description": "Finds the (global) matches in a String based on a regular expression.",
1545
+ "name": "Lower case",
1546
+ "description": "Convert a string to lowercase.",
1461
1547
  "arguments": [
1462
1548
  {
1463
- "name": "Input",
1549
+ "name": "String",
1464
1550
  "formula": {
1465
1551
  "type": "value",
1466
- "value": ""
1552
+ "value": "string"
1467
1553
  },
1468
- "description": "The string to search for matches in.",
1554
+ "description": "Input String",
1469
1555
  "type": {
1470
1556
  "type": "String"
1471
1557
  }
1472
- },
1558
+ }
1559
+ ],
1560
+ "output": {
1561
+ "description": "The input String with all characters converted to lowercase.",
1562
+ "type": {
1563
+ "type": "String"
1564
+ }
1565
+ }
1566
+ },
1567
+ "@toddle/equals": {
1568
+ "$schema": "../../schemas/libFormula.schema.json",
1569
+ "name": "Equals",
1570
+ "description": "Compute if values are identical.",
1571
+ "arguments": [
1473
1572
  {
1474
- "name": "Regular expression",
1573
+ "name": "First",
1475
1574
  "formula": {
1476
1575
  "type": "value",
1477
1576
  "value": ""
1478
1577
  },
1479
- "description": "The regular expression to use for matching.",
1578
+ "description": "First Value",
1480
1579
  "type": {
1481
- "type": "String"
1580
+ "type": "Any"
1482
1581
  }
1483
1582
  },
1484
1583
  {
1485
- "name": "Global search",
1584
+ "name": "Second",
1486
1585
  "formula": {
1487
1586
  "type": "value",
1488
- "value": true
1587
+ "value": ""
1489
1588
  },
1490
- "description": "Test the regular expression against all possible matches in a string.",
1589
+ "description": "Second Value",
1491
1590
  "type": {
1492
- "type": "Boolean"
1591
+ "type": "Any"
1493
1592
  }
1494
- },
1593
+ }
1594
+ ],
1595
+ "output": {
1596
+ "description": "Returns True if the input values are identical, otherwise False.",
1597
+ "type": {
1598
+ "type": "Boolean"
1599
+ }
1600
+ }
1601
+ },
1602
+ "@toddle/first": {
1603
+ "$schema": "../../schemas/libFormula.schema.json",
1604
+ "name": "First",
1605
+ "description": "Return the first item in an Array or the first character in a String.",
1606
+ "arguments": [
1495
1607
  {
1496
- "name": "Case insensitive",
1608
+ "name": "Array",
1497
1609
  "formula": {
1498
1610
  "type": "value",
1499
- "value": false
1611
+ "value": []
1500
1612
  },
1501
- "description": "Ignore case while attempting a match in a string.",
1502
1613
  "type": {
1503
- "type": "Boolean"
1614
+ "type": "Array \\| String"
1615
+ },
1616
+ "description": "An Array of items or a String."
1617
+ }
1618
+ ],
1619
+ "output": {
1620
+ "description": "The first item in the Array or the first character in the String.",
1621
+ "type": {
1622
+ "type": "Any"
1623
+ }
1624
+ }
1625
+ },
1626
+ "@toddle/json": {
1627
+ "$schema": "../../schemas/libFormula.schema.json",
1628
+ "name": "JSON",
1629
+ "description": "Convert a value into a JSON String.",
1630
+ "arguments": [
1631
+ {
1632
+ "name": "Input",
1633
+ "formula": {
1634
+ "type": "value",
1635
+ "value": null
1636
+ },
1637
+ "description": "The input value.",
1638
+ "type": {
1639
+ "type": "Any"
1504
1640
  }
1505
1641
  },
1506
1642
  {
1507
- "name": "Multi line",
1643
+ "name": "Indentation",
1508
1644
  "formula": {
1509
1645
  "type": "value",
1510
- "value": false
1646
+ "value": 0
1511
1647
  },
1512
- "description": "Treat multiline strings as multiple lines.",
1648
+ "description": "The number of spaces used for indentation in the JSON String.",
1513
1649
  "type": {
1514
- "type": "Boolean"
1650
+ "type": "Number"
1515
1651
  }
1516
1652
  }
1517
1653
  ],
1518
1654
  "output": {
1519
- "description": "An Array of Strings",
1655
+ "description": "The JSON String.",
1520
1656
  "type": {
1521
- "type": "Array"
1657
+ "type": "String"
1522
1658
  }
1523
1659
  }
1524
1660
  },
@@ -1558,187 +1694,204 @@
1558
1694
  }
1559
1695
  }
1560
1696
  },
1561
- "@toddle/decodeBase64": {
1697
+ "@toddle/dateFromString": {
1562
1698
  "$schema": "../../schemas/libFormula.schema.json",
1563
- "name": "Decode base64",
1699
+ "name": "Date From String",
1564
1700
  "arguments": [
1565
1701
  {
1566
- "name": "Base64 value",
1567
- "formula": {
1568
- "type": "value",
1569
- "value": "Input value"
1570
- },
1702
+ "name": "Date string",
1703
+ "description": "A String representing a date, for example \"January 1, 1970\".",
1571
1704
  "type": {
1572
1705
  "type": "String"
1573
1706
  },
1574
- "description": "The input data encoded as base64."
1707
+ "formula": {
1708
+ "type": "value",
1709
+ "value": "January 1, 1970"
1710
+ }
1575
1711
  }
1576
1712
  ],
1577
- "description": "Deocde a base64 string to utf-8.",
1713
+ "description": "Convert a string to a Date.",
1578
1714
  "output": {
1579
- "description": "The decoded string.",
1715
+ "description": "The input value converted to a Date.",
1580
1716
  "type": {
1581
- "type": "String"
1717
+ "type": "Date"
1582
1718
  }
1583
1719
  }
1584
1720
  },
1585
- "@toddle/keyBy": {
1721
+ "@toddle/deleteKey": {
1586
1722
  "$schema": "../../schemas/libFormula.schema.json",
1587
- "name": "Key by",
1588
- "description": "Organize an Array of items into an Object based on a Key formula.",
1723
+ "name": "Delete",
1724
+ "description": "Return a copy of the input Object or Array without the specified key.",
1589
1725
  "arguments": [
1590
1726
  {
1591
- "name": "Array",
1727
+ "name": "Object",
1592
1728
  "formula": {
1593
1729
  "type": "value",
1594
1730
  "value": null
1595
1731
  },
1596
- "description": "Array of items.",
1732
+ "description": "The input record.",
1597
1733
  "type": {
1598
- "type": "Array"
1734
+ "type": "Array \\| Object"
1599
1735
  }
1600
1736
  },
1601
1737
  {
1602
- "name": "Formula",
1603
- "isFunction": true,
1738
+ "name": "Path",
1604
1739
  "formula": {
1605
1740
  "type": "value",
1606
- "value": null
1741
+ "value": "Item"
1607
1742
  },
1608
- "description": "The key formula used to index the items. The String returned from the formula will match the key in the output Object.",
1743
+ "description": "The path can be either a Number (if the first argument is an array), a String, or an Array of strings. If an Array is given, the property at that path will be removed.",
1609
1744
  "type": {
1610
- "type": "Formula"
1745
+ "type": "Array<Number \\| String> \\| Number \\| String"
1611
1746
  }
1612
1747
  }
1613
1748
  ],
1614
1749
  "output": {
1615
- "description": "An Object where each key matches a value returned by the key formula, and each value is the item that String was returned for.",
1750
+ "description": "A copy of the record without the property specified in the Path.",
1616
1751
  "type": {
1617
1752
  "type": "Object"
1618
1753
  }
1619
1754
  }
1620
1755
  },
1621
- "@toddle/languages": {
1756
+ "@toddle/min": {
1622
1757
  "$schema": "../../schemas/libFormula.schema.json",
1623
- "name": "Languages",
1624
- "description": "An array of the preferred languages for the user, based on the Navigator.languages property (on the client) or the Accept-Language header (on the server).",
1625
- "arguments": [],
1626
- "output": {
1627
- "description": "An array with the preferred languages for the user.",
1628
- "type": {
1629
- "type": "Array"
1630
- }
1631
- }
1632
- },
1633
- "@toddle/last": {
1634
- "$schema": "../../schemas/libFormula.schema.json",
1635
- "name": "Last",
1636
- "description": "Get the last item in an Array or the last character in a String.",
1758
+ "name": "Min",
1759
+ "description": "Find the smallest Number from a list of inputs.",
1637
1760
  "arguments": [
1638
1761
  {
1639
- "name": "Array",
1762
+ "name": "0",
1640
1763
  "formula": {
1641
1764
  "type": "value",
1642
- "value": []
1765
+ "value": null
1643
1766
  },
1767
+ "description": "Input number",
1644
1768
  "type": {
1645
- "type": "Array \\| String"
1769
+ "type": "Number"
1770
+ }
1771
+ },
1772
+ {
1773
+ "name": "1",
1774
+ "formula": {
1775
+ "type": "value",
1776
+ "value": null
1646
1777
  },
1647
- "description": "An array of items or a String."
1778
+ "description": "Input number",
1779
+ "type": {
1780
+ "type": "Number"
1781
+ }
1648
1782
  }
1649
1783
  ],
1784
+ "variableArguments": true,
1650
1785
  "output": {
1651
- "description": "The last item in the Array or the last character in the String.",
1786
+ "description": "The smallest of the input Numbers.",
1652
1787
  "type": {
1653
- "type": "Any"
1788
+ "type": "Number"
1654
1789
  }
1655
1790
  }
1656
1791
  },
1657
- "@toddle/set": {
1792
+ "@toddle/reverse": {
1658
1793
  "$schema": "../../schemas/libFormula.schema.json",
1659
- "name": "Set",
1660
- "description": "Set a value in an Object or Array based on a specified path.",
1794
+ "name": "Reverse",
1795
+ "description": "Reverse the order of an Array.",
1661
1796
  "arguments": [
1662
1797
  {
1663
- "name": "Object",
1798
+ "name": "Array",
1664
1799
  "formula": {
1665
1800
  "type": "value",
1666
1801
  "value": null
1667
1802
  },
1668
- "description": "The input Object.",
1803
+ "description": "The Array to be reversed.",
1669
1804
  "type": {
1670
- "type": "Object"
1805
+ "type": "Array"
1671
1806
  }
1807
+ }
1808
+ ],
1809
+ "output": {
1810
+ "type": {
1811
+ "type": "Array"
1672
1812
  },
1813
+ "description": "The reversed Array."
1814
+ }
1815
+ },
1816
+ "@toddle/branchName": {
1817
+ "$schema": "../../schemas/libFormula.schema.json",
1818
+ "name": "Branch Name",
1819
+ "description": "Get the name of the current branch. For production, the branch name is 'main'.",
1820
+ "arguments": [],
1821
+ "output": {
1822
+ "description": "Returns the name of the current branch.",
1823
+ "type": {
1824
+ "type": "String"
1825
+ }
1826
+ }
1827
+ },
1828
+ "@toddle/greaterOrEqueal": {
1829
+ "$schema": "../../schemas/libFormula.schema.json",
1830
+ "name": "Greater or equal",
1831
+ "description": "Compute whether a value is larger than or equal to another value.",
1832
+ "arguments": [
1673
1833
  {
1674
- "name": "Path",
1834
+ "name": "First",
1675
1835
  "formula": {
1676
1836
  "type": "value",
1677
- "value": "Key"
1837
+ "value": ""
1678
1838
  },
1679
- "description": "The Path can be either a Number, a String or an Array of Strings.",
1839
+ "description": "First value to be compared.",
1680
1840
  "type": {
1681
- "type": "Array \\| Number \\| String"
1841
+ "type": "Number"
1682
1842
  }
1683
1843
  },
1684
1844
  {
1685
- "name": "Value",
1845
+ "name": "Second",
1686
1846
  "formula": {
1687
1847
  "type": "value",
1688
- "value": "Item"
1848
+ "value": ""
1689
1849
  },
1690
- "description": "The value to set.",
1850
+ "description": "Second value to be compared.",
1691
1851
  "type": {
1692
- "type": "Any"
1852
+ "type": "Number"
1693
1853
  }
1694
1854
  }
1695
1855
  ],
1696
1856
  "output": {
1697
- "description": "The input Object with the new field.",
1857
+ "description": "Returns True if the first Number is larger than or equal to the second Number.",
1698
1858
  "type": {
1699
- "type": "Object"
1859
+ "type": "Boolean"
1700
1860
  }
1701
1861
  }
1702
1862
  },
1703
- "@toddle/round": {
1863
+ "@toddle/size": {
1704
1864
  "$schema": "../../schemas/libFormula.schema.json",
1705
- "name": "Round",
1706
- "description": "Round a Number to the nearest decimal point.",
1865
+ "name": "Size",
1866
+ "description": "Get the size of an Array, Object or String.",
1707
1867
  "arguments": [
1708
1868
  {
1709
- "name": "Input",
1710
- "description": "Number to round.",
1711
- "type": {
1712
- "type": "Number"
1713
- },
1869
+ "name": "Collection",
1714
1870
  "formula": {
1715
1871
  "type": "value",
1716
- "value": 1
1717
- }
1718
- },
1719
- {
1720
- "name": "Decimals",
1721
- "description": "Number of decimals to round to.",
1722
- "type": {
1723
- "type": "Number"
1872
+ "value": [
1873
+ 1,
1874
+ 2,
1875
+ 3
1876
+ ]
1724
1877
  },
1725
- "formula": {
1726
- "type": "value",
1727
- "value": 0
1878
+ "description": "The collection to get the size of.",
1879
+ "type": {
1880
+ "type": "Array \\| Object \\| String"
1728
1881
  }
1729
1882
  }
1730
1883
  ],
1731
1884
  "output": {
1885
+ "description": "The size of the collection.",
1732
1886
  "type": {
1733
1887
  "type": "Number"
1734
- },
1735
- "description": "The rounded Number."
1888
+ }
1736
1889
  }
1737
1890
  },
1738
- "@toddle/findIndex": {
1891
+ "@toddle/reduce": {
1739
1892
  "$schema": "../../schemas/libFormula.schema.json",
1740
- "name": "Find index",
1741
- "description": "Search through an Array of items and apply a formula to each item, to return the index of the first item where the formula returns True.",
1893
+ "name": "Reduce",
1894
+ "description": "Reduce a group of items to a single value by applying each item to a reducer formula.",
1742
1895
  "arguments": [
1743
1896
  {
1744
1897
  "name": "Array",
@@ -1746,62 +1899,92 @@
1746
1899
  "type": "value",
1747
1900
  "value": null
1748
1901
  },
1749
- "description": "The array to search.",
1902
+ "description": "The Array or Object of items to be reduced.",
1750
1903
  "type": {
1751
- "type": "Array"
1904
+ "type": "Array \\| Object"
1752
1905
  }
1753
1906
  },
1754
1907
  {
1755
1908
  "name": "Formula",
1756
1909
  "isFunction": true,
1757
1910
  "formula": {
1758
- "type": "path",
1759
- "path": [
1760
- "Args",
1761
- "item"
1762
- ]
1911
+ "type": "value",
1912
+ "value": null
1763
1913
  },
1764
- "description": "The predicate formula that each item in the Array is passed to.",
1914
+ "description": "The reducer formula. Each item in the Array is applied to the formula along with the accumulator. The result of this formula will be a new accumulator used for the next item.",
1765
1915
  "type": {
1766
1916
  "type": "Formula"
1767
1917
  }
1918
+ },
1919
+ {
1920
+ "name": "Accumulator",
1921
+ "formula": {
1922
+ "type": "value",
1923
+ "value": null
1924
+ },
1925
+ "description": "The initial value of the accumulator. This value is passed to the reducer formula along with the first item in the Array, and the result is used as the accumulator for the next item.",
1926
+ "type": {
1927
+ "type": "Any"
1928
+ }
1768
1929
  }
1769
1930
  ],
1770
1931
  "output": {
1771
- "description": "The index of the first item in the Array where the predicate formula returns True. Returns -1 if the predicate formula did not return True for any item.",
1932
+ "description": "The value returned from applying the last item to the reducer formula.",
1772
1933
  "type": {
1773
1934
  "type": "Any"
1774
1935
  }
1775
1936
  }
1776
1937
  },
1777
- "@toddle/boolean": {
1938
+ "@toddle/set": {
1778
1939
  "$schema": "../../schemas/libFormula.schema.json",
1779
- "name": "Boolean",
1780
- "description": "Convert a value of any type to a Boolean.",
1940
+ "name": "Set",
1941
+ "description": "Set a value in an Object or Array based on a specified path.",
1781
1942
  "arguments": [
1782
1943
  {
1783
- "name": "Input",
1784
- "description": "Value of any type.",
1944
+ "name": "Object",
1945
+ "formula": {
1946
+ "type": "value",
1947
+ "value": null
1948
+ },
1949
+ "description": "The input Object.",
1785
1950
  "type": {
1786
- "type": "Any"
1951
+ "type": "Object"
1952
+ }
1953
+ },
1954
+ {
1955
+ "name": "Path",
1956
+ "formula": {
1957
+ "type": "value",
1958
+ "value": "Key"
1787
1959
  },
1960
+ "description": "The Path can be either a Number, a String or an Array of Strings.",
1961
+ "type": {
1962
+ "type": "Array \\| Number \\| String"
1963
+ }
1964
+ },
1965
+ {
1966
+ "name": "Value",
1788
1967
  "formula": {
1789
1968
  "type": "value",
1790
- "value": "1"
1969
+ "value": "Item"
1970
+ },
1971
+ "description": "The value to set.",
1972
+ "type": {
1973
+ "type": "Any"
1791
1974
  }
1792
1975
  }
1793
1976
  ],
1794
1977
  "output": {
1795
- "description": "The input value converted to a Boolean. False and Null will return False, all other values will return True.",
1978
+ "description": "The input Object with the new field.",
1796
1979
  "type": {
1797
- "type": "Boolean"
1980
+ "type": "Object"
1798
1981
  }
1799
1982
  }
1800
1983
  },
1801
- "@toddle/takeLast": {
1984
+ "@toddle/some": {
1802
1985
  "$schema": "../../schemas/libFormula.schema.json",
1803
- "name": "Take last",
1804
- "description": "Take items from the end of an Array or String.",
1986
+ "name": "Some",
1987
+ "description": "Run a formula on all items of an Array to determine if any item matches a set of conditions.",
1805
1988
  "arguments": [
1806
1989
  {
1807
1990
  "name": "Array",
@@ -1809,122 +1992,114 @@
1809
1992
  "type": "value",
1810
1993
  "value": null
1811
1994
  },
1812
- "description": "The input value.",
1995
+ "description": "The Array of items to evaluate.",
1813
1996
  "type": {
1814
- "type": "Array \\| String"
1997
+ "type": "Array"
1815
1998
  }
1816
1999
  },
1817
2000
  {
1818
- "name": "Count",
2001
+ "name": "Formula",
2002
+ "isFunction": true,
1819
2003
  "formula": {
1820
- "type": "value",
1821
- "value": 1
2004
+ "type": "path",
2005
+ "path": [
2006
+ "Args",
2007
+ "item"
2008
+ ]
1822
2009
  },
1823
- "description": "Number of items to take.",
2010
+ "description": "Predicate formula for evaluating each item.",
1824
2011
  "type": {
1825
- "type": "Number"
2012
+ "type": "Formula"
1826
2013
  }
1827
2014
  }
1828
2015
  ],
1829
2016
  "output": {
1830
- "description": "The last items from the Array or String.",
2017
+ "description": "Returns True if the predicate formula returns True for any items in the Array, otherwise False.",
1831
2018
  "type": {
1832
- "type": "Array \\| String"
2019
+ "type": "Boolean"
1833
2020
  }
1834
2021
  }
1835
2022
  },
1836
- "@toddle/formatDate": {
2023
+ "@toddle/entries": {
1837
2024
  "$schema": "../../schemas/libFormula.schema.json",
1838
- "name": "Format Date",
2025
+ "name": "Entries",
2026
+ "description": "Get an Array of entries from a given Object.",
1839
2027
  "arguments": [
1840
2028
  {
1841
- "name": "Date",
1842
- "description": "Date to format",
1843
- "type": {
1844
- "type": "Date"
1845
- },
2029
+ "name": "Object",
1846
2030
  "formula": {
1847
2031
  "type": "value",
1848
2032
  "value": null
1849
- }
1850
- },
1851
- {
1852
- "name": "Locale(s)",
1853
- "description": "Optional locale to use for formatting the Date, e.g. \"en\" or \"fr\". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.",
1854
- "type": {
1855
- "type": "Array \\| String"
1856
2033
  },
1857
- "formula": {
1858
- "type": "value",
1859
- "value": null
1860
- }
1861
- },
1862
- {
1863
- "name": "Options",
1864
- "description": "Optional Object for configuring the formatting of the output. See the [DateTimeFormat syntax on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#syntax).",
2034
+ "description": "Input record",
1865
2035
  "type": {
1866
2036
  "type": "Object"
1867
- },
1868
- "formula": {
1869
- "type": "value",
1870
- "value": null
1871
2037
  }
1872
2038
  }
1873
2039
  ],
1874
- "description": "Format a date using the Intl.DateTimeFormat API. See the [DateTimeFormat docs on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat).",
1875
2040
  "output": {
1876
- "description": "The Date input formatted as a String.",
2041
+ "description": "Returns an Array of entries for the given input record. The entries are Objects with a “key” and “value” property.",
1877
2042
  "type": {
1878
- "type": "String"
2043
+ "type": "Array"
1879
2044
  }
1880
2045
  }
1881
2046
  },
1882
- "@toddle/squareRoot": {
2047
+ "@toddle/flatten": {
1883
2048
  "$schema": "../../schemas/libFormula.schema.json",
1884
- "name": "Square root",
1885
- "description": "Get the square root of a Number.",
2049
+ "name": "Flatten",
2050
+ "description": "Flatten a nested Array.",
1886
2051
  "arguments": [
1887
2052
  {
1888
- "name": "Number",
1889
- "formula": {
1890
- "type": "value",
1891
- "value": 1
1892
- },
1893
- "description": "The input Number.",
2053
+ "name": "Array",
2054
+ "description": "An Array containing one or more Arrays.",
1894
2055
  "type": {
1895
- "type": "Number"
2056
+ "type": "Array"
2057
+ },
2058
+ "formula": {
2059
+ "type": "array",
2060
+ "arguments": []
1896
2061
  }
1897
2062
  }
1898
2063
  ],
1899
2064
  "output": {
1900
- "description": "The square root of the input Number.",
2065
+ "description": "A flattened Array where all items in the original array are concatenated.",
1901
2066
  "type": {
1902
- "type": "Number"
2067
+ "type": "Array"
1903
2068
  }
1904
2069
  }
1905
2070
  },
1906
- "@toddle/getFromSessionStorage": {
2071
+ "@toddle/drop": {
1907
2072
  "$schema": "../../schemas/libFormula.schema.json",
1908
- "name": "Get from Session Storage",
1909
- "description": "Read a value from session storage with the provided key.",
1910
- "cache": false,
2073
+ "name": "Drop",
2074
+ "description": "Remove items from the beginning of an Array or String.",
1911
2075
  "arguments": [
1912
2076
  {
1913
- "name": "Key",
2077
+ "name": "Array",
1914
2078
  "formula": {
1915
2079
  "type": "value",
1916
2080
  "value": null
1917
2081
  },
1918
- "description": "The key to read from session storage.",
2082
+ "description": "The input value.",
1919
2083
  "type": {
1920
- "type": "String"
2084
+ "type": "Array \\| String"
2085
+ }
2086
+ },
2087
+ {
2088
+ "name": "Count",
2089
+ "description": "Number of items to remove.",
2090
+ "type": {
2091
+ "type": "Number"
2092
+ },
2093
+ "formula": {
2094
+ "type": "value",
2095
+ "value": 1
1921
2096
  }
1922
2097
  }
1923
2098
  ],
1924
2099
  "output": {
1925
- "description": "The value found in session storage.",
2100
+ "description": "A copy of the list without the first items.",
1926
2101
  "type": {
1927
- "type": "Any"
2102
+ "type": "Array \\| String"
1928
2103
  }
1929
2104
  }
1930
2105
  },
@@ -1963,45 +2138,49 @@
1963
2138
  }
1964
2139
  }
1965
2140
  },
1966
- "@toddle/minus": {
2141
+ "@toddle/find": {
1967
2142
  "$schema": "../../schemas/libFormula.schema.json",
1968
- "name": "Minus",
1969
- "description": "Subtract a Number from a Number.",
2143
+ "name": "Find",
2144
+ "description": "Search through an Array of items and apply a formula to each item, to return the first item where the provided formula returns True.",
1970
2145
  "arguments": [
1971
2146
  {
1972
- "name": "Minuend",
2147
+ "name": "Array",
1973
2148
  "formula": {
1974
2149
  "type": "value",
1975
- "value": 1
2150
+ "value": null
1976
2151
  },
1977
- "description": "The number to subtract from.",
2152
+ "description": "The array to search through",
1978
2153
  "type": {
1979
- "type": "Number"
2154
+ "type": "Array"
1980
2155
  }
1981
2156
  },
1982
2157
  {
1983
- "name": "Substrahend",
2158
+ "name": "Formula",
2159
+ "isFunction": true,
1984
2160
  "formula": {
1985
- "type": "value",
1986
- "value": 1
2161
+ "type": "path",
2162
+ "path": [
2163
+ "Args",
2164
+ "item"
2165
+ ]
1987
2166
  },
1988
- "description": "The number to subtract.",
2167
+ "description": "The predicate formula that each item in the array is passed to.",
1989
2168
  "type": {
1990
- "type": "Number"
2169
+ "type": "Formula"
1991
2170
  }
1992
2171
  }
1993
2172
  ],
1994
2173
  "output": {
1995
- "description": "The result of subtracting the Substrahend from the Minuend.",
2174
+ "description": "The first item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.",
1996
2175
  "type": {
1997
- "type": "Number"
2176
+ "type": "Any"
1998
2177
  }
1999
2178
  }
2000
2179
  },
2001
- "@toddle/every": {
2180
+ "@toddle/filter": {
2002
2181
  "$schema": "../../schemas/libFormula.schema.json",
2003
- "name": "Every",
2004
- "description": "Run a formula returns for all items in an Array.",
2182
+ "name": "Filter",
2183
+ "description": "Return a new Array containing only the elements for which the provided formula evaluates to True.",
2005
2184
  "arguments": [
2006
2185
  {
2007
2186
  "name": "Array",
@@ -2009,7 +2188,7 @@
2009
2188
  "type": "value",
2010
2189
  "value": null
2011
2190
  },
2012
- "description": "The array of items to evaluate.",
2191
+ "description": "The array of items to be filtered.",
2013
2192
  "type": {
2014
2193
  "type": "Array"
2015
2194
  }
@@ -2024,82 +2203,73 @@
2024
2203
  "item"
2025
2204
  ]
2026
2205
  },
2027
- "description": "Predicate formula for evaluating each item.",
2206
+ "description": "Predicate formula for filtering items.",
2028
2207
  "type": {
2029
2208
  "type": "Formula"
2030
2209
  }
2031
2210
  }
2032
2211
  ],
2033
2212
  "output": {
2034
- "description": "Returns True if the predicate formula returns true for all items in the Array, otherwise False.",
2213
+ "description": "New Array containing only the items for which the Formula evaluated to True.",
2035
2214
  "type": {
2036
2215
  "type": "Array"
2037
2216
  }
2038
2217
  }
2039
2218
  },
2040
- "@toddle/notEqual": {
2219
+ "@toddle/getFromLocalStorage": {
2041
2220
  "$schema": "../../schemas/libFormula.schema.json",
2042
- "name": "Not equal",
2043
- "description": "Compute if values are not identical.",
2221
+ "name": "Get from Local Storage",
2222
+ "description": "Read a value from local storage with the provided key.",
2223
+ "cache": false,
2044
2224
  "arguments": [
2045
2225
  {
2046
- "name": "First",
2047
- "formula": {
2048
- "type": "value",
2049
- "value": ""
2050
- },
2051
- "description": "First value.",
2052
- "type": {
2053
- "type": "Any"
2054
- }
2055
- },
2056
- {
2057
- "name": "Second",
2226
+ "name": "Key",
2058
2227
  "formula": {
2059
2228
  "type": "value",
2060
- "value": ""
2229
+ "value": null
2061
2230
  },
2062
- "description": "Second value.",
2231
+ "description": "The key to read from local storage.",
2063
2232
  "type": {
2064
- "type": "Any"
2233
+ "type": "String"
2065
2234
  }
2066
2235
  }
2067
2236
  ],
2068
2237
  "output": {
2069
- "description": "Returns True if the values are not identical, otherwise False.",
2238
+ "description": "The value found in local storage. If no value is found, this will return Null.",
2070
2239
  "type": {
2071
2240
  "type": "Any"
2072
2241
  }
2073
2242
  }
2074
2243
  },
2075
- "@toddle/entries": {
2244
+ "@toddle/number": {
2076
2245
  "$schema": "../../schemas/libFormula.schema.json",
2077
- "name": "Entries",
2078
- "description": "Get an Array of entries from a given Object.",
2246
+ "name": "Number",
2247
+ "description": "Convert a value of any type to a Number.",
2079
2248
  "arguments": [
2080
2249
  {
2081
- "name": "Object",
2250
+ "name": "Input",
2251
+ "description": "Value of any type",
2252
+ "type": {
2253
+ "type": "Any"
2254
+ },
2082
2255
  "formula": {
2083
2256
  "type": "value",
2084
- "value": null
2085
- },
2086
- "description": "Input record",
2087
- "type": {
2088
- "type": "Object"
2257
+ "value": "1"
2089
2258
  }
2090
2259
  }
2091
2260
  ],
2092
2261
  "output": {
2093
- "description": "Returns an Array of entries for the given input record. The entries are Objects with a “key” and “value” property.",
2262
+ "description": "The input value converted to a Number.",
2094
2263
  "type": {
2095
- "type": "Array"
2264
+ "type": "Number"
2096
2265
  }
2097
2266
  }
2098
2267
  },
2099
- "@toddle/filter": {
2268
+ "@toddle/shuffle": {
2100
2269
  "$schema": "../../schemas/libFormula.schema.json",
2101
- "name": "Filter",
2102
- "description": "Return a new Array containing only the elements for which the provided formula evaluates to True.",
2270
+ "name": "Shuffle",
2271
+ "description": "Shuffle items in an Array or String.",
2272
+ "cache": false,
2103
2273
  "arguments": [
2104
2274
  {
2105
2275
  "name": "Array",
@@ -2107,727 +2277,599 @@
2107
2277
  "type": "value",
2108
2278
  "value": null
2109
2279
  },
2110
- "description": "The array of items to be filtered.",
2111
- "type": {
2112
- "type": "Array"
2113
- }
2114
- },
2115
- {
2116
- "name": "Formula",
2117
- "isFunction": true,
2118
- "formula": {
2119
- "type": "path",
2120
- "path": [
2121
- "Args",
2122
- "item"
2123
- ]
2124
- },
2125
- "description": "Predicate formula for filtering items.",
2280
+ "description": "The input value.",
2126
2281
  "type": {
2127
- "type": "Formula"
2282
+ "type": "Array \\| String"
2128
2283
  }
2129
2284
  }
2130
2285
  ],
2131
2286
  "output": {
2132
- "description": "New Array containing only the items for which the Formula evaluated to True.",
2287
+ "description": "The shuffled Array or String.",
2133
2288
  "type": {
2134
- "type": "Array"
2289
+ "type": "Array \\| String"
2135
2290
  }
2136
2291
  }
2137
2292
  },
2138
- "@toddle/uppercase": {
2293
+ "@toddle/add": {
2139
2294
  "$schema": "../../schemas/libFormula.schema.json",
2140
- "name": "Uppercase",
2141
- "description": "Convert a String to uppercase.",
2295
+ "name": "Add",
2142
2296
  "arguments": [
2143
2297
  {
2144
- "name": "String",
2298
+ "name": "0",
2299
+ "description": "Number to be added.",
2300
+ "type": {
2301
+ "type": "Number"
2302
+ },
2145
2303
  "formula": {
2146
2304
  "type": "value",
2147
- "value": "string"
2148
- },
2149
- "description": "Input String.",
2305
+ "value": 1
2306
+ }
2307
+ },
2308
+ {
2309
+ "name": "1",
2150
2310
  "type": {
2151
- "type": "String"
2311
+ "type": "Number"
2312
+ },
2313
+ "description": "Number to be added.",
2314
+ "formula": {
2315
+ "type": "value",
2316
+ "value": 1
2152
2317
  }
2153
2318
  }
2154
2319
  ],
2320
+ "variableArguments": true,
2321
+ "description": "Get the sum of multiple numbers.",
2155
2322
  "output": {
2156
- "description": "The input String with all characters converted to uppercase.",
2323
+ "description": "The sum of all the input numbers.",
2157
2324
  "type": {
2158
- "type": "String"
2325
+ "type": "Number"
2159
2326
  }
2160
2327
  }
2161
2328
  },
2162
- "@toddle/fromEntries": {
2329
+ "@toddle/defaultTo": {
2163
2330
  "$schema": "../../schemas/libFormula.schema.json",
2164
- "name": "From entries",
2165
- "description": "Transform an Array of key-value pairs into an Object. This formula is the reverse of Entries.",
2331
+ "name": "Default to",
2332
+ "description": "Return the first value that is not False or Null.",
2166
2333
  "arguments": [
2167
2334
  {
2168
- "name": "Array",
2335
+ "name": "0",
2169
2336
  "formula": {
2170
2337
  "type": "value",
2171
2338
  "value": null
2172
2339
  },
2173
- "description": "An Array of Objects. Each Object should have a `key` and `value` property named `key` and `value` respectively e.g. `[{ key: 'yourKey', value: 'yourValue' }]`.",
2340
+ "description": "The inital value.",
2174
2341
  "type": {
2175
- "type": "Array"
2342
+ "type": "Any"
2343
+ }
2344
+ },
2345
+ {
2346
+ "name": "1",
2347
+ "description": "The first fallback value to be used if the primary value is Null or False.",
2348
+ "type": {
2349
+ "type": "Any"
2350
+ },
2351
+ "formula": {
2352
+ "type": "value",
2353
+ "value": "default"
2176
2354
  }
2177
2355
  }
2178
2356
  ],
2357
+ "variableArguments": true,
2179
2358
  "output": {
2180
- "description": "An Object containing all entries from the input Array in the format `{yourKey: yourValue}`.",
2359
+ "description": "Returns the first value that is not False or Null. Returns Null if no valid values is given.",
2181
2360
  "type": {
2182
- "type": "Object"
2361
+ "type": "Any"
2183
2362
  }
2184
2363
  }
2185
2364
  },
2186
- "@toddle/clamp": {
2365
+ "@toddle/roundUp": {
2187
2366
  "$schema": "../../schemas/libFormula.schema.json",
2188
- "name": "Clamp",
2189
- "description": "Limit a value to a specified Min and Max value.",
2367
+ "name": "Round up",
2368
+ "description": "Round a Number up to the nearest decimal point.",
2190
2369
  "arguments": [
2191
2370
  {
2192
- "name": "Value",
2371
+ "name": "Input",
2372
+ "description": "Number to round up.",
2193
2373
  "type": {
2194
2374
  "type": "Number"
2195
2375
  },
2196
2376
  "formula": {
2197
2377
  "type": "value",
2198
- "value": null
2199
- },
2200
- "description": "Number to round."
2378
+ "value": 1
2379
+ }
2201
2380
  },
2202
2381
  {
2203
- "name": "Min",
2382
+ "name": "Decimals",
2383
+ "description": "Number of decimals to round to.",
2204
2384
  "type": {
2205
2385
  "type": "Number"
2206
2386
  },
2207
- "description": "The smallest allowed Number.",
2208
2387
  "formula": {
2209
2388
  "type": "value",
2210
2389
  "value": 0
2211
2390
  }
2212
- },
2213
- {
2214
- "name": "Max",
2215
- "type": {
2216
- "type": "Number"
2217
- },
2218
- "description": "The largest allowed Number.",
2219
- "formula": {
2220
- "type": "value",
2221
- "value": 100
2222
- }
2223
2391
  }
2224
2392
  ],
2225
2393
  "output": {
2226
2394
  "type": {
2227
2395
  "type": "Number"
2228
2396
  },
2229
- "description": "Returns the input value if between the specified Min and Max. Otherwise, it returns the Min or Max value."
2397
+ "description": "The rounded Number."
2230
2398
  }
2231
2399
  },
2232
- "@toddle/drop": {
2400
+ "@toddle/lastIndexOf": {
2233
2401
  "$schema": "../../schemas/libFormula.schema.json",
2234
- "name": "Drop",
2235
- "description": "Remove items from the beginning of an Array or String.",
2402
+ "name": "Last Index of",
2403
+ "description": "Search an Array or String to find the index of the last occurrence of a specified item or substring.",
2236
2404
  "arguments": [
2237
2405
  {
2238
2406
  "name": "Array",
2239
2407
  "formula": {
2240
2408
  "type": "value",
2241
- "value": null
2409
+ "value": ""
2242
2410
  },
2243
- "description": "The input value.",
2411
+ "description": "The value to search.",
2244
2412
  "type": {
2245
2413
  "type": "Array \\| String"
2246
2414
  }
2247
2415
  },
2248
2416
  {
2249
- "name": "Count",
2250
- "description": "Number of items to remove.",
2251
- "type": {
2252
- "type": "Number"
2253
- },
2417
+ "name": "Item",
2254
2418
  "formula": {
2255
2419
  "type": "value",
2256
- "value": 1
2420
+ "value": ""
2421
+ },
2422
+ "description": "The item or substring to search for.",
2423
+ "type": {
2424
+ "type": "Any"
2257
2425
  }
2258
2426
  }
2259
2427
  ],
2260
2428
  "output": {
2261
- "description": "A copy of the list without the first items.",
2429
+ "description": "If the item or substring exists in the Array, the last index of that item is returned. If the item is not found, -1 is returned.",
2262
2430
  "type": {
2263
- "type": "Array \\| String"
2431
+ "type": "Number"
2264
2432
  }
2265
2433
  }
2266
2434
  },
2267
- "@toddle/deleteKey": {
2435
+ "@toddle/timestamp": {
2268
2436
  "$schema": "../../schemas/libFormula.schema.json",
2269
- "name": "Delete",
2270
- "description": "Return a copy of the input Object or Array without the specified key.",
2437
+ "name": "Timestamp",
2438
+ "description": "Get the timestamp from a Date, e.g. 1633462980000.",
2271
2439
  "arguments": [
2272
2440
  {
2273
- "name": "Object",
2274
- "formula": {
2275
- "type": "value",
2276
- "value": null
2277
- },
2278
- "description": "The input record.",
2441
+ "name": "Date",
2442
+ "description": "The date to get the timestamp from.",
2279
2443
  "type": {
2280
- "type": "Array \\| Object"
2281
- }
2282
- },
2283
- {
2284
- "name": "Path",
2444
+ "type": "Date"
2445
+ },
2285
2446
  "formula": {
2286
2447
  "type": "value",
2287
- "value": "Item"
2288
- },
2289
- "description": "The path can be either a Number (if the first argument is an array), a String, or an Array of strings. If an Array is given, the property at that path will be removed.",
2290
- "type": {
2291
- "type": "Array<Number \\| String> \\| Number \\| String"
2448
+ "value": null
2292
2449
  }
2293
2450
  }
2294
2451
  ],
2295
2452
  "output": {
2296
- "description": "A copy of the record without the property specified in the Path.",
2297
- "type": {
2298
- "type": "Object"
2299
- }
2300
- }
2301
- },
2302
- "@toddle/isServer": {
2303
- "$schema": "../../schemas/libFormula.schema.json",
2304
- "name": "Is Server",
2305
- "description": "Get information about whether formulas are currently evaluated server-side or client-side.",
2306
- "arguments": [],
2307
- "output": {
2308
- "description": "Returns True if formulas are evaluated server-side, and False if formulas are evaluated client-side.",
2309
- "type": {
2310
- "type": "Boolean"
2311
- }
2312
- }
2313
- },
2314
- "@toddle/userAgent": {
2315
- "$schema": "../../schemas/libFormula.schema.json",
2316
- "name": "User Agent",
2317
- "description": "Get the user agent for the browser or from the User-Agent header on the server. See [User-Agent on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) for more information.",
2318
- "arguments": [],
2319
- "output": {
2320
- "description": "The user agent string.",
2453
+ "description": "The timestamp from the date input.",
2321
2454
  "type": {
2322
- "type": "String"
2455
+ "type": "Number"
2323
2456
  }
2324
2457
  }
2325
2458
  },
2326
- "@toddle/split": {
2459
+ "@toddle/getCookie": {
2327
2460
  "$schema": "../../schemas/libFormula.schema.json",
2328
- "name": "Split",
2329
- "description": "Split a String into an Array of smaller strings each time a delimiter occurs. The delimiter will not be part of the output.",
2461
+ "name": "Get Cookie",
2462
+ "description": "Get the value of a cookie by name. This formula is available both server-side and client-side. Http-Only cookies will only be available server-side.",
2330
2463
  "arguments": [
2331
2464
  {
2332
- "name": "Input",
2333
- "formula": {
2334
- "type": "value",
2335
- "value": ""
2336
- },
2337
- "description": "The String to split.",
2338
- "type": {
2339
- "type": "String"
2340
- }
2341
- },
2342
- {
2343
- "name": "Delimiter",
2465
+ "name": "Cookie name",
2344
2466
  "formula": {
2345
2467
  "type": "value",
2346
- "value": ""
2468
+ "value": null
2347
2469
  },
2348
- "description": "The string to split by.",
2470
+ "description": "The name of the cookie you want to get the value of.",
2349
2471
  "type": {
2350
2472
  "type": "String"
2351
2473
  }
2352
2474
  }
2353
2475
  ],
2354
2476
  "output": {
2355
- "description": "An array of Strings.",
2356
- "type": {
2357
- "type": "Array",
2358
- "ofType": {
2359
- "type": "String"
2360
- }
2361
- }
2362
- }
2363
- },
2364
- "@toddle/randomNumber": {
2365
- "$schema": "../../schemas/libFormula.schema.json",
2366
- "name": "Random number",
2367
- "description": "Return a random Number between 0 and 1.",
2368
- "arguments": [],
2369
- "cache": false,
2370
- "output": {
2371
- "description": "A random Number between 0 and 1.",
2477
+ "description": "The value of the cookie. If a value is not found, this return value will be Null.",
2372
2478
  "type": {
2373
- "type": "Number"
2479
+ "type": "String"
2374
2480
  }
2375
2481
  }
2376
2482
  },
2377
- "@toddle/findLast": {
2483
+ "@toddle/indexOf": {
2378
2484
  "$schema": "../../schemas/libFormula.schema.json",
2379
- "name": "Find Last",
2380
- "description": "Search through an Array of items and apply a formula to each item, to return the last item where the formula returns True.",
2485
+ "name": "Index of",
2486
+ "description": "Find the index of a specific item in an Array or String.and [String.prototype.indexOf on MDN]() for more information.",
2381
2487
  "arguments": [
2382
2488
  {
2383
2489
  "name": "Array",
2384
2490
  "formula": {
2385
2491
  "type": "value",
2386
- "value": null
2492
+ "value": ""
2387
2493
  },
2388
- "description": "The array to search.",
2494
+ "description": "The value to search.",
2389
2495
  "type": {
2390
- "type": "Array"
2496
+ "type": "Array \\| String"
2391
2497
  }
2392
2498
  },
2393
2499
  {
2394
- "name": "Formula",
2395
- "isFunction": true,
2500
+ "name": "Item",
2396
2501
  "formula": {
2397
- "type": "path",
2398
- "path": [
2399
- "Args",
2400
- "item"
2401
- ]
2502
+ "type": "value",
2503
+ "value": ""
2402
2504
  },
2403
- "description": "The predicate formula that each item in the Array is passed to.",
2505
+ "description": "The items to search for.",
2404
2506
  "type": {
2405
- "type": "Formula"
2507
+ "type": "Any"
2406
2508
  }
2407
2509
  }
2408
2510
  ],
2409
2511
  "output": {
2410
- "description": "The last item in the Array where the formula returns True. Returns Null if the predicate formula did not return True for any item.",
2512
+ "description": "If the item exists in the Array, the index of that item is returned. If the item is not found, -1 is returned.",
2411
2513
  "type": {
2412
- "type": "Any"
2514
+ "type": "Number"
2413
2515
  }
2414
2516
  }
2415
2517
  },
2416
- "@toddle/now": {
2518
+ "@toddle/currentURL": {
2417
2519
  "$schema": "../../schemas/libFormula.schema.json",
2418
- "name": "Now",
2419
- "description": "Get a Date representing \"Now\".",
2520
+ "name": "Current URL",
2521
+ "description": "Return the current URL of the browser. Use the \"Parse URL\" formula for working with the URL.",
2420
2522
  "arguments": [],
2421
2523
  "cache": false,
2422
2524
  "output": {
2423
- "description": "A Date object initialized at the current date/time.",
2525
+ "description": "The browser's current URL.",
2424
2526
  "type": {
2425
- "type": "Date"
2527
+ "type": "String"
2426
2528
  }
2427
2529
  }
2428
2530
  },
2429
- "@toddle/sum": {
2531
+ "@toddle/replaceAll": {
2430
2532
  "$schema": "../../schemas/libFormula.schema.json",
2431
- "name": "Sum",
2432
- "description": "Return the sum of an Array of numbers.",
2533
+ "name": "Replace all",
2534
+ "description": "Replace all occurrences of a substring in a String.",
2433
2535
  "arguments": [
2434
2536
  {
2435
- "name": "Array",
2537
+ "name": "Input",
2538
+ "description": "The input String to search in.",
2436
2539
  "type": {
2437
- "type": "Array"
2540
+ "type": "String"
2438
2541
  },
2439
- "description": "The array of numbers to sum.",
2440
- "formula": {
2441
- "type": "array",
2442
- "arguments": []
2443
- }
2444
- }
2445
- ],
2446
- "output": {
2447
- "description": "The total sum from adding all the numbers in the Array.",
2448
- "type": {
2449
- "type": "Number"
2450
- }
2451
- }
2452
- },
2453
- "@toddle/encodeURIComponent": {
2454
- "$schema": "../../schemas/libFormula.schema.json",
2455
- "name": "Encode URI Component",
2456
- "description": "Encode a URI component, escaping certain characters to their UTF-8 representation.",
2457
- "arguments": [
2542
+ "required": true
2543
+ },
2458
2544
  {
2459
- "name": "URIComponent",
2460
- "formula": {
2461
- "type": "value",
2462
- "value": null
2545
+ "name": "Search",
2546
+ "description": "The substring to search for.",
2547
+ "type": {
2548
+ "type": "String"
2463
2549
  },
2464
- "description": "The URI component to encode.",
2550
+ "required": true
2551
+ },
2552
+ {
2553
+ "name": "Replace with",
2554
+ "description": "The replacement value.",
2465
2555
  "type": {
2466
2556
  "type": "String"
2467
- }
2557
+ },
2558
+ "required": true
2468
2559
  }
2469
2560
  ],
2470
2561
  "output": {
2471
- "description": "The encoded URI component.",
2472
2562
  "type": {
2473
2563
  "type": "String"
2474
- }
2564
+ },
2565
+ "name": "Output",
2566
+ "description": "The resulting String."
2475
2567
  }
2476
2568
  },
2477
- "@toddle/getFromLocalStorage": {
2569
+ "@toddle/getElementById": {
2478
2570
  "$schema": "../../schemas/libFormula.schema.json",
2479
- "name": "Get from Local Storage",
2480
- "description": "Read a value from local storage with the provided key.",
2571
+ "name": "Get element by id",
2572
+ "description": "Return a DOM element with a given id.",
2481
2573
  "cache": false,
2482
2574
  "arguments": [
2483
2575
  {
2484
- "name": "Key",
2576
+ "name": "Id",
2485
2577
  "formula": {
2486
2578
  "type": "value",
2487
- "value": null
2579
+ "value": "element-id"
2488
2580
  },
2489
- "description": "The key to read from local storage.",
2490
2581
  "type": {
2491
2582
  "type": "String"
2492
- }
2583
+ },
2584
+ "description": "The id of the DOM element to return."
2493
2585
  }
2494
2586
  ],
2495
2587
  "output": {
2496
- "description": "The value found in local storage. If no value is found, this will return Null.",
2588
+ "description": "The DOM element with the given id. If no DOM element is found, this will return Null.",
2497
2589
  "type": {
2498
- "type": "Any"
2590
+ "type": "Element"
2499
2591
  }
2500
2592
  }
2501
2593
  },
2502
- "@toddle/roundUp": {
2594
+ "@toddle/userAgent": {
2503
2595
  "$schema": "../../schemas/libFormula.schema.json",
2504
- "name": "Round up",
2505
- "description": "Round a Number up to the nearest decimal point.",
2596
+ "name": "User Agent",
2597
+ "description": "Get the user agent for the browser or from the User-Agent header on the server. See [User-Agent on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) for more information.",
2598
+ "arguments": [],
2599
+ "output": {
2600
+ "description": "The user agent string.",
2601
+ "type": {
2602
+ "type": "String"
2603
+ }
2604
+ }
2605
+ },
2606
+ "@toddle/startsWith": {
2607
+ "$schema": "../../schemas/libFormula.schema.json",
2608
+ "name": "Starts with",
2609
+ "description": "Check if a String has a given prefix.",
2506
2610
  "arguments": [
2507
2611
  {
2508
- "name": "Input",
2509
- "description": "Number to round up.",
2510
- "type": {
2511
- "type": "Number"
2512
- },
2612
+ "name": "String",
2513
2613
  "formula": {
2514
2614
  "type": "value",
2515
- "value": 1
2615
+ "value": ""
2616
+ },
2617
+ "description": "The String to check.",
2618
+ "type": {
2619
+ "type": "String"
2516
2620
  }
2517
2621
  },
2518
2622
  {
2519
- "name": "Decimals",
2520
- "description": "Number of decimals to round to.",
2521
- "type": {
2522
- "type": "Number"
2523
- },
2623
+ "name": "Prefix",
2524
2624
  "formula": {
2525
2625
  "type": "value",
2526
- "value": 0
2626
+ "value": ""
2627
+ },
2628
+ "description": "The prefix to check for.",
2629
+ "type": {
2630
+ "type": "String"
2527
2631
  }
2528
2632
  }
2529
2633
  ],
2530
2634
  "output": {
2635
+ "description": "Returns True if the input String starts with the prefix, otherwise False",
2531
2636
  "type": {
2532
- "type": "Number"
2533
- },
2534
- "description": "The rounded Number."
2637
+ "type": "Boolean"
2638
+ }
2535
2639
  }
2536
2640
  },
2537
- "@toddle/capitalize": {
2641
+ "@toddle/getHttpOnlyCookie": {
2538
2642
  "$schema": "../../schemas/libFormula.schema.json",
2539
- "name": "Capitalize",
2540
- "description": "Capitalize a string: make the first letter uppercase whilst keeping the rest lowercase.",
2643
+ "name": "Get Http-Only Cookie",
2644
+ "description": "Get the value of an Http-Only cookie by name. This formula is only intended to be used server-side for SSR/proxied API requests to read Http-Only cookies.",
2541
2645
  "arguments": [
2542
2646
  {
2543
- "name": "String",
2647
+ "name": "Cookie name",
2544
2648
  "formula": {
2545
2649
  "type": "value",
2546
- "value": "string"
2650
+ "value": null
2547
2651
  },
2548
- "description": "An input String.",
2652
+ "description": "The name of the Http-Only cookie you want to get the value of.",
2549
2653
  "type": {
2550
2654
  "type": "String"
2551
2655
  }
2552
2656
  }
2553
2657
  ],
2554
2658
  "output": {
2555
- "description": "The capitalized String.",
2659
+ "description": "The value of the cookie. If no cookie is found, this will return Null. If you use this formula client-side, it will return a placeholder template string.",
2556
2660
  "type": {
2557
2661
  "type": "String"
2558
2662
  }
2559
2663
  }
2560
2664
  },
2561
- "@toddle/greaterOrEqueal": {
2665
+ "@toddle/multiply": {
2562
2666
  "$schema": "../../schemas/libFormula.schema.json",
2563
- "name": "Greater or equal",
2564
- "description": "Compute whether a value is larger than or equal to another value.",
2667
+ "name": "Multiply",
2668
+ "description": "Multiply two or more Numbers.",
2565
2669
  "arguments": [
2566
2670
  {
2567
- "name": "First",
2671
+ "name": "0",
2568
2672
  "formula": {
2569
2673
  "type": "value",
2570
- "value": ""
2674
+ "value": 1
2571
2675
  },
2572
- "description": "First value to be compared.",
2573
2676
  "type": {
2574
2677
  "type": "Number"
2575
- }
2678
+ },
2679
+ "description": "Number to be multiplied."
2576
2680
  },
2577
2681
  {
2578
- "name": "Second",
2682
+ "name": "1",
2579
2683
  "formula": {
2580
2684
  "type": "value",
2581
- "value": ""
2685
+ "value": 1
2582
2686
  },
2583
- "description": "Second value to be compared.",
2584
2687
  "type": {
2585
2688
  "type": "Number"
2586
- }
2689
+ },
2690
+ "description": "Number to be multiplied."
2587
2691
  }
2588
2692
  ],
2693
+ "variableArguments": true,
2589
2694
  "output": {
2590
- "description": "Returns True if the first Number is larger than or equal to the second Number.",
2695
+ "description": "The product of multiplying the input Numbers.",
2591
2696
  "type": {
2592
- "type": "Boolean"
2697
+ "type": "Number"
2593
2698
  }
2594
2699
  }
2595
2700
  },
2596
- "@toddle/logarithm": {
2701
+ "@toddle/findIndex": {
2597
2702
  "$schema": "../../schemas/libFormula.schema.json",
2598
- "name": "Logarithm",
2599
- "description": "Return the logarithm of a Number.",
2703
+ "name": "Find index",
2704
+ "description": "Search through an Array of items and apply a formula to each item, to return the index of the first item where the formula returns True.",
2600
2705
  "arguments": [
2601
2706
  {
2602
- "name": "Number",
2707
+ "name": "Array",
2603
2708
  "formula": {
2604
2709
  "type": "value",
2605
- "value": 1
2710
+ "value": null
2606
2711
  },
2607
- "description": "A Number greater than or equal to 0.",
2712
+ "description": "The array to search.",
2608
2713
  "type": {
2609
- "type": "Number"
2714
+ "type": "Array"
2610
2715
  }
2611
- }
2612
- ],
2613
- "output": {
2614
- "type": {
2615
- "type": "Number"
2616
2716
  },
2617
- "description": "The natural logarithm of the Number."
2618
- }
2619
- },
2620
- "@toddle/size": {
2621
- "$schema": "../../schemas/libFormula.schema.json",
2622
- "name": "Size",
2623
- "description": "Get the size of an Array, Object or String.",
2624
- "arguments": [
2625
2717
  {
2626
- "name": "Collection",
2718
+ "name": "Formula",
2719
+ "isFunction": true,
2627
2720
  "formula": {
2628
- "type": "value",
2629
- "value": [
2630
- 1,
2631
- 2,
2632
- 3
2721
+ "type": "path",
2722
+ "path": [
2723
+ "Args",
2724
+ "item"
2633
2725
  ]
2634
2726
  },
2635
- "description": "The collection to get the size of.",
2727
+ "description": "The predicate formula that each item in the Array is passed to.",
2636
2728
  "type": {
2637
- "type": "Array \\| Object \\| String"
2729
+ "type": "Formula"
2638
2730
  }
2639
2731
  }
2640
2732
  ],
2641
2733
  "output": {
2642
- "description": "The size of the collection.",
2734
+ "description": "The index of the first item in the Array where the predicate formula returns True. Returns -1 if the predicate formula did not return True for any item.",
2643
2735
  "type": {
2644
- "type": "Number"
2736
+ "type": "Any"
2645
2737
  }
2646
2738
  }
2647
2739
  },
2648
- "@toddle/prepend": {
2740
+ "@toddle/range": {
2649
2741
  "$schema": "../../schemas/libFormula.schema.json",
2650
- "name": "Prepend",
2651
- "description": "Add an element to the start of an Array.",
2742
+ "name": "Range",
2743
+ "description": "Create an Array of numbers between a Min and Max value.",
2652
2744
  "arguments": [
2653
2745
  {
2654
- "name": "Array",
2655
- "type": {
2656
- "type": "Array"
2657
- },
2658
- "description": "The Array to prepend to.",
2659
2746
  "formula": {
2660
- "type": "array",
2661
- "arguments": []
2747
+ "type": "value",
2748
+ "value": 0
2749
+ },
2750
+ "name": "Min",
2751
+ "description": "The smallest value in the list.",
2752
+ "type": {
2753
+ "type": "Number"
2662
2754
  }
2663
2755
  },
2664
2756
  {
2665
- "name": "Item",
2666
- "type": {
2667
- "type": "Any"
2668
- },
2669
- "description": "The item to prepend to the Array.",
2757
+ "name": "Max",
2670
2758
  "formula": {
2671
2759
  "type": "value",
2672
- "value": "Item"
2760
+ "value": 10
2761
+ },
2762
+ "description": "The largest value in the list.",
2763
+ "type": {
2764
+ "type": "Number"
2673
2765
  }
2674
2766
  }
2675
2767
  ],
2676
2768
  "output": {
2677
- "description": "A new Array containing the new item and all the elements from the input Array.",
2769
+ "description": "An Array containing all the numbers between Min and Max, inclusive.",
2678
2770
  "type": {
2679
2771
  "type": "Array"
2680
2772
  }
2681
2773
  }
2682
2774
  },
2683
- "@toddle/decodeURIComponent": {
2775
+ "@toddle/trim": {
2684
2776
  "$schema": "../../schemas/libFormula.schema.json",
2685
- "name": "Decode URI Component",
2686
- "description": "Decode a URI component that was previously encoded with the Encode URI Component formula.",
2777
+ "name": "Trim",
2778
+ "description": "Remove any leading and trailing white spaces from a String.",
2687
2779
  "arguments": [
2688
2780
  {
2689
- "name": "EncodedURI",
2781
+ "name": "String",
2690
2782
  "formula": {
2691
2783
  "type": "value",
2692
- "value": null
2784
+ "value": ""
2693
2785
  },
2786
+ "description": "The String to trim.",
2694
2787
  "type": {
2695
2788
  "type": "String"
2696
- },
2697
- "description": "The encoded URI to decode."
2789
+ }
2698
2790
  }
2699
2791
  ],
2700
2792
  "output": {
2701
- "description": "The decoded URI component.",
2793
+ "description": "The trimmed String.",
2702
2794
  "type": {
2703
2795
  "type": "String"
2704
2796
  }
2705
2797
  }
2706
2798
  },
2707
- "@toddle/roundDown": {
2799
+ "@toddle/not": {
2708
2800
  "$schema": "../../schemas/libFormula.schema.json",
2709
- "name": "Round down",
2710
- "description": "Round a Number down to the nearest decimal point.",
2801
+ "name": "Not",
2802
+ "description": "Get the Boolean opposite of an input value.",
2711
2803
  "arguments": [
2712
2804
  {
2713
2805
  "name": "Input",
2714
- "description": "Number to round down.",
2715
- "type": {
2716
- "type": "Number"
2717
- },
2718
2806
  "formula": {
2719
2807
  "type": "value",
2720
- "value": 1
2721
- }
2722
- },
2723
- {
2724
- "name": "Decimals",
2725
- "description": "Number of decimals to round to.",
2726
- "type": {
2727
- "type": "Number"
2808
+ "value": true
2728
2809
  },
2729
- "formula": {
2730
- "type": "value",
2731
- "value": 0
2810
+ "description": "The input value.",
2811
+ "type": {
2812
+ "type": "Boolean"
2732
2813
  }
2733
2814
  }
2734
2815
  ],
2735
2816
  "output": {
2817
+ "description": "Returns True if the input value is False, and False if the input value is True.",
2736
2818
  "type": {
2737
- "type": "Number"
2738
- },
2739
- "description": "The rounded Number."
2819
+ "type": "Boolean"
2820
+ }
2740
2821
  }
2741
2822
  },
2742
- "@toddle/groupBy": {
2823
+ "@toddle/formatNumber": {
2743
2824
  "$schema": "../../schemas/libFormula.schema.json",
2744
- "name": "Group by",
2745
- "description": "Group an Array of items into an Object based on a grouping formula.",
2825
+ "name": "Format Number",
2746
2826
  "arguments": [
2747
2827
  {
2748
- "name": "Array",
2828
+ "name": "Input",
2829
+ "description": "Number to format.",
2830
+ "type": {
2831
+ "type": "Number"
2832
+ },
2749
2833
  "formula": {
2750
2834
  "type": "value",
2751
- "value": null
2752
- },
2753
- "description": "Array of items to be grouped.",
2754
- "type": {
2755
- "type": "Array"
2835
+ "value": 100
2756
2836
  }
2757
2837
  },
2758
2838
  {
2759
- "name": "Formula",
2760
- "isFunction": true,
2839
+ "name": "Locale(s)",
2840
+ "description": "Optional locale to use for formatting the Number, e.g. \"en\" or \"fr\". Multiple locales can be provided (as an Array of Strings) to provide a fallback locale. The default value is the runtime's locale.",
2841
+ "type": {
2842
+ "type": "Array \\| String"
2843
+ },
2761
2844
  "formula": {
2762
2845
  "type": "value",
2763
2846
  "value": null
2764
- },
2765
- "description": "The grouping formula used to group the items. The String returned from the formula will match the key in the output Oject.",
2766
- "type": {
2767
- "type": "Formula"
2768
2847
  }
2769
- }
2770
- ],
2771
- "output": {
2772
- "description": "An Object where each key matches a value returned by the grouping formula, and each value is the list of items that share the return value.",
2773
- "type": {
2774
- "type": "Object"
2775
- }
2776
- }
2777
- },
2778
- "@toddle/currentURL": {
2779
- "$schema": "../../schemas/libFormula.schema.json",
2780
- "name": "Current URL",
2781
- "description": "Return the current URL of the browser. Use the \"Parse URL\" formula for working with the URL.",
2782
- "arguments": [],
2783
- "cache": false,
2784
- "output": {
2785
- "description": "The browser's current URL.",
2786
- "type": {
2787
- "type": "String"
2788
- }
2789
- }
2790
- },
2791
- "@toddle/branchName": {
2792
- "$schema": "../../schemas/libFormula.schema.json",
2793
- "name": "Branch Name",
2794
- "description": "Get the name of the current branch. For production, the branch name is 'main'.",
2795
- "arguments": [],
2796
- "output": {
2797
- "description": "Returns the name of the current branch.",
2798
- "type": {
2799
- "type": "String"
2800
- }
2801
- }
2802
- },
2803
- "@toddle/concatenate": {
2804
- "$schema": "../../schemas/libFormula.schema.json",
2805
- "name": "Concatenate",
2806
- "description": "Concatenate two or more values.",
2807
- "arguments": [
2848
+ },
2808
2849
  {
2809
- "name": "0",
2810
- "formula": {
2811
- "type": "value",
2812
- "value": ""
2813
- },
2850
+ "name": "Options",
2851
+ "description": "Optional Object for configuring the formatting of the output. See the [NumberFormat locale options on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#locale_options).",
2814
2852
  "type": {
2815
- "type": "Array \\| String \\| Object"
2853
+ "type": "Object"
2854
+ },
2855
+ "formula": {
2856
+ "type": "value",
2857
+ "value": null
2816
2858
  }
2817
2859
  }
2818
2860
  ],
2819
- "variableArguments": true,
2861
+ "description": "Format a Number using the Intl.NumberFormat API. See the [NumberFormat docs on MDN]().",
2820
2862
  "output": {
2863
+ "description": "The Number input formatted as a String.",
2821
2864
  "type": {
2822
- "type": "Array \\| String \\| Object"
2823
- },
2824
- "description": "Returns a String, Array or Object containing all the specified input values."
2865
+ "type": "String"
2866
+ }
2825
2867
  }
2826
2868
  },
2827
- "@toddle/greaterThan": {
2869
+ "@toddle/notEqual": {
2828
2870
  "$schema": "../../schemas/libFormula.schema.json",
2829
- "name": "Greater than",
2830
- "description": "Compute if a value is larger than another value.",
2871
+ "name": "Not equal",
2872
+ "description": "Compute if values are not identical.",
2831
2873
  "arguments": [
2832
2874
  {
2833
2875
  "name": "First",
@@ -2835,9 +2877,9 @@
2835
2877
  "type": "value",
2836
2878
  "value": ""
2837
2879
  },
2838
- "description": "First value to be compared.",
2880
+ "description": "First value.",
2839
2881
  "type": {
2840
- "type": "Number"
2882
+ "type": "Any"
2841
2883
  }
2842
2884
  },
2843
2885
  {
@@ -2846,161 +2888,168 @@
2846
2888
  "type": "value",
2847
2889
  "value": ""
2848
2890
  },
2849
- "description": "Second value to be compared.",
2891
+ "description": "Second value.",
2850
2892
  "type": {
2851
- "type": "Number"
2893
+ "type": "Any"
2852
2894
  }
2853
2895
  }
2854
2896
  ],
2855
2897
  "output": {
2856
- "description": "Returns True if the first Number is larger than the second Number.",
2898
+ "description": "Returns True if the values are not identical, otherwise False.",
2857
2899
  "type": {
2858
- "type": "Boolean"
2900
+ "type": "Any"
2859
2901
  }
2860
2902
  }
2861
2903
  },
2862
- "@toddle/json": {
2904
+ "@toddle/keyBy": {
2863
2905
  "$schema": "../../schemas/libFormula.schema.json",
2864
- "name": "JSON",
2865
- "description": "Convert a value into a JSON String.",
2906
+ "name": "Key by",
2907
+ "description": "Organize an Array of items into an Object based on a Key formula.",
2866
2908
  "arguments": [
2867
2909
  {
2868
- "name": "Input",
2910
+ "name": "Array",
2869
2911
  "formula": {
2870
2912
  "type": "value",
2871
2913
  "value": null
2872
2914
  },
2873
- "description": "The input value.",
2915
+ "description": "Array of items.",
2874
2916
  "type": {
2875
- "type": "Any"
2917
+ "type": "Array"
2876
2918
  }
2877
2919
  },
2878
2920
  {
2879
- "name": "Indentation",
2921
+ "name": "Formula",
2922
+ "isFunction": true,
2880
2923
  "formula": {
2881
2924
  "type": "value",
2882
- "value": 0
2925
+ "value": null
2883
2926
  },
2884
- "description": "The number of spaces used for indentation in the JSON String.",
2927
+ "description": "The key formula used to index the items. The String returned from the formula will match the key in the output Object.",
2885
2928
  "type": {
2886
- "type": "Number"
2929
+ "type": "Formula"
2887
2930
  }
2888
2931
  }
2889
2932
  ],
2890
2933
  "output": {
2891
- "description": "The JSON String.",
2934
+ "description": "An Object where each key matches a value returned by the key formula, and each value is the item that String was returned for.",
2892
2935
  "type": {
2893
- "type": "String"
2936
+ "type": "Object"
2894
2937
  }
2895
2938
  }
2896
2939
  },
2897
- "@toddle/equals": {
2940
+ "@toddle/decodeBase64": {
2898
2941
  "$schema": "../../schemas/libFormula.schema.json",
2899
- "name": "Equals",
2900
- "description": "Compute if values are identical.",
2942
+ "name": "Decode base64",
2901
2943
  "arguments": [
2902
2944
  {
2903
- "name": "First",
2945
+ "name": "Base64 value",
2904
2946
  "formula": {
2905
2947
  "type": "value",
2906
- "value": ""
2948
+ "value": "Input value"
2907
2949
  },
2908
- "description": "First Value",
2909
2950
  "type": {
2910
- "type": "Any"
2911
- }
2912
- },
2913
- {
2914
- "name": "Second",
2915
- "formula": {
2916
- "type": "value",
2917
- "value": ""
2951
+ "type": "String"
2918
2952
  },
2919
- "description": "Second Value",
2920
- "type": {
2921
- "type": "Any"
2922
- }
2953
+ "description": "The input data encoded as base64."
2923
2954
  }
2924
2955
  ],
2956
+ "description": "Deocde a base64 string to utf-8.",
2925
2957
  "output": {
2926
- "description": "Returns True if the input values are identical, otherwise False.",
2958
+ "description": "The decoded string.",
2927
2959
  "type": {
2928
- "type": "Boolean"
2960
+ "type": "String"
2929
2961
  }
2930
2962
  }
2931
2963
  },
2932
- "@toddle/startsWith": {
2964
+ "@toddle/split": {
2933
2965
  "$schema": "../../schemas/libFormula.schema.json",
2934
- "name": "Starts with",
2935
- "description": "Check if a String has a given prefix.",
2966
+ "name": "Split",
2967
+ "description": "Split a String into an Array of smaller strings each time a delimiter occurs. The delimiter will not be part of the output.",
2936
2968
  "arguments": [
2937
2969
  {
2938
- "name": "String",
2970
+ "name": "Input",
2939
2971
  "formula": {
2940
2972
  "type": "value",
2941
2973
  "value": ""
2942
2974
  },
2943
- "description": "The String to check.",
2975
+ "description": "The String to split.",
2944
2976
  "type": {
2945
2977
  "type": "String"
2946
2978
  }
2947
2979
  },
2948
2980
  {
2949
- "name": "Prefix",
2981
+ "name": "Delimiter",
2950
2982
  "formula": {
2951
2983
  "type": "value",
2952
2984
  "value": ""
2953
2985
  },
2954
- "description": "The prefix to check for.",
2986
+ "description": "The string to split by.",
2955
2987
  "type": {
2956
2988
  "type": "String"
2957
2989
  }
2958
2990
  }
2959
2991
  ],
2960
2992
  "output": {
2961
- "description": "Returns True if the input String starts with the prefix, otherwise False",
2993
+ "description": "An array of Strings.",
2962
2994
  "type": {
2963
- "type": "Boolean"
2995
+ "type": "Array",
2996
+ "ofType": {
2997
+ "type": "String"
2998
+ }
2964
2999
  }
2965
3000
  }
2966
- },
2967
- "@toddle/take": {
2968
- "$schema": "../../schemas/libFormula.schema.json",
2969
- "name": "Take",
2970
- "description": "Take items from the start of an Array or String.",
3001
+ }
3002
+ };
3003
+ export const actions = {
3004
+ "@toddle/deleteFromSessionStorage": {
3005
+ "$schema": "../../schemas/libAction.schema.json",
3006
+ "name": "Delete from session storage",
3007
+ "description": "Delete a value from session storage (if found) based on the provided key.",
3008
+ "group": "session_storage",
2971
3009
  "arguments": [
2972
3010
  {
2973
- "name": "Array",
3011
+ "name": "Key",
3012
+ "description": "The key in session storage to delete.",
3013
+ "type": {
3014
+ "type": "String"
3015
+ },
2974
3016
  "formula": {
2975
3017
  "type": "value",
2976
- "value": null
2977
- },
2978
- "description": "Input Array or String.",
2979
- "type": {
2980
- "type": "Array \\| String"
3018
+ "value": ""
2981
3019
  }
2982
- },
3020
+ }
3021
+ ]
3022
+ },
3023
+ "@toddle/saveToLocalStorage": {
3024
+ "$schema": "../../schemas/libAction.schema.json",
3025
+ "name": "Save to local storage",
3026
+ "description": "Save a provided key/value to local storage by JSON encoding the value.",
3027
+ "group": "local_storage",
3028
+ "arguments": [
2983
3029
  {
2984
- "name": "Count",
3030
+ "name": "Key",
3031
+ "description": "The key to be used in local storage.",
3032
+ "type": {
3033
+ "type": "String"
3034
+ },
2985
3035
  "formula": {
2986
3036
  "type": "value",
2987
- "value": 1
2988
- },
3037
+ "value": ""
3038
+ }
3039
+ },
3040
+ {
3041
+ "name": "Value",
3042
+ "description": "The value that should be saved in local storage. This can be anything that is serializable (String, Number, Boolean, Array or Object).",
2989
3043
  "type": {
2990
- "type": "Number"
3044
+ "type": "Any"
2991
3045
  },
2992
- "description": "Number of items to take."
2993
- }
2994
- ],
2995
- "output": {
2996
- "description": "The first items from the Array or String.",
2997
- "type": {
2998
- "type": "Array \\| String"
3046
+ "formula": {
3047
+ "type": "value",
3048
+ "value": null
3049
+ }
2999
3050
  }
3000
- }
3001
- }
3002
- };
3003
- export const actions = {
3051
+ ]
3052
+ },
3004
3053
  "@toddle/interval": {
3005
3054
  "$schema": "../../schemas/libAction.schema.json",
3006
3055
  "name": "Interval",
@@ -3054,53 +3103,112 @@
3054
3103
  }
3055
3104
  }
3056
3105
  },
3057
- "@toddle/sleep": {
3106
+ "@toddle/deleteFromLocalStorage": {
3058
3107
  "$schema": "../../schemas/libAction.schema.json",
3059
- "name": "Sleep",
3060
- "description": "Run an action after a delay.",
3061
- "group": "timers",
3108
+ "name": "Delete from local storage",
3109
+ "description": "Delete a value from local storage (if found) based on the provided key.",
3110
+ "group": "local_storage",
3111
+ "arguments": [
3112
+ {
3113
+ "name": "Key",
3114
+ "description": "The key in local storage to delete.",
3115
+ "type": {
3116
+ "type": "String"
3117
+ },
3118
+ "formula": {
3119
+ "type": "value",
3120
+ "value": ""
3121
+ }
3122
+ }
3123
+ ]
3124
+ },
3125
+ "@toddle/setSessionCookies": {
3126
+ "$schema": "../../schemas/libAction.schema.json",
3127
+ "name": "Set session cookies",
3128
+ "description": "Save authentication tokens as session cookies.",
3129
+ "deprecated": true,
3130
+ "supercededBy": "Set HttpOnly cookie",
3131
+ "group": "cookies",
3132
+ "arguments": [
3133
+ {
3134
+ "name": "Access token",
3135
+ "description": "Access tokens are the most common way to authenticate with a server.",
3136
+ "type": {
3137
+ "type": "String"
3138
+ },
3139
+ "formula": {
3140
+ "type": "value",
3141
+ "value": ""
3142
+ }
3143
+ },
3144
+ {
3145
+ "name": "Expires in",
3146
+ "description": "(Optional) Time in seconds until the token expires. Defaults to 3600 (1 hour). This should be left blank for JWTs.",
3147
+ "type": {
3148
+ "type": "Number"
3149
+ },
3150
+ "formula": {
3151
+ "type": "value",
3152
+ "value": ""
3153
+ }
3154
+ }
3155
+ ],
3156
+ "events": {
3157
+ "Success": {
3158
+ "description": "This event is triggered once the tokens have been saved.",
3159
+ "actions": []
3160
+ },
3161
+ "Error": {
3162
+ "description": "This event is triggered if Nordcraft is unable to set the session cookies.",
3163
+ "actions": []
3164
+ }
3165
+ }
3166
+ },
3167
+ "@toddle/clearLocalStorage": {
3168
+ "$schema": "../../schemas/libAction.schema.json",
3169
+ "name": "Clear local storage",
3170
+ "description": "Delete all values in local storage.",
3171
+ "group": "local_storage",
3172
+ "arguments": []
3173
+ },
3174
+ "@toddle/clearSessionStorage": {
3175
+ "$schema": "../../schemas/libAction.schema.json",
3176
+ "name": "Clear session storage",
3177
+ "description": "Delete all values in session storage.",
3178
+ "group": "session_storage",
3179
+ "arguments": []
3180
+ },
3181
+ "@toddle/logToConsole": {
3182
+ "$schema": "../../schemas/libAction.schema.json",
3183
+ "name": "Log to console",
3184
+ "description": "Log a message to the browser console.",
3185
+ "group": "debugging",
3062
3186
  "arguments": [
3063
3187
  {
3064
- "name": "Delay in milliseconds",
3065
- "description": "The number of milliseconds to wait before an action is executed.",
3066
- "type": {
3067
- "type": "Number"
3068
- },
3188
+ "name": "Label",
3189
+ "description": "A label for the message.",
3069
3190
  "formula": {
3070
3191
  "type": "value",
3071
- "value": 500
3192
+ "value": ""
3072
3193
  }
3073
- }
3074
- ],
3075
- "events": {
3076
- "tick": {
3077
- "actions": []
3078
- }
3079
- }
3080
- },
3081
- "@toddle/deleteFromLocalStorage": {
3082
- "$schema": "../../schemas/libAction.schema.json",
3083
- "name": "Delete from local storage",
3084
- "description": "Delete a value from local storage (if found) based on the provided key.",
3085
- "group": "local_storage",
3086
- "arguments": [
3194
+ },
3087
3195
  {
3088
- "name": "Key",
3089
- "description": "The key in local storage to delete.",
3196
+ "name": "Data",
3090
3197
  "type": {
3091
- "type": "String"
3198
+ "type": "Any"
3092
3199
  },
3200
+ "description": "The data you want to log to the console.",
3093
3201
  "formula": {
3094
3202
  "type": "value",
3095
- "value": ""
3203
+ "value": "<Data>"
3096
3204
  }
3097
3205
  }
3098
3206
  ]
3099
3207
  },
3100
- "@toddle/setCookie": {
3208
+ "@toddle/setHttpOnlyCookie": {
3101
3209
  "$schema": "../../schemas/libAction.schema.json",
3102
- "name": "Set cookie",
3103
- "description": "Save a key/value pair as a non-http-only cookie (readable on the client). Useful for storing user preferences.",
3210
+ "name": "Set HttpOnly cookie",
3211
+ "description": "Save a key/value pair as an Http-Only cookie. Useful for storing JWTs or other tokens.",
3104
3212
  "group": "cookies",
3105
3213
  "arguments": [
3106
3214
  {
@@ -3111,7 +3219,7 @@
3111
3219
  },
3112
3220
  "formula": {
3113
3221
  "type": "value",
3114
- "value": ""
3222
+ "value": "access_token"
3115
3223
  }
3116
3224
  },
3117
3225
  {
@@ -3127,7 +3235,7 @@
3127
3235
  },
3128
3236
  {
3129
3237
  "name": "Expires in",
3130
- "description": "(Optional) Time in seconds until the cookie expires. If this is null, the cookie will expire at the end of the user's session.",
3238
+ "description": "(Optional) Time in seconds until the cookie expires. This should be null for JWTs to use the JWT's expiration. If not provided, the cookie will be a session cookie. If set to 0, the cookie will be deleted.",
3131
3239
  "type": {
3132
3240
  "type": "Number"
3133
3241
  },
@@ -3181,55 +3289,6 @@
3181
3289
  }
3182
3290
  }
3183
3291
  },
3184
- "@toddle/share": {
3185
- "$schema": "../../schemas/libAction.schema.json",
3186
- "name": "Share",
3187
- "description": "Share data with title, text, and/or URL using the Navigator.share API.",
3188
- "group": "sharing",
3189
- "arguments": [
3190
- {
3191
- "name": "URL",
3192
- "description": "The URL to share.",
3193
- "type": {
3194
- "type": "String"
3195
- },
3196
- "formula": {
3197
- "type": "value",
3198
- "value": null
3199
- }
3200
- },
3201
- {
3202
- "name": "Title",
3203
- "description": "The title to share.",
3204
- "type": {
3205
- "type": "String"
3206
- },
3207
- "formula": {
3208
- "type": "value",
3209
- "value": null
3210
- }
3211
- },
3212
- {
3213
- "name": "Text",
3214
- "description": "The text to share.",
3215
- "type": {
3216
- "type": "String"
3217
- },
3218
- "formula": {
3219
- "type": "value",
3220
- "value": null
3221
- }
3222
- }
3223
- ]
3224
- },
3225
- "@toddle/stopPropagation": {
3226
- "$schema": "../../schemas/libAction.schema.json",
3227
- "name": "Stop propagation",
3228
- "docs-link": "https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation",
3229
- "description": "Stop the event from bubbling up the DOM to parent elements.",
3230
- "group": "events",
3231
- "arguments": []
3232
- },
3233
3292
  "@toddle/saveToSessionStorage": {
3234
3293
  "$schema": "../../schemas/libAction.schema.json",
3235
3294
  "name": "Save to session storage",
@@ -3279,24 +3338,18 @@
3279
3338
  }
3280
3339
  ]
3281
3340
  },
3282
- "@toddle/clearSessionStorage": {
3283
- "$schema": "../../schemas/libAction.schema.json",
3284
- "name": "Clear session storage",
3285
- "description": "Delete all values in session storage.",
3286
- "group": "session_storage",
3287
- "arguments": []
3288
- },
3289
- "@toddle/clearLocalStorage": {
3341
+ "@toddle/stopPropagation": {
3290
3342
  "$schema": "../../schemas/libAction.schema.json",
3291
- "name": "Clear local storage",
3292
- "description": "Delete all values in local storage.",
3293
- "group": "local_storage",
3343
+ "name": "Stop propagation",
3344
+ "docs-link": "https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation",
3345
+ "description": "Stop the event from bubbling up the DOM to parent elements.",
3346
+ "group": "events",
3294
3347
  "arguments": []
3295
3348
  },
3296
- "@toddle/setHttpOnlyCookie": {
3349
+ "@toddle/setCookie": {
3297
3350
  "$schema": "../../schemas/libAction.schema.json",
3298
- "name": "Set HttpOnly cookie",
3299
- "description": "Save a key/value pair as an Http-Only cookie. Useful for storing JWTs or other tokens.",
3351
+ "name": "Set cookie",
3352
+ "description": "Save a key/value pair as a non-http-only cookie (readable on the client). Useful for storing user preferences.",
3300
3353
  "group": "cookies",
3301
3354
  "arguments": [
3302
3355
  {
@@ -3307,7 +3360,7 @@
3307
3360
  },
3308
3361
  "formula": {
3309
3362
  "type": "value",
3310
- "value": "access_token"
3363
+ "value": ""
3311
3364
  }
3312
3365
  },
3313
3366
  {
@@ -3323,7 +3376,7 @@
3323
3376
  },
3324
3377
  {
3325
3378
  "name": "Expires in",
3326
- "description": "(Optional) Time in seconds until the cookie expires. This should be null for JWTs to use the JWT's expiration. If not provided, the cookie will be a session cookie. If set to 0, the cookie will be deleted.",
3379
+ "description": "(Optional) Time in seconds until the cookie expires. If this is null, the cookie will expire at the end of the user's session.",
3327
3380
  "type": {
3328
3381
  "type": "Number"
3329
3382
  },
@@ -3377,40 +3430,21 @@
3377
3430
  }
3378
3431
  }
3379
3432
  },
3380
- "@toddle/deleteFromSessionStorage": {
3381
- "$schema": "../../schemas/libAction.schema.json",
3382
- "name": "Delete from session storage",
3383
- "description": "Delete a value from session storage (if found) based on the provided key.",
3384
- "group": "session_storage",
3385
- "arguments": [
3386
- {
3387
- "name": "Key",
3388
- "description": "The key in session storage to delete.",
3389
- "type": {
3390
- "type": "String"
3391
- },
3392
- "formula": {
3393
- "type": "value",
3394
- "value": ""
3395
- }
3396
- }
3397
- ]
3398
- },
3399
- "@toddle/gotToURL": {
3433
+ "@toddle/focus": {
3400
3434
  "$schema": "../../schemas/libAction.schema.json",
3401
- "name": "Go to URL",
3402
- "description": "Navigate to a specified URL.",
3403
- "group": "navigation",
3435
+ "name": "Focus",
3436
+ "description": "Move focus to a DOM element.",
3437
+ "group": "events",
3404
3438
  "arguments": [
3405
3439
  {
3406
- "name": "URL",
3407
- "description": "The URL to navigate to.",
3440
+ "name": "Element",
3441
+ "description": "The DOM element that should receive focus.",
3408
3442
  "type": {
3409
- "type": "String"
3443
+ "type": "Element"
3410
3444
  },
3411
3445
  "formula": {
3412
3446
  "type": "value",
3413
- "value": "https://example.com"
3447
+ "value": null
3414
3448
  }
3415
3449
  }
3416
3450
  ]
@@ -3423,120 +3457,86 @@
3423
3457
  "group": "events",
3424
3458
  "arguments": []
3425
3459
  },
3426
- "@toddle/saveToLocalStorage": {
3460
+ "@toddle/share": {
3427
3461
  "$schema": "../../schemas/libAction.schema.json",
3428
- "name": "Save to local storage",
3429
- "description": "Save a provided key/value to local storage by JSON encoding the value.",
3430
- "group": "local_storage",
3462
+ "name": "Share",
3463
+ "description": "Share data with title, text, and/or URL using the Navigator.share API.",
3464
+ "group": "sharing",
3431
3465
  "arguments": [
3432
3466
  {
3433
- "name": "Key",
3434
- "description": "The key to be used in local storage.",
3467
+ "name": "URL",
3468
+ "description": "The URL to share.",
3435
3469
  "type": {
3436
3470
  "type": "String"
3437
3471
  },
3438
3472
  "formula": {
3439
3473
  "type": "value",
3440
- "value": ""
3474
+ "value": null
3441
3475
  }
3442
3476
  },
3443
3477
  {
3444
- "name": "Value",
3445
- "description": "The value that should be saved in local storage. This can be anything that is serializable (String, Number, Boolean, Array or Object).",
3478
+ "name": "Title",
3479
+ "description": "The title to share.",
3446
3480
  "type": {
3447
- "type": "Any"
3481
+ "type": "String"
3448
3482
  },
3449
3483
  "formula": {
3450
3484
  "type": "value",
3451
3485
  "value": null
3452
3486
  }
3453
- }
3454
- ]
3455
- },
3456
- "@toddle/setSessionCookies": {
3457
- "$schema": "../../schemas/libAction.schema.json",
3458
- "name": "Set session cookies",
3459
- "description": "Save authentication tokens as session cookies.",
3460
- "deprecated": true,
3461
- "supercededBy": "Set HttpOnly cookie",
3462
- "group": "cookies",
3463
- "arguments": [
3487
+ },
3464
3488
  {
3465
- "name": "Access token",
3466
- "description": "Access tokens are the most common way to authenticate with a server.",
3489
+ "name": "Text",
3490
+ "description": "The text to share.",
3467
3491
  "type": {
3468
3492
  "type": "String"
3469
3493
  },
3470
3494
  "formula": {
3471
3495
  "type": "value",
3472
- "value": ""
3496
+ "value": null
3473
3497
  }
3474
- },
3498
+ }
3499
+ ]
3500
+ },
3501
+ "@toddle/sleep": {
3502
+ "$schema": "../../schemas/libAction.schema.json",
3503
+ "name": "Sleep",
3504
+ "description": "Run an action after a delay.",
3505
+ "group": "timers",
3506
+ "arguments": [
3475
3507
  {
3476
- "name": "Expires in",
3477
- "description": "(Optional) Time in seconds until the token expires. Defaults to 3600 (1 hour). This should be left blank for JWTs.",
3508
+ "name": "Delay in milliseconds",
3509
+ "description": "The number of milliseconds to wait before an action is executed.",
3478
3510
  "type": {
3479
3511
  "type": "Number"
3480
3512
  },
3481
3513
  "formula": {
3482
3514
  "type": "value",
3483
- "value": ""
3515
+ "value": 500
3484
3516
  }
3485
3517
  }
3486
3518
  ],
3487
3519
  "events": {
3488
- "Success": {
3489
- "description": "This event is triggered once the tokens have been saved.",
3490
- "actions": []
3491
- },
3492
- "Error": {
3493
- "description": "This event is triggered if Nordcraft is unable to set the session cookies.",
3520
+ "tick": {
3494
3521
  "actions": []
3495
3522
  }
3496
3523
  }
3497
3524
  },
3498
- "@toddle/focus": {
3499
- "$schema": "../../schemas/libAction.schema.json",
3500
- "name": "Focus",
3501
- "description": "Move focus to a DOM element.",
3502
- "group": "events",
3503
- "arguments": [
3504
- {
3505
- "name": "Element",
3506
- "description": "The DOM element that should receive focus.",
3507
- "type": {
3508
- "type": "Element"
3509
- },
3510
- "formula": {
3511
- "type": "value",
3512
- "value": null
3513
- }
3514
- }
3515
- ]
3516
- },
3517
- "@toddle/logToConsole": {
3525
+ "@toddle/gotToURL": {
3518
3526
  "$schema": "../../schemas/libAction.schema.json",
3519
- "name": "Log to console",
3520
- "description": "Log a message to the browser console.",
3521
- "group": "debugging",
3527
+ "name": "Go to URL",
3528
+ "description": "Navigate to a specified URL.",
3529
+ "group": "navigation",
3522
3530
  "arguments": [
3523
3531
  {
3524
- "name": "Label",
3525
- "description": "A label for the message.",
3526
- "formula": {
3527
- "type": "value",
3528
- "value": ""
3529
- }
3530
- },
3531
- {
3532
- "name": "Data",
3532
+ "name": "URL",
3533
+ "description": "The URL to navigate to.",
3533
3534
  "type": {
3534
- "type": "Any"
3535
+ "type": "String"
3535
3536
  },
3536
- "description": "The data you want to log to the console.",
3537
3537
  "formula": {
3538
3538
  "type": "value",
3539
- "value": "<Data>"
3539
+ "value": "https://example.com"
3540
3540
  }
3541
3541
  }
3542
3542
  ]