From e18f24166fd797f4f583f1029b2171675f3f059b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szikszai=20Guszt=C3=A1v?= Date: Fri, 9 Aug 2024 14:21:50 +0200 Subject: [PATCH] Started testing cli commands. --- .ameba.yml | 4 + .github/workflows/ci-base.yml | 3 + Makefile | 4 + core/docs.json | 1 - source.mint | 3 + spec/compilers/access | 19 +-- spec/{compilers2 => compilers}/access_deep | 0 spec/compilers/argument | 17 +- spec/compilers/argument_with_default | 17 +- .../argument_with_default_inline_function | 17 +- spec/compilers/array_literal | 24 +-- spec/compilers/block | 10 +- spec/compilers/block_with_await | 25 ++- spec/compilers/block_with_early_return | 45 ++---- spec/compilers/block_with_early_return_2 | 15 -- spec/compilers/block_with_early_return_await | 50 +++--- spec/compilers/block_with_tuple_destructuring | 16 +- spec/compilers/bool_literal_false | 20 +-- spec/compilers/bool_literal_true | 20 +-- spec/compilers/bracket_access | 52 +++--- spec/{compilers2 => compilers}/builtin | 0 spec/compilers/call_labelled | 21 +-- spec/compilers/case | 49 +++--- spec/compilers/case_await | 65 ++++---- spec/compilers/case_empty | 22 ++- spec/compilers/case_with_array_destructuring | 91 +++++------ .../case_with_nested_tuple_destructuring | 84 +++++----- spec/compilers/case_with_tuple_destructuring | 69 ++++---- .../case_with_tuple_destructuring_bool | 55 +++---- spec/compilers/case_with_type_destructuring | 83 ++++------ spec/compilers/component | 12 +- .../{compilers2 => compilers}/component_async | 0 .../component_async_2 | 0 .../component_async_3 | 0 .../component_async_4 | 0 .../component_async_5 | 0 .../component_children | 0 spec/compilers/component_global | 53 +++---- spec/compilers/component_instance_access | 114 ++++++------- .../component_instance_access_ref | 0 spec/compilers/component_namespaced | 24 +-- .../compilers/component_namespaced_with_style | 38 ++--- spec/compilers/component_readonly | 43 ++--- spec/compilers/component_with_provider | 70 +++----- ...nent_with_provider_and_lifecycle_functions | 87 ++++------ .../component_with_provider_and_store | 103 +++--------- spec/compilers/constant_component | 19 +-- spec/compilers/constant_global_component | 42 ++--- spec/compilers/constant_module | 25 +-- spec/compilers/constant_store | 26 +-- spec/compilers/constant_store_exposed | 39 +---- spec/compilers/css_definition | 49 +++--- spec/compilers/css_font_face | 22 ++- spec/compilers/css_font_face_with_quotes | 22 ++- spec/compilers/css_keyframes | 56 +++---- spec/compilers/css_media | 51 +++--- spec/compilers/css_media_with_if | 44 +++-- spec/compilers/css_selector | 49 +++--- spec/compilers/css_selector_multiple | 49 +++--- spec/compilers/css_string | 58 +++---- spec/compilers/css_supports | 56 +++---- spec/compilers/css_with_ands | 22 ++- spec/compilers/css_with_arguments | 41 +++-- spec/compilers/css_with_case | 43 +++-- spec/compilers/css_with_else_if | 49 +++--- spec/compilers/css_with_if | 40 +++-- spec/compilers/css_with_if_and_case | 44 +++-- spec/compilers/css_with_if_same_condition | 49 +++--- .../css_with_if_variables | 0 spec/compilers/css_with_if_with_interpolation | 40 +++-- .../dce_remove_component_computed_property | 10 +- spec/compilers/dce_remove_component_function | 10 +- spec/compilers/dce_remove_module_function | 20 +-- spec/compilers/dce_remove_provider | 6 - spec/compilers/dce_style | 10 +- spec/compilers/decode | 62 +++----- spec/compilers/decode_function | 52 +++--- spec/compilers/decode_map | 24 ++- spec/compilers/decode_tuple | 29 +++- spec/compilers/decoder | 108 ++++++------- spec/{compilers2 => compilers}/defer | 0 spec/{compilers2 => compilers}/defer_2 | 0 spec/compilers/destructuring | 85 ++++------ .../destructuring_constant | 0 .../destructuring_state | 0 spec/compilers/directives/asset | 12 +- spec/compilers/directives/documentation | 10 +- spec/compilers/directives/format | 16 +- spec/compilers/directives/highlight | 20 ++- spec/compilers/directives/highlight-file | 78 ++++++--- .../directives/inline | 0 spec/compilers/directives/svg | 21 ++- spec/compilers/encode | 43 ++--- spec/{compilers2 => compilers}/encode_nested | 0 .../encode_no_record | 0 .../encode_with_mapping | 0 .../encoder_and_decoder | 0 spec/compilers/env | 8 +- spec/compilers/field | 37 +---- spec/compilers/field_access | 41 ++--- spec/compilers/for | 34 ++-- .../for_with_destructuring | 0 spec/compilers/for_with_index | 44 ++--- spec/compilers/for_with_index_2 | 36 ++--- spec/compilers/function | 18 +-- spec/compilers/function_call_simple | 25 ++- spec/compilers/function_call_with_arguments | 25 ++- spec/compilers/get | 13 +- spec/compilers/here_doc_markdown | 16 +- .../here_doc_markdown_escape | 0 .../here_doc_markdown_in_markdown | 0 .../here_doc_markdown_with_code_block | 0 ...doc_markdown_with_code_block_interpolation | 0 ...wn_with_code_block_interpolation_highlight | 0 ...ere_doc_markdown_with_code_block_multiline | 0 .../here_doc_markdown_with_html_interpolation | 0 .../here_doc_markdown_with_inline_code | 0 .../here_doc_markdown_with_interpolation | 27 ++-- .../here_doc_new_line_char | 0 spec/compilers/here_doc_with_interpolation | 10 +- spec/compilers/here_doc_without_indentation | 10 +- spec/compilers/html_attribute_class | 14 +- .../compilers/html_attribute_class_with_style | 22 ++- spec/compilers/html_attribute_html_fragment | 41 ++--- spec/compilers/html_attribute_readonly | 15 +- spec/compilers/html_attribute_ref | 41 ++--- spec/compilers/html_attribute_simple | 14 +- spec/compilers/html_attribute_with_expression | 14 +- spec/compilers/html_component | 24 +-- spec/compilers/html_fragment | 21 +-- spec/compilers/html_fragment_empty | 12 +- spec/compilers/html_with_custom_style | 36 ++--- spec/compilers/html_with_multiple_styles | 22 ++- .../html_with_multiple_styles_and_parameters | 41 +++-- ...html_with_multiple_styles_and_parameters_2 | 59 +++---- spec/compilers/html_with_pseudos | 66 +++----- spec/compilers/html_with_string_style | 17 +- spec/compilers/html_with_style | 68 ++++---- .../html_with_style_and_custom_style | 66 ++++---- spec/compilers/if | 20 +-- spec/compilers/if_let | 40 ++--- spec/compilers/if_let_await | 45 ++---- spec/compilers/if_without_else_array | 10 +- spec/compilers/if_without_else_promise | 12 +- spec/compilers/if_without_else_string | 10 +- spec/compilers/indirect_connect | 62 ++------ spec/compilers/inline_function | 15 +- spec/compilers/inline_function_recursive | 29 ++-- spec/compilers/inline_function_with_arguments | 22 +-- spec/compilers/js | 8 +- spec/compilers/js_with_double_interpolation | 18 +-- spec/compilers/js_with_interpolation | 18 +-- spec/compilers/locale_key | 22 +-- spec/{compilers2 => compilers}/map | 0 spec/compilers/module | 22 +-- spec/compilers/module_access | 29 ++-- spec/compilers/module_access_get | 32 ++-- spec/compilers/module_access_subscriptions | 78 ++++----- spec/compilers/module_call | 27 ++-- spec/compilers/module_call_piped | 27 ++-- spec/compilers/next_call | 50 ++---- spec/compilers/next_call_empty | 10 +- spec/compilers/number_literal_negative | 21 +-- spec/compilers/number_literal_simple | 21 +-- spec/compilers/number_literal_with_decimal | 21 +-- spec/compilers/operation_chained | 21 +-- spec/compilers/operation_or | 55 +++---- spec/compilers/operation_simple | 21 +-- spec/compilers/parenthesized_expression | 21 +-- spec/compilers/pipe | 24 ++- spec/{compilers2 => compilers}/pipe_await | 0 spec/compilers/property | 39 ++--- spec/compilers/property_without_default | 42 ++--- spec/compilers/provider_with_items | 102 ++++-------- spec/compilers/record | 37 +---- spec/compilers/record_update | 55 ++----- spec/compilers/regexp_literal | 21 +-- spec/compilers/route | 21 --- spec/{compilers2 => compilers}/signal | 0 spec/compilers/state | 36 ++--- spec/{compilers2 => compilers}/state_setter | 0 spec/compilers/statement | 10 +- spec/compilers/static_component | 150 ------------------ spec/compilers/store | 47 ++---- spec/compilers/store_with_get | 46 ++---- .../string_literal_broken | 0 spec/compilers/string_literal_escaped | 8 +- spec/compilers/string_literal_simple | 8 +- spec/compilers/string_literal_with_backtick | 8 +- .../string_literal_with_escaped_interpolation | 0 .../string_literal_with_interpolation | 8 +- ...ral_with_interpolation_and_js_iterpolation | 8 +- ...tring_literal_with_interpolation_of_number | 8 +- .../string_literal_with_js_iterpolation | 8 +- spec/compilers/style_with_argument | 41 +++-- spec/compilers/style_with_default_argument | 41 +++-- spec/compilers/tuple_literal | 25 +-- spec/compilers/type | 102 +++--------- spec/compilers/type_with_variants | 67 +++----- spec/compilers/unary_minus | 20 +-- spec/compilers/variable_argument | 17 +- spec/compilers/variable_component_function | 15 +- spec/compilers/variable_component_get | 13 +- spec/compilers/variable_component_property | 39 ++--- spec/compilers/variable_module_function | 30 ++-- spec/compilers/void | 21 +-- spec/compilers2/access | 15 -- spec/compilers2/argument | 19 --- spec/compilers2/argument_with_default | 19 --- .../argument_with_default_inline_function | 20 --- spec/compilers2/array_literal | 20 --- spec/compilers2/block | 12 -- spec/compilers2/block_with_await | 27 ---- spec/compilers2/block_with_early_return | 33 ---- spec/compilers2/block_with_early_return_await | 40 ----- .../compilers2/block_with_tuple_destructuring | 18 --- spec/compilers2/bool_literal_false | 12 -- spec/compilers2/bool_literal_true | 12 -- spec/compilers2/bracket_access | 43 ----- spec/compilers2/call_labelled | 16 -- spec/compilers2/case | 37 ----- spec/compilers2/case_await | 41 ----- spec/compilers2/case_empty | 18 --- spec/compilers2/case_with_array_destructuring | 62 -------- .../case_with_nested_tuple_destructuring | 66 -------- spec/compilers2/case_with_tuple_destructuring | 58 ------- .../case_with_tuple_destructuring_bool | 47 ------ spec/compilers2/case_with_type_destructuring | 58 ------- spec/compilers2/component | 9 -- spec/compilers2/component_global | 45 ------ spec/compilers2/component_instance_access | 83 ---------- spec/compilers2/component_namespaced | 21 --- .../component_namespaced_with_style | 35 ---- spec/compilers2/component_readonly | 27 ---- spec/compilers2/component_with_provider | 50 ------ ...nent_with_provider_and_lifecycle_functions | 74 --------- .../component_with_provider_and_store | 64 -------- spec/compilers2/constant_component | 12 -- spec/compilers2/constant_global_component | 26 --- spec/compilers2/constant_module | 20 --- spec/compilers2/constant_store | 20 --- spec/compilers2/constant_store_exposed | 21 --- spec/compilers2/css_definition | 41 ----- spec/compilers2/css_font_face | 39 ----- spec/compilers2/css_font_face_with_quotes | 33 ---- spec/compilers2/css_keyframes | 72 --------- spec/compilers2/css_media | 54 ------- spec/compilers2/css_media_with_if | 46 ------ spec/compilers2/css_selector | 51 ------ spec/compilers2/css_selector_multiple | 56 ------- spec/compilers2/css_string | 42 ----- spec/compilers2/css_supports | 42 ----- spec/compilers2/css_with_ands | 41 ----- spec/compilers2/css_with_arguments | 33 ---- spec/compilers2/css_with_case | 58 ------- spec/compilers2/css_with_else_if | 47 ------ spec/compilers2/css_with_if | 42 ----- spec/compilers2/css_with_if_and_case | 66 -------- spec/compilers2/css_with_if_same_condition | 59 ------- .../compilers2/css_with_if_with_interpolation | 42 ----- spec/compilers2/dce_remove_component | 6 - .../dce_remove_component_computed_property | 15 -- spec/compilers2/dce_remove_component_function | 15 -- spec/compilers2/dce_remove_enum | 6 - spec/compilers2/dce_remove_module | 6 - spec/compilers2/dce_remove_module_function | 23 --- spec/compilers2/dce_remove_provider | 10 -- spec/compilers2/dce_remove_store | 6 - spec/compilers2/dce_style | 15 -- spec/compilers2/decode | 42 ----- spec/compilers2/decode_function | 42 ----- spec/compilers2/decode_map | 26 --- spec/compilers2/decode_tuple | 31 ---- spec/compilers2/decoder | 66 -------- spec/compilers2/destructuring | 58 ------- spec/compilers2/directives/asset | 15 -- spec/compilers2/directives/documentation | 12 -- spec/compilers2/directives/format | 22 --- spec/compilers2/directives/highlight | 23 --- spec/compilers2/directives/highlight-file | 63 -------- spec/compilers2/directives/svg | 20 --- spec/compilers2/encode | 30 ---- spec/compilers2/env | 9 -- spec/compilers2/field | 25 --- spec/compilers2/field_access | 43 ----- spec/compilers2/for | 27 ---- spec/compilers2/for_with_index | 37 ----- spec/compilers2/for_with_index_2 | 28 ---- spec/compilers2/function | 19 --- spec/compilers2/function_call_simple | 27 ---- spec/compilers2/function_call_with_arguments | 28 ---- spec/compilers2/get | 16 -- spec/compilers2/here_doc_markdown | 21 --- .../here_doc_markdown_with_interpolation | 29 ---- spec/compilers2/here_doc_with_interpolation | 17 -- spec/compilers2/here_doc_without_indentation | 15 -- spec/compilers2/html_attribute_class | 14 -- .../html_attribute_class_with_style | 24 --- spec/compilers2/html_attribute_html_fragment | 27 ---- spec/compilers2/html_attribute_readonly | 13 -- spec/compilers2/html_attribute_ref | 29 ---- spec/compilers2/html_attribute_simple | 14 -- .../compilers2/html_attribute_with_expression | 14 -- spec/compilers2/html_component | 21 --- spec/compilers2/html_fragment | 22 --- spec/compilers2/html_fragment_empty | 14 -- spec/compilers2/html_with_custom_style | 24 --- spec/compilers2/html_with_multiple_styles | 32 ---- .../html_with_multiple_styles_and_parameters | 42 ----- ...html_with_multiple_styles_and_parameters_2 | 52 ------ spec/compilers2/html_with_pseudos | 73 --------- spec/compilers2/html_with_string_style | 16 -- spec/compilers2/html_with_style | 87 ---------- .../html_with_style_and_custom_style | 51 ------ spec/compilers2/if | 18 --- spec/compilers2/if_let | 42 ----- spec/compilers2/if_let_await | 49 ------ spec/compilers2/if_without_else_array | 13 -- spec/compilers2/if_without_else_promise | 16 -- spec/compilers2/if_without_else_string | 13 -- spec/compilers2/indirect_connect | 32 ---- spec/compilers2/inline_function | 15 -- spec/compilers2/inline_function_recursive | 35 ---- .../compilers2/inline_function_with_arguments | 25 --- spec/compilers2/js | 9 -- spec/compilers2/js_with_double_interpolation | 9 -- spec/compilers2/js_with_interpolation | 9 -- spec/compilers2/locale_key | 27 ---- spec/compilers2/module | 23 --- spec/compilers2/module_access | 30 ---- spec/compilers2/module_access_get | 26 --- spec/compilers2/module_access_subscriptions | 51 ------ spec/compilers2/module_call | 26 --- spec/compilers2/module_call_piped | 27 ---- spec/compilers2/next_call | 37 ----- spec/compilers2/next_call_empty | 11 -- spec/compilers2/number_literal_negative | 11 -- spec/compilers2/number_literal_simple | 11 -- spec/compilers2/number_literal_with_decimal | 11 -- spec/compilers2/operation_chained | 13 -- spec/compilers2/operation_or | 29 ---- spec/compilers2/operation_simple | 13 -- spec/compilers2/parenthesized_expression | 11 -- spec/compilers2/pipe | 21 --- spec/compilers2/property | 25 --- spec/compilers2/property_without_default | 28 ---- spec/compilers2/provider_with_items | 64 -------- spec/compilers2/record | 25 --- spec/compilers2/record_update | 28 ---- spec/compilers2/regexp_literal | 11 -- spec/compilers2/state | 25 --- spec/compilers2/statement | 13 -- spec/compilers2/store | 26 --- spec/compilers2/store_with_get | 29 ---- spec/compilers2/string_literal_escaped | 9 -- spec/compilers2/string_literal_simple | 9 -- spec/compilers2/string_literal_with_backtick | 9 -- .../string_literal_with_interpolation | 9 -- ...ral_with_interpolation_and_js_iterpolation | 9 -- ...tring_literal_with_interpolation_of_number | 9 -- .../string_literal_with_js_iterpolation | 9 -- spec/compilers2/style_with_argument | 34 ---- spec/compilers2/style_with_default_argument | 34 ---- spec/compilers2/tuple_literal | 19 --- spec/compilers2/type | 39 ----- spec/compilers2/type_with_variants | 47 ------ spec/compilers2/unary_minus | 12 -- spec/compilers2/variable_argument | 16 -- spec/compilers2/variable_component_function | 16 -- spec/compilers2/variable_component_get | 16 -- spec/compilers2/variable_component_property | 25 --- spec/compilers2/variable_module_function | 30 ---- spec/compilers2/void | 11 -- spec/compilers_spec.cr | 2 +- spec/formatting_spec.cr | 4 +- spec/spec_helper.cr | 24 +-- spec/spec_helpers.cr | 58 +++++++ spec_cli/build_spec.cr | 99 ++++++++++++ spec_cli/clean_spec.cr | 52 ++++++ spec_cli/format_spec.cr | 106 +++++++++++++ spec_cli/init_spec.cr | 89 +++++++++++ spec_cli/spec_helper.cr | 41 +++++ spec_cli/version_spec.cr | 19 +++ src/assets/scaffold/source/Content.mint | 4 +- src/bundler.cr | 8 +- src/commands/build.cr | 2 +- src/commands/format.cr | 16 +- src/commands/init.cr | 3 +- src/formatters/top_level.cr | 2 +- 389 files changed, 2697 insertions(+), 8494 deletions(-) delete mode 100644 core/docs.json create mode 100644 source.mint rename spec/{compilers2 => compilers}/access_deep (100%) delete mode 100644 spec/compilers/block_with_early_return_2 rename spec/{compilers2 => compilers}/builtin (100%) rename spec/{compilers2 => compilers}/component_async (100%) rename spec/{compilers2 => compilers}/component_async_2 (100%) rename spec/{compilers2 => compilers}/component_async_3 (100%) rename spec/{compilers2 => compilers}/component_async_4 (100%) rename spec/{compilers2 => compilers}/component_async_5 (100%) rename spec/{compilers2 => compilers}/component_children (100%) rename spec/{compilers2 => compilers}/component_instance_access_ref (100%) rename spec/{compilers2 => compilers}/css_with_if_variables (100%) rename spec/{compilers2 => compilers}/defer (100%) rename spec/{compilers2 => compilers}/defer_2 (100%) rename spec/{compilers2 => compilers}/destructuring_constant (100%) rename spec/{compilers2 => compilers}/destructuring_state (100%) rename spec/{compilers2 => compilers}/directives/inline (100%) rename spec/{compilers2 => compilers}/encode_nested (100%) rename spec/{compilers2 => compilers}/encode_no_record (100%) rename spec/{compilers2 => compilers}/encode_with_mapping (100%) rename spec/{compilers2 => compilers}/encoder_and_decoder (100%) rename spec/{compilers2 => compilers}/for_with_destructuring (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_escape (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_in_markdown (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_code_block (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_code_block_interpolation (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_code_block_interpolation_highlight (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_code_block_multiline (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_html_interpolation (100%) rename spec/{compilers2 => compilers}/here_doc_markdown_with_inline_code (100%) rename spec/{compilers2 => compilers}/here_doc_new_line_char (100%) rename spec/{compilers2 => compilers}/map (100%) rename spec/{compilers2 => compilers}/pipe_await (100%) delete mode 100644 spec/compilers/route rename spec/{compilers2 => compilers}/signal (100%) rename spec/{compilers2 => compilers}/state_setter (100%) delete mode 100644 spec/compilers/static_component rename spec/{compilers2 => compilers}/string_literal_broken (100%) rename spec/{compilers2 => compilers}/string_literal_with_escaped_interpolation (100%) delete mode 100644 spec/compilers2/access delete mode 100644 spec/compilers2/argument delete mode 100644 spec/compilers2/argument_with_default delete mode 100644 spec/compilers2/argument_with_default_inline_function delete mode 100644 spec/compilers2/array_literal delete mode 100644 spec/compilers2/block delete mode 100644 spec/compilers2/block_with_await delete mode 100644 spec/compilers2/block_with_early_return delete mode 100644 spec/compilers2/block_with_early_return_await delete mode 100644 spec/compilers2/block_with_tuple_destructuring delete mode 100644 spec/compilers2/bool_literal_false delete mode 100644 spec/compilers2/bool_literal_true delete mode 100644 spec/compilers2/bracket_access delete mode 100644 spec/compilers2/call_labelled delete mode 100644 spec/compilers2/case delete mode 100644 spec/compilers2/case_await delete mode 100644 spec/compilers2/case_empty delete mode 100644 spec/compilers2/case_with_array_destructuring delete mode 100644 spec/compilers2/case_with_nested_tuple_destructuring delete mode 100644 spec/compilers2/case_with_tuple_destructuring delete mode 100644 spec/compilers2/case_with_tuple_destructuring_bool delete mode 100644 spec/compilers2/case_with_type_destructuring delete mode 100644 spec/compilers2/component delete mode 100644 spec/compilers2/component_global delete mode 100644 spec/compilers2/component_instance_access delete mode 100644 spec/compilers2/component_namespaced delete mode 100644 spec/compilers2/component_namespaced_with_style delete mode 100644 spec/compilers2/component_readonly delete mode 100644 spec/compilers2/component_with_provider delete mode 100644 spec/compilers2/component_with_provider_and_lifecycle_functions delete mode 100644 spec/compilers2/component_with_provider_and_store delete mode 100644 spec/compilers2/constant_component delete mode 100644 spec/compilers2/constant_global_component delete mode 100644 spec/compilers2/constant_module delete mode 100644 spec/compilers2/constant_store delete mode 100644 spec/compilers2/constant_store_exposed delete mode 100644 spec/compilers2/css_definition delete mode 100644 spec/compilers2/css_font_face delete mode 100644 spec/compilers2/css_font_face_with_quotes delete mode 100644 spec/compilers2/css_keyframes delete mode 100644 spec/compilers2/css_media delete mode 100644 spec/compilers2/css_media_with_if delete mode 100644 spec/compilers2/css_selector delete mode 100644 spec/compilers2/css_selector_multiple delete mode 100644 spec/compilers2/css_string delete mode 100644 spec/compilers2/css_supports delete mode 100644 spec/compilers2/css_with_ands delete mode 100644 spec/compilers2/css_with_arguments delete mode 100644 spec/compilers2/css_with_case delete mode 100644 spec/compilers2/css_with_else_if delete mode 100644 spec/compilers2/css_with_if delete mode 100644 spec/compilers2/css_with_if_and_case delete mode 100644 spec/compilers2/css_with_if_same_condition delete mode 100644 spec/compilers2/css_with_if_with_interpolation delete mode 100644 spec/compilers2/dce_remove_component delete mode 100644 spec/compilers2/dce_remove_component_computed_property delete mode 100644 spec/compilers2/dce_remove_component_function delete mode 100644 spec/compilers2/dce_remove_enum delete mode 100644 spec/compilers2/dce_remove_module delete mode 100644 spec/compilers2/dce_remove_module_function delete mode 100644 spec/compilers2/dce_remove_provider delete mode 100644 spec/compilers2/dce_remove_store delete mode 100644 spec/compilers2/dce_style delete mode 100644 spec/compilers2/decode delete mode 100644 spec/compilers2/decode_function delete mode 100644 spec/compilers2/decode_map delete mode 100644 spec/compilers2/decode_tuple delete mode 100644 spec/compilers2/decoder delete mode 100644 spec/compilers2/destructuring delete mode 100644 spec/compilers2/directives/asset delete mode 100644 spec/compilers2/directives/documentation delete mode 100644 spec/compilers2/directives/format delete mode 100644 spec/compilers2/directives/highlight delete mode 100644 spec/compilers2/directives/highlight-file delete mode 100644 spec/compilers2/directives/svg delete mode 100644 spec/compilers2/encode delete mode 100644 spec/compilers2/env delete mode 100644 spec/compilers2/field delete mode 100644 spec/compilers2/field_access delete mode 100644 spec/compilers2/for delete mode 100644 spec/compilers2/for_with_index delete mode 100644 spec/compilers2/for_with_index_2 delete mode 100644 spec/compilers2/function delete mode 100644 spec/compilers2/function_call_simple delete mode 100644 spec/compilers2/function_call_with_arguments delete mode 100644 spec/compilers2/get delete mode 100644 spec/compilers2/here_doc_markdown delete mode 100644 spec/compilers2/here_doc_markdown_with_interpolation delete mode 100644 spec/compilers2/here_doc_with_interpolation delete mode 100644 spec/compilers2/here_doc_without_indentation delete mode 100644 spec/compilers2/html_attribute_class delete mode 100644 spec/compilers2/html_attribute_class_with_style delete mode 100644 spec/compilers2/html_attribute_html_fragment delete mode 100644 spec/compilers2/html_attribute_readonly delete mode 100644 spec/compilers2/html_attribute_ref delete mode 100644 spec/compilers2/html_attribute_simple delete mode 100644 spec/compilers2/html_attribute_with_expression delete mode 100644 spec/compilers2/html_component delete mode 100644 spec/compilers2/html_fragment delete mode 100644 spec/compilers2/html_fragment_empty delete mode 100644 spec/compilers2/html_with_custom_style delete mode 100644 spec/compilers2/html_with_multiple_styles delete mode 100644 spec/compilers2/html_with_multiple_styles_and_parameters delete mode 100644 spec/compilers2/html_with_multiple_styles_and_parameters_2 delete mode 100644 spec/compilers2/html_with_pseudos delete mode 100644 spec/compilers2/html_with_string_style delete mode 100644 spec/compilers2/html_with_style delete mode 100644 spec/compilers2/html_with_style_and_custom_style delete mode 100644 spec/compilers2/if delete mode 100644 spec/compilers2/if_let delete mode 100644 spec/compilers2/if_let_await delete mode 100644 spec/compilers2/if_without_else_array delete mode 100644 spec/compilers2/if_without_else_promise delete mode 100644 spec/compilers2/if_without_else_string delete mode 100644 spec/compilers2/indirect_connect delete mode 100644 spec/compilers2/inline_function delete mode 100644 spec/compilers2/inline_function_recursive delete mode 100644 spec/compilers2/inline_function_with_arguments delete mode 100644 spec/compilers2/js delete mode 100644 spec/compilers2/js_with_double_interpolation delete mode 100644 spec/compilers2/js_with_interpolation delete mode 100644 spec/compilers2/locale_key delete mode 100644 spec/compilers2/module delete mode 100644 spec/compilers2/module_access delete mode 100644 spec/compilers2/module_access_get delete mode 100644 spec/compilers2/module_access_subscriptions delete mode 100644 spec/compilers2/module_call delete mode 100644 spec/compilers2/module_call_piped delete mode 100644 spec/compilers2/next_call delete mode 100644 spec/compilers2/next_call_empty delete mode 100644 spec/compilers2/number_literal_negative delete mode 100644 spec/compilers2/number_literal_simple delete mode 100644 spec/compilers2/number_literal_with_decimal delete mode 100644 spec/compilers2/operation_chained delete mode 100644 spec/compilers2/operation_or delete mode 100644 spec/compilers2/operation_simple delete mode 100644 spec/compilers2/parenthesized_expression delete mode 100644 spec/compilers2/pipe delete mode 100644 spec/compilers2/property delete mode 100644 spec/compilers2/property_without_default delete mode 100644 spec/compilers2/provider_with_items delete mode 100644 spec/compilers2/record delete mode 100644 spec/compilers2/record_update delete mode 100644 spec/compilers2/regexp_literal delete mode 100644 spec/compilers2/state delete mode 100644 spec/compilers2/statement delete mode 100644 spec/compilers2/store delete mode 100644 spec/compilers2/store_with_get delete mode 100644 spec/compilers2/string_literal_escaped delete mode 100644 spec/compilers2/string_literal_simple delete mode 100644 spec/compilers2/string_literal_with_backtick delete mode 100644 spec/compilers2/string_literal_with_interpolation delete mode 100644 spec/compilers2/string_literal_with_interpolation_and_js_iterpolation delete mode 100644 spec/compilers2/string_literal_with_interpolation_of_number delete mode 100644 spec/compilers2/string_literal_with_js_iterpolation delete mode 100644 spec/compilers2/style_with_argument delete mode 100644 spec/compilers2/style_with_default_argument delete mode 100644 spec/compilers2/tuple_literal delete mode 100644 spec/compilers2/type delete mode 100644 spec/compilers2/type_with_variants delete mode 100644 spec/compilers2/unary_minus delete mode 100644 spec/compilers2/variable_argument delete mode 100644 spec/compilers2/variable_component_function delete mode 100644 spec/compilers2/variable_component_get delete mode 100644 spec/compilers2/variable_component_property delete mode 100644 spec/compilers2/variable_module_function delete mode 100644 spec/compilers2/void create mode 100644 spec/spec_helpers.cr create mode 100644 spec_cli/build_spec.cr create mode 100644 spec_cli/clean_spec.cr create mode 100644 spec_cli/format_spec.cr create mode 100644 spec_cli/init_spec.cr create mode 100644 spec_cli/spec_helper.cr create mode 100644 spec_cli/version_spec.cr diff --git a/.ameba.yml b/.ameba.yml index 0e5043707..fef2b8664 100644 --- a/.ameba.yml +++ b/.ameba.yml @@ -9,3 +9,7 @@ Documentation/DocumentationAdmonition: Lint/UselessAssign: ExcludeTypeDeclarations: true + +Lint/SpecFilename: + Excluded: + - spec/spec_helpers.cr diff --git a/.github/workflows/ci-base.yml b/.github/workflows/ci-base.yml index 706d49497..f3fff4255 100644 --- a/.github/workflows/ci-base.yml +++ b/.github/workflows/ci-base.yml @@ -31,6 +31,9 @@ jobs: - name: Run specs run: crystal spec --error-on-warnings --error-trace + - name: Run CLI specs + run: crystal spec spec_cli/*_spec.cr --error-on-warnings --error-trace + - name: Build the binary run: shards build --error-on-warnings --error-trace diff --git a/Makefile b/Makefile index 29f8ae433..38e4dc5c9 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,10 @@ build: bin/mint spec: crystal spec --error-on-warnings --error-trace --progress +.PHONY: spec-cli +spec-cli: build + crystal spec spec_cli/*_spec.cr --error-on-warnings --error-trace --progress + .PHONY: format format: crystal tool format diff --git a/core/docs.json b/core/docs.json deleted file mode 100644 index 7a5d30394..000000000 --- a/core/docs.json +++ /dev/null @@ -1 +0,0 @@ -[{"k":10,"e":[{"k":0,"b":false,"t":"Function(WebSocket, Promise(Void))","n":"onOpen"},{"k":0,"b":false,"t":"Function(String, Promise(Void))","n":"onMessage"},{"k":0,"b":false,"t":"Function(Promise(Void))","n":"onError"},{"k":0,"b":false,"t":"Function(Promise(Void))","n":"onClose"},{"k":0,"b":false,"t":"Bool","n":"reconnectOnClose"},{"k":0,"b":false,"t":"String","n":"url"}],"d":"

Data structure for WebSocket configurations.

","l":"WebSocket.Config(type)","n":"WebSocket.Config"},{"k":10,"e":[{"k":0,"a":[{"n":"value"}],"b":false,"n":"Just"},{"k":0,"a":[],"b":false,"n":"Nothing"}],"d":"

Represent values that may or may not exist.

","l":"Maybe(type)","n":"Maybe"},{"k":10,"e":[{"k":0,"a":[{"n":"error"}],"b":false,"n":"Err"},{"k":0,"a":[{"n":"value"}],"b":false,"n":"Ok"}],"d":"

Data structure for a computation that can fail.

","l":"Result(type)","n":"Result"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Promise(Void))","n":"action"},{"k":0,"b":false,"t":"Function(Bool)","n":"condition"},{"k":0,"b":false,"t":"Array(Number)","n":"shortcut"},{"k":0,"b":false,"t":"Bool","n":"bypassFocused"}],"d":"

Represents a shortcut:

","l":"Provider.Shortcuts.Shortcut(type)","n":"Provider.Shortcuts.Shortcut"},{"k":10,"e":[{"k":0,"b":false,"t":"Array(Provider.Shortcuts.Shortcut)","n":"shortcuts"}],"d":"

Record for Provider.Shortcuts.

","l":"Provider.Shortcuts(type)","n":"Provider.Shortcuts"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Number, Promise(Void))","n":"callback"},{"k":0,"b":false,"t":"Maybe(Dom.Element)","n":"element"},{"k":0,"b":false,"t":"String","n":"rootMargin"},{"k":0,"b":false,"t":"Number","n":"threshold"}],"d":"

Represents a subscription for Provider.Intersection

","l":"Provider.Intersection(type)","n":"Provider.Intersection"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Promise(Void))","n":"ticks"}],"d":"

Represents a subscription for Provider.Tick

","l":"Provider.Tick(type)","n":"Provider.Tick"},{"k":10,"e":[{"k":0,"b":false,"t":"Array(Maybe(Dom.Element))","n":"elements"},{"k":0,"b":false,"t":"Function(Promise(Void))","n":"clicks"}],"d":"

Represents a subscription for Provider.OutsideClick

","l":"Provider.OutsideClick(type)","n":"Provider.OutsideClick"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Number, Promise(Void))","n":"frames"}],"d":"

Represents a subscription for Provider.AnimationFrame

","l":"Provider.AnimationFrame(type)","n":"Provider.AnimationFrame"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"downs"},{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"ups"}],"d":"

Represents a subscription for Provider.Keyboard

","l":"Provider.Keyboard(type)","n":"Provider.Keyboard"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"clicks"},{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"moves"},{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"ups"}],"d":"

Represents a subscription for Provider.Mouse

","l":"Provider.Mouse(type)","n":"Provider.Mouse"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Promise(Void))","n":"changes"},{"k":0,"b":false,"t":"Maybe(Dom.Element)","n":"element"}],"d":"

Represents a subscription for Provider.Mutation

","l":"Provider.Mutation(type)","n":"Provider.Mutation"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"resizes"}],"d":"

Represents a subscription for Provider.Resize

","l":"Provider.Resize(type)","n":"Provider.Resize"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Bool, Promise(Void))","n":"changes"},{"k":0,"b":false,"t":"String","n":"query"}],"d":"

Represents a subscription for Provider.MediaQuery

","l":"Provider.MediaQuery(type)","n":"Provider.MediaQuery"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Dom.Dimensions, Promise(Void))","n":"changes"},{"k":0,"b":false,"t":"Maybe(Dom.Element)","n":"element"}],"d":"

Represents a subscription for Provider.ElementSize

","l":"Provider.ElementSize(type)","n":"Provider.ElementSize"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"scrolls"}],"d":"

Represents a subscription for Provider.Scroll

","l":"Provider.Scroll(type)","n":"Provider.Scroll"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Promise(Void))","n":"onTabOut"},{"k":0,"b":false,"t":"Function(Promise(Void))","n":"onTabIn"},{"k":0,"b":false,"t":"Maybe(Dom.Element)","n":"element"}],"d":"

Represents a subscription for Provider.TabFocus

","l":"Provider.TabFocus(type)","n":"Provider.TabFocus"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"downs"},{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"moves"},{"k":0,"b":false,"t":"Function(Html.Event, Promise(Void))","n":"ups"}],"d":"

Represents a subscription for Provider.Pointer

","l":"Provider.Pointer(type)","n":"Provider.Pointer"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Url, Promise(Void))","n":"changes"}],"d":"

Represents a subscription for Provider.Url

","l":"Provider.Url(type)","n":"Provider.Url"},{"k":10,"e":[{"k":0,"b":false,"t":"Bool","n":"caseInsensitive"},{"k":0,"b":false,"t":"Bool","n":"multiline"},{"k":0,"b":false,"t":"Bool","n":"unicode"},{"k":0,"b":false,"t":"Bool","n":"global"},{"k":0,"b":false,"t":"Bool","n":"sticky"}],"d":"

Represents the options for a regular expression.

","l":"Regexp.Options(type)","n":"Regexp.Options"},{"k":10,"e":[{"k":0,"b":false,"t":"Array(String)","n":"submatches"},{"k":0,"b":false,"t":"String","n":"match"},{"k":0,"b":false,"t":"Number","n":"index"}],"d":"

Represents a regular expression match.

","l":"Regexp.Match(type)","n":"Regexp.Match"},{"k":10,"e":[{"k":0,"a":[],"d":"

The storage API is disabled.

","b":false,"n":"SecurityError"},{"k":0,"a":[],"d":"

The storage is full (over the quota, usually 5MB).

","b":false,"n":"QuotaExceeded"},{"k":0,"a":[],"d":"

The key in the storage does not exist.

","b":false,"n":"NotFound"},{"k":0,"a":[],"d":"

The reason for the failure is unknown.

","b":false,"n":"Unknown"}],"d":"

Represents the possible failures when dealing with the Storage API.

","l":"Storage.Error(type)","n":"Storage.Error"},{"k":10,"e":[{"k":0,"b":false,"t":"Dom.Dimensions","n":"dimensions"},{"k":0,"b":false,"t":"Dom.Element","n":"target"}],"d":"

A data structure for the resize obeservers entry.

","l":"ResizeObserver.Entry(type)","n":"ResizeObserver.Entry"},{"k":10,"e":[{"k":0,"b":false,"t":"Dom.Element","n":"target"},{"k":0,"b":false,"t":"String","n":"type"}],"d":"

A data structure for the mutation obeservers entry.

","l":"MutationObserver.Entry(type)","n":"MutationObserver.Entry"},{"k":10,"e":[{"k":0,"b":false,"t":"Number","n":"height"},{"k":0,"b":false,"t":"Number","n":"bottom"},{"k":0,"b":false,"t":"Number","n":"width"},{"k":0,"b":false,"t":"Number","n":"right"},{"k":0,"b":false,"t":"Number","n":"left"},{"k":0,"b":false,"t":"Number","n":"top"},{"k":0,"b":false,"t":"Number","n":"x"},{"k":0,"b":false,"t":"Number","n":"y"}],"d":"

Record for the dimensions of an element on the screen.

","l":"Dom.Dimensions(type)","n":"Dom.Dimensions"},{"k":10,"e":[{"k":0,"b":false,"t":"String","n":"value"},{"k":0,"b":false,"t":"String","n":"key"}],"d":"

Represents a HTTP header

","l":"Http.Header(type)","n":"Http.Header"},{"k":10,"e":[{"k":0,"b":false,"t":"Array(Http.Header)","n":"headers"},{"k":0,"b":false,"t":"Bool","n":"withCredentials"},{"k":0,"b":false,"t":"Http.Body","n":"body"},{"k":0,"b":false,"t":"String","n":"method"},{"k":0,"b":false,"t":"String","n":"url"}],"d":"

Represents an HTTP request.

","l":"Http.Request(type)","n":"Http.Request"},{"k":10,"e":[{"k":0,"b":false,"t":"Map(String, String)","n":"headers"},{"k":0,"b":false,"t":"Http.ResponseBody","n":"body"},{"k":0,"b":false,"t":"String","n":"bodyString"},{"k":0,"b":false,"t":"Number","n":"status"}],"d":"

Represents an HTTP response.

","l":"Http.Response(type)","n":"Http.Response"},{"k":10,"e":[{"k":0,"a":[{"n":"Object"}],"b":false,"n":"JSON"},{"k":0,"a":[{"n":"Object"}],"b":false,"n":"HTML"},{"k":0,"a":[{"n":"String"}],"b":false,"n":"Text"},{"k":0,"a":[{"n":"Object"}],"b":false,"n":"XML"},{"k":0,"a":[{"n":"File"}],"b":false,"n":"File"}],"d":"

Represents the body of a HTTP response.

","l":"Http.ResponseBody(type)","n":"Http.ResponseBody"},{"k":10,"e":[{"k":0,"b":false,"t":"Map(String, String)","n":"headers"},{"k":0,"b":false,"t":"Http.Error","n":"type"},{"k":0,"b":false,"t":"Number","n":"status"},{"k":0,"b":false,"t":"String","n":"url"}],"d":"

Represents an HTTP request which failed to load.

","l":"Http.ErrorResponse(type)","n":"Http.ErrorResponse"},{"k":10,"e":[{"k":0,"a":[],"d":"

The request cannot be loaded because of a network failure

","b":false,"n":"NetworkError"},{"k":0,"a":[],"d":"

The client (browser) aborted the request

","b":false,"n":"Aborted"},{"k":0,"a":[],"d":"

The request timed out

","b":false,"n":"Timeout"},{"k":0,"a":[],"d":"

The url is malformed and cannot be loaded

","b":false,"n":"BadUrl"}],"d":"

Represents the possible failures of an HTTP request.

","l":"Http.Error(type)","n":"Http.Error"},{"k":10,"e":[{"k":0,"b":false,"t":"String","n":"hostname"},{"k":0,"b":false,"t":"String","n":"protocol"},{"k":0,"b":false,"t":"String","n":"origin"},{"k":0,"b":false,"t":"String","n":"search"},{"k":0,"b":false,"t":"String","n":"path"},{"k":0,"b":false,"t":"String","n":"hash"},{"k":0,"b":false,"t":"String","n":"host"},{"k":0,"b":false,"t":"String","n":"port"}],"d":"

Represents a URL

","l":"Url(type)","n":"Url"},{"k":10,"e":[{"k":0,"b":false,"t":"Html.NativeEvent","n":"event"},{"k":0,"b":false,"t":"Html.DataTransfer","n":"clipboardData"},{"k":0,"b":false,"t":"Html.DataTransfer","n":"dataTransfer"},{"k":0,"b":false,"t":"Dom.Element","n":"currentTarget"},{"k":0,"b":false,"t":"Dom.Element","n":"target"},{"k":0,"b":false,"t":"Bool","n":"defaultPrevented"},{"k":0,"b":false,"t":"Bool","n":"cancelable"},{"k":0,"b":false,"t":"Bool","n":"isTrusted"},{"k":0,"b":false,"t":"Bool","n":"bubbles"},{"k":0,"b":false,"t":"Bool","n":"repeat"},{"k":0,"b":false,"t":"Bool","n":"shiftKey"},{"k":0,"b":false,"t":"Bool","n":"metaKey"},{"k":0,"b":false,"t":"Bool","n":"ctrlKey"},{"k":0,"b":false,"t":"Bool","n":"altKey"},{"k":0,"b":false,"t":"String","n":"animationName"},{"k":0,"b":false,"t":"String","n":"pseudoElement"},{"k":0,"b":false,"t":"String","n":"propertyName"},{"k":0,"b":false,"t":"String","n":"locale"},{"k":0,"b":false,"t":"String","n":"type"},{"k":0,"b":false,"t":"String","n":"data"},{"k":0,"b":false,"t":"String","n":"key"},{"k":0,"b":false,"t":"Number","n":"elapsedTime"},{"k":0,"b":false,"t":"Number","n":"eventPhase"},{"k":0,"b":false,"t":"Number","n":"timeStamp"},{"k":0,"b":false,"t":"Number","n":"charCode"},{"k":0,"b":false,"t":"Number","n":"location"},{"k":0,"b":false,"t":"Number","n":"keyCode"},{"k":0,"b":false,"t":"Number","n":"buttons"},{"k":0,"b":false,"t":"Number","n":"button"},{"k":0,"b":false,"t":"Number","n":"detail"},{"k":0,"b":false,"t":"Number","n":"which"},{"k":0,"b":false,"t":"Number","n":"clientX"},{"k":0,"b":false,"t":"Number","n":"clientY"},{"k":0,"b":false,"t":"Number","n":"screenX"},{"k":0,"b":false,"t":"Number","n":"screenY"},{"k":0,"b":false,"t":"Number","n":"pageX"},{"k":0,"b":false,"t":"Number","n":"pageY"},{"k":0,"b":false,"t":"Number","n":"deltaMode"},{"k":0,"b":false,"t":"Number","n":"deltaX"},{"k":0,"b":false,"t":"Number","n":"deltaY"},{"k":0,"b":false,"t":"Number","n":"deltaZ"}],"d":"

Represents an HTML event.

","l":"Html.Event(type)","n":"Html.Event"},{"k":10,"e":[{"k":0,"b":false,"t":"Function(Number, String)","n":"toOrdinalSuffix"},{"k":0,"b":false,"t":"Function(Month, String)","n":"toMonthName"},{"k":0,"b":false,"t":"Function(Month, String)","n":"toMonthAbbreviation"},{"k":0,"b":false,"t":"Function(Weekday, String)","n":"toWeekdayName"},{"k":0,"b":false,"t":"Function(Weekday, String)","n":"toWeekdayAbbreviation"},{"k":0,"b":false,"t":"Function(Number, String)","n":"amPm"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someSecondsAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someMinutesAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someHoursAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someDaysAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someMonthsAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"someYearsAgo"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeSeconds"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeMinutes"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeHours"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeDays"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeMonths"},{"k":0,"b":false,"t":"Function(Number, String)","n":"inSomeYears"},{"k":0,"b":false,"t":"String","n":"rightNow"}],"d":"

Represents a language for time formatting.

","l":"Time.Format.Language(type)","n":"Time.Format.Language"},{"k":10,"e":[{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Milliseconds"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Seconds"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Minutes"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Hours"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Days"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Weeks"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Months"},{"k":0,"a":[{"n":"Number"}],"b":false,"n":"Years"}],"d":"

Represents a duration (span) of time.

","l":"Time.Span(type)","n":"Time.Span"},{"k":10,"e":[{"k":0,"a":[],"b":false,"n":"January"},{"k":0,"a":[],"b":false,"n":"February"},{"k":0,"a":[],"b":false,"n":"March"},{"k":0,"a":[],"b":false,"n":"April"},{"k":0,"a":[],"b":false,"n":"May"},{"k":0,"a":[],"b":false,"n":"June"},{"k":0,"a":[],"b":false,"n":"July"},{"k":0,"a":[],"b":false,"n":"August"},{"k":0,"a":[],"b":false,"n":"September"},{"k":0,"a":[],"b":false,"n":"October"},{"k":0,"a":[],"b":false,"n":"November"},{"k":0,"a":[],"b":false,"n":"December"}],"d":"

Represents a month of the week in the Gregorian calendar.

","l":"Month(type)","n":"Month"},{"k":10,"e":[{"k":0,"a":[],"b":false,"n":"Monday"},{"k":0,"a":[],"b":false,"n":"Tuesday"},{"k":0,"a":[],"b":false,"n":"Wednesday"},{"k":0,"a":[],"b":false,"n":"Thursday"},{"k":0,"a":[],"b":false,"n":"Friday"},{"k":0,"a":[],"b":false,"n":"Saturday"},{"k":0,"a":[],"b":false,"n":"Sunday"}],"d":"

Represents a day of the week in the Gregorian calendar.

","l":"Weekday(type)","n":"Weekday"},{"k":6,"e":[{"k":4,"a":[{"t":"Function(a)","n":"method"},{"t":"Number","n":"delay"}],"d":"

Returns a debounced version of the function which when called repeatedly\nunder inside delay, will be called only once.

Function.debounce(() { Debug.log("Hello World!") }, 100)
","b":false,"t":"Function(a)","n":"debounce"},{"k":4,"a":[{"t":"Function(a, b)","n":"method"},{"t":"Number","n":"delay"}],"d":"

Same as debounce but for functions with only one argument.

Function.debounce1((argument : String) { Debug.log(argument) }, 100)
","b":true,"t":"Function(a, b)","n":"debounce1"}],"d":"

This module provides functions for working with functions.

","n":"Function"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"locale"}],"d":"

Sets the current locale.

Locale.set("en")
","b":false,"t":"Bool","n":"set"},{"k":4,"a":[],"d":"

Returns the current locale.

Locale.get() == Maybe.Just("en")
","b":false,"t":"Maybe(String)","n":"get"}],"d":"

This module provides functions to get and change the locale of the\napplication.

","n":"Locale"},{"k":6,"e":[{"k":4,"a":[{"t":"WebSocket","n":"socket"}],"d":"

Closes the connection. If the reconnectOnClose flag was specified then the\nconnection will reconnect using this function.

WebSocket.close(websocket)
","b":false,"t":"Promise(Void)","n":"close"},{"k":4,"a":[{"t":"WebSocket","n":"socket"}],"d":"

Closes the connection without reconnecting, even if the reconnectOnClose\nflag was set.

WebSocket.closeWithoutReconnecting(websocket)
","b":false,"t":"Promise(Void)","n":"closeWithoutReconnecting"},{"k":4,"a":[{"t":"WebSocket.Config","n":"config"}],"d":"

Creates a WebSocket connection using the provided configuration. If\nreconnectOnClose is set then when a connection is closed it tries to\nreconnect, using the same configuration (basically calls open again).

WebSocket.open({\n  url: "wss://echo.websocket.org",\n  reconnectOnClose: true,\n  onMessage: handleMessage,\n  onError: handleError,\n  onClose: handleClose,\n  onOpen: handleOpen\n})
","b":false,"t":"WebSocket","n":"open"},{"k":4,"a":[{"t":"WebSocket","n":"socket"},{"t":"String","n":"data"}],"d":"

Sends the data to the connection.

WebSocket.send(websocket, "some data")
","b":false,"t":"Promise(Void)","n":"send"}],"d":"

This module provides functions for working with the WebSocket Web API.

","n":"WebSocket"},{"k":6,"e":[{"k":4,"a":[{"t":"SearchParams","n":"params"},{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Appends a specified key-value pair.

SearchParams.empty()\n|> SearchParams.append("key", "value")
","b":true,"t":"SearchParams","n":"append"},{"k":4,"a":[{"t":"SearchParams","n":"params"},{"t":"String","n":"key"}],"d":"

Returns a Bool indicating if such a search parameter exists.

(SearchParams.fromString("key=value")\n |> SearchParams.contains("key")) == true
","b":false,"t":"Bool","n":"contains"},{"k":4,"a":[{"t":"SearchParams","n":"params"},{"t":"String","n":"key"}],"d":"

Deletes the given search parameter, and its associated value(s), from the\nlist of all search parameters.

SearchParams.fromString("key=value")\n|> SearchParams.delete("key")
","b":false,"t":"SearchParams","n":"delete"},{"k":4,"a":[],"d":"

Returns an empty SearchParams object.

SearchParams.empty()
","b":false,"t":"SearchParams","n":"empty"},{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Parses a string into a SearchParams object.

SearchParams.fromString("key=value")
","b":false,"t":"SearchParams","n":"fromString"},{"k":4,"a":[{"t":"SearchParams","n":"params"},{"t":"String","n":"key"}],"d":"

Returns the first value associated of the key.

(SearchParams.fromString("key=value")\n |> SearchParams.get("key")) == "value"
","b":false,"t":"Maybe(String)","n":"get"},{"k":4,"a":[{"t":"SearchParams","n":"params"},{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Sets the value associated to the key. If there were several values, deletes\nthe others.

SearchParams.empty()\n|> SearchParams.set("key", "value")
","b":true,"t":"SearchParams","n":"set"},{"k":4,"a":[{"t":"SearchParams","n":"params"}],"d":"

Returns a string containing a query string suitable for use in a URL.

(SearchParams.empty()\n |> SearchParams.set("key", "value")\n |> SearchParams.toString()) == "key=value"
","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions for working with the URLSearchParams Web\nAPI.

","n":"SearchParams"},{"k":6,"e":[{"k":4,"a":[{"t":"Number","n":"size"}],"d":"

Formats a number as a file size.

FileSize.format(0) == "0 B"\nFileSize.format(1000) == "1 kB"\nFileSize.format(1000000) == "1 MB"\nFileSize.format(1000000000) == "1 GB"
","b":false,"t":"String","n":"format"}],"d":"

This module provides functions to format file sizes in human\nreadable format.

","n":"FileSize"},{"k":6,"e":[{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Prompts a dialog for the saving the file.

let file =\n  await File.select("*")\n\nFile.download(file)
","b":false,"t":"Promise(Void)","n":"download"},{"k":4,"a":[{"t":"String","n":"contents"},{"t":"String","n":"name"},{"t":"String","n":"type"}],"d":"

Creates a new file from the contents, name and mime-type.

File.fromString("Some contents...", "test.txt", "text/plain")
","b":true,"t":"File","n":"fromString"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Returns the mime-type of the file.

(File.fromString("Some contents...", "test.txt", "text/plain")\n|> File.mimeType()) == "text/plain"
","b":false,"t":"String","n":"mimeType"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Returns the name of the file.

(File.fromString("Some contents...", "test.txt", "text/plain")\n|> File.name()) == "test.txt"
","b":false,"t":"String","n":"name"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Reads the contents of the file as an ArrayBuffer.

let file =\n  File.create("Some content...", "test.txt", "text/plain")\n\nlet buffer =\n  File.readAsArrayBuffer(file)
","b":false,"t":"Promise(ArrayBuffer)","n":"readAsArrayBuffer"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Reads the contents of the given file as a Data URL.

let files =\n  await File.select("text/plain")\n\nlet dataUrl =\n  await File.readAsDataURL(file)\n\ndataUrl == "data:text/plain;...."
","b":false,"t":"Promise(String)","n":"readAsDataURL"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Reads the contents of the given file as a String.

let file =\n  File.create("Some content...", "test.txt", "text/plain")\n\nlet string =\n  await File.readAsString(file)\n\nstring == "Some content..."
","b":false,"t":"Promise(String)","n":"readAsString"},{"k":4,"a":[{"t":"String","n":"accept"}],"d":"

Opens the browsers file dialog for selecting a single file.

let file =\n  await File.select("application/json")
","b":false,"t":"Promise(File)","n":"select"},{"k":4,"a":[{"t":"String","n":"accept"}],"d":"

Opens the browsers file dialog for selecting multiple files.

let files =\n  await File.selectMultiple("application/json")
","b":false,"t":"Promise(Array(File))","n":"selectMultiple"},{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Returns the size of the file in bytes.

(File.fromString("Some contents...", "test.txt", "text/plain")\n|> File.size()) == 16
","b":false,"t":"Number","n":"size"}],"d":"

This module provides functions for getting, creating and reading files in\ndifferent formats.

","n":"File"},{"k":6,"e":[{"k":4,"a":[{"t":"Map(String, Array(String))","n":"errors"},{"t":"String","n":"key"}],"d":"

Returns the first error for the key in the errors.

([Validation.isNotBlank("", {"name", "Please enter the name."})]\n|> Validation.merge\n|> Validation.getFirstError("name")) // "Please enter the name."
","b":true,"t":"Maybe(String)","n":"getFirstError"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Number","n":"size"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the string does not have the exact number of characters.

Validation.hasExactNumberOfCharacters(\n  "",\n  5,\n  {"zip", "Zip code does is not 5 characters!"}) ==\n    Maybe.Just({"zip", "Zip code does is not 5 characters!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"hasExactNumberOfCharacters"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Number","n":"size"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the string does not have at least the number of\ncharacters.

Validation.hasMinimumNumberOfCharacters(\n  "",\n  5,\n  {"zip", "Zip code does is not 5 characters or more!"}) ==\n    Maybe.Just({"zip", "Zip code does is not 5 characters or more!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"hasMinimumNumberOfCharacters"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error when the string is blank (contains only whitespace).

Validation.isNotBlank("", {"name", "Name is empty!"}) ==\n  Maybe.Just({"name", "Name is empty!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"isNotBlank"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the string is not a number.

Validation.isNumber("foo", {"multiplicand", "Multiplicand is not a number!"}) ==\n  Maybe.Just({"multiplicand", "Multiplicand is not a number!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"isNumber"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the string does not consist of just digits.

Validation.isDigits("1234x", {"zip", "Zip code is not just digits!"}) ==\n  Maybe.Just({"zip", "Zip code is not just digits!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"isDigits"},{"k":4,"a":[{"t":"a","n":"value"},{"t":"a","n":"value2"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the two values are not the same.

Validation.isSame(\n  "password",\n  "confirmation",\n  {"confirmation", "Confirmation is not the same!"}) ==\n    Maybe.Just({"confirmation", "Confirmation is not the same!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"isSame"},{"k":4,"a":[{"t":"String","n":"value"},{"t":"Tuple(String, String)","n":"error"}],"d":"

Returns the error if the string is not an email address.

Validation.isValidEmail(\n  "test",\n  {"email", "Email is not a valid email address!"}) ==\n    Maybe.Just({"email", "Email is not a valid email address!"})
","b":true,"t":"Maybe(Tuple(String, String))","n":"isValidEmail"},{"k":4,"a":[{"t":"Array(Maybe(Tuple(String, String)))","n":"errors"}],"d":"

Merges the result of many validations into a Map(String, Array(String)).

Validation.merge([\n  Validation.isNotBlank("", {"firstName", "Please enter the first name."}),\n  Validation.isNotBlank("", {"message", "Please enter the message."}),\n]) == (Map.empty()\n  |> Map.set("firstName", "Please enter the first name.")\n  |> Map.set("message", "Please enter the message."))
","b":true,"t":"Map(String, Array(String))","n":"merge"},{"k":5,"d":"

A regular expression to validate an email address.

","v":"Regexp.createWithOptions(\n "^[a-zA-Z0-9.!#$%&'*+\\\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-" \\\n "Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-" \\\n "]{0,61}[a-zA-Z0-9])?)*$", \n {\n caseInsensitive: true,\n multiline: false,\n unicode: false,\n global: false,\n sticky: false\n })","b":true,"n":"EMAIL_REGEXP"},{"k":5,"d":"

A regular expression to validate digits.

","v":"Regexp.createWithOptions(\n "^[0-9]+$", \n {\n caseInsensitive: true,\n multiline: false,\n unicode: false,\n global: false,\n sticky: false\n })","b":true,"n":"DIGITS_REGEXP"}],"d":"

A module for validating values (mostly used in forms).

A validation function gets the value (and other parameters) and an error to\nreturn if the validation fails.

The error is a Tuple(String, String) where the first parameter is the key of\nthe field and the second is the error message.

The result of the validation is a Maybe(error). If it's Maybe.Nothing then\nthere validation succeeded, otherwise it will be a Maybe.Just(error) meaning\nthe validation failed.

Here is an example of doing validation for a contact form:

Validation.merge(\n  [\n    Validation.isNotBlank(firstName,\n      {"firstName", "Please enter the first name."}),\n    Validation.isNotBlank(lastName,\n      {"lastName", "Please enter the last name."}),\n    Validation.isNotBlank(message,\n      {"message", "Please enter the message."}),\n    Validation.isValidEmail(email,\n      {"email", "Please enter the a valid email address."}),\n    Validation.isNotBlank(email,\n      {"email", "Please enter the email address."}),\n  ])

Here the errors variable contains a Map(String, Array(String)) where they\nkey of the field is the the key of the error and the value of the field is the\nerror messages for that key.

If the errors is empty that means that there are no errors.

","n":"Validation"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Returns the Base64-decoded version of value as a Result.

Base64.decode("dGVzdA==") == Result.Ok("test")
","b":false,"t":"Result(String, String)","n":"decode"},{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Returns the Base64-encoded version of value.

Base64.encode("test") == "dGVzdA=="
","b":false,"t":"String","n":"encode"}],"d":"

This module provides functions for the encoding and decoding of binary data\nusing a Base64 representation.

","n":"Base64"},{"k":6,"e":[{"k":4,"a":[],"d":"

Blurs the active element of the page.

Dom.blurActiveElement()
","b":false,"t":"Promise(Void)","n":"blurActiveElement"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"selector"}],"d":"

Returns if the element is in an other element that matches the selector.

if let Just(div) = Document.getElementBySelector("div") {\n  Dom.containedInSelector(div, "body")\n}
","b":true,"t":"Bool","n":"containedInSelector"},{"k":4,"a":[{"t":"Dom.Element","n":"base"},{"t":"Dom.Element","n":"element"}],"d":"

Returns if the base element contains the element.

if let Just(div) =  Dom.getElementBySelector("div") {\n  if let Just(body) = Dom.getElementBySelector("body") {\n    Dom.contains(body, div)\n  }\n}
","b":false,"t":"Bool","n":"contains"},{"k":4,"a":[{"t":"String","n":"tag"}],"d":"

Creates a new Dom.Element using the tag.

Dom.createElement("div")
","b":false,"t":"Dom.Element","n":"createElement"},{"k":4,"a":[{"t":"Maybe(Dom.Element)","n":"maybeElement"}],"d":"

Tries to focus the given element (if exists) in the next 150 milliseconds.\nFails silently if there is no element or if the element cannot be focused.

Dom.focus(Dom.getElementBySelector("input"))
","b":false,"t":"Promise(Void)","n":"focus"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Focuses the first focusable descendant of the element. Fails silently if\nthere is no element.

if let Just(body) = Document.getElementBySelector("body") {\n  Dom.focusFirst(body)\n}
","b":false,"t":"Promise(Void)","n":"focusFirst"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Tries to focus the element in the next 150 milliseconds.

if let Just(input) = Document.getElementBySelector("input") {\n  Dom.focusWhenVisible(input)\n}
","b":true,"t":"Promise(Result(String, Void))","n":"focusWhenVisible"},{"k":4,"a":[],"d":"

Returns the active (focused) element of the page.

Dom.getActiveElement() == Dom.getElementBySelector("body")
","b":false,"t":"Maybe(Dom.Element)","n":"getActiveElement"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"attribute"}],"d":"

If the attribute is present, it will return its value on the element.

if let Just(element) = Dom.getElementById("my-div") {\n  Dom.getAttribute(element, "id") == "my-div"\n}
","b":true,"t":"Maybe(String)","n":"getAttribute"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns all child elements of the element.

if let Just(body) = Dom.getElementBySelector("body") {\n  Dom.getChildren(body)\n}
","b":false,"t":"Array(Dom.Element)","n":"getChildren"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the clientHeight of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getClientHeight(div) == 200\n}
","b":false,"t":"Number","n":"getClientHeight"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the clientWidth of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getClientWidth(div) == 200\n}
","b":false,"t":"Number","n":"getClientWidth"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the dimensions (BoundingClientRect) of the element.

Dom.getDimensions(Dom.createElement("div")) = {\n  bottom: 0,\n  height: 0,\n  width: 0,\n  right: 0,\n  left: 0,\n  top: 0,\n  x: 0,\n  y: 0\n}
","b":false,"t":"Dom.Dimensions","n":"getDimensions"},{"k":4,"a":[{"t":"String","n":"id"}],"d":"

Gets the element with the id from anywhere in the page.

Dom.getElementById("my-div")
","b":false,"t":"Maybe(Dom.Element)","n":"getElementById"},{"k":4,"a":[{"t":"String","n":"selector"}],"d":"

Gets the first element to match the selector from anywhere in the page.

Dom.getElementBySelector("body section > p:first-child")
","b":false,"t":"Maybe(Dom.Element)","n":"getElementBySelector"},{"k":4,"a":[{"t":"Number","n":"left"},{"t":"Number","n":"top"}],"d":"

Gets the element from a point on the screen.

Dom.getElementFromPoint(0, 0)
","b":true,"t":"Maybe(Dom.Element)","n":"getElementFromPoint"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"selector"}],"d":"

Gets all descendant elements of an element which are matching the selector.

if let Just(body) = Dom.getElementBySelector("body") {\n  Dom.getElementsBySelector(body, "a[name]")\n}
","b":true,"t":"Array(Dom.Element)","n":"getElementsBySelector"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns all focusable descendant elements.

if let Just(body) = Dom.getElementBySelector("body") {\n  Dom.getFocusableElements(body)\n}
","b":false,"t":"Array(Dom.Element)","n":"getFocusableElements"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the scrollable height of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getScrollHeight(div) == 0\n}
","b":false,"t":"Number","n":"getScrollHeight"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the horizontal scroll position of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getScrollLeft(div) == 0\n}
","b":false,"t":"Number","n":"getScrollLeft"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the vertical scroll position of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getScrollTop(div) == 0\n}
","b":false,"t":"Number","n":"getScrollTop"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the scrollable width of the element.

if let Just(div) = Dom.getElementBySelector("div") {\n  Dom.getScrollWidth(div) == 300\n}
","b":false,"t":"Number","n":"getScrollWidth"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"selector"}],"d":"

Returns the table of contents of the element for the selectors.

if let Just(body) = Dom.getElementBySelector("body") {\n  Dom.getTableOfContents(body, "h1, h2, h3, h4") == [\n    {"h1", "The title of the page", "the-title-of-the-page"},\n    {"h2", "A subtitle of the page", "a-subtitle-of-the-page"},\n    {"h3", "A sub-subtitle of the page", "a-sub-subtitle-of-the-page"}\n  ]\n}
","b":true,"t":"Array(Tuple(String, String, String))","n":"getTableOfContents"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the tagname of the element.

if let Just(body) = Dom.getElementBySelector("body") {\n  Dom.getTagName(body) == "BODY"\n}
","b":false,"t":"String","n":"getTagName"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Returns the text content of the element.

if let Just(body) = Document.getElementBySelector("body") {\n  Dom.getTextContent(body)\n}
","b":false,"t":"String","n":"getTextContent"},{"k":4,"a":[{"t":"String","n":"text"},{"t":"String","n":"font"}],"d":"

Measures width of the text with the font using the canvas.

Dom.getTextWidth("Hello There", "20px sans-serif") = 300
","b":false,"t":"Number","n":"getTextWidth"},{"k":4,"a":[{"t":"Dom.Element","n":"element"}],"d":"

Gets the value as string form an element. If the element supports value\nit will return it, otherwise it returns an empty string.

if let Just(input) = Document.getElementBySelector("input[value=hello]") {\n  Dom.getValue(input) == "hello"\n}
","b":false,"t":"String","n":"getValue"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"selector"}],"d":"

Returns whether or not the element matches the selector.

Dom.matches(Dom.createElement("div"), "div") == true\nDom.matches(Dom.createElement("div"), "p") == false
","b":false,"t":"Bool","n":"matches"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"Number","n":"left"},{"t":"Number","n":"top"}],"d":"

Scrolls the element to the position.

if let Just(body) = Document.getElementBySelector("body") {\n  Dom.scrollTo(body, 10, 10)\n}
","b":true,"t":"Promise(Void)","n":"scrollTo"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"attribute"},{"t":"String","n":"value"}],"d":"

Sets the attribute to the value of the element and returns the element.

"a"\n|> Dom.createElement\n|> Dom.setAttribute("name", "test")
","b":true,"t":"Dom.Element","n":"setAttribute"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"name"},{"t":"String","n":"value"}],"d":"

Sets the style to the value of the element.

if let Just(div) = Document.getElementBySelector("div") {\n  div\n  |> Dom.setStyle("background", "red")\n  |> Dom.setStyle("color", "white")\n}
","b":true,"t":"Dom.Element","n":"setStyle"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"String","n":"value"}],"d":"

Sets the value property of an element. It is used to set the value of input\nfields programmatically.

if let Just(input) = Document.getElementBySelector("input") {\n  Dom.setValue(input, "Hello World!")\n}
","b":false,"t":"Dom.Element","n":"setValue"},{"k":4,"a":[{"t":"Dom.Element","n":"element"},{"t":"Number","n":"left"},{"t":"Number","n":"top"}],"d":"

Smooth scroll the given element to the given position.

if let Just(body) = Document.getElementBySelector("body") {\n  Dom.smoothScrollTo(body, 10, 10)\n}
","b":true,"t":"Promise(Void)","n":"smoothScrollTo"}],"d":"

This module provides functions for working with the DOM.

","n":"Dom"},{"k":6,"e":[{"k":4,"a":[{"t":"Bool","n":"assertion"},{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

If the assertion is false, the message is written to the console. Supports\nstring substitution. For more information check out the console.assert()\nfunction.

Console.assert(false, "Message...") // This will not print the message.\nConsole.assert(true, "Message...") // This will print the message.
","b":true,"t":"Tuple(Bool, a, Array(b))","n":"assert"},{"k":4,"a":[],"d":"

Clears the console. For more information check out the console.clear()\nfunction.

Console.clear()
","b":false,"t":"Void","n":"clear"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Logs the number of times that this particular call to count has been called.\nReturns the label passed along with the current count. For more information\ncheck out the console.count() function.

Console.count()          // {"Default", 1}\nConsole.count("Default") // {"Default", 2}\nConsole.count("Test")    // {"Test", 1}
","b":false,"t":"Tuple(String, Number)","n":"count"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Resets the counter used with count. Returns the label passed along with the\ncurrent count. For more information check out the console.countReset()\nfunction.

Console.count()         // {"Default", 1}\nConsole.count()         // {"Default", 2}\nConsole.countReset()    // {"Default", 0}
","b":false,"t":"Tuple(String, Number)","n":"countReset"},{"k":4,"a":[{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

Outputs a message to the Web Console at the "debug" log level. The message is\nonly displayed to the user if the console is configured to display debug\noutput. Supports string substitution. For more information check out the\nconsole.debug() function.

Console.debug("The message...")
","b":false,"t":"Tuple(a, Array(b))","n":"debug"},{"k":4,"a":[{"t":"a","n":"value"}],"d":"

Displays an interactive list of the properties of the generated JavaScript\nobject. For more information check out the console.dir() function.

Console.dir(`{key: "value"}`)
","b":false,"t":"a","n":"dir"},{"k":4,"a":[{"t":"a","n":"value"}],"d":"

Displays an interactive tree of the descendant elements of the specified\nXML/HTML element. For more information check out the console.dirxml()\nfunction.

if let Just(element) = Dom.getElementBySelector("body") {\n  Console.dirxml(element)\n}
","b":false,"t":"a","n":"dirxml"},{"k":4,"a":[{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

Outputs an error message to the Web Console. Supports string substitution.\nFor more information check out the console.error() function.

Console.error("Something went wrong!")
","b":false,"t":"Tuple(a, Array(b))","n":"error"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Creates a new inline group in the Web Console log. For more information check\nout the console.group() function.

Console.group("My Group")\nConsole.log("Some information...")\nConsole.groupEnd()
","b":false,"t":"String","n":"group"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Creates a new inline group in the Web Console log. The new group is created\ncollapsed. For more information check out the console.groupCollapsed()\nfunction.

Console.groupCollapsed("My Group")\nConsole.log("Some information...")\nConsole.groupEnd()
","b":false,"t":"String","n":"groupCollapsed"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Exits the current inline group in the Web Console. For more information check\nout the console.groupEnd() function.

Console.group("My Group")\nConsole.log("Some information...")\nConsole.groupEnd()
","b":false,"t":"String","n":"groupEnd"},{"k":4,"a":[{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

Outputs an informational message to the Web Console. Supports string\nsubstitution. For more information check out the console.info() function.

Console.info("I'm cute!")
","b":false,"t":"Tuple(a, Array(b))","n":"info"},{"k":4,"a":[{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

Outputs a message to the Web Console. Supports string substitution. For more\ninformation check out the console.log() function.

Console.log("Hello ", ["World", "!"]) => "Hello World!"
","b":false,"t":"Tuple(a, Array(b))","n":"log"},{"k":4,"a":[{"v":""Default"","t":"String","n":"profileName"}],"d":"

NON-STANDARD: Starts recording a performance profile. For more information\ncheck out the console.profile() function.

Console.profile("My Profile")\n// Do something...\nConsole.profileEnd("My Profile")
","b":false,"t":"String","n":"profile"},{"k":4,"a":[{"v":""Default"","t":"String","n":"profileName"}],"d":"

NON-STANDARD: Stops recording a previously started performance profile.\nFor more information check out the console.profileEnd() function.

Console.profile("My Profile")\n// Do something...\nConsole.profileEnd("My Profile")
","b":false,"t":"String","n":"profileEnd"},{"k":4,"a":[{"t":"a","n":"data"},{"v":"[]","t":"Array(String)","n":"columns"}],"d":"

Logs data as a table. For more information check out the console.table()\nfunction.

Console.table({ name: "Joe" })
","b":true,"t":"Tuple(a, Array(String))","n":"table"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Starts a timer. For more information check out the console.time()\nfunction.

Console.time("My Timer")\n// Do some stuff...\nConsole.timeEnd("My Timer")
","b":false,"t":"String","n":"time"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Stops a timer that was previously started. For more information check out the\nconsole.timeEnd() function.

Console.time("My Timer")\n// Do some stuff...\nConsole.timeEnd("My Timer")
","b":false,"t":"String","n":"timeEnd"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"},{"v":"[]","t":"Array(a)","n":"values"}],"d":"

Logs the current value of a timer that was previously started. For more\ninformation check out the console.timeLog() function.

Console.time("My Timer")\n// Do some stuff...\nConsole.timeLog("My Timer")\nConsole.timeEnd("My Timer")
","b":true,"t":"Tuple(String, Array(a))","n":"timeLog"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

NON-STANDARD: Adds a single marker to the browser's performance tool. For\nmore information check out the console.timestamp() function.

Console.timestamp("My Timestamp")
","b":false,"t":"String","n":"timestamp"},{"k":4,"a":[{"t":"a","n":"value"},{"t":"Array(b)","n":"values"}],"d":"

Outputs a stack trace to the Web Console. Does not support string\nsubstitution. For more information check out the console.trace()\nfunction.

Console.trace("Value")
","b":false,"t":"Tuple(a, Array(b))","n":"trace"},{"k":4,"a":[{"t":"a","n":"value"},{"v":"[]","t":"Array(b)","n":"values"}],"d":"

Outputs a warning message to the Web Console. For more information check out\nthe console.warn() function.

Console.warn("Something fishy is going on...")
","b":false,"t":"Tuple(a, Array(b))","n":"warn"}],"d":"

This module provides functions to work with the Console Web API.

","n":"Console"},{"k":6,"e":[{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"},{"t":"Function(value, Maybe(result))","n":"function"}],"d":"

Maps the value of a maybe with a possibility to discard it.

Maybe.andThen(Maybe.Just(4), (num : Number) : Maybe(String) {\n  if (num > 4) {\n    Maybe.Just(Number.toString(num))\n  } else {\n    Maybe.Nothing\n  }\n})
","b":true,"t":"Maybe(result)","n":"andThen"},{"k":4,"a":[{"t":"Maybe(Maybe(value))","n":"maybe"}],"d":"

Flattens a nested maybe.

(Maybe.Just("A")\n|> Maybe.Just\n|> Maybe.flatten) == Maybe.Just("A")
","b":false,"t":"Maybe(value)","n":"flatten"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"}],"d":"

Returns whether the maybe is just a value.

Maybe.isJust(Maybe.Just("A")) == true\nMaybe.isJust(Maybe.Nothing) == false
","b":false,"t":"Bool","n":"isJust"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"}],"d":"

Returns whether the maybe is nothing.

Maybe.isNothing(Maybe.Nothing("A")) == false\nMaybe.isNothing(Maybe.Just("A")) == false
","b":false,"t":"Bool","n":"isNothing"},{"k":4,"a":[{"t":"value","n":"value"}],"d":"

Returns a maybe containing just the value.

Maybe.just("A") == Maybe.Just("A")
","b":false,"t":"Maybe(value)","n":"just"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"},{"t":"Function(value, result)","n":"function"}],"d":"

Maps the value of a maybe.

Maybe.map(\n  Maybe.Just(1),\n  (number : Number) { number + 2 })) == Maybe.Just(3)
","b":true,"t":"Maybe(result)","n":"map"},{"k":4,"a":[],"d":"

Returns nothing.

Maybe.nothing() == Maybe.Nothing
","b":false,"t":"Maybe(value)","n":"nothing"},{"k":4,"a":[{"t":"Array(Maybe(value))","n":"array"}],"d":"

Returns the first maybe with a value or nothing if all are nothing.

Maybe.oneOf([Maybe.Just("A"), Maybe.Nothing]) == Maybe.just("A")
","b":false,"t":"Maybe(value)","n":"oneOf"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"},{"t":"error","n":"error"}],"d":"

Converts the maybe to a result using the value as the error.

Maybe.toResult(Maybe.Nothing, "Error") == Result.Error("Error")\nMaybe.toResult(Maybe.Just("A"), "Error") == Result.Ok("A")
","b":true,"t":"Result(error, value)","n":"toResult"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"},{"t":"value","n":"defaultValue"}],"d":"

Returns the value of a maybe or the given value if it's nothing.

Maybe.withDefault(Maybe.Just("B"), "A") == "B"\nMaybe.withDefault(Maybe.Nothing, "A") == "A"
","b":false,"t":"value","n":"withDefault"},{"k":4,"a":[{"t":"Maybe(value)","n":"maybe"},{"t":"Function(value)","n":"function"}],"d":"

Returns the value of a maybe, or calls the given function otherwise.

Maybe.withLazyDefault(Maybe.Just("B"), () { "A" }) == "B"\nMaybe.withLazyDefault(Maybe.Nothing, () { "A" }) == "A"
","b":true,"t":"value","n":"withLazyDefault"}],"d":"

This module provides functions to work with the Maybe type.

","n":"Maybe"},{"k":6,"e":[{"k":4,"a":[],"d":"

Returns a promise which resolves after the next animationFrame

await Timer.nextFrame()\nDebug.log("This runs after the next frame...")
","b":false,"t":"Promise(Void)","n":"nextFrame"},{"k":4,"a":[{"t":"Number","n":"duration"}],"d":"

Returns a promise which resolves after the specified time in milliseconds.

await Timer.timeout(2000)\nDebug.log("This runs after 2 seconds...")
","b":false,"t":"Promise(Void)","n":"timeout"}],"d":"

This module provides functions related to timers.

","n":"Timer"},{"k":6,"e":[{"k":4,"a":[{"t":"FormData","n":"original"},{"t":"String","n":"key"},{"t":"File","n":"file"}],"d":"

Returns a new FormData object containing all the values from the original,\nwith the file added as a key.

let file =\n  File.fromString("Contents", "text.txt", "text/plain")\n\nFormData.empty()\n|> FormData.addFile("key", file)
","b":true,"t":"FormData","n":"addFile"},{"k":4,"a":[{"t":"FormData","n":"original"},{"t":"String","n":"key"},{"t":"String","n":"string"}],"d":"

Returns a new FormData object containing all the values from the original,\nwith the string added as a key.

FormData.empty()\n|> FormData.addString("key", "value")
","b":true,"t":"FormData","n":"addString"},{"k":4,"a":[],"d":"

Returns an empty FormData object.

FormData.empty()\n|> FormData.addString("key", "value")
","b":false,"t":"FormData","n":"empty"},{"k":4,"a":[{"t":"FormData","n":"formData"}],"d":"

Returns the keys of a FormData object.

FormData.empty()\n|> FormData.addString("key", "value")\n|> FormData.keys() == ["key"]
","b":false,"t":"Array(String)","n":"keys"}],"d":"

This module provides functions for working with the FormData Web API. It is\ngenerally used when sending messages via HTTP requests.

","n":"FormData"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"type"},{"t":"Bool","n":"capture"},{"t":"Function(Html.Event, a)","n":"listener"}],"d":"

Adds a listener to the window and returns the function which\nremoves this listener.

let listener =\n  Window.addEventListener("click", true, (event : Html.Event) {\n    Debug.log(event)\n  })
","b":true,"t":"Function(Void)","n":"addEventListener"},{"k":4,"a":[{"t":"String","n":"query"},{"t":"Function(Bool, a)","n":"listener"}],"d":"

Adds a media query listener to the window and returns the function which\nremoves this listener.

let listener =\n  Window.addMediaQueryListener("(max-width: 320px)", (matches : Bool) {\n    Debug.log(matches)\n  })
","b":true,"t":"Function(Void)","n":"addMediaQueryListener"},{"k":4,"a":[{"t":"String","n":"message"}],"d":"

Shows the default alert popup of the browser with the message. This function\nreturns a promise but blocks execution until the popup is closed.

Window.alert("Hello World!")
","b":false,"t":"Promise(Void)","n":"alert"},{"k":4,"a":[{"t":"String","n":"message"}],"d":"

Shows the default confirm popup of the browser with the message. This\nfunction returns a promise but blocks execution until the popup is closed.

case await Window.confirm("Are you ready?") {\n  Ok => "The user OK-d the popup."\n  Err => "The user cancelled."\n}
","b":false,"t":"Promise(Result(String, Void))","n":"confirm"},{"k":4,"a":[],"d":"

Returns the width of the scrollbar.

Window.getScrollbarWidth() == 10
","b":false,"t":"Number","n":"getScrollbarWidth"},{"k":4,"a":[],"d":"

Returns the height of the window in pixels.

Window.height() == 768
","b":false,"t":"Number","n":"height"},{"k":4,"a":[],"d":"

Returns the windows URL as a string.

Window.href() == "https://www.example.com"
","b":false,"t":"String","n":"href"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Returns true if the UL is the same as the current URL of the page.

Window.isActiveURL("https://www.example.com")
","b":false,"t":"Bool","n":"isActiveURL"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Like Window.navigate(), but also triggers a jump to the start of the\ndocument or the hash, if it exists.

Window.jump("/new-url")
","b":false,"t":"Promise(Void)","n":"jump"},{"k":4,"a":[{"t":"String","n":"query"}],"d":"

Returns true if the media query matches.

Window.matchesMediaQuery("(max-width: 320px)")
","b":false,"t":"Bool","n":"matchesMediaQuery"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Sets the URL of the window. If there is a route defined for this URL, runs\nits handler. Updates the navigation history.

Window.navigate("/new-url")
","b":false,"t":"Promise(Void)","n":"navigate"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Opens the URL in a new window or tab.

Window.open("https://www.google.com")
","b":false,"t":"Promise(Void)","n":"open"},{"k":4,"a":[{"t":"String","n":"label"},{"v":"""","t":"String","n":"current"}],"d":"

Shows the default prompt popup of the browser with the given message and\nvalue.

This function returns the entered text as a Maybe(String) and blocks\nexecution until the popup is closed. If the user cancelled the popup it\nreturns Maybe.Nothing.

case await Window.prompt("How old are you?") {\n  Just(value) => "The user provided the value: #{value}"\n  Nothing => "The user cancelled!"\n}
","b":true,"t":"Promise(Maybe(String))","n":"prompt"},{"k":4,"a":[],"d":"

Returns the scrollable height of the window in pixels.

Window.scrollHeight() == 768
","b":false,"t":"Number","n":"scrollHeight"},{"k":4,"a":[],"d":"

Returns the horizontal scroll position of the window in pixels.

Window.scrollLeft() == 100
","b":false,"t":"Number","n":"scrollLeft"},{"k":4,"a":[],"d":"

Returns the vertical scroll position of the window in pixels.

Window.scrollTop() == 100
","b":false,"t":"Number","n":"scrollTop"},{"k":4,"a":[],"d":"

Returns the scrollable width of the window in pixels.

Window.scrollWidth() == 1024
","b":false,"t":"Number","n":"scrollWidth"},{"k":4,"a":[{"t":"Number","n":"position"}],"d":"

Sets the vertical scroll position of the window in pixels.

Window.setScrollLeft(100)
","b":false,"t":"Promise(Void)","n":"setScrollLeft"},{"k":4,"a":[{"t":"Number","n":"position"}],"d":"

Sets the horizontal scroll position of the window in pixels.

Window.setScrollTop(100)
","b":false,"t":"Promise(Void)","n":"setScrollTop"},{"k":4,"a":[{"t":"String","n":"title"}],"d":"

Sets the windows title.

Window.setTitle("New Title!")
","b":false,"t":"Promise(Void)","n":"setTitle"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Sets the URL of the window.

Window.setUrl("/new-url")
","b":false,"t":"Promise(Void)","n":"setUrl"},{"k":4,"a":[],"d":"

Returns the windows title.

Window.title() == "Title!"
","b":false,"t":"String","n":"title"},{"k":4,"a":[],"d":"

Triggers a jump to the current location on the page.

When a page loads and the current URL has a hash #anchor-name, the browser\nautomatically jumps to the element with the matching id or to the anchor tag\nwith the matching name <a name="anchor-name">. This behavior does not happen\nwhen the history is manipulated manually.

This function triggers that behavior. When there is a hash in the current URL,\nit jumps to it, otherwise it jumps to the start of the document.

","b":false,"t":"Promise(Void)","n":"triggerJump"},{"k":4,"a":[],"d":"

Returns the current URL of the window.

Window.url().host == "www.example.com"
","b":false,"t":"Url","n":"url"},{"k":4,"a":[],"d":"

Returns the width of the window in pixels.

Window.width == 1024
","b":false,"t":"Number","n":"width"}],"d":"

This module provides functions for working with the Window JavaScript object.

","n":"Window"},{"k":6,"e":[{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the absolute value of the number.

Math.abs(1) == 1\nMath.abs(-1) == 1
","b":false,"t":"Number","n":"abs"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse cosine of the angle in radian.

Math.acos(0) == 1.5707963267948966
","b":false,"t":"Number","n":"acos"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse hyperbolic cosine of the angle in radians.

Math.acosh(2) == 1.3169578969248166
","b":false,"t":"Number","n":"acosh"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse sine of the angle in radians.

Math.asin(0.5) == 0.5235987755982989
","b":false,"t":"Number","n":"asin"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse hyperbolic sine of the angle in radians.

Math.asinh(1) == 0.881373587019543
","b":false,"t":"Number","n":"asinh"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse tangent of the angle in radians.

Math.atan(1) == 0.7853981633974483
","b":false,"t":"Number","n":"atan"},{"k":4,"a":[{"t":"Number","n":"y"},{"t":"Number","n":"x"}],"d":"

Returns the angle in the plane (in radians) between the positive x-axis\nand the ray from (0, 0) to the point (x, y).

Math.atan2(90, 15) == 1.4056476493802699
","b":false,"t":"Number","n":"atan2"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the inverse hyperbolic tangent of the angle in radians.

Math.atanh(0.5) == 0.5493061443340548
","b":false,"t":"Number","n":"atanh"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the cubic root of the number.

Math.cbrt(1) == 1\nMath.cbrt(64) == 4
","b":false,"t":"Number","n":"cbrt"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the smallest integer greater than or equal to the number.

Math.ceil(0.3) == 1
","b":false,"t":"Number","n":"ceil"},{"k":4,"a":[{"t":"Number","n":"value"},{"t":"Number","n":"lower"},{"t":"Number","n":"upper"}],"d":"

Clamps the number between the upper and lower bounds.

Math.clamp(100, 0, 10) == 10\nMath.clamp(-100, 0, 10) == 0
","b":false,"t":"Number","n":"clamp"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the number of leading zero bits in the 32-bit binary representation\nof the number.

// 00000000000000000000000000000100\nMath.clz32(4) == 29
","b":false,"t":"Number","n":"clz32"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the cosine of the angle in radians.

Math.cos(1) == 0.5403023058681398
","b":false,"t":"Number","n":"cos"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Returns the hyperbolic cosine of the angle in radians.

Math.cosh(1) == 1.5430806348152437
","b":false,"t":"Number","n":"cosh"},{"k":4,"a":[{"t":"Number","n":"x"}],"d":"

Returns the value of Math.E raised to the power x, where x is the number.

Math.exp(1) == 2.718281828459045
","b":false,"t":"Number","n":"exp"},{"k":4,"a":[{"t":"Number","n":"x"}],"d":"

Returns the value of Math.E to the power x, minus 1.

Math.exp(2) == 7.38905609893065\nMath.expm1(2) == 6.38905609893065
","b":false,"t":"Number","n":"expm1"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the largest integer less than or equal to the number.

Math.floor(0.8) == 0
","b":false,"t":"Number","n":"floor"},{"k":4,"a":[{"t":"Number","n":"a"},{"t":"Number","n":"b"}],"d":"

Returns the floating-point remainder of two numbers.

Math.fmod(2, 5.3) == 1.3\nMath.fmod(4.2, 18.5) == 1.7
","b":false,"t":"Number","n":"fmod"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the nearest 32-bit single precision float representation of the\nnumber.

Math.fround(1.337) == 1.3370000123977661
","b":false,"t":"Number","n":"fround"},{"k":4,"a":[{"t":"Number","n":"a"},{"t":"Number","n":"b"}],"d":"

Returns the square root of the sum of squares of its arguments.

Math.hypot(3, 4) == 5
","b":false,"t":"Number","n":"hypot"},{"k":4,"a":[{"t":"Number","n":"a"},{"t":"number","n":"b"}],"d":"

Returns the result using C-like 32-bit multiplication of the two parameters.

Math.imul(3, 4) == 12
","b":false,"t":"Number","n":"imul"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns natural logarithm (base e) of the value.

Math.log(1) == 0
","b":false,"t":"Number","n":"log"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns natural logarithm (base 10) of the value.

Math.log10(100) == 10
","b":false,"t":"Number","n":"log10"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns natural logarithm (base e) of the value, plus 1.

Math.log1p(1) == 0
","b":false,"t":"Number","n":"log1p"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns natural logarithm (base 2) of the value.

Math.log2(8) == 3
","b":false,"t":"Number","n":"log2"},{"k":4,"a":[{"t":"Number","n":"number1"},{"t":"Number","n":"number2"}],"d":"

Returns the highest-valued number from the arguments.

Math.max(1, 2) == 2
","b":false,"t":"Number","n":"max"},{"k":4,"a":[{"t":"Number","n":"number1"},{"t":"Number","n":"number2"}],"d":"

Returns the lowest-valued number from the arguments.

Math.min(1, 2) == 1
","b":false,"t":"Number","n":"min"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Negates the number.

Math.negate(1) == -1
","b":false,"t":"Number","n":"negate"},{"k":4,"a":[{"t":"Number","n":"value"},{"t":"Number","n":"exponent"}],"d":"

Returns the exponent power of the number.

Math.pow(2, 2) == 4
","b":false,"t":"Number","n":"pow"},{"k":4,"a":[],"d":"

Returns a pseudo-random number in the range 0 to less than 1.

Math.random() // A random number between 0 and 1.
","b":false,"t":"Number","n":"random"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the value of a number rounded to the nearest integer.

Math.round(0.5) == 1
","b":false,"t":"Number","n":"round"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the sign of the number (1 or -1).

Math.sign(5) == 1\nMath.sign(-5) == -1
","b":false,"t":"Number","n":"sign"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Calculates the sine of the angle in radians.

Math.sin(1) == 0.8414709848078965
","b":false,"t":"Number","n":"sin"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Calculates the hyperbolic sine of the angle in radians.

Math.sinh(1) == 1.1752011936438014
","b":false,"t":"Number","n":"sinh"},{"k":4,"a":[{"t":"Number","n":"value"}],"d":"

Returns the square root of the number.

Math.sqrt(4) == 2
","b":false,"t":"Number","n":"sqrt"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Calculates the tangent of the angle in radians.

Math.tan(1) == 1.5574077246549023
","b":false,"n":"tan"},{"k":4,"a":[{"t":"Number","n":"angle"}],"d":"

Calculates the hyperbolic tangent of the angle in radians.

Math.tanh(1) == 0.7615941559557649
","b":false,"t":"Number","n":"tanh"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the integer part of a number by removing any fractional digits.

Math.trunc(13.37) == 13\nMath.trunc(42.84) == 42
","b":false,"n":"trunc"},{"k":4,"a":[{"t":"Number","n":"value"},{"t":"Number","n":"to"}],"d":"

Truncates the given number to the given amount.

Math.truncate(0.123456, 2) == 0.12
","b":false,"t":"Number","n":"truncate"},{"k":5,"d":"

Base-10 logarithm of E (approximately 0.434)

","v":"`Math.LOG10E`","b":false,"n":"LOG10E"},{"k":5,"d":"

Square root of 0.5 (approximately 0.707)

","v":"`Math.SQRT1_2`","b":false,"n":"SQRT1_2"},{"k":5,"d":"

Base-2 logarithm of E (approximately 1.443)

","v":"`Math.LOG2E`","b":false,"n":"LOG2E"},{"k":5,"d":"

Square root of 2 (approximately 1.414)

","v":"`Math.SQRT2`","b":false,"n":"SQRT2"},{"k":5,"d":"

Natural logarithm of 10 (approximately 2.303)

","v":"`Math.LN10`","b":false,"n":"LN10"},{"k":5,"d":"

Natural logarithm of 2 (approximately 0.693)

","v":"`Math.LN2`","b":false,"n":"LN2"},{"k":5,"d":"

Ratio of a circle's circumference to its diameter (approximately 3.14159)

","v":"`Math.PI`","b":false,"n":"PI"},{"k":5,"d":"

Euler's number and the base of natural logarithms (approximately 2.718)

","v":"`Math.E`","b":false,"n":"E"}],"d":"

This module provides mathematical functions and constants.

","n":"Math"},{"k":6,"e":[{"k":4,"a":[{"t":"a","n":"value"}],"d":"

Logs an arbitrary value to the windows console.

Debug.log("Hello World!")
","b":false,"t":"a","n":"log"}],"d":"

This module provides functions for debugging purposes.

","n":"Debug"},{"k":6,"e":[{"k":4,"a":[{"t":"Set(item)","n":"set"},{"t":"item","n":"value"}],"d":"

Adds the value to the set.

Set.add(Set.empty(), "value") == Set.fromArray(["value"])
","b":false,"t":"Set(item)","n":"add"},{"k":4,"a":[{"t":"Set(item)","n":"set"},{"t":"item","n":"value"}],"d":"

Deletes the value from the set.

(Set.empty()\n|> Set.add("value")\n|> Set.delete("value")) == Set.empty()
","b":false,"t":"Set(item)","n":"delete"},{"k":4,"a":[],"d":"

Returns an empty set.

Set.empty()
","b":false,"t":"Set(item)","n":"empty"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Converts an Array(a) to a Set(a), duplicates are removed.

Set.add(Set.empty(), "value") == Set.fromArray(["value"])
","b":false,"t":"Set(item)","n":"fromArray"},{"k":4,"a":[{"t":"Set(item)","n":"set"},{"t":"item","n":"value"}],"d":"

Returns whether or not the set has the value.

(Set.empty()\n|> Set.add(Maybe.just("value"))\n|> Set.has(Maybe.just("value"))) == true
","b":false,"t":"Bool","n":"has"},{"k":4,"a":[{"t":"Set(item)","n":"set"},{"t":"Function(item, b)","n":"method"}],"d":"

Maps over the items of the set to return a new set.

(Set.fromArray([0])\n|> Set.map(Number.toString)) == Set.fromArray(["0"])
","b":false,"t":"Set(b)","n":"map"},{"k":4,"a":[{"t":"Set(item)","n":"set"}],"d":"

Returns the size of a set.

Set.size(Set.fromArray([0, 1, 2])) == 3
","b":false,"t":"Number","n":"size"},{"k":4,"a":[{"t":"Set(item)","n":"set"}],"d":"

Converts the Set(a) to an Array(a).

(Set.empty()\n|> Set.add("value")\n|> Set.toArray()) == ["value"]
","b":false,"t":"Array(item)","n":"toArray"}],"d":"

This module provides functions for the Set type.

","n":"Set"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"raw"}],"d":"

Tries to parse the given string as an ISO date.

Time.parseISO("2018-04-05T00:00:00.000Z")
","b":false,"t":"Maybe(Time)","n":"parseISO"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the UNIX Timestamp (in milliseconds) of the time.

Time.toUnix(Time.utcDate(2006, 1, 2)) == 1136160000000
","b":false,"t":"Number","n":"toUnix"},{"k":4,"a":[{"t":"Number","n":"timestamp"}],"d":"

Returns the time respective to the UNIX Timestamp (in milliseconds).

Time.unix(1136160000000) == Time.utcDate(2006, 1, 2)
","b":false,"t":"Time","n":"unix"},{"k":4,"a":[{"t":"Number","n":"year"},{"v":"1","t":"Number","n":"month"},{"v":"1","t":"Number","n":"day"},{"v":"0","t":"Number","n":"hour"},{"v":"0","t":"Number","n":"minute"},{"v":"0","t":"Number","n":"second"},{"v":"0","t":"Number","n":"millisecond"}],"d":"

Returns a new time from the parameters.

Time.utc(2018, 4, 5, 12, 24, 50, 100)
","b":true,"t":"Time","n":"utc"},{"k":4,"a":[{"t":"Number","n":"year"},{"t":"Number","n":"month"},{"t":"Number","n":"day"}],"d":"

Returns a new time from the parameters (without time parts).

Time.utcDate(2018, 4, 5)
","b":false,"t":"Time","n":"utcDate"},{"k":4,"a":[],"d":"

Returns the current time (in UTC).

Time.now()
","b":false,"t":"Time","n":"now"},{"k":4,"a":[],"d":"

Returns the current time (offset by the clients time zone).

Time.local()
","b":false,"t":"Time","n":"local"},{"k":4,"a":[],"d":"

Returns the time at the begging of today.

Time.today()
","b":false,"t":"Time","n":"today"},{"k":4,"a":[],"d":"

Returns the time at the begging of tomorrow.

Time.tomorrow()
","b":false,"t":"Time","n":"tomorrow"},{"k":4,"a":[],"d":"

Returns the time at the begging of yesterday.

Time.yesterday()
","b":false,"t":"Time","n":"yesterday"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the year of the time.

Time.year(Time.utcDate(2018, 4, 5)) == 2018
","b":false,"t":"Number","n":"year"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the quarter of the year in which the time occurs.

Time.quarterOfYear(Time.utcDate(2018, 4, 5)) == 1
","b":false,"t":"Number","n":"quarterOfYear"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the month of the time (as a number).

Time.monthNumber(Time.utcDate(2018, 4, 5)) == 4
","b":false,"t":"Number","n":"monthNumber"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the month of the time (as a Month).

Time.month(Time.utcDate(2018, 4, 5)) == Month.April
","b":false,"t":"Month","n":"month"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the ISO calendar year and week of the time.

The ISO calendar year to which the week belongs is not always in the same\nas the year of the regular calendar date. The first three days of January\nsometimes belong to week 52 (or 53) of the previous year; equally the last\nthree days of December sometimes are already in week 1 of the following year.

For that reason, this method returns a tuple year, week consisting of the\ncalendar year to which the calendar week belongs and the ordinal number of\nthe week within that year.

Time.calendarWeek(Time.utcDate(2016, 1, 1)) == {2016, 53}
","b":false,"t":"Tuple(Number, Number)","n":"calendarWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the day of the week of the time (as a number from 1 to 7).

Time.dayOfWeekNumber(Time.utcDate(2018, 4, 5)) == 4
","b":false,"t":"Number","n":"dayOfWeekNumber"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the day of week of the time.

Time.dayOfWeek(Time.utcDate(2018, 4, 5)) == Weekday.Thursday
","b":false,"t":"Weekday","n":"dayOfWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the day of month of the time.

Time.dayOfMonth(Time.utcDate(2018, 4, 5)) == 5
","b":false,"t":"Number","n":"dayOfMonth"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the day of the year of the time.

Time.dayOfYear(Time.utcDate(2018, 4, 5)) == 95
","b":false,"t":"Number","n":"dayOfYear"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the hour of the time.

Time.hour(Time.utc(2018, 4, 5, 10, 25, 30, 40) == 10
","b":false,"t":"Number","n":"hour"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the minute of the time.

Time.minute(Time.utc(2018, 4, 5, 10, 25, 30, 40)) == 25
","b":false,"t":"Number","n":"minute"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the second of the time.

Time.second(Time.utc(2018, 4, 5, 10, 25, 30, 40)) == 30
","b":false,"t":"Number","n":"second"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns the millisecond of the time.

Time.millisecond(Time.utc(2018, 4, 5, 10, 25, 30, 40)) == 40
","b":false,"t":"Number","n":"millisecond"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns if the year of the time is a leap year or not.

Time.isLeapYear(Time.utcDate(2011,1,1)) == false\nTime.isLeapYear(Time.utcDate(2012,1,1)) == true
","b":false,"t":"Bool","n":"isLeapYear"},{"k":4,"a":[{"t":"Number","n":"year"}],"d":"

Returns if the number (year) is a leap year or not.

Time.isNumberLeapYear(2020) == true\nTime.isNumberLeapYear(2021) == false
","b":false,"t":"Bool","n":"isNumberLeapYear"},{"k":4,"a":[{"t":"Time","n":"time"},{"t":"Time.Span","n":"delta"}],"d":"

Shifts the time using the time span.

Time.shift(Time.utcDate(2018, 4, 5), Time.Span.Days(2)) ==\n  Time.utcDate(2018, 4, 7)
","b":false,"t":"Time","n":"shift"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same year as the original\ntime.

Time.atBeginningOfYear(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 1, 1)
","b":false,"t":"Time","n":"atBeginningOfYear"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same month as the\noriginal time.

Time.atBeginningOfMonth(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 1)
","b":false,"t":"Time","n":"atBeginningOfMonth"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same week as the original\ntime.

Time.atBeginningOfWeek(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 15)
","b":false,"t":"Time","n":"atBeginningOfWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same day as the original\ntime.

Time.atBeginningOfDay(Time.utc(2017, 5, 20, 10, 34, 22, 40)) ==\n  Time.utc(2017, 5, 20, 0, 0, 0, 0)
","b":false,"t":"Time","n":"atBeginningOfDay"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the end of the same year as the original time.

Time.atEndOfYear(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 12, 31)
","b":false,"t":"Time","n":"atEndOfYear"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the end of the same month as the original time.

Time.atEndOfMonth(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 31)
","b":false,"t":"Time","n":"atEndOfMonth"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same week as the original\ntime.

Time.atEndOfWeek(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 1)
","b":false,"t":"Time","n":"atEndOfWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is at the beginning of the same day as the original\ntime.

Time.atEndOfDay(Time.utc(2017, 5, 20, 10, 34, 22, 40)) ==\n  Time.utc(2017, 5, 20, 0, 0, 0, 0)
","b":false,"t":"Time","n":"atEndOfDay"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a month later than the time.

Time.nextMonth(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 6, 20)
","b":false,"t":"Time","n":"nextMonth"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a month sooner than the time.

Time.previousMonth(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 4, 20)
","b":false,"t":"Time","n":"previousMonth"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a week later than the time.

Time.nextWeek(Time.utcDate(2017, 5, 10)) == Time.utcDate(2017, 5, 17)
","b":false,"t":"Time","n":"nextWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a week sooner than the time.

Time.previousWeek(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 13)
","b":false,"t":"Time","n":"previousWeek"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a day later than the time.

Time.nextDay(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 21)
","b":false,"t":"Time","n":"nextDay"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Returns a new time which is a day sooner than the time.

Time.previousDay(Time.utcDate(2017, 5, 20)) == Time.utcDate(2017, 5, 19)
","b":false,"t":"Time","n":"previousDay"},{"k":4,"a":[{"t":"Time","n":"from"},{"t":"Time","n":"to"}],"d":"

Returns an array of days from the start to end time (inclusive).

Time.range(Time.utcDate(2006, 4, 1), Time.utcDate(2006, 4, 4)) == [\n  Time.utcDate(2006, 4, 1),\n  Time.utcDate(2006, 4, 2),\n  Time.utcDate(2006, 4, 3),\n  Time.utcDate(2006, 4, 4)\n]
","b":false,"t":"Array(Time)","n":"range"},{"k":4,"a":[{"t":"String","n":"timeZone"},{"t":"Time","n":"time"}],"d":"

Converts the time zone, since not all browsers support time zone\nconversion this function can fail.

Time.inZone("America/New_York", Time.utc(2019, 1, 1, 7, 12, 35, 200)) ==\n  Maybe.Just(Time.utc(2019, 1, 1, 2, 12, 35, 200))
","b":false,"t":"Maybe(Time)","n":"inZone"},{"k":4,"a":[{"t":"Time","n":"from"},{"t":"Time","n":"to"},{"t":"Time.Format.Language","n":"language"}],"d":"

Reports the approximate distance in time between two Time objects as seconds\nin the language.

let now =\n  Time.utc(2016, 1, 2, 12, 34, 50, 200)\n\nlet time =\n  Time.shift(Time.Span.Hours(4), time)\n\nTime.distanceOfTimeInWords(time, now, Time.Format.English) == "in 4 hours"
","b":true,"n":"distanceOfTimeInWords"},{"k":4,"a":[{"t":"Time","n":"time"},{"t":"Time.Format.Language","n":"language"},{"t":"String","n":"pattern"}],"d":"

Formats the time using the pattern in the language.

Time.format(\n  Time.utcDate(2018, 4, 5),\n  Time.Format:ENGLISH,\n  "%Y-%m-%dT%H:%M:%S.%LZ") == "2018-04-05T00:00:00.000Z"

The following token can be used in the pattern:

","b":true,"t":"String","n":"format"},{"k":4,"a":[{"t":"Time","n":"time"}],"d":"

Formats the time to the ISO format.

Time.formatISO(Time.utcDate(2018, 4, 5)) == "2018-04-05T00:00:00.000Z"
","b":false,"t":"String","n":"formatISO"},{"k":4,"a":[{"t":"Time","n":"time"},{"t":"Time.Format.Language","n":"language"},{"t":"String","n":"token"}],"d":"

Formats the time by the single token using the language.

Time.formatToken(Time.Format:ENGLISH, "Y", Time.utcDate(2018, 4, 5)) == "2018"
","b":true,"t":"String","n":"formatToken"}],"d":"

Time represents a point in time without a time-zone attribute.

The calendaric calculations are based on the rules of the proleptic Gregorian\ncalendar as specified in ISO 8601. Leap seconds are ignored.

This module uses the Date JavaScript object under the hood. Since the\nDate object is always in the clients time-zone, this module uses the UTC\nbased functions getUTC* and setUTC* for querying and modifying.

Things to keep in mind when working with Time:

","n":"Time"},{"k":6,"e":[{"k":4,"a":[{"t":"Bool","n":"item"}],"d":"

Converts a boolean to a string.

Bool.toString(true) == "true"\nBool.toString(false) == "false"
","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions for working with boolean values.

","n":"Bool"},{"k":6,"e":[{"k":4,"a":[{"t":"Number","n":"id"}],"d":"

Cancels a previously scheduled function call using the request function.

AnimationFrame.cancel(id)
","b":false,"t":"Number","n":"cancel"},{"k":4,"a":[{"t":"Function(Number, a)","n":"function"}],"d":"

Schedules the function to run on the next frame, and returns its ID for\npossible cancellation.

let id =\n  AnimationFrame.request((timestamp : Number) {\n    Debug.log("Hello")\n  })
","b":false,"t":"Number","n":"request"}],"d":"

This module provides functions to work with the Animation Frame Web API.

","n":"AnimationFrame"},{"k":6,"e":[{"k":4,"a":[{"t":"a","n":"error"}],"d":"

Returns an Err result wit the the error.

(Result.error("error")\n|> Result.isError()) == true
","b":false,"t":"Result(a, b)","n":"error"},{"k":4,"a":[{"t":"Result(error, a)","n":"result"},{"t":"Function(a, Result(error, b))","n":"function"}],"d":"

Maps over the value of the result to an other result and flattens it.

(Result.Err("error")\n|> Result.flatMap((item : String) { Result.Ok(item + "1") })) == Result.Err("error")\n\n(Result.Ok("ok")\n|> Result.map((item : String) { Result.Ok(item + "1") })) == Result.Ok("ok1")
","b":true,"t":"Result(error, b)","n":"flatMap"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"}],"d":"

Returns true if the result is an Err.

(Result.Err("error")\n|> Result.isError()) == true
","b":false,"t":"Bool","n":"isError"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"}],"d":"

Returns true if the result is an Ok.

(Result.Ok("ok")\n|> Result.isOk()) == true
","b":false,"t":"Bool","n":"isOk"},{"k":4,"a":[{"t":"Result(error, Result(error, value))","n":"result"}],"d":"

Flattens a nested result (where the other result is in an Ok).

Result.flatten(Result.Ok(Result.Ok("Hello"))) == Result.Ok("Hello")\nResult.flatten(Result.Err("Error")) == Result.Err("Error")
","b":true,"t":"Result(error, value)","n":"flatten"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"},{"t":"Function(b, c)","n":"function"}],"d":"

Apply a function to a result. If the result is Ok, it will be converted.\nIf the result is an Err, the same error value will propagate through.

(Result.Err("error")\n|> Result.map((item : String) { item + "1" })) == Result.Err("error")\n\n(Result.Ok("ok")\n|> Result.map((item : String) { item + "1" })) == Result.Ok("ok1")
","b":true,"t":"Result(a, c)","n":"map"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"},{"t":"Function(a, c)","n":"function"}],"d":"

Transform an Err value.

(Result.Err("error")\n|> Result.mapError((item : String) { item + "1" })) == Result.Err("error1")\n\n(Result.Ok("ok")\n|> Result.mapError((item : String) { item + "1" })) == Result.Ok("ok")
","b":true,"t":"Result(c, b)","n":"mapError"},{"k":4,"a":[{"t":"a","n":"input"}],"d":"

Returns an Ok result with the input.

(Result.ok("ok")\n|> Result.isOk()) == true
","b":false,"t":"Result(b, a)","n":"ok"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"}],"d":"

Convert to a simpler Maybe if the actual error message is not needed or you\nneed to interact with some code that primarily uses maybes.

(Result.Ok("blah")\n|> Result.toMaybe()) == Maybe.Just("blah")\n\n(Result.Err("blah")\n|> Result.toMaybe()) == Maybe.Nothing
","b":false,"t":"Maybe(b)","n":"toMaybe"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"},{"t":"b","n":"defaultValue"}],"d":"

If the result is Ok return the value, but if the result is an Err then\nreturn a given default value.

(Result.Err("error")\n|> Result.withDefault("a")) == "a"\n\n(Result.Ok("ok")\n|> Result.withDefault("a")) == "ok"
","b":false,"t":"b","n":"withDefault"},{"k":4,"a":[{"t":"Result(a, b)","n":"result"},{"t":"a","n":"defaultError"}],"d":"

If the result is Err return the error, but if the result is an Ok then\nreturn a given default error.

(Result.Err("error")\n|> Result.withError("a")) == "error"\n\n(Result.Ok("ok")\n|> Result.withError("a")) == "a"
","b":false,"t":"a","n":"withError"}],"d":"

This module provides functions for working with the Result type.

","n":"Result"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"input"}],"d":"

Creates a new regular expression from a string.

Regexp.create("test") == /test/
","b":false,"t":"Regexp","n":"create"},{"k":4,"a":[{"t":"String","n":"input"},{"t":"Regexp.Options","n":"options"}],"d":"

Creates a new regular expression using the options.

Regexp.createWithOptions(\n  "test",\n  {\n    caseInsensitive: true,\n    multiline: true,\n    unicode: true,\n    global: true,\n    sticky: true\n  }) == /test/gimuy
","b":true,"t":"Regexp","n":"createWithOptions"},{"k":4,"a":[{"t":"String","n":"input"}],"d":"

Escapes the input to use in a regular expression.

Regexp.escape("-{") == "\\\\-\\\\{"
","b":false,"t":"String","n":"escape"},{"k":4,"a":[{"t":"Regexp","n":"regexp"},{"t":"String","n":"input"}],"d":"

Returns whether or not the regular expression matches the string.

Regexp.match(/,/, "asd,asd")) == true
","b":false,"t":"Bool","n":"match"},{"k":4,"a":[{"t":"Regexp","n":"regexp"},{"t":"String","n":"input"}],"d":"

Returns all of the matches of the regular expression against the string.

Regexp.matces(/\\w/i, "a,b,c,d") == [\n  {\n    submatches: [],\n    match: "a",\n    index: 0\n  }\n]
","b":false,"t":"Array(Regexp.Match)","n":"matches"},{"k":4,"a":[{"t":"Regexp","n":"regexp"},{"t":"String","n":"input"},{"t":"Function(Regexp.Match, String)","n":"replacer"}],"d":"

Replaces the matches of the regular expression using the function to\ncalculate the replacement string.

Regexp.replace(\n  /\\w/i,\n  "a,b,c,d",\n  (match : Regexp.Match) { match.match + "1" }) == "a1,b1,c1,d1"
","b":true,"t":"String","n":"replace"},{"k":4,"a":[{"t":"Regexp","n":"regexp"},{"t":"String","n":"input"}],"d":"

Splits the string by the regular expression.

Regexp.split(/,/, "a,b,c,d")) == ["a", "b", "c", "d"]
","b":false,"t":"Array(String)","n":"split"},{"k":4,"a":[{"t":"Regexp","n":"regexp"}],"d":"

Returns the string representation of the regular expression.

Regexp.toString(/test/) == "/test/"
","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions for working with regular expressions.

","n":"Regexp"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Sets the clipboards content to the given value.

Clipboard.set("Hello World!")
","b":false,"t":"Promise(String)","n":"set"}],"d":"

This module has functions for manipulating the clipboard.

","n":"Clipboard"},{"k":6,"e":[{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"key","n":"keyToDelete"}],"d":"

Deletes the key-value pair.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.delete("a")) == Map.empty()
","b":true,"t":"Map(key, value)","n":"delete"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"value","n":"valueToDelete"}],"d":"

Delete all key-value pairs which match the value.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 1)\n|> Map.deleteValues(1)) == Map.empty()
","b":true,"t":"Map(key, value)","n":"deleteValues"},{"k":4,"a":[],"d":"

Returns an empty map.

Map.empty()
","b":false,"t":"Map(x, z)","n":"empty"},{"k":4,"a":[{"t":"Map(a, b)","n":"map"}],"d":"

Returns the map as an array of key-value tuples.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.entries()) == [{"a", 1}, {"b", 2}]
","b":false,"t":"Array(Tuple(a, b))","n":"entries"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"Function(value, Bool)","n":"function"}],"d":"

Returns the first key which is matched by the function.

(Map.empty()\n|> Map.set("a", 0)\n|> Map.set("b", 1)\n|> Map.findKeyBy((value : Number) { value == 1 })) == Maybe.just("b")
","b":true,"t":"Maybe(key)","n":"findKeyBy"},{"k":4,"a":[{"t":"Array(Tuple(a, b))","n":"array"}],"d":"

Converts an Array of key-value tuples into a map.

(Map.empty()\n |> Map.set("a", 1)\n |> Map.set("b", 2)) == Map.fromArray([{"a", 1}, {"b", 2}])
","b":false,"t":"Map(a, b)","n":"fromArray"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"key","n":"search"}],"d":"

Gets the value of the key.

(Map.empty()\n|> Map.set("key", "value")\n|> Map.get("key")) == Maybe.just("value")
","b":false,"t":"Maybe(value)","n":"get"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"key","n":"key"},{"t":"value","n":"value"}],"d":"

Gets the value of the key using the value as fallback.

(Map.empty()\n|> Map.set("key", "value")\n|> Map.getWithDefault("key", "fallback")) == "value"\n\n(Map.empty()\n|> Map.getWithDefault("key", "fallback")) == "fallback"
","b":true,"t":"value","n":"getWithDefault"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"key","n":"search"}],"d":"

Returns whether or not the map has the key.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.has("a")) == true
","b":false,"t":"Bool","n":"has"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"}],"d":"

Returns whether or not the map is empty.

(Map.empty()\n|> Map.isEmpty()) == true\n\n(Map.empty()\n|> Map.set("a", "b")\n|> Map.isEmpty()) == false
","b":false,"t":"Bool","n":"isEmpty"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"}],"d":"

Returns the keys of a map as an Array(key).

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.values()) == ["a", "b"]
","b":false,"t":"Array(key)","n":"keys"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"Function(key, value, result)","n":"function"}],"d":"

Maps over the keys-values pairs with the function.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.map((key : String, value : Number) : Number { value * 2 })\n|> Map.values()) == [2,4]
","b":true,"t":"Map(key, result)","n":"map"},{"k":4,"a":[{"t":"Map(key, value)","n":"map1"},{"t":"Map(key, value)","n":"map2"}],"d":"

Merges two maps together where the second has the precedence.

let a =\n  Map.empty()\n  |> Map.set("a", "b")\n\nlet b =\n  Map.empty()\n  |> Map.set("a", "y")\n\n(Map.merge(a, b)\n|> Map.get("a")) == Maybe.Just("y")
","b":true,"t":"Map(key, value)","n":"merge"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"memo","n":"memo"},{"t":"Function(memo, key, value, memo)","n":"method"}],"d":"

Reduces the map from the left using the accumulator function.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.reduce(\n  0,\n  (memo : Number, key : String, value : Number) : Number {\n    memo + value\n  })) == 3
","b":true,"t":"memo","n":"reduce"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"key","n":"key"},{"t":"value","n":"value"}],"d":"

Assigns the value to the key in the map.

Map.empty()\n|> Map.set("key", "value")
","b":true,"t":"Map(key, value)","n":"set"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"}],"d":"

Returns the number of items in the map.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.size()) == 1
","b":false,"t":"Number","n":"size"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"},{"t":"Function(key, value, result)","n":"method"}],"d":"

Sorts the map using the function.

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.sortBy((key : String, value : Number) { value - 100 })\n|> Map.values()) == ["b", "a"]
","b":true,"t":"Map(key, value)","n":"sortBy"},{"k":4,"a":[{"t":"Map(key, value)","n":"map"}],"d":"

Returns the values of a map as an Array(value).

(Map.empty()\n|> Map.set("a", 1)\n|> Map.set("b", 2)\n|> Map.values()) == [1, 2]
","b":false,"t":"Array(value)","n":"values"}],"d":"

This module provides functions for the Map data structure (mapping keys to\nvalues).

Implementation wise we are using an array of tuples where the first item is\nthe key, where the second item is the value.

","n":"Map"},{"k":6,"e":[{"k":4,"a":[],"d":"

Returns an empty Html object. It is useful for example if you don't want to\nrender something conditionally. Same as an empty fragment <></>.

if (Array.isEmpty(items)) {\n  Html.empty()\n} else {\n  <div>\n    items\n  </div>\n}
","b":false,"t":"Html","n":"empty"},{"k":4,"a":[{"t":"Html","n":"html"}],"d":"

Returns whether or not the html is empty.

Html.isEmpty(<div></div>) == false\nHtml.isEmpty(<></>) == true
","b":false,"t":"Bool","n":"isEmpty"},{"k":4,"a":[{"t":"Html","n":"html"}],"d":"

Returns whether or not the html is not empty.

Html.isNotEmpty(<div></div>) == true\nHtml.isNotEmpty(<></>) == false
","b":false,"t":"Bool","n":"isNotEmpty"}],"d":"

This module provides functions for working with Html.

","n":"Html"},{"k":6,"e":[{"k":4,"a":[{"t":"IntersectionObserver","n":"observer"}],"d":"

Unobserves all observed elements.

IntersectionObserver.disconnect(observer)
","b":true,"t":"IntersectionObserver","n":"disconnect"},{"k":4,"a":[{"t":"String","n":"rootMargin"},{"t":"Number","n":"threshold"},{"t":"Function(Number, a)","n":"callback"}],"d":"

Creates a new intersection observer.

IntersectionObserver.new("50px", 0.1,\n  (intersectionRatio : Number) {\n    if (intersectionRatio == 1) {\n      Debug.log("Fully visible!")\n    } else {\n      Debug.log("Not fully visible!")\n    }\n  })
","b":true,"t":"IntersectionObserver","n":"new"},{"k":4,"a":[{"t":"IntersectionObserver","n":"observer"},{"t":"Dom.Element","n":"element"}],"d":"

Observes the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  IntersectionObserver.observe(observer, element)\n}
","b":true,"t":"IntersectionObserver","n":"observe"},{"k":4,"a":[{"t":"IntersectionObserver","n":"observer"},{"t":"Dom.Element","n":"element"}],"d":"

Unobserves the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  IntersectionObserver.unobserve(observer, element)\n}
","b":true,"t":"IntersectionObserver","n":"unobserve"}],"d":"

This module provides functions for working with the Intersection Observer Web\nAPI.

","n":"IntersectionObserver"},{"k":6,"e":[{"k":4,"a":[{"t":"Storage","n":"storage"}],"d":"

Clears the storage, removing all key-value pairs.

","b":false,"t":"Result(Storage.Error, Void)","n":"clear"},{"k":4,"a":[{"t":"Storage","n":"storage"},{"t":"String","n":"key"}],"d":"

Deletes the value with the key from the storage.

","b":true,"t":"Result(Storage.Error, Void)","n":"delete"},{"k":4,"a":[{"t":"Storage","n":"storage"},{"t":"String","n":"key"}],"d":"

Gets the value of the key in the storage.

","b":true,"t":"Result(Storage.Error, String)","n":"get"},{"k":4,"a":[{"t":"Storage","n":"storage"}],"d":"

Returns alll the keys in the storage.

","b":false,"t":"Result(Storage.Error, Array(String))","n":"keys"},{"k":4,"a":[{"t":"Storage","n":"storage"},{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Sets the key to the value in the storage.

","b":true,"t":"Result(Storage.Error, Void)","n":"set"},{"k":4,"a":[{"t":"Storage","n":"storage"}],"d":"

Returns the number of items in the storage.

","b":false,"t":"Result(Storage.Error, Number)","n":"size"}],"d":"

This module provides functions to work with the Storage Web API. This module\nshould not be used directly, it is used by Storage.Local and Storage.Session\nmodules.

","n":"Storage.Common"},{"k":6,"e":[{"k":4,"a":[],"d":"

Clears the session storage.

Storage.Session.clear()
","b":false,"t":"Result(Storage.Error, Void)","n":"clear"},{"k":4,"a":[{"t":"String","n":"key"}],"d":"

Deletes the value with the key from the session storage.

Storage.Session.delete("key")
","b":false,"t":"Result(Storage.Error, Void)","n":"delete"},{"k":4,"a":[{"t":"String","n":"key"}],"d":"

Gets the value of the key in the session storage.

Storage.Session.set("key", "value")\nStorage.Session.get("key") // "value"
","b":false,"t":"Result(Storage.Error, String)","n":"get"},{"k":4,"a":[],"d":"

Returns all the keys in the session storage.

Storage.Session.set("key", "value")\nStorage.Session.keys() == ["key"]
","b":false,"t":"Result(Storage.Error, Array(String))","n":"keys"},{"k":4,"a":[{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Sets the key to the value in the session storage.

Storage.Session.set("key", "value")
","b":false,"t":"Result(Storage.Error, Void)","n":"set"},{"k":4,"a":[],"d":"

Returns the number of items in the session storage.

Storage.Session.set("key", "value")\nStorage.Session.size() == 1
","b":false,"t":"Result(Storage.Error, Number)","n":"size"}],"d":"

This module provides functions to work with the SessionStorage Web API.

","n":"Storage.Session"},{"k":6,"e":[{"k":4,"a":[],"d":"

Clears the local storage.

Storage.Local.clear()
","b":false,"t":"Result(Storage.Error, Void)","n":"clear"},{"k":4,"a":[{"t":"String","n":"key"}],"d":"

Deletes the value with the key from the local storage.

Storage.Local.delete("key")
","b":false,"t":"Result(Storage.Error, Void)","n":"delete"},{"k":4,"a":[{"t":"String","n":"key"}],"d":"

Gets the value of the key in the local storage.

Storage.Local.set("key", "value")\nStorage.Local.get("key") // "value"
","b":false,"t":"Result(Storage.Error, String)","n":"get"},{"k":4,"a":[],"d":"

Returns all the keys in the local storage.

Storage.Local.set("key", "value")\nStorage.Local.keys() == ["key"]
","b":false,"t":"Result(Storage.Error, Array(String))","n":"keys"},{"k":4,"a":[{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Sets the key to the value in the local storage.

Storage.Local.set("key", "value")
","b":false,"t":"Result(Storage.Error, Void)","n":"set"},{"k":4,"a":[],"d":"

Returns the number of items in the local storage.

Storage.Local.set("key", "value")\nStorage.Local.size() == 1
","b":false,"t":"Result(Storage.Error, Number)","n":"size"}],"d":"

This module provides functions to work with the LocalStorage Web API.

","n":"Storage.Local"},{"k":6,"e":[{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Bool)","n":"function"}],"d":"

Returns true if any item in the array matches the predicate function,\nfalse otherwise.

Array.any([1, 2, 3, 4], (number : Number) { number % 2 == 0 }) == true\nArray.any([1, 3], (number : Number) { number % 2 == 0 }) == false
","b":false,"t":"Bool","n":"any"},{"k":4,"a":[{"t":"Array(item)","n":"array1"},{"t":"Array(item)","n":"array2"}],"d":"

Merges two arrays together into a new one.

Array.append([1, 1, 2], [3, 5, 8]) == [1, 1, 2, 3, 5, 8]
","b":false,"t":"Array(item)","n":"append"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"index"}],"d":"

Returns the element at the index as a Maybe(item).

Array.at([0], 0) == Maybe.Just(0)\nArray.at([0], 1) == Maybe.Nothing
","b":false,"t":"Maybe(item)","n":"at"},{"k":4,"a":[{"t":"Array(Maybe(item))","n":"array"}],"d":"

Flattens an Array(Maybe(item)) into an Array(item), by unwrapping the\nitems and skipping all elements of Maybe.Nothing.

Array.compact([Maybe.Just("A"), Maybe.Nothing]) == ["A"]
","b":false,"t":"Array(item)","n":"compact"},{"k":4,"a":[{"t":"Array(Array(item))","n":"arrays"}],"d":"

Concatenate multiple arrays into a single array.

Array.concat([[1, 2], [3], [4, 5]]) == [1, 2, 3, 4, 5]
","b":false,"t":"Array(item)","n":"concat"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"other"}],"d":"

Checks whether or not the element exists in the array.

Array.contains(["x", "y", "z"], "a") == false\nArray.contains(["a", "b", "c"], "a") == true
","b":false,"t":"Bool","n":"contains"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"what"}],"d":"

Deletes every occurrence of the element from the array.

Array.delete(["a", "b", "c", "a"], "a") == ["b", "c"]
","b":false,"t":"Array(item)","n":"delete"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"index"}],"d":"

Deletes the item of an array at the specified index.

Array.deleteAt(["a", "b", "c"], 1) == ["a", "c"]
","b":false,"t":"Array(item)","n":"deleteAt"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"number"}],"d":"

Drop the specified number of items from the end of the array.

Array.dropEnd([1, 2, 3, 4], 2) == [1, 2]
","b":false,"t":"Array(item)","n":"dropEnd"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"number"}],"d":"

Drop the specified number of items from the start of the array.

Array.dropStart([1, 2, 3, 4], 2) == [3, 4]
","b":false,"t":"Array(item)","n":"dropStart"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Bool)","n":"function"}],"d":"

Finds the first element in the array that matches the predicate function.

Array.find([1, 2, 3, 4], (number : Number) { number % 2 == 0 }) == Maybe.Just(2)
","b":true,"t":"Maybe(item)","n":"find"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Tuple(Bool, result))","n":"function"}],"d":"

Finds the first element in the array that matches the predicate functions\nfirst item and returns the second item in the resulting tuple.

Array.findByAndMap([1, 2, 3, 4],\n  (number : Number) { {number % 2 == 0, "Two"} }) == Maybe.Just("Two")
","b":true,"t":"Maybe(b)","n":"findByAndMap"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns the first element of the array as Maybe.Just(item) or\nMaybe.Nothing.

Array.first(["a", "x"]) == Maybe.Just("a")\nArray.first([]) == Maybe.Nothing
","b":false,"t":"Maybe(item)","n":"first"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"}],"d":"

Returns the first element of the array or the default value.

Array.firstWithDefault(["b", "x"], "a") == "b"\nArray.firstWithDefault([], "a") == "a"
","b":false,"t":"item","n":"firstWithDefault"},{"k":4,"a":[{"t":"Array(Array(item))","n":"array"},{"t":"Function(Array(item), Array(result))","n":"function"}],"d":"

Map over a nested array and then flattens the result.

Array.flatMap(\n  [[1, 2], [1, 5]],\n  (item : Array(Number)) { [Array.max(item) or 0] }) == [2,5]
","b":true,"t":"Array(result)","n":"flatMap"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"size"}],"d":"

Group an array into sub groups of specified length (all items are included so\nthe last group maybe shorter if after grouping there is a remainder)

Array.groupsOf([1, 2, 3, 4, 5, 6, 7], 2) == [\n  [1, 2], [3, 4], [5, 6], [7]]
","b":false,"t":"Array(Array(item))","n":"groupsOf"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"size"}],"d":"

Group an array into sub groups of specified length (all items are included so\nthe last group maybe shorter if after grouping there is a remainder) starting\nfrom the end of the array.

Array.groupsOfFromEnd([1,2,3,4,5,6,7], 2) == [[1],[2,3],[4,5],[6,7]]
","b":true,"t":"Array(Array(item))","n":"groupsOfFromEnd"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"result","n":"value"},{"t":"Function(item, result)","n":"method"}],"d":"

Returns the index of the item in the array which matches the generated value\nby the function.

Array.indexBy(["a","b","c"], "a", (item : String) : String { item }) == 0
","b":true,"t":"Number","n":"indexBy"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"search"}],"d":"

Returns the index of the item in the array.

Array.indexOf(["a","b","c"], "a") == 0
","b":false,"t":"Maybe(Number)","n":"indexOf"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"},{"t":"Number","n":"position"}],"d":"

Inserts the item into the specified position of the array, pushing items\ntoward the end of the array. If the length is negative the item will be\ninserted at the start of the array.

Array.insertAt(["b","c"], "a", 0) == ["a","b","c"]
","b":true,"t":"Array(item)","n":"insertAt"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"}],"d":"

Inserts the element between the elements of the array.

Array.intersperse(["x", "y", "z"], "a") == ["x", "a", "y", "a", "z"]
","b":false,"t":"Array(item)","n":"intersperse"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns whether or not the array is empty.

Array.isEmpty(["a", "b"]) == false\nArray.isEmpty([]) == true
","b":false,"t":"Bool","n":"isEmpty"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns whether or not the array is not empty.

Array.isNotEmpty(["a", "b"]) == true\nArray.isNotEmpty([]) == false
","b":false,"t":"Bool","n":"isNotEmpty"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns the last element of the array as Maybe.Just(a) or Maybe.Nothing.

Array.last(["x", "a"]) == Maybe.Just("a")\nArray.last([]) == Maybe.Nothing
","b":false,"t":"Maybe(item)","n":"last"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"}],"d":"

Returns the last element of the array or the default value.

Array.lastWithDefault(["x", "b"], "a") == "b"\nArray.lastWithDefault([], "a") == "a"
","b":false,"t":"item","n":"lastWithDefault"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, result)","n":"method"}],"d":"

Creates a new array with the results of calling a provided function on every\nelement in the array.

Array.map([1, 2, 3], (number : Number) : Number { number + 1 }) == [2, 3, 4]
","b":true,"t":"Array(result)","n":"map"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Number, result)","n":"method"}],"d":"

Creates a new array with the results of calling a provided function on every\nelement in the array while providing the index of the element.

Array.mapWithIndex(\n  [1, 2, 3],\n  (number : Number, index : Number) { number + index }) == [2, 4, 6]
","b":true,"t":"Array(result)","n":"mapWithIndex"},{"k":4,"a":[{"t":"Array(Number)","n":"array"}],"d":"

Returns the maximum value of an array of numbers. It's a Maybe because the\narray might not have items in it.

Array.max([0, 1, 2, 3, 4]) == Maybe.Just(4)\nArray.max([]) == Maybe.Nothing
","b":false,"t":"Maybe(Number)","n":"max"},{"k":4,"a":[{"t":"Array(Number)","n":"array"}],"d":"

Returns the minimum value of an array of numbers. It's a Maybe because the\narray might not have items in it.

Array.min([0, 1, 2, 3, 4]) == Maybe.Just(0)\nArray.min([]) == Maybe.Nothing
","b":false,"t":"Maybe(Number)","n":"min"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"from"},{"t":"Number","n":"to"}],"d":"

Moves an item at the index from to a new index to.

The array is returned as is if:

Array.move(["A", "B", "C"], -1, 1) == ["A", "B", "C"]\nArray.move(["A", "B", "C"], 10, 1) == ["A", "B", "C"]\nArray.move(["A", "B", "C"], 0, 0) == ["A", "B", "C"]

If a negative number is supplied to to then, the item is moved to the\nfirst position.

Array.move(["A", "B", "C"], 2, -1) == ["C", "A", "B"]

If a number is supplied to to which is grater the the length of the array,\nthen the item is moved to the last position.

Array.move(["A", "B", "C"], 0, 10) == ["B", "C", "A"]
","b":true,"t":"Array(item)","n":"move"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"}],"d":"

Pushes an element to the end of an array.

Array.push([1, 2, 3], 4) == [1, 2, 3, 4]\nArray.push([], "a") == ["a"]
","b":false,"t":"Array(item)","n":"push"},{"k":4,"a":[{"t":"Number","n":"from"},{"t":"Number","n":"to"}],"d":"

Creates an array of numbers starting from the first argument and\nending in the last.

Array.range(0, 5) == [0, 1, 2, 3, 4, 5]
","b":false,"t":"Array(Number)","n":"range"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"memo","n":"initial"},{"t":"Function(memo, item, memo)","n":"function"}],"d":"

Applies the function against an accumulator and each element in the array\n(from start to end) to reduce it to a single value.

Array.reduce(\n  [1, 2, 3],\n  0,\n  (memo : Number, item : Number) : Number { memo + item }) == 6
","b":true,"t":"memo","n":"reduce"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"memo","n":"initial"},{"t":"Function(memo, item, memo)","n":"function"}],"d":"

Applies the function against an accumulator and each element in the array\n(from end to start) to reduce it to a single value.

Array.reduceEnd(\n  [1,2,3,4,5],\n  0,\n  (acc : Number, n : Number) : Number { acc + n}) == 15
","b":true,"t":"memo","n":"reduceEnd"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Bool)","n":"function"}],"d":"

Returns all elements that do not match the predicate function.

Array.reject([1, 2, 3, 4], (number : Number) { number % 2 == 0 }) == [1, 3]
","b":true,"t":"Array(item)","n":"reject"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns a new array where the elements are reversed. The first array element\nbecomes the last, and the last array element becomes the first.

Array.reverse([1, 2, 3]) == [3, 2, 1]
","b":false,"t":"Array(item)","n":"reverse"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Bool","n":"condition"}],"d":"

Returns a new array where the elements are reversed if the condition is true.

Array.reverseIf([1, 2, 3], false) == [1, 2, 3]\nArray.reverseIf([1, 2, 3], true) == [3, 2, 1]
","b":false,"t":"Array(item)","n":"reverseIf"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns a random element from the array.

Array.sample(["a"]) == Maybe.Just("a")\nArray.sample() == Maybe.Nothing
","b":false,"t":"Maybe(item)","n":"sample"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Bool)","n":"function"}],"d":"

Returns all elements that match the predicate function.

Array.select([1, 2, 3, 4], (number : Number) { number % 2 == 0 }) == [2, 4]
","b":true,"t":"Array(item)","n":"select"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"index"},{"t":"item","n":"item"}],"d":"

Sets the item at index to the item of the array, if the specified index is\nnot found in the array it returns the array unchanged.

Array.setAt([1,2,3], 2, 5) == [1,2,5]
","b":true,"t":"Array(item)","n":"setAt"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Returns the size of the array.

Array.size([1, 2, 3]) == 3\nArray.size([]) == 0
","b":false,"t":"Number","n":"size"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"begin"},{"t":"Number","n":"end"}],"d":"

Returns a copy of a portion of an array (end not included).

Array.slice(\n  ["ant", "bison", "camel", "duck", "elephant"], 2, 4\n) == ["camel", "duck"]
","b":true,"t":"Array(item)","n":"slice"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, item, Number)","n":"function"}],"d":"

Returns a new sorted array using the sorting function function(a, b).\nItems are sorted using a number:

Array.sort([4, 1, 3, 2], (a : Number, b : Number) { a - b }) == [1, 2, 3, 4]
","b":true,"t":"Array(item)","n":"sort"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, result)","n":"function"}],"d":"

Returns a new sorted array using the functions return as the base of\nthe sorting.

Array.sortBy([4, 1, 3, 2], (number : Number) { number }) == [1, 2, 3, 4]
","b":true,"t":"Array(item)","n":"sortBy"},{"k":4,"a":[{"t":"Array(Number)","n":"array"}],"d":"

Sums up the array of numbers. Returns 0 if the array is empty.

Array.sum([1, 2, 3]) == 6\nArray.sum([]) == 0
","b":false,"t":"Number","n":"sum"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Function(item, Number)","n":"method"}],"d":"

Sums up the array using the specified function. Returns 0 if the array\nis empty.

Array.sumBy([1, 2, 3], (value : Number) { value }) == 6\nArray.sumBy([], (value : Number) { value }) == 6
","b":true,"t":"Number","n":"sumBy"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"index1"},{"t":"Number","n":"index2"}],"d":"

Swaps the items at the specified indexes of the array. It returns the array\nunchanged if there is no item at any of the specified indexes.

Array.swap(["a","b"], 0, 1) == ["b", "a"]
","b":true,"t":"Array(item)","n":"swap"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"number"}],"d":"

Takes the specified number of items from the end of the array.

Array.takeEnd([1, 2, 3, 4], 2) == [3, 4]
","b":false,"t":"Array(item)","n":"takeEnd"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"number"}],"d":"

Takes the specified number of items from the start of the array.

Array.takeStart([1, 2, 3, 4], 2) == [1, 2]
","b":false,"t":"Array(item)","n":"takeStart"},{"k":4,"a":[{"t":"Array(item)","n":"array"}],"d":"

Removes duplicate items from the array.

Array.uniq(["a", "a", "b", "b", "c"]) == ["a", "b", "c"]
","b":false,"t":"Array(item)","n":"uniq"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"item","n":"item"}],"d":"

Pushes a new item at the head of the array.

Array.unshift([3, 4], 2) == [2, 3, 4]
","b":false,"t":"Array(item)","n":"unshift"},{"k":4,"a":[{"t":"Array(item)","n":"array"},{"t":"Number","n":"index"},{"t":"Function(item, item)","n":"method"}],"d":"

Updates the item at the index of the array using the function.

Array.updateAt([0, 1, 2], 2, (number : Number) { number + 2}) == [0, 1, 4]
","b":true,"t":"Array(item)","n":"updateAt"}],"d":"

This module provides functions to manipulate immutable arrays.

","n":"Array"},{"k":6,"e":[{"k":4,"a":[{"t":"Function(Array(ResizeObserver.Entry), a)","n":"callback"}],"d":"

Creates a new resize observer.

let observer =\n  ResizeObserver.new((entries : ResizeObserver.Entry) {\n    for (entry of entries) {\n      Debug.log(entry)\n    }\n  })
","b":true,"t":"ResizeObserver","n":"new"},{"k":4,"a":[{"t":"ResizeObserver","n":"observer"},{"t":"Dom.Element","n":"element"}],"d":"

Observes the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  ResizeObserver.observe(observer, element, true, true)\n}
","b":true,"t":"ResizeObserver","n":"observe"},{"k":4,"a":[{"t":"ResizeObserver","n":"observer"},{"t":"Dom.Element","n":"element"}],"d":"

Unobserves the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  ResizeObserver.unobserve(observer, element)\n}
","b":true,"t":"ResizeObserver","n":"unobserve"}],"d":"

This module provides functions for working with the Resize Observer Web API.

","n":"ResizeObserver"},{"k":6,"e":[{"k":4,"a":[{"t":"Function(Array(MutationObserver.Entry), a)","n":"callback"}],"d":"

Creates a new resize observer.

MutationObserver.new((entries : MutationObserver.Entry) {\n  for (entry of entries) {\n    Debug.log(entry)\n  }\n})
","b":true,"t":"MutationObserver","n":"new"},{"k":4,"a":[{"t":"MutationObserver","n":"observer"},{"t":"Dom.Element","n":"element"},{"t":"Bool","n":"subtree"},{"t":"Bool","n":"childList"}],"d":"

Observes the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  MutationObserver.observe(observer, element, true, true)\n}
","b":true,"t":"MutationObserver","n":"observe"},{"k":4,"a":[{"t":"MutationObserver","n":"observer"},{"t":"Dom.Element","n":"element"}],"d":"

Unobserves the element.

if let Just(element) = Dom.getElementBySelector("div") {\n  MutationObserver.unobserve(observer, element)\n}
","b":true,"t":"MutationObserver","n":"unobserve"}],"d":"

This module provides functions for working with the Mutation Observer Web API\n.

","n":"MutationObserver"},{"k":6,"e":[{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Number","n":"to"}],"d":"

Sets the horizontal scroll position of the window during a test.

","b":true,"t":"Test.Context(a)","n":"setScrollLeft"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Number","n":"to"}],"d":"

Sets the vertical scroll position of the window during a test.

","b":true,"t":"Test.Context(a)","n":"setScrollTop"}],"d":"

This module provides functions for the window when writing tests.

","n":"Test.Window"},{"k":6,"e":[{"k":4,"a":[{"t":"Html","n":"node"}],"d":"

Starts a test of an Html node.

test {\n  Test.Html.start(<div>"Content"</div>)\n}
","b":false,"t":"Test.Context(Dom.Element)","n":"start"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Tries to find an element matching the selector. If found it replaces the\nvalue of the context with it, if not it fails the test.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.find("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"find"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Tries to find an element matching the selector (globally). If found it\nreplaces the value of the context with it, if not it fails the test.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.findGlobally("body")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"findGlobally"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"Number","n":"top"}],"d":"

Asserts the top position of the current element.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertTop(0)\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertTop"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"Number","n":"left"}],"d":"

Asserts the left position of the current element.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertLeft(0)\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertLeft"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"Number","n":"height"}],"d":"

Asserts the height of the current element.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertHeight(0)\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertHeight"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"Number","n":"width"}],"d":"

Asserts the width of the current element.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertWidth(0)\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertWidth"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Triggers a click event on the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerClick("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerClick"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Triggers a mouse down event on the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerMouseDown("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerMouseDown"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Triggers a mouse move event on the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerMouseMove("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerMouseMove"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Triggers a mouse up event on the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerMouseUp("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerMouseUp"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"},{"t":"String","n":"key"}],"d":"

Triggers a keydown event with the key on the element that the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerKeyDown("div", "A")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerKeyDown"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"},{"t":"String","n":"key"}],"d":"

Triggers a keyup event with the key on the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.triggerKeyUp("div", "A")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"triggerKeyUp"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"},{"t":"String","n":"value"}],"d":"

Asserts the text of the element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertTextOf("div", "Content")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertTextOf"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Asserts that the active element matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertActiveElement("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertActiveElement"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"}],"d":"

Asserts that there is an element that matches the selector.

test {\n  Test.Html.start(<div>"Content"</div>)\n  |> Test.Html.assertElementExists("div")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertElementExists"},{"k":4,"a":[{"t":"Test.Context(Dom.Element)","n":"context"},{"t":"String","n":"selector"},{"t":"String","n":"property"},{"t":"String","n":"value"}],"d":"

Asserts the value of a CSS property on the element that matches the selector.

test {\n  Test.Html.start(<div style="color:red;">"Content"</div>)\n  |> Test.Html.assertCssOf("div", "color", "red")\n}
","b":true,"t":"Test.Context(Dom.Element)","n":"assertCssOf"}],"d":"

This module provides functions for testing Html

","n":"Test.Html"},{"k":6,"e":[{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"a","n":"value"}],"d":"

Asserts the equality of the current value of the context with the specified\none.

test {\n  Test.Context.of(5)\n  |> Test.Context.assertEqual(5)\n}
","b":true,"t":"Test.Context(a)","n":"assertEqual"},{"k":4,"a":[{"t":"Test.Context(c)","n":"context"},{"t":"a","n":"function"}],"d":"

Asserts that a spy (function) was called.

test {\n  let spy =\n    Text.Context.spyOn(String.toUpperCase)\n\n  "hello world!"\n  |> Text.contextOf()\n  |> Text.Context.map(spy)\n  |> Test.Context.assertFunctionCalled(spy)\n}
","b":true,"t":"Test.Context(c)","n":"assertFunctionCalled"},{"k":4,"a":[{"t":"Test.Context(c)","n":"context"},{"t":"a","n":"function"}],"d":"

Asserts that a spy (function) was not called.

test {\n  let spy =\n    Text.Context.spyOn(String.toUpperCase)\n\n  "hello world!"\n  |> Text.contextOf()\n  |> Text.Context.map(String.toUpperCase)\n  |> Test.Context.assertFunctionNotCalled(spy)\n}
","b":true,"t":"Test.Context(c)","n":"assertFunctionNotCalled"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"b","n":"value"},{"t":"Function(a, b)","n":"method"}],"d":"

Asserts if the value equals of the returned value from the function.

test {\n  Test.Context.of(5)\n  |> Test.Context.assertOf("5", Number.toString)\n}
","b":true,"t":"Test.Context(a)","n":"assertOf"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Function(a, bool)","n":"method"}],"d":"

Asserts if the value equals of the returned value from the function.

test {\n  Test.Context.of(5)\n  |> Test.Context.assert((value : Number) { value == 5 })\n}
","b":true,"t":"Test.Context(a)","n":"assert"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Function(a, b)","n":"method"}],"d":"

Maps (transforms) the subject to a new subject.

test {\n  Test.Context.of(5)\n  |> Test.Context.map(Number.toString)\n}
","b":true,"t":"Test.Context(b)","n":"map"},{"k":4,"a":[{"t":"a","n":"a"}],"d":"

Starts a test using the value.

test {\n  Test.Context.of(5)\n  |> assertEqual(5)\n}
","b":false,"t":"Test.Context(a)","n":"of"},{"k":4,"a":[{"t":"a","n":"entity"}],"d":"

Spies on the entity if it's a function.

test {\n  let spy =\n    Text.Context.spyOn(String.toUpperCase)\n\n  "hello world!"\n  |> Text.contextOf()\n  |> Text.Context.map(spy)\n  |> Test.Context.assertFunctionCalled(spy)\n}
","b":false,"t":"a","n":"spyOn"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Function(a, Promise(b))","n":"proc"}],"d":"

Adds a transformation step to the test.

test {\n  Test.Context.of(5)\n  |> Test.Context.then((number : Number) { await (number + 2) })\n  |> Test.Context.assertEqual(7)\n}
","b":true,"t":"Test.Context(b)","n":"then"},{"k":4,"a":[{"t":"Test.Context(a)","n":"context"},{"t":"Number","n":"duration"}],"d":"

Adds a timeout to the test using the duration (in milliseconds).

test {\n  Test.Context.of(5)\n  |> Test.Context.timeout(1000)\n  |> Test.Context.assertEqual(5)\n}
","b":true,"t":"Test.Context(a)","n":"timeout"}],"d":"

This module provides functions for writing complex tests.

","n":"Test.Context"},{"k":6,"e":[{"k":4,"a":[],"d":"

Generates a unique identifier.

Uid.generate() // A unique ID
","b":false,"t":"String","n":"generate"}],"d":"

This module provides functions for generating unique identifiers.

","n":"Uid"},{"k":6,"e":[{"k":4,"a":[{"t":"Object.Error","n":"error"}],"d":"

Formats the error as string.

","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions for working with Object.Error type.

","n":"Object.Error"},{"k":6,"e":[{"k":4,"a":[{"t":"Object","n":"input"},{"t":"Function(Object, Result(Object.Error, a))","n":"decoder"}],"d":"

Decodes the object as an Array using the decoder.

Object.Decode.array(`["A"]`, Object.Decode.string) == Result.Ok(["a"])
","b":true,"t":"Result(Object.Error, Array(a))","n":"array"},{"k":4,"a":[{"t":"Object","n":"input"}],"d":"

Decodes the object as a Bool

Object.Decode.boolean(`true`) == Result.Ok(true)
","b":false,"t":"Result(Object.Error, Bool)","n":"boolean"},{"k":4,"a":[{"t":"Object","n":"input"},{"t":"String","n":"key"},{"t":"Function(Object, Result(Object.Error, a))","n":"decoder"}],"d":"

Decodes a field from an object using the decoder.

Object.Decode.field(\n  `{field: "Value"}`, "field", Object.Decode.string) == Result.Ok("Value")
","b":true,"t":"Result(Object.Error, a)","n":"field"},{"k":4,"a":[{"t":"Object","n":"input"},{"t":"Function(Object, Result(Object.Error, a))","n":"decoder"}],"d":"

Decodes the object as a Maybe(a) using the decoder.

Object.Decode.maybe(`"A"`, Object.Decode.String) == Result.Ok(Maybe.Just("A"))\nObject.Decode.maybe(`null`, Object.Decode.String) == Result.Ok(Maybe.Nothing)
","b":true,"t":"Result(Object.Error, Maybe(a))","n":"maybe"},{"k":4,"a":[{"t":"Object","n":"input"}],"d":"

Decodes the object as a Number

Object.Decode.number(`0`) == Result.Ok(0)
","b":false,"t":"Result(Object.Error, Number)","n":"number"},{"k":4,"a":[{"t":"Object","n":"input"}],"d":"

Decodes the object as a String

Object.Decode.string(`"A"`) == Result.Ok("A")
","b":false,"t":"Result(Object.Error, String)","n":"string"},{"k":4,"a":[{"t":"Object","n":"input"}],"d":"

Decodes the object as a Time

Object.Decode.time(`"new Date()"`)
","b":false,"t":"Result(Object.Error, Time)","n":"time"}],"d":"

This module provides functions for decoding specific types from an Object.

","n":"Object.Decode"},{"k":6,"e":[{"k":4,"a":[{"t":"Array(Object)","n":"input"}],"d":"

Encodes an Array of objects.

Object.Encode.array(["Hello", "World"])
","b":false,"t":"Object","n":"array"},{"k":4,"a":[{"t":"Bool","n":"input"}],"d":"

Encodes a Bool

Object.Encode.bool(true)
","b":false,"t":"Object","n":"boolean"},{"k":4,"a":[{"t":"String","n":"name"},{"t":"Object","n":"value"}],"d":"

Encodes a field of an object.

Object.Encode.field("key", Object.Encode.string("value"))
","b":false,"t":"Object.Field","n":"field"},{"k":4,"a":[{"t":"Number","n":"input"}],"d":"

Encodes a Number

Object.Encode.number(10)
","b":false,"t":"Object","n":"number"},{"k":4,"a":[{"t":"Array(Object.Field)","n":"fields"}],"d":"

Encodes an array of fields as an object.

Object.Encode.object([\n  Object.Encode.field("key", Object.Encode.string("value")),\n  Object.Encode.field("key2", Object.Encode.string("value2"))\n])
","b":false,"t":"Object","n":"object"},{"k":4,"a":[{"t":"String","n":"input"}],"d":"

Encodes a String.

Object.Encode.string("Hello")
","b":false,"t":"Object","n":"string"},{"k":4,"a":[{"t":"Time","n":"input"}],"d":"

Encodes a Time.

Object.Encode.time(Time.now())
","b":false,"t":"Object","n":"time"}],"d":"

This module provides functions for encoding values to an Object.

","n":"Object.Encode"},{"k":6,"e":[{"k":4,"a":[],"d":"

Returns an empty Dom.Dimensions record.

Dom.Dimensions.empty()
","b":false,"t":"Dom.Dimensions","n":"empty"}],"d":"

This module provides functions for working with dimensions in the DOM.

","n":"Dom.Dimensions"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Converts the given string to an ArrayBuffer.

("Hello"\n|> ArrayBuffer.toArrayBuffer()\n|> ArrayBuffer.toString()) == "Hello"
","b":false,"t":"ArrayBuffer","n":"toArrayBuffer"},{"k":4,"a":[{"t":"ArrayBuffer","n":"buffer"}],"d":"

Converts an ArrayBuffer to an UTF-8 string.

("Hello"\n|> ArrayBuffer.toArrayBuffer()\n|> ArrayBuffer.toString()) == "Hello"
","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions to work with the ArrayBuffer Web API. They are\nused to encode and decode binary data.

","n":"ArrayBuffer"},{"k":6,"e":[{"k":4,"a":[],"d":"

Returns a resolved promise with Void which never fails.

Promise.never()
","b":false,"t":"Promise(Void)","n":"never"},{"k":4,"a":[{"t":"a","n":"param1"}],"d":"

Returns a resolved promise with Void which never fails, with one\nargument which is ignored.

Promise.never1("Value")
","b":false,"t":"Promise(Void)","n":"never1"},{"k":4,"a":[{"t":"a","n":"param1"},{"t":"b","n":"param2"}],"d":"

Returns a resolved promise with Void which never fails, with two\narguments which are ignored.

Promise.never1("Value1", "Value2")
","b":false,"t":"Promise(Void)","n":"never2"},{"k":4,"a":[{"t":"a","n":"param1"},{"t":"b","n":"param2"},{"t":"c","n":"param3"}],"d":"

Returns a resolved promise with Void which never fails, with three\narguments which are ignored.

Promise.never1("Value1", "Value2", "Value3")
","b":false,"t":"Promise(Void)","n":"never3"},{"k":4,"a":[{"t":"a","n":"input"}],"d":"

Creates an already resolved Promise

","b":false,"t":"Promise(a)","n":"resolve"},{"k":4,"a":[],"d":"

Create a promise with manual resolve.

let {resolve, promise} =\n  Promise.create()
","b":false,"t":"Tuple(Function(value, Void), Promise(value))","n":"create"}],"d":"

This module provides functions for working with promises.

","n":"Promise"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Capitalizes each letter in the string.

String.capitalize("The quick brown fox jumps.") == "The Quick Brown Fox Jumps."
","b":false,"t":"String","n":"capitalize"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"index"}],"d":"

Returns a string representing the character (exactly one UTF-16 code unit) at\nthe specified index. If index is out of range, it returns an empty string.

String.charAt("The quick brown fox jumps.", 4) == "q"
","b":false,"t":"String","n":"charAt"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"index"}],"d":"

Returns an integer between 0 and 65535 representing the UTF-16 code unit at\nthe index.

String.charCodeAt("The quick brown fox jumps.", 4) == Maybe.Just(113)
","b":false,"t":"Maybe(Number)","n":"charCodeAt"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"char"}],"d":"

Removes all occurrences of the character from the end of the string.

String.chopEnd("The quick brown fox jumps.", ".") == "The quick brown fox jumps"
","b":false,"t":"String","n":"chopEnd"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"char"}],"d":"

Removes all occurrences of the character from the start of the string.

String.chopStart("The quick brown fox jumps.", "T") == "he quick brown fox jumps."
","b":false,"t":"String","n":"chopStart"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"index"}],"d":"

Returns a non-negative integer that is the UTF-16 code point value.

String.codePointAt("☃★♲", 1) == Maybe.Just(9733)
","b":false,"t":"Maybe(Number)","n":"codePointAt"},{"k":4,"a":[{"t":"Array(String)","n":"array"}],"d":"

Joins the array of strings.

String.concat(["The", "quick", "brown", "fox", "jumps."]) == "Thequickbrownfoxjumps."
","b":false,"t":"String","n":"concat"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"search"}],"d":"

Performs a case-sensitive search to determine whether one string may be found\nwithin another string, returning true or false as appropriate.

String.contains("The quick brown fox jumps over the lazy dog.", "fox") == true
","b":false,"t":"Bool","n":"contains"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"number"}],"d":"

Drops the number of characters from the end of the string.

String.dropEnd("The quick brown fox jumps.", 1) == "The quick brown fox jumps"\nString.dropEnd("The quick brown fox jumps.", 2) == "The quick brown fox jump"
","b":false,"t":"String","n":"dropEnd"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"number"}],"d":"

Drops the number of characters from the start of the string.

String.dropStart("The quick brown fox jumps.", 1) == "he quick brown fox jumps."\nString.dropStart("The quick brown fox jumps.", 2) == "e quick brown fox jumps."
","b":false,"t":"String","n":"dropStart"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"pattern"}],"d":"

Determines whether a string ends with the pattern, returning true or\nfalse as appropriate.

String.endsWith("The quick brown fox jumps.", "jumps.") == true
","b":false,"t":"Bool","n":"endsWith"},{"k":4,"a":[{"t":"Number","n":"charCode"}],"d":"

Returns a string created from the specified UTF-16 code unit.

String.fromCharCode(65) == "A"
","b":false,"t":"String","n":"fromCharCode"},{"k":4,"a":[{"t":"Number","n":"charCode"}],"d":"

Returns a string created by using the specified code point.

String.fromCodePoint(9731) == "☃"
","b":false,"t":"String","n":"fromCodePoint"},{"k":4,"a":[{"t":"String","n":"string"},{"v":"2","t":"Number","n":"by"},{"v":"" "","t":"String","n":"character"},{"v":"true","t":"Bool","n":"includeEmptyLines"}],"d":"

Indents the string with the number of spaces.

String.indent("The quick brown fox jumps.", 2) == "  The quick brown fox jumps."\nString.indent("The quick brown fox jumps.", 2, "-", false) == "--The quick brown fox jumps."
","b":true,"t":"String","n":"indent"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"search"}],"d":"

Returns the index within the string of the first occurrence of the value,\nreturns Maybe.Nothing if the value is not found.

String.indexOf("The quick brown fox jumps over the lazy dog.", "whale") == Maybe.Nothing\nString.indexOf("The quick brown fox jumps over the lazy dog.", "fox") == Maybe.Just(16)
","b":false,"t":"Maybe(Number)","n":"indexOf"},{"k":4,"a":[{"t":"String","n":"string1"},{"t":"String","n":"string2"}],"d":"

Returns if the string is an anagram of the other string.

String.isAnagram("The", "quick") == false\nString.isAnagram("rail safety", "fairy tales") == true
","b":false,"t":"Bool","n":"isAnagram"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns whether or not the string is blank (only contains whitespace).

String.isBlank("") == true\n String.isBlank(" ") == true\n String.isBlank("The quick brown fox jumps.") == false
","b":false,"t":"Bool","n":"isBlank"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns whether or not the string is empty ("").

String.isEmpty("") == true\n String.isEmpty(" ") == false\n String.isEmpty("The quick brown fox jumps.") == false
","b":false,"t":"Bool","n":"isEmpty"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns whether or not the string is not blank.

String.isNotBlank("   ") == false\nString.isNotBlank("The quick brown fox jumps.") == true
","b":false,"t":"Bool","n":"isNotBlank"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns whether or not the string is not empty.

String.isNotEmpty("   ") == true\nString.isNotEmpty("The quick brown fox jumps.") == true
","b":false,"t":"Bool","n":"isNotEmpty"},{"k":4,"a":[{"t":"Array(String)","n":"array"},{"t":"String","n":"separator"}],"d":"

Joins the array of strings into a single string using the separator.

String.join(["The","quick","brown", "fox", "jumps."], " ") == "The quick brown fox jumps."
","b":false,"t":"String","n":"join"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"search"}],"d":"

Returns the index within the string of the last occurrence of the specified\nvalue, returns Maybe.Nothing if the value is not found.

String.lastIndexOf("The quick brown fox jumps over the lazy dog.", "whale") == Maybe.Nothing\nString.lastIndexOf("The quick brown fox jumps over the lazy dog.", "the") == Maybe.Just(31)
","b":false,"t":"Maybe(Number)","n":"lastIndexOf"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns the Unicode Normalization Form of the string.

String.normalize("\\u0041\\u006d\\u0065\\u0301\\u006c\\u0069\\u0065") == "\\u0041\\u006d\\u00e9\\u006c\\u0069\\u0065"
","b":false,"t":"String","n":"normalize"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"padString"},{"t":"Number","n":"targetLength"}],"d":"

Pads the string with another string (multiple times, if needed) until the\nresulting string reaches the given length. The padding is applied from the\nend of the string.

String.padEnd("5", "0", 2) == "50"
","b":true,"t":"String","n":"padEnd"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"padString"},{"t":"Number","n":"targetLength"}],"d":"

Pads the string with another string (multiple times, if needed) until the\nresulting string reaches the given length. The padding is applied from the\nstart of the string.

String.padStart("5", "0", 2) == "05"
","b":true,"t":"String","n":"padStart"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Parameterizes the string:

String.parameterize("The quick brown fox jumps.") == "the-quick-brown-fox-jumps"
","b":false,"t":"String","n":"parameterize"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"times"}],"d":"

Repeats the string by the specified number of times.

String.repeat(3, "The") == "TheTheThe"
","b":false,"t":"String","n":"repeat"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"pattern"},{"t":"String","n":"replacement"}],"d":"

Returns a new string with the first match of a pattern replaced by the\nreplacement.

String.replace("The quick brown fox jumps.", "fox", "bear") ==\n  "The quick brown bear jumps."
","b":true,"t":"String","n":"replace"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"pattern"},{"t":"String","n":"replacement"}],"d":"

Returns a new string with all matches of a pattern replaced by the replacement.

String.replaceAll("The quick brown fox jumps over the lazy fox.", "fox", "bear") ==\n  "The quick brown bear jumps over the lazy bear."
","b":true,"t":"String","n":"replaceAll"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Reverses the string.

String.reverse("The quick brown fox jumps.") == ".spmuj xof nworb kciuq ehT"
","b":false,"t":"String","n":"reverse"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Returns number of characters in the string.

String.size("The quick brown fox jumps.") == 26
","b":false,"t":"Number","n":"size"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"separator"}],"d":"

Splits the string using the separator.

String.split("The quick brown fox jumps.", " ") ==\n  ["The", "quick", "brown", "fox", "jumps."]
","b":false,"t":"Array(String)","n":"split"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"pattern"}],"d":"

Determines whether a string starts with the pattern, returning true or\nfalse as appropriate.

String.startsWith("The quick brown fox jumps.", "The") == true
","b":false,"t":"Bool","n":"startsWith"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"length"}],"d":"

Returns the given number of characters from the end of the string.

String.takeEnd("The quick brown fox jumps.", 2) == "s."
","b":false,"t":"String","n":"takeEnd"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"Number","n":"length"}],"d":"

Returns the given number of characters from the start of the string.

String.takeStart("The quick brown fox jumps.", 2) == "Th"
","b":false,"t":"String","n":"takeStart"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Convert the string into an array of strings.

String.toArray("Hello") == ["H", "e", "l", "l", "o"]
","b":false,"t":"Array(String)","n":"toArray"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Converts the string to lowercase.

String.toLowerCase("HELLO") == "hello"
","b":false,"t":"String","n":"toLowerCase"},{"k":4,"a":[{"t":"String","n":"string"}],"d":"

Converts the string to uppercase.

String.toUpperCase("hello") == "HELLO"
","b":false,"t":"String","n":"toUpperCase"},{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Removes whitespace from the beginning and end of the string.

String.trim("  The quick brown fox jumps.  ") == "The quick brown fox jumps."
","b":false,"t":"String","n":"trim"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"value"}],"d":"

Returns the string or the default value if the string is empty.

String.withDefault("", "The quick brown fox jumps.") == "The quick brown fox jumps."\nString.withDefault("Hello", "The quick brown fox jumps.") == "Hello"
","b":false,"t":"String","n":"withDefault"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"start"},{"t":"String","n":"end"}],"d":"

Wraps the string with the start and end characters.

String.wrap("The quick brown fox jumps.", "{", "}") == "{The quick brown fox jumps.}"
","b":false,"t":"String","n":"wrap"}],"d":"

This module provides functions for working with the String type.

","n":"String"},{"k":6,"e":[{"k":4,"a":[{"t":"File","n":"file"}],"d":"

Creates an URL from the file, which is available until the current window is\nclosed.

let file =\n  File.fromString("Content", "test.html", "text/html")\n\nUrl.createObjectUrlFromFile(file)
","b":false,"t":"String","n":"createObjectUrlFromFile"},{"k":4,"a":[{"t":"String","n":"string"},{"t":"String","n":"type"}],"d":"

Creates an URL from the content and type, which is available until the\ncurrent window is closed.

Url.createObjectUrlFromString("Content", "text/html")
","b":true,"t":"String","n":"createObjectUrlFromString"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Parses the string as an Url.

Url.parse("https://www.example.com").host == "www.example.com"
","b":false,"t":"Url","n":"parse"},{"k":4,"a":[{"t":"Url","n":"url"}],"d":"

Converts the url to a String.

let url =\n  Url.parse("https://www.example.com/path/?search=foo#hash")\n\nUrl.toString(url) == "https://www.example.com/path/?search=foo#hash"
","b":false,"t":"String","n":"toString"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Releases an existing object URL which was previously created.

let url =\n  Url.createObjectUrlFromString("Content", "text/html")\n\nUrl.revokeObjectUrl(url)
","b":false,"t":"Void","n":"revokeObjectUrl"}],"d":"

This module provides functions functions for working with the Url type.

","n":"Url"},{"k":6,"e":[{"k":4,"a":[{"t":"Number","n":"number"},{"t":"String","n":"prefix"}],"d":"

Formats the number using the prefix and separating the digits by 3 with a\ncomma.

Number.format(1034150, "$ ") == "$ 1,034,150"
","b":false,"t":"String","n":"format"},{"k":4,"a":[{"t":"String","n":"input"}],"d":"

Tries to parse the string input into a number.

Number.fromString("012") == Maybe.Just(12)\nNumber.fromString("asd") == Maybe.Nothing
","b":false,"t":"Maybe(Number)","n":"fromString"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns true if number is even.

Number.isEven(2) == false\nNumber.isEven(1) == true
","b":false,"t":"Bool","n":"isEven"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns true if number is NaN.

Number.isNaN(`NaN`) == true\nNumber.isNaN(0) == false
","b":false,"t":"Bool","n":"isNaN"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns true if number is odd.

Number.isOdd(1) == false\nNumber.isOdd(2) == true
","b":false,"t":"Bool","n":"isOdd"},{"k":4,"a":[{"t":"Number","n":"number"},{"t":"Number","n":"decimalPlaces"}],"d":"

Formats a number using fixed-point notation.

The last arguments specifies the number of digits to appear after the\ndecimal point, it can be between 0 and 20.

Number.toFixed(0.1234567, 2) == "0.12"
","b":false,"t":"String","n":"toFixed"},{"k":4,"a":[{"t":"Number","n":"number"}],"d":"

Returns the string representation of the number.

Number.toString(123) == 123
","b":false,"t":"String","n":"toString"}],"d":"

This module provides functions for working with the Number type.

","n":"Number"},{"k":6,"e":[{"k":4,"a":[{"t":"String","n":"input"}],"d":"

Parses a string into an Object, returns Result.Err if the parsing\nfailed.

Result.isOk(Json.parse("{}"))\nResult.isError(Json.parse("{"))
","b":false,"t":"Result(String, Object)","n":"parse"},{"k":4,"a":[{"t":"Object","n":"value"},{"t":"Number","n":"spaces"}],"d":"

Generates a JSON string from an Object, in a human readable format (with\nline breaks and indentation).

Json.prettyStringify(encode { a: "Hello" }, 2) == <<~JSON  {    "a": "Hello"  }"JSON
","b":false,"n":"prettyStringify"},{"k":4,"a":[{"t":"Object","n":"input"}],"d":"

Generates a JSON string from an Object.

Json.stringify(encode { a: "Hello" }) == "{ \\"a\\": \\"Hello\\" }"
","b":false,"t":"String","n":"stringify"}],"d":"

This module provides functions for parsing and generating JSON documents.

","n":"Json"},{"k":6,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Returns whether or not the events propagation is stopped or not.

Html.Event.isPropagationStopped(event)
","b":false,"t":"Bool","n":"isPropagationStopped"},{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Prevents the default action of the event from happening.

Html.Event.preventDefault(event)
","b":false,"t":"Void","n":"preventDefault"},{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Stops the propagation of the given event.

Html.Event.stopPropagation(event)
","b":false,"t":"Void","n":"stopPropagation"},{"k":5,"d":"

Constant for the Right Window Key key.

","v":"92","b":false,"n":"RIGHT_WINDOW_KEY"},{"k":5,"d":"

Constant for the Left Window key.

","v":"91","b":false,"n":"LEFT_WINDOW_KEY"},{"k":5,"d":"

Constant for the Closing Bracket key.

","v":"221","b":false,"n":"CLOSE_BRACKET"},{"k":5,"d":"

Constant for the Decimal Point key.

","v":"110","b":false,"n":"DECIMAL_POINT"},{"k":5,"d":"

Constant for the Forward Slash key.

","v":"191","b":false,"n":"FORWARD_SLASH"},{"k":5,"d":"

Constant for the Open Bracket key.

","v":"219","b":false,"n":"OPEN_BRACKET"},{"k":5,"d":"

Constant for the Single Quote key.

","v":"222","b":false,"n":"SINGLE_QUOTE"},{"k":5,"d":"

Constant for the Grave Accent key.

","v":"192","b":false,"n":"GRAVE_ACCENT"},{"k":5,"d":"

Constant for the Scroll Lock key.

","v":"145","b":false,"n":"SCROLL_LOCK"},{"k":5,"d":"

Constant for the Pause Break key.

","v":"19","b":false,"n":"PAUSE_BREAK"},{"k":5,"d":"

Constant for the Right Arrow key.

","v":"39","b":false,"n":"RIGHT_ARROW"},{"k":5,"d":"

Constant for the Back Slash key.

","v":"220","b":false,"n":"BACK_SLASH"},{"k":5,"d":"

Constant for the Equal Sign key.

","v":"187","b":false,"n":"EQUAL_SIGN"},{"k":5,"d":"

Constant for the Semi Colon key.

","v":"186","b":false,"n":"SEMI_COLON"},{"k":5,"d":"

Constant for the Down Arrow key.

","v":"40","b":false,"n":"DOWN_ARROW"},{"k":5,"d":"

Constant for the Select Key key.

","v":"93","b":false,"n":"SELECT_KEY"},{"k":5,"d":"

Constant for the Left Arrow key.

","v":"37","b":false,"n":"LEFT_ARROW"},{"k":5,"d":"

Constant for the Page Down key.

","v":"34","b":false,"n":"PAGE_DOWN"},{"k":5,"d":"

Constant for the Num Lock key.

","v":"144","b":false,"n":"NUM_LOCK"},{"k":5,"d":"

Constant for the Subtract key.

","v":"109","b":false,"n":"SUBTRACT"},{"k":5,"d":"

Constant for the Caps Lock key.

","v":"20","b":false,"n":"CAPS_LOCK"},{"k":5,"d":"

Constant for the Multiply key.

","v":"106","b":false,"n":"MULTIPLY"},{"k":5,"d":"

Constant for the Backspace key.

","v":"8","b":false,"n":"BACKSPACE"},{"k":5,"d":"

Constant for the Up Arrow key.

","v":"38","b":false,"n":"UP_ARROW"},{"k":5,"d":"

Constant for the Page Up key.

","v":"33","b":false,"n":"PAGE_UP"},{"k":5,"d":"

Constant for the Numpad Divide key.

","v":"111","b":false,"n":"DIVIDE"},{"k":5,"d":"

Constant for the Period key.

","v":"190","b":false,"n":"PERIOD"},{"k":5,"d":"

Constant for the comma , key.

","v":"188","b":false,"n":"COMMA"},{"k":5,"d":"

Constant for the Insert key.

","v":"45","b":false,"n":"INSERT"},{"k":5,"d":"

Constant for the Delete key.

","v":"46","b":false,"n":"DELETE"},{"k":5,"d":"

Constant for the Escape key.

","v":"27","b":false,"n":"ESCAPE"},{"k":5,"d":"

Constant for the Shift key.

","v":"16","b":false,"n":"SHIFT"},{"k":5,"d":"

Constant for the Space key.

","v":"32","b":false,"n":"SPACE"},{"k":5,"d":"

Constant for the Enter key.

","v":"13","b":false,"n":"ENTER"},{"k":5,"d":"

Constant for the dash Dash key.

","v":"189","b":false,"n":"DASH"},{"k":5,"d":"

Constant for the Home key.

","v":"36","b":false,"n":"HOME"},{"k":5,"d":"

Constant for the Control key.

","v":"17","b":false,"n":"CTRL"},{"k":5,"d":"

Constant for the Add key.

","v":"107","b":false,"n":"ADD"},{"k":5,"d":"

Constant for the Alt key.

","v":"18","b":false,"n":"ALT"},{"k":5,"d":"

Constant for the End key.

","v":"35","b":false,"n":"END"},{"k":5,"d":"

Constant for the Tab key.

","v":"9","b":false,"n":"TAB"},{"k":5,"d":"

Constant for the 0 key (numpad).

","v":"96","b":false,"n":"NUMPAD_0"},{"k":5,"d":"

Constant for the 1 key (numpad).

","v":"97","b":false,"n":"NUMPAD_1"},{"k":5,"d":"

Constant for the 2 key (numpad).

","v":"98","b":false,"n":"NUMPAD_2"},{"k":5,"d":"

Constant for the 3 key (numpad).

","v":"99","b":false,"n":"NUMPAD_3"},{"k":5,"d":"

Constant for the 4 key (numpad).

","v":"100","b":false,"n":"NUMPAD_4"},{"k":5,"d":"

Constant for the 5 key (numpad).

","v":"101","b":false,"n":"NUMPAD_5"},{"k":5,"d":"

Constant for the 6 key (numpad).

","v":"102","b":false,"n":"NUMPAD_6"},{"k":5,"d":"

Constant for the 7 key (numpad).

","v":"103","b":false,"n":"NUMPAD_7"},{"k":5,"d":"

Constant for the 8 key (numpad).

","v":"104","b":false,"n":"NUMPAD_8"},{"k":5,"d":"

Constant for the 9 key (numpad).

","v":"105","b":false,"n":"NUMPAD_9"},{"k":5,"d":"

Constant for the 0 key.

","v":"48","b":false,"n":"NUMBER_0"},{"k":5,"d":"

Constant for the 1 key.

","v":"49","b":false,"n":"NUMBER_1"},{"k":5,"d":"

Constant for the 2 key.

","v":"50","b":false,"n":"NUMBER_2"},{"k":5,"d":"

Constant for the 3 key.

","v":"51","b":false,"n":"NUMBER_3"},{"k":5,"d":"

Constant for the 4 key.

","v":"52","b":false,"n":"NUMBER_4"},{"k":5,"d":"

Constant for the 5 key.

","v":"53","b":false,"n":"NUMBER_5"},{"k":5,"d":"

Constant for the 6 key.

","v":"54","b":false,"n":"NUMBER_6"},{"k":5,"d":"

Constant for the 7 key.

","v":"55","b":false,"n":"NUMBER_7"},{"k":5,"d":"

Constant for the 8 key.

","v":"56","b":false,"n":"NUMBER_8"},{"k":5,"d":"

Constant for the 9 key.

","v":"57","b":false,"n":"NUMBER_9"},{"k":5,"d":"

Constant for the F10 key.

","v":"121","b":false,"n":"F10"},{"k":5,"d":"

Constant for the F11 key.

","v":"122","b":false,"n":"F11"},{"k":5,"d":"

Constant for the F12 key.

","v":"123","b":false,"n":"F12"},{"k":5,"d":"

Constant for the F1 key.

","v":"112","b":false,"n":"F1"},{"k":5,"d":"

Constant for the F2 key.

","v":"113","b":false,"n":"F2"},{"k":5,"d":"

Constant for the F3 key.

","v":"114","b":false,"n":"F3"},{"k":5,"d":"

Constant for the F4 key.

","v":"115","b":false,"n":"F4"},{"k":5,"d":"

Constant for the F5 key.

","v":"116","b":false,"n":"F5"},{"k":5,"d":"

Constant for the F6 key.

","v":"117","b":false,"n":"F6"},{"k":5,"d":"

Constant for the F7 key.

","v":"118","b":false,"n":"F7"},{"k":5,"d":"

Constant for the F8 key.

","v":"119","b":false,"n":"F8"},{"k":5,"d":"

Constant for the F9 key.

","v":"120","b":false,"n":"F9"},{"k":5,"d":"

Constant for the A key.

","v":"65","b":false,"n":"A"},{"k":5,"d":"

Constant for the B key.

","v":"66","b":false,"n":"B"},{"k":5,"d":"

Constant for the C key.

","v":"67","b":false,"n":"C"},{"k":5,"d":"

Constant for the D key.

","v":"68","b":false,"n":"D"},{"k":5,"d":"

Constant for the E key.

","v":"69","b":false,"n":"E"},{"k":5,"d":"

Constant for the F key.

","v":"70","b":false,"n":"F"},{"k":5,"d":"

Constant for the G key.

","v":"71","b":false,"n":"G"},{"k":5,"d":"

Constant for the H key.

","v":"72","b":false,"n":"H"},{"k":5,"d":"

Constant for the I key.

","v":"73","b":false,"n":"I"},{"k":5,"d":"

Constant for the J key.

","v":"74","b":false,"n":"J"},{"k":5,"d":"

Constant for the K key.

","v":"75","b":false,"n":"K"},{"k":5,"d":"

Constant for the L key.

","v":"76","b":false,"n":"L"},{"k":5,"d":"

Constant for the M key.

","v":"77","b":false,"n":"M"},{"k":5,"d":"

Constant for the N key.

","v":"78","b":false,"n":"N"},{"k":5,"d":"

Constant for the O key.

","v":"79","b":false,"n":"O"},{"k":5,"d":"

Constant for the P key.

","v":"80","b":false,"n":"P"},{"k":5,"d":"

Constant for the Q key.

","v":"81","b":false,"n":"Q"},{"k":5,"d":"

Constant for the R key.

","v":"82","b":false,"n":"R"},{"k":5,"d":"

Constant for the S key.

","v":"83","b":false,"n":"S"},{"k":5,"d":"

Constant for the T key.

","v":"84","b":false,"n":"T"},{"k":5,"d":"

Constant for the U key.

","v":"85","b":false,"n":"U"},{"k":5,"d":"

Constant for the V key.

","v":"86","b":false,"n":"V"},{"k":5,"d":"

Constant for the W key.

","v":"87","b":false,"n":"W"},{"k":5,"d":"

Constant for the X key.

","v":"88","b":false,"n":"X"},{"k":5,"d":"

Constant for the Y key.

","v":"89","b":false,"n":"Y"},{"k":5,"d":"

Constant for the Z key.

","v":"90","b":false,"n":"Z"}],"d":"

This module provides functions for working with Html.Event objects.

","n":"Html.Event"},{"k":6,"e":[{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"}],"d":"

Removes the attached data.

Html.DataTransfer.clearData(data)
","b":false,"t":"Html.DataTransfer","n":"clearData"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"},{"t":"String","n":"format"}],"d":"

Returns string data for the format or an empty string if there is no data.

let string =\n  Html.DataTransfer.getData(event.dataTransfer, "text/plain")
","b":false,"t":"String","n":"getData"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"}],"d":"

Returns the type of drag-and-drop operation which is currently selected.

let dropEffect =\n  Html.DataTransfer.getDropEffect(event.dataTransfer)
","b":false,"t":"String","n":"getDropEffect"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"}],"d":"

Returns the type of operation that is possible.

let effectAllowed =\n  Html.DataTransfer.getEffectAllowed(event.dataTransfer)
","b":false,"t":"String","n":"getEffectAllowed"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"}],"d":"

Returns the files which is contained in the data transfer.

let files =\n  Html.DataTransfer.getFiles(event.dataTransfer)
","b":false,"t":"Array(File)","n":"getFiles"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"}],"d":"

Returns the types of the data which is available.

let types =\n  Html.DataTransfer.getTypes(event.dataTransfer)
","b":false,"t":"Array(String)","n":"getTypes"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"},{"t":"String","n":"format"},{"t":"String","n":"value"}],"d":"

Sets the value for the format in the data transfer.

Html.DataTransfer.setData(event.dataTransfer, "text/plain", "Hello!")
","b":true,"t":"Html.DataTransfer","n":"setData"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"},{"t":"Dom.Element","n":"element"},{"t":"Number","n":"offsetX"},{"t":"Number","n":"offsetY"}],"d":"

Sets the element as the drag image of the data transfer.

if let Just(element) = Dom.getElementBySelector("div") {\n  Html.DataTransfer.setDragImage(event.dataTransfer, element, 0, 0)\n}
","b":true,"t":"Html.DataTransfer","n":"setDragImage"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"},{"t":"String","n":"value"}],"d":"

Sets the operation to a new type. The value must be "none", "copy",\n"link" or "move".

Html.DataTransfer.setDropEffect(event.dataTransfer, "copy")
","b":true,"t":"Html.DataTransfer","n":"setDropEffect"},{"k":4,"a":[{"t":"Html.DataTransfer","n":"data"},{"t":"String","n":"value"}],"d":"

Sets of the type of operation that are possible.

Html.DataTransfer.setEffectAllowed(event.dataTransfer, "copy")
","b":true,"t":"Html.DataTransfer","n":"setEffectAllowed"}],"d":"

This module provides functions for working with the DataTransfer Web API.\nThis is used for drag and drop functionality. Html.Event contains the fields\ndataTransfer and clipboardData which are Html.DataTransfer objects.

","n":"Html.DataTransfer"},{"k":6,"e":[{"k":5,"d":"

The English language record for time formatting.

","v":"{\n toMonthAbbreviation:\n (month : Month) {\n case month {\n January => "Jan"\n February => "Feb"\n March => "Mar"\n April => "Apr"\n May => "May"\n June => "Jun"\n July => "Jul"\n August => "Aug"\n September => "Sep"\n October => "Oct"\n November => "Nov"\n December => "Dec"\n }\n },\n toMonthName:\n (month : Month) {\n case month {\n January => "January"\n February => "February"\n March => "March"\n April => "April"\n May => "May"\n June => "June"\n July => "July"\n August => "August"\n September => "September"\n October => "October"\n November => "November"\n December => "December"\n }\n },\n toWeekdayName:\n (weekday : Weekday) {\n case weekday {\n Monday => "Monday"\n Tuesday => "Tuesday"\n Wednesday => "Wednesday"\n Thursday => "Thursday"\n Friday => "Friday"\n Saturday => "Saturday"\n Sunday => "Sunday"\n }\n },\n toWeekdayAbbreviation:\n (weekday : Weekday) {\n case weekday {\n Monday => "Mon"\n Tuesday => "Tue"\n Wednesday => "Wed"\n Thursday => "Thu"\n Friday => "Fri"\n Saturday => "Sat"\n Sunday => "Sun"\n }\n },\n toOrdinalSuffix:\n (day : Number) {\n case day % 100 {\n 11 => "th"\n 12 => "th"\n 13 => "th"\n\n =>\n case day % 10 {\n 1 => "st"\n 2 => "nd"\n 3 => "rd"\n => "th"\n }\n }\n },\n amPm:\n (hour : Number) {\n if hour >= 12 {\n "pm"\n } else {\n "am"\n }\n },\n someSecondsAgo:\n (seconds : Number) {\n if seconds < 30 {\n "just now"\n } else {\n "#{seconds} seconds ago"\n }\n },\n someMinutesAgo:\n (minutes : Number) {\n if minutes < 2 {\n "a minute ago"\n } else {\n "#{minutes} minutes ago"\n }\n },\n someHoursAgo:\n (hours : Number) {\n if hours < 2 {\n "an hour ago"\n } else {\n "#{hours} hours ago"\n }\n },\n someDaysAgo:\n (days : Number) {\n if days < 2 {\n "yesterday"\n } else {\n "#{days} days ago"\n }\n },\n someMonthsAgo:\n (months : Number) {\n if months < 2 {\n "last month"\n } else {\n "#{months} months ago"\n }\n },\n someYearsAgo:\n (years : Number) {\n if years < 2 {\n "last year"\n } else {\n "#{years} years ago"\n }\n },\n inSomeSeconds:\n (seconds : Number) {\n if seconds < 30 {\n "in a few seconds"\n } else {\n "in #{seconds} seconds"\n }\n },\n inSomeMinutes:\n (minutes : Number) {\n if minutes < 2 {\n "in a minute"\n } else {\n "in #{minutes} minutes"\n }\n },\n inSomeHours:\n (hours : Number) {\n if hours < 2 {\n "in an hour"\n } else {\n "in #{hours} hours"\n }\n },\n inSomeDays:\n (days : Number) {\n if days < 2 {\n "tomorrow"\n } else {\n "in #{days} days"\n }\n },\n inSomeMonths:\n (months : Number) {\n if months < 2 {\n "in a month"\n } else {\n "in #{months} months"\n }\n },\n inSomeYears:\n (years : Number) {\n if years < 2 {\n "in a year"\n } else {\n "in #{years} years"\n }\n },\n rightNow: "right now"\n}","b":true,"n":"ENGLISH"},{"k":5,"d":"

The Hungarian language record for time formatting.

","v":"{\n toMonthAbbreviation:\n (month : Month) {\n case month {\n January => "jan."\n February => "febr."\n March => "márc."\n April => "ápr."\n May => "máj."\n June => "jún."\n July => "júl."\n August => "aug."\n September => "szept."\n October => "okt."\n November => "nov."\n December => "dec."\n }\n },\n toMonthName:\n (month : Month) {\n case month {\n January => "janár"\n February => "február"\n March => "március"\n April => "április"\n May => "május"\n June => "június"\n July => "július"\n August => "augusztus"\n September => "szeptember"\n October => "október"\n November => "november"\n December => "december"\n }\n },\n toWeekdayName:\n (weekday : Weekday) {\n case weekday {\n Monday => "hétfő"\n Tuesday => "kedd"\n Wednesday => "szerda"\n Thursday => "csütörtök"\n Friday => "péntek"\n Saturday => "szombat"\n Sunday => "vasárnap"\n }\n },\n toWeekdayAbbreviation:\n (weekday : Weekday) {\n case weekday {\n Monday => "hé"\n Tuesday => "ke"\n Wednesday => "sze."\n Thursday => "csü."\n Friday => "pé."\n Saturday => "szo."\n Sunday => "va."\n }\n },\n toOrdinalSuffix:\n (day : Number) {\n case day {\n 1 => "-je"\n 2 => "-a"\n 3 => "-a"\n 4 => "-e"\n 5 => "-e"\n 6 => "-a"\n 7 => "-e"\n 8 => "-a"\n 9 => "-e"\n 10 => "-e"\n 11 => "-e"\n 12 => "-e"\n 13 => "-a"\n 14 => "-e"\n 15 => "-e"\n 16 => "-a"\n 17 => "-e"\n 18 => "-a"\n 19 => "-e"\n 20 => "-a"\n 21 => "-e"\n 22 => "-e"\n 23 => "-a"\n 24 => "-e"\n 25 => "-e"\n 26 => "-a"\n 27 => "-e"\n 28 => "-a"\n 29 => "-e"\n 30 => "-a"\n 31 => "-e"\n => ""\n }\n },\n amPm:\n (hour : Number) {\n if hour >= 12 {\n "du."\n } else {\n "de."\n }\n },\n someSecondsAgo:\n (seconds : Number) {\n if seconds < 30 {\n "épp most"\n } else {\n "#{seconds} másodperce"\n }\n },\n someMinutesAgo:\n (minutes : Number) {\n if minutes < 2 {\n "egy perce"\n } else {\n "#{minutes} perce"\n }\n },\n someHoursAgo:\n (hours : Number) {\n if hours < 2 {\n "egy órája"\n } else {\n "#{hours} órája"\n }\n },\n someDaysAgo:\n (days : Number) {\n if days < 2 {\n "tegnap"\n } else {\n "#{days} napja"\n }\n },\n someMonthsAgo:\n (months : Number) {\n if months < 2 {\n "egy hónapja"\n } else {\n "#{months} hónapja"\n }\n },\n someYearsAgo:\n (years : Number) {\n if years < 2 {\n "egy éve"\n } else {\n "#{years} éve"\n }\n },\n inSomeSeconds:\n (seconds : Number) {\n if seconds < 30 {\n "nemsokára"\n } else {\n "#{seconds} másodperc múlva"\n }\n },\n inSomeMinutes:\n (minutes : Number) {\n if minutes < 2 {\n "egy perc múlva"\n } else {\n "#{minutes} perc múlva"\n }\n },\n inSomeHours:\n (hours : Number) {\n if hours < 2 {\n "egy óra múlva"\n } else {\n "#{hours} óra múlva"\n }\n },\n inSomeDays:\n (days : Number) {\n if days < 2 {\n "holnap"\n } else {\n "#{days} nam múlva"\n }\n },\n inSomeMonths:\n (months : Number) {\n if months < 2 {\n "egy hónap múlva"\n } else {\n "#{months} hónap múlva"\n }\n },\n inSomeYears:\n (years : Number) {\n if years < 2 {\n "egy év múlva"\n } else {\n "#{years} év múlva"\n }\n },\n rightNow: "épp most"\n}","b":true,"n":"HUNGARIAN"}],"n":"Time.Format"},{"f":[],"k":1,"e":[{"k":3,"d":"

The children to render.

","v":"[]","b":false,"t":"Array(Html)","n":"children"},{"k":4,"a":[],"d":"

Renders the children in the </head>.

","b":false,"t":"Html","n":"render"}],"d":"

A component to render Html in the <head>.

<Html.Portals.Head>\n  <link rel="stylesheet" href="index.css"/>\n</Html.Portals.Head>
","n":"Html.Portals.Head"},{"f":[],"k":1,"e":[{"k":3,"d":"

The children to render.

","v":"[]","b":false,"t":"Array(Html)","n":"children"},{"k":4,"a":[],"d":"

Renders the children in the </body>.

","b":false,"t":"Html","n":"render"}],"d":"

A component to render Html in the <body>.

<Html.Portals.Body>\n  "Hello World!"\n</Html.Portals.Body>
","n":"Html.Portals.Body"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Handles keypress events.

","b":false,"t":"Array(Array(Promise(Void)))","n":"handle"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe function.

","v":"Maybe.Nothing","b":false,"t":"Maybe(Function(Void))","n":"listener"}],"d":"

This provider allows components to subscribe to global shortcuts.

component Main {\n  use Provider.Shortcuts {\n    shortcuts:\n      [\n        {\n          action: () { Window.alert("Shotcut pressed!") },\n          shortcut: [Html.Event.CTRL, Html.Event.G],\n          condition: () { true },\n          bypassFocused: false\n        }\n      ]\n  }\n\n  fun render : Html {\n    <div>"Press CTRL+G"</div>\n  }\n}
","n":"Provider.Shortcuts"},{"k":2,"e":[{"k":4,"a":[{"t":"String","n":"url"},{"t":"WebSocket","n":"socket"}],"d":"

Handles the open event.

","b":false,"t":"Promise(Void)","n":"onOpen"},{"k":4,"a":[{"t":"String","n":"url"},{"t":"String","n":"data"}],"d":"

Handles the message event.

","b":false,"t":"Promise(Void)","n":"onMessage"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Handles the error event.

","b":false,"t":"Promise(Void)","n":"onError"},{"k":4,"a":[{"t":"String","n":"url"}],"d":"

Handles the close event.

","b":false,"t":"Promise(Void)","n":"onClose"},{"k":4,"a":[],"d":"

Handles updates to the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

A state to store current connections.

","v":"Map.empty()","b":false,"t":"Map(String, WebSocket)","n":"connections"}],"d":"

Provider to handle websocket connections. Only one connection is made for an\nendpoint, events are emitted for all subscribers for that endpoint.

component Main {\n  state socket : Maybe(WebSocket) = Maybe.Nothing\n  state messages : Array(String) = []\n\n  use Provider.WebSocket {\n    url: "wss://echo.websocket.org/",\n    reconnectOnClose: false,\n    onOpen:\n      (socket : WebSocket) {\n        next {\n          messages: Array.push(messages, "Opened!"),\n          socket: Maybe.Just(socket)\n        }\n      },\n    onMessage:\n      (message : String) {\n        next { messages: Array.push(messages, message) }\n      },\n    onError:\n      () {\n        Debug.log("Error!")\n        next { }\n      },\n    onClose:\n      () {\n        Debug.log("Close!")\n        next { }\n      }\n  }\n\n  fun render : Html {\n    <div>\n      <button\n        onClick={\n          () {\n            if let Just(item) = socket {\n              WebSocket.send(item, "Message!")\n            }\n          }\n        }>\n\n        "Send a message"\n\n      </button>\n\n      for message of messages {\n        <div>\n          message\n        </div>\n      }\n    </div>\n  }\n}
","n":"Provider.WebSocket"},{"k":2,"e":[{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The observers.

","v":"[]","b":true,"t":"Array(Tuple(Provider.Intersection, IntersectionObserver))","n":"observers"}],"d":"

A provider to provide events when the given element is visible on the screen,\nusing the Intersection Observer Web API.

component Main {\n  state intersecting : Bool = false\n\n  use Provider.Intersection {\n    callback: (amount : Number) { next { intersecting: amount != 1 } },\n    rootMargin: "0px",\n    threshold: 1,\n    element: div\n  }\n\n  style div {\n    animation: animate 2s both alternate infinite;\n\n    box-sizing: border-box;\n    position: absolute;\n    background: black;\n    color: white;\n\n    place-content: center;\n    display: grid;\n\n    padding: 20px;\n    height: 200px;\n    width: 200px;\n\n    @keyframes animate {\n      0% {\n        left: 250px;\n      }\n\n      100% {\n        left: -250px;\n      }\n    }\n  }\n\n  fun render : Html {\n    <div>\n      if intersecting {\n        "Intersecting"\n      } else {\n        "Not Intersecting"\n      }\n\n      <div::div as div>"Hello World!"</div>\n    </div>\n  }\n}
","n":"Provider.Intersection"},{"k":2,"e":[{"k":4,"a":[],"d":"

Call the subscribers.

","b":false,"t":"Array(Promise(Void))","n":"process"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"v":"-1","b":false,"t":"Number","n":"id"}],"d":"

A provider for periodic updates (every 1 seconds).

component Main {\n  state count : Number = 0\n\n  use Provider.Tick {\n    ticks:\n      () {\n        next { count: count + 1 }\n      }\n  }\n\n  fun render : Html {\n    <div>"#{count}"</div>\n  }\n}
","n":"Provider.Tick"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

The event handler.

","b":false,"t":"Array(Promise(Void))","n":"handle"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe function.

","v":"Maybe.Nothing","b":false,"t":"Maybe(Function(Void))","n":"listener"}],"d":"

A provider to provide events when clicking outside of one of the elements.

component Main {\n  use Provider.OutsideClick {\n    elements: [root],\n    clicks:\n      () {\n        Debug.log("Clicked outside!")\n        next { }\n      }\n  }\n\n  fun render : Html {\n    <div as root>"Hello World!"</div>\n  }\n}
","n":"Provider.OutsideClick"},{"k":2,"e":[{"k":4,"a":[{"t":"Number","n":"timestamp"}],"d":"

Notifies all subscribers.

","b":false,"t":"Promise(Void)","n":"notify"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The current animation frame callback ID.

","v":"-1","b":false,"t":"Number","n":"id"}],"d":"

A provider for the requestAnimationFrame Web API.

component Main {\n  state id : Number = 0\n\n  use Provider.AnimationFrame {\n    frames: (id : Number) {\n      next { id: id }\n    }\n  }\n\n  fun render : Html {\n    <div>\n      "#{id}"\n    </div>\n  }\n}
","n":"Provider.AnimationFrame"},{"k":2,"e":[{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The unsubscribe functions.

","v":"Maybe.Nothing","b":true,"t":"Maybe(Tuple(Function(Void), Function(Void)))","n":"listeners"}],"d":"

A provider for global keyboard events.

component Main {\n  state keyCode : Number = 0\n\n  use Provider.Keyboard {\n    downs: (event : Html.Event) { next { keyCode: event.keyCode } },\n    ups: (event : Html.Event) { next { keyCode: event.keyCode } }\n  }\n\n  fun render : Html {\n    <div>"#{keyCode}"</div>\n  }\n}
","n":"Provider.Keyboard"},{"k":2,"e":[{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The unsubscribe functions.

","v":"Maybe.Nothing","b":true,"t":"Maybe(Tuple(Function(Void), Function(Void), Function(Void)))","n":"listeners"},{"k":9,"d":"

The state to hold the animation frame ID.

","v":"0","b":false,"t":"Number","n":"id"}],"d":"

A provider for global mouse events.

component Main {\n  state position : Tuple(Number, Number) = {0, 0}\n\n  use Provider.Mouse {\n    clicks: Promise.never1,\n    ups: Promise.never1,\n    moves: (event : Html.Event) {\n      next {\n        position: {event.pageX, event.pageY}\n      }\n    }\n  }\n\n  fun render : Html {\n    <div>"#{position[0]}, #{position[1]}"</div>\n  }\n}
","n":"Provider.Mouse"},{"k":2,"e":[{"k":4,"a":[{"t":"Array(MutationObserver.Entry)","n":"entries"}],"d":"

Notifies the subscribers when changes occur.

","b":true,"t":"Array(Array(Promise(Void)))","n":"notify"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

Keep a state of all observed elements.

","v":"[]","b":false,"t":"Array(Maybe(Dom.Element))","n":"observedElements"},{"k":9,"d":"

The mutation observer.

","v":"MutationObserver.new(notify)","b":false,"n":"observer"}],"d":"

A provider to provide events when the DOM structure of the element changes.

component Main {\n  state counter : Number = 0\n\n  use Provider.Mutation {\n    element: root,\n    changes:\n      () {\n        Debug.log("The contents changed!")\n        next { }\n      }\n  }\n\n  fun render : Html {\n    <div as root>\n      Number.toString(counter)\n\n      <button onClick={() { next { counter: counter + 1 } }}>\n        "Increment"\n      </button>\n    </div>\n  }\n}
","n":"Provider.Mutation"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Handles the resize events.

","b":false,"t":"Array(Promise(Void))","n":"handle"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe function.

","v":"Maybe.Nothing","b":false,"t":"Maybe(Function(Void))","n":"listener"}],"d":"

A provider for handling changes of the viewport.

component Main {\n  state size : Tuple(Number, Number) = {Window.width(), Window.height()}\n\n  use Provider.Resize {\n    resizes:\n      (event : Html.Event) {\n        next { size: {Window.width(), Window.height()} }\n      }\n  }\n\n  fun render : Html {\n    <div>"#{size[0]}, #{size[1]}"</div>\n  }\n}
","n":"Provider.Resize"},{"k":2,"e":[{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listeners.

","v":"Map.empty()","b":false,"t":"Map(String, Function(Void))","n":"listeners"}],"d":"

This provider sends changes when the media query in the subscription changes.

component Main {\n  state matches : Bool = false\n\n  use Provider.MediaQuery {\n    query: "(max-width: 1000px)",\n    changes: -> matches\n  }\n\n  fun render : Html {\n    <div>\n      Bool.toString(matches)\n    </div>\n  }\n}
","n":"Provider.MediaQuery"},{"k":2,"e":[{"k":4,"a":[{"t":"Array(ResizeObserver.Entry)","n":"entries"}],"d":"

Notifies all subscribers when there are changes.

","b":true,"t":"Array(Array(Promise(Void)))","n":"notify"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

All observed elements.

","v":"[]","b":false,"t":"Array(Maybe(Dom.Element))","n":"observedElements"},{"k":9,"d":"

The resize observer.

","v":"ResizeObserver.new(notify)","b":false,"n":"observer"}],"d":"

A provider which provides events when the size of the element changes.

component Main {\n  state height : Number = 0\n\n  use Provider.ElementSize {\n    element: base,\n    changes: (dimensions : Dom.Dimensions) {\n      next { height: dimensions.height }\n    }\n  }\n\n  fun render : Html {\n    <div as base>\n      "#{height}"\n    </div>\n  }\n}
","n":"Provider.ElementSize"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

Handles the scroll events.

","b":false,"t":"Array(Promise(Void))","n":"handle"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe function.

","v":"Maybe.Nothing","b":false,"t":"Maybe(Function(Void))","n":"listener"}],"d":"

A provider for global scroll events.

component Main {\n  state scrollTop : Number = 0\n\n  use Provider.Scroll {\n    scrolls:\n      (event : Html.Event) {\n        next { scrollTop: Window.scrollTop() }\n      }\n  }\n\n  style root {\n    height: 200vh;\n  }\n\n  style position {\n    position: fixed;\n  }\n\n  fun render : Html {\n    <div::root>\n      <div::position>"#{scrollTop}"</div>\n    </div>\n  }\n}
","n":"Provider.Scroll"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

The keyUp event handler.

","b":false,"t":"Array(Promise(Void))","n":"handleKeyUp"},{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

The keyDown event handler.

","b":false,"t":"Array(Promise(Void))","n":"handleKeyDown"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe functions.

","v":"Maybe.Nothing","b":true,"t":"Maybe(Tuple(Function(Void), Function(Void)))","n":"listeners"}],"d":"

A provider to provide the tab in and tab out events for an element.

component Main {\n  use Provider.TabFocus {\n    onTabOut: () { Window.alert("Tabbed Out!") },\n    onTabIn: () { Window.alert("Tabbed In!") },\n    element: input\n  }\n\n  fun render : Html {\n    <input as input/>\n  }\n}
","n":"Provider.TabFocus"},{"k":2,"e":[{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The listener unsubscribe functions.

","v":"Maybe.Nothing","b":true,"t":"Maybe(Tuple(Function(Void), Function(Void), Function(Void)))","n":"listeners"},{"k":9,"d":"

The state to hold the animation frame id.

","v":"0","b":false,"t":"Number","n":"id"}],"d":"

A provider for global pointer events.

component Main {\n  state position : Tuple(Number, Number) = {0, 0}\n\n  use Provider.Pointer {\n    downs: Promise.never1,\n    ups: Promise.never1,\n    moves: (event : Html.Event) {\n      next {\n        position: {event.pageX, event.pageY}\n      }\n    }\n  }\n\n  fun render : Html {\n    <div>"#{position[0]}, #{position[1]}"</div>\n  }\n}
","n":"Provider.Pointer"},{"k":2,"e":[{"k":4,"a":[{"t":"Html.Event","n":"event"}],"d":"

The event handler.

","b":false,"t":"Array(Promise(Void))","n":"handle"},{"k":4,"a":[],"d":"

Updates the provider.

","b":false,"t":"Promise(Void)","n":"update"},{"k":9,"d":"

The unsubscribe function.

","v":"Maybe.Nothing","b":false,"t":"Maybe(Function(Void))","n":"listener"}],"d":"

A provider for global popstate events, which emits the current URL.

component Main {\n  use Provider.Url {\n    changes:\n      (url : Url) {\n        Debug.log(url)\n        next { }\n      }\n  }\n\n  fun render : Html {\n    <div>\n      <a href="/home">\n        "Home"\n      </a>\n\n      <a href="/">\n        "Root"\n      </a>\n    </div>\n  }\n}\n\nroutes {\n  * {\n    ""\n  }\n}
","n":"Provider.Url"},{"k":8,"e":[{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Resets the counter with the label to 0.

","b":false,"t":"Promise(Void)","n":"clear"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Returns the current count of the counter with the label.

","b":false,"t":"Number","n":"get"},{"k":4,"a":[{"v":""Default"","t":"String","n":"label"}],"d":"

Increments the counter with the label.

","b":false,"t":"Promise(Void)","n":"increment"},{"k":9,"d":"

State for the counts of each counter.

","v":"Map.empty()","b":false,"t":"Map(String, Number)","n":"counts"}],"d":"

This store for saving the value of the console counters.

Console.Counter.increment("My Label")\nConsole.Counter.get("My Label") // 1\nConsole.Counter.clear("My Label")\nConsole.Counter.get("My Label") // 0
","n":"Console.Counter"},{"k":8,"e":[{"k":4,"a":[{"t":"String","n":"id"}],"d":"

Aborts the running request with the id.

Http.abort("my-request")
","b":false,"t":"Promise(Void)","n":"abort"},{"k":4,"a":[],"d":"

Aborts all running requests.

Http.abortAll()
","b":false,"t":"Promise(Void)","n":"abortAll"},{"k":4,"a":[{"t":"String","n":"value"}],"d":"

Creates a request record where the method is DELETE.

Http.delete("https://httpbin.org/delete").method == "DELETE"
","b":false,"t":"Http.Request","n":"delete"},{"k":4,"a":[],"d":"

Creates an empty request record. It is useful if you want to use a\nnon-standard HTTP method.

Http.empty() ==\n  {\n    withCredentials: false,\n    method: "GET",\n    body: `null`,\n    headers: [],\n    url: ""\n  }
","b":false,"t":"Http.Request","n":"empty"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"FormData","n":"body"}],"d":"

Sets the body of the request to the provided FormData object.

let formData =\n  FormData.empty()\n  |> FormData.addString("key", "value")\n\n"https://httpbin.org/anything"\n|> Http.post()\n|> Http.formDataBody(formData)\n|> Http.send()
","b":true,"t":"Http.Request","n":"formDataBody"},{"k":4,"a":[{"t":"String","n":"urlValue"}],"d":"

Creates a request record where the method is GET.

Http.get("https://httpbin.org/get").method == "GET"
","b":false,"t":"Http.Request","n":"get"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"String","n":"key"}],"d":"

Checks the prescence of a header with the key.

Http.empty()\n|> Http.header("Content-Type", "application/json")\n|> Http.hasHeader("Content-Type") == true
","b":false,"t":"Bool","n":"hasHeader"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"String","n":"key"},{"t":"String","n":"value"}],"d":"

Adds a header to the request with the key and value. Overwrites the value\nif key already exists.

Http.empty()\n|> Http.header("Content-Type", "application/json")
","b":true,"t":"Http.Request","n":"header"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"Object","n":"body"}],"d":"

Sets the body of the request to the object encoded to JSON.

"https://httpbin.org/anything"\n|> Http.post()\n|> Http.jsonBody(encode { name = "John" })\n|> Http.send()
","b":false,"t":"Http.Request","n":"jsonBody"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"String","n":"method"}],"d":"

Sets the method of the request.

Http.empty()\n|> Http.method("PATCH")
","b":false,"t":"Http.Request","n":"method"},{"k":4,"a":[{"t":"String","n":"urlValue"}],"d":"

Creates a request record where the method is POST.

Http.post("https://httpbin.org/post").method == "POST"
","b":false,"t":"Http.Request","n":"post"},{"k":4,"a":[{"t":"String","n":"urlValue"}],"d":"

Creates a request record where the method is PUT.

Http.put("https://httpbin.org/put").method == "PUT"
","b":false,"t":"Http.Request","n":"put"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"v":"Uid.generate()","t":"String","n":"id"},{"v":"(value : Object) { void }","t":"Function(Object, a)","n":"instrument"}],"d":"

Sends the request with the ID (generated if not provided) so it could be\naborted later. The running request with the same id is aborted before the new\nrequest is sent.

"https://httpbin.org/get"\n|> Http.get()\n|> Http.send("my-request")
","b":true,"t":"Promise(Result(Http.ErrorResponse, Http.Response))","n":"send"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"String","n":"body"}],"d":"

Sets the body of the request as String.

"https://httpbin.org/anything"\n|> Http.post()\n|> Http.stringBody("Some string that will come back.")\n|> Http.send()
","b":false,"t":"Http.Request","n":"stringBody"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"String","n":"url"}],"d":"

Sets the URL of the request.

Http.empty()\n|> Http.url("https://httpbin.org/anything")
","b":false,"t":"Http.Request","n":"url"},{"k":4,"a":[{"t":"Http.Request","n":"request"},{"t":"Bool","n":"value"}],"d":"

Sets the withCredentials of the request.

Http.empty()\n|> Http.withCredentials(true)
","b":true,"t":"Http.Request","n":"withCredentials"},{"k":9,"d":"

The state for tracking requests.

","v":"{ } of String => Object","b":false,"n":"requests"}],"d":"

This store provides functions for sending and tracking HTTP requests.

let request =\n  await "https://httpbin.org/get"\n  |> Http.get()\n  |> Http.send()\n\ncase (request) {\n  Ok(response) =>\n    Debug.log(response)\n\n  Err(error) =>\n    Debug.log(error)\n}
","n":"Http"}] \ No newline at end of file diff --git a/source.mint b/source.mint new file mode 100644 index 000000000..69c880d46 --- /dev/null +++ b/source.mint @@ -0,0 +1,3 @@ +type Test { + file : String +} \ No newline at end of file diff --git a/spec/compilers/access b/spec/compilers/access index 8337f9b0a..52c19f469 100644 --- a/spec/compilers/access +++ b/spec/compilers/access @@ -8,19 +8,8 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({ - name: [ - "name", - Decoder.string - ] -}); - -class B extends _C { - render() { - return new A({ - name: `test` - }).name; - } +export const A = () => { + return { + name: `test` + }.name }; - -B.displayName = "Main"; diff --git a/spec/compilers2/access_deep b/spec/compilers/access_deep similarity index 100% rename from spec/compilers2/access_deep rename to spec/compilers/access_deep diff --git a/spec/compilers/argument b/spec/compilers/argument index 2fef7575f..e38d7c8a5 100644 --- a/spec/compilers/argument +++ b/spec/compilers/argument @@ -10,15 +10,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a(b, c) { - return c; - } - - render() { - this.a(``, 0); - return ``; - } +export const A = () => { + const a = (b, c) => { + return c + }; + a(``, 0); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/argument_with_default b/spec/compilers/argument_with_default index 20554eab6..a8433d8b6 100644 --- a/spec/compilers/argument_with_default +++ b/spec/compilers/argument_with_default @@ -10,15 +10,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a(b, c = 0) { - return c; - } - - render() { - this.a(``); - return ``; - } +export const A = () => { + const a = (b, c = 0) => { + return c + }; + a(``); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/argument_with_default_inline_function b/spec/compilers/argument_with_default_inline_function index dc7d0ad14..ef98ddc90 100644 --- a/spec/compilers/argument_with_default_inline_function +++ b/spec/compilers/argument_with_default_inline_function @@ -11,15 +11,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const c = (b, a = 0) => { - return a - }; - - c(``); - return ``; - } +export const A = () => { + const a = (b, c = 0) => { + return c + }; + a(``); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/array_literal b/spec/compilers/array_literal index 7cddcb840..c2e86a127 100644 --- a/spec/compilers/array_literal +++ b/spec/compilers/array_literal @@ -1,28 +1,20 @@ component Main { - fun test : Array(String) { + fun render : String { [ "Hello", "Blah", "Joe" ] - } - - fun render : String { - test() "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return [`Hello`, `Blah`, `Joe`]; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + [ + `Hello`, + `Blah`, + `Joe` + ]; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/block b/spec/compilers/block index d3bf4d0c9..07661b944 100644 --- a/spec/compilers/block +++ b/spec/compilers/block @@ -6,11 +6,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const a = `Some string...`; - return a + `, other string...`; - } +export const A = () => { + const a = `Some string...`; + return a + `, other string...` }; - -A.displayName = "Main"; diff --git a/spec/compilers/block_with_await b/spec/compilers/block_with_await index 2cc348514..97dfafca4 100644 --- a/spec/compilers/block_with_await +++ b/spec/compilers/block_with_await @@ -14,19 +14,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return; - } - - async b() { - return await this.a(); - } - - render() { - this.b(); - return `Hello`; - } +export const A = () => { + const + a = () => { + return undefined + }, + b = async () => { + return await a() + }; + b(); + return `Hello` }; - -A.displayName = "Main"; diff --git a/spec/compilers/block_with_early_return b/spec/compilers/block_with_early_return index e08ced87d..3cb3a2504 100644 --- a/spec/compilers/block_with_early_return +++ b/spec/compilers/block_with_early_return @@ -12,35 +12,22 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class C extends _C { - render() { - const b = __match(_n(A)(`Some string...`), _PE(A,[ - _PV - ])); +import { + patternVariable as H, + destructure as E, + newVariant as F, + pattern as G, + variant as B +} from "./runtime.js"; - if (b === false) { +export const + A = B(1), + C = B(1), + D = () => { + const a = E(F(A)(`Some string...`), G(A, [H])); + if (a === false) { return `RETURN` }; - - const [a] = b; - return a; - } -}; - -C.displayName = "Main"; + const [b] = a; + return b + }; diff --git a/spec/compilers/block_with_early_return_2 b/spec/compilers/block_with_early_return_2 deleted file mode 100644 index ee88819f4..000000000 --- a/spec/compilers/block_with_early_return_2 +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - fun render : String { - return "YES" - "NO" - } -} --------------------------------------------------------------------------------- -class A extends _C { - render() { - return `YES`; - return `NO`; - } -}; - -A.displayName = "Main"; diff --git a/spec/compilers/block_with_early_return_await b/spec/compilers/block_with_early_return_await index 8b6a924c3..ab2071bf4 100644 --- a/spec/compilers/block_with_early_return_await +++ b/spec/compilers/block_with_early_return_await @@ -16,39 +16,25 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class C extends _C { - render() { +import { + patternVariable as H, + destructure as E, + newVariant as F, + pattern as G, + variant as B +} from "./runtime.js"; + +export const + A = B(1), + C = B(1), + D = () => { (async () => { - const b = __match(await _n(A)(`Some string...`), _PE(A,[ - _PV - ])); - - if (b === false) { + const a = E(await F(A)(`Some string...`), G(A, [H])); + if (a === false) { return `RETURN` }; - - const [a] = b; - return a; + const [b] = a; + return b })(); - - return ``; - } -}; - -C.displayName = "Main"; + return `` + }; diff --git a/spec/compilers/block_with_tuple_destructuring b/spec/compilers/block_with_tuple_destructuring index 416ffe5f4..c625e9694 100644 --- a/spec/compilers/block_with_tuple_destructuring +++ b/spec/compilers/block_with_tuple_destructuring @@ -6,11 +6,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const [a,b] = [`Some string...`, `B`]; - return a + `, other string...`; - } +export const A = () => { + const [ + a, + b + ] = [ + `Some string...`, + `B` + ]; + return a + `, other string...` }; - -A.displayName = "Main"; diff --git a/spec/compilers/bool_literal_false b/spec/compilers/bool_literal_false index aaa5753ab..f602b7803 100644 --- a/spec/compilers/bool_literal_false +++ b/spec/compilers/bool_literal_false @@ -1,24 +1,12 @@ component Main { - fun test : Bool { - false - } - fun render : String { - test() + false "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return false; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + false; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/bool_literal_true b/spec/compilers/bool_literal_true index 90eaee8ea..67d0b3639 100644 --- a/spec/compilers/bool_literal_true +++ b/spec/compilers/bool_literal_true @@ -1,24 +1,12 @@ component Main { - fun test : Bool { - true - } - fun render : String { - test() + true "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return true; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + true; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/bracket_access b/spec/compilers/bracket_access index 21d5398b7..d128c83af 100644 --- a/spec/compilers/bracket_access +++ b/spec/compilers/bracket_access @@ -1,39 +1,43 @@ +type Maybe(a) { + Nothing + Just(a) +} + component Main { - fun test : Maybe(String) { + fun render : String { [ "Hello", "Blah", "Joe" ][1] - } - fun test1 : Maybe(a) { [][1] - } - - fun render : String { - test() - test1() + { "key" => "value" }["key"] "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return _at([`Hello`, `Blah`, `Joe`], 1); - } - - b() { - return _at([], 1); - } - - render() { - this.a(); - this.b(); - return ``; - } -}; +import { + bracketAccess as E, + mapAccess as F, + variant as B +} from "./runtime.js"; -A.displayName = "Main"; +export const + A = B(0), + C = B(1), + D = () => { + E([ + `Hello`, + `Blah`, + `Joe` + ], 1, C, A); + E([], 1, C, A); + F([[ + `key`, + `value` + ]], `key`, C, A); + return `` + }; diff --git a/spec/compilers2/builtin b/spec/compilers/builtin similarity index 100% rename from spec/compilers2/builtin rename to spec/compilers/builtin diff --git a/spec/compilers/call_labelled b/spec/compilers/call_labelled index f128ca6a3..d3a9a60aa 100644 --- a/spec/compilers/call_labelled +++ b/spec/compilers/call_labelled @@ -1,21 +1,16 @@ component Main { - fun test (argument1 : String, argument2: Number) : Html { -
+ fun test (argument1 : String, argument2: Number) : String { + "" } - fun render : Html { + fun render : String { test(argument2: 0, argument1: "") } } -------------------------------------------------------------------------------- -class A extends _C { - a(b, c) { - return _h("div", {}); - } - - render() { - return this.a(``, 0); - } +export const A = () => { + const a = (b, c) => { + return `` + }; + return a(``, 0) }; - -A.displayName = "Main"; diff --git a/spec/compilers/case b/spec/compilers/case index 422ff0f5c..1b4049e7c 100644 --- a/spec/compilers/case +++ b/spec/compilers/case @@ -10,31 +10,28 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - _match(`Hello`,[ - [ - `test`, - () => { - return true - } - ], - [ - `Hello`, - () => { - return false - } - ], - [ - null, - () => { - return false - } - ] - ]); +import { match as B } from "./runtime.js"; - return ``; - } +export const A = () => { + B(`Hello`, [ + [ + `test`, + () => { + return true + } + ], + [ + `Hello`, + () => { + return false + } + ], + [ + null, + () => { + return false + } + ] + ]); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_await b/spec/compilers/case_await index dc110bc25..db208de54 100644 --- a/spec/compilers/case_await +++ b/spec/compilers/case_await @@ -1,44 +1,41 @@ component Main { fun render : String { - case await "Hello" { - "test" => true - "Hello" => false - => false + { + case await "Hello" { + "test" => true + "Hello" => false + => false + } } "" } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - (async () => { - let a = await `Hello`; +import { match as B } from "./runtime.js"; - return _match(a,[ - [ - `test`, - () => { - return true - } - ], - [ - `Hello`, - () => { - return false - } - ], - [ - null, - () => { - return false - } - ] - ]); - })(); - - return ``; - } +export const A = () => { + (async () => { + return B(await `Hello`, [ + [ + `test`, + () => { + return true + } + ], + [ + `Hello`, + () => { + return false + } + ], + [ + null, + () => { + return false + } + ] + ]) + })(); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_empty b/spec/compilers/case_empty index 421f4c978..c1812f1d6 100644 --- a/spec/compilers/case_empty +++ b/spec/compilers/case_empty @@ -6,17 +6,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _match(`Hello`,[ - [ - null, - () => { - return `false` - } - ] - ]); - } -}; +import { match as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`Hello`, [[ + null, + () => { + return `false` + } + ]]) +}; diff --git a/spec/compilers/case_with_array_destructuring b/spec/compilers/case_with_array_destructuring index c3da05c7c..acd9f446a 100644 --- a/spec/compilers/case_with_array_destructuring +++ b/spec/compilers/case_with_array_destructuring @@ -5,57 +5,58 @@ component Main { ["a"] => ["a"] [a] => [a] [a, b] => [a, b] - [a, b, ...middle] => middle + [a, b, ...rest] => rest } } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _match([],[ - [ - [], - () => { - return [``] - } - ], - [ - [ - `a` - ], - () => { - return [`a`] - } - ], +import { + patternVariable as C, + patternSpread as D, + match as B +} from "./runtime.js"; + +export const A = () => { + return B([], [ + [ + [], + () => { + return [``] + } + ], + [ + [`a`], + () => { + return [`a`] + } + ], + [ + [C], + (a) => { + return [a] + } + ], + [ [ - [ - _PV - ], - (a) => { - return [a] - } + C, + C ], + (b, c) => { + return [ + b, + c + ] + } + ], + [ [ - [ - _PV, - _PV - ], - (b, c) => { - return [b, c] - } + C, + C, + D ], - [ - [ - _PV, - _PV, - _PS - ], - (e, f, d) => { - return d - } - ] - ]); - } + (d, e, f) => { + return f + } + ] + ]) }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_with_nested_tuple_destructuring b/spec/compilers/case_with_nested_tuple_destructuring index dd4d5e7b2..249c7d057 100644 --- a/spec/compilers/case_with_nested_tuple_destructuring +++ b/spec/compilers/case_with_nested_tuple_destructuring @@ -1,56 +1,66 @@ component Main { fun render : String { - case ({"A", {"B", ""}}) { - {"A", {"C", ""}} => + case ({"A", {"B", "C"}}) { + {"A", {"C", "D"}} => "B" - {"A", {"B", ""}} => + {"A", {"B", "C"}} => "A" - {a, b} => - a + {a, {b, c}} => + b } } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _match([`A`, [`B`, ``]],[ +import { + patternVariable as C, + match as B +} from "./runtime.js"; + +export const A = () => { + return B([ + `A`, + [ + `B`, + `C` + ] + ], [ + [ [ + `A`, [ - `A`, - [ - `C`, - `` - ] - ], - () => { - return `B` - } + `C`, + `D` + ] ], + () => { + return `B` + } + ], + [ [ + `A`, [ - `A`, - [ - `B`, - `` - ] - ], - () => { - return `A` - } + `B`, + `C` + ] ], + () => { + return `A` + } + ], + [ [ + C, [ - _PV, - _PV - ], - (a, b) => { - return a - } - ] - ]); - } + C, + C + ] + ], + (a, b, c) => { + return b + } + ] + ]) }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_with_tuple_destructuring b/spec/compilers/case_with_tuple_destructuring index 106cd2920..273dd6555 100644 --- a/spec/compilers/case_with_tuple_destructuring +++ b/spec/compilers/case_with_tuple_destructuring @@ -13,41 +13,46 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _match([`A`, 0, true],[ +import { + patternVariable as C, + match as B +} from "./runtime.js"; + +export const A = () => { + return B([ + `A`, + 0, + true + ], [ + [ [ - [ - `A`, - 0, - false - ], - () => { - return `B` - } + `A`, + 0, + false ], + () => { + return `B` + } + ], + [ [ - [ - `A`, - 0, - true - ], - () => { - return `A` - } + `A`, + 0, + true ], + () => { + return `A` + } + ], + [ [ - [ - _PV, - _PV, - _PV - ], - (a, b, c) => { - return a - } - ] - ]); - } + C, + C, + C + ], + (a, b, c) => { + return a + } + ] + ]) }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_with_tuple_destructuring_bool b/spec/compilers/case_with_tuple_destructuring_bool index c04075a7b..d466229b7 100644 --- a/spec/compilers/case_with_tuple_destructuring_bool +++ b/spec/compilers/case_with_tuple_destructuring_bool @@ -12,35 +12,36 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _match([false, true],[ +import { match as B } from "./runtime.js"; + +export const A = () => { + return B([ + false, + true + ], [ + [ [ - [ - true, - false - ], - () => { - return `B` - } + true, + false ], + () => { + return `B` + } + ], + [ [ - [ - false, - true - ], - () => { - return `A` - } + false, + true ], - [ - null, - () => { - return `C` - } - ] - ]); - } + () => { + return `A` + } + ], + [ + null, + () => { + return `C` + } + ] + ]) }; - -A.displayName = "Main"; diff --git a/spec/compilers/case_with_type_destructuring b/spec/compilers/case_with_type_destructuring index 44c41e680..892c40be6 100644 --- a/spec/compilers/case_with_type_destructuring +++ b/spec/compilers/case_with_type_destructuring @@ -8,8 +8,8 @@ type C(a) { } component Main { - fun test (b : C(a)) : a { - case (b) { + fun render : String { + case (C.D(A.B(""))) { C.X => "" C.D(a) => case (a) { @@ -17,71 +17,42 @@ component Main { c } } - } - - fun render : String { - test(C.D(A.B(""))) "" } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class C extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class D extends _C { - a(b) { - return _match(b,[ +import { + patternVariable as I, + newVariant as G, + pattern as H, + variant as B, + match as F +} from "./runtime.js"; + +export const + A = B(1), + C = B(0), + D = B(1), + E = () => { + F(G(A)(G(D)(``)), [ [ - _PE(C,[]), + H(C, []), () => { return `` } ], [ - _PE(B,[ - _PV - ]), - (c) => { - return _match(c,[ - [ - _PE(A,[ - _PV - ]), - (d) => { - return d - } - ] - ]) + H(A, [I]), + (a) => { + return F(a, [[ + H(D, [I]), + (b) => { + return b + } + ]]) } ] ]); - } - - render() { - this.a(_n(B)(_n(A)(``))); - return ``; - } -}; - -D.displayName = "Main"; + return `` + }; diff --git a/spec/compilers/component b/spec/compilers/component index 89352d8f3..49d297c64 100644 --- a/spec/compilers/component +++ b/spec/compilers/component @@ -1,13 +1,9 @@ component Main { - fun render : Html { -
+ fun render : String { + "" } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}); - } +export const A = () => { + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers2/component_async b/spec/compilers/component_async similarity index 100% rename from spec/compilers2/component_async rename to spec/compilers/component_async diff --git a/spec/compilers2/component_async_2 b/spec/compilers/component_async_2 similarity index 100% rename from spec/compilers2/component_async_2 rename to spec/compilers/component_async_2 diff --git a/spec/compilers2/component_async_3 b/spec/compilers/component_async_3 similarity index 100% rename from spec/compilers2/component_async_3 rename to spec/compilers/component_async_3 diff --git a/spec/compilers2/component_async_4 b/spec/compilers/component_async_4 similarity index 100% rename from spec/compilers2/component_async_4 rename to spec/compilers/component_async_4 diff --git a/spec/compilers2/component_async_5 b/spec/compilers/component_async_5 similarity index 100% rename from spec/compilers2/component_async_5 rename to spec/compilers/component_async_5 diff --git a/spec/compilers2/component_children b/spec/compilers/component_children similarity index 100% rename from spec/compilers2/component_children rename to spec/compilers/component_children diff --git a/spec/compilers/component_global b/spec/compilers/component_global index 5d36ae5f4..e78a0b59d 100644 --- a/spec/compilers/component_global +++ b/spec/compilers/component_global @@ -1,11 +1,17 @@ global component Notifications { + state test : String = "" + + get value : String { + test + } + fun notify (value : String) : String { value } fun render : Html {
- "Test" + value
} } @@ -18,31 +24,22 @@ component Main { } } -------------------------------------------------------------------------------- -class $A extends _C { - a(b) { - return b; - } - - render() { - return _h("div", {}, [ - `Test` - ]); - } - - _persist() { - A = this - } -}; - -$A.displayName = "Notifications"; -let A; - -class B extends _C { - render() { - return _h("div", {}, [ - A.a(`Hello`) - ]); - } -}; +import { + createElement as B, + signal as D +} from "./runtime.js"; -B.displayName = "Main"; +export const + A = () => { + return B(`div`, {}, [a()]) + }, + b = (c) => { + return c + }, + C = () => { + return B(`div`, {}, [b(`Hello`)]) + }, + d = D(``), + a = () => { + return d.value + }; diff --git a/spec/compilers/component_instance_access b/spec/compilers/component_instance_access index 9182fffe7..71bc658c1 100644 --- a/spec/compilers/component_instance_access +++ b/spec/compilers/component_instance_access @@ -28,66 +28,56 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class C extends _C { - get a() { - return `Instance` - } - - render() { - return _h("div", {}); - } -}; - -C.displayName = "Instance"; - -class D extends _C { - get c() { - return (this._instance ? new A(this._instance) : new B); - } - - b() { - return _match(this.c,[ - [ - _PE(A,[ - _PV - ]), - (d) => { - return d.a - } - ], - [ - _PE(B,[]), - () => { - return `` - } - ] - ]); - } - - render() { - return _h("div", { - "onClick": (event => (this.b)(_normalizeEvent(event))) - }, [ - _h(C, { - ref: (instance) => { this._instance = instance } - }) - ]); - } -}; +import { + patternVariable as K, + createElement as F, + pattern as J, + useMemo as E, + variant as B, + setRef as L, + useRef as H, + match as I +} from "./runtime.js"; -D.displayName = "Main"; +export const + A = B(1), + C = B(0), + D = ({ + _ + }) => { + const a = () => { + return `Instance` + }; + const b = E(() => { + return { + a + } + }, []); + (_ ? _(b) : null); + return F(`div`, {}) + }, + G = () => { + const + c = H(new C()), + d = () => { + return I(c.current, [ + [ + J(A, [K]), + (e) => { + return e.a() + } + ], + [ + J(C, []), + () => { + return `` + } + ] + ]) + }; + return F(`div`, { + "onClick": d + }, [F(D, { + _: L(c, A) + })]) + }; diff --git a/spec/compilers2/component_instance_access_ref b/spec/compilers/component_instance_access_ref similarity index 100% rename from spec/compilers2/component_instance_access_ref rename to spec/compilers/component_instance_access_ref diff --git a/spec/compilers/component_namespaced b/spec/compilers/component_namespaced index 951028851..450ad76d7 100644 --- a/spec/compilers/component_namespaced +++ b/spec/compilers/component_namespaced @@ -10,20 +10,12 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `test`; - } -}; - -A.displayName = "Ui.Dropdown"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; +import { createElement as C } from "./runtime.js"; -const $a = _m(() => _h(A, {})); +export const + A = () => { + return `test` + }, + B = () => { + return C(A, {}) + }; diff --git a/spec/compilers/component_namespaced_with_style b/spec/compilers/component_namespaced_with_style index d7093529d..7c36f4e5e 100644 --- a/spec/compilers/component_namespaced_with_style +++ b/spec/compilers/component_namespaced_with_style @@ -16,30 +16,20 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `Ui·Dropdown_base` - }, [ - `test` - ]); - } -}; - -A.displayName = "Ui.Dropdown"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; - -const $a = _m(() => _h(A, {})); - -_insertStyles(` +---=== /__mint__/index.css ===--- .Ui·Dropdown_base { background: red; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const + A = () => { + return B(`div`, { + className: `Ui·Dropdown_base` + }, [`test`]) + }, + C = () => { + return B(A, {}) + }; diff --git a/spec/compilers/component_readonly b/spec/compilers/component_readonly index c9fdd0b30..536a5716d 100644 --- a/spec/compilers/component_readonly +++ b/spec/compilers/component_readonly @@ -12,33 +12,16 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this._d({ - a: [ - null, - false - ] - }); - } - - render() { - return _h("div", {}); - } -}; - -A.displayName = "Test"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; - -const $a = _m(() => _h(A, { - a: true -})); +import { createElement as B } from "./runtime.js"; + +export const + A = ({ + a = false + }) => { + return B(`div`, {}) + }, + C = () => { + return B(A, { + a: true + }) + }; diff --git a/spec/compilers/component_with_provider b/spec/compilers/component_with_provider index a92200cff..d3c75e115 100644 --- a/spec/compilers/component_with_provider +++ b/spec/compilers/component_with_provider @@ -22,57 +22,29 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({}); - -const B = new(class extends _P { - constructor() { - super(); - this.state = {}; - } - - update() { - return null; - } -}); - -class C extends _C { - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidUpdate() { - if (false) { - B._subscribe(this, new A({ - moves: (a) => { - return null - }, - ups: (b) => { - return null - } - })) - } else { - B._unsubscribe(this) - }; - } - - componentDidMount() { - if (false) { - B._subscribe(this, new A({ - moves: (a) => { +import { + createProvider as B, + createElement as E, + useId as D +} from "./runtime.js"; + +export const + a = new Map(), + A = B(a, () => { + return null + }), + C = () => { + const b = D(); + A(b, () => { + return (false ? { + moves: (c) => { return null }, - ups: (b) => { + ups: (d) => { return null } - })) - } else { - B._unsubscribe(this) - }; - } - - render() { - return _h("div", {}); - } -}; + } : null) + }); + return E(`div`, {}) + }; -C.displayName = "Main"; diff --git a/spec/compilers/component_with_provider_and_lifecycle_functions b/spec/compilers/component_with_provider_and_lifecycle_functions index 9883e4b81..78184033a 100644 --- a/spec/compilers/component_with_provider_and_lifecycle_functions +++ b/spec/compilers/component_with_provider_and_lifecycle_functions @@ -34,62 +34,41 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({}); +import { + createProvider as B, + createElement as G, + useDidUpdate as F, + useEffect as E, + useId as D +} from "./runtime.js"; -const B = new(class extends _P { - constructor() { - super(); - this.state = {}; - } - - update() { - return null; - } -}); - -class C extends _C { - componentWillUnmount() { - B._unsubscribe(this); - return null; - } - - componentDidUpdate() { - if (false) { - B._subscribe(this, new A({ - moves: (a) => { - return null - }, - ups: (b) => { - return null - } - })) - } else { - B._unsubscribe(this) - }; - - return null; - } - - componentDidMount() { - if (false) { - B._subscribe(this, new A({ - moves: (a) => { +export const + a = new Map(), + A = B(a, () => { + return null + }), + C = () => { + const b = D(); + E(() => { + (() => { + return null + })(); + return () => { + return null + } + }, []); + F(() => { + return null + }); + A(b, () => { + return (false ? { + moves: (c) => { return null }, - ups: (b) => { + ups: (d) => { return null } - })) - } else { - B._unsubscribe(this) - }; - - return null; - } - - render() { - return _h("div", {}); - } -}; - -C.displayName = "Main"; + } : null) + }); + return G(`div`, {}) + }; diff --git a/spec/compilers/component_with_provider_and_store b/spec/compilers/component_with_provider_and_store index 37d45c867..75cfa0f77 100644 --- a/spec/compilers/component_with_provider_and_store +++ b/spec/compilers/component_with_provider_and_store @@ -32,84 +32,33 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({}); - -const B = new(class extends _P { - constructor() { - super(); - this.state = {}; - } - - update() { - return null; - } -}); - -class C extends _C { - get d() { - return D.c; - } - - f (...params) { return D.e(...params); } - - componentWillUnmount() { - D._unsubscribe(this); - B._unsubscribe(this); - } - - componentDidUpdate() { - if (false) { - B._subscribe(this, new A({ - moves: (a) => { - return null - }, - ups: (b) => { - return null - } - })) - } else { - B._unsubscribe(this) - }; - } - - componentDidMount() { - D._subscribe(this); - - if (false) { - B._subscribe(this, new A({ - moves: (a) => { +import { + createProvider as C, + createElement as F, + signal as A, + useId as E +} from "./runtime.js"; + +export const + a = new Map(), + b = () => { + return `hello` + }, + c = A(``), + B = C(a, () => { + return null + }), + D = () => { + const d = E(); + B(d, () => { + return (false ? { + moves: (e) => { return null }, - ups: (b) => { + ups: (f) => { return null } - })) - } else { - B._unsubscribe(this) - }; - } - - render() { - return _h("div", {}); - } -}; - -C.displayName = "Main"; - -const D = new(class extends _S { - constructor() { - super(); - - this.state = { - c: `` - }; - } - - get c() { - return this.state.c; - } - - e() { - return `hello`; - } -}); + } : null) + }); + return F(`div`, {}) + }; diff --git a/spec/compilers/constant_component b/spec/compilers/constant_component index 284faece9..22be68c2f 100644 --- a/spec/compilers/constant_component +++ b/spec/compilers/constant_component @@ -6,20 +6,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this._d({},{ - a: () => { - return `ASD` - } - }); - } - - render() { - return this.a; - } +export const A = () => { + const a = `ASD`; + return a }; - -A.displayName = "Main"; diff --git a/spec/compilers/constant_global_component b/spec/compilers/constant_global_component index 0d7f7a9cd..2f286b541 100644 --- a/spec/compilers/constant_global_component +++ b/spec/compilers/constant_global_component @@ -14,35 +14,13 @@ component Main { } } -------------------------------------------------------------------------------- -class $A extends _C { - constructor(props) { - super(props); - - this._d({},{ - a: () => { - return `ASD` - } - }); - } - - render() { - return this.a; - } - - _persist() { - A = this - } -}; - -$A.displayName = "Test"; -let A; - -class B extends _C { - render() { - return _h("div", {}, [ - A.a - ]); - } -}; - -B.displayName = "Main"; +import { createElement as C } from "./runtime.js"; + +export const + A = () => { + return a + }, + a = `ASD`, + B = () => { + return C(`div`, {}, [a]) + }; diff --git a/spec/compilers/constant_module b/spec/compilers/constant_module index 4b162515d..2957d19db 100644 --- a/spec/compilers/constant_module +++ b/spec/compilers/constant_module @@ -10,24 +10,11 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - constructor() { - super(); +import { createElement as B } from "./runtime.js"; - this._d({ - a: () => { - return `ASD` - } - }); - } -}); - -class A extends _C { - render() { - return _h("div", {}, [ - B.a - ]); - } -}; +export const + a = `ASD`, + A = () => { + return B(`div`, {}, [a]) + }; -A.displayName = "Main"; diff --git a/spec/compilers/constant_store b/spec/compilers/constant_store index 562b0c94f..c0dcfedc5 100644 --- a/spec/compilers/constant_store +++ b/spec/compilers/constant_store @@ -10,25 +10,11 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}, [ - B.a - ]); - } -}; - -A.displayName = "Main"; +import { createElement as B } from "./runtime.js"; -const B = new(class extends _S { - constructor() { - super(); - this.state = {}; +export const + a = `ASD`, + A = () => { + return B(`div`, {}, [a]) + }; - this._d({ - a: () => { - return `ASD` - } - }); - } -}); diff --git a/spec/compilers/constant_store_exposed b/spec/compilers/constant_store_exposed index 4840abb12..983dbddec 100644 --- a/spec/compilers/constant_store_exposed +++ b/spec/compilers/constant_store_exposed @@ -12,37 +12,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - get b() { - return B.a; - } - - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidMount() { - B._subscribe(this); - } +import { createElement as B } from "./runtime.js"; - render() { - return _h("div", {}, [ - this.a - ]); - } -}; - -A.displayName = "Main"; - -const B = new(class extends _S { - constructor() { - super(); - this.state = {}; - - this._d({ - a: () => { - return `ASD` - } - }); - } -}); +export const + a = `ASD`, + A = () => { + return B(`div`, {}, [a]) + }; diff --git a/spec/compilers/css_definition b/spec/compilers/css_definition index cde3f2843..bd72fb6bf 100644 --- a/spec/compilers/css_definition +++ b/spec/compilers/css_definition @@ -12,31 +12,30 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = { - [`--a-a`]: this.a + `px 0px` - }; - - return _; - } - - get a() { - return 10 - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { margin: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const + a = () => { + return 10 + }, + b = () => { + const _ = { + [`--a-a`]: a() + `px 0px` + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([b()]) + }) +}; diff --git a/spec/compilers/css_font_face b/spec/compilers/css_font_face index 13d2144bf..0d40aa332 100644 --- a/spec/compilers/css_font_face +++ b/spec/compilers/css_font_face @@ -17,17 +17,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `Main_test` - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- @font-face { src: url(sansation_light.woff); font-family: myFirstFont; @@ -38,4 +28,12 @@ _insertStyles(` font-family: myFirstFont; font-weight: bold; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const A = () => { + return B(`div`, { + className: `Main_test` + }) +}; diff --git a/spec/compilers/css_font_face_with_quotes b/spec/compilers/css_font_face_with_quotes index 2533cfe7b..379a60465 100644 --- a/spec/compilers/css_font_face_with_quotes +++ b/spec/compilers/css_font_face_with_quotes @@ -13,17 +13,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `Main_test` - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { font-family: "myFirstFont"; } @@ -32,4 +22,12 @@ _insertStyles(` src: url(sansation_light.woff); font-family: myFirstFont; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const A = () => { + return B(`div`, { + className: `Main_test` + }) +}; diff --git a/spec/compilers/css_keyframes b/spec/compilers/css_keyframes index 64d3473e9..eb807256d 100644 --- a/spec/compilers/css_keyframes +++ b/spec/compilers/css_keyframes @@ -28,38 +28,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - a: 1 - }); - } - - $Main_test() { - const _ = { - [`--a-a`]: this.a - }; - - return _; - } - - get a() { - return this.state.a; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- @keyframes animation { from { opacity: 0; @@ -79,4 +48,25 @@ _insertStyles(` opacity: 1; } } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(1), + b = () => { + const _ = { + [`--a-a`]: a.value + }; + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([b()]) + }) +}; diff --git a/spec/compilers/css_media b/spec/compilers/css_media index f677d586c..105687c2e 100644 --- a/spec/compilers/css_media +++ b/spec/compilers/css_media @@ -18,31 +18,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = { - [`--a-a`]: this.a, - [`--b-a`]: this.a - }; - - return _; - } - - get a() { - return `blue` - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test div { color: var(--a-a); } @@ -52,4 +28,27 @@ _insertStyles(` color: var(--b-a); } } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const + a = () => { + return `blue` + }, + b = () => { + const _ = { + [`--a-a`]: a(), + [`--b-a`]: a() + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([b()]) + }) +}; diff --git a/spec/compilers/css_media_with_if b/spec/compilers/css_media_with_if index c0cd784ca..a309f821a 100644 --- a/spec/compilers/css_media_with_if +++ b/spec/compilers/css_media_with_if @@ -14,28 +14,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; - - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : null); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { color: yellow; } @@ -45,4 +24,23 @@ _insertStyles(` color: var(--a-a); } } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = () => { + const _ = {}; + (true ? Object.assign(_, { + [`--a-a`]: `red` + }) : null); + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a()]) + }) +}; diff --git a/spec/compilers/css_selector b/spec/compilers/css_selector index 894b2a490..cb4e1cd3e 100644 --- a/spec/compilers/css_selector +++ b/spec/compilers/css_selector @@ -18,30 +18,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = { - [`--a-a`]: this.a - }; - - return _; - } - - get a() { - return `blue` - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test div { color: var(--a-a); } @@ -49,4 +26,26 @@ _insertStyles(` .Main_test:focus { color: red; } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const + a = () => { + return `blue` + }, + b = () => { + const _ = { + [`--a-a`]: a() + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([b()]) + }) +}; diff --git a/spec/compilers/css_selector_multiple b/spec/compilers/css_selector_multiple index 03e8b68f0..c56eeb3e6 100644 --- a/spec/compilers/css_selector_multiple +++ b/spec/compilers/css_selector_multiple @@ -19,30 +19,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = { - [`--a-a`]: this.a - }; - - return _; - } - - get a() { - return `blue` - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test div { color: var(--a-a); } @@ -54,4 +31,26 @@ _insertStyles(` .Main_test:hover { color: red; } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const + a = () => { + return `blue` + }, + b = () => { + const _ = { + [`--a-a`]: a() + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([b()]) + }) +}; diff --git a/spec/compilers/css_string b/spec/compilers/css_string index e0882adef..18848fa9c 100644 --- a/spec/compilers/css_string +++ b/spec/compilers/css_string @@ -14,41 +14,29 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - a: `Joe` - }); - } - - $Main_unicode() { - const _ = { - [`--a-a`]: `"Hi"` + ` blah ` + this.a + ` ` + `"Here is some content; Thanks ${this.a}"` - }; - - return _; - } - - get a() { - return this.state.a; - } - - render() { - return _h("div", { - className: `Main_unicode`, - style: _style([this.$Main_unicode()]) - }, [ - _h("span", {}) - ]); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_unicode span::after { content: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(`Joe`), + b = () => { + const _ = { + [`--a-a`]: `"Hi"` + ` blah ` + a.value + ` ` + `"Here is some content; Thanks ${a.value}"` + }; + return _ + }; + return C(`div`, { + className: `Main_unicode`, + style: D([b()]) + }, [C(`span`, {})]) +}; diff --git a/spec/compilers/css_supports b/spec/compilers/css_supports index 824a44f13..18c78c620 100644 --- a/spec/compilers/css_supports +++ b/spec/compilers/css_supports @@ -12,41 +12,31 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - a: `blue` - }); - } - - $Main_test() { - const _ = { - [`--a-a`]: this.a - }; - - return _; - } - - get a() { - return this.state.a; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- @supports (screen) { .Main_test { color: var(--a-a); } } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(`blue`), + b = () => { + const _ = { + [`--a-a`]: a.value + }; + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([b()]) + }) +}; diff --git a/spec/compilers/css_with_ands b/spec/compilers/css_with_ands index d1b2c41ac..c7ed74e87 100644 --- a/spec/compilers/css_with_ands +++ b/spec/compilers/css_with_ands @@ -18,17 +18,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `Main_test` - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test:focus { color: red; } @@ -40,4 +30,12 @@ _insertStyles(` .Main_test.someclass { color: red; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const A = () => { + return B(`div`, { + className: `Main_test` + }) +}; diff --git a/spec/compilers/css_with_arguments b/spec/compilers/css_with_arguments index ef663a97d..da0f4deec 100644 --- a/spec/compilers/css_with_arguments +++ b/spec/compilers/css_with_arguments @@ -8,27 +8,26 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test(a) { - const _ = { - [`--a-a`]: a - }; - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test(`red`)]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { color: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = (b) => { + const _ = { + [`--a-a`]: b + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a(`red`)]) + }) +}; diff --git a/spec/compilers/css_with_case b/spec/compilers/css_with_case index b0e881a1d..b3154b5dd 100644 --- a/spec/compilers/css_with_case +++ b/spec/compilers/css_with_case @@ -16,11 +16,22 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_test { + color: var(--a-a, yellow); +} - _match(`a`,[ +---=== /__mint__/index.js ===--- +import { + createElement as C, + style as D, + match as B +} from "./runtime.js"; + +export const A = () => { + const a = () => { + const _ = {}; + B(`a`, [ [ `a`, () => { @@ -38,22 +49,10 @@ class A extends _C { } ] ]); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([a()]) + }) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_test { - color: var(--a-a, yellow); -} -`); diff --git a/spec/compilers/css_with_else_if b/spec/compilers/css_with_else_if index e6bc7f97e..2579ad24d 100644 --- a/spec/compilers/css_with_else_if +++ b/spec/compilers/css_with_else_if @@ -17,34 +17,31 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_base(a) { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_base { + height: 20px; + background: var(--a-a); +} - (_compare(a, `red`) ? Object.assign(_, { +---=== /__mint__/index.js ===--- +import { + createElement as C, + compare as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const a = (b) => { + const _ = {}; + (B(b, `red`) ? Object.assign(_, { [`--a-a`]: `red` - }) : (_compare(a, `blue`) ? Object.assign(_, { + }) : (B(b, `blue`) ? Object.assign(_, { [`--a-a`]: `blue` }) : null)); - - return _; - } - - render() { - return _h("div", {}, [ - _h("div", { - className: `Main_base`, - style: _style([this.$Main_base(`blue`)]) - }) - ]); - } + return _ + }; + return C(`div`, {}, [C(`div`, { + className: `Main_base`, + style: D([a(`blue`)]) + })]) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_base { - height: 20px; - background: var(--a-a); -} -`); diff --git a/spec/compilers/css_with_if b/spec/compilers/css_with_if index 5359ae556..4ef9ba40c 100644 --- a/spec/compilers/css_with_if +++ b/spec/compilers/css_with_if @@ -14,31 +14,29 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_test { + color: var(--a-a, yellow); +} +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = () => { + const _ = {}; (true ? Object.assign(_, { [`--a-a`]: `red` }) : Object.assign(_, { [`--a-a`]: `blue` })); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a()]) + }) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_test { - color: var(--a-a, yellow); -} -`); diff --git a/spec/compilers/css_with_if_and_case b/spec/compilers/css_with_if_and_case index d7875d1ba..912338228 100644 --- a/spec/compilers/css_with_if_and_case +++ b/spec/compilers/css_with_if_and_case @@ -19,11 +19,22 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_test { + color: var(--a-a, yellow); +} - _match(true,[ +---=== /__mint__/index.js ===--- +import { + createElement as C, + style as D, + match as B +} from "./runtime.js"; + +export const A = () => { + const a = () => { + const _ = {}; + B(true, [ [ true, () => { @@ -41,28 +52,15 @@ class A extends _C { } ] ]); - (true ? Object.assign(_, { [`--a-a`]: `red` }) : Object.assign(_, { [`--a-a`]: `blue` })); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([a()]) + }) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_test { - color: var(--a-a, yellow); -} -`); diff --git a/spec/compilers/css_with_if_same_condition b/spec/compilers/css_with_if_same_condition index 9400b70ee..b470533b5 100644 --- a/spec/compilers/css_with_if_same_condition +++ b/spec/compilers/css_with_if_same_condition @@ -22,41 +22,38 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_test .tag { + color: var(--a-a); +} + +.Main_test .string { + color: var(--b-a); +} + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; +export const A = () => { + const a = () => { + const _ = {}; (true ? Object.assign(_, { [`--a-a`]: `red` }) : Object.assign(_, { [`--a-a`]: `blue` })); - (true ? Object.assign(_, { [`--b-a`]: `yellow` }) : Object.assign(_, { [`--b-a`]: `cyan` })); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a()]) + }) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_test .tag { - color: var(--a-a); -} - -.Main_test .string { - color: var(--b-a); -} -`); diff --git a/spec/compilers2/css_with_if_variables b/spec/compilers/css_with_if_variables similarity index 100% rename from spec/compilers2/css_with_if_variables rename to spec/compilers/css_with_if_variables diff --git a/spec/compilers/css_with_if_with_interpolation b/spec/compilers/css_with_if_with_interpolation index 7e70b4bf9..54a2e3500 100644 --- a/spec/compilers/css_with_if_with_interpolation +++ b/spec/compilers/css_with_if_with_interpolation @@ -14,31 +14,29 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test() { - const _ = {}; +---=== /__mint__/index.css ===--- +.Main_test { + color: var(--a-a, yellow); +} +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = () => { + const _ = {}; (true ? Object.assign(_, { [`--a-a`]: `red` }) : Object.assign(_, { [`--a-a`]: `blue` })); - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a()]) + }) }; - -A.displayName = "Main"; - -_insertStyles(` -.Main_test { - color: var(--a-a, yellow); -} -`); diff --git a/spec/compilers/dce_remove_component_computed_property b/spec/compilers/dce_remove_component_computed_property index 70322d3f2..4313d58e8 100644 --- a/spec/compilers/dce_remove_component_computed_property +++ b/spec/compilers/dce_remove_component_computed_property @@ -8,10 +8,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}) +}; diff --git a/spec/compilers/dce_remove_component_function b/spec/compilers/dce_remove_component_function index 28cd03654..b7e25d8a6 100644 --- a/spec/compilers/dce_remove_component_function +++ b/spec/compilers/dce_remove_component_function @@ -8,10 +8,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}) +}; diff --git a/spec/compilers/dce_remove_module_function b/spec/compilers/dce_remove_module_function index 4e782b251..1660281fc 100644 --- a/spec/compilers/dce_remove_module_function +++ b/spec/compilers/dce_remove_module_function @@ -14,16 +14,10 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - a() { - return ``; - } -}); - -class A extends _C { - render() { - return B.a(); - } -}; - -A.displayName = "Main"; +export const + a = () => { + return `` + }, + A = () => { + return a() + }; diff --git a/spec/compilers/dce_remove_provider b/spec/compilers/dce_remove_provider index e1b107f6b..b4a62740e 100644 --- a/spec/compilers/dce_remove_provider +++ b/spec/compilers/dce_remove_provider @@ -8,9 +8,3 @@ provider MouseProvider : Subscription { } } -------------------------------------------------------------------------------- -const A = _R({ - name: [ - "name", - Decoder.string - ] -}); diff --git a/spec/compilers/dce_style b/spec/compilers/dce_style index 4ba592246..278f4f988 100644 --- a/spec/compilers/dce_style +++ b/spec/compilers/dce_style @@ -8,10 +8,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}) +}; diff --git a/spec/compilers/decode b/spec/compilers/decode index 1e76ab71a..027759c6f 100644 --- a/spec/compilers/decode +++ b/spec/compilers/decode @@ -1,3 +1,8 @@ +type Result(error, value) { + Err(error) + Ok(value) +} + type X.Y { blah : String } @@ -8,45 +13,30 @@ type X { } component Main { - fun x (input : Object) : Result(Object.Error, x) { - decode input as X - } - fun render : String { - x(``) + decode `null` as Object as X "" } } -------------------------------------------------------------------------------- -const A = _R({ - blah: [ - "blah", - Decoder.string - ] -}); - -const B = _R({ - name: [ - "name", - Decoder.string - ], - y: [ - "y", - ((_)=>A.decode(_)), - ((_)=>A.encode(_)) - ] -}); - -class C extends _C { - a(b) { - return ((_)=>B.decode(_))(b); - } - - render() { - this.a(); - return ``; - } -}; - -C.displayName = "Main"; +import { + decodeString as E, + decoder as D, + variant as B +} from "./runtime.js"; + +export const + A = B(1), + C = B(1), + a = D({ + blah: E(C, A) + }, C, A), + b = D({ + name: E(C, A), + y: a + }, C, A), + F = () => { + b((null)); + return `` + }; diff --git a/spec/compilers/decode_function b/spec/compilers/decode_function index 4c7d96ff1..824734bac 100644 --- a/spec/compilers/decode_function +++ b/spec/compilers/decode_function @@ -1,3 +1,8 @@ +type Result(error, value) { + Err(error) + Ok(value) +} + type X.Y { blah : String } @@ -9,36 +14,29 @@ type X { component Main { fun render : String { - (decode as X)(``) + (decode as X)(`null`) "" } } -------------------------------------------------------------------------------- -const A = _R({ - blah: [ - "blah", - Decoder.string - ] -}); - -const B = _R({ - name: [ - "name", - Decoder.string - ], - y: [ - "y", - ((_)=>A.decode(_)), - ((_)=>A.encode(_)) - ] -}); - -class C extends _C { - render() { - (((_)=>((_)=>B.decode(_))(_)))(); - return ``; - } -}; +import { + decodeString as E, + decoder as D, + variant as B +} from "./runtime.js"; -C.displayName = "Main"; +export const + A = B(1), + C = B(1), + a = D({ + blah: E(C, A) + }, C, A), + b = D({ + name: E(C, A), + y: a + }, C, A), + F = () => { + (b)((null)); + return `` + }; diff --git a/spec/compilers/decode_map b/spec/compilers/decode_map index c810fcb59..5b42bd6e9 100644 --- a/spec/compilers/decode_map +++ b/spec/compilers/decode_map @@ -1,3 +1,8 @@ +type Result(error, value) { + Err(error) + Ok(value) +} + component Main { fun render : String { decode (`[]`) as Map(String, Number) @@ -6,11 +11,16 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - Decoder.map(Decoder.number)((([]))); - return ``; - } -}; +import { + decodeNumber as F, + decodeMap as E, + variant as B +} from "./runtime.js"; -A.displayName = "Main"; +export const + A = B(1), + C = B(1), + D = () => { + E(F(C, A), C, A)((([]))); + return `` + }; diff --git a/spec/compilers/decode_tuple b/spec/compilers/decode_tuple index 979ac7e9a..ec12d75e8 100644 --- a/spec/compilers/decode_tuple +++ b/spec/compilers/decode_tuple @@ -1,3 +1,8 @@ +type Result(error, value) { + Err(error) + Ok(value) +} + component Main { fun render : String { decode (`[]`) as Tuple(String, Number, String) @@ -6,11 +11,21 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - Decoder.tuple([Decoder.string,Decoder.number,Decoder.string])((([]))); - return ``; - } -}; +import { + decodeNumber as G, + decodeString as F, + decodeTuple as E, + variant as B +} from "./runtime.js"; -A.displayName = "Main"; +export const + A = B(1), + C = B(1), + D = () => { + E([ + F(C, A), + G(C, A), + F(C, A) + ], C, A)((([]))); + return `` + }; diff --git a/spec/compilers/decoder b/spec/compilers/decoder index 5f10b3227..b92ae10e7 100644 --- a/spec/compilers/decoder +++ b/spec/compilers/decoder @@ -1,80 +1,66 @@ +type Result(error, value) { + Err(error) + Ok(value) +} + +type Maybe(a) { + Just(a) + Nothing +} + type Y { size : Number using "SIIIZEEE" } type X { + maybe : Maybe(String), + array : Array(String), string : String, number : Number, bool : Bool, time : Time, - maybe : Maybe(String), - array : Array(String), y : Y } component Main { - fun x (input : Object) : Result(Object.Error, x) { - decode input as X - } - fun render : String { - x(``) - + decode `` as Object as X "" } } -------------------------------------------------------------------------------- -const A = _R({ - size: [ - "SIIIZEEE", - Decoder.number - ] -}); - -const B = _R({ - string: [ - "string", - Decoder.string - ], - number: [ - "number", - Decoder.number - ], - bool: [ - "bool", - Decoder.boolean - ], - time: [ - "time", - Decoder.time, - Encoder.time - ], - maybe: [ - "maybe", - Decoder.maybe(Decoder.string), - Encoder.maybe() - ], - array: [ - "array", - Decoder.array(Decoder.string), - Encoder.array() - ], - y: [ - "y", - ((_)=>A.decode(_)), - ((_)=>A.encode(_)) - ] -}); - -class C extends _C { - a(b) { - return ((_)=>B.decode(_))(b); - } - - render() { - this.a(); - return ``; - } -}; +import { + decodeBoolean as K, + decodeString as I, + decodeNumber as G, + decodeArray as J, + decodeMaybe as H, + decodeTime as L, + decoder as F, + variant as B +} from "./runtime.js"; -C.displayName = "Main"; +export const + A = B(1), + C = B(0), + D = B(1), + E = B(1), + a = F({ + size: [ + G(E, D), + "SIIIZEEE" + ] + }, E, D), + b = F({ + maybe: H(I(E, D), E, D, A, C), + array: J(I(E, D), E, D), + string: I(E, D), + number: G(E, D), + bool: K(E, D), + time: L(E, D), + y: a + }, E, D), + M = () => { + b(undefined); + return `` + }; diff --git a/spec/compilers2/defer b/spec/compilers/defer similarity index 100% rename from spec/compilers2/defer rename to spec/compilers/defer diff --git a/spec/compilers2/defer_2 b/spec/compilers/defer_2 similarity index 100% rename from spec/compilers2/defer_2 rename to spec/compilers/defer_2 diff --git a/spec/compilers/destructuring b/spec/compilers/destructuring index be48dfb6a..02d4e1a7c 100644 --- a/spec/compilers/destructuring +++ b/spec/compilers/destructuring @@ -7,71 +7,52 @@ type Test { } component Main { - fun content (item : Test) : String { - case item { - Test.Item(content) => content - Test.None => "" - } - } - fun render : String { - content( + let item = Test.Item( matchString: "MATCHSTRING", content: "CONTENT", - key: "KEY")) + key: "KEY") + + case item { + Test.Item(_, content) => content + Test.None => "" + } } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0, _1, _2) { - super(); - this._0 = _0; - this._1 = _1; - this._2 = _2; - this.length = 3; +import { + patternVariable as H, + newVariant as E, + pattern as G, + variant as B, + match as F +} from "./runtime.js"; - this._mapping = { - matchString: "_0", - content: "_1", - key: "_2" - }; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class C extends _C { - a(b) { - return _match(b,[ +export const + A = B([ + "matchString", + "content", + "key" + ]), + C = B(0), + D = () => { + const a = E(A)(`MATCHSTRING`, `CONTENT`, `KEY`); + return F(a, [ [ - _PE(A,_PR([ - [ - "content", - _PV - ] - ])), - (c) => { - return c + G(A, [ + null, + H + ]), + (b) => { + return b } ], [ - _PE(B,[]), + G(C, []), () => { return `` } ] - ]); - } - - render() { - return this.a(_n(A)(`MATCHSTRING`, `CONTENT`, `KEY`)); - } -}; - -C.displayName = "Main"; + ]) + }; diff --git a/spec/compilers2/destructuring_constant b/spec/compilers/destructuring_constant similarity index 100% rename from spec/compilers2/destructuring_constant rename to spec/compilers/destructuring_constant diff --git a/spec/compilers2/destructuring_state b/spec/compilers/destructuring_state similarity index 100% rename from spec/compilers2/destructuring_state rename to spec/compilers/destructuring_state diff --git a/spec/compilers/directives/asset b/spec/compilers/directives/asset index 367c2e0f9..af918d403 100644 --- a/spec/compilers/directives/asset +++ b/spec/compilers/directives/asset @@ -4,10 +4,12 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `/__mint__/icon_c97b81630bc53286dadc8996727d348e.svg`; - } +---=== /__mint__/index.js ===--- +export const A = () => { + return `/__mint__/icon_c97b81630bc53286dadc8996727d348e.svg` }; -A.displayName = "Main"; +---=== /__mint__/icon_c97b81630bc53286dadc8996727d348e.svg ===--- + + + diff --git a/spec/compilers/directives/documentation b/spec/compilers/directives/documentation index 70372e814..e0f781118 100644 --- a/spec/compilers/directives/documentation +++ b/spec/compilers/directives/documentation @@ -6,11 +6,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - {"description":null,"name":"Main","connects":[],"computed-properties":[],"properties":[],"functions":[{"type":"String","description":null,"name":"render","source":"fun render : String {\n @documentation(Main)\n\n \"Hello There\"\n}","arguments":[]}],"providers":[],"states":[]}; - return `Hello There`; - } +export const A = () => { + {"description":null,"name":"Main","connects":[],"computed-properties":[],"properties":[],"functions":[{"type":"String","description":null,"name":"render","source":"fun render : String {\n @documentation(Main)\n\n \"Hello There\"\n}","arguments":[]}],"providers":[],"states":[]}; + return `Hello There` }; - -A.displayName = "Main"; diff --git a/spec/compilers/directives/format b/spec/compilers/directives/format index bebbec384..4907c73bb 100644 --- a/spec/compilers/directives/format +++ b/spec/compilers/directives/format @@ -10,11 +10,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const [a,b] = [`HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello`, `"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello"`]; - return a + b; - } +export const A = () => { + const [ + a, + b + ] = [ + `HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello`, + `"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello"` + ]; + return a + b }; - -A.displayName = "Main"; diff --git a/spec/compilers/directives/highlight b/spec/compilers/directives/highlight index 943124de4..d84cc1219 100644 --- a/spec/compilers/directives/highlight +++ b/spec/compilers/directives/highlight @@ -6,10 +6,18 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return [`Test`, _h(React.Fragment, {}, [_h('span', { className: 'string' }, [`"Test"`])])][1]; - } -}; +import { + createElement as B, + fragment as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return [ + `Test`, + B(C, {}, [B("span", { + className: "line" + }, [B("span", { + className: "string" + }, [`"Test"`])])]) + ][1] +}; diff --git a/spec/compilers/directives/highlight-file b/spec/compilers/directives/highlight-file index 4a79d80d1..2d16a9615 100644 --- a/spec/compilers/directives/highlight-file +++ b/spec/compilers/directives/highlight-file @@ -4,26 +4,60 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h(React.Fragment, {}, [_h('span', { className: 'keyword' }, [`component`]), - ` `, - _h('span', { className: 'type' }, [`Main`]), - ` { - `, - _h('span', { className: 'keyword' }, [`fun`]), - ` render : `, - _h('span', { className: 'type' }, [`Html`]), - ` { - <`, - _h('span', { className: 'namespace' }, [`div`]), - `> - } -} -`]); - } -}; +import { + createElement as B, + fragment as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(C, {}, [ + B("span", { + className: "line" + }, [ + B("span", { + className: "keyword" + }, [`component`]), + ` `, + B("span", { + className: "type" + }, [`Main`]), + ` { +` + ]), + B("span", { + className: "line" + }, [ + ` `, + B("span", { + className: "keyword" + }, [`fun`]), + ` render : `, + B("span", { + className: "type" + }, [`Html`]), + ` { +` + ]), + B("span", { + className: "line" + }, [ + ` <`, + B("span", { + className: "namespace" + }, [`div`]), + `> +` + ]), + B("span", { + className: "line" + }, [` } +`]), + B("span", { + className: "line" + }, [`}`]) + ]) +}; diff --git a/spec/compilers2/directives/inline b/spec/compilers/directives/inline similarity index 100% rename from spec/compilers2/directives/inline rename to spec/compilers/directives/inline diff --git a/spec/compilers/directives/svg b/spec/compilers/directives/svg index 20adef446..b29598232 100644 --- a/spec/compilers/directives/svg +++ b/spec/compilers/directives/svg @@ -4,12 +4,17 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return $a(); - } -}; - -A.displayName = "Main"; +import { createElement as A } from "./runtime.js"; -const $a = _m(() => _h('svg', { width: '24', height: '24', viewBox: '0 0 24 24', dangerouslySetInnerHTML: { __html: `` }})); +export const + a = A(`svg`, { + dangerouslySetInnerHTML: { + __html: `` + }, + viewBox: `0 0 24 24`, + height: `24`, + width: `24` + }), + B = () => { + return a + }; diff --git a/spec/compilers/encode b/spec/compilers/encode index 70152e283..8998765c2 100644 --- a/spec/compilers/encode +++ b/spec/compilers/encode @@ -4,40 +4,27 @@ type Test { } component Main { - fun test : Object { - encode { name: "Hello", age: 20 } - } - fun render : String { - test() + encode { name: "Hello", age: 20 } "" } } -------------------------------------------------------------------------------- -const A = _R({ - name: [ - "name", - Decoder.string - ], - age: [ - "age", - Decoder.number - ] -}); +import { + identity as B, + encoder as A +} from "./runtime.js"; -class B extends _C { - a() { - return ((_)=>A.encode(_))(new A({ +export const + a = A({ + name: B, + age: B + }), + C = () => { + a({ name: `Hello`, age: 20 - })); - } - - render() { - this.a(); - return ``; - } -}; - -B.displayName = "Main"; + }); + return `` + }; diff --git a/spec/compilers2/encode_nested b/spec/compilers/encode_nested similarity index 100% rename from spec/compilers2/encode_nested rename to spec/compilers/encode_nested diff --git a/spec/compilers2/encode_no_record b/spec/compilers/encode_no_record similarity index 100% rename from spec/compilers2/encode_no_record rename to spec/compilers/encode_no_record diff --git a/spec/compilers2/encode_with_mapping b/spec/compilers/encode_with_mapping similarity index 100% rename from spec/compilers2/encode_with_mapping rename to spec/compilers/encode_with_mapping diff --git a/spec/compilers2/encoder_and_decoder b/spec/compilers/encoder_and_decoder similarity index 100% rename from spec/compilers2/encoder_and_decoder rename to spec/compilers/encoder_and_decoder diff --git a/spec/compilers/env b/spec/compilers/env index 341ee6805..ed8ec9192 100644 --- a/spec/compilers/env +++ b/spec/compilers/env @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `TRUE`; - } +export const A = () => { + return `TRUE` }; - -A.displayName = "Main"; diff --git a/spec/compilers/field b/spec/compilers/field index 83200c435..fa3afe1d4 100644 --- a/spec/compilers/field +++ b/spec/compilers/field @@ -4,43 +4,22 @@ type Test { } component Main { - fun test : Test { + fun render : Html { { a: "Hello", b: 0 } - } - - fun render : Html { - test()
} } -------------------------------------------------------------------------------- -const A = _R({ - a: [ - "a", - Decoder.string - ], - b: [ - "b", - Decoder.number - ] -}); +import { createElement as B } from "./runtime.js"; -class B extends _C { - a() { - return new A({ - a: `Hello`, - b: 0 - }); - } - - render() { - this.a(); - return _h("div", {}); - } +export const A = () => { + { + a: `Hello`, + b: 0 + }; + return B(`div`, {}) }; - -B.displayName = "Main"; diff --git a/spec/compilers/field_access b/spec/compilers/field_access index fbaa79a7d..d71b54574 100644 --- a/spec/compilers/field_access +++ b/spec/compilers/field_access @@ -24,29 +24,20 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({ - name: [ - "name", - Decoder.string - ] -}); +import { access as B } from "./runtime.js"; -const C = new(class extends _M { - a(b, c) { - return; - } -}); - -class B extends _C { - render() { - C.a([new A({ - name: `Joe` - }), new A({ - name: `Doe` - })], ((_) => _.name)); - - return `asd`; - } -}; - -B.displayName = "Main"; +export const + a = (b, c) => { + return undefined + }, + A = () => { + a([ + { + name: `Joe` + }, + { + name: `Doe` + } + ], B(`name`)); + return `asd` + }; diff --git a/spec/compilers/for b/spec/compilers/for index 2dcd7d551..22d344709 100644 --- a/spec/compilers/for +++ b/spec/compilers/for @@ -8,24 +8,20 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return (() => { - const _0 = []; - const _1 = [`A`, `B`]; - let _i = -1; +import { createElement as B } from "./runtime.js"; - for (let a of _1) { - _i++; - - _0.push(_h("div", {}, [ - a - ])); - }; - - return _0; - })(); - } +export const A = () => { + return (() => { + const _0 = []; + const _1 = [ + `A`, + `B` + ]; + let _i = -1; + for (let a of _1) { + _i++; + _0.push(B(`div`, {}, [a])) + }; + return _0 + })() }; - -A.displayName = "Main"; diff --git a/spec/compilers2/for_with_destructuring b/spec/compilers/for_with_destructuring similarity index 100% rename from spec/compilers2/for_with_destructuring rename to spec/compilers/for_with_destructuring diff --git a/spec/compilers/for_with_index b/spec/compilers/for_with_index index 6ca9221a4..1b1e470ec 100644 --- a/spec/compilers/for_with_index +++ b/spec/compilers/for_with_index @@ -10,28 +10,28 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return (() => { - const _0 = []; - const _1 = [`A`, `B`]; - let _i = -1; +import { + createElement as C, + compare as B +} from "./runtime.js"; - for (let a of _1) { - _i++; - const b = _i; - - const _2 = _compare(b, 10) - if (!_2) { continue }; - - _0.push(_h("div", {}, [ - a - ])); +export const A = () => { + return (() => { + const _0 = []; + const _1 = [ + `A`, + `B` + ]; + let _i = -1; + for (let a of _1) { + _i++; + const b = _i; + const _2 = B(b, 10); + if (!_2) { + continue }; - - return _0; - })(); - } + _0.push(C(`div`, {}, [a])) + }; + return _0 + })() }; - -A.displayName = "Main"; diff --git a/spec/compilers/for_with_index_2 b/spec/compilers/for_with_index_2 index 7557e890f..3cb443082 100644 --- a/spec/compilers/for_with_index_2 +++ b/spec/compilers/for_with_index_2 @@ -8,25 +8,21 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return (() => { - const _0 = []; - const _1 = [`A`, `B`]; - let _i = -1; +import { createElement as B } from "./runtime.js"; - for (let a of _1) { - _i++; - const b = _i; - - _0.push(_h("div", {}, [ - a - ])); - }; - - return _0; - })(); - } +export const A = () => { + return (() => { + const _0 = []; + const _1 = [ + `A`, + `B` + ]; + let _i = -1; + for (let a of _1) { + _i++; + const b = _i; + _0.push(B(`div`, {}, [a])) + }; + return _0 + })() }; - -A.displayName = "Main"; diff --git a/spec/compilers/function b/spec/compilers/function index 34982465d..818cf7f9b 100644 --- a/spec/compilers/function +++ b/spec/compilers/function @@ -10,16 +10,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return true; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + const a = () => { + return true + }; + a(); + return `` }; - -A.displayName = "Main"; - diff --git a/spec/compilers/function_call_simple b/spec/compilers/function_call_simple index 169d5042c..bd1275c9c 100644 --- a/spec/compilers/function_call_simple +++ b/spec/compilers/function_call_simple @@ -14,19 +14,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return `test`; - } - - b() { - return this.a(); - } - - render() { - this.b(); - return ``; - } +export const A = () => { + const + a = () => { + return `test` + }, + b = () => { + return a() + }; + b(); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/function_call_with_arguments b/spec/compilers/function_call_with_arguments index 048a21e6e..9188dc239 100644 --- a/spec/compilers/function_call_with_arguments +++ b/spec/compilers/function_call_with_arguments @@ -14,20 +14,15 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a(b, c) { - return c; - } - - d() { - return this.a(`Hello`, true); - } - - render() { - this.d(); - return ``; - } +export const A = () => { + const + a = (b, c) => { + return c + }, + d = () => { + return a(`Hello`, true) + }; + d(); + return `` }; -A.displayName = "Main"; - diff --git a/spec/compilers/get b/spec/compilers/get index 0f34adc78..54aa99bc6 100644 --- a/spec/compilers/get +++ b/spec/compilers/get @@ -8,14 +8,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - get a() { +export const A = () => { + const a = () => { return `` - } - - render() { - return this.a; - } + }; + return a() }; - -A.displayName = "Main"; diff --git a/spec/compilers/here_doc_markdown b/spec/compilers/here_doc_markdown index ceafda103..05f5b8b24 100644 --- a/spec/compilers/here_doc_markdown +++ b/spec/compilers/here_doc_markdown @@ -8,10 +8,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h(React.Fragment,{},[_h('h2',{},[`Hello There`]),_h('p',{},[`WTF`])]); - } -}; +import { + createElement as B, + fragment as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(C, {}, [ + B('h2', {}, [`Hello There`]), + B('p', {}, [`WTF`]) + ]) +}; diff --git a/spec/compilers2/here_doc_markdown_escape b/spec/compilers/here_doc_markdown_escape similarity index 100% rename from spec/compilers2/here_doc_markdown_escape rename to spec/compilers/here_doc_markdown_escape diff --git a/spec/compilers2/here_doc_markdown_in_markdown b/spec/compilers/here_doc_markdown_in_markdown similarity index 100% rename from spec/compilers2/here_doc_markdown_in_markdown rename to spec/compilers/here_doc_markdown_in_markdown diff --git a/spec/compilers2/here_doc_markdown_with_code_block b/spec/compilers/here_doc_markdown_with_code_block similarity index 100% rename from spec/compilers2/here_doc_markdown_with_code_block rename to spec/compilers/here_doc_markdown_with_code_block diff --git a/spec/compilers2/here_doc_markdown_with_code_block_interpolation b/spec/compilers/here_doc_markdown_with_code_block_interpolation similarity index 100% rename from spec/compilers2/here_doc_markdown_with_code_block_interpolation rename to spec/compilers/here_doc_markdown_with_code_block_interpolation diff --git a/spec/compilers2/here_doc_markdown_with_code_block_interpolation_highlight b/spec/compilers/here_doc_markdown_with_code_block_interpolation_highlight similarity index 100% rename from spec/compilers2/here_doc_markdown_with_code_block_interpolation_highlight rename to spec/compilers/here_doc_markdown_with_code_block_interpolation_highlight diff --git a/spec/compilers2/here_doc_markdown_with_code_block_multiline b/spec/compilers/here_doc_markdown_with_code_block_multiline similarity index 100% rename from spec/compilers2/here_doc_markdown_with_code_block_multiline rename to spec/compilers/here_doc_markdown_with_code_block_multiline diff --git a/spec/compilers2/here_doc_markdown_with_html_interpolation b/spec/compilers/here_doc_markdown_with_html_interpolation similarity index 100% rename from spec/compilers2/here_doc_markdown_with_html_interpolation rename to spec/compilers/here_doc_markdown_with_html_interpolation diff --git a/spec/compilers2/here_doc_markdown_with_inline_code b/spec/compilers/here_doc_markdown_with_inline_code similarity index 100% rename from spec/compilers2/here_doc_markdown_with_inline_code rename to spec/compilers/here_doc_markdown_with_inline_code diff --git a/spec/compilers/here_doc_markdown_with_interpolation b/spec/compilers/here_doc_markdown_with_interpolation index f0df49794..25a697a3b 100644 --- a/spec/compilers/here_doc_markdown_with_interpolation +++ b/spec/compilers/here_doc_markdown_with_interpolation @@ -8,13 +8,22 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h(React.Fragment,{},[_h('h2',{},[`Hello There`]),_h('p',{},[_h("div", {}, [ - `Hello` -]),` -`,`World`,`!`])]); - } -}; +import { + createElement as B, + fragment as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(C, {}, [ + B('h2', {}, [`Hello There`]), + B('p', {}, [ + ``, + B(`div`, {}, [`Hello`]), + ``, + ` +`, + `World`, + `!` + ]) + ]) +}; diff --git a/spec/compilers2/here_doc_new_line_char b/spec/compilers/here_doc_new_line_char similarity index 100% rename from spec/compilers2/here_doc_new_line_char rename to spec/compilers/here_doc_new_line_char diff --git a/spec/compilers/here_doc_with_interpolation b/spec/compilers/here_doc_with_interpolation index 8cb5ac929..96d8db68c 100644 --- a/spec/compilers/here_doc_with_interpolation +++ b/spec/compilers/here_doc_with_interpolation @@ -9,13 +9,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return ` Hello There! +export const A = () => { + return ` Hello There! ${`interpolation`} This line should be indented by 2 spaces. - This line should be indented by 4 spaces.`; - } + This line should be indented by 4 spaces.` }; - -A.displayName = "Main"; diff --git a/spec/compilers/here_doc_without_indentation b/spec/compilers/here_doc_without_indentation index f3833b3e0..52cc1dde9 100644 --- a/spec/compilers/here_doc_without_indentation +++ b/spec/compilers/here_doc_without_indentation @@ -8,12 +8,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There! +export const A = () => { + return `Hello There! This line should be indented by 2 spaces. - This line should be indented by 4 spaces.`; - } + This line should be indented by 4 spaces.` }; - -A.displayName = "Main"; diff --git a/spec/compilers/html_attribute_class b/spec/compilers/html_attribute_class index 17259cdf8..7a7780962 100644 --- a/spec/compilers/html_attribute_class +++ b/spec/compilers/html_attribute_class @@ -5,12 +5,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `something` - }); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, { + className: `something` + }) +}; diff --git a/spec/compilers/html_attribute_class_with_style b/spec/compilers/html_attribute_class_with_style index 623eecfd0..b0ffe2c6c 100644 --- a/spec/compilers/html_attribute_class_with_style +++ b/spec/compilers/html_attribute_class_with_style @@ -9,18 +9,16 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `something` + ` Main_base` - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_base { width: 100%; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const A = () => { + return B(`div`, { + className: `something` + ` Main_base` + }) +}; diff --git a/spec/compilers/html_attribute_html_fragment b/spec/compilers/html_attribute_html_fragment index 39cefe537..cbc9584a8 100644 --- a/spec/compilers/html_attribute_html_fragment +++ b/spec/compilers/html_attribute_html_fragment @@ -12,33 +12,16 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); +import { createElement as B } from "./runtime.js"; - this._d({ - a: [ - null, - null - ] - }); - } - - render() { - return _h("div", {}); - } -}; - -A.displayName = "Thing"; - -class B extends _C { - render() { - return _h(A, { - a: _h(React.Fragment, {}, [ - `x` - ]) - }); - } -}; - -B.displayName = "Main"; +export const + A = ({ + a = null + }) => { + return B(`div`, {}) + }, + C = () => { + return B(A, { + a: `x` + }) + }; diff --git a/spec/compilers/html_attribute_readonly b/spec/compilers/html_attribute_readonly index e091dd70f..e2ec4c2ef 100644 --- a/spec/compilers/html_attribute_readonly +++ b/spec/compilers/html_attribute_readonly @@ -4,13 +4,10 @@ component Main {
} } --------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - readOnly: true - }); - } -}; +--------------------------------------------------------------------------------import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, { + readOnly: true + }) +}; diff --git a/spec/compilers/html_attribute_ref b/spec/compilers/html_attribute_ref index afd5c48a4..4569c3e4e 100644 --- a/spec/compilers/html_attribute_ref +++ b/spec/compilers/html_attribute_ref @@ -10,31 +10,20 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; +import { + createElement as F, + variant as B, + setRef as G, + useRef as E +} from "./runtime.js"; -class C extends _C { - get a() { - return (this._input ? new A(this._input) : new B); - } - - render() { - return _h("div", { - ref: (element) => { this._input = element } - }); - } -}; +export const + A = B(1), + C = B(0), + D = () => { + const a = E(new C()); + return F(`div`, { + ref: G(a, A) + }) + }; -C.displayName = "Main"; diff --git a/spec/compilers/html_attribute_simple b/spec/compilers/html_attribute_simple index 26f17c858..0f80d1280 100644 --- a/spec/compilers/html_attribute_simple +++ b/spec/compilers/html_attribute_simple @@ -5,12 +5,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - "title": `Hello` - }); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, { + "title": `Hello` + }) +}; diff --git a/spec/compilers/html_attribute_with_expression b/spec/compilers/html_attribute_with_expression index 419923b57..5bad2b743 100644 --- a/spec/compilers/html_attribute_with_expression +++ b/spec/compilers/html_attribute_with_expression @@ -5,12 +5,10 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - "title": `Hello ` + `there!` - }); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, { + "title": `Hello ` + `there!` + }) +}; diff --git a/spec/compilers/html_component b/spec/compilers/html_component index 07a7030a0..eebf41252 100644 --- a/spec/compilers/html_component +++ b/spec/compilers/html_component @@ -10,20 +10,12 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}); - } -}; - -A.displayName = "Test"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; +import { createElement as B } from "./runtime.js"; -const $a = _m(() => _h(A, {})); +export const + A = () => { + return B(`div`, {}) + }, + C = () => { + return B(A, {}) + }; diff --git a/spec/compilers/html_fragment b/spec/compilers/html_fragment index a12c92a70..ccf06589f 100644 --- a/spec/compilers/html_fragment +++ b/spec/compilers/html_fragment @@ -3,19 +3,20 @@ component Main {
<> "A" + "B"
} } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}, [ - _h(React.Fragment, {}, [ - `A` - ]) - ]); - } -}; +import { + createElement as B, + fragment as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}, [B(C, {}, [ + `A`, + `B` + ])]) +}; diff --git a/spec/compilers/html_fragment_empty b/spec/compilers/html_fragment_empty index 7a2712a77..51f5a8206 100644 --- a/spec/compilers/html_fragment_empty +++ b/spec/compilers/html_fragment_empty @@ -7,12 +7,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}, [ - null - ]); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}, [null]) +}; diff --git a/spec/compilers/html_with_custom_style b/spec/compilers/html_with_custom_style index ad393499f..07e5a8140 100644 --- a/spec/compilers/html_with_custom_style +++ b/spec/compilers/html_with_custom_style @@ -1,6 +1,4 @@ component Main { - state background : String = "blue" - get styles : Map(String, String) { `` } @@ -11,28 +9,16 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - b: `blue` - }); - } - - get a() { - return - } +import { + createElement as B, + style as C +} from "./runtime.js"; - get b() { - return this.state.b; - } - - render() { - return _h("div", { - style: _style([this.a]) - }); - } +export const A = () => { + const a = () => { + return undefined + }; + return B(`div`, { + style: C([a()]) + }) }; - -A.displayName = "Main"; diff --git a/spec/compilers/html_with_multiple_styles b/spec/compilers/html_with_multiple_styles index ee6ab1281..ecca4946b 100644 --- a/spec/compilers/html_with_multiple_styles +++ b/spec/compilers/html_with_multiple_styles @@ -13,17 +13,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - className: `Main_one Main_two` - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_one { color: red; } @@ -31,4 +21,12 @@ _insertStyles(` .Main_two { color: blue; } -`); + +---=== /__mint__/index.js ===--- +import { createElement as B } from "./runtime.js"; + +export const A = () => { + return B(`div`, { + className: `Main_one Main_two` + }) +}; diff --git a/spec/compilers/html_with_multiple_styles_and_parameters b/spec/compilers/html_with_multiple_styles_and_parameters index 372d05474..6f308f986 100644 --- a/spec/compilers/html_with_multiple_styles_and_parameters +++ b/spec/compilers/html_with_multiple_styles_and_parameters @@ -13,26 +13,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_two(a) { - const _ = { - [`--a-a`]: a - }; - - return _; - } - - render() { - return _h("div", { - className: `Main_one Main_two`, - style: _style([this.$Main_two(`blue`)]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_one { color: red; } @@ -40,4 +21,22 @@ _insertStyles(` .Main_two { color: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = (b) => { + const _ = { + [`--a-a`]: b + }; + return _ + }; + return B(`div`, { + className: `Main_one Main_two`, + style: C([a(`blue`)]) + }) +}; diff --git a/spec/compilers/html_with_multiple_styles_and_parameters_2 b/spec/compilers/html_with_multiple_styles_and_parameters_2 index 3d24d6147..b8b87a846 100644 --- a/spec/compilers/html_with_multiple_styles_and_parameters_2 +++ b/spec/compilers/html_with_multiple_styles_and_parameters_2 @@ -13,34 +13,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_one(a) { - const _ = { - [`--a-a`]: a - }; - - return _; - } - - $Main_two(b) { - const _ = { - [`--b-a`]: b - }; - - return _; - } - - render() { - return _h("div", { - className: `Main_one Main_two`, - style: _style([this.$Main_one(`red`), this.$Main_two(`blue`)]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_one { color: var(--a-a); } @@ -48,4 +21,32 @@ _insertStyles(` .Main_two { color: var(--b-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const + a = (b) => { + const _ = { + [`--a-a`]: b + }; + return _ + }, + c = (d) => { + const _ = { + [`--b-a`]: d + }; + return _ + }; + return B(`div`, { + className: `Main_one Main_two`, + style: C([ + a(`red`), + c(`blue`) + ]) + }) +}; diff --git a/spec/compilers/html_with_pseudos b/spec/compilers/html_with_pseudos index f28e0275d..787fb1c5a 100644 --- a/spec/compilers/html_with_pseudos +++ b/spec/compilers/html_with_pseudos @@ -27,45 +27,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - b: `yellow`, - a: `blue` - }); - } - - $Main_test() { - const _ = { - [`--a-a`]: this.a, - [`--b-a`]: this.b, - [`--c-a`]: `Hello` - }; - - return _; - } - - get b() { - return this.state.b; - } - - get a() { - return this.state.a; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { background: var(--a-a); color: red; @@ -84,4 +46,28 @@ _insertStyles(` font-family: var(--c-a); color: blue; } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(`yellow`), + b = B(`blue`), + c = () => { + const _ = { + [`--a-a`]: b.value, + [`--b-a`]: a.value, + [`--c-a`]: `Hello` + }; + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([c()]) + }) +}; diff --git a/spec/compilers/html_with_string_style b/spec/compilers/html_with_string_style index c0f17fdab..726ef0718 100644 --- a/spec/compilers/html_with_string_style +++ b/spec/compilers/html_with_string_style @@ -4,12 +4,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", { - style: _style([`opacity:0;`]) - }); - } -}; +import { + createElement as B, + style as C +} from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, { + style: C([`opacity:0;`]) + }) +}; diff --git a/spec/compilers/html_with_style b/spec/compilers/html_with_style index 9b256159f..bf103d91b 100644 --- a/spec/compilers/html_with_style +++ b/spec/compilers/html_with_style @@ -34,46 +34,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - a: `blue`, - b: `yellow` - }); - } - - $Main_test() { - const _ = { - [`--a-a`]: this.a, - [`--a-b`]: this.a, - [`--a-c`]: this.a, - [`--a-d`]: this.b - }; - - return _; - } - - get a() { - return this.state.a; - } - - get b() { - return this.state.b; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-touch-callout: none; @@ -98,4 +59,29 @@ _insertStyles(` .Main_test > span { font-size: .8em; } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(`blue`), + b = B(`yellow`), + c = () => { + const _ = { + [`--a-a`]: a.value, + [`--a-b`]: a.value, + [`--a-c`]: a.value, + [`--a-d`]: b.value + }; + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([c()]) + }) +}; diff --git a/spec/compilers/html_with_style_and_custom_style b/spec/compilers/html_with_style_and_custom_style index cf9ae227f..f2e22d49a 100644 --- a/spec/compilers/html_with_style_and_custom_style +++ b/spec/compilers/html_with_style_and_custom_style @@ -16,44 +16,36 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - a: `blue` - }); - } - - $Main_test() { - const _ = { - [`--a-a`]: this.a - }; - - return _; - } - - get b() { - return - } - - get a() { - return this.state.a; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test(), this.b]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { background: var(--a-a); color: red; } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as C, + useSignal as B, + style as D +} from "./runtime.js"; + +export const A = () => { + const + a = B(`blue`), + b = () => { + return undefined + }, + c = () => { + const _ = { + [`--a-a`]: a.value + }; + return _ + }; + return C(`div`, { + className: `Main_test`, + style: D([ + c(), + b() + ]) + }) +}; diff --git a/spec/compilers/if b/spec/compilers/if index 7b89c3f0e..335d1847d 100644 --- a/spec/compilers/if +++ b/spec/compilers/if @@ -1,28 +1,18 @@ component Main { - fun test : Bool { + fun render : String { if ("asd" == "asd2") { true } else { false } - } - - fun render : String { - test() "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return (_compare(`asd`, `asd2`) ? true : false); - } +import { compare as B } from "./runtime.js"; - render() { - this.a(); - return ``; - } +export const A = () => { + (B(`asd`, `asd2`) ? true : false); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/if_let b/spec/compilers/if_let index d5c9cf6a8..8bbc909ac 100644 --- a/spec/compilers/if_let +++ b/spec/compilers/if_let @@ -13,28 +13,21 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; +import { + patternVariable as H, + newVariant as F, + pattern as G, + variant as B, + match as E +} from "./runtime.js"; -class C extends _C { - render() { - return _match(_n(A)(``),[ +export const + A = B(1), + C = B(0), + D = () => { + return E(F(A)(``), [ [ - _PE(A,[ - _PV - ]), + G(A, [H]), (a) => { return a } @@ -45,8 +38,5 @@ class C extends _C { return `b` } ] - ]); - } -}; - -C.displayName = "Main"; + ]) + }; diff --git a/spec/compilers/if_let_await b/spec/compilers/if_let_await index 9a60ffdf3..0cdfd26ce 100644 --- a/spec/compilers/if_let_await +++ b/spec/compilers/if_let_await @@ -17,31 +17,22 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; +import { + patternVariable as H, + newVariant as F, + pattern as G, + variant as B, + match as E +} from "./runtime.js"; -class C extends _C { - render() { +export const + A = B(1), + C = B(0), + D = () => { (async () => { - let b = await _n(A)(``); - - return _match(b,[ + return E(await F(A)(``), [ [ - _PE(A,[ - _PV - ]), + G(A, [H]), (a) => { return a } @@ -52,11 +43,7 @@ class C extends _C { return `b` } ] - ]); + ]) })(); - - return ``; - } -}; - -C.displayName = "Main"; + return `` + }; diff --git a/spec/compilers/if_without_else_array b/spec/compilers/if_without_else_array index c91ec6894..41e93e5b4 100644 --- a/spec/compilers/if_without_else_array +++ b/spec/compilers/if_without_else_array @@ -6,10 +6,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return (_compare(`asd`, `asd2`) ? [`ARRAY`] : []); - } -}; +import { compare as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return (B(`asd`, `asd2`) ? [`ARRAY`] : []) +}; diff --git a/spec/compilers/if_without_else_promise b/spec/compilers/if_without_else_promise index 02449f53c..b36a60690 100644 --- a/spec/compilers/if_without_else_promise +++ b/spec/compilers/if_without_else_promise @@ -8,11 +8,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - (_compare(`asd`, `asd2`) ? null : null); - return ``; - } -}; +import { compare as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + (B(`asd`, `asd2`) ? null : null); + return `` +}; diff --git a/spec/compilers/if_without_else_string b/spec/compilers/if_without_else_string index d6feca875..75726e3f1 100644 --- a/spec/compilers/if_without_else_string +++ b/spec/compilers/if_without_else_string @@ -6,10 +6,8 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return (_compare(`asd`, `asd2`) ? `TRUE` : ""); - } -}; +import { compare as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return (B(`asd`, `asd2`) ? `TRUE` : "") +}; diff --git a/spec/compilers/indirect_connect b/spec/compilers/indirect_connect index a24baf41c..d93738c1c 100644 --- a/spec/compilers/indirect_connect +++ b/spec/compilers/indirect_connect @@ -19,54 +19,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - get c() { - return B.b; - } - - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidMount() { - B._subscribe(this); - } - - render() { - return C.a; - } -}; - -A.displayName = "Main"; - -const B = new(class extends _S { - constructor() { - super(); - - this.state = { - b: `` - }; - } - - get b() { - return this.state.b; - } - - d() { - return `hello`; - } -}); - -const C = new(class extends _S { - constructor() { - super(); - - this.state = { - a: `` - }; - } - - get a() { - return this.state.a; - } -}); +import { signal as A } from "./runtime.js"; + +export const + a = () => { + return `hello` + }, + b = A(``), + c = A(``), + B = () => { + return c.value + }; diff --git a/spec/compilers/inline_function b/spec/compilers/inline_function index 9c8f38cda..0f55720b5 100644 --- a/spec/compilers/inline_function +++ b/spec/compilers/inline_function @@ -7,14 +7,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const a = () => { - return `Hello` - }; - - return a(); - } +export const A = () => { + const a = () => { + return `Hello` + }; + return a() }; - -A.displayName = "Main"; diff --git a/spec/compilers/inline_function_recursive b/spec/compilers/inline_function_recursive index 024ffd9ca..13c292257 100644 --- a/spec/compilers/inline_function_recursive +++ b/spec/compilers/inline_function_recursive @@ -20,21 +20,16 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - a(b) { - const d = (e, c) => { - return (_compare(e, 0) ? c : d(e - 1, c * e)) - }; - - return d(b, 1); - } -}); +import { compare as A } from "./runtime.js"; -class A extends _C { - render() { - B.a(3); - return ``; - } -}; - -A.displayName = "Main"; +export const + a = (b) => { + const c = (d, e) => { + return (A(d, 0) ? e : c(d - 1, e * d)) + }; + return c(b, 1) + }, + B = () => { + a(3); + return `` + }; diff --git a/spec/compilers/inline_function_with_arguments b/spec/compilers/inline_function_with_arguments index 699d4b5a2..2038ed326 100644 --- a/spec/compilers/inline_function_with_arguments +++ b/spec/compilers/inline_function_with_arguments @@ -13,19 +13,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - const c = (b) => { - return b +export const A = () => { + const a = () => { + const b = (c) => { + return c }; - - return c(`Joe`); - } - - render() { - this.a(); - return ``; - } + return b(`Joe`) + }; + a(); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/js b/spec/compilers/js index 2dbf3760a..7639d253d 100644 --- a/spec/compilers/js +++ b/spec/compilers/js @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return ("Hello"); - } +export const A = () => { + return ("Hello") }; - -A.displayName = "Main"; diff --git a/spec/compilers/js_with_double_interpolation b/spec/compilers/js_with_double_interpolation index 1bbbe314d..aa012544b 100644 --- a/spec/compilers/js_with_double_interpolation +++ b/spec/compilers/js_with_double_interpolation @@ -1,21 +1,9 @@ component Main { - fun test (input : String) : String { - input - } - fun render : String { - ` "Hello" + #{test(`"World!"`)} ` + ` "Hello" + #{`"World!"`} ` } } -------------------------------------------------------------------------------- -class A extends _C { - a(b) { - return b; - } - - render() { - return ("Hello" + this.a(("World!"))); - } +export const A = () => { + return ("Hello" + ("World!")) }; - -A.displayName = "Main"; diff --git a/spec/compilers/js_with_interpolation b/spec/compilers/js_with_interpolation index 2ac9f1c92..169797cdd 100644 --- a/spec/compilers/js_with_interpolation +++ b/spec/compilers/js_with_interpolation @@ -1,21 +1,9 @@ component Main { - fun test : String { - "World!" - } - fun render : String { - ` "Hello" + #{test()} ` + ` "Hello" + #{"World!"} ` } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return `World!`; - } - - render() { - return ("Hello" + this.a()); - } +export const A = () => { + return ("Hello" + `World!`) }; - -A.displayName = "Main"; diff --git a/spec/compilers/locale_key b/spec/compilers/locale_key index 6521ef9e7..91330bfe1 100644 --- a/spec/compilers/locale_key +++ b/spec/compilers/locale_key @@ -8,18 +8,20 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - componentWillUnmount() { - _L._unsubscribe(this); - } +import { + translations as C, + translate as B, + locale as D +} from "./runtime.js"; - componentDidMount() { - _L._subscribe(this); - } +export const A = () => { + return B(`test`) +}; - render() { - return _L.t("test"); +C.value = { + en: { + 'test': `Hello` } }; -A.displayName = "Main"; +D.value = `en`; diff --git a/spec/compilers2/map b/spec/compilers/map similarity index 100% rename from spec/compilers2/map rename to spec/compilers/map diff --git a/spec/compilers/module b/spec/compilers/module index 2ed07c7e9..fea9e8f97 100644 --- a/spec/compilers/module +++ b/spec/compilers/module @@ -12,18 +12,12 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - a() { - return _h("p", {}, [ - `It should work` - ]); - } -}); - -class A extends _C { - render() { - return B.a(); - } -}; +import { createElement as A } from "./runtime.js"; -A.displayName = "Main"; +export const + a = () => { + return A(`p`, {}, [`It should work`]) + }, + B = () => { + return a() + }; diff --git a/spec/compilers/module_access b/spec/compilers/module_access index d2e2bb029..25926594f 100644 --- a/spec/compilers/module_access +++ b/spec/compilers/module_access @@ -17,21 +17,14 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - c() { - return `Hello`; - } - - a() { - return B.c; - } -}); - -class A extends _C { - render() { - const b = B.a(); - return b(); - } -}; - -A.displayName = "Main"; +export const + a = () => { + return `Hello` + }, + b = () => { + return a + }, + A = () => { + const c = b(); + return c() + }; diff --git a/spec/compilers/module_access_get b/spec/compilers/module_access_get index 6728adfee..43bb133ee 100644 --- a/spec/compilers/module_access_get +++ b/spec/compilers/module_access_get @@ -4,7 +4,7 @@ store Test { } fun b : String { - Test.a + a } } @@ -14,25 +14,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return B.a(); - } -}; - -A.displayName = "Main"; - -const B = new(class extends _S { - constructor() { - super(); - this.state = {}; - } - - get b() { +export const + a = () => { return `Hello` - } - - a() { - return B.b; - } -}); + }, + b = () => { + return a() + }, + A = () => { + return b() + }; diff --git a/spec/compilers/module_access_subscriptions b/spec/compilers/module_access_subscriptions index 58ec66eaa..fe14e8097 100644 --- a/spec/compilers/module_access_subscriptions +++ b/spec/compilers/module_access_subscriptions @@ -3,6 +3,11 @@ type Test { } provider Test : Test { + fun update : Promise(Void) { + subscriptions + await void + } + fun print (a : String) : String { a } @@ -19,53 +24,28 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({ - test: [ - "test", - Decoder.string - ] -}); - -const B = new(class extends _P { - constructor() { - super(); - this.state = {}; - } - - a(b) { - return b; - } -}); - -class C extends _C { - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidUpdate() { - if (true) { - B._subscribe(this, new A({ - test: `` - })) - } else { - B._unsubscribe(this) - }; - } - - componentDidMount() { - if (true) { - B._subscribe(this, new A({ +import { + createProvider as B, + subscriptions as C, + useId as E +} from "./runtime.js"; + +export const + a = new Map(), + b = (c) => { + return c + }, + A = B(a, async () => { + C(a); + return await null + }), + D = () => { + const d = E(); + A(d, () => { + return { test: `` - })) - } else { - B._unsubscribe(this) - }; - } - - render() { - B._subscriptions; - return B.a(`a`); - } -}; - -C.displayName = "Main"; + } + }); + C(a); + return b(`a`) + }; diff --git a/spec/compilers/module_call b/spec/compilers/module_call index 414577d8d..e8690f524 100644 --- a/spec/compilers/module_call +++ b/spec/compilers/module_call @@ -14,20 +14,13 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - b(c) { - return c; - } - - a() { - return B.b(`Lorem ipsum dolor sit amet`); - } -}); - -class A extends _C { - render() { - return B.a(); - } -}; - -A.displayName = "Main"; +export const + a = (b) => { + return b + }, + c = () => { + return a(`Lorem ipsum dolor sit amet`) + }, + A = () => { + return c() + }; diff --git a/spec/compilers/module_call_piped b/spec/compilers/module_call_piped index e57bfeb9e..21ba67372 100644 --- a/spec/compilers/module_call_piped +++ b/spec/compilers/module_call_piped @@ -15,20 +15,13 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - b(c, d) { - return d; - } - - a() { - return B.b(true, `Lorem ipsum dolor sit amet`); - } -}); - -class A extends _C { - render() { - return B.a(); - } -}; - -A.displayName = "Main"; +export const + a = (b, c) => { + return c + }, + d = () => { + return a(true, `Lorem ipsum dolor sit amet`) + }, + A = () => { + return d() + }; diff --git a/spec/compilers/next_call b/spec/compilers/next_call index d5112d14b..3e8b9774b 100644 --- a/spec/compilers/next_call +++ b/spec/compilers/next_call @@ -17,37 +17,21 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - b: `Joe`, - c: 24 - }); - } - - get b() { - return this.state.b; - } - - get c() { - return this.state.c; - } - - a() { - return new Promise((_resolve) => { - this.setState(_u(this.state, new Record({ - b: `Hello`, - c: 30 - })), _resolve) - }); - } - - render() { - this.a(); - return ``; - } +import { + useSignal as B, + batch as C +} from "./runtime.js"; + +export const A = () => { + const + a = B(`Joe`), + b = B(24), + c = () => { + return C(() => { + a.value = `Hello`; + b.value = 30 + }) + }; + c(); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/next_call_empty b/spec/compilers/next_call_empty index 648d90f85..dc991181f 100644 --- a/spec/compilers/next_call_empty +++ b/spec/compilers/next_call_empty @@ -5,11 +5,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - null; - return ``; - } +export const A = () => { + null; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/number_literal_negative b/spec/compilers/number_literal_negative index 61b98a1fc..a348075c2 100644 --- a/spec/compilers/number_literal_negative +++ b/spec/compilers/number_literal_negative @@ -1,24 +1,11 @@ component Main { - fun test : Number { - -42 - } - fun render : String { - test() - + -42 "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return -42; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + -42; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/number_literal_simple b/spec/compilers/number_literal_simple index c61a5fd10..efcc15473 100644 --- a/spec/compilers/number_literal_simple +++ b/spec/compilers/number_literal_simple @@ -1,24 +1,11 @@ component Main { - fun test : Number { - 10 - } - fun render : String { - test() - + 10 "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return 10; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + 10; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/number_literal_with_decimal b/spec/compilers/number_literal_with_decimal index 0ccab029d..70c37398a 100644 --- a/spec/compilers/number_literal_with_decimal +++ b/spec/compilers/number_literal_with_decimal @@ -1,24 +1,11 @@ component Main { - fun test : Number { - 10.120 - } - fun render : String { - test() - + 10.120 "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return 10.120; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + 10.120; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/operation_chained b/spec/compilers/operation_chained index 7e031848b..636b05463 100644 --- a/spec/compilers/operation_chained +++ b/spec/compilers/operation_chained @@ -1,24 +1,13 @@ component Main { - fun test : Bool { - "a" == "b" && true != false - } - fun render : String { - test() - + "a" == "b" && true != false "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return _compare(`a`, `b`) && !_compare(true, false); - } +import { compare as B } from "./runtime.js"; - render() { - this.a(); - return ``; - } +export const A = () => { + B(`a`, `b`) && !B(true, false); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/operation_or b/spec/compilers/operation_or index 105357e47..8bc4b5158 100644 --- a/spec/compilers/operation_or +++ b/spec/compilers/operation_or @@ -1,44 +1,29 @@ -type Maybe(a) { +type Result(error, value) { + Err(error) + Ok(value) +} + +type Maybe(value) { Nothing - Just(a) + Just(value) } component Main { - fun test : String { - Maybe.Nothing or "Hello" - } - fun render : String { - test() - - "" + Maybe.Nothing or "Hello" } } -------------------------------------------------------------------------------- -class A extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class B extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class C extends _C { - a() { - return _o(new A()._0, `Hello`); - } - - render() { - this.a(); - return ``; - } -}; +import { + variant as B, + or as G +} from "./runtime.js"; -C.displayName = "Main"; +export const + A = B(0), + C = B(1), + D = B(1), + E = B(1), + F = () => { + return G(A, D, new A(), `Hello`) + }; diff --git a/spec/compilers/operation_simple b/spec/compilers/operation_simple index 80e1db303..c779827db 100644 --- a/spec/compilers/operation_simple +++ b/spec/compilers/operation_simple @@ -1,24 +1,13 @@ component Main { - fun test : Bool { - "a" == "b" - } - fun render : String { - test() - + "a" == "b" "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return _compare(`a`, `b`); - } +import { compare as B } from "./runtime.js"; - render() { - this.a(); - return ``; - } +export const A = () => { + B(`a`, `b`); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/parenthesized_expression b/spec/compilers/parenthesized_expression index 13eab0cdb..b9352f3c8 100644 --- a/spec/compilers/parenthesized_expression +++ b/spec/compilers/parenthesized_expression @@ -1,24 +1,11 @@ component Main { - fun test : Bool { - (true) - } - fun render : String { - test() - + (true) "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return (true); - } - - render() { - this.a(); - return ``; - } +export const A = () => { + (true); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/pipe b/spec/compilers/pipe index 080c08a50..f5887061f 100644 --- a/spec/compilers/pipe +++ b/spec/compilers/pipe @@ -7,17 +7,15 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return _h("div", {}, [ - ((a) => { - return a - })(`3`), - ((b) => { - return b - })(`3`) - ]); - } -}; +import { createElement as B } from "./runtime.js"; -A.displayName = "Main"; +export const A = () => { + return B(`div`, {}, [ + ((a) => { + return a + })(`3`), + ((b) => { + return b + })(`3`) + ]) +}; diff --git a/spec/compilers2/pipe_await b/spec/compilers/pipe_await similarity index 100% rename from spec/compilers2/pipe_await rename to spec/compilers/pipe_await diff --git a/spec/compilers/property b/spec/compilers/property index 7efc34fd1..89df7270a 100644 --- a/spec/compilers/property +++ b/spec/compilers/property @@ -12,31 +12,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this._d({ - a: [ - null, - `Joe` - ] - }); - } - - render() { - return _h("div", {}); - } -}; - -A.displayName = "Test"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; - -const $a = _m(() => _h(A, {})); +import { createElement as B } from "./runtime.js"; + +export const + A = ({ + a = `Joe` + }) => { + return B(`div`, {}) + }, + C = () => { + return B(A, {}) + }; diff --git a/spec/compilers/property_without_default b/spec/compilers/property_without_default index faa38c790..11a665665 100644 --- a/spec/compilers/property_without_default +++ b/spec/compilers/property_without_default @@ -12,33 +12,17 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); +import { createElement as B } from "./runtime.js"; + +export const + A = ({ + a + }) => { + return B(`div`, {}) + }, + C = () => { + return B(A, { + a: `HELLO` + }) + }; - this._d({ - a: [ - null, - null - ] - }); - } - - render() { - return _h("div", {}); - } -}; - -A.displayName = "Test"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; - -const $a = _m(() => _h(A, { - a: `HELLO` -})); diff --git a/spec/compilers/provider_with_items b/spec/compilers/provider_with_items index e53cae737..cdbac6618 100644 --- a/spec/compilers/provider_with_items +++ b/spec/compilers/provider_with_items @@ -12,6 +12,10 @@ provider Provider : Subscription { a } + fun update : Promise(Void) { + await void + } + fun name : String { NAME } @@ -28,75 +32,33 @@ component Main { } } -------------------------------------------------------------------------------- -const A = _R({ - a: [ - "a", - Decoder.boolean - ], - b: [ - "b", - Decoder.boolean - ] -}); - -const B = new(class extends _P { - constructor() { - super(); - - this.state = { - c: `` - }; - - this._d({ - b: () => { - return `hello` - } - }); - } - - get c() { - return this.state.c; - } - - get d() { - return this.c - } - - a() { - return this.b; - } -}); - -class C extends _C { - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidUpdate() { - if (true) { - B._subscribe(this, new A({ - a: true, - b: false - })) - } else { - B._unsubscribe(this) - }; - } - - componentDidMount() { - if (true) { - B._subscribe(this, new A({ +import { + createProvider as C, + createElement as F, + signal as A, + useId as E +} from "./runtime.js"; + +export const + a = new Map(), + b = `hello`, + c = () => { + return b + }, + d = A(``), + e = () => { + return d.value + }, + B = C(a, async () => { + return await null + }), + D = () => { + const f = E(); + B(f, () => { + return { a: true, b: false - })) - } else { - B._unsubscribe(this) - }; - } - - render() { - return _h("div", {}); - } -}; - -C.displayName = "Main"; + } + }); + return F(`div`, {}) + }; diff --git a/spec/compilers/record b/spec/compilers/record index 83200c435..fa3afe1d4 100644 --- a/spec/compilers/record +++ b/spec/compilers/record @@ -4,43 +4,22 @@ type Test { } component Main { - fun test : Test { + fun render : Html { { a: "Hello", b: 0 } - } - - fun render : Html { - test()
} } -------------------------------------------------------------------------------- -const A = _R({ - a: [ - "a", - Decoder.string - ], - b: [ - "b", - Decoder.number - ] -}); +import { createElement as B } from "./runtime.js"; -class B extends _C { - a() { - return new A({ - a: `Hello`, - b: 0 - }); - } - - render() { - this.a(); - return _h("div", {}); - } +export const A = () => { + { + a: `Hello`, + b: 0 + }; + return B(`div`, {}) }; - -B.displayName = "Main"; diff --git a/spec/compilers/record_update b/spec/compilers/record_update index 29a60759c..69d73368d 100644 --- a/spec/compilers/record_update +++ b/spec/compilers/record_update @@ -5,49 +5,24 @@ type Record { component Main { state record : Record = { name: "Doe" } - fun test : Record { - { record | name: "John" } - } - fun render : Html { - test() - + { record | name: "John" }
} } -------------------------------------------------------------------------------- -const A = _R({ - name: [ - "name", - Decoder.string - ] -}); - -class B extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - b: new A({ - name: `Doe` - }) - }); - } - - get b() { - return this.state.b; - } - - a() { - return _u(this.b, { - name: `John` - }); - } - - render() { - this.a(); - return _h("div", {}); - } +import { + createElement as C, + useSignal as B +} from "./runtime.js"; + +export const A = () => { + const a = B({ + name: `Doe` + }); + { + ...a.value, + name: `John` + }; + return C(`div`, {}) }; - -B.displayName = "Main"; diff --git a/spec/compilers/regexp_literal b/spec/compilers/regexp_literal index 9dbcf0521..e9d582296 100644 --- a/spec/compilers/regexp_literal +++ b/spec/compilers/regexp_literal @@ -1,24 +1,11 @@ component Main { - fun regexp : Regexp { - /.*/gm - } - fun render : String { - regexp() - + /.*/gm "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return /.*/gm; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + /.*/gm; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/route b/spec/compilers/route deleted file mode 100644 index 7bd073304..000000000 --- a/spec/compilers/route +++ /dev/null @@ -1,21 +0,0 @@ -routes { - /:name (name : String) { - "Hello" - } -} --------------------------------------------------------------------------------- -_program.addRoutes([ - { - handler: (a) => { - `Hello` - }, - decoders: [ - Decoder.string - ], - mapping: [ - 'name' - ], - path: `/:name` - } -]); - diff --git a/spec/compilers2/signal b/spec/compilers/signal similarity index 100% rename from spec/compilers2/signal rename to spec/compilers/signal diff --git a/spec/compilers/state b/spec/compilers/state index 8c7858409..d2d317b47 100644 --- a/spec/compilers/state +++ b/spec/compilers/state @@ -11,31 +11,15 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this.state = new Record({ - b: `Hello`, - c: `0` - }); - } - - get b() { - return this.state.b; - } - - get c() { - return this.state.c; - } - - a() { - return this.b + this.c; - } - - render() { - return this.a(); - } +import { useSignal as B } from "./runtime.js"; + +export const A = () => { + const + a = B(`Hello`), + b = B(`0`), + c = () => { + return a.value + b.value + }; + return c() }; -A.displayName = "Main"; diff --git a/spec/compilers2/state_setter b/spec/compilers/state_setter similarity index 100% rename from spec/compilers2/state_setter rename to spec/compilers/state_setter diff --git a/spec/compilers/statement b/spec/compilers/statement index 628f5f042..d473aff79 100644 --- a/spec/compilers/statement +++ b/spec/compilers/statement @@ -7,11 +7,7 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - const a = `hello`; - return a; - } +export const A = () => { + const a = `hello`; + return a }; - -A.displayName = "Main"; diff --git a/spec/compilers/static_component b/spec/compilers/static_component deleted file mode 100644 index f6f98ba62..000000000 --- a/spec/compilers/static_component +++ /dev/null @@ -1,150 +0,0 @@ -component Test { - property text : String = "" - - fun render : Html { -
text
- } -} - -component Test2 { - property text : String = "" - - fun render : Html { -
text
- } -} - -component TestWithChildren { - property children : Array(Html) = [] - property text : String = "" - - fun render : Html { -
text
- } -} - -component Main { - fun render : Html { - <> - - - - - - - - "Hello" - - - - "Hello" - - - - - - - - - - - } -} --------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this._d({ - a: [ - null, - `` - ] - }); - } - - render() { - return _h("div", {}, [ - this.a - ]); - } -}; - -A.displayName = "Test"; - -class B extends _C { - constructor(props) { - super(props); - - this._d({ - b: [ - null, - `` - ] - }); - } - - render() { - return _h("div", {}, [ - this.b - ]); - } -}; - -B.displayName = "Test2"; - -class C extends _C { - constructor(props) { - super(props); - - this._d({ - d: [ - "children", - [] - ], - c: [ - null, - `` - ] - }); - } - - render() { - return _h("div", {}, [ - this.c - ]); - } -}; - -C.displayName = "TestWithChildren"; - -class D extends _C { - render() { - return _h(React.Fragment, {}, [ - $a(), - $a(), - $b(), - $b(), - $c(), - $c(), - $d(), - $e() - ]); - } -}; - -D.displayName = "Main"; - -const $a = _m(() => _h(A, {})); - -const $b = _m(() => _h(A, { - a: `Hello` -})); - -const $c = _m(() => _h(C, {}, _array(_h("span", {}, [ - `Hello` -])))); - -const $d = _m(() => _h(C, {}, _array($a()))); -const $f = _m(() => _h(B, {})); -const $e = _m(() => _h(C, {}, _array($f()))); diff --git a/spec/compilers/store b/spec/compilers/store index a19d8a621..5d4031673 100644 --- a/spec/compilers/store +++ b/spec/compilers/store @@ -14,40 +14,13 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - get b() { - return B.a; - } - - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidMount() { - B._subscribe(this); - } - - render() { - return this.a; - } -}; - -A.displayName = "Main"; - -const B = new(class extends _S { - constructor() { - super(); - - this.state = { - a: `` - }; - } - - get a() { - return this.state.a; - } - - c() { - return `hello`; - } -}); +import { signal as A } from "./runtime.js"; + +export const + a = () => { + return `hello` + }, + b = A(``), + B = () => { + return b.value + }; diff --git a/spec/compilers/store_with_get b/spec/compilers/store_with_get index f875102f5..0e707cd3d 100644 --- a/spec/compilers/store_with_get +++ b/spec/compilers/store_with_get @@ -11,43 +11,19 @@ component Main { fun render : String { xxx + Test.hello } } -------------------------------------------------------------------------------- -class A extends _C { - get b() { - return B.a; - } - - componentWillUnmount() { - B._unsubscribe(this); - } - - componentDidMount() { - B._subscribe(this); - } - - render() { - return this.a; - } -}; - -A.displayName = "Main"; +import { signal as A } from "./runtime.js"; -const B = new(class extends _S { - constructor() { - super(); - - this.state = { - a: `` - }; - } - - get a() { - return this.state.a; - } - - get c() { +export const + a = A(``), + b = () => { return `hello` - } -}); + }, + B = () => { + a.value; + return b() + }; + diff --git a/spec/compilers2/string_literal_broken b/spec/compilers/string_literal_broken similarity index 100% rename from spec/compilers2/string_literal_broken rename to spec/compilers/string_literal_broken diff --git a/spec/compilers/string_literal_escaped b/spec/compilers/string_literal_escaped index 0c39d33df..5df330860 100644 --- a/spec/compilers/string_literal_escaped +++ b/spec/compilers/string_literal_escaped @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There \"Joe\"`; - } +export const A = () => { + return `Hello There "Joe"` }; - -A.displayName = "Main"; diff --git a/spec/compilers/string_literal_simple b/spec/compilers/string_literal_simple index bc3217f7e..50db540f9 100644 --- a/spec/compilers/string_literal_simple +++ b/spec/compilers/string_literal_simple @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There`; - } +export const A = () => { + return `Hello There` }; - -A.displayName = "Main"; diff --git a/spec/compilers/string_literal_with_backtick b/spec/compilers/string_literal_with_backtick index bbafeb2be..936a625db 100644 --- a/spec/compilers/string_literal_with_backtick +++ b/spec/compilers/string_literal_with_backtick @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There \`Joe\``; - } +export const A = () => { + return `Hello There \`Joe\`` }; - -A.displayName = "Main"; diff --git a/spec/compilers2/string_literal_with_escaped_interpolation b/spec/compilers/string_literal_with_escaped_interpolation similarity index 100% rename from spec/compilers2/string_literal_with_escaped_interpolation rename to spec/compilers/string_literal_with_escaped_interpolation diff --git a/spec/compilers/string_literal_with_interpolation b/spec/compilers/string_literal_with_interpolation index 6af32ee00..7ebcebb6f 100644 --- a/spec/compilers/string_literal_with_interpolation +++ b/spec/compilers/string_literal_with_interpolation @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There ${`Hello`}`; - } +export const A = () => { + return `Hello There ${`Hello`}` }; - -A.displayName = "Main"; diff --git a/spec/compilers/string_literal_with_interpolation_and_js_iterpolation b/spec/compilers/string_literal_with_interpolation_and_js_iterpolation index 6af32ee00..7ebcebb6f 100644 --- a/spec/compilers/string_literal_with_interpolation_and_js_iterpolation +++ b/spec/compilers/string_literal_with_interpolation_and_js_iterpolation @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There ${`Hello`}`; - } +export const A = () => { + return `Hello There ${`Hello`}` }; - -A.displayName = "Main"; diff --git a/spec/compilers/string_literal_with_interpolation_of_number b/spec/compilers/string_literal_with_interpolation_of_number index 2989caf0c..797598e2c 100644 --- a/spec/compilers/string_literal_with_interpolation_of_number +++ b/spec/compilers/string_literal_with_interpolation_of_number @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There ${0}`; - } +export const A = () => { + return `Hello There ${0}` }; - -A.displayName = "Main"; diff --git a/spec/compilers/string_literal_with_js_iterpolation b/spec/compilers/string_literal_with_js_iterpolation index 5c9ccafbd..f6baea1bd 100644 --- a/spec/compilers/string_literal_with_js_iterpolation +++ b/spec/compilers/string_literal_with_js_iterpolation @@ -4,10 +4,6 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - render() { - return `Hello There \${a}`; - } +export const A = () => { + return `Hello There \${a}` }; - -A.displayName = "Main"; diff --git a/spec/compilers/style_with_argument b/spec/compilers/style_with_argument index 61dbb6006..1ebb28757 100644 --- a/spec/compilers/style_with_argument +++ b/spec/compilers/style_with_argument @@ -9,27 +9,26 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test(a) { - const _ = { - [`--a-a`]: a - }; - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test(`red`)]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { color: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = (b) => { + const _ = { + [`--a-a`]: b + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a(`red`)]) + }) +}; diff --git a/spec/compilers/style_with_default_argument b/spec/compilers/style_with_default_argument index ca0ebc218..333ba2ce6 100644 --- a/spec/compilers/style_with_default_argument +++ b/spec/compilers/style_with_default_argument @@ -9,27 +9,26 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - $Main_test(a = `red`) { - const _ = { - [`--a-a`]: a - }; - - return _; - } - - render() { - return _h("div", { - className: `Main_test`, - style: _style([this.$Main_test()]) - }); - } -}; - -A.displayName = "Main"; - -_insertStyles(` +---=== /__mint__/index.css ===--- .Main_test { color: var(--a-a); } -`); + +---=== /__mint__/index.js ===--- +import { + createElement as B, + style as C +} from "./runtime.js"; + +export const A = () => { + const a = (b = `red`) => { + const _ = { + [`--a-a`]: b + }; + return _ + }; + return B(`div`, { + className: `Main_test`, + style: C([a()]) + }) +}; diff --git a/spec/compilers/tuple_literal b/spec/compilers/tuple_literal index 926dbeb60..3ba53ea10 100644 --- a/spec/compilers/tuple_literal +++ b/spec/compilers/tuple_literal @@ -1,28 +1,19 @@ component Main { - fun test : Tuple(String, String, String) { + fun render : String { { "Hello", "Blah", "Joe" } - } - - fun render : String { - test() - "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return [`Hello`, `Blah`, `Joe`]; - } - - render() { - this.a(); - return ``; - } +export const A = () => { + [ + `Hello`, + `Blah`, + `Joe` + ]; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/type b/spec/compilers/type index 343ae2f20..884bdaef7 100644 --- a/spec/compilers/type +++ b/spec/compilers/type @@ -11,93 +11,29 @@ type Res(error, value) { } component Main { - fun a : Test(a) { + fun render : String { Test.X - } - - fun b : Res(String, String) { Res.Other("", "") - } - - fun c : Test(String) { Test.Z(Res.Error("")) - } - - fun render : String { - a() - b() - c() - "" } } -------------------------------------------------------------------------------- -class A extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class C extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class D extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class E extends _E { - constructor(_0) { - super(); - this._0 = _0; - this.length = 1; - } -}; - -class F extends _E { - constructor(_0, _1) { - super(); - this._0 = _0; - this._1 = _1; - this.length = 2; - } -}; - -class G extends _C { - a() { - return new A(); - } - - b() { - return _n(F)(``, ``); - } - - c() { - return _n(C)(_n(D)(``)); - } - - render() { - this.a(); - this.b(); - this.c(); - return ``; - } -}; - -G.displayName = "Main"; +import { + newVariant as I, + variant as B +} from "./runtime.js"; + +export const + A = B(1), + C = B(0), + D = B(0), + E = B(1), + F = B(1), + G = B(2), + H = () => { + new C(); + I(G)(``, ``); + I(E)(I(F)(``)); + return `` + }; diff --git a/spec/compilers/type_with_variants b/spec/compilers/type_with_variants index 6e7c3b7be..77e844b1d 100644 --- a/spec/compilers/type_with_variants +++ b/spec/compilers/type_with_variants @@ -1,64 +1,47 @@ type A { - B(name : String, color : String) + B(name : String, age : Number) C } component Main { fun render : String { - case (A.B(name: "Joe", color: "Blue")) { - A.B(color, name) => color + case (A.B(name: "Joe", age: 32)) { + A.B(name, age) => name A.C => "" } } } -------------------------------------------------------------------------------- -class A extends _E { - constructor(_0, _1) { - super(); - this._0 = _0; - this._1 = _1; - this.length = 2; +import { + patternVariable as H, + newVariant as F, + pattern as G, + variant as B, + match as E +} from "./runtime.js"; - this._mapping = { - name: "_0", - color: "_1" - }; - } -}; - -class B extends _E { - constructor() { - super(); - this.length = 0; - } -}; - -class C extends _C { - render() { - return _match(_n(A)(`Joe`, `Blue`),[ +export const + A = B([ + "name", + "age" + ]), + C = B(0), + D = () => { + return E(F(A)(`Joe`, 32), [ [ - _PE(A,_PR([ - [ - "color", - _PV - ], - [ - "name", - _PV - ] - ])), + G(A, [ + H, + H + ]), (a, b) => { return a } ], [ - _PE(B,[]), + G(C, []), () => { return `` } ] - ]); - } -}; - -C.displayName = "Main"; + ]) + }; diff --git a/spec/compilers/unary_minus b/spec/compilers/unary_minus index cbfa24597..b99bff095 100644 --- a/spec/compilers/unary_minus +++ b/spec/compilers/unary_minus @@ -1,24 +1,12 @@ component Main { - fun test : Number { - 42 - } - fun render : String { - -test() + -(42) "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return 42; - } - - render() { - -(this.a()); - return ``; - } +export const A = () => { + -((42)); + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers/variable_argument b/spec/compilers/variable_argument index 635bc60b4..149c82824 100644 --- a/spec/compilers/variable_argument +++ b/spec/compilers/variable_argument @@ -4,18 +4,13 @@ component Main { } fun render : String { - test("X") + test("X") } } -------------------------------------------------------------------------------- -class A extends _C { - a(b) { - return b; - } - - render() { - return this.a(`X`); - } +export const A = () => { + const a = (b) => { + return b + }; + return a(`X`) }; - -A.displayName = "Main"; diff --git a/spec/compilers/variable_component_function b/spec/compilers/variable_component_function index 35f8d6977..bdc82ee57 100644 --- a/spec/compilers/variable_component_function +++ b/spec/compilers/variable_component_function @@ -8,14 +8,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return `Hello`; - } - - render() { - return this.a(); - } +export const A = () => { + const a = () => { + return `Hello` + }; + return a() }; - -A.displayName = "Main"; diff --git a/spec/compilers/variable_component_get b/spec/compilers/variable_component_get index 134357fea..c1c323fcf 100644 --- a/spec/compilers/variable_component_get +++ b/spec/compilers/variable_component_get @@ -8,14 +8,9 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - get a() { +export const A = () => { + const a = () => { return `Hello` - } - - render() { - return this.a; - } + }; + return a() }; - -A.displayName = "Main"; diff --git a/spec/compilers/variable_component_property b/spec/compilers/variable_component_property index 62a6a8f3b..7ac6fcc32 100644 --- a/spec/compilers/variable_component_property +++ b/spec/compilers/variable_component_property @@ -12,31 +12,14 @@ component Main { } } -------------------------------------------------------------------------------- -class A extends _C { - constructor(props) { - super(props); - - this._d({ - a: [ - null, - `Hello` - ] - }); - } - - render() { - return this.a; - } -}; - -A.displayName = "Test"; - -class B extends _C { - render() { - return $a(); - } -}; - -B.displayName = "Main"; - -const $a = _m(() => _h(A, {})); +import { createElement as C } from "./runtime.js"; + +export const + A = ({ + a = `Hello` + }) => { + return a + }, + B = () => { + return C(A, {}) + }; diff --git a/spec/compilers/variable_module_function b/spec/compilers/variable_module_function index 3d20cd9d6..a4ef29b14 100644 --- a/spec/compilers/variable_module_function +++ b/spec/compilers/variable_module_function @@ -17,22 +17,14 @@ component Main { } } -------------------------------------------------------------------------------- -const B = new(class extends _M { - c() { - return `Hello`; - } - - a() { - return B.c; - } -}); - -class A extends _C { - render() { - const b = B.a(); - return b(); - } -}; - -A.displayName = "Main"; - +export const + a = () => { + return `Hello` + }, + b = () => { + return a + }, + A = () => { + const c = b(); + return c() + }; diff --git a/spec/compilers/void b/spec/compilers/void index 6490bb1b8..6365978da 100644 --- a/spec/compilers/void +++ b/spec/compilers/void @@ -1,24 +1,11 @@ component Main { - fun test : Void { - void - } - fun render : String { - let x = test - + void "" } } -------------------------------------------------------------------------------- -class A extends _C { - a() { - return null; - } - - render() { - const b = this.a; - return ``; - } +export const A = () => { + null; + return `` }; - -A.displayName = "Main"; diff --git a/spec/compilers2/access b/spec/compilers2/access deleted file mode 100644 index 52c19f469..000000000 --- a/spec/compilers2/access +++ /dev/null @@ -1,15 +0,0 @@ -type X { - name : String -} - -component Main { - fun render : String { - { name: "test" }.name - } -} --------------------------------------------------------------------------------- -export const A = () => { - return { - name: `test` - }.name -}; diff --git a/spec/compilers2/argument b/spec/compilers2/argument deleted file mode 100644 index e38d7c8a5..000000000 --- a/spec/compilers2/argument +++ /dev/null @@ -1,19 +0,0 @@ -component Main { - fun test (a : String, b : Number) : Number { - b - } - - fun render : String { - test("", 0) - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = (b, c) => { - return c - }; - a(``, 0); - return `` -}; diff --git a/spec/compilers2/argument_with_default b/spec/compilers2/argument_with_default deleted file mode 100644 index a8433d8b6..000000000 --- a/spec/compilers2/argument_with_default +++ /dev/null @@ -1,19 +0,0 @@ -component Main { - fun test (a : String, b : Number = 0) : Number { - b - } - - fun render : String { - test("") - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = (b, c = 0) => { - return c - }; - a(``); - return `` -}; diff --git a/spec/compilers2/argument_with_default_inline_function b/spec/compilers2/argument_with_default_inline_function deleted file mode 100644 index ef98ddc90..000000000 --- a/spec/compilers2/argument_with_default_inline_function +++ /dev/null @@ -1,20 +0,0 @@ -component Main { - fun render : String { - let test = - (a : String, b : Number = 0) : Number { - b - } - - test("") - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = (b, c = 0) => { - return c - }; - a(``); - return `` -}; diff --git a/spec/compilers2/array_literal b/spec/compilers2/array_literal deleted file mode 100644 index c2e86a127..000000000 --- a/spec/compilers2/array_literal +++ /dev/null @@ -1,20 +0,0 @@ -component Main { - fun render : String { - [ - "Hello", - "Blah", - "Joe" - ] - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - [ - `Hello`, - `Blah`, - `Joe` - ]; - return `` -}; diff --git a/spec/compilers2/block b/spec/compilers2/block deleted file mode 100644 index 07661b944..000000000 --- a/spec/compilers2/block +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - fun render : String { - let a = "Some string..." - - a + ", other string..." - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = `Some string...`; - return a + `, other string...` -}; diff --git a/spec/compilers2/block_with_await b/spec/compilers2/block_with_await deleted file mode 100644 index 97dfafca4..000000000 --- a/spec/compilers2/block_with_await +++ /dev/null @@ -1,27 +0,0 @@ -component Main { - fun promise : Promise(String) { - `` as Promise(String) - } - - fun promiseTest : Promise(String) { - await promise() - } - - fun render : String { - promiseTest() - - "Hello" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const - a = () => { - return undefined - }, - b = async () => { - return await a() - }; - b(); - return `Hello` -}; diff --git a/spec/compilers2/block_with_early_return b/spec/compilers2/block_with_early_return deleted file mode 100644 index 3cb3a2504..000000000 --- a/spec/compilers2/block_with_early_return +++ /dev/null @@ -1,33 +0,0 @@ -type Test { - A(String) - B(String) -} - -component Main { - fun render : String { - let Test.A(a) = - Test.A("Some string...") or return "RETURN" - - a - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - destructure as E, - newVariant as F, - pattern as G, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - D = () => { - const a = E(F(A)(`Some string...`), G(A, [H])); - if (a === false) { - return `RETURN` - }; - const [b] = a; - return b - }; diff --git a/spec/compilers2/block_with_early_return_await b/spec/compilers2/block_with_early_return_await deleted file mode 100644 index ab2071bf4..000000000 --- a/spec/compilers2/block_with_early_return_await +++ /dev/null @@ -1,40 +0,0 @@ -type Test { - A(String) - B(String) -} - -component Main { - fun render : String { - { - let Test.A(a) = - await Test.A("Some string...") or return "RETURN" - - a - } - - "" - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - destructure as E, - newVariant as F, - pattern as G, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - D = () => { - (async () => { - const a = E(await F(A)(`Some string...`), G(A, [H])); - if (a === false) { - return `RETURN` - }; - const [b] = a; - return b - })(); - return `` - }; diff --git a/spec/compilers2/block_with_tuple_destructuring b/spec/compilers2/block_with_tuple_destructuring deleted file mode 100644 index c625e9694..000000000 --- a/spec/compilers2/block_with_tuple_destructuring +++ /dev/null @@ -1,18 +0,0 @@ -component Main { - fun render : String { - let {a, b} = {"Some string...", "B"} - - a + ", other string..." - } -} --------------------------------------------------------------------------------- -export const A = () => { - const [ - a, - b - ] = [ - `Some string...`, - `B` - ]; - return a + `, other string...` -}; diff --git a/spec/compilers2/bool_literal_false b/spec/compilers2/bool_literal_false deleted file mode 100644 index f602b7803..000000000 --- a/spec/compilers2/bool_literal_false +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - fun render : String { - false - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - false; - return `` -}; diff --git a/spec/compilers2/bool_literal_true b/spec/compilers2/bool_literal_true deleted file mode 100644 index 67d0b3639..000000000 --- a/spec/compilers2/bool_literal_true +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - fun render : String { - true - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - true; - return `` -}; diff --git a/spec/compilers2/bracket_access b/spec/compilers2/bracket_access deleted file mode 100644 index d128c83af..000000000 --- a/spec/compilers2/bracket_access +++ /dev/null @@ -1,43 +0,0 @@ -type Maybe(a) { - Nothing - Just(a) -} - -component Main { - fun render : String { - [ - "Hello", - "Blah", - "Joe" - ][1] - - [][1] - - { "key" => "value" }["key"] - - "" - } -} --------------------------------------------------------------------------------- -import { - bracketAccess as E, - mapAccess as F, - variant as B -} from "./runtime.js"; - -export const - A = B(0), - C = B(1), - D = () => { - E([ - `Hello`, - `Blah`, - `Joe` - ], 1, C, A); - E([], 1, C, A); - F([[ - `key`, - `value` - ]], `key`, C, A); - return `` - }; diff --git a/spec/compilers2/call_labelled b/spec/compilers2/call_labelled deleted file mode 100644 index d3a9a60aa..000000000 --- a/spec/compilers2/call_labelled +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - fun test (argument1 : String, argument2: Number) : String { - "" - } - - fun render : String { - test(argument2: 0, argument1: "") - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = (b, c) => { - return `` - }; - return a(``, 0) -}; diff --git a/spec/compilers2/case b/spec/compilers2/case deleted file mode 100644 index 1b4049e7c..000000000 --- a/spec/compilers2/case +++ /dev/null @@ -1,37 +0,0 @@ -component Main { - fun render : String { - case ("Hello") { - "test" => true - "Hello" => false - => false - } - - "" - } -} --------------------------------------------------------------------------------- -import { match as B } from "./runtime.js"; - -export const A = () => { - B(`Hello`, [ - [ - `test`, - () => { - return true - } - ], - [ - `Hello`, - () => { - return false - } - ], - [ - null, - () => { - return false - } - ] - ]); - return `` -}; diff --git a/spec/compilers2/case_await b/spec/compilers2/case_await deleted file mode 100644 index db208de54..000000000 --- a/spec/compilers2/case_await +++ /dev/null @@ -1,41 +0,0 @@ -component Main { - fun render : String { - { - case await "Hello" { - "test" => true - "Hello" => false - => false - } - } - - "" - } -} --------------------------------------------------------------------------------- -import { match as B } from "./runtime.js"; - -export const A = () => { - (async () => { - return B(await `Hello`, [ - [ - `test`, - () => { - return true - } - ], - [ - `Hello`, - () => { - return false - } - ], - [ - null, - () => { - return false - } - ] - ]) - })(); - return `` -}; diff --git a/spec/compilers2/case_empty b/spec/compilers2/case_empty deleted file mode 100644 index c1812f1d6..000000000 --- a/spec/compilers2/case_empty +++ /dev/null @@ -1,18 +0,0 @@ -component Main { - fun render : String { - case ("Hello") { - => "false" - } - } -} --------------------------------------------------------------------------------- -import { match as B } from "./runtime.js"; - -export const A = () => { - return B(`Hello`, [[ - null, - () => { - return `false` - } - ]]) -}; diff --git a/spec/compilers2/case_with_array_destructuring b/spec/compilers2/case_with_array_destructuring deleted file mode 100644 index acd9f446a..000000000 --- a/spec/compilers2/case_with_array_destructuring +++ /dev/null @@ -1,62 +0,0 @@ -component Main { - fun render : Array(String) { - case ([]) { - [] => [""] - ["a"] => ["a"] - [a] => [a] - [a, b] => [a, b] - [a, b, ...rest] => rest - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as C, - patternSpread as D, - match as B -} from "./runtime.js"; - -export const A = () => { - return B([], [ - [ - [], - () => { - return [``] - } - ], - [ - [`a`], - () => { - return [`a`] - } - ], - [ - [C], - (a) => { - return [a] - } - ], - [ - [ - C, - C - ], - (b, c) => { - return [ - b, - c - ] - } - ], - [ - [ - C, - C, - D - ], - (d, e, f) => { - return f - } - ] - ]) -}; diff --git a/spec/compilers2/case_with_nested_tuple_destructuring b/spec/compilers2/case_with_nested_tuple_destructuring deleted file mode 100644 index 249c7d057..000000000 --- a/spec/compilers2/case_with_nested_tuple_destructuring +++ /dev/null @@ -1,66 +0,0 @@ -component Main { - fun render : String { - case ({"A", {"B", "C"}}) { - {"A", {"C", "D"}} => - "B" - - {"A", {"B", "C"}} => - "A" - - {a, {b, c}} => - b - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as C, - match as B -} from "./runtime.js"; - -export const A = () => { - return B([ - `A`, - [ - `B`, - `C` - ] - ], [ - [ - [ - `A`, - [ - `C`, - `D` - ] - ], - () => { - return `B` - } - ], - [ - [ - `A`, - [ - `B`, - `C` - ] - ], - () => { - return `A` - } - ], - [ - [ - C, - [ - C, - C - ] - ], - (a, b, c) => { - return b - } - ] - ]) -}; diff --git a/spec/compilers2/case_with_tuple_destructuring b/spec/compilers2/case_with_tuple_destructuring deleted file mode 100644 index 273dd6555..000000000 --- a/spec/compilers2/case_with_tuple_destructuring +++ /dev/null @@ -1,58 +0,0 @@ -component Main { - fun render : String { - case ({"A", 0, true}) { - {"A", 0, false} => - "B" - - {"A", 0, true} => - "A" - - {a, b, c} => - a - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as C, - match as B -} from "./runtime.js"; - -export const A = () => { - return B([ - `A`, - 0, - true - ], [ - [ - [ - `A`, - 0, - false - ], - () => { - return `B` - } - ], - [ - [ - `A`, - 0, - true - ], - () => { - return `A` - } - ], - [ - [ - C, - C, - C - ], - (a, b, c) => { - return a - } - ] - ]) -}; diff --git a/spec/compilers2/case_with_tuple_destructuring_bool b/spec/compilers2/case_with_tuple_destructuring_bool deleted file mode 100644 index d466229b7..000000000 --- a/spec/compilers2/case_with_tuple_destructuring_bool +++ /dev/null @@ -1,47 +0,0 @@ -component Main { - fun render : String { - case ({false, true}) { - {true, false} => - "B" - - {false, true} => - "A" - - => "C" - } - } -} --------------------------------------------------------------------------------- -import { match as B } from "./runtime.js"; - -export const A = () => { - return B([ - false, - true - ], [ - [ - [ - true, - false - ], - () => { - return `B` - } - ], - [ - [ - false, - true - ], - () => { - return `A` - } - ], - [ - null, - () => { - return `C` - } - ] - ]) -}; diff --git a/spec/compilers2/case_with_type_destructuring b/spec/compilers2/case_with_type_destructuring deleted file mode 100644 index 892c40be6..000000000 --- a/spec/compilers2/case_with_type_destructuring +++ /dev/null @@ -1,58 +0,0 @@ -type A(a) { - B(a) -} - -type C(a) { - D(A(a)) - X -} - -component Main { - fun render : String { - case (C.D(A.B(""))) { - C.X => "" - C.D(a) => - case (a) { - A.B(c) => - c - } - } - - "" - } -} --------------------------------------------------------------------------------- -import { - patternVariable as I, - newVariant as G, - pattern as H, - variant as B, - match as F -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = B(1), - E = () => { - F(G(A)(G(D)(``)), [ - [ - H(C, []), - () => { - return `` - } - ], - [ - H(A, [I]), - (a) => { - return F(a, [[ - H(D, [I]), - (b) => { - return b - } - ]]) - } - ] - ]); - return `` - }; diff --git a/spec/compilers2/component b/spec/compilers2/component deleted file mode 100644 index 49d297c64..000000000 --- a/spec/compilers2/component +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `` -}; diff --git a/spec/compilers2/component_global b/spec/compilers2/component_global deleted file mode 100644 index e78a0b59d..000000000 --- a/spec/compilers2/component_global +++ /dev/null @@ -1,45 +0,0 @@ -global component Notifications { - state test : String = "" - - get value : String { - test - } - - fun notify (value : String) : String { - value - } - - fun render : Html { -
- value -
- } -} - -component Main { - fun render : Html { -
- Notifications.notify("Hello") -
- } -} --------------------------------------------------------------------------------- -import { - createElement as B, - signal as D -} from "./runtime.js"; - -export const - A = () => { - return B(`div`, {}, [a()]) - }, - b = (c) => { - return c - }, - C = () => { - return B(`div`, {}, [b(`Hello`)]) - }, - d = D(``), - a = () => { - return d.value - }; diff --git a/spec/compilers2/component_instance_access b/spec/compilers2/component_instance_access deleted file mode 100644 index 71bc658c1..000000000 --- a/spec/compilers2/component_instance_access +++ /dev/null @@ -1,83 +0,0 @@ -type Maybe(value) { - Just(value) - Nothing -} - -component Instance { - get name : String { - "Instance" - } - - fun render : Html { -
- } -} - -component Main { - fun handleClick : String { - case (instance) { - Just(component) => component.name - Nothing => "" - } - } - - fun render : Html { -
- -
- } -} --------------------------------------------------------------------------------- -import { - patternVariable as K, - createElement as F, - pattern as J, - useMemo as E, - variant as B, - setRef as L, - useRef as H, - match as I -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = ({ - _ - }) => { - const a = () => { - return `Instance` - }; - const b = E(() => { - return { - a - } - }, []); - (_ ? _(b) : null); - return F(`div`, {}) - }, - G = () => { - const - c = H(new C()), - d = () => { - return I(c.current, [ - [ - J(A, [K]), - (e) => { - return e.a() - } - ], - [ - J(C, []), - () => { - return `` - } - ] - ]) - }; - return F(`div`, { - "onClick": d - }, [F(D, { - _: L(c, A) - })]) - }; diff --git a/spec/compilers2/component_namespaced b/spec/compilers2/component_namespaced deleted file mode 100644 index 450ad76d7..000000000 --- a/spec/compilers2/component_namespaced +++ /dev/null @@ -1,21 +0,0 @@ -component Ui.Dropdown { - fun render : String { - "test" - } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as C } from "./runtime.js"; - -export const - A = () => { - return `test` - }, - B = () => { - return C(A, {}) - }; diff --git a/spec/compilers2/component_namespaced_with_style b/spec/compilers2/component_namespaced_with_style deleted file mode 100644 index 7c36f4e5e..000000000 --- a/spec/compilers2/component_namespaced_with_style +++ /dev/null @@ -1,35 +0,0 @@ -component Ui.Dropdown { - style base { - background: red; - } - - fun render : Html { - - "test" -
- } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Ui·Dropdown_base { - background: red; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const - A = () => { - return B(`div`, { - className: `Ui·Dropdown_base` - }, [`test`]) - }, - C = () => { - return B(A, {}) - }; diff --git a/spec/compilers2/component_readonly b/spec/compilers2/component_readonly deleted file mode 100644 index 536a5716d..000000000 --- a/spec/compilers2/component_readonly +++ /dev/null @@ -1,27 +0,0 @@ -component Test { - property readonly : Bool = false - - fun render : Html { -
- } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - A = ({ - a = false - }) => { - return B(`div`, {}) - }, - C = () => { - return B(A, { - a: true - }) - }; diff --git a/spec/compilers2/component_with_provider b/spec/compilers2/component_with_provider deleted file mode 100644 index d3c75e115..000000000 --- a/spec/compilers2/component_with_provider +++ /dev/null @@ -1,50 +0,0 @@ -type MouseProvider.Data { - moves : Function(Position, Void), - ups : Function(Position, Void) -} - -provider MouseProvider : MouseProvider.Data { - fun update : Void { - void - } -} - -component Main { - use MouseProvider { - moves: (data : Position) : Void { void }, - ups: (data : Position) : Void { void } - } when { - false - } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { - createProvider as B, - createElement as E, - useId as D -} from "./runtime.js"; - -export const - a = new Map(), - A = B(a, () => { - return null - }), - C = () => { - const b = D(); - A(b, () => { - return (false ? { - moves: (c) => { - return null - }, - ups: (d) => { - return null - } - } : null) - }); - return E(`div`, {}) - }; - diff --git a/spec/compilers2/component_with_provider_and_lifecycle_functions b/spec/compilers2/component_with_provider_and_lifecycle_functions deleted file mode 100644 index 78184033a..000000000 --- a/spec/compilers2/component_with_provider_and_lifecycle_functions +++ /dev/null @@ -1,74 +0,0 @@ -type MouseProvider.Data { - moves : Function(Position, Void), - ups : Function(Position, Void) -} - -provider MouseProvider : MouseProvider.Data { - fun update : Void { - void - } -} - -component Main { - use MouseProvider { - moves: (data : Position) : Void { void }, - ups: (data : Position) : Void { void } - } when { - false - } - - fun componentWillUnmount : Void { - void - } - - fun componentDidUpdate : Void { - void - } - - fun componentDidMount : Void { - void - } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { - createProvider as B, - createElement as G, - useDidUpdate as F, - useEffect as E, - useId as D -} from "./runtime.js"; - -export const - a = new Map(), - A = B(a, () => { - return null - }), - C = () => { - const b = D(); - E(() => { - (() => { - return null - })(); - return () => { - return null - } - }, []); - F(() => { - return null - }); - A(b, () => { - return (false ? { - moves: (c) => { - return null - }, - ups: (d) => { - return null - } - } : null) - }); - return G(`div`, {}) - }; diff --git a/spec/compilers2/component_with_provider_and_store b/spec/compilers2/component_with_provider_and_store deleted file mode 100644 index 75cfa0f77..000000000 --- a/spec/compilers2/component_with_provider_and_store +++ /dev/null @@ -1,64 +0,0 @@ -type MouseProvider.Data { - moves : Function(Position, Void), - ups : Function(Position, Void) -} - -provider MouseProvider : MouseProvider.Data { - fun update : Void { - void - } -} - -store Blah { - state test : String = "" - - fun x : String { - "hello" - } -} - -component Main { - use MouseProvider { - moves: (data : Position) : Void { void }, - ups: (data : Position) : Void { void } - } when { - false - } - - connect Blah exposing { test, x } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { - createProvider as C, - createElement as F, - signal as A, - useId as E -} from "./runtime.js"; - -export const - a = new Map(), - b = () => { - return `hello` - }, - c = A(``), - B = C(a, () => { - return null - }), - D = () => { - const d = E(); - B(d, () => { - return (false ? { - moves: (e) => { - return null - }, - ups: (f) => { - return null - } - } : null) - }); - return F(`div`, {}) - }; diff --git a/spec/compilers2/constant_component b/spec/compilers2/constant_component deleted file mode 100644 index 22be68c2f..000000000 --- a/spec/compilers2/constant_component +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - const NAME = "ASD" - - fun render : String { - NAME - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = `ASD`; - return a -}; diff --git a/spec/compilers2/constant_global_component b/spec/compilers2/constant_global_component deleted file mode 100644 index 2f286b541..000000000 --- a/spec/compilers2/constant_global_component +++ /dev/null @@ -1,26 +0,0 @@ -global component Test { - const NAME = "ASD" - - fun render : String { - NAME - } -} - -component Main { - fun render : Html { -
- Test.NAME -
- } -} --------------------------------------------------------------------------------- -import { createElement as C } from "./runtime.js"; - -export const - A = () => { - return a - }, - a = `ASD`, - B = () => { - return C(`div`, {}, [a]) - }; diff --git a/spec/compilers2/constant_module b/spec/compilers2/constant_module deleted file mode 100644 index 2957d19db..000000000 --- a/spec/compilers2/constant_module +++ /dev/null @@ -1,20 +0,0 @@ -module Test { - const NAME = "ASD" -} - -component Main { - fun render : Html { -
- Test.NAME -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - a = `ASD`, - A = () => { - return B(`div`, {}, [a]) - }; - diff --git a/spec/compilers2/constant_store b/spec/compilers2/constant_store deleted file mode 100644 index c0dcfedc5..000000000 --- a/spec/compilers2/constant_store +++ /dev/null @@ -1,20 +0,0 @@ -store Test { - const NAME = "ASD" -} - -component Main { - fun render : Html { -
- Test.NAME -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - a = `ASD`, - A = () => { - return B(`div`, {}, [a]) - }; - diff --git a/spec/compilers2/constant_store_exposed b/spec/compilers2/constant_store_exposed deleted file mode 100644 index 983dbddec..000000000 --- a/spec/compilers2/constant_store_exposed +++ /dev/null @@ -1,21 +0,0 @@ -store Test { - const NAME = "ASD" -} - -component Main { - connect Test exposing { NAME } - - fun render : Html { -
- NAME -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - a = `ASD`, - A = () => { - return B(`div`, {}, [a]) - }; diff --git a/spec/compilers2/css_definition b/spec/compilers2/css_definition deleted file mode 100644 index bd72fb6bf..000000000 --- a/spec/compilers2/css_definition +++ /dev/null @@ -1,41 +0,0 @@ -component Main { - style test { - margin: #{margin}px 0px; - } - - get margin : Number { - 10 - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - margin: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const - a = () => { - return 10 - }, - b = () => { - const _ = { - [`--a-a`]: a() + `px 0px` - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([b()]) - }) -}; diff --git a/spec/compilers2/css_font_face b/spec/compilers2/css_font_face deleted file mode 100644 index 0d40aa332..000000000 --- a/spec/compilers2/css_font_face +++ /dev/null @@ -1,39 +0,0 @@ -component Main { - style test { - @font-face { - src: url(sansation_light.woff); - font-family: myFirstFont; - } - - @font-face { - src: url(sansation_light2.woff); - font-family: myFirstFont; - font-weight: bold; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -@font-face { - src: url(sansation_light.woff); - font-family: myFirstFont; -} - -@font-face { - src: url(sansation_light2.woff); - font-family: myFirstFont; - font-weight: bold; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `Main_test` - }) -}; diff --git a/spec/compilers2/css_font_face_with_quotes b/spec/compilers2/css_font_face_with_quotes deleted file mode 100644 index 379a60465..000000000 --- a/spec/compilers2/css_font_face_with_quotes +++ /dev/null @@ -1,33 +0,0 @@ -component Main { - style test { - @font-face { - src: url(sansation_light.woff); - font-family: myFirstFont; - } - - font-family: "myFirstFont"; - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - font-family: "myFirstFont"; -} - -@font-face { - src: url(sansation_light.woff); - font-family: myFirstFont; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `Main_test` - }) -}; diff --git a/spec/compilers2/css_keyframes b/spec/compilers2/css_keyframes deleted file mode 100644 index eb807256d..000000000 --- a/spec/compilers2/css_keyframes +++ /dev/null @@ -1,72 +0,0 @@ -component Main { - state opacity : Number = 1 - - style test { - @keyframes animation { - from { - opacity: 0; - } - - to { - opacity: #{opacity}; - } - } - - @keyframes animation { - from { - opacity: 0; - } - - to { - opacity: 1; - } - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -@keyframes animation { - from { - opacity: 0; - } - - to { - opacity: var(--a-a); - } -} - -@keyframes animation { - from { - opacity: 0; - } - - to { - opacity: 1; - } -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(1), - b = () => { - const _ = { - [`--a-a`]: a.value - }; - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([b()]) - }) -}; diff --git a/spec/compilers2/css_media b/spec/compilers2/css_media deleted file mode 100644 index 105687c2e..000000000 --- a/spec/compilers2/css_media +++ /dev/null @@ -1,54 +0,0 @@ -component Main { - style test { - div { - color: #{color}; - } - - @media (screen) { - color: #{color}; - } - } - - get color : String { - "blue" - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test div { - color: var(--a-a); -} - -@media (screen) { - .Main_test { - color: var(--b-a); - } -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const - a = () => { - return `blue` - }, - b = () => { - const _ = { - [`--a-a`]: a(), - [`--b-a`]: a() - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([b()]) - }) -}; diff --git a/spec/compilers2/css_media_with_if b/spec/compilers2/css_media_with_if deleted file mode 100644 index a309f821a..000000000 --- a/spec/compilers2/css_media_with_if +++ /dev/null @@ -1,46 +0,0 @@ -component Main { - style test { - color: yellow; - - @media (max-width: 300px) { - if (true) { - color: red; - } - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: yellow; -} - -@media (max-width: 300px) { - .Main_test { - color: var(--a-a); - } -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : null); - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a()]) - }) -}; diff --git a/spec/compilers2/css_selector b/spec/compilers2/css_selector deleted file mode 100644 index cb4e1cd3e..000000000 --- a/spec/compilers2/css_selector +++ /dev/null @@ -1,51 +0,0 @@ -component Main { - style test { - div { - color: #{color}; - } - - &:focus { - color: red; - } - } - - get color : String { - "blue" - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test div { - color: var(--a-a); -} - -.Main_test:focus { - color: red; -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const - a = () => { - return `blue` - }, - b = () => { - const _ = { - [`--a-a`]: a() - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([b()]) - }) -}; diff --git a/spec/compilers2/css_selector_multiple b/spec/compilers2/css_selector_multiple deleted file mode 100644 index c56eeb3e6..000000000 --- a/spec/compilers2/css_selector_multiple +++ /dev/null @@ -1,56 +0,0 @@ -component Main { - style test { - div { - color: #{color}; - } - - &:focus, - &:hover { - color: red; - } - } - - get color : String { - "blue" - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test div { - color: var(--a-a); -} - -.Main_test:focus { - color: red; -} - -.Main_test:hover { - color: red; -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const - a = () => { - return `blue` - }, - b = () => { - const _ = { - [`--a-a`]: a() - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([b()]) - }) -}; diff --git a/spec/compilers2/css_string b/spec/compilers2/css_string deleted file mode 100644 index 18848fa9c..000000000 --- a/spec/compilers2/css_string +++ /dev/null @@ -1,42 +0,0 @@ -component Main { - state name : String = "Joe" - - style unicode { - span::after { - content: "Hi" blah #{name} "Here is some content; Thanks #{name}"; - } - } - - fun render { - - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_unicode span::after { - content: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(`Joe`), - b = () => { - const _ = { - [`--a-a`]: `"Hi"` + ` blah ` + a.value + ` ` + `"Here is some content; Thanks ${a.value}"` - }; - return _ - }; - return C(`div`, { - className: `Main_unicode`, - style: D([b()]) - }, [C(`span`, {})]) -}; diff --git a/spec/compilers2/css_supports b/spec/compilers2/css_supports deleted file mode 100644 index 18c78c620..000000000 --- a/spec/compilers2/css_supports +++ /dev/null @@ -1,42 +0,0 @@ -component Main { - state color : String = "blue" - - style test { - @supports (screen) { - color: #{color}; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -@supports (screen) { - .Main_test { - color: var(--a-a); - } -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(`blue`), - b = () => { - const _ = { - [`--a-a`]: a.value - }; - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([b()]) - }) -}; diff --git a/spec/compilers2/css_with_ands b/spec/compilers2/css_with_ands deleted file mode 100644 index c7ed74e87..000000000 --- a/spec/compilers2/css_with_ands +++ /dev/null @@ -1,41 +0,0 @@ -component Main { - style test { - &:focus { - color: red; - } - - &[someattribute] { - color: red; - } - - &.someclass { - color: red; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test:focus { - color: red; -} - -.Main_test[someattribute] { - color: red; -} - -.Main_test.someclass { - color: red; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `Main_test` - }) -}; diff --git a/spec/compilers2/css_with_arguments b/spec/compilers2/css_with_arguments deleted file mode 100644 index da0f4deec..000000000 --- a/spec/compilers2/css_with_arguments +++ /dev/null @@ -1,33 +0,0 @@ -component Main { - style test(color : String) { - color: #{color}; - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = (b) => { - const _ = { - [`--a-a`]: b - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a(`red`)]) - }) -}; diff --git a/spec/compilers2/css_with_case b/spec/compilers2/css_with_case deleted file mode 100644 index b3154b5dd..000000000 --- a/spec/compilers2/css_with_case +++ /dev/null @@ -1,58 +0,0 @@ -component Main { - style test { - color: yellow; - - case ("a") { - "a" => - color: red; - - => - color: blue; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a, yellow); -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - style as D, - match as B -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - B(`a`, [ - [ - `a`, - () => { - return Object.assign(_, { - [`--a-a`]: `red` - }) - } - ], - [ - null, - () => { - return Object.assign(_, { - [`--a-a`]: `blue` - }) - } - ] - ]); - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([a()]) - }) -}; diff --git a/spec/compilers2/css_with_else_if b/spec/compilers2/css_with_else_if deleted file mode 100644 index 2579ad24d..000000000 --- a/spec/compilers2/css_with_else_if +++ /dev/null @@ -1,47 +0,0 @@ -component Main { - style base(color : String) { - height: 20px; - - if (color == "red") { - background: red; - } else if (color == "blue") { - background: blue; - } - } - - - fun render : Html { -
- -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_base { - height: 20px; - background: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - compare as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const a = (b) => { - const _ = {}; - (B(b, `red`) ? Object.assign(_, { - [`--a-a`]: `red` - }) : (B(b, `blue`) ? Object.assign(_, { - [`--a-a`]: `blue` - }) : null)); - return _ - }; - return C(`div`, {}, [C(`div`, { - className: `Main_base`, - style: D([a(`blue`)]) - })]) -}; diff --git a/spec/compilers2/css_with_if b/spec/compilers2/css_with_if deleted file mode 100644 index 4ef9ba40c..000000000 --- a/spec/compilers2/css_with_if +++ /dev/null @@ -1,42 +0,0 @@ -component Main { - style test { - color: yellow; - - if (true) { - color: red; - } else { - color: blue; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a, yellow); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : Object.assign(_, { - [`--a-a`]: `blue` - })); - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a()]) - }) -}; diff --git a/spec/compilers2/css_with_if_and_case b/spec/compilers2/css_with_if_and_case deleted file mode 100644 index 912338228..000000000 --- a/spec/compilers2/css_with_if_and_case +++ /dev/null @@ -1,66 +0,0 @@ -component Main { - style test { - color: yellow; - - case (true) { - true => color: yellow; - => color: cyan; - } - - if (true) { - color: red; - } else { - color: blue; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a, yellow); -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - style as D, - match as B -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - B(true, [ - [ - true, - () => { - return Object.assign(_, { - [`--a-a`]: `yellow` - }) - } - ], - [ - null, - () => { - return Object.assign(_, { - [`--a-a`]: `cyan` - }) - } - ] - ]); - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : Object.assign(_, { - [`--a-a`]: `blue` - })); - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([a()]) - }) -}; diff --git a/spec/compilers2/css_with_if_same_condition b/spec/compilers2/css_with_if_same_condition deleted file mode 100644 index b470533b5..000000000 --- a/spec/compilers2/css_with_if_same_condition +++ /dev/null @@ -1,59 +0,0 @@ -component Main { - style test { - .tag { - if (true) { - color: red; - } else { - color: blue; - } - } - - .string { - if (true) { - color: yellow; - } else { - color: cyan; - } - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test .tag { - color: var(--a-a); -} - -.Main_test .string { - color: var(--b-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : Object.assign(_, { - [`--a-a`]: `blue` - })); - (true ? Object.assign(_, { - [`--b-a`]: `yellow` - }) : Object.assign(_, { - [`--b-a`]: `cyan` - })); - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a()]) - }) -}; diff --git a/spec/compilers2/css_with_if_with_interpolation b/spec/compilers2/css_with_if_with_interpolation deleted file mode 100644 index 54a2e3500..000000000 --- a/spec/compilers2/css_with_if_with_interpolation +++ /dev/null @@ -1,42 +0,0 @@ -component Main { - style test { - color: yellow; - - if (true) { - color: #{"red"}; - } else { - color: blue; - } - } - - fun render : Html { - - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a, yellow); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = () => { - const _ = {}; - (true ? Object.assign(_, { - [`--a-a`]: `red` - }) : Object.assign(_, { - [`--a-a`]: `blue` - })); - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a()]) - }) -}; diff --git a/spec/compilers2/dce_remove_component b/spec/compilers2/dce_remove_component deleted file mode 100644 index bf8074864..000000000 --- a/spec/compilers2/dce_remove_component +++ /dev/null @@ -1,6 +0,0 @@ -component Test { - fun render : Html { -
- } -} --------------------------------------------------------------------------------- diff --git a/spec/compilers2/dce_remove_component_computed_property b/spec/compilers2/dce_remove_component_computed_property deleted file mode 100644 index 4313d58e8..000000000 --- a/spec/compilers2/dce_remove_component_computed_property +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - get test : String { - "" - } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, {}) -}; diff --git a/spec/compilers2/dce_remove_component_function b/spec/compilers2/dce_remove_component_function deleted file mode 100644 index b7e25d8a6..000000000 --- a/spec/compilers2/dce_remove_component_function +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - fun test : String { - "" - } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, {}) -}; diff --git a/spec/compilers2/dce_remove_enum b/spec/compilers2/dce_remove_enum deleted file mode 100644 index 422202fea..000000000 --- a/spec/compilers2/dce_remove_enum +++ /dev/null @@ -1,6 +0,0 @@ -type Test { - X - Y - Z -} --------------------------------------------------------------------------------- diff --git a/spec/compilers2/dce_remove_module b/spec/compilers2/dce_remove_module deleted file mode 100644 index ffd83a5f9..000000000 --- a/spec/compilers2/dce_remove_module +++ /dev/null @@ -1,6 +0,0 @@ -module Test { - fun test : String { - "" - } -} --------------------------------------------------------------------------------- diff --git a/spec/compilers2/dce_remove_module_function b/spec/compilers2/dce_remove_module_function deleted file mode 100644 index 1660281fc..000000000 --- a/spec/compilers2/dce_remove_module_function +++ /dev/null @@ -1,23 +0,0 @@ -module Test { - fun test : String { - "" - } - - fun x : String { - "" - } -} - -component Main { - fun render : String { - Test.test() - } -} --------------------------------------------------------------------------------- -export const - a = () => { - return `` - }, - A = () => { - return a() - }; diff --git a/spec/compilers2/dce_remove_provider b/spec/compilers2/dce_remove_provider deleted file mode 100644 index b4a62740e..000000000 --- a/spec/compilers2/dce_remove_provider +++ /dev/null @@ -1,10 +0,0 @@ -type Subscription { - name : String -} - -provider MouseProvider : Subscription { - fun attach : Void { - void - } -} --------------------------------------------------------------------------------- diff --git a/spec/compilers2/dce_remove_store b/spec/compilers2/dce_remove_store deleted file mode 100644 index da746ab3e..000000000 --- a/spec/compilers2/dce_remove_store +++ /dev/null @@ -1,6 +0,0 @@ -store Test { - fun test : String { - "" - } -} --------------------------------------------------------------------------------- diff --git a/spec/compilers2/dce_style b/spec/compilers2/dce_style deleted file mode 100644 index 278f4f988..000000000 --- a/spec/compilers2/dce_style +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - style test { - color: red; - } - - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, {}) -}; diff --git a/spec/compilers2/decode b/spec/compilers2/decode deleted file mode 100644 index 027759c6f..000000000 --- a/spec/compilers2/decode +++ /dev/null @@ -1,42 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -type X.Y { - blah : String -} - -type X { - name : String, - y: X.Y -} - -component Main { - fun render : String { - decode `null` as Object as X - - "" - } -} --------------------------------------------------------------------------------- -import { - decodeString as E, - decoder as D, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - a = D({ - blah: E(C, A) - }, C, A), - b = D({ - name: E(C, A), - y: a - }, C, A), - F = () => { - b((null)); - return `` - }; diff --git a/spec/compilers2/decode_function b/spec/compilers2/decode_function deleted file mode 100644 index 824734bac..000000000 --- a/spec/compilers2/decode_function +++ /dev/null @@ -1,42 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -type X.Y { - blah : String -} - -type X { - name : String, - y: X.Y -} - -component Main { - fun render : String { - (decode as X)(`null`) - - "" - } -} --------------------------------------------------------------------------------- -import { - decodeString as E, - decoder as D, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - a = D({ - blah: E(C, A) - }, C, A), - b = D({ - name: E(C, A), - y: a - }, C, A), - F = () => { - (b)((null)); - return `` - }; diff --git a/spec/compilers2/decode_map b/spec/compilers2/decode_map deleted file mode 100644 index 5b42bd6e9..000000000 --- a/spec/compilers2/decode_map +++ /dev/null @@ -1,26 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -component Main { - fun render : String { - decode (`[]`) as Map(String, Number) - - "" - } -} --------------------------------------------------------------------------------- -import { - decodeNumber as F, - decodeMap as E, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - D = () => { - E(F(C, A), C, A)((([]))); - return `` - }; diff --git a/spec/compilers2/decode_tuple b/spec/compilers2/decode_tuple deleted file mode 100644 index ec12d75e8..000000000 --- a/spec/compilers2/decode_tuple +++ /dev/null @@ -1,31 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -component Main { - fun render : String { - decode (`[]`) as Tuple(String, Number, String) - - "" - } -} --------------------------------------------------------------------------------- -import { - decodeNumber as G, - decodeString as F, - decodeTuple as E, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(1), - D = () => { - E([ - F(C, A), - G(C, A), - F(C, A) - ], C, A)((([]))); - return `` - }; diff --git a/spec/compilers2/decoder b/spec/compilers2/decoder deleted file mode 100644 index b92ae10e7..000000000 --- a/spec/compilers2/decoder +++ /dev/null @@ -1,66 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -type Maybe(a) { - Just(a) - Nothing -} - -type Y { - size : Number using "SIIIZEEE" -} - -type X { - maybe : Maybe(String), - array : Array(String), - string : String, - number : Number, - bool : Bool, - time : Time, - y : Y -} - -component Main { - fun render : String { - decode `` as Object as X - "" - } -} --------------------------------------------------------------------------------- -import { - decodeBoolean as K, - decodeString as I, - decodeNumber as G, - decodeArray as J, - decodeMaybe as H, - decodeTime as L, - decoder as F, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = B(1), - E = B(1), - a = F({ - size: [ - G(E, D), - "SIIIZEEE" - ] - }, E, D), - b = F({ - maybe: H(I(E, D), E, D, A, C), - array: J(I(E, D), E, D), - string: I(E, D), - number: G(E, D), - bool: K(E, D), - time: L(E, D), - y: a - }, E, D), - M = () => { - b(undefined); - return `` - }; diff --git a/spec/compilers2/destructuring b/spec/compilers2/destructuring deleted file mode 100644 index 02d4e1a7c..000000000 --- a/spec/compilers2/destructuring +++ /dev/null @@ -1,58 +0,0 @@ -type Test { - Item( - matchString : String, - content : String, - key : String) - None -} - -component Main { - fun render : String { - let item = - Test.Item( - matchString: "MATCHSTRING", - content: "CONTENT", - key: "KEY") - - case item { - Test.Item(_, content) => content - Test.None => "" - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - newVariant as E, - pattern as G, - variant as B, - match as F -} from "./runtime.js"; - -export const - A = B([ - "matchString", - "content", - "key" - ]), - C = B(0), - D = () => { - const a = E(A)(`MATCHSTRING`, `CONTENT`, `KEY`); - return F(a, [ - [ - G(A, [ - null, - H - ]), - (b) => { - return b - } - ], - [ - G(C, []), - () => { - return `` - } - ] - ]) - }; diff --git a/spec/compilers2/directives/asset b/spec/compilers2/directives/asset deleted file mode 100644 index af918d403..000000000 --- a/spec/compilers2/directives/asset +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - fun render : String { - @asset(../../fixtures/icon.svg) - } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.js ===--- -export const A = () => { - return `/__mint__/icon_c97b81630bc53286dadc8996727d348e.svg` -}; - ----=== /__mint__/icon_c97b81630bc53286dadc8996727d348e.svg ===--- - - - diff --git a/spec/compilers2/directives/documentation b/spec/compilers2/directives/documentation deleted file mode 100644 index e0f781118..000000000 --- a/spec/compilers2/directives/documentation +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - fun render : String { - @documentation(Main) - - "Hello There" - } -} --------------------------------------------------------------------------------- -export const A = () => { - {"description":null,"name":"Main","connects":[],"computed-properties":[],"properties":[],"functions":[{"type":"String","description":null,"name":"render","source":"fun render : String {\n @documentation(Main)\n\n \"Hello There\"\n}","arguments":[]}],"providers":[],"states":[]}; - return `Hello There` -}; diff --git a/spec/compilers2/directives/format b/spec/compilers2/directives/format deleted file mode 100644 index 4907c73bb..000000000 --- a/spec/compilers2/directives/format +++ /dev/null @@ -1,22 +0,0 @@ -component Main { - fun render : String { - let {result, formatted} = - @format { - "HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloH" \ - "Bello" - } - - result + formatted - } -} --------------------------------------------------------------------------------- -export const A = () => { - const [ - a, - b - ] = [ - `HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello`, - `"HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHBello"` - ]; - return a + b -}; diff --git a/spec/compilers2/directives/highlight b/spec/compilers2/directives/highlight deleted file mode 100644 index d84cc1219..000000000 --- a/spec/compilers2/directives/highlight +++ /dev/null @@ -1,23 +0,0 @@ -component Main { - fun render : Html { - @highlight { - "Test" - }[1] - } -} --------------------------------------------------------------------------------- -import { - createElement as B, - fragment as C -} from "./runtime.js"; - -export const A = () => { - return [ - `Test`, - B(C, {}, [B("span", { - className: "line" - }, [B("span", { - className: "string" - }, [`"Test"`])])]) - ][1] -}; diff --git a/spec/compilers2/directives/highlight-file b/spec/compilers2/directives/highlight-file deleted file mode 100644 index 2d16a9615..000000000 --- a/spec/compilers2/directives/highlight-file +++ /dev/null @@ -1,63 +0,0 @@ -component Main { - fun render : Html { - @highlight-file(../../fixtures/Test.mint) - } -} --------------------------------------------------------------------------------- -import { - createElement as B, - fragment as C -} from "./runtime.js"; - -export const A = () => { - return B(C, {}, [ - B("span", { - className: "line" - }, [ - B("span", { - className: "keyword" - }, [`component`]), - ` `, - B("span", { - className: "type" - }, [`Main`]), - ` { -` - ]), - B("span", { - className: "line" - }, [ - ` `, - B("span", { - className: "keyword" - }, [`fun`]), - ` render : `, - B("span", { - className: "type" - }, [`Html`]), - ` { -` - ]), - B("span", { - className: "line" - }, [ - ` <`, - B("span", { - className: "namespace" - }, [`div`]), - `> -` - ]), - B("span", { - className: "line" - }, [` } -`]), - B("span", { - className: "line" - }, [`}`]) - ]) -}; diff --git a/spec/compilers2/directives/svg b/spec/compilers2/directives/svg deleted file mode 100644 index b29598232..000000000 --- a/spec/compilers2/directives/svg +++ /dev/null @@ -1,20 +0,0 @@ -component Main { - fun render : Html { - @svg(../../fixtures/icon.svg) - } -} --------------------------------------------------------------------------------- -import { createElement as A } from "./runtime.js"; - -export const - a = A(`svg`, { - dangerouslySetInnerHTML: { - __html: `` - }, - viewBox: `0 0 24 24`, - height: `24`, - width: `24` - }), - B = () => { - return a - }; diff --git a/spec/compilers2/encode b/spec/compilers2/encode deleted file mode 100644 index 8998765c2..000000000 --- a/spec/compilers2/encode +++ /dev/null @@ -1,30 +0,0 @@ -type Test { - name : String, - age : Number -} - -component Main { - fun render : String { - encode { name: "Hello", age: 20 } - - "" - } -} --------------------------------------------------------------------------------- -import { - identity as B, - encoder as A -} from "./runtime.js"; - -export const - a = A({ - name: B, - age: B - }), - C = () => { - a({ - name: `Hello`, - age: 20 - }); - return `` - }; diff --git a/spec/compilers2/env b/spec/compilers2/env deleted file mode 100644 index ed8ec9192..000000000 --- a/spec/compilers2/env +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - @TEST - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `TRUE` -}; diff --git a/spec/compilers2/field b/spec/compilers2/field deleted file mode 100644 index fa3afe1d4..000000000 --- a/spec/compilers2/field +++ /dev/null @@ -1,25 +0,0 @@ -type Test { - a : String, - b : Number -} - -component Main { - fun render : Html { - { - a: "Hello", - b: 0 - } - -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - { - a: `Hello`, - b: 0 - }; - return B(`div`, {}) -}; diff --git a/spec/compilers2/field_access b/spec/compilers2/field_access deleted file mode 100644 index d71b54574..000000000 --- a/spec/compilers2/field_access +++ /dev/null @@ -1,43 +0,0 @@ -type X { - name : String -} - -module Array { - fun map (array : Array(a), method : Function(a, b)) : Array(b) { - `` - } -} - -component Main { - fun render : String { - [ - { - name: "Joe" - }, - { - name: "Doe" - } - ] - |> Array.map(.name(X)) - - "asd" - } -} --------------------------------------------------------------------------------- -import { access as B } from "./runtime.js"; - -export const - a = (b, c) => { - return undefined - }, - A = () => { - a([ - { - name: `Joe` - }, - { - name: `Doe` - } - ], B(`name`)); - return `asd` - }; diff --git a/spec/compilers2/for b/spec/compilers2/for deleted file mode 100644 index 22d344709..000000000 --- a/spec/compilers2/for +++ /dev/null @@ -1,27 +0,0 @@ -component Main { - fun render : Array(Html) { - for (item of ["A", "B"]) { -
- item -
- } - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return (() => { - const _0 = []; - const _1 = [ - `A`, - `B` - ]; - let _i = -1; - for (let a of _1) { - _i++; - _0.push(B(`div`, {}, [a])) - }; - return _0 - })() -}; diff --git a/spec/compilers2/for_with_index b/spec/compilers2/for_with_index deleted file mode 100644 index 1b1e470ec..000000000 --- a/spec/compilers2/for_with_index +++ /dev/null @@ -1,37 +0,0 @@ -component Main { - fun render : Array(Html) { - for (item, index of ["A", "B"]) { -
- item -
- } when { - index == 10 - } - } -} --------------------------------------------------------------------------------- -import { - createElement as C, - compare as B -} from "./runtime.js"; - -export const A = () => { - return (() => { - const _0 = []; - const _1 = [ - `A`, - `B` - ]; - let _i = -1; - for (let a of _1) { - _i++; - const b = _i; - const _2 = B(b, 10); - if (!_2) { - continue - }; - _0.push(C(`div`, {}, [a])) - }; - return _0 - })() -}; diff --git a/spec/compilers2/for_with_index_2 b/spec/compilers2/for_with_index_2 deleted file mode 100644 index 3cb443082..000000000 --- a/spec/compilers2/for_with_index_2 +++ /dev/null @@ -1,28 +0,0 @@ -component Main { - fun render : Array(Html) { - for (item, index of ["A", "B"]) { -
- item -
- } - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return (() => { - const _0 = []; - const _1 = [ - `A`, - `B` - ]; - let _i = -1; - for (let a of _1) { - _i++; - const b = _i; - _0.push(B(`div`, {}, [a])) - }; - return _0 - })() -}; diff --git a/spec/compilers2/function b/spec/compilers2/function deleted file mode 100644 index 818cf7f9b..000000000 --- a/spec/compilers2/function +++ /dev/null @@ -1,19 +0,0 @@ -component Main { - fun test : Bool { - true - } - - fun render : String { - test() - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - return true - }; - a(); - return `` -}; diff --git a/spec/compilers2/function_call_simple b/spec/compilers2/function_call_simple deleted file mode 100644 index bd1275c9c..000000000 --- a/spec/compilers2/function_call_simple +++ /dev/null @@ -1,27 +0,0 @@ -component Main { - fun a : String { - "test" - } - - fun test : String { - a() - } - - fun render : String { - test() - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const - a = () => { - return `test` - }, - b = () => { - return a() - }; - b(); - return `` -}; diff --git a/spec/compilers2/function_call_with_arguments b/spec/compilers2/function_call_with_arguments deleted file mode 100644 index 9188dc239..000000000 --- a/spec/compilers2/function_call_with_arguments +++ /dev/null @@ -1,28 +0,0 @@ -component Main { - fun call (a : String, b : Bool) : Bool { - b - } - - fun test : Bool { - call("Hello", true) - } - - fun render : String { - test() - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const - a = (b, c) => { - return c - }, - d = () => { - return a(`Hello`, true) - }; - d(); - return `` -}; - diff --git a/spec/compilers2/get b/spec/compilers2/get deleted file mode 100644 index 54aa99bc6..000000000 --- a/spec/compilers2/get +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - get test : String { - "" - } - - fun render : String { - test - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - return `` - }; - return a() -}; diff --git a/spec/compilers2/here_doc_markdown b/spec/compilers2/here_doc_markdown deleted file mode 100644 index 05f5b8b24..000000000 --- a/spec/compilers2/here_doc_markdown +++ /dev/null @@ -1,21 +0,0 @@ -component Main { - fun render : Html { - <<#MARKDOWN - ## Hello There - - WTF - MARKDOWN - } -} --------------------------------------------------------------------------------- -import { - createElement as B, - fragment as C -} from "./runtime.js"; - -export const A = () => { - return B(C, {}, [ - B('h2', {}, [`Hello There`]), - B('p', {}, [`WTF`]) - ]) -}; diff --git a/spec/compilers2/here_doc_markdown_with_interpolation b/spec/compilers2/here_doc_markdown_with_interpolation deleted file mode 100644 index 25a697a3b..000000000 --- a/spec/compilers2/here_doc_markdown_with_interpolation +++ /dev/null @@ -1,29 +0,0 @@ -component Main { - fun render : Html { - <<#MARKDOWN - ## Hello There - #{
"Hello"
} - World! - MARKDOWN - } -} --------------------------------------------------------------------------------- -import { - createElement as B, - fragment as C -} from "./runtime.js"; - -export const A = () => { - return B(C, {}, [ - B('h2', {}, [`Hello There`]), - B('p', {}, [ - ``, - B(`div`, {}, [`Hello`]), - ``, - ` -`, - `World`, - `!` - ]) - ]) -}; diff --git a/spec/compilers2/here_doc_with_interpolation b/spec/compilers2/here_doc_with_interpolation deleted file mode 100644 index 96d8db68c..000000000 --- a/spec/compilers2/here_doc_with_interpolation +++ /dev/null @@ -1,17 +0,0 @@ -component Main { - fun render : String { - <<-TEXT - Hello There! - #{"interpolation"} - This line should be indented by 2 spaces. - This line should be indented by 4 spaces. - TEXT - } -} --------------------------------------------------------------------------------- -export const A = () => { - return ` Hello There! - ${`interpolation`} - This line should be indented by 2 spaces. - This line should be indented by 4 spaces.` -}; diff --git a/spec/compilers2/here_doc_without_indentation b/spec/compilers2/here_doc_without_indentation deleted file mode 100644 index 52cc1dde9..000000000 --- a/spec/compilers2/here_doc_without_indentation +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - fun render : String { - <<~TEXT - Hello There! - This line should be indented by 2 spaces. - This line should be indented by 4 spaces. - TEXT - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There! - This line should be indented by 2 spaces. - This line should be indented by 4 spaces.` -}; diff --git a/spec/compilers2/html_attribute_class b/spec/compilers2/html_attribute_class deleted file mode 100644 index 7a7780962..000000000 --- a/spec/compilers2/html_attribute_class +++ /dev/null @@ -1,14 +0,0 @@ -component Main { - fun render : Html { -
-
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `something` - }) -}; diff --git a/spec/compilers2/html_attribute_class_with_style b/spec/compilers2/html_attribute_class_with_style deleted file mode 100644 index b0ffe2c6c..000000000 --- a/spec/compilers2/html_attribute_class_with_style +++ /dev/null @@ -1,24 +0,0 @@ -component Main { - style base { - width: 100%; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_base { - width: 100%; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `something` + ` Main_base` - }) -}; diff --git a/spec/compilers2/html_attribute_html_fragment b/spec/compilers2/html_attribute_html_fragment deleted file mode 100644 index cbc9584a8..000000000 --- a/spec/compilers2/html_attribute_html_fragment +++ /dev/null @@ -1,27 +0,0 @@ -component Thing { - property things : Html = <> - - fun render : Html { -
- } -} - -component Main { - fun render { - "x"/> - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - A = ({ - a = null - }) => { - return B(`div`, {}) - }, - C = () => { - return B(A, { - a: `x` - }) - }; diff --git a/spec/compilers2/html_attribute_readonly b/spec/compilers2/html_attribute_readonly deleted file mode 100644 index e2ec4c2ef..000000000 --- a/spec/compilers2/html_attribute_readonly +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : Html { -
-
- } -} ---------------------------------------------------------------------------------import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - readOnly: true - }) -}; diff --git a/spec/compilers2/html_attribute_ref b/spec/compilers2/html_attribute_ref deleted file mode 100644 index 4569c3e4e..000000000 --- a/spec/compilers2/html_attribute_ref +++ /dev/null @@ -1,29 +0,0 @@ -type Maybe(value) { - Just(value) - Nothing -} - -component Main { - fun render : Html { -
-
- } -} --------------------------------------------------------------------------------- -import { - createElement as F, - variant as B, - setRef as G, - useRef as E -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = () => { - const a = E(new C()); - return F(`div`, { - ref: G(a, A) - }) - }; - diff --git a/spec/compilers2/html_attribute_simple b/spec/compilers2/html_attribute_simple deleted file mode 100644 index 0f80d1280..000000000 --- a/spec/compilers2/html_attribute_simple +++ /dev/null @@ -1,14 +0,0 @@ -component Main { - fun render : Html { -
-
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - "title": `Hello` - }) -}; diff --git a/spec/compilers2/html_attribute_with_expression b/spec/compilers2/html_attribute_with_expression deleted file mode 100644 index 5bad2b743..000000000 --- a/spec/compilers2/html_attribute_with_expression +++ /dev/null @@ -1,14 +0,0 @@ -component Main { - fun render : Html { -
-
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - "title": `Hello ` + `there!` - }) -}; diff --git a/spec/compilers2/html_component b/spec/compilers2/html_component deleted file mode 100644 index eebf41252..000000000 --- a/spec/compilers2/html_component +++ /dev/null @@ -1,21 +0,0 @@ -component Test { - fun render : Html { -
- } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - A = () => { - return B(`div`, {}) - }, - C = () => { - return B(A, {}) - }; diff --git a/spec/compilers2/html_fragment b/spec/compilers2/html_fragment deleted file mode 100644 index ccf06589f..000000000 --- a/spec/compilers2/html_fragment +++ /dev/null @@ -1,22 +0,0 @@ -component Main { - fun render : Html { -
- <> - "A" - "B" - -
- } -} --------------------------------------------------------------------------------- -import { - createElement as B, - fragment as C -} from "./runtime.js"; - -export const A = () => { - return B(`div`, {}, [B(C, {}, [ - `A`, - `B` - ])]) -}; diff --git a/spec/compilers2/html_fragment_empty b/spec/compilers2/html_fragment_empty deleted file mode 100644 index 51f5a8206..000000000 --- a/spec/compilers2/html_fragment_empty +++ /dev/null @@ -1,14 +0,0 @@ -component Main { - fun render : Html { -
- <> - -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, {}, [null]) -}; diff --git a/spec/compilers2/html_with_custom_style b/spec/compilers2/html_with_custom_style deleted file mode 100644 index 07e5a8140..000000000 --- a/spec/compilers2/html_with_custom_style +++ /dev/null @@ -1,24 +0,0 @@ -component Main { - get styles : Map(String, String) { - `` - } - - fun render : Html { -
-
- } -} --------------------------------------------------------------------------------- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = () => { - return undefined - }; - return B(`div`, { - style: C([a()]) - }) -}; diff --git a/spec/compilers2/html_with_multiple_styles b/spec/compilers2/html_with_multiple_styles deleted file mode 100644 index ecca4946b..000000000 --- a/spec/compilers2/html_with_multiple_styles +++ /dev/null @@ -1,32 +0,0 @@ -component Main { - style one { - color: red; - } - - style two { - color: blue; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_one { - color: red; -} - -.Main_two { - color: blue; -} - ----=== /__mint__/index.js ===--- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, { - className: `Main_one Main_two` - }) -}; diff --git a/spec/compilers2/html_with_multiple_styles_and_parameters b/spec/compilers2/html_with_multiple_styles_and_parameters deleted file mode 100644 index 6f308f986..000000000 --- a/spec/compilers2/html_with_multiple_styles_and_parameters +++ /dev/null @@ -1,42 +0,0 @@ -component Main { - style one { - color: red; - } - - style two(color : String) { - color: #{color}; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_one { - color: red; -} - -.Main_two { - color: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = (b) => { - const _ = { - [`--a-a`]: b - }; - return _ - }; - return B(`div`, { - className: `Main_one Main_two`, - style: C([a(`blue`)]) - }) -}; diff --git a/spec/compilers2/html_with_multiple_styles_and_parameters_2 b/spec/compilers2/html_with_multiple_styles_and_parameters_2 deleted file mode 100644 index b8b87a846..000000000 --- a/spec/compilers2/html_with_multiple_styles_and_parameters_2 +++ /dev/null @@ -1,52 +0,0 @@ -component Main { - style one(color: String) { - color: #{color}; - } - - style two(color : String) { - color: #{color}; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_one { - color: var(--a-a); -} - -.Main_two { - color: var(--b-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const - a = (b) => { - const _ = { - [`--a-a`]: b - }; - return _ - }, - c = (d) => { - const _ = { - [`--b-a`]: d - }; - return _ - }; - return B(`div`, { - className: `Main_one Main_two`, - style: C([ - a(`red`), - c(`blue`) - ]) - }) -}; diff --git a/spec/compilers2/html_with_pseudos b/spec/compilers2/html_with_pseudos deleted file mode 100644 index 787fb1c5a..000000000 --- a/spec/compilers2/html_with_pseudos +++ /dev/null @@ -1,73 +0,0 @@ -component Main { - state hoverBackground : String = "yellow" - state background : String = "blue" - - style test { - background: #{background}; - color: red; - - &:hover { - background: #{hoverBackground}; - color: cyan; - } - - &::first-line { - text-transform: uppercase; - } - - div { - font-family: #{"Hello"}; - color: blue; - } - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - background: var(--a-a); - color: red; -} - -.Main_test:hover { - background: var(--b-a); - color: cyan; -} - -.Main_test::first-line { - text-transform: uppercase; -} - -.Main_test div { - font-family: var(--c-a); - color: blue; -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(`yellow`), - b = B(`blue`), - c = () => { - const _ = { - [`--a-a`]: b.value, - [`--b-a`]: a.value, - [`--c-a`]: `Hello` - }; - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([c()]) - }) -}; diff --git a/spec/compilers2/html_with_string_style b/spec/compilers2/html_with_string_style deleted file mode 100644 index 726ef0718..000000000 --- a/spec/compilers2/html_with_string_style +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - fun render : Html { -
- } -} --------------------------------------------------------------------------------- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - return B(`div`, { - style: C([`opacity:0;`]) - }) -}; diff --git a/spec/compilers2/html_with_style b/spec/compilers2/html_with_style deleted file mode 100644 index bf103d91b..000000000 --- a/spec/compilers2/html_with_style +++ /dev/null @@ -1,87 +0,0 @@ -component Main { - state background : String = "blue" - state color : String = "yellow" - - style test { - -webkit-tap-highlight-color: rgba(0,0,0,0); - -webkit-touch-callout: none; - - border-color: #{background}; - background: #{background}; - border: #{background}; - color: #{color}; - - & { - font-size: 1em; - } - - &.big { - font-size: 1.5em; - } - - &[data-foo="bar"] { - font-size: 3em; - } - - > span { - font-size: .8em; - } - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - -webkit-tap-highlight-color: rgba(0,0,0,0); - -webkit-touch-callout: none; - border-color: var(--a-a); - background: var(--a-b); - border: var(--a-c); - color: var(--a-d); -} - -.Main_test { - font-size: 1em; -} - -.Main_test.big { - font-size: 1.5em; -} - -.Main_test[data-foo="bar"] { - font-size: 3em; -} - -.Main_test > span { - font-size: .8em; -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(`blue`), - b = B(`yellow`), - c = () => { - const _ = { - [`--a-a`]: a.value, - [`--a-b`]: a.value, - [`--a-c`]: a.value, - [`--a-d`]: b.value - }; - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([c()]) - }) -}; diff --git a/spec/compilers2/html_with_style_and_custom_style b/spec/compilers2/html_with_style_and_custom_style deleted file mode 100644 index f2e22d49a..000000000 --- a/spec/compilers2/html_with_style_and_custom_style +++ /dev/null @@ -1,51 +0,0 @@ -component Main { - state background : String = "blue" - - get styles : Map(String, String) { - `` - } - - style test { - background: #{background}; - color: red; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - background: var(--a-a); - color: red; -} - ----=== /__mint__/index.js ===--- -import { - createElement as C, - useSignal as B, - style as D -} from "./runtime.js"; - -export const A = () => { - const - a = B(`blue`), - b = () => { - return undefined - }, - c = () => { - const _ = { - [`--a-a`]: a.value - }; - return _ - }; - return C(`div`, { - className: `Main_test`, - style: D([ - c(), - b() - ]) - }) -}; diff --git a/spec/compilers2/if b/spec/compilers2/if deleted file mode 100644 index 335d1847d..000000000 --- a/spec/compilers2/if +++ /dev/null @@ -1,18 +0,0 @@ -component Main { - fun render : String { - if ("asd" == "asd2") { - true - } else { - false - } - - "" - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - (B(`asd`, `asd2`) ? true : false); - return `` -}; diff --git a/spec/compilers2/if_let b/spec/compilers2/if_let deleted file mode 100644 index 8bbc909ac..000000000 --- a/spec/compilers2/if_let +++ /dev/null @@ -1,42 +0,0 @@ -type T { - A(String) - B -} - -component Main { - fun render : String { - if let T.A(a) = T.A("") { - a - } else { - "b" - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - newVariant as F, - pattern as G, - variant as B, - match as E -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = () => { - return E(F(A)(``), [ - [ - G(A, [H]), - (a) => { - return a - } - ], - [ - null, - () => { - return `b` - } - ] - ]) - }; diff --git a/spec/compilers2/if_let_await b/spec/compilers2/if_let_await deleted file mode 100644 index 0cdfd26ce..000000000 --- a/spec/compilers2/if_let_await +++ /dev/null @@ -1,49 +0,0 @@ -type T { - A(String) - B -} - -component Main { - fun render : String { - { - if let T.A(a) = await T.A("") { - a - } else { - "b" - } - } - - "" - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - newVariant as F, - pattern as G, - variant as B, - match as E -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = () => { - (async () => { - return E(await F(A)(``), [ - [ - G(A, [H]), - (a) => { - return a - } - ], - [ - null, - () => { - return `b` - } - ] - ]) - })(); - return `` - }; diff --git a/spec/compilers2/if_without_else_array b/spec/compilers2/if_without_else_array deleted file mode 100644 index 41e93e5b4..000000000 --- a/spec/compilers2/if_without_else_array +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : Array(String) { - if ("asd" == "asd2") { - ["ARRAY"] - } - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - return (B(`asd`, `asd2`) ? [`ARRAY`] : []) -}; diff --git a/spec/compilers2/if_without_else_promise b/spec/compilers2/if_without_else_promise deleted file mode 100644 index b36a60690..000000000 --- a/spec/compilers2/if_without_else_promise +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - fun render : String { - if ("asd" == "asd2") { - next {} - } - - "" - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - (B(`asd`, `asd2`) ? null : null); - return `` -}; diff --git a/spec/compilers2/if_without_else_string b/spec/compilers2/if_without_else_string deleted file mode 100644 index 75726e3f1..000000000 --- a/spec/compilers2/if_without_else_string +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : String { - if ("asd" == "asd2") { - "TRUE" - } - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - return (B(`asd`, `asd2`) ? `TRUE` : "") -}; diff --git a/spec/compilers2/indirect_connect b/spec/compilers2/indirect_connect deleted file mode 100644 index d93738c1c..000000000 --- a/spec/compilers2/indirect_connect +++ /dev/null @@ -1,32 +0,0 @@ -store Test { - state a : String = "" - - fun b : String { - "hello" - } -} - -store A { - state test : Array(String) = [""] - state other : String = "" -} - -component Main { - connect Test exposing { a } - - fun render : String { - A.other - } -} --------------------------------------------------------------------------------- -import { signal as A } from "./runtime.js"; - -export const - a = () => { - return `hello` - }, - b = A(``), - c = A(``), - B = () => { - return c.value - }; diff --git a/spec/compilers2/inline_function b/spec/compilers2/inline_function deleted file mode 100644 index 0f55720b5..000000000 --- a/spec/compilers2/inline_function +++ /dev/null @@ -1,15 +0,0 @@ -component Main { - fun render : String { - let a = - () : String { "Hello" } - - a() - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - return `Hello` - }; - return a() -}; diff --git a/spec/compilers2/inline_function_recursive b/spec/compilers2/inline_function_recursive deleted file mode 100644 index 13c292257..000000000 --- a/spec/compilers2/inline_function_recursive +++ /dev/null @@ -1,35 +0,0 @@ -module Test { - fun factorial(n : Number) : Number { - let helper = (n : Number, acc : Number) : Number { - if (n == 0) { - acc - } else { - helper(n - 1, acc * n) - } - } - - helper(n, 1) - } -} - -component Main { - fun render : String { - Test.factorial(3) - - "" - } -} --------------------------------------------------------------------------------- -import { compare as A } from "./runtime.js"; - -export const - a = (b) => { - const c = (d, e) => { - return (A(d, 0) ? e : c(d - 1, e * d)) - }; - return c(b, 1) - }, - B = () => { - a(3); - return `` - }; diff --git a/spec/compilers2/inline_function_with_arguments b/spec/compilers2/inline_function_with_arguments deleted file mode 100644 index 2038ed326..000000000 --- a/spec/compilers2/inline_function_with_arguments +++ /dev/null @@ -1,25 +0,0 @@ -component Main { - fun test : String { - let getName = - (name : String) : String { name } - - getName("Joe") - } - - fun render : String { - test() - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - const b = (c) => { - return c - }; - return b(`Joe`) - }; - a(); - return `` -}; diff --git a/spec/compilers2/js b/spec/compilers2/js deleted file mode 100644 index 7639d253d..000000000 --- a/spec/compilers2/js +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - ` "Hello" ` - } -} --------------------------------------------------------------------------------- -export const A = () => { - return ("Hello") -}; diff --git a/spec/compilers2/js_with_double_interpolation b/spec/compilers2/js_with_double_interpolation deleted file mode 100644 index aa012544b..000000000 --- a/spec/compilers2/js_with_double_interpolation +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - ` "Hello" + #{`"World!"`} ` - } -} --------------------------------------------------------------------------------- -export const A = () => { - return ("Hello" + ("World!")) -}; diff --git a/spec/compilers2/js_with_interpolation b/spec/compilers2/js_with_interpolation deleted file mode 100644 index 169797cdd..000000000 --- a/spec/compilers2/js_with_interpolation +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - ` "Hello" + #{"World!"} ` - } -} --------------------------------------------------------------------------------- -export const A = () => { - return ("Hello" + `World!`) -}; diff --git a/spec/compilers2/locale_key b/spec/compilers2/locale_key deleted file mode 100644 index 91330bfe1..000000000 --- a/spec/compilers2/locale_key +++ /dev/null @@ -1,27 +0,0 @@ -locale en { - test: "Hello" -} - -component Main { - fun render : String { - :test - } -} --------------------------------------------------------------------------------- -import { - translations as C, - translate as B, - locale as D -} from "./runtime.js"; - -export const A = () => { - return B(`test`) -}; - -C.value = { - en: { - 'test': `Hello` - } -}; - -D.value = `en`; diff --git a/spec/compilers2/module b/spec/compilers2/module deleted file mode 100644 index fea9e8f97..000000000 --- a/spec/compilers2/module +++ /dev/null @@ -1,23 +0,0 @@ -module Html.Testing { - fun renderAll : Html { -

- "It should work" -

- } -} - -component Main { - fun render : Html { - Html.Testing.renderAll() - } -} --------------------------------------------------------------------------------- -import { createElement as A } from "./runtime.js"; - -export const - a = () => { - return A(`p`, {}, [`It should work`]) - }, - B = () => { - return a() - }; diff --git a/spec/compilers2/module_access b/spec/compilers2/module_access deleted file mode 100644 index 25926594f..000000000 --- a/spec/compilers2/module_access +++ /dev/null @@ -1,30 +0,0 @@ -module Test { - fun a : String { - "Hello" - } - - fun b : Function(String) { - Test.a - } -} - -component Main { - fun render : String { - let x = - Test.b() - - x() - } -} --------------------------------------------------------------------------------- -export const - a = () => { - return `Hello` - }, - b = () => { - return a - }, - A = () => { - const c = b(); - return c() - }; diff --git a/spec/compilers2/module_access_get b/spec/compilers2/module_access_get deleted file mode 100644 index 43bb133ee..000000000 --- a/spec/compilers2/module_access_get +++ /dev/null @@ -1,26 +0,0 @@ -store Test { - get a : String { - "Hello" - } - - fun b : String { - a - } -} - -component Main { - fun render : String { - Test.b() - } -} --------------------------------------------------------------------------------- -export const - a = () => { - return `Hello` - }, - b = () => { - return a() - }, - A = () => { - return b() - }; diff --git a/spec/compilers2/module_access_subscriptions b/spec/compilers2/module_access_subscriptions deleted file mode 100644 index fe14e8097..000000000 --- a/spec/compilers2/module_access_subscriptions +++ /dev/null @@ -1,51 +0,0 @@ -type Test { - test : String -} - -provider Test : Test { - fun update : Promise(Void) { - subscriptions - await void - } - - fun print (a : String) : String { - a - } -} - -component Main { - use Test { - test: "" - } - - fun render : String { - Test.subscriptions - Test.print("a") - } -} --------------------------------------------------------------------------------- -import { - createProvider as B, - subscriptions as C, - useId as E -} from "./runtime.js"; - -export const - a = new Map(), - b = (c) => { - return c - }, - A = B(a, async () => { - C(a); - return await null - }), - D = () => { - const d = E(); - A(d, () => { - return { - test: `` - } - }); - C(a); - return b(`a`) - }; diff --git a/spec/compilers2/module_call b/spec/compilers2/module_call deleted file mode 100644 index e8690f524..000000000 --- a/spec/compilers2/module_call +++ /dev/null @@ -1,26 +0,0 @@ -module Test { - fun a (value : String) : String { - value - } - - fun b : String { - Test.a("Lorem ipsum dolor sit amet") - } -} - -component Main { - fun render : String { - Test.b() - } -} --------------------------------------------------------------------------------- -export const - a = (b) => { - return b - }, - c = () => { - return a(`Lorem ipsum dolor sit amet`) - }, - A = () => { - return c() - }; diff --git a/spec/compilers2/module_call_piped b/spec/compilers2/module_call_piped deleted file mode 100644 index 21ba67372..000000000 --- a/spec/compilers2/module_call_piped +++ /dev/null @@ -1,27 +0,0 @@ -module Test { - fun a (x : Bool, value : String) : String { - value - } - - fun b : String { - true - |> Test.a("Lorem ipsum dolor sit amet") - } -} - -component Main { - fun render : String { - Test.b() - } -} --------------------------------------------------------------------------------- -export const - a = (b, c) => { - return c - }, - d = () => { - return a(true, `Lorem ipsum dolor sit amet`) - }, - A = () => { - return d() - }; diff --git a/spec/compilers2/next_call b/spec/compilers2/next_call deleted file mode 100644 index 3e8b9774b..000000000 --- a/spec/compilers2/next_call +++ /dev/null @@ -1,37 +0,0 @@ -component Main { - state name : String = "Joe" - state age : Number = 24 - - fun test : Promise(Void) { - next - { - name: "Hello", - age: 30 - } - } - - fun render : String { - test() - - "" - } -} --------------------------------------------------------------------------------- -import { - useSignal as B, - batch as C -} from "./runtime.js"; - -export const A = () => { - const - a = B(`Joe`), - b = B(24), - c = () => { - return C(() => { - a.value = `Hello`; - b.value = 30 - }) - }; - c(); - return `` -}; diff --git a/spec/compilers2/next_call_empty b/spec/compilers2/next_call_empty deleted file mode 100644 index dc991181f..000000000 --- a/spec/compilers2/next_call_empty +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - next {} - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - null; - return `` -}; diff --git a/spec/compilers2/number_literal_negative b/spec/compilers2/number_literal_negative deleted file mode 100644 index a348075c2..000000000 --- a/spec/compilers2/number_literal_negative +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - -42 - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - -42; - return `` -}; diff --git a/spec/compilers2/number_literal_simple b/spec/compilers2/number_literal_simple deleted file mode 100644 index efcc15473..000000000 --- a/spec/compilers2/number_literal_simple +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - 10 - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - 10; - return `` -}; diff --git a/spec/compilers2/number_literal_with_decimal b/spec/compilers2/number_literal_with_decimal deleted file mode 100644 index 70c37398a..000000000 --- a/spec/compilers2/number_literal_with_decimal +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - 10.120 - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - 10.120; - return `` -}; diff --git a/spec/compilers2/operation_chained b/spec/compilers2/operation_chained deleted file mode 100644 index 636b05463..000000000 --- a/spec/compilers2/operation_chained +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : String { - "a" == "b" && true != false - "" - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - B(`a`, `b`) && !B(true, false); - return `` -}; diff --git a/spec/compilers2/operation_or b/spec/compilers2/operation_or deleted file mode 100644 index 8bc4b5158..000000000 --- a/spec/compilers2/operation_or +++ /dev/null @@ -1,29 +0,0 @@ -type Result(error, value) { - Err(error) - Ok(value) -} - -type Maybe(value) { - Nothing - Just(value) -} - -component Main { - fun render : String { - Maybe.Nothing or "Hello" - } -} --------------------------------------------------------------------------------- -import { - variant as B, - or as G -} from "./runtime.js"; - -export const - A = B(0), - C = B(1), - D = B(1), - E = B(1), - F = () => { - return G(A, D, new A(), `Hello`) - }; diff --git a/spec/compilers2/operation_simple b/spec/compilers2/operation_simple deleted file mode 100644 index c779827db..000000000 --- a/spec/compilers2/operation_simple +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : String { - "a" == "b" - "" - } -} --------------------------------------------------------------------------------- -import { compare as B } from "./runtime.js"; - -export const A = () => { - B(`a`, `b`); - return `` -}; diff --git a/spec/compilers2/parenthesized_expression b/spec/compilers2/parenthesized_expression deleted file mode 100644 index b9352f3c8..000000000 --- a/spec/compilers2/parenthesized_expression +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - (true) - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - (true); - return `` -}; diff --git a/spec/compilers2/pipe b/spec/compilers2/pipe deleted file mode 100644 index f5887061f..000000000 --- a/spec/compilers2/pipe +++ /dev/null @@ -1,21 +0,0 @@ -component Main { - fun render : Html { -
- (n : String) : String { n }("3") - "3" |> (n : String) : String { n } -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - return B(`div`, {}, [ - ((a) => { - return a - })(`3`), - ((b) => { - return b - })(`3`) - ]) -}; diff --git a/spec/compilers2/property b/spec/compilers2/property deleted file mode 100644 index 89df7270a..000000000 --- a/spec/compilers2/property +++ /dev/null @@ -1,25 +0,0 @@ -component Test { - property name : String = "Joe" - - fun render : Html { -
- } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - A = ({ - a = `Joe` - }) => { - return B(`div`, {}) - }, - C = () => { - return B(A, {}) - }; diff --git a/spec/compilers2/property_without_default b/spec/compilers2/property_without_default deleted file mode 100644 index 11a665665..000000000 --- a/spec/compilers2/property_without_default +++ /dev/null @@ -1,28 +0,0 @@ -component Test { - property name : String - - fun render : Html { -
- } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const - A = ({ - a - }) => { - return B(`div`, {}) - }, - C = () => { - return B(A, { - a: `HELLO` - }) - }; - diff --git a/spec/compilers2/provider_with_items b/spec/compilers2/provider_with_items deleted file mode 100644 index cdbac6618..000000000 --- a/spec/compilers2/provider_with_items +++ /dev/null @@ -1,64 +0,0 @@ -type Subscription { - a : Bool, - b : Bool -} - -provider Provider : Subscription { - const NAME = "hello" - - state a : String = "" - - get b : String { - a - } - - fun update : Promise(Void) { - await void - } - - fun name : String { - NAME - } -} - -component Main { - use Provider { - a: true, - b: false - } - - fun render { -
- } -} --------------------------------------------------------------------------------- -import { - createProvider as C, - createElement as F, - signal as A, - useId as E -} from "./runtime.js"; - -export const - a = new Map(), - b = `hello`, - c = () => { - return b - }, - d = A(``), - e = () => { - return d.value - }, - B = C(a, async () => { - return await null - }), - D = () => { - const f = E(); - B(f, () => { - return { - a: true, - b: false - } - }); - return F(`div`, {}) - }; diff --git a/spec/compilers2/record b/spec/compilers2/record deleted file mode 100644 index fa3afe1d4..000000000 --- a/spec/compilers2/record +++ /dev/null @@ -1,25 +0,0 @@ -type Test { - a : String, - b : Number -} - -component Main { - fun render : Html { - { - a: "Hello", - b: 0 - } - -
- } -} --------------------------------------------------------------------------------- -import { createElement as B } from "./runtime.js"; - -export const A = () => { - { - a: `Hello`, - b: 0 - }; - return B(`div`, {}) -}; diff --git a/spec/compilers2/record_update b/spec/compilers2/record_update deleted file mode 100644 index 69d73368d..000000000 --- a/spec/compilers2/record_update +++ /dev/null @@ -1,28 +0,0 @@ -type Record { - name: String -} - -component Main { - state record : Record = { name: "Doe" } - - fun render : Html { - { record | name: "John" } -
- } -} --------------------------------------------------------------------------------- -import { - createElement as C, - useSignal as B -} from "./runtime.js"; - -export const A = () => { - const a = B({ - name: `Doe` - }); - { - ...a.value, - name: `John` - }; - return C(`div`, {}) -}; diff --git a/spec/compilers2/regexp_literal b/spec/compilers2/regexp_literal deleted file mode 100644 index e9d582296..000000000 --- a/spec/compilers2/regexp_literal +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - /.*/gm - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - /.*/gm; - return `` -}; diff --git a/spec/compilers2/state b/spec/compilers2/state deleted file mode 100644 index d2d317b47..000000000 --- a/spec/compilers2/state +++ /dev/null @@ -1,25 +0,0 @@ -component Main { - state test : String = "Hello" - state blah : String = "0" - - fun asd : String { - test + blah - } - - fun render : String { - asd() - } -} --------------------------------------------------------------------------------- -import { useSignal as B } from "./runtime.js"; - -export const A = () => { - const - a = B(`Hello`), - b = B(`0`), - c = () => { - return a.value + b.value - }; - return c() -}; - diff --git a/spec/compilers2/statement b/spec/compilers2/statement deleted file mode 100644 index d473aff79..000000000 --- a/spec/compilers2/statement +++ /dev/null @@ -1,13 +0,0 @@ -component Main { - fun render : String { - let x = - "hello" - - x - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = `hello`; - return a -}; diff --git a/spec/compilers2/store b/spec/compilers2/store deleted file mode 100644 index 5d4031673..000000000 --- a/spec/compilers2/store +++ /dev/null @@ -1,26 +0,0 @@ -store Test { - state test : String = "" - - fun hello : String { - "hello" - } -} - -component Main { - connect Test exposing { test } - - fun render : String { - test - } -} --------------------------------------------------------------------------------- -import { signal as A } from "./runtime.js"; - -export const - a = () => { - return `hello` - }, - b = A(``), - B = () => { - return b.value - }; diff --git a/spec/compilers2/store_with_get b/spec/compilers2/store_with_get deleted file mode 100644 index 0e707cd3d..000000000 --- a/spec/compilers2/store_with_get +++ /dev/null @@ -1,29 +0,0 @@ -store Test { - state test : String = "" - - get hello : String { - "hello" - } -} - -component Main { - connect Test exposing { test as xxx } - - fun render : String { - xxx - Test.hello - } -} --------------------------------------------------------------------------------- -import { signal as A } from "./runtime.js"; - -export const - a = A(``), - b = () => { - return `hello` - }, - B = () => { - a.value; - return b() - }; - diff --git a/spec/compilers2/string_literal_escaped b/spec/compilers2/string_literal_escaped deleted file mode 100644 index 5df330860..000000000 --- a/spec/compilers2/string_literal_escaped +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There \"Joe\"" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There "Joe"` -}; diff --git a/spec/compilers2/string_literal_simple b/spec/compilers2/string_literal_simple deleted file mode 100644 index 50db540f9..000000000 --- a/spec/compilers2/string_literal_simple +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There` -}; diff --git a/spec/compilers2/string_literal_with_backtick b/spec/compilers2/string_literal_with_backtick deleted file mode 100644 index 936a625db..000000000 --- a/spec/compilers2/string_literal_with_backtick +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There `Joe`" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There \`Joe\`` -}; diff --git a/spec/compilers2/string_literal_with_interpolation b/spec/compilers2/string_literal_with_interpolation deleted file mode 100644 index 7ebcebb6f..000000000 --- a/spec/compilers2/string_literal_with_interpolation +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There #{"Hello"}" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There ${`Hello`}` -}; diff --git a/spec/compilers2/string_literal_with_interpolation_and_js_iterpolation b/spec/compilers2/string_literal_with_interpolation_and_js_iterpolation deleted file mode 100644 index 7ebcebb6f..000000000 --- a/spec/compilers2/string_literal_with_interpolation_and_js_iterpolation +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There #{"Hello"}" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There ${`Hello`}` -}; diff --git a/spec/compilers2/string_literal_with_interpolation_of_number b/spec/compilers2/string_literal_with_interpolation_of_number deleted file mode 100644 index 797598e2c..000000000 --- a/spec/compilers2/string_literal_with_interpolation_of_number +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There #{0}" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There ${0}` -}; diff --git a/spec/compilers2/string_literal_with_js_iterpolation b/spec/compilers2/string_literal_with_js_iterpolation deleted file mode 100644 index f6baea1bd..000000000 --- a/spec/compilers2/string_literal_with_js_iterpolation +++ /dev/null @@ -1,9 +0,0 @@ -component Main { - fun render : String { - "Hello There ${a}" - } -} --------------------------------------------------------------------------------- -export const A = () => { - return `Hello There \${a}` -}; diff --git a/spec/compilers2/style_with_argument b/spec/compilers2/style_with_argument deleted file mode 100644 index 1ebb28757..000000000 --- a/spec/compilers2/style_with_argument +++ /dev/null @@ -1,34 +0,0 @@ -component Main { - style test (color : String) { - color: #{color}; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = (b) => { - const _ = { - [`--a-a`]: b - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a(`red`)]) - }) -}; diff --git a/spec/compilers2/style_with_default_argument b/spec/compilers2/style_with_default_argument deleted file mode 100644 index 333ba2ce6..000000000 --- a/spec/compilers2/style_with_default_argument +++ /dev/null @@ -1,34 +0,0 @@ -component Main { - style test (color : String = "red") { - color: #{color}; - } - - fun render : Html { - -
- } -} --------------------------------------------------------------------------------- ----=== /__mint__/index.css ===--- -.Main_test { - color: var(--a-a); -} - ----=== /__mint__/index.js ===--- -import { - createElement as B, - style as C -} from "./runtime.js"; - -export const A = () => { - const a = (b = `red`) => { - const _ = { - [`--a-a`]: b - }; - return _ - }; - return B(`div`, { - className: `Main_test`, - style: C([a()]) - }) -}; diff --git a/spec/compilers2/tuple_literal b/spec/compilers2/tuple_literal deleted file mode 100644 index 3ba53ea10..000000000 --- a/spec/compilers2/tuple_literal +++ /dev/null @@ -1,19 +0,0 @@ -component Main { - fun render : String { - { - "Hello", - "Blah", - "Joe" - } - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - [ - `Hello`, - `Blah`, - `Joe` - ]; - return `` -}; diff --git a/spec/compilers2/type b/spec/compilers2/type deleted file mode 100644 index 884bdaef7..000000000 --- a/spec/compilers2/type +++ /dev/null @@ -1,39 +0,0 @@ -type Test(a) { - X - Y - Z(Res(a, Number)) -} - -type Res(error, value) { - Error(error) - Ok(value) - Other(error, value) -} - -component Main { - fun render : String { - Test.X - Res.Other("", "") - Test.Z(Res.Error("")) - "" - } -} --------------------------------------------------------------------------------- -import { - newVariant as I, - variant as B -} from "./runtime.js"; - -export const - A = B(1), - C = B(0), - D = B(0), - E = B(1), - F = B(1), - G = B(2), - H = () => { - new C(); - I(G)(``, ``); - I(E)(I(F)(``)); - return `` - }; diff --git a/spec/compilers2/type_with_variants b/spec/compilers2/type_with_variants deleted file mode 100644 index 77e844b1d..000000000 --- a/spec/compilers2/type_with_variants +++ /dev/null @@ -1,47 +0,0 @@ -type A { - B(name : String, age : Number) - C -} - -component Main { - fun render : String { - case (A.B(name: "Joe", age: 32)) { - A.B(name, age) => name - A.C => "" - } - } -} --------------------------------------------------------------------------------- -import { - patternVariable as H, - newVariant as F, - pattern as G, - variant as B, - match as E -} from "./runtime.js"; - -export const - A = B([ - "name", - "age" - ]), - C = B(0), - D = () => { - return E(F(A)(`Joe`, 32), [ - [ - G(A, [ - H, - H - ]), - (a, b) => { - return a - } - ], - [ - G(C, []), - () => { - return `` - } - ] - ]) - }; diff --git a/spec/compilers2/unary_minus b/spec/compilers2/unary_minus deleted file mode 100644 index b99bff095..000000000 --- a/spec/compilers2/unary_minus +++ /dev/null @@ -1,12 +0,0 @@ -component Main { - fun render : String { - -(42) - - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - -((42)); - return `` -}; diff --git a/spec/compilers2/variable_argument b/spec/compilers2/variable_argument deleted file mode 100644 index 149c82824..000000000 --- a/spec/compilers2/variable_argument +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - fun test (a : String) : String { - a - } - - fun render : String { - test("X") - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = (b) => { - return b - }; - return a(`X`) -}; diff --git a/spec/compilers2/variable_component_function b/spec/compilers2/variable_component_function deleted file mode 100644 index bdc82ee57..000000000 --- a/spec/compilers2/variable_component_function +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - fun test : String { - "Hello" - } - - fun render : String { - test() - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - return `Hello` - }; - return a() -}; diff --git a/spec/compilers2/variable_component_get b/spec/compilers2/variable_component_get deleted file mode 100644 index c1c323fcf..000000000 --- a/spec/compilers2/variable_component_get +++ /dev/null @@ -1,16 +0,0 @@ -component Main { - get test : String { - "Hello" - } - - fun render : String { - test - } -} --------------------------------------------------------------------------------- -export const A = () => { - const a = () => { - return `Hello` - }; - return a() -}; diff --git a/spec/compilers2/variable_component_property b/spec/compilers2/variable_component_property deleted file mode 100644 index 7ac6fcc32..000000000 --- a/spec/compilers2/variable_component_property +++ /dev/null @@ -1,25 +0,0 @@ -component Test { - property test : String = "Hello" - - fun render : String { - test - } -} - -component Main { - fun render : Html { - - } -} --------------------------------------------------------------------------------- -import { createElement as C } from "./runtime.js"; - -export const - A = ({ - a = `Hello` - }) => { - return a - }, - B = () => { - return C(A, {}) - }; diff --git a/spec/compilers2/variable_module_function b/spec/compilers2/variable_module_function deleted file mode 100644 index a4ef29b14..000000000 --- a/spec/compilers2/variable_module_function +++ /dev/null @@ -1,30 +0,0 @@ -module A { - fun a : String { - "Hello" - } - - fun b : Function(String) { - a - } -} - -component Main { - fun render : String { - let a = - A.b() - - a() - } -} --------------------------------------------------------------------------------- -export const - a = () => { - return `Hello` - }, - b = () => { - return a - }, - A = () => { - const c = b(); - return c() - }; diff --git a/spec/compilers2/void b/spec/compilers2/void deleted file mode 100644 index 6365978da..000000000 --- a/spec/compilers2/void +++ /dev/null @@ -1,11 +0,0 @@ -component Main { - fun render : String { - void - "" - } -} --------------------------------------------------------------------------------- -export const A = () => { - null; - return `` -}; diff --git a/spec/compilers_spec.cr b/spec/compilers_spec.cr index b0f05dace..7c189ba5d 100644 --- a/spec/compilers_spec.cr +++ b/spec/compilers_spec.cr @@ -1,7 +1,7 @@ require "./spec_helper" Dir - .glob("./spec/compilers2/**/*") + .glob("./spec/compilers/**/*") .select! { |file| File.file?(file) } .sort! .each do |file| diff --git a/spec/formatting_spec.cr b/spec/formatting_spec.cr index 75b4d67b6..f80e5297a 100644 --- a/spec/formatting_spec.cr +++ b/spec/formatting_spec.cr @@ -28,7 +28,7 @@ Dir result = formatter.format(ast) begin - result.should eq(expected.lstrip) + result.should eq(expected.strip) rescue error fail diff(expected, result) end @@ -40,7 +40,7 @@ Dir result = formatter.format(ast) begin - result.should eq(expected.lstrip) + result.should eq(expected.strip) rescue error fail diff(expected, result) end diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 743e31626..41c8b20a0 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -3,29 +3,7 @@ require "spec" ENV["SPEC"] = "TRUE" MINT_ENV["TEST"] = "TRUE" -def diff(a, b) - file1 = File.tempfile do |file| - file.puts a.strip - file.flush - end - file2 = File.tempfile do |file| - file.puts b - file.flush - end - - io = IO::Memory.new - - Process.run("git", [ - "--no-pager", "diff", "--no-index", "--color=always", - file1.path, file2.path, - ], output: io) - - io.to_s -ensure - file1.try &.delete - file2.try &.delete -end - +require "./spec_helpers" require "../src/all" # Mock things diff --git a/spec/spec_helpers.cr b/spec/spec_helpers.cr new file mode 100644 index 000000000..8f28d36a8 --- /dev/null +++ b/spec/spec_helpers.cr @@ -0,0 +1,58 @@ +def expect_diff(a, b) + a.should eq(b) +rescue error + fail diff(a, b) +end + +def diff(a, b) + file1 = File.tempfile do |file| + file.puts a.strip + file.flush + end + + file2 = File.tempfile do |file| + file.puts b + file.flush + end + + io = IO::Memory.new + + Process.run("git", [ + "--no-pager", "diff", "--no-index", "--color=always", + file1.path, file2.path, + ], output: io) + + io.to_s +ensure + file1.try &.delete + file2.try &.delete +end + +def matches_template(template, expected) + parts = + template.split(/×+/) + + position = + 0 + + replaced = + if parts.size <= 1 + template + else + parts.reduce("") do |memo, item| + if index = expected.index(item, position) + value = + expected[position, index - position] + + position = + index + item.size + + memo + value.to_s + item + else + memo + item + end + end + end + + expect_diff(replaced, expected) +end diff --git a/spec_cli/build_spec.cr b/spec_cli/build_spec.cr new file mode 100644 index 000000000..ae5d330c1 --- /dev/null +++ b/spec_cli/build_spec.cr @@ -0,0 +1,99 @@ +require "./spec_helper" + +context "build" do + before_each do + run ["init", "my-project"] + FileUtils.cd "my-project" + end + + after_each do + FileUtils.cd ".." + FileUtils.rm_rf "my-project" + end + + it "builds the project" do + expect_output ["build"], <<-TEXT + Mint - Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Clearing the "dist" directory... ×××× + ⚙ Building... ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Bundle size: 359KB + Files: 10 + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "shows timings with the `--timings` flag" do + expect_output ["build", "--timings"], <<-TEXT + Mint - Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Clearing the "dist" directory... ×××× + ⚙ Building... ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Bundle size: 359KB + Files: 10 + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Parsing files | ×××× + Type Checking | ×××× + Building application | ×××× + Compiling intermediate representation... | ×××× + Calculating dependencies for bundles... | ×××× + Bundling and rendering JavaScript... | ×××× + Generating index.html | ×××× + Generating icons | ×××× + Copying assets | ×××× + Building index.css | ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "generates manifeset with the `--generate-manifest` flag" do + expect_output ["build", "--generate-manifest"], <<-TEXT + Mint - Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Clearing the "dist" directory... ×××× + ⚙ Building... ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Bundle size: 359KB + Files: 11 + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + + File.exists?("dist/manifest.webmanifest").should eq(true) + end + + it "logs the files using the `--verbose` flag" do + expect_output ["build", "--verbose"], <<-TEXT + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Building for production... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Clearing the "dist" directory... ×××× + ⚙ Building... ×××× + ⚙ Writing __mint__/bottom-center_65d9d8fd7df4b3a35b1902a81cdbda84.png (38.1KB)... ×××× + ⚙ Writing __mint__/bottom-right_6af458c30624b5e5fb037d8b85e80d97.png (62.4KB)... ×××× + ⚙ Writing __mint__/bottom-left_56d5c8f1ad148a45a63fc5c092d096c6.png (52.0KB)... ×××× + ⚙ Writing __mint__/top-center_68582b5008e9414b7a5c8faf7758bd32.png (36.2KB)... ×××× + ⚙ Writing __mint__/top-right_b74c8a753f67cde5e97e6fbb5ec63c52.png (60.6KB)... ×××× + ⚙ Writing __mint__/top-left_50246e01096cfd733510104620d52c8e.png (48.1KB)... ×××× + ⚙ Writing __mint__/runtime.js (49.6KB)... ×××× + ⚙ Writing __mint__/index.css (1.46KB)... ×××× + ⚙ Writing __mint__/index.js (9.54KB)... ×××× + ⚙ Writing index.html (899B)... ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Bundle size: 359KB + Files: 10 + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end +end diff --git a/spec_cli/clean_spec.cr b/spec_cli/clean_spec.cr new file mode 100644 index 000000000..c9a733537 --- /dev/null +++ b/spec_cli/clean_spec.cr @@ -0,0 +1,52 @@ +require "./spec_helper" + +context "Clean" do + it "cleans the temporary directory" do + FileUtils.mkdir ".mint" + FileUtils.mkdir "dist" + + expect_output ["clean"], <<-TEXT + Mint - Removing directories + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Deleting: .mint + Deleting: dist + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "cleans the package cache directory" do + FileUtils.mkdir Mint::MINT_PACKAGES_DIR + + expect_output ["clean", "--package-cache"], <<-TEXT + Mint - Removing directories + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Deleting: ×××× + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "nothing to delete" do + expect_output ["clean"], <<-TEXT + Mint - Removing directories + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Nothing to delete. + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "prints the help" do + expect_output ["clean", "--help"], <<-TEXT + Usage: + ×××× clean [flags...] [arg...] + + Removes artifacts (directories) created by Mint. + + Flags: + --help # Displays help for the current command. + --package-cache # If specified, cleans the package cache directory. + TEXT + end +end diff --git a/spec_cli/format_spec.cr b/spec_cli/format_spec.cr new file mode 100644 index 000000000..bea1fe592 --- /dev/null +++ b/spec_cli/format_spec.cr @@ -0,0 +1,106 @@ +require "./spec_helper" + +context "Format" do + formatted_code = + <<-MINT + type Test { + file : String + } + MINT + + unformatted_code = + <<-MINT + typeTest{file:String} + MINT + + it "prints the help" do + expect_output ["format", "--help"], <<-TEXT + Usage: + ×××× format [flags...] [arg...] + + Formats *.mint files. + + Flags: + --check # Checks that formatting code produces no changes. + --help # Displays help for the current command. + --stdin # Formats code from STDIN and writes it to STDOUT. + + Arguments: + pattern # The pattern which determines which files to format. + TEXT + end + + it "formats code from STDIN" do + expect_output ["format", "--stdin"], <<-TEXT, unformatted_code + type Test { + file : String + } + TEXT + end + + it "check code from STDIN (not formatted)" do + expect_output ["format", "--stdin", "--check"], <<-TEXT, unformatted_code + Mint - Checking source from STDIN + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Source is not formatted! + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + There was an error, exiting... + TEXT + end + + it "check code from STDIN (formatted)" do + expect_output ["format", "--stdin", "--check"], <<-TEXT, formatted_code + Mint - Checking source from STDIN + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Source is formatted! + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "nothing to format" do + expect_output ["format"], <<-TEXT + Mint - Formatting files + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Nothing to format! + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "formatted files" do + File.write("source.mint", unformatted_code) + + expect_output ["format", "source.mint"], <<-TEXT + Mint - Formatting files + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Formatted: source.mint + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "not formatted (--check)" do + File.write("source.mint", unformatted_code) + + expect_output ["format", "source.mint", "--check"], <<-TEXT + Mint - Formatting files + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Not formatted: source.mint + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "all files formatted" do + File.write("source.mint", formatted_code) + + expect_output ["format", "source.mint"], <<-TEXT + Mint - Formatting files + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All files are formatted! + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end +end diff --git a/spec_cli/init_spec.cr b/spec_cli/init_spec.cr new file mode 100644 index 000000000..bcd4a31eb --- /dev/null +++ b/spec_cli/init_spec.cr @@ -0,0 +1,89 @@ +require "./spec_helper" + +context "init" do + after_each do + FileUtils.rm_rf "my-project" + end + + it "asks for a name if not provided" do + expect_output(["init", "--bare"], <<-TEXT, "\nmy-project\n") + Mint - Initializing a new project + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Please provide a name for the project (for example my-project): + Please provide a name for the project (for example my-project): + ⚙ Writing files: + ➔ source + ➔ Main.mint + ➔ mint.json + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "initializes a project" do + expect_output ["init", "my-project"], <<-TEXT + Mint - Initializing a new project + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Writing files: + ➔ source + ➔ Content.mint + ➔ Main.mint + ➔ assets + ➔ head.html + ➔ top-center.png + ➔ top-right.png + ➔ top-left.png + ➔ bottom-center.png + ➔ logo.svg + ➔ favicon.png + ➔ bottom-right.png + ➔ bottom-left.png + ➔ tests + ➔ Main.mint + ➔ mint.json + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "directory already exists" do + run ["init", "my-project"] + + expect_output ["init", "my-project"], <<-TEXT + Mint - Initializing a new project + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚠ Directory exists, exiting... + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "initializes a project bare project with '--bare' flag" do + expect_output ["init", "my-project", "--bare"], <<-TEXT + Mint - Initializing a new project + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + ⚙ Writing files: + ➔ source + ➔ Main.mint + ➔ mint.json + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + All done in ××××! + TEXT + end + + it "displays help with '--help' flag" do + expect_output ["init", "--help"], <<-TEXT + Usage: + ×××× init [flags...] [arg...] + + Initializes a new project. + + Flags: + --bare # If speficied, an empty project will be generated. + --help # Displays help for the current command. + + Arguments: + name # The name of the new project. + TEXT + end +end diff --git a/spec_cli/spec_helper.cr b/spec_cli/spec_helper.cr new file mode 100644 index 000000000..3d88ba8dc --- /dev/null +++ b/spec_cli/spec_helper.cr @@ -0,0 +1,41 @@ +require "file_utils" +require "spec" + +require "../src/constants" +require "../src/version" + +require "../spec/spec_helpers" + +def run(args : Array(String), input : String = "") + input_io, output, error = + {IO::Memory.new(input), IO::Memory.new, IO::Memory.new} + + path = + Path[__DIR__, "..", "bin", "mint"].normalize.to_s + + status = + Process.run( + clear_env: true, + input: input_io, + output: output, + command: path, + error: error, + args: args, + env: { + "NO_COLOR" => "1", + }) + + { + output.rewind.gets_to_end, + error.rewind.gets_to_end, + status, + } +end + +def expect_output(args : Array(String), template : String, input : String = "") + output, _, status = + run args, input + + status.normal_exit?.should eq(true) + matches_template(template.rstrip, output.rstrip) +end diff --git a/spec_cli/version_spec.cr b/spec_cli/version_spec.cr new file mode 100644 index 000000000..45b4c964e --- /dev/null +++ b/spec_cli/version_spec.cr @@ -0,0 +1,19 @@ +require "./spec_helper" + +context "Version" do + it "prints the version" do + expect_output ["version"], "Mint #{Mint::VERSION}" + end + + it "prints the help" do + expect_output ["version", "--help"], <<-TEXT + Usage: + ×××× version [flags...] [arg...] + + Shows version. + + Flags: + --help # Displays help for the current command. + TEXT + end +end diff --git a/src/assets/scaffold/source/Content.mint b/src/assets/scaffold/source/Content.mint index 690c1e62c..c8dd027cc 100644 --- a/src/assets/scaffold/source/Content.mint +++ b/src/assets/scaffold/source/Content.mint @@ -64,7 +64,7 @@ component Content { Here are some links which you might find helpful going forward: * The [interactive tutorial] to learn Mint 🧑‍🎓 - * The [guide] with information on best practices 📚 + * The [guides] with information on best practices 📚 * The documentation of the [standard library] 📜 * The [RealWorld] example application 💡 @@ -78,7 +78,7 @@ component Content { [interactive tutorial]: https://mint-lang.com/tutorial [discord server]: https://discord.gg/EtApG7BGfy [standard library]: https://mint-lang.com/api - [guide]: https://mint-lang.com/guide + [guides]: https://mint-lang.com/guides MARKDOWN
} diff --git a/src/bundler.cr b/src/bundler.cr index 29c223112..373a19677 100644 --- a/src/bundler.cr +++ b/src/bundler.cr @@ -40,10 +40,10 @@ module Mint def bundle Logger.log "Building application" { generate_application } - Logger.log "Building index.html" { generate_index_html } - Logger.log "Building manifest" { generate_manifest } if config.generate_manifest - Logger.log "Building icons" { generate_icons } unless config.skip_icons - Logger.log "Building assets" { generate_assets } + Logger.log "Generating index.html" { generate_index_html } + Logger.log "Generating manifest" { generate_manifest } if config.generate_manifest + Logger.log "Generating icons" { generate_icons } unless config.skip_icons + Logger.log "Copying assets" { generate_assets } files end diff --git a/src/commands/build.cr b/src/commands/build.cr index d49f1b1e3..837e13df7 100644 --- a/src/commands/build.cr +++ b/src/commands/build.cr @@ -63,7 +63,7 @@ module Mint terminal.puts "Building for production..." terminal.divider - terminal.measure %(#{COG} Clearing the "#{DIST_DIR}" directory...") do + terminal.measure %(#{COG} Clearing the "#{DIST_DIR}" directory...) do FileUtils.rm_rf DIST_DIR end diff --git a/src/commands/format.cr b/src/commands/format.cr index 35c7e29ea..948e48de8 100644 --- a/src/commands/format.cr +++ b/src/commands/format.cr @@ -10,7 +10,7 @@ module Mint Same end - define_help description: "Formats .mint files." + define_help description: "Formats *.mint files." define_argument pattern : String, description: "The pattern which determines which files to format." @@ -66,7 +66,19 @@ module Mint formatted = Formatter.new.format(artifact) - terminal.puts formatted + if flags.check + execute "Checking source from STDIN" do + if input != formatted + terminal.puts "Source is not formatted!" + terminal.divider + error nil, terminal.position + else + terminal.puts "Source is formatted!" + end + end + else + terminal.puts formatted + end rescue error : Error error error.to_terminal, terminal.position end diff --git a/src/commands/init.cr b/src/commands/init.cr index 0374d894f..0078b15a5 100644 --- a/src/commands/init.cr +++ b/src/commands/init.cr @@ -17,7 +17,8 @@ module Mint name = arguments.name.presence loop do - terminal.puts "Please provide a name for the project (for example my-project):" + terminal.puts "Please provide a name for the project " \ + "(for example my-project):" break if name = gets.presence end unless name diff --git a/src/formatters/top_level.cr b/src/formatters/top_level.cr index 09789f78c..4eb9c593d 100644 --- a/src/formatters/top_level.cr +++ b/src/formatters/top_level.cr @@ -17,7 +17,7 @@ module Mint .intersperse([Line.new(2)] of Node) .flatten - Renderer.render(body) + "\n" + Renderer.render(body) end end end