firefly-compiler 0.4.69 → 0.4.71

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.
@@ -7,6 +7,7 @@ import Handler
7
7
  data CompletionInfo(
8
8
  label: String
9
9
  extra: String
10
+ more: String
10
11
  snippet: String
11
12
  member: Bool
12
13
  type: Type
@@ -75,7 +76,7 @@ handleCompletion(lspHook: LspHook, toplevel: Bool, followedByOpenBracket: Bool):
75
76
  let fieldNames = n.split('$').dropFirst(1)
76
77
  let fieldCompletions = fieldNames.zip(ts).map {| Pair(name, t) =>
77
78
  let t2 = h.unification.substitute(t)
78
- CompletionInfo(name, "", name, True, t2, "(...)." + name + ": " + t2.show([]), Some(h.expected))
79
+ CompletionInfo(name, "", "", name, True, t2, "(...)." + name + ": " + t2.show([]), Some(h.expected))
79
80
  }
80
81
  [...fieldCompletions, ...completion(h.unification, h.environment, n, None, h.expected)]
81
82
  | InferArgumentHook h {
@@ -194,6 +195,7 @@ completionsToJson(completions: List[CompletionInfo]): Json {
194
195
  .with("label", i.label)
195
196
  .with("labelDetails", Json.object()
196
197
  .with("detail", i.extra + if(shownType == "") {""} else {": " + shownType})
198
+ .with("description", i.more)
197
199
  )
198
200
  .with("insertText", i.snippet)
199
201
  .with("insertTextFormat", 2 /* Snippet */)
@@ -213,7 +215,7 @@ typeCompletion(types: Map[String, String], typeGenerics: Map[String, List[String
213
215
  let label = typeName
214
216
  let extra = if(realGenerics.isEmpty()) {""} else {"[" + realGenerics.join(", ") + "]"}
215
217
  let snippet = typeName + if(realGenerics.isEmpty()) {""} else {"[$0]"}
216
- CompletionInfo(label, extra, snippet, False, TConstructor(Location("", 0, 0), "type", []), full, None)
218
+ CompletionInfo(label, extra, "", snippet, False, TConstructor(Location("", 0, 0), "type", []), full, None)
217
219
  }
218
220
  completions
219
221
  }
@@ -384,6 +386,7 @@ makeCompletion(
384
386
  CompletionInfo(
385
387
  label = shortName
386
388
  extra = pair.first
389
+ more = ""
387
390
  snippet = shortName + pair.second
388
391
  member = member && !copy
389
392
  type = returnType
@@ -398,6 +401,7 @@ exhaustiveMatchCompletion(environment: Environment, prefix: String, inside: Bool
398
401
  [CompletionInfo(
399
402
  label = curly.first + "| "
400
403
  extra = "[] => ... | [first, ...rest] => ..." + curly.second
404
+ more = ""
401
405
  snippet = curly.first + "\n | [] => $0\n | [first, ...rest] =>\n" + curly.second
402
406
  member = True
403
407
  type = TConstructor(Location("", 0, 0), "exhaustive match", [])
@@ -439,6 +443,7 @@ exhaustiveMatchCompletion(environment: Environment, prefix: String, inside: Bool
439
443
  [CompletionInfo(
440
444
  label = label.slice(0, 2)
441
445
  extra = label.dropFirst(2)
446
+ more = ""
442
447
  snippet = snippet
443
448
  member = True
444
449
  type = TConstructor(Location("", 0, 0), "exhaustive match", [])
@@ -454,16 +459,16 @@ patternCompletion(unification: Unification, environment: Environment, expected:
454
459
  }
455
460
  if(typeName == "") {[]} else:
456
461
  if(typeName == "ff:core/List.List") {
457
- [CompletionInfo("[...]", "", "[$0]", False, expected, "// List pattern", Some(expected))]
462
+ [CompletionInfo("[...]", "", "", "[$0]", False, expected, "// List pattern", Some(expected))]
458
463
  } else:
459
464
  if(typeName == "ff:core/String.String") {
460
- [CompletionInfo("\"...\"", "", "\"$0\"", False, expected, "// String pattern", Some(expected))]
465
+ [CompletionInfo("\"...\"", "", "", "\"$0\"", False, expected, "// String pattern", Some(expected))]
461
466
  } else:
462
467
  if(typeName == "ff:core/Char.Char") {
463
- [CompletionInfo("'...'", "", "'$0'", False, expected, "// Char pattern", Some(expected))]
468
+ [CompletionInfo("'...'", "", "", "'$0'", False, expected, "// Char pattern", Some(expected))]
464
469
  } else:
465
470
  if(typeName == "ff:core/Int.Int") {
466
- [CompletionInfo("0", "", "0", False, expected, "// Int pattern", Some(expected))]
471
+ [CompletionInfo("0", "", "", "0", False, expected, "// Int pattern", Some(expected))]
467
472
  } else:
468
473
  let variants = do {
469
474
  environment.symbols.toList().filter {s =>
@@ -492,6 +497,7 @@ patternCompletion(unification: Unification, environment: Environment, expected:
492
497
  CompletionInfo(
493
498
  label = shortName
494
499
  extra = extra
500
+ more = ""
495
501
  snippet = shortName + if(scheme.signature.parameters.isEmpty()) {""} else {"($0)"}
496
502
  member = False
497
503
  type = expected
@@ -544,7 +550,7 @@ missingCompletion(
544
550
  | TVariable _ => name + ": "
545
551
  }
546
552
  let documentation = "// Add missing parameter\n" + name + ": " + t.show([])
547
- [CompletionInfo(name, "", snippet, False, t, documentation, Some(t))]
553
+ [CompletionInfo(name, "", "", snippet, False, t, documentation, Some(t))]
548
554
  | Some(as) {isParameter} =>
549
555
  let noEffect = TConstructor(instantiated.scheme.signature.at, "ff:core/Nothing.Nothing", [])
550
556
  let t = unification.substitute(TConstructor(
@@ -557,12 +563,12 @@ missingCompletion(
557
563
  ]
558
564
  ))
559
565
  let documentation = "// Add missing parameter\n" + name + ": " + t.show([])
560
- [CompletionInfo(name, "", name + ": " + t.show([]), False, t, documentation, Some(t))]
566
+ [CompletionInfo(name, "", "", name + ": " + t.show([]), False, t, documentation, Some(t))]
561
567
  | None =>
562
568
  let t = unification.substitute(instantiated.scheme.signature.returnType)
563
569
  let snippet = name + " = "
564
570
  let documentation = "// Define missing variable\n" + name + ": " + t.show([])
565
- [CompletionInfo(snippet, "...", snippet, False, t, documentation, Some(t))]
571
+ [CompletionInfo(snippet, "...", "", snippet, False, t, documentation, Some(t))]
566
572
  | Some(as) =>
567
573
  mutable remainingParameters = instantiated.scheme.signature.parameters
568
574
  mutable usedNames = [].toSet()
@@ -603,7 +609,7 @@ missingCompletion(
603
609
  let snippet = if(shortSnippet.size() <= 100) {shortSnippet} else {longSnippet}
604
610
  let documentation = "// Define missing function\n" +
605
611
  if(shortSnippet.size() < 30) {shortSnippet} else {longSnippet}
606
- [CompletionInfo(name, extra, snippet + " {\n $0\n}", False, returnType, documentation, None)]
612
+ [CompletionInfo(name, extra, "", snippet + " {\n $0\n}", False, returnType, documentation, None)]
607
613
  }
608
614
  if(keyword && arguments.isEmpty()) {
609
615
  ["let ", "mutable "].flatMap {k => completions.map {c =>
@@ -622,6 +628,7 @@ namedParameterCompletion(parameter: Parameter, index: Int, preselect: Bool): Com
622
628
  CompletionInfo(
623
629
  label = parameter.name + " = "
624
630
  extra = "..."
631
+ more = ""
625
632
  snippet = parameter.name + " = "
626
633
  member = False
627
634
  type = parameter.valueType
@@ -636,6 +643,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
636
643
  CompletionInfo(
637
644
  label = "package",
638
645
  extra = " some:package:0.0.0",
646
+ more = ""
639
647
  snippet = "package ",
640
648
  member = False,
641
649
  type = TConstructor(lspHook.at, "", []),
@@ -645,6 +653,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
645
653
  CompletionInfo(
646
654
  label = "dependency",
647
655
  extra = " some:package:0.0.0",
656
+ more = ""
648
657
  snippet = "dependency ",
649
658
  member = False,
650
659
  type = TConstructor(lspHook.at, "", []),
@@ -654,6 +663,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
654
663
  CompletionInfo(
655
664
  label = "import",
656
665
  extra = " Module from some:package",
666
+ more = ""
657
667
  snippet = "import ",
658
668
  member = False,
659
669
  type = TConstructor(lspHook.at, "", []),
@@ -663,6 +673,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
663
673
  CompletionInfo(
664
674
  label = "extend",
665
675
  extra = " self[T]: SomeType[T] {...}",
676
+ more = ""
666
677
  snippet = "extend ",
667
678
  member = False,
668
679
  type = TConstructor(lspHook.at, "", []),
@@ -672,6 +683,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
672
683
  CompletionInfo(
673
684
  label = "data",
674
685
  extra = " SomeType[T](...) {...}",
686
+ more = ""
675
687
  snippet = "data ",
676
688
  member = False,
677
689
  type = TConstructor(lspHook.at, "", []),
@@ -681,6 +693,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
681
693
  CompletionInfo(
682
694
  label = "class",
683
695
  extra = " SomeType[T](...) {...}",
696
+ more = ""
684
697
  snippet = "class ",
685
698
  member = False,
686
699
  type = TConstructor(lspHook.at, "", []),
@@ -690,6 +703,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
690
703
  CompletionInfo(
691
704
  label = "capability",
692
705
  extra = " SomeType[T](...) {...}",
706
+ more = ""
693
707
  snippet = "capability ",
694
708
  member = False,
695
709
  type = TConstructor(lspHook.at, "", []),
@@ -699,6 +713,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
699
713
  CompletionInfo(
700
714
  label = "trait",
701
715
  extra = " T: SomeTrait {...}",
716
+ more = ""
702
717
  snippet = "trait ",
703
718
  member = False,
704
719
  type = TConstructor(lspHook.at, "", []),
@@ -708,6 +723,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
708
723
  CompletionInfo(
709
724
  label = "instance",
710
725
  extra = " SomeType: SomeTrait {...}",
726
+ more = ""
711
727
  snippet = "instance ",
712
728
  member = False,
713
729
  type = TConstructor(lspHook.at, "", []),
@@ -717,6 +733,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
717
733
  CompletionInfo(
718
734
  label = "nodeMain",
719
735
  extra = "(system: NodeSystem) {...}",
736
+ more = ""
720
737
  snippet = "nodeMain(system: NodeSystem) {\n $0\n}",
721
738
  member = False,
722
739
  type = TConstructor(lspHook.at, "", []),
@@ -726,6 +743,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
726
743
  CompletionInfo(
727
744
  label = "browserMain",
728
745
  extra = "(system: BrowserSystem) {...}",
746
+ more = ""
729
747
  snippet = "browserMain(system: BrowserSystem) {\n $0\n}",
730
748
  member = False,
731
749
  type = TConstructor(lspHook.at, "", []),
@@ -735,6 +753,7 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
735
753
  CompletionInfo(
736
754
  label = "buildMain",
737
755
  extra = "(system: BuildSystem) {...}",
756
+ more = ""
738
757
  snippet = "buildMain(system: NodeSystem) {\n $0\n}",
739
758
  member = False,
740
759
  type = TConstructor(lspHook.at, "", []),
@@ -744,14 +763,15 @@ toplevelCompletion(lspHook: LspHook): List[CompletionInfo] {
744
763
  CompletionInfo(
745
764
  label = "webapp",
746
765
  extra = " with frontend and backend",
766
+ more = ""
747
767
  snippet = [
748
768
  "dependency ff:webserver:0.0.0"
749
769
  "import WebServer from ff:webserver"
750
770
  ""
751
771
  "browserMain(system: BrowserSystem): Unit {"
752
- " let response = system.httpClient().fetch(\"http://localhost:8080/hello\")"
772
+ " let message = system.httpClient().get(\"http://localhost:8080/hello\", []) {_.readText()}"
753
773
  " let window = system.js().global().get(\"window\")"
754
- " window.call1(\"alert\", response.readText())"
774
+ " window.call1(\"alert\", message)"
755
775
  "}"
756
776
  ""
757
777
  "nodeMain(system: NodeSystem): Unit {"
package/lux/Main.ff CHANGED
@@ -39,11 +39,7 @@ questionComponent(lux: Lux, http: HttpClient, question: String) {
39
39
  lux.div {lux.text("User: " + question)}
40
40
  lux.useLazy1(question): _ =>
41
41
  lux.useSuspense {lux.div {lux.text("Assistant typing...")}}: lux =>
42
- let answer = http.fetch(
43
- url = "/chat"
44
- method = "POST"
45
- body = Some(HttpClient.bodyText(question))
46
- ).readText()
42
+ let answer = http.post("/chat", [], question.toBuffer()) {_.readText()}
47
43
  lux.div {lux.text("Assistant: " + answer)}
48
44
  }
49
45
  }
@@ -82,15 +78,14 @@ nodeMain(system: NodeSystem) {
82
78
  }
83
79
 
84
80
  fetchAnswer(httpClient: HttpClient, key: String, question: Json): String {
85
- let json = httpClient.fetch(
81
+ let json = httpClient.post(
86
82
  url = "https://api.openai.com/v1/chat/completions"
87
- method = "POST"
88
83
  headers = [
89
84
  Pair("Authorization", "Bearer " + key)
90
85
  Pair("Content-Type", "application/json")
91
86
  ]
92
- body = Some(HttpClient.bodyText(question.write()))
93
- ).readJson()
87
+ body = question.write().toBuffer()
88
+ ) {_.readJson()}
94
89
  json.field("choices").index(0).field("message").field("content").grabString()
95
90
  }
96
91
 
package/lux/Main2.ff CHANGED
@@ -92,7 +92,7 @@ rhymeComponent(lux: Lux, system: BrowserSystem) {
92
92
 
93
93
 
94
94
  rhyme(system: BrowserSystem, text: String): String {
95
- let result = system.httpClient().fetch("https://api.datamuse.com/words?rel_rhy=" + text)
95
+ let result = system.httpClient().get("https://api.datamuse.com/words?rel_rhy=" + text, [])
96
96
  let json = system.js().parseJson(result.readText())
97
97
  if(json.get(0).isNullOrUndefined()) {"?"} else {json.get(0).get("word").grabString()}
98
98
  }
@@ -256,11 +256,12 @@ ff_compiler_DependencyLock.DependencyLock_do(dependencyLock_, ff_core_Path.Path_
256
256
  if((!ff_core_Path.Path_exists(donePath_, false, false, false))) {
257
257
  return ff_core_Option.Some((function() {
258
258
  ff_core_Log.trace_(("Fetching " + location_));
259
- const response_ = ff_core_HttpClient.HttpClient_fetch(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false);
259
+ const buffer_ = ff_core_HttpClient.HttpClient_get(httpClient_, location_, [], ((response_) => {
260
260
  if((!ff_core_HttpClient.FetchResponse_ok(response_))) {
261
261
  ff_core_Core.panic_(("Could not download dependency: " + location_))
262
262
  };
263
- const buffer_ = ff_core_HttpClient.FetchResponse_readBuffer(response_);
263
+ return ff_core_HttpClient.FetchResponse_readBuffer(response_)
264
+ }));
264
265
  if(ff_core_Path.Path_exists(dependencyPath_, false, false, false)) {
265
266
  ff_core_Path.Path_delete(dependencyPath_, 0, 100)
266
267
  };
@@ -360,11 +361,12 @@ if((!(await ff_core_Path.Path_exists$(donePath_, false, false, false, $task))))
360
361
  if((!(await ff_core_Path.Path_exists$(donePath_, false, false, false, $task)))) {
361
362
  return ff_core_Option.Some((await (async function() {
362
363
  ff_core_Log.trace_(("Fetching " + location_));
363
- const response_ = (await ff_core_HttpClient.HttpClient_fetch$(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false, $task));
364
+ const buffer_ = (await ff_core_HttpClient.HttpClient_get$(httpClient_, location_, [], (async (response_, $task) => {
364
365
  if((!(await ff_core_HttpClient.FetchResponse_ok$(response_, $task)))) {
365
366
  ff_core_Core.panic_(("Could not download dependency: " + location_))
366
367
  };
367
- const buffer_ = (await ff_core_HttpClient.FetchResponse_readBuffer$(response_, $task));
368
+ return (await ff_core_HttpClient.FetchResponse_readBuffer$(response_, $task))
369
+ }), $task));
368
370
  if((await ff_core_Path.Path_exists$(dependencyPath_, false, false, false, $task))) {
369
371
  (await ff_core_Path.Path_delete$(dependencyPath_, 0, 100, $task))
370
372
  };
@@ -132,7 +132,7 @@ throw new Error('Function BrowserSystem_urlFragment is missing on this target in
132
132
  }
133
133
 
134
134
  export async function BrowserSystem_httpClient$(self_, $task) {
135
- return null
135
+ return typeof globalThis !== 'undefined' ? globalThis : window
136
136
  }
137
137
 
138
138
  export async function BrowserSystem_mainTask$(self_, $task) {
@@ -97,7 +97,7 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
97
97
 
98
98
  export function hypot_(values_) {
99
99
 
100
- return Math.hypot(...values);
100
+ return Math.hypot(...values_);
101
101
 
102
102
  }
103
103
 
@@ -218,156 +218,159 @@ return self_.toFixed(digits_)
218
218
  }
219
219
 
220
220
  export function Float_min(self_, that_) {
221
- return Math.min(self, that)
221
+ return Math.min(self_, that_)
222
222
  }
223
223
 
224
224
  export function Float_max(self_, that_) {
225
- return Math.max(self, that)
225
+ return Math.max(self_, that_)
226
226
  }
227
227
 
228
228
  export function Float_clamp(self_, from_, to_) {
229
- if((self_ <= from_)) {
230
- return from_
231
- } else if((self_ >= to_)) {
232
- return to_
233
- } else {
234
- return self_
229
+ return Math.min(Math.max(self_, from_), to_)
235
230
  }
231
+
232
+ export function Float_lerp(self_, that_, factor_) {
233
+ return (self_ + (factor_ * (that_ - self_)))
234
+ }
235
+
236
+ export function Float_smoothstep(self_, that_, factor_) {
237
+ const t_ = ff_core_Float.Float_clamp(((factor_ - self_) / (that_ - self_)), 0.0, 1.0);
238
+ return ((t_ * t_) * (3.0 - (2.0 * t_)))
236
239
  }
237
240
 
238
- export function Float_expDecay(self_, that_, decay_, delta_) {
239
- return (that_ + ((self_ - that_) * ff_core_Float.Float_exp(((-decay_) * delta_))))
241
+ export function Float_expDecay(self_, that_, decay_, factor_) {
242
+ return (that_ + ((self_ - that_) * ff_core_Float.Float_exp(((-decay_) * factor_))))
240
243
  }
241
244
 
242
245
  export function Float_acos(self_) {
243
246
 
244
- return Math.acos(self);
247
+ return Math.acos(self_);
245
248
 
246
249
  }
247
250
 
248
251
  export function Float_acosh(self_) {
249
252
 
250
- return Math.acosh(self);
253
+ return Math.acosh(self_);
251
254
 
252
255
  }
253
256
 
254
257
  export function Float_asin(self_) {
255
258
 
256
- return Math.asin(self);
259
+ return Math.asin(self_);
257
260
 
258
261
  }
259
262
 
260
263
  export function Float_asinh(self_) {
261
264
 
262
- return Math.asinh(self);
265
+ return Math.asinh(self_);
263
266
 
264
267
  }
265
268
 
266
269
  export function Float_atan(self_) {
267
270
 
268
- return Math.atan(self);
271
+ return Math.atan(self_);
269
272
 
270
273
  }
271
274
 
272
275
  export function Float_atan2(self_, that_) {
273
276
 
274
- return Math.atan2(self, that);
277
+ return Math.atan2(self_, that_);
275
278
 
276
279
  }
277
280
 
278
281
  export function Float_atanh(self_) {
279
282
 
280
- return Math.atanh(self);
283
+ return Math.atanh(self_);
281
284
 
282
285
  }
283
286
 
284
287
  export function Float_cbrt(self_) {
285
288
 
286
- return Math.cbrt(self);
289
+ return Math.cbrt(self_);
287
290
 
288
291
  }
289
292
 
290
293
  export function Float_cos(self_) {
291
294
 
292
- return Math.cos(self);
295
+ return Math.cos(self_);
293
296
 
294
297
  }
295
298
 
296
299
  export function Float_cosh(self_) {
297
300
 
298
- return Math.cosh(self);
301
+ return Math.cosh(self_);
299
302
 
300
303
  }
301
304
 
302
305
  export function Float_exp(self_) {
303
306
 
304
- return Math.exp(self);
307
+ return Math.exp(self_);
305
308
 
306
309
  }
307
310
 
308
311
  export function Float_expm1(self_) {
309
312
 
310
- return Math.expm1(self);
313
+ return Math.expm1(self_);
311
314
 
312
315
  }
313
316
 
314
317
  export function Float_log(self_, that_) {
315
318
 
316
- return Math.log2(self) / Math.log2(that);
319
+ return Math.log2(self_) / Math.log2(that_);
317
320
 
318
321
  }
319
322
 
320
323
  export function Float_log10(self_) {
321
324
 
322
- return Math.log10(self);
325
+ return Math.log10(self_);
323
326
 
324
327
  }
325
328
 
326
329
  export function Float_log2(self_) {
327
330
 
328
- return Math.log2(self);
331
+ return Math.log2(self_);
329
332
 
330
333
  }
331
334
 
332
335
  export function Float_ln(self_) {
333
336
 
334
- return Math.log(self);
337
+ return Math.log(self_);
335
338
 
336
339
  }
337
340
 
338
341
  export function Float_ln1p(self_) {
339
342
 
340
- return Math.log1p(self);
343
+ return Math.log1p(self_);
341
344
 
342
345
  }
343
346
 
344
347
  export function Float_sin(self_) {
345
348
 
346
- return Math.sin(self);
349
+ return Math.sin(self_);
347
350
 
348
351
  }
349
352
 
350
353
  export function Float_sinh(self_) {
351
354
 
352
- return Math.sinh(self);
355
+ return Math.sinh(self_);
353
356
 
354
357
  }
355
358
 
356
359
  export function Float_sqrt(self_) {
357
360
 
358
- return Math.sqrt(self);
361
+ return Math.sqrt(self_);
359
362
 
360
363
  }
361
364
 
362
365
  export function Float_tan(self_) {
363
366
 
364
- return Math.tan(self);
367
+ return Math.tan(self_);
365
368
 
366
369
  }
367
370
 
368
371
  export function Float_tanh(self_) {
369
372
 
370
- return Math.tanh(self);
373
+ return Math.tanh(self_);
371
374
 
372
375
  }
373
376
 
@@ -412,17 +415,20 @@ throw new Error('Function Float_max is missing on this target in async context.'
412
415
  }
413
416
 
414
417
  export async function Float_clamp$(self_, from_, to_, $task) {
415
- if((self_ <= from_)) {
416
- return from_
417
- } else if((self_ >= to_)) {
418
- return to_
419
- } else {
420
- return self_
418
+ throw new Error('Function Float_clamp is missing on this target in async context.');
421
419
  }
420
+
421
+ export async function Float_lerp$(self_, that_, factor_, $task) {
422
+ return (self_ + (factor_ * (that_ - self_)))
423
+ }
424
+
425
+ export async function Float_smoothstep$(self_, that_, factor_, $task) {
426
+ const t_ = ff_core_Float.Float_clamp(((factor_ - self_) / (that_ - self_)), 0.0, 1.0);
427
+ return ((t_ * t_) * (3.0 - (2.0 * t_)))
422
428
  }
423
429
 
424
- export async function Float_expDecay$(self_, that_, decay_, delta_, $task) {
425
- return (that_ + ((self_ - that_) * ff_core_Float.Float_exp(((-decay_) * delta_))))
430
+ export async function Float_expDecay$(self_, that_, decay_, factor_, $task) {
431
+ return (that_ + ((self_ - that_) * ff_core_Float.Float_exp(((-decay_) * factor_))))
426
432
  }
427
433
 
428
434
  export async function Float_acos$(self_, $task) {