create-mendix-widget-gleam 2.0.14 → 2.0.15
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/README.md +1 -1
- package/package.json +5 -1
- package/src/index.mjs +22 -7
- package/template/gleam.toml +1 -1
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@command.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@command.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@command.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@cursor.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@cursor.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@cursor.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@event.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@event.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@event.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@internal@consts.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@internal@consts.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@internal@consts.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@stdout.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@stdout.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@stdout.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@style.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@style.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@style.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@terminal.cache +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@terminal.cache_inline +0 -0
- package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@terminal.cache_meta +0 -0
- package/tui/build/dev/javascript/etch/etch/command.mjs +479 -0
- package/tui/build/dev/javascript/etch/etch/cursor.mjs +164 -0
- package/tui/build/dev/javascript/etch/etch/event.mjs +2399 -0
- package/tui/build/dev/javascript/etch/etch/internal/consts.mjs +3 -0
- package/tui/build/dev/javascript/etch/etch/stdout.mjs +375 -0
- package/tui/build/dev/javascript/etch/etch/style.mjs +741 -0
- package/tui/build/dev/javascript/etch/etch/terminal.mjs +137 -0
- package/tui/build/dev/javascript/etch/gleam.mjs +1 -0
- package/tui/build/dev/javascript/etch/input/event_ffi.erl +73 -0
- package/tui/build/dev/javascript/etch/input/input_ffi.mjs +192 -0
- package/tui/build/dev/javascript/etch/input/signal_handler.erl +33 -0
- package/tui/build/dev/javascript/etch/terminal/terminal_ffi.erl +22 -0
- package/tui/build/dev/javascript/etch/terminal/terminal_ffi.mjs +37 -0
- package/tui/build/dev/javascript/etch/terminal/tty_state.erl +29 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@application.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@application.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@application.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@atom.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@atom.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@atom.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@charlist.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@charlist.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@charlist.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@node.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@node.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@node.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@port.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@port.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@port.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@process.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@process.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@process.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@reference.cache +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@reference.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@reference.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/application.mjs +38 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/atom.mjs +2 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/charlist.mjs +1 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/node.mjs +12 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/port.mjs +1 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/process.mjs +161 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam/erlang/reference.mjs +1 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam.mjs +1 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@application.erl +43 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@atom.erl +94 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@charlist.erl +42 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@node.erl +80 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@port.erl +8 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@process.erl +868 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam@erlang@reference.erl +21 -0
- package/tui/build/dev/javascript/gleam_erlang/gleam_erlang_ffi.erl +164 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@promise.cache +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@promise.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@promise.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@symbol.cache +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@symbol.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@symbol.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_javascript/gleam/javascript/array.mjs +24 -0
- package/tui/build/dev/javascript/gleam_javascript/gleam/javascript/promise.mjs +105 -0
- package/tui/build/dev/javascript/gleam_javascript/gleam/javascript/symbol.mjs +7 -0
- package/tui/build/dev/javascript/gleam_javascript/gleam.mjs +1 -0
- package/tui/build/dev/javascript/gleam_javascript/gleam_javascript_ffi.mjs +133 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_inline +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache_meta +0 -0
- package/tui/build/dev/javascript/gleam_stdlib/dict.mjs +710 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/bit_array.mjs +286 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/bool.mjs +295 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/bytes_tree.mjs +225 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/dict.mjs +455 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/dynamic/decode.mjs +993 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/dynamic.mjs +35 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/float.mjs +528 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/function.mjs +6 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/int.mjs +764 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/io.mjs +8 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/list.mjs +3063 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/option.mjs +386 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/order.mjs +166 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/pair.mjs +96 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/result.mjs +448 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/set.mjs +413 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/string.mjs +695 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/string_tree.mjs +128 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam/uri.mjs +1151 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam.mjs +1 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@bit_array.erl +347 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@bool.erl +334 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@bytes_tree.erl +211 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@dict.erl +513 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@dynamic.erl +105 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@dynamic@decode.erl +1114 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@float.erl +711 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@function.erl +18 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@int.erl +972 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@io.erl +76 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@list.erl +2735 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@option.erl +381 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@order.erl +188 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@pair.erl +104 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@result.erl +500 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@set.erl +430 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@string.erl +964 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@string_tree.erl +202 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam@uri.erl +1042 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam_stdlib.erl +534 -0
- package/tui/build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs +1133 -0
- package/tui/build/dev/javascript/gleam_version +1 -0
- package/tui/build/dev/javascript/prelude.mjs +1575 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache_inline +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache_meta +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache_warnings +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache_inline +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache_meta +0 -0
- package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache_warnings +0 -0
- package/tui/build/dev/javascript/tui/gleam.mjs +1 -0
- package/tui/build/dev/javascript/tui/tui/prompt.mjs +521 -0
- package/tui/build/dev/javascript/tui/tui.mjs +334 -0
- package/tui/build/dev/javascript/tui/tui_ffi.mjs +32 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-module(gleam@erlang@reference).
|
|
2
|
+
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
|
|
3
|
+
-define(FILEPATH, "src/gleam/erlang/reference.gleam").
|
|
4
|
+
-export([new/0]).
|
|
5
|
+
-export_type([reference_/0]).
|
|
6
|
+
|
|
7
|
+
-if(?OTP_RELEASE >= 27).
|
|
8
|
+
-define(MODULEDOC(Str), -moduledoc(Str)).
|
|
9
|
+
-define(DOC(Str), -doc(Str)).
|
|
10
|
+
-else.
|
|
11
|
+
-define(MODULEDOC(Str), -compile([])).
|
|
12
|
+
-define(DOC(Str), -compile([])).
|
|
13
|
+
-endif.
|
|
14
|
+
|
|
15
|
+
-type reference_() :: any().
|
|
16
|
+
|
|
17
|
+
-file("src/gleam/erlang/reference.gleam", 15).
|
|
18
|
+
?DOC(" Create a new unique reference.\n").
|
|
19
|
+
-spec new() -> reference_().
|
|
20
|
+
new() ->
|
|
21
|
+
erlang:make_ref().
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
-module(gleam_erlang_ffi).
|
|
2
|
+
-export([
|
|
3
|
+
atom_from_string/1, sleep/1, sleep_forever/0, demonitor/1, new_selector/0,
|
|
4
|
+
link/1, insert_selector_handler/3, remove_selector_handler/2, select/1,
|
|
5
|
+
select/2, trap_exits/1, map_selector/2, merge_selector/2, flush_messages/0,
|
|
6
|
+
priv_directory/1, connect_node/1, register_process/2, unregister_process/1,
|
|
7
|
+
process_named/1, identity/1, 'receive'/1, 'receive'/2, new_name/1,
|
|
8
|
+
cast_down_message/1, cast_exit_reason/1
|
|
9
|
+
]).
|
|
10
|
+
|
|
11
|
+
-spec atom_from_string(binary()) -> {ok, atom()} | {error, nil}.
|
|
12
|
+
atom_from_string(S) ->
|
|
13
|
+
try {ok, binary_to_existing_atom(S)}
|
|
14
|
+
catch error:badarg -> {error, nil}
|
|
15
|
+
end.
|
|
16
|
+
|
|
17
|
+
new_name(Prefix) ->
|
|
18
|
+
Suffix = integer_to_binary(erlang:unique_integer([positive])),
|
|
19
|
+
Name = <<Prefix/bits, "$"/utf8, Suffix/bits>>,
|
|
20
|
+
binary_to_atom(Name).
|
|
21
|
+
|
|
22
|
+
sleep(Microseconds) ->
|
|
23
|
+
timer:sleep(Microseconds),
|
|
24
|
+
nil.
|
|
25
|
+
|
|
26
|
+
sleep_forever() ->
|
|
27
|
+
timer:sleep(infinity),
|
|
28
|
+
nil.
|
|
29
|
+
|
|
30
|
+
new_selector() ->
|
|
31
|
+
{selector, #{}}.
|
|
32
|
+
|
|
33
|
+
map_selector({selector, Handlers}, Fn) ->
|
|
34
|
+
MappedHandlers = maps:map(fun(_Tag, Handler) ->
|
|
35
|
+
fun(Message) -> Fn(Handler(Message)) end
|
|
36
|
+
end, Handlers),
|
|
37
|
+
{selector, MappedHandlers}.
|
|
38
|
+
|
|
39
|
+
merge_selector({selector, HandlersA}, {selector, HandlersB}) ->
|
|
40
|
+
{selector, maps:merge(HandlersA, HandlersB)}.
|
|
41
|
+
|
|
42
|
+
insert_selector_handler({selector, Handlers}, Tag, Fn) ->
|
|
43
|
+
{selector, Handlers#{Tag => Fn}}.
|
|
44
|
+
|
|
45
|
+
remove_selector_handler({selector, Handlers}, Tag) ->
|
|
46
|
+
{selector, maps:remove(Tag, Handlers)}.
|
|
47
|
+
|
|
48
|
+
select(Selector) ->
|
|
49
|
+
{ok, Message} = select(Selector, infinity),
|
|
50
|
+
Message.
|
|
51
|
+
|
|
52
|
+
select({selector, Handlers}, Timeout) ->
|
|
53
|
+
AnythingHandler = maps:get(anything, Handlers, undefined),
|
|
54
|
+
receive
|
|
55
|
+
% Monitored process down messages.
|
|
56
|
+
% This is special cased so we can selectively receive based on the
|
|
57
|
+
% reference as well as the record tag.
|
|
58
|
+
{'DOWN', Ref, _, _, _} = Message when is_map_key(Ref, Handlers) ->
|
|
59
|
+
Fn = maps:get(Ref, Handlers),
|
|
60
|
+
{ok, Fn(cast_down_message(Message))};
|
|
61
|
+
|
|
62
|
+
Msg when is_map_key({element(1, Msg), tuple_size(Msg)}, Handlers) ->
|
|
63
|
+
Fn = maps:get({element(1, Msg), tuple_size(Msg)}, Handlers),
|
|
64
|
+
{ok, Fn(Msg)};
|
|
65
|
+
|
|
66
|
+
Msg when AnythingHandler =/= undefined ->
|
|
67
|
+
{ok, AnythingHandler(Msg)}
|
|
68
|
+
after Timeout ->
|
|
69
|
+
{error, nil}
|
|
70
|
+
end.
|
|
71
|
+
|
|
72
|
+
cast_exit_reason(normal) -> normal;
|
|
73
|
+
cast_exit_reason(killed) -> killed;
|
|
74
|
+
cast_exit_reason(Other) -> {abnormal, Other}.
|
|
75
|
+
|
|
76
|
+
cast_down_message({'DOWN', Ref, process, Pid, Reason}) ->
|
|
77
|
+
{process_down, Ref, Pid, cast_exit_reason(Reason)};
|
|
78
|
+
cast_down_message({'DOWN', Ref, port, Pid, Reason}) ->
|
|
79
|
+
{port_down, Ref, Pid, cast_exit_reason(Reason)}.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
'receive'({subject, _Pid, Ref}) ->
|
|
83
|
+
receive
|
|
84
|
+
{Ref, Message} -> Message
|
|
85
|
+
end;
|
|
86
|
+
'receive'({named_subject, Name}) ->
|
|
87
|
+
receive
|
|
88
|
+
{Name, Message} -> Message
|
|
89
|
+
end.
|
|
90
|
+
|
|
91
|
+
'receive'({subject, _Pid, Ref}, Timeout) ->
|
|
92
|
+
receive
|
|
93
|
+
{Ref, Message} -> {ok, Message}
|
|
94
|
+
after Timeout ->
|
|
95
|
+
{error, nil}
|
|
96
|
+
end;
|
|
97
|
+
'receive'({named_subject, Name}, Timeout) ->
|
|
98
|
+
receive
|
|
99
|
+
{Name, Message} -> {ok, Message}
|
|
100
|
+
after Timeout ->
|
|
101
|
+
{error, nil}
|
|
102
|
+
end.
|
|
103
|
+
|
|
104
|
+
demonitor(Reference) ->
|
|
105
|
+
erlang:demonitor(Reference, [flush]).
|
|
106
|
+
|
|
107
|
+
link(Pid) ->
|
|
108
|
+
try
|
|
109
|
+
erlang:link(Pid)
|
|
110
|
+
catch
|
|
111
|
+
error:_ -> false
|
|
112
|
+
end.
|
|
113
|
+
|
|
114
|
+
trap_exits(ShouldTrap) ->
|
|
115
|
+
erlang:process_flag(trap_exit, ShouldTrap),
|
|
116
|
+
nil.
|
|
117
|
+
|
|
118
|
+
flush_messages() ->
|
|
119
|
+
receive _Message -> flush_messages()
|
|
120
|
+
after 0 -> nil
|
|
121
|
+
end.
|
|
122
|
+
|
|
123
|
+
priv_directory(Name) ->
|
|
124
|
+
try erlang:binary_to_existing_atom(Name) of
|
|
125
|
+
Atom ->
|
|
126
|
+
case code:priv_dir(Atom) of
|
|
127
|
+
{error, _} -> {error, nil};
|
|
128
|
+
Path -> {ok, unicode:characters_to_binary(Path)}
|
|
129
|
+
end
|
|
130
|
+
catch
|
|
131
|
+
error:badarg -> {error, nil}
|
|
132
|
+
end.
|
|
133
|
+
|
|
134
|
+
connect_node(Node) ->
|
|
135
|
+
case net_kernel:connect_node(Node) of
|
|
136
|
+
true -> {ok, Node};
|
|
137
|
+
false -> {error, failed_to_connect};
|
|
138
|
+
ignored -> {error, local_node_is_not_alive}
|
|
139
|
+
end.
|
|
140
|
+
|
|
141
|
+
register_process(Pid, Name) ->
|
|
142
|
+
try
|
|
143
|
+
true = erlang:register(Name, Pid),
|
|
144
|
+
{ok, nil}
|
|
145
|
+
catch
|
|
146
|
+
error:badarg -> {error, nil}
|
|
147
|
+
end.
|
|
148
|
+
|
|
149
|
+
unregister_process(Name) ->
|
|
150
|
+
try
|
|
151
|
+
true = erlang:unregister(Name),
|
|
152
|
+
{ok, nil}
|
|
153
|
+
catch
|
|
154
|
+
error:badarg -> {error, nil}
|
|
155
|
+
end.
|
|
156
|
+
|
|
157
|
+
process_named(Name) ->
|
|
158
|
+
case erlang:whereis(Name) of
|
|
159
|
+
Pid when is_pid(Pid) -> {ok, Pid};
|
|
160
|
+
_ -> {error, nil}
|
|
161
|
+
end.
|
|
162
|
+
|
|
163
|
+
identity(X) ->
|
|
164
|
+
X.
|
package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache
ADDED
|
Binary file
|
|
Binary file
|
package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache_meta
ADDED
|
Binary file
|
package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@promise.cache
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@symbol.cache
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toList, prepend as listPrepend } from "../../gleam.mjs";
|
|
2
|
+
import {
|
|
3
|
+
toArray as from_list,
|
|
4
|
+
length as size,
|
|
5
|
+
map,
|
|
6
|
+
reduce as fold,
|
|
7
|
+
reduceRight as fold_right,
|
|
8
|
+
index as get,
|
|
9
|
+
} from "../../gleam_javascript_ffi.mjs";
|
|
10
|
+
|
|
11
|
+
export { fold, fold_right, from_list, get, map, size };
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Convert a JavaScript array to a Gleam list.
|
|
15
|
+
*
|
|
16
|
+
* Runs in linear time.
|
|
17
|
+
*/
|
|
18
|
+
export function to_list(items) {
|
|
19
|
+
return fold_right(
|
|
20
|
+
items,
|
|
21
|
+
toList([]),
|
|
22
|
+
(list, item) => { return listPrepend(item, list); },
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as $dynamic from "../../../gleam_stdlib/gleam/dynamic.mjs";
|
|
2
|
+
import { Ok, Error } from "../../gleam.mjs";
|
|
3
|
+
import * as $array from "../../gleam/javascript/array.mjs";
|
|
4
|
+
import {
|
|
5
|
+
newPromise as new$,
|
|
6
|
+
start_promise as start,
|
|
7
|
+
resolve,
|
|
8
|
+
rescue,
|
|
9
|
+
then_await as await$,
|
|
10
|
+
map_promise as map,
|
|
11
|
+
all_promises as await_array,
|
|
12
|
+
all_promises as do_await_list,
|
|
13
|
+
race_promises as race_list,
|
|
14
|
+
race_promises as race_array,
|
|
15
|
+
wait,
|
|
16
|
+
} from "../../gleam_javascript_ffi.mjs";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
await$,
|
|
20
|
+
await_array,
|
|
21
|
+
map,
|
|
22
|
+
new$,
|
|
23
|
+
race_array,
|
|
24
|
+
race_list,
|
|
25
|
+
rescue,
|
|
26
|
+
resolve,
|
|
27
|
+
start,
|
|
28
|
+
wait,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Run a function on the value a promise resolves to, after it has resolved.
|
|
33
|
+
* The value returned is discarded.
|
|
34
|
+
*/
|
|
35
|
+
export function tap(promise, callback) {
|
|
36
|
+
let _pipe = promise;
|
|
37
|
+
return map(
|
|
38
|
+
_pipe,
|
|
39
|
+
(a) => {
|
|
40
|
+
callback(a);
|
|
41
|
+
return a;
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Run a function on the value a promise resolves to, after it has resolved.
|
|
48
|
+
*
|
|
49
|
+
* The function is only called if the value is `Ok`, and the returned becomes
|
|
50
|
+
* the new value contained by the promise.
|
|
51
|
+
*
|
|
52
|
+
* This is a convenience functin that combines the `map` function with `result.try`.
|
|
53
|
+
*/
|
|
54
|
+
export function map_try(promise, callback) {
|
|
55
|
+
let _pipe = promise;
|
|
56
|
+
return map(
|
|
57
|
+
_pipe,
|
|
58
|
+
(result) => {
|
|
59
|
+
if (result instanceof Ok) {
|
|
60
|
+
let a = result[0];
|
|
61
|
+
return callback(a);
|
|
62
|
+
} else {
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Run a promise returning function on the value a promise resolves to, after
|
|
71
|
+
* it has resolved.
|
|
72
|
+
*
|
|
73
|
+
* The function is only called if the value is `Ok`, and the returned becomes
|
|
74
|
+
* the new value contained by the promise.
|
|
75
|
+
*
|
|
76
|
+
* This is a convenience functin that combines the `await` function with
|
|
77
|
+
* `result.try`.
|
|
78
|
+
*/
|
|
79
|
+
export function try_await(promise, callback) {
|
|
80
|
+
let _pipe = promise;
|
|
81
|
+
return await$(
|
|
82
|
+
_pipe,
|
|
83
|
+
(result) => {
|
|
84
|
+
if (result instanceof Ok) {
|
|
85
|
+
let a = result[0];
|
|
86
|
+
return callback(a);
|
|
87
|
+
} else {
|
|
88
|
+
let e = result[0];
|
|
89
|
+
return resolve(new Error(e));
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Chain an asynchronous operation onto an list of promises, so it runs after the
|
|
97
|
+
* promises have resolved.
|
|
98
|
+
*
|
|
99
|
+
* This is the equivilent of the `Promise.all` JavaScript static method.
|
|
100
|
+
*/
|
|
101
|
+
export function await_list(xs) {
|
|
102
|
+
let _pipe = xs;
|
|
103
|
+
let _pipe$1 = do_await_list(_pipe);
|
|
104
|
+
return map(_pipe$1, $array.to_list);
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../prelude.mjs";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Ok, Error } from "./gleam.mjs";
|
|
2
|
+
export function toArray(list) {
|
|
3
|
+
return list.toArray();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function map(thing, fn) {
|
|
7
|
+
return thing.map(fn);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function length(thing) {
|
|
11
|
+
return thing.length;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function reduce(thing, acc, fn) {
|
|
15
|
+
return thing.reduce(fn, acc);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function reduceRight(thing, acc, fn) {
|
|
19
|
+
return thing.reduceRight(fn, acc);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function index(thing, index) {
|
|
23
|
+
return index in thing ? new Ok(thing[index]) : new Error(undefined);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function object_from_entries(entries) {
|
|
27
|
+
return Object.fromEntries(entries);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function new_symbol(name) {
|
|
31
|
+
return Symbol(name);
|
|
32
|
+
}
|
|
33
|
+
export function get_symbol(name) {
|
|
34
|
+
return Symbol.for(name);
|
|
35
|
+
}
|
|
36
|
+
export function symbol_description(symbol) {
|
|
37
|
+
const description = symbol.description;
|
|
38
|
+
if (symbol.description === undefined) return new Error(undefined);
|
|
39
|
+
return new Ok(description);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// A wrapper around a promise to prevent `Promise<Promise<T>>` collapsing into
|
|
43
|
+
// `Promise<T>`.
|
|
44
|
+
class PromiseLayer {
|
|
45
|
+
constructor(promise) {
|
|
46
|
+
this.promise = promise;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static wrap(value) {
|
|
50
|
+
return value instanceof Promise ? new PromiseLayer(value) : value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static unwrap(value) {
|
|
54
|
+
return value instanceof PromiseLayer ? value.promise : value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function newPromise(executor) {
|
|
59
|
+
return new Promise((resolve) =>
|
|
60
|
+
executor((value) => {
|
|
61
|
+
resolve(PromiseLayer.wrap(value));
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function start_promise() {
|
|
67
|
+
let resolve;
|
|
68
|
+
const promise = new Promise((r) => {
|
|
69
|
+
resolve = (value) => {
|
|
70
|
+
r(PromiseLayer.wrap(value));
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return [promise, resolve];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function resolve(value) {
|
|
77
|
+
return Promise.resolve(PromiseLayer.wrap(value));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function then_await(promise, fn) {
|
|
81
|
+
return promise.then((value) => fn(PromiseLayer.unwrap(value)));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function map_promise(promise, fn) {
|
|
85
|
+
return promise.then((value) =>
|
|
86
|
+
PromiseLayer.wrap(fn(PromiseLayer.unwrap(value))),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function rescue(promise, fn) {
|
|
91
|
+
return promise.catch((error) => fn(error));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function wait(delay) {
|
|
95
|
+
return new Promise((resolve) => {
|
|
96
|
+
globalThis.setTimeout(resolve, delay);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function all_promises(...promises) {
|
|
101
|
+
if (promises.length === 1) {
|
|
102
|
+
return Promise.all(promises[0]);
|
|
103
|
+
} else {
|
|
104
|
+
return Promise.all(promises);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function race_promises(...promises) {
|
|
109
|
+
if (promises.length === 1) {
|
|
110
|
+
return Promise.race(promises[0]);
|
|
111
|
+
} else {
|
|
112
|
+
return Promise.race(promises);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function map_new() {
|
|
117
|
+
return new Map();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function map_set(map, key, value) {
|
|
121
|
+
return map.set(key, value);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function map_get(map, key) {
|
|
125
|
+
if (map.has(key)) {
|
|
126
|
+
return new Ok(map.get(key));
|
|
127
|
+
}
|
|
128
|
+
return new Error(undefined);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function map_size(map) {
|
|
132
|
+
return map.size;
|
|
133
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_inline
ADDED
|
Binary file
|
package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_meta
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|