@kuncat/avoidant 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -18
- package/dist/components/AvoidantGame.svelte +743 -458
- package/dist/components/AvoidantGame.svelte.d.ts +2 -1
- package/dist/components/GameHistory.svelte +103 -0
- package/dist/components/GameHistory.svelte.d.ts +8 -0
- package/dist/components/MapControls.svelte +1 -1
- package/dist/components/MapIcon.svelte +40 -0
- package/dist/components/MapIcon.svelte.d.ts +7 -0
- package/dist/components/MatchResults.svelte +29 -0
- package/dist/components/MatchResults.svelte.d.ts +8 -0
- package/dist/components/MultiplayerGame.svelte +504 -0
- package/dist/components/MultiplayerGame.svelte.d.ts +11 -0
- package/dist/components/OptionHelp.svelte +96 -0
- package/dist/components/OptionHelp.svelte.d.ts +7 -0
- package/dist/components/ScoreSummary.svelte +43 -0
- package/dist/components/ScoreSummary.svelte.d.ts +8 -0
- package/dist/components/board.svelte +61 -39
- package/dist/components/board.svelte.d.ts +4 -2
- package/dist/components/fragment.glsl +34 -0
- package/dist/components/label-connectors.d.ts +5 -2
- package/dist/components/label-connectors.js +47 -37
- package/dist/components/map-camera.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/multiplayer/client.d.ts +21 -0
- package/dist/multiplayer/client.js +111 -0
- package/dist/multiplayer/duration.d.ts +1 -0
- package/dist/multiplayer/duration.js +6 -0
- package/dist/multiplayer/local-identity.d.ts +1 -0
- package/dist/multiplayer/local-identity.js +13 -0
- package/dist/multiplayer/maps.json +275 -0
- package/dist/multiplayer/reveal.d.ts +11 -0
- package/dist/multiplayer/reveal.js +16 -0
- package/dist/multiplayer/types.d.ts +80 -0
- package/dist/multiplayer/types.js +10 -0
- package/dist/paraglide/messages/_index.d.ts +111 -8
- package/dist/paraglide/messages/_index.js +111 -8
- package/dist/paraglide/messages/action_back.js +2 -2
- package/dist/paraglide/messages/action_copied.d.ts +16 -0
- package/dist/paraglide/messages/action_copied.js +29 -0
- package/dist/paraglide/messages/action_copy.js +2 -2
- package/dist/paraglide/messages/action_copy_invitation.d.ts +16 -0
- package/dist/paraglide/messages/action_copy_invitation.js +29 -0
- package/dist/paraglide/messages/action_download_replay.d.ts +16 -0
- package/dist/paraglide/messages/action_download_replay.js +29 -0
- package/dist/paraglide/messages/action_exit.js +2 -2
- package/dist/paraglide/messages/action_game_history.d.ts +16 -0
- package/dist/paraglide/messages/action_game_history.js +29 -0
- package/dist/paraglide/messages/action_invite.js +2 -2
- package/dist/paraglide/messages/action_join.js +2 -2
- package/dist/paraglide/messages/action_join_game.js +2 -2
- package/dist/paraglide/messages/action_load_more.d.ts +16 -0
- package/dist/paraglide/messages/action_load_more.js +29 -0
- package/dist/paraglide/messages/action_login.d.ts +16 -0
- package/dist/paraglide/messages/action_login.js +29 -0
- package/dist/paraglide/messages/action_login_again.d.ts +16 -0
- package/dist/paraglide/messages/action_login_again.js +29 -0
- package/dist/paraglide/messages/action_logout.d.ts +16 -0
- package/dist/paraglide/messages/action_logout.js +29 -0
- package/dist/paraglide/messages/action_new_game.js +2 -2
- package/dist/paraglide/messages/action_pass.d.ts +16 -0
- package/dist/paraglide/messages/action_pass.js +29 -0
- package/dist/paraglide/messages/action_random.js +2 -2
- package/dist/paraglide/messages/action_reconnect.d.ts +16 -0
- package/dist/paraglide/messages/action_reconnect.js +29 -0
- package/dist/paraglide/messages/action_register.d.ts +16 -0
- package/dist/paraglide/messages/action_register.js +29 -0
- package/dist/paraglide/messages/action_save_name.d.ts +16 -0
- package/dist/paraglide/messages/action_save_name.js +29 -0
- package/dist/paraglide/messages/action_start.js +2 -2
- package/dist/paraglide/messages/action_start_match.d.ts +16 -0
- package/dist/paraglide/messages/action_start_match.js +29 -0
- package/dist/paraglide/messages/aria_close_invitation.js +2 -2
- package/dist/paraglide/messages/aria_score_summary.js +2 -2
- package/dist/paraglide/messages/cells_count.js +2 -2
- package/dist/paraglide/messages/cells_per_face.js +2 -2
- package/dist/paraglide/messages/default_player_name.js +2 -2
- package/dist/paraglide/messages/error_connection_failed.d.ts +16 -0
- package/dist/paraglide/messages/error_connection_failed.js +29 -0
- package/dist/paraglide/messages/error_connection_interrupted.d.ts +16 -0
- package/dist/paraglide/messages/error_connection_interrupted.js +29 -0
- package/dist/paraglide/messages/error_history.d.ts +16 -0
- package/dist/paraglide/messages/error_history.js +29 -0
- package/dist/paraglide/messages/error_invitation_invalid.d.ts +16 -0
- package/dist/paraglide/messages/error_invitation_invalid.js +29 -0
- package/dist/paraglide/messages/error_join_connect_failed.js +2 -2
- package/dist/paraglide/messages/error_join_failed.js +2 -2
- package/dist/paraglide/messages/error_join_ticket_invalid.js +2 -2
- package/dist/paraglide/messages/error_join_ticket_required.js +2 -2
- package/dist/paraglide/messages/error_login_to_join.d.ts +16 -0
- package/dist/paraglide/messages/error_login_to_join.js +29 -0
- package/dist/paraglide/messages/error_map_version.d.ts +16 -0
- package/dist/paraglide/messages/error_map_version.js +29 -0
- package/dist/paraglide/messages/error_match_join.d.ts +16 -0
- package/dist/paraglide/messages/error_match_join.js +29 -0
- package/dist/paraglide/messages/error_match_version.d.ts +16 -0
- package/dist/paraglide/messages/error_match_version.js +29 -0
- package/dist/paraglide/messages/error_name_not_saved.d.ts +16 -0
- package/dist/paraglide/messages/error_name_not_saved.js +29 -0
- package/dist/paraglide/messages/error_name_server_update.d.ts +16 -0
- package/dist/paraglide/messages/error_name_server_update.js +29 -0
- package/dist/paraglide/messages/error_player_name.d.ts +16 -0
- package/dist/paraglide/messages/error_player_name.js +29 -0
- package/dist/paraglide/messages/error_reconnect_to_play.d.ts +16 -0
- package/dist/paraglide/messages/error_reconnect_to_play.js +29 -0
- package/dist/paraglide/messages/error_replay.d.ts +16 -0
- package/dist/paraglide/messages/error_replay.js +29 -0
- package/dist/paraglide/messages/error_unsupported_map.d.ts +16 -0
- package/dist/paraglide/messages/error_unsupported_map.js +29 -0
- package/dist/paraglide/messages/faces_count.js +2 -2
- package/dist/paraglide/messages/field_bordering.d.ts +16 -0
- package/dist/paraglide/messages/field_bordering.js +29 -0
- package/dist/paraglide/messages/field_cell_density.js +2 -2
- package/dist/paraglide/messages/field_duration_unit.d.ts +16 -0
- package/dist/paraglide/messages/field_duration_unit.js +29 -0
- package/dist/paraglide/messages/field_finite_flood.d.ts +16 -0
- package/dist/paraglide/messages/field_finite_flood.js +29 -0
- package/dist/paraglide/messages/field_flood_cells.d.ts +16 -0
- package/dist/paraglide/messages/field_flood_cells.js +29 -0
- package/dist/paraglide/messages/field_flood_limit.d.ts +16 -0
- package/dist/paraglide/messages/field_flood_limit.js +29 -0
- package/dist/paraglide/messages/field_infinite_flood.d.ts +16 -0
- package/dist/paraglide/messages/field_infinite_flood.js +29 -0
- package/dist/paraglide/messages/field_invitation_link.d.ts +16 -0
- package/dist/paraglide/messages/field_invitation_link.js +29 -0
- package/dist/paraglide/messages/field_invitation_url.js +2 -2
- package/dist/paraglide/messages/field_language.d.ts +16 -0
- package/dist/paraglide/messages/field_language.js +29 -0
- package/dist/paraglide/messages/field_map.d.ts +16 -0
- package/dist/paraglide/messages/field_map.js +29 -0
- package/dist/paraglide/messages/field_map_shape.js +2 -2
- package/dist/paraglide/messages/field_map_size.d.ts +1 -1
- package/dist/paraglide/messages/field_map_size.js +5 -5
- package/dist/paraglide/messages/field_match_duration.d.ts +16 -0
- package/dist/paraglide/messages/field_match_duration.js +29 -0
- package/dist/paraglide/messages/field_match_minutes.d.ts +16 -0
- package/dist/paraglide/messages/field_match_minutes.js +29 -0
- package/dist/paraglide/messages/field_play_mode.d.ts +16 -0
- package/dist/paraglide/messages/field_play_mode.js +29 -0
- package/dist/paraglide/messages/field_player_name.js +2 -2
- package/dist/paraglide/messages/field_radius.js +2 -2
- package/dist/paraglide/messages/field_radius_x.js +2 -2
- package/dist/paraglide/messages/field_radius_y.js +2 -2
- package/dist/paraglide/messages/field_radius_z.js +2 -2
- package/dist/paraglide/messages/field_relay_servers.js +2 -2
- package/dist/paraglide/messages/field_seed.js +2 -2
- package/dist/paraglide/messages/field_size.d.ts +1 -1
- package/dist/paraglide/messages/field_size.js +5 -5
- package/dist/paraglide/messages/field_spikiness.js +2 -2
- package/dist/paraglide/messages/field_subdivisions.js +2 -2
- package/dist/paraglide/messages/field_surface_detail.js +2 -2
- package/dist/paraglide/messages/field_ticket_or_invitation_url.js +2 -2
- package/dist/paraglide/messages/field_turn_based.d.ts +16 -0
- package/dist/paraglide/messages/field_turn_based.js +29 -0
- package/dist/paraglide/messages/field_turn_duration.d.ts +16 -0
- package/dist/paraglide/messages/field_turn_duration.js +29 -0
- package/dist/paraglide/messages/field_turn_duration_unit.d.ts +16 -0
- package/dist/paraglide/messages/field_turn_duration_unit.js +29 -0
- package/dist/paraglide/messages/field_turn_timer.d.ts +16 -0
- package/dist/paraglide/messages/field_turn_timer.js +29 -0
- package/dist/paraglide/messages/field_tutorial_mode.js +2 -2
- package/dist/paraglide/messages/field_void_fraction.js +2 -2
- package/dist/paraglide/messages/help_bordering.d.ts +16 -0
- package/dist/paraglide/messages/help_bordering.js +29 -0
- package/dist/paraglide/messages/help_flood_limit.d.ts +16 -0
- package/dist/paraglide/messages/help_flood_limit.js +29 -0
- package/dist/paraglide/messages/help_map.d.ts +16 -0
- package/dist/paraglide/messages/help_map.js +29 -0
- package/dist/paraglide/messages/help_map_size.d.ts +16 -0
- package/dist/paraglide/messages/help_map_size.js +29 -0
- package/dist/paraglide/messages/help_match_duration.d.ts +16 -0
- package/dist/paraglide/messages/help_match_duration.js +29 -0
- package/dist/paraglide/messages/help_participation_time.d.ts +16 -0
- package/dist/paraglide/messages/help_participation_time.js +29 -0
- package/dist/paraglide/messages/help_play_mode.d.ts +16 -0
- package/dist/paraglide/messages/help_play_mode.js +29 -0
- package/dist/paraglide/messages/help_player_name.d.ts +16 -0
- package/dist/paraglide/messages/help_player_name.js +29 -0
- package/dist/paraglide/messages/help_seed.d.ts +16 -0
- package/dist/paraglide/messages/help_seed.js +29 -0
- package/dist/paraglide/messages/help_size.d.ts +16 -0
- package/dist/paraglide/messages/help_size.js +29 -0
- package/dist/paraglide/messages/help_spikiness.d.ts +16 -0
- package/dist/paraglide/messages/help_spikiness.js +29 -0
- package/dist/paraglide/messages/help_turn_based.d.ts +16 -0
- package/dist/paraglide/messages/help_turn_based.js +29 -0
- package/dist/paraglide/messages/help_turn_duration.d.ts +16 -0
- package/dist/paraglide/messages/help_turn_duration.js +29 -0
- package/dist/paraglide/messages/help_turn_time.d.ts +16 -0
- package/dist/paraglide/messages/help_turn_time.js +29 -0
- package/dist/paraglide/messages/help_turn_timer.d.ts +16 -0
- package/dist/paraglide/messages/help_turn_timer.js +29 -0
- package/dist/paraglide/messages/help_tutorial_mode.d.ts +16 -0
- package/dist/paraglide/messages/help_tutorial_mode.js +29 -0
- package/dist/paraglide/messages/help_void_fraction.d.ts +16 -0
- package/dist/paraglide/messages/help_void_fraction.js +29 -0
- package/dist/paraglide/messages/history_empty.d.ts +16 -0
- package/dist/paraglide/messages/history_empty.js +29 -0
- package/dist/paraglide/messages/label_advanced_settings.js +2 -2
- package/dist/paraglide/messages/label_claims.d.ts +18 -0
- package/dist/paraglide/messages/label_claims.js +29 -0
- package/dist/paraglide/messages/label_cumulative_time.d.ts +16 -0
- package/dist/paraglide/messages/label_cumulative_time.js +29 -0
- package/dist/paraglide/messages/label_custom_map_options.d.ts +16 -0
- package/dist/paraglide/messages/label_custom_map_options.js +29 -0
- package/dist/paraglide/messages/label_gameplay_options.d.ts +16 -0
- package/dist/paraglide/messages/label_gameplay_options.js +29 -0
- package/dist/paraglide/messages/label_map_options.d.ts +16 -0
- package/dist/paraglide/messages/label_map_options.js +29 -0
- package/dist/paraglide/messages/label_match_ends.d.ts +18 -0
- package/dist/paraglide/messages/label_match_ends.js +29 -0
- package/dist/paraglide/messages/label_match_id.d.ts +18 -0
- package/dist/paraglide/messages/label_match_id.js +29 -0
- package/dist/paraglide/messages/label_player_number.d.ts +18 -0
- package/dist/paraglide/messages/label_player_number.js +29 -0
- package/dist/paraglide/messages/label_players.js +2 -2
- package/dist/paraglide/messages/label_points.d.ts +18 -0
- package/dist/paraglide/messages/label_points.js +29 -0
- package/dist/paraglide/messages/label_revealed_count.d.ts +18 -0
- package/dist/paraglide/messages/label_revealed_count.js +29 -0
- package/dist/paraglide/messages/label_safe_cells_explored.js +2 -2
- package/dist/paraglide/messages/label_safe_cells_remaining.js +2 -2
- package/dist/paraglide/messages/label_score.js +2 -2
- package/dist/paraglide/messages/label_streak.js +2 -2
- package/dist/paraglide/messages/label_team_score.d.ts +18 -0
- package/dist/paraglide/messages/label_team_score.js +29 -0
- package/dist/paraglide/messages/label_turn_remaining.d.ts +18 -0
- package/dist/paraglide/messages/label_turn_remaining.js +29 -0
- package/dist/paraglide/messages/label_voids_discovered.js +2 -2
- package/dist/paraglide/messages/label_you.d.ts +16 -0
- package/dist/paraglide/messages/label_you.js +29 -0
- package/dist/paraglide/messages/mode_collaborative.d.ts +16 -0
- package/dist/paraglide/messages/mode_collaborative.js +29 -0
- package/dist/paraglide/messages/mode_collaborative_hint.d.ts +16 -0
- package/dist/paraglide/messages/mode_collaborative_hint.js +29 -0
- package/dist/paraglide/messages/mode_solo.d.ts +16 -0
- package/dist/paraglide/messages/mode_solo.js +29 -0
- package/dist/paraglide/messages/mode_solo_hint.d.ts +16 -0
- package/dist/paraglide/messages/mode_solo_hint.js +29 -0
- package/dist/paraglide/messages/mode_territory.d.ts +16 -0
- package/dist/paraglide/messages/mode_territory.js +29 -0
- package/dist/paraglide/messages/mode_territory_hint.d.ts +16 -0
- package/dist/paraglide/messages/mode_territory_hint.js +29 -0
- package/dist/paraglide/messages/multiplayer_title.d.ts +16 -0
- package/dist/paraglide/messages/multiplayer_title.js +29 -0
- package/dist/paraglide/messages/option_help.d.ts +18 -0
- package/dist/paraglide/messages/option_help.js +29 -0
- package/dist/paraglide/messages/package.json +4 -0
- package/dist/paraglide/messages/preset_custom.js +2 -2
- package/dist/paraglide/messages/preset_large.js +2 -2
- package/dist/paraglide/messages/preset_medium.js +2 -2
- package/dist/paraglide/messages/preset_small.js +2 -2
- package/dist/paraglide/messages/shape_label.d.ts +5 -5
- package/dist/paraglide/messages/shape_label.js +17 -17
- package/dist/paraglide/messages/status_connecting.d.ts +16 -0
- package/dist/paraglide/messages/status_connecting.js +29 -0
- package/dist/paraglide/messages/status_draw.d.ts +16 -0
- package/dist/paraglide/messages/status_draw.js +29 -0
- package/dist/paraglide/messages/status_generating_map.js +2 -2
- package/dist/paraglide/messages/status_initialization_failed.js +2 -2
- package/dist/paraglide/messages/status_joining_game.js +2 -2
- package/dist/paraglide/messages/status_loading.js +2 -2
- package/dist/paraglide/messages/status_match_complete.d.ts +16 -0
- package/dist/paraglide/messages/status_match_complete.js +29 -0
- package/dist/paraglide/messages/status_match_expired.d.ts +16 -0
- package/dist/paraglide/messages/status_match_expired.js +29 -0
- package/dist/paraglide/messages/status_name_saved.d.ts +16 -0
- package/dist/paraglide/messages/status_name_saved.js +29 -0
- package/dist/paraglide/messages/status_named_turn.d.ts +18 -0
- package/dist/paraglide/messages/status_named_turn.js +29 -0
- package/dist/paraglide/messages/status_named_winner.d.ts +18 -0
- package/dist/paraglide/messages/status_named_winner.js +29 -0
- package/dist/paraglide/messages/status_player_turn.d.ts +18 -0
- package/dist/paraglide/messages/status_player_turn.js +29 -0
- package/dist/paraglide/messages/status_preparing.js +2 -2
- package/dist/paraglide/messages/status_realtime_claims.d.ts +16 -0
- package/dist/paraglide/messages/status_realtime_claims.js +29 -0
- package/dist/paraglide/messages/status_reconnecting.d.ts +16 -0
- package/dist/paraglide/messages/status_reconnecting.js +29 -0
- package/dist/paraglide/messages/status_session_complete.d.ts +16 -0
- package/dist/paraglide/messages/status_session_complete.js +29 -0
- package/dist/paraglide/messages/status_winner.d.ts +18 -0
- package/dist/paraglide/messages/status_winner.js +29 -0
- package/dist/paraglide/messages/text_account_multiplayer.d.ts +16 -0
- package/dist/paraglide/messages/text_account_multiplayer.js +29 -0
- package/dist/paraglide/messages/text_avoided.js +2 -2
- package/dist/paraglide/messages/text_density_summary.js +2 -2
- package/dist/paraglide/messages/text_invite_after_opening.js +2 -2
- package/dist/paraglide/messages/text_multiplayer_login.d.ts +16 -0
- package/dist/paraglide/messages/text_multiplayer_login.js +29 -0
- package/dist/paraglide/messages/text_relay_servers_hint.js +2 -2
- package/dist/paraglide/messages/text_waiting_lobby.d.ts +16 -0
- package/dist/paraglide/messages/text_waiting_lobby.js +29 -0
- package/dist/paraglide/messages/tutorial_action_dismiss.js +2 -2
- package/dist/paraglide/messages/tutorial_action_next.js +2 -2
- package/dist/paraglide/messages/tutorial_after_safe_deducible.js +2 -2
- package/dist/paraglide/messages/tutorial_after_safe_guess.js +2 -2
- package/dist/paraglide/messages/tutorial_after_void.js +2 -2
- package/dist/paraglide/messages/tutorial_awaiting_first_click.js +2 -2
- package/dist/paraglide/messages/tutorial_intro.d.ts +1 -1
- package/dist/paraglide/messages/tutorial_intro.js +5 -5
- package/dist/paraglide/messages/tutorial_won.js +2 -2
- package/dist/paraglide/messages/unit_hours.d.ts +16 -0
- package/dist/paraglide/messages/unit_hours.js +29 -0
- package/dist/paraglide/messages/unit_hours_selected.d.ts +19 -0
- package/dist/paraglide/messages/unit_hours_selected.js +35 -0
- package/dist/paraglide/messages/unit_minutes.d.ts +16 -0
- package/dist/paraglide/messages/unit_minutes.js +29 -0
- package/dist/paraglide/messages/unit_minutes_selected.d.ts +19 -0
- package/dist/paraglide/messages/unit_minutes_selected.js +35 -0
- package/dist/paraglide/messages/unit_seconds.d.ts +16 -0
- package/dist/paraglide/messages/unit_seconds.js +29 -0
- package/dist/paraglide/messages/unit_seconds_selected.d.ts +19 -0
- package/dist/paraglide/messages/unit_seconds_selected.js +35 -0
- package/dist/paraglide/registry.d.ts +13 -0
- package/dist/paraglide/registry.js +15 -0
- package/dist/paraglide/runtime.d.ts +90 -26
- package/dist/paraglide/runtime.js +597 -109
- package/dist/paraglide/server.d.ts +1 -1
- package/dist/paraglide/server.js +27 -10
- package/dist/styles/global.css +12 -51
- package/dist/wasm/avoidant_wasm.d.ts +56 -11
- package/dist/wasm/avoidant_wasm.js +188 -52
- package/dist/wasm/avoidant_wasm_bg.wasm +0 -0
- package/dist/wasm/avoidant_wasm_bg.wasm.d.ts +25 -11
- package/package.json +34 -32
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
|
+
import OptionHelp from "./OptionHelp.svelte";
|
|
4
|
+
import ScoreSummary from "./ScoreSummary.svelte";
|
|
5
|
+
import MapIcon from "./MapIcon.svelte";
|
|
6
|
+
import GameHistory from "./GameHistory.svelte";
|
|
7
|
+
let historyOpen = $state(false);
|
|
8
|
+
import MultiplayerGame from "./MultiplayerGame.svelte";
|
|
9
|
+
import type { CompetitiveConfig, MultiplayerSetup } from "../multiplayer/types";
|
|
3
10
|
import { devicePixelRatio } from "svelte/reactivity/window";
|
|
4
11
|
import { slide } from "svelte/transition";
|
|
5
12
|
import { SvelteSet } from "svelte/reactivity";
|
|
@@ -18,8 +25,15 @@
|
|
|
18
25
|
import { generateMap } from "../workers/mapgen-client";
|
|
19
26
|
import { TutorialState } from "../tutorial.svelte";
|
|
20
27
|
|
|
21
|
-
const SETTINGS_STORAGE_KEY = "avoidant:gameSettings:v1";
|
|
22
28
|
const PLAYER_NAME_STORAGE_KEY = "avoidant:playerName";
|
|
29
|
+
let playerNameInput = $state<string>(m.default_player_name());
|
|
30
|
+
let playerNameLoaded = $state(false);
|
|
31
|
+
$effect(() => {
|
|
32
|
+
if (playerNameLoaded && playerNameInput !== m.default_player_name())
|
|
33
|
+
localStorage.setItem(PLAYER_NAME_STORAGE_KEY, playerNameInput);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const SETTINGS_STORAGE_KEY = "avoidant:gameSettings:v1";
|
|
23
37
|
const SIZE_PRESETS = { small: 80, medium: 160, large: 320 } as const;
|
|
24
38
|
|
|
25
39
|
// Default mapshape parameters used when a preset is picked or no custom value has been entered yet.
|
|
@@ -45,35 +59,96 @@
|
|
|
45
59
|
type SizePreset = keyof typeof SIZE_PRESETS | "custom";
|
|
46
60
|
type Locale = (typeof locales)[number];
|
|
47
61
|
type AvoidantGameProps = {
|
|
48
|
-
|
|
62
|
+
competitive?: CompetitiveConfig;
|
|
49
63
|
};
|
|
50
64
|
|
|
51
|
-
let {
|
|
65
|
+
let { competitive }: AvoidantGameProps = $props();
|
|
66
|
+
let competitiveOpen = $state(false);
|
|
67
|
+
let account = $state<{ id: string; capabilities: string[] } | null>(null);
|
|
68
|
+
let authMessage = $state("");
|
|
69
|
+
let playMode = $state<"solo" | MultiplayerSetup["mode"]>("solo");
|
|
70
|
+
let multiplayerSetup = $state<MultiplayerSetup>();
|
|
71
|
+
let invitation = $state<string>();
|
|
72
|
+
let bordering = $state(false);
|
|
73
|
+
let turnBased = $state(true);
|
|
74
|
+
let infiniteFlood = $state(true);
|
|
75
|
+
let matchDuration = $state(60);
|
|
76
|
+
let matchUnit = $state<"minutes" | "hours">("minutes");
|
|
77
|
+
let turnDuration = $state(5);
|
|
78
|
+
let turnUnit = $state<"seconds" | "minutes">("seconds");
|
|
79
|
+
let turnTimer = $state(true);
|
|
80
|
+
let floodLimit = $state(0);
|
|
81
|
+
const playModes = [
|
|
82
|
+
{ id: "solo", label: m.mode_solo, description: m.mode_solo_hint },
|
|
83
|
+
{ id: "collaborative", label: m.mode_collaborative, description: m.mode_collaborative_hint },
|
|
84
|
+
{ id: "territory", label: m.mode_territory, description: m.mode_territory_hint },
|
|
85
|
+
] as const;
|
|
86
|
+
$effect(() => {
|
|
87
|
+
const config = competitive;
|
|
88
|
+
if (!config) return;
|
|
89
|
+
let active = true;
|
|
90
|
+
void (async () => {
|
|
91
|
+
try {
|
|
92
|
+
const params = new URL(window.location.href).searchParams;
|
|
93
|
+
const pending =
|
|
94
|
+
params.get("match") ??
|
|
95
|
+
(params.has("state") ? sessionStorage.getItem("avoidant:competitiveMatch") : null);
|
|
96
|
+
if (pending) sessionStorage.setItem("avoidant:competitiveMatch", pending);
|
|
97
|
+
await config.account.completeLogin();
|
|
98
|
+
const current = await config.account.account();
|
|
99
|
+
if (!active) return;
|
|
100
|
+
account = current;
|
|
101
|
+
if (
|
|
102
|
+
current?.username &&
|
|
103
|
+
(!localStorage.getItem(PLAYER_NAME_STORAGE_KEY) ||
|
|
104
|
+
localStorage.getItem(PLAYER_NAME_STORAGE_KEY) === m.default_player_name())
|
|
105
|
+
) {
|
|
106
|
+
playerNameInput = Array.from(current.username.trim()).slice(0, 32).join("");
|
|
107
|
+
}
|
|
108
|
+
if (pending) {
|
|
109
|
+
invitation = pending;
|
|
110
|
+
ticketInput = pending;
|
|
111
|
+
if (current) competitiveOpen = true;
|
|
112
|
+
else setupMode = "join";
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if (active) authMessage = String(error);
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
return () => {
|
|
119
|
+
active = false;
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
async function login(register = false) {
|
|
123
|
+
try {
|
|
124
|
+
await competitive?.account.login(register);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
authMessage = String(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function logout() {
|
|
130
|
+
try {
|
|
131
|
+
await competitive?.account.logout();
|
|
132
|
+
account = null;
|
|
133
|
+
playMode = "solo";
|
|
134
|
+
} catch (error) {
|
|
135
|
+
authMessage = String(error);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function selectMode(mode: typeof playMode) {
|
|
139
|
+
playMode = mode;
|
|
140
|
+
if (mode !== "solo") {
|
|
141
|
+
if (sizePreset === "custom") sizePreset = "medium";
|
|
142
|
+
isTutorialMode = false;
|
|
143
|
+
}
|
|
144
|
+
infiniteFlood = mode === "collaborative";
|
|
145
|
+
}
|
|
52
146
|
|
|
53
147
|
const localeLabels: Record<Locale, string> = {
|
|
54
148
|
en: "English",
|
|
55
149
|
bn: "বাংলা",
|
|
56
150
|
};
|
|
57
151
|
|
|
58
|
-
function normalizeRelayServerList(input: string[]): string[] {
|
|
59
|
-
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
60
|
-
const seen = new Set<string>();
|
|
61
|
-
const urls: string[] = [];
|
|
62
|
-
for (const item of input) {
|
|
63
|
-
const trimmed = item.trim();
|
|
64
|
-
if (!trimmed || seen.has(trimmed)) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
seen.add(trimmed);
|
|
68
|
-
urls.push(trimmed);
|
|
69
|
-
}
|
|
70
|
-
return urls;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function parseRelayServersInput(input: string): string[] {
|
|
74
|
-
return normalizeRelayServerList(input.split(/\r?\n/));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
152
|
let status: string | undefined = $state(undefined);
|
|
78
153
|
let gameState = $state<GameState | undefined>(undefined);
|
|
79
154
|
let terrain = $state<MapData["terrain"] | undefined>(undefined);
|
|
@@ -91,7 +166,6 @@
|
|
|
91
166
|
}
|
|
92
167
|
// Shape selection state. The shape kind drives which numeric inputs are shown; each per-shape numeric value persists independently so switching back and forth doesn't reset the user's edits.
|
|
93
168
|
let shapeKindInput = $state<ShapeKind>("icosahedron");
|
|
94
|
-
let playerNameInput = $state<string>(m.default_player_name());
|
|
95
169
|
let settingsLoaded = $state(false);
|
|
96
170
|
let isTutorialMode = $state(false);
|
|
97
171
|
let tutorial = $state<TutorialState | undefined>(undefined);
|
|
@@ -100,18 +174,8 @@
|
|
|
100
174
|
let setupMode: "host" | "join" | undefined = $state(undefined);
|
|
101
175
|
let sizePreset = $state<SizePreset>("medium");
|
|
102
176
|
let isAdvancedSettingsOpen = $state(false);
|
|
103
|
-
let relayServersInput = $state("");
|
|
104
|
-
let hasRelayServersConfigured = $derived(parseRelayServersInput(relayServersInput).length > 0);
|
|
105
177
|
let ticketInput = $state("");
|
|
106
178
|
let joinError: string | undefined = $state(undefined);
|
|
107
|
-
let inviteTicket = $state("");
|
|
108
|
-
let inviteUrl = $derived(
|
|
109
|
-
inviteTicket && typeof window !== "undefined"
|
|
110
|
-
? `${window.location.origin}${window.location.pathname}?ticket=${encodeURIComponent(inviteTicket)}`
|
|
111
|
-
: "",
|
|
112
|
-
);
|
|
113
|
-
let isGeneratingInvite = $state(false);
|
|
114
|
-
let networkSnapshot = $derived(gameState?.networkSnapshot);
|
|
115
179
|
let score = $derived(gameState?.score);
|
|
116
180
|
let cellMetadataStore = $derived(gameState?.cellMetadata);
|
|
117
181
|
let cellsStore = $derived(gameState?.cells);
|
|
@@ -119,12 +183,6 @@
|
|
|
119
183
|
let numSafeUnexploredCells = $derived(
|
|
120
184
|
$score ? Math.max(0, $score.totalCells - $score.voidTotal - $score.safeExplored) : 0,
|
|
121
185
|
);
|
|
122
|
-
let isScoreBreakdownHovered = $state(false);
|
|
123
|
-
let isScoreBreakdownPinned = $state(false);
|
|
124
|
-
let showScoreBreakdown = $derived(isScoreBreakdownHovered || isScoreBreakdownPinned);
|
|
125
|
-
let connectedPeerCount = $derived(
|
|
126
|
-
($networkSnapshot?.peers ?? []).filter((peer) => peer.isConnected).length,
|
|
127
|
-
);
|
|
128
186
|
let cameraFov = $state(50);
|
|
129
187
|
|
|
130
188
|
let selectedCellCount = $derived(
|
|
@@ -184,17 +242,6 @@
|
|
|
184
242
|
],
|
|
185
243
|
);
|
|
186
244
|
|
|
187
|
-
function toggleScoreBreakdown() {
|
|
188
|
-
isScoreBreakdownPinned = !isScoreBreakdownPinned;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function handleScoreSummaryKeydown(event: KeyboardEvent) {
|
|
192
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
toggleScoreBreakdown();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
245
|
/**
|
|
199
246
|
* Pick a perspective FOV so the bounding sphere of the generated shape (including the maximum elevation displacement) fits the viewport on both axes, with a small margin so cells near the silhouette aren't clipped.
|
|
200
247
|
*/
|
|
@@ -232,10 +279,10 @@
|
|
|
232
279
|
}
|
|
233
280
|
|
|
234
281
|
onMount(() => {
|
|
282
|
+
playerNameInput = localStorage.getItem(PLAYER_NAME_STORAGE_KEY) || m.default_player_name();
|
|
283
|
+
playerNameLoaded = true;
|
|
235
284
|
resetRandomSeed();
|
|
236
|
-
relayServersInput = normalizeRelayServerList(relayServers).join("\n");
|
|
237
285
|
try {
|
|
238
|
-
playerNameInput = localStorage.getItem(PLAYER_NAME_STORAGE_KEY) ?? playerNameInput;
|
|
239
286
|
const saved = JSON.parse(localStorage.getItem(SETTINGS_STORAGE_KEY) ?? "null");
|
|
240
287
|
if (saved && typeof saved === "object" && !Array.isArray(saved)) {
|
|
241
288
|
if (SHAPE_KINDS.includes(saved.shapeKind)) shapeKindInput = saved.shapeKind;
|
|
@@ -254,7 +301,6 @@
|
|
|
254
301
|
randomSeed = saved.randomSeed !== false;
|
|
255
302
|
if (!randomSeed && Number.isSafeInteger(saved.rngSeed) && saved.rngSeed >= 0)
|
|
256
303
|
rngSeedInput = saved.rngSeed;
|
|
257
|
-
if (typeof saved.relayServers === "string") relayServersInput = saved.relayServers;
|
|
258
304
|
if (typeof saved.tutorialMode === "boolean") isTutorialMode = saved.tutorialMode;
|
|
259
305
|
}
|
|
260
306
|
} catch {
|
|
@@ -267,14 +313,6 @@
|
|
|
267
313
|
status = m.status_loading();
|
|
268
314
|
await init();
|
|
269
315
|
status = undefined;
|
|
270
|
-
|
|
271
|
-
const sharedTicket = new URLSearchParams(window.location.search).get("ticket");
|
|
272
|
-
if (sharedTicket) {
|
|
273
|
-
// Clear the ticket from the visible URL so a refresh doesn't re-trigger join.
|
|
274
|
-
window.history.replaceState({}, "", `${window.location.pathname}${window.location.hash}`);
|
|
275
|
-
ticketInput = sharedTicket;
|
|
276
|
-
setupMode = "join";
|
|
277
|
-
}
|
|
278
316
|
} catch (error) {
|
|
279
317
|
status = m.status_initialization_failed();
|
|
280
318
|
console.error("Failed to initialize wasm", error);
|
|
@@ -289,12 +327,6 @@
|
|
|
289
327
|
setInitialCameraFov();
|
|
290
328
|
});
|
|
291
329
|
|
|
292
|
-
$effect(() => {
|
|
293
|
-
if (gameState) return;
|
|
294
|
-
isScoreBreakdownHovered = false;
|
|
295
|
-
isScoreBreakdownPinned = false;
|
|
296
|
-
});
|
|
297
|
-
|
|
298
330
|
$effect(() => {
|
|
299
331
|
if (settingsLoaded) {
|
|
300
332
|
const settings = {
|
|
@@ -305,11 +337,9 @@
|
|
|
305
337
|
spikiness: spikinessInput,
|
|
306
338
|
randomSeed,
|
|
307
339
|
rngSeed: randomSeed ? undefined : rngSeedInput,
|
|
308
|
-
relayServers: relayServersInput,
|
|
309
340
|
tutorialMode: isTutorialMode,
|
|
310
341
|
};
|
|
311
342
|
try {
|
|
312
|
-
localStorage.setItem(PLAYER_NAME_STORAGE_KEY, playerNameInput);
|
|
313
343
|
localStorage.setItem(SETTINGS_STORAGE_KEY, JSON.stringify(settings));
|
|
314
344
|
} catch (error) {
|
|
315
345
|
console.warn("Failed to persist game settings", error);
|
|
@@ -346,33 +376,24 @@
|
|
|
346
376
|
}
|
|
347
377
|
});
|
|
348
378
|
|
|
349
|
-
function
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
[cx + dx / 2, cy + radius / 2],
|
|
366
|
-
[cx, cy + radius],
|
|
367
|
-
[cx - dx / 2, cy + radius / 2],
|
|
368
|
-
[cx - dx / 2, cy - radius / 2],
|
|
369
|
-
]
|
|
370
|
-
.map(([x, y]) => `${x.toFixed(1)},${y.toFixed(1)}`)
|
|
371
|
-
.join(" "),
|
|
372
|
-
);
|
|
379
|
+
function mosaicCells(divisions: number): string[] {
|
|
380
|
+
const point = (x: number, y: number) => [
|
|
381
|
+
(x * 40) / divisions + (x > 0 && x < divisions ? Math.sin(x * 3 + y * 7) * 2 : 0),
|
|
382
|
+
(y * 40) / divisions + (y > 0 && y < divisions ? Math.cos(x * 5 + y * 3) * 2 : 0),
|
|
383
|
+
];
|
|
384
|
+
const polygons: string[] = [];
|
|
385
|
+
for (let y = 0; y < divisions; y++)
|
|
386
|
+
for (let x = 0; x < divisions; x++) {
|
|
387
|
+
const [a, b, c, d] = [point(x, y), point(x + 1, y), point(x + 1, y + 1), point(x, y + 1)];
|
|
388
|
+
for (const polygon of (x + y) % 3 === 0
|
|
389
|
+
? [
|
|
390
|
+
[a, b, c],
|
|
391
|
+
[a, c, d],
|
|
392
|
+
]
|
|
393
|
+
: [[a, b, c, d]])
|
|
394
|
+
polygons.push(polygon.map((p) => p.join(",")).join(" "));
|
|
373
395
|
}
|
|
374
|
-
|
|
375
|
-
return cells;
|
|
396
|
+
return polygons;
|
|
376
397
|
}
|
|
377
398
|
|
|
378
399
|
type PresetIcon = {
|
|
@@ -384,21 +405,21 @@
|
|
|
384
405
|
const presetIcons: PresetIcon[] = [
|
|
385
406
|
{
|
|
386
407
|
value: "small",
|
|
387
|
-
cells:
|
|
408
|
+
cells: mosaicCells(2),
|
|
388
409
|
get label() {
|
|
389
410
|
return m.preset_small();
|
|
390
411
|
},
|
|
391
412
|
},
|
|
392
413
|
{
|
|
393
414
|
value: "medium",
|
|
394
|
-
cells:
|
|
415
|
+
cells: mosaicCells(3),
|
|
395
416
|
get label() {
|
|
396
417
|
return m.preset_medium();
|
|
397
418
|
},
|
|
398
419
|
},
|
|
399
420
|
{
|
|
400
421
|
value: "large",
|
|
401
|
-
cells:
|
|
422
|
+
cells: mosaicCells(5),
|
|
402
423
|
get label() {
|
|
403
424
|
return m.preset_large();
|
|
404
425
|
},
|
|
@@ -414,15 +435,29 @@
|
|
|
414
435
|
|
|
415
436
|
async function startGame() {
|
|
416
437
|
if (status) return;
|
|
438
|
+
if (playMode !== "solo") {
|
|
439
|
+
if (!competitive || !account || sizePreset === "custom") return;
|
|
440
|
+
multiplayerSetup = {
|
|
441
|
+
mode: playMode,
|
|
442
|
+
map: shapeKindInput === "icosahedron" ? sizePreset : `${shapeKindInput}-${sizePreset}`,
|
|
443
|
+
bordering: playMode === "territory" && bordering,
|
|
444
|
+
turnBased: playMode === "territory" && turnBased,
|
|
445
|
+
floodLimit: infiniteFlood ? null : floodLimit,
|
|
446
|
+
matchMinutes: matchDuration * (matchUnit === "hours" ? 60 : 1),
|
|
447
|
+
turnSeconds: turnTimer ? turnDuration * (turnUnit === "minutes" ? 60 : 1) : null,
|
|
448
|
+
};
|
|
449
|
+
invitation = undefined;
|
|
450
|
+
competitiveOpen = true;
|
|
451
|
+
setupMode = undefined;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
417
454
|
let nextGameState: GameState | undefined;
|
|
418
455
|
try {
|
|
419
|
-
const relayUrls = parseRelayServersInput($state.snapshot(relayServersInput));
|
|
420
456
|
if (randomSeed) resetRandomSeed();
|
|
421
457
|
const options: GameOptions = {
|
|
422
458
|
elevationMax: 6.0,
|
|
423
459
|
elevationMin: 0.0,
|
|
424
460
|
numCells: selectedCellCount,
|
|
425
|
-
relayUrls: relayUrls.length > 0 ? relayUrls : undefined,
|
|
426
461
|
rngSeed: $state.snapshot(rngSeedInput),
|
|
427
462
|
shape: resolveShape(),
|
|
428
463
|
spikiness: $state.snapshot(spikinessInput),
|
|
@@ -439,7 +474,6 @@
|
|
|
439
474
|
terrain = generated.terrain;
|
|
440
475
|
surfaceArea = generated.surfaceArea;
|
|
441
476
|
boundsRadius = generated.boundsRadius;
|
|
442
|
-
inviteTicket = "";
|
|
443
477
|
exploredCellsSeen = new SvelteSet<number>();
|
|
444
478
|
pendingTutorialClick = undefined;
|
|
445
479
|
tutorial = isTutorialMode ? new TutorialState() : undefined;
|
|
@@ -453,71 +487,22 @@
|
|
|
453
487
|
}
|
|
454
488
|
}
|
|
455
489
|
|
|
456
|
-
function
|
|
457
|
-
const trimmed = input.trim();
|
|
458
|
-
if (!trimmed) {
|
|
459
|
-
return "";
|
|
460
|
-
}
|
|
461
|
-
if (/^https?:\/\//i.test(trimmed)) {
|
|
462
|
-
try {
|
|
463
|
-
return new URL(trimmed).searchParams.get("ticket")?.trim() ?? "";
|
|
464
|
-
} catch {
|
|
465
|
-
return "";
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return trimmed;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
async function joinGame() {
|
|
490
|
+
function joinGame() {
|
|
472
491
|
joinError = undefined;
|
|
473
|
-
|
|
492
|
+
if (!account || !competitive) {
|
|
493
|
+
joinError = m.error_login_to_join();
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
474
496
|
try {
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
options = GameState.optionsFromTicket(ticket);
|
|
483
|
-
} catch (error) {
|
|
484
|
-
console.error("Failed to parse ticket", error);
|
|
485
|
-
throw new Error(m.error_join_ticket_invalid(), { cause: error });
|
|
486
|
-
}
|
|
487
|
-
const nextGameState = new GameState(options);
|
|
488
|
-
status = m.status_generating_map();
|
|
489
|
-
const generated = await generateMap(options);
|
|
490
|
-
nextGameState.applyMapCells(generated.cells);
|
|
491
|
-
status = m.status_joining_game();
|
|
492
|
-
try {
|
|
493
|
-
await nextGameState.joinAsPeer(ticket, playerNameInput);
|
|
494
|
-
} catch (error) {
|
|
495
|
-
console.error("Failed to join peer", error);
|
|
496
|
-
try {
|
|
497
|
-
nextGameState.free();
|
|
498
|
-
} catch (freeError) {
|
|
499
|
-
console.error("Failed to release game state", freeError);
|
|
500
|
-
}
|
|
501
|
-
throw new Error(m.error_join_connect_failed(), { cause: error });
|
|
502
|
-
}
|
|
503
|
-
isFlatMap = options.shape?.kind === "flat";
|
|
504
|
-
gameState = nextGameState;
|
|
505
|
-
terrain = generated.terrain;
|
|
506
|
-
surfaceArea = generated.surfaceArea;
|
|
507
|
-
boundsRadius = generated.boundsRadius;
|
|
508
|
-
inviteTicket = "";
|
|
509
|
-
succeeded = true;
|
|
497
|
+
const input = ticketInput.trim();
|
|
498
|
+
const id = /^https?:\/\//i.test(input) ? new URL(input).searchParams.get("match") : input;
|
|
499
|
+
if (!id || !/^[a-f0-9-]{36}$/.test(id)) throw new Error(m.error_invitation_invalid());
|
|
500
|
+
invitation = id;
|
|
501
|
+
multiplayerSetup = undefined;
|
|
502
|
+
competitiveOpen = true;
|
|
503
|
+
setupMode = undefined;
|
|
510
504
|
} catch (error) {
|
|
511
|
-
|
|
512
|
-
joinError = error instanceof Error ? error.message : m.error_join_failed();
|
|
513
|
-
} finally {
|
|
514
|
-
status = undefined;
|
|
515
|
-
if (succeeded) {
|
|
516
|
-
setupMode = undefined;
|
|
517
|
-
ticketInput = "";
|
|
518
|
-
} else {
|
|
519
|
-
setupMode = "join";
|
|
520
|
-
}
|
|
505
|
+
joinError = String(error);
|
|
521
506
|
}
|
|
522
507
|
}
|
|
523
508
|
|
|
@@ -532,7 +517,6 @@
|
|
|
532
517
|
surfaceArea = 0;
|
|
533
518
|
boundsRadius = DEFAULT_RADIUS;
|
|
534
519
|
setupMode = undefined;
|
|
535
|
-
inviteTicket = "";
|
|
536
520
|
ticketInput = "";
|
|
537
521
|
joinError = undefined;
|
|
538
522
|
status = undefined;
|
|
@@ -540,38 +524,31 @@
|
|
|
540
524
|
exploredCellsSeen = new SvelteSet<number>();
|
|
541
525
|
pendingTutorialClick = undefined;
|
|
542
526
|
}
|
|
527
|
+
</script>
|
|
543
528
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
try {
|
|
549
|
-
await navigator.clipboard.writeText(inviteUrl);
|
|
550
|
-
} catch (error) {
|
|
551
|
-
console.error("Failed to copy invitation URL", error);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
529
|
+
{#if historyOpen && competitive}<GameHistory
|
|
530
|
+
config={competitive}
|
|
531
|
+
onexit={() => (historyOpen = false)}
|
|
532
|
+
/>{/if}
|
|
554
533
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
isGeneratingInvite = false;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
</script>
|
|
534
|
+
{#if competitiveOpen && competitive}
|
|
535
|
+
<MultiplayerGame
|
|
536
|
+
bind:playerName={playerNameInput}
|
|
537
|
+
config={competitive}
|
|
538
|
+
setup={multiplayerSetup}
|
|
539
|
+
{invitation}
|
|
540
|
+
onexit={() => {
|
|
541
|
+
competitiveOpen = false;
|
|
542
|
+
multiplayerSetup = undefined;
|
|
543
|
+
invitation = undefined;
|
|
544
|
+
}}
|
|
545
|
+
/>
|
|
546
|
+
{/if}
|
|
572
547
|
|
|
573
548
|
<div
|
|
574
|
-
|
|
549
|
+
data-theme="winter"
|
|
550
|
+
class="panel-wrapper fixed inset-x-0 z-20 flex justify-center bg-transparent select-none"
|
|
551
|
+
style:display={historyOpen || (competitiveOpen && competitive) ? "none" : undefined}
|
|
575
552
|
class:[&_*]:text-white={gameState}
|
|
576
553
|
class:panel-wrapper-card={!gameState}
|
|
577
554
|
class:panel-wrapper-header={gameState}
|
|
@@ -581,7 +558,7 @@
|
|
|
581
558
|
<div
|
|
582
559
|
class="panel-shell w-full"
|
|
583
560
|
class:max-w-full={gameState}
|
|
584
|
-
class:max-w-
|
|
561
|
+
class:max-w-xl={!gameState && setupMode}
|
|
585
562
|
class:max-w-xs={!gameState && !setupMode}
|
|
586
563
|
class:panel-card={!gameState}
|
|
587
564
|
class:panel-header={gameState}
|
|
@@ -599,24 +576,8 @@
|
|
|
599
576
|
</h1>
|
|
600
577
|
{#if gameState}
|
|
601
578
|
{#if $score}
|
|
602
|
-
<
|
|
603
|
-
|
|
604
|
-
role="group"
|
|
605
|
-
aria-label={m.aria_score_summary()}
|
|
606
|
-
onmouseenter={() => (isScoreBreakdownHovered = true)}
|
|
607
|
-
onmouseleave={() => (isScoreBreakdownHovered = false)}
|
|
608
|
-
>
|
|
609
|
-
<div
|
|
610
|
-
class="score-summary"
|
|
611
|
-
role="button"
|
|
612
|
-
tabindex="0"
|
|
613
|
-
aria-expanded={showScoreBreakdown}
|
|
614
|
-
aria-controls="score-breakdown"
|
|
615
|
-
onclick={toggleScoreBreakdown}
|
|
616
|
-
onfocus={() => (isScoreBreakdownHovered = true)}
|
|
617
|
-
onblur={() => (isScoreBreakdownHovered = false)}
|
|
618
|
-
onkeydown={handleScoreSummaryKeydown}
|
|
619
|
-
>
|
|
579
|
+
<ScoreSummary>
|
|
580
|
+
{#snippet summary()}
|
|
620
581
|
{m.label_score()}:
|
|
621
582
|
<strong class="text-slate-200!"
|
|
622
583
|
>{Math.round($score.score).toLocaleString(getLocale())}</strong
|
|
@@ -639,61 +600,53 @@
|
|
|
639
600
|
>
|
|
640
601
|
</span>
|
|
641
602
|
{/if}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
{m.label_streak()}</span
|
|
652
|
-
>
|
|
653
|
-
</p>
|
|
654
|
-
{/if}
|
|
655
|
-
<p class="text-emerald-600!">
|
|
656
|
-
{m.label_safe_cells_explored({
|
|
657
|
-
count: $score.safeExplored.toLocaleString(getLocale()),
|
|
658
|
-
})}:
|
|
659
|
-
<strong>{$score.safeExplored.toLocaleString(getLocale())}</strong>
|
|
660
|
-
</p>
|
|
661
|
-
<p class="text-rose-500!">
|
|
662
|
-
{m.label_voids_discovered()}:
|
|
663
|
-
<strong>{$score.voidExplored.toLocaleString(getLocale())}</strong>
|
|
603
|
+
{/snippet}
|
|
604
|
+
{#snippet breakdown()}
|
|
605
|
+
{#if $score.streak > 1}<p>
|
|
606
|
+
<span class="opacity-70"
|
|
607
|
+
>×{(1 + Math.min($score.streak, 10) * 0.1).toLocaleString(getLocale(), {
|
|
608
|
+
maximumFractionDigits: 1,
|
|
609
|
+
})}
|
|
610
|
+
{m.label_streak()}</span
|
|
611
|
+
>
|
|
664
612
|
</p>
|
|
665
|
-
</div>
|
|
666
|
-
{/if}
|
|
667
|
-
</div>
|
|
668
|
-
{/if}
|
|
669
|
-
<div class="ml-auto text-sm text-slate-200!">
|
|
670
|
-
{#if connectedPeerCount > 0}
|
|
671
|
-
{m.label_players({ count: connectedPeerCount + 1 })}:
|
|
672
|
-
<strong>{connectedPeerCount + 1}</strong>
|
|
673
|
-
{/if}
|
|
674
|
-
</div>
|
|
675
|
-
<div class="flex gap-2">
|
|
676
|
-
{#if !isTutorialMode && hasRelayServersConfigured}
|
|
677
|
-
<button
|
|
678
|
-
class="btn btn-primary"
|
|
679
|
-
type="button"
|
|
680
|
-
onclick={generateInvite}
|
|
681
|
-
disabled={isGeneratingInvite || ($score?.safeExplored ?? 0) === 0}
|
|
682
|
-
title={($score?.safeExplored ?? 0) === 0 ? m.text_invite_after_opening() : undefined}
|
|
683
|
-
>
|
|
684
|
-
{#if isGeneratingInvite}
|
|
685
|
-
<span class="spinner" aria-hidden="true"></span>
|
|
686
|
-
<span>{m.status_preparing()}</span>
|
|
687
|
-
{:else}
|
|
688
|
-
{m.action_invite()}
|
|
689
613
|
{/if}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
614
|
+
<p class="text-emerald-600!">
|
|
615
|
+
{m.label_safe_cells_explored({
|
|
616
|
+
count: $score.safeExplored.toLocaleString(getLocale()),
|
|
617
|
+
})}:
|
|
618
|
+
<strong>{$score.safeExplored.toLocaleString(getLocale())}</strong>
|
|
619
|
+
</p>
|
|
620
|
+
<p class="text-rose-500!">
|
|
621
|
+
{m.label_voids_discovered()}:
|
|
622
|
+
<strong>{$score.voidExplored.toLocaleString(getLocale())}</strong>
|
|
623
|
+
</p>
|
|
624
|
+
{/snippet}
|
|
625
|
+
</ScoreSummary>
|
|
626
|
+
{/if}
|
|
627
|
+
<div class="ml-auto flex gap-2">
|
|
628
|
+
<button class="btn btn-error" type="button" onclick={exitGame}>{m.action_exit()}</button>
|
|
693
629
|
</div>
|
|
694
630
|
{/if}
|
|
695
631
|
</div>
|
|
696
632
|
|
|
633
|
+
{#if !gameState}
|
|
634
|
+
<div class="my-3 flex flex-wrap justify-center gap-2">
|
|
635
|
+
{#if account}<button class="btn btn-secondary btn-sm" onclick={() => (historyOpen = true)}
|
|
636
|
+
>{m.action_game_history()}</button
|
|
637
|
+
><button class="btn btn-secondary btn-sm" onclick={logout}>{m.action_logout()}</button>
|
|
638
|
+
{:else}<button
|
|
639
|
+
class="btn btn-secondary btn-sm"
|
|
640
|
+
disabled={!competitive}
|
|
641
|
+
onclick={() => login()}>{m.action_login()}</button
|
|
642
|
+
><button
|
|
643
|
+
class="btn btn-secondary btn-sm"
|
|
644
|
+
disabled={!competitive}
|
|
645
|
+
onclick={() => login(true)}>{m.action_register()}</button
|
|
646
|
+
>{/if}
|
|
647
|
+
</div>
|
|
648
|
+
{#if authMessage}<p role="status" class="text-sm">{authMessage}</p>{/if}
|
|
649
|
+
{/if}
|
|
697
650
|
{#if status}
|
|
698
651
|
<p class="mt-2 text-sm text-slate-600!">{status}</p>
|
|
699
652
|
{/if}
|
|
@@ -710,190 +663,526 @@
|
|
|
710
663
|
>
|
|
711
664
|
<div class="-mx-3 mb-2 flex flex-wrap">
|
|
712
665
|
<div class="mb-4 w-full px-3">
|
|
713
|
-
<
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
<select id="shape-select" class="field" bind:value={shapeKindInput}>
|
|
719
|
-
{#each SHAPE_KINDS as kind (kind)}
|
|
720
|
-
<option value={kind}>{m.shape_label({ kind })}</option>
|
|
721
|
-
{/each}
|
|
722
|
-
</select>
|
|
723
|
-
</div>
|
|
724
|
-
<div class="mb-4 w-full px-3">
|
|
725
|
-
<span class="field-label">{m.field_map_size()}</span>
|
|
726
|
-
<div class="grid grid-cols-4 gap-2">
|
|
727
|
-
{#each presetIcons as preset (preset.value)}
|
|
666
|
+
<span class="field-label"
|
|
667
|
+
><OptionHelp label={m.field_play_mode()} help={m.help_play_mode()} /></span
|
|
668
|
+
>
|
|
669
|
+
<div class="grid grid-cols-3 gap-2">
|
|
670
|
+
{#each playModes as mode (mode.id)}
|
|
728
671
|
<button
|
|
729
672
|
type="button"
|
|
730
|
-
class="
|
|
731
|
-
class:
|
|
732
|
-
aria-pressed={
|
|
733
|
-
|
|
673
|
+
class="btn h-auto min-h-28 flex-col gap-1 py-3 font-normal disabled:bg-base-200 disabled:text-base-content/60 disabled:opacity-100"
|
|
674
|
+
class:btn-primary={playMode === mode.id}
|
|
675
|
+
aria-pressed={playMode === mode.id}
|
|
676
|
+
disabled={mode.id !== "solo" && (!account || !competitive)}
|
|
677
|
+
onclick={() => selectMode(mode.id)}
|
|
734
678
|
>
|
|
735
|
-
<span class="preset-icon"
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
<circle cx="25" cy="20" r="3.5" fill="currentColor" />
|
|
762
|
-
<line x1="8" y1="28" x2="32" y2="28" />
|
|
763
|
-
<circle cx="19" cy="28" r="3.5" fill="currentColor" />
|
|
764
|
-
</svg>
|
|
765
|
-
{/if}
|
|
766
|
-
</span>
|
|
767
|
-
<span class="preset-label">{preset.label}</span>
|
|
768
|
-
<span class="preset-count">
|
|
769
|
-
{preset.value === "custom"
|
|
770
|
-
? ""
|
|
771
|
-
: m.cells_count({ count: SIZE_PRESETS[preset.value] })}
|
|
772
|
-
</span>
|
|
679
|
+
<span class="preset-icon"
|
|
680
|
+
><svg
|
|
681
|
+
viewBox="0 0 40 40"
|
|
682
|
+
fill="none"
|
|
683
|
+
stroke="currentColor"
|
|
684
|
+
stroke-width="1.6"
|
|
685
|
+
aria-hidden="true"
|
|
686
|
+
>
|
|
687
|
+
{#if mode.id === "solo"}<circle cx="20" cy="10" r="5" /><path
|
|
688
|
+
d="M9 34v-8a11 11 0 0 1 22 0v8M15 25l5 5 5-5"
|
|
689
|
+
/>
|
|
690
|
+
{:else if mode.id === "collaborative"}<circle
|
|
691
|
+
cx="12"
|
|
692
|
+
cy="10"
|
|
693
|
+
r="4"
|
|
694
|
+
/><circle cx="28" cy="10" r="4" /><path
|
|
695
|
+
d="M5 26v-5a7 7 0 0 1 14 0v5M21 26v-5a7 7 0 0 1 14 0v5M12 29h16M20 24v10"
|
|
696
|
+
/>
|
|
697
|
+
{:else}<path
|
|
698
|
+
d="M4 5h15v13H4zM21 5h15v13H21zM4 20h15v15H4zM21 20h15v15H21zM7 14l9-6M24 31l9-7"
|
|
699
|
+
/>{/if}
|
|
700
|
+
</svg></span
|
|
701
|
+
>
|
|
702
|
+
<span class="preset-label">{mode.label()}</span><span class="text-xs"
|
|
703
|
+
>{mode.description()}</span
|
|
704
|
+
>
|
|
773
705
|
</button>
|
|
774
706
|
{/each}
|
|
775
707
|
</div>
|
|
708
|
+
{#if !account}<p class="field-help mt-2">
|
|
709
|
+
{m.text_multiplayer_login()}
|
|
710
|
+
</p>{/if}
|
|
776
711
|
</div>
|
|
777
|
-
{#if sizePreset === "custom"}
|
|
778
|
-
<div class="mb-4 w-full px-3">
|
|
779
|
-
<label class="field-label" for="size-input">{m.field_size()}</label>
|
|
780
712
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
bind:value={numCellsInput}
|
|
790
|
-
/>
|
|
791
|
-
</div>
|
|
792
|
-
{/if}
|
|
793
|
-
<p class="field-help mb-4 w-full px-3">
|
|
794
|
-
{usesFaceDensity
|
|
795
|
-
? m.text_density_summary({ faces: faceCount, count: selectedCellCount })
|
|
796
|
-
: m.cells_count({ count: selectedCellCount })}
|
|
797
|
-
</p>
|
|
798
|
-
<div class="mb-4 w-full px-3">
|
|
799
|
-
<div class="advanced-settings" class:advanced-settings-open={isAdvancedSettingsOpen}>
|
|
800
|
-
<button
|
|
801
|
-
type="button"
|
|
802
|
-
class="advanced-settings-summary w-full"
|
|
803
|
-
aria-expanded={isAdvancedSettingsOpen}
|
|
804
|
-
aria-controls="advanced-settings-content"
|
|
805
|
-
onclick={() => (isAdvancedSettingsOpen = !isAdvancedSettingsOpen)}
|
|
713
|
+
<fieldset
|
|
714
|
+
class="mx-3 mb-6 fieldset min-w-0 flex-1 rounded-lg border border-secondary px-4 pb-4"
|
|
715
|
+
transition:slide={{ duration: 180 }}
|
|
716
|
+
>
|
|
717
|
+
<legend class="fieldset-legend">{m.label_gameplay_options()}</legend>
|
|
718
|
+
{#if playMode !== "solo"}
|
|
719
|
+
<label
|
|
720
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
806
721
|
>
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
{#if isAdvancedSettingsOpen}
|
|
810
|
-
<div
|
|
811
|
-
id="advanced-settings-content"
|
|
812
|
-
class="advanced-settings-content"
|
|
813
|
-
transition:slide={{ duration: 180 }}
|
|
722
|
+
<span
|
|
723
|
+
><OptionHelp label={m.field_player_name()} help={m.help_player_name()} /></span
|
|
814
724
|
>
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
725
|
+
<input
|
|
726
|
+
class="input w-30 min-w-0 text-right input-sm"
|
|
727
|
+
type="text"
|
|
728
|
+
maxlength="32"
|
|
729
|
+
required
|
|
730
|
+
aria-label={m.field_player_name()}
|
|
731
|
+
bind:value={playerNameInput}
|
|
732
|
+
/>
|
|
733
|
+
</label>
|
|
734
|
+
{/if}
|
|
735
|
+
{#if playMode !== "solo"}
|
|
736
|
+
<div class="flex w-full items-center justify-between gap-4">
|
|
737
|
+
<label
|
|
738
|
+
class="label text-left whitespace-normal text-base-content"
|
|
739
|
+
for="match-duration"
|
|
740
|
+
><OptionHelp
|
|
741
|
+
label={m.field_match_duration()}
|
|
742
|
+
help={m.help_match_duration()}
|
|
743
|
+
/></label
|
|
744
|
+
>
|
|
745
|
+
<div class="join w-36 shrink-0">
|
|
818
746
|
<input
|
|
819
|
-
|
|
820
|
-
|
|
747
|
+
id="match-duration"
|
|
748
|
+
class="input join-item min-w-0 flex-1 text-right input-sm"
|
|
821
749
|
type="number"
|
|
750
|
+
min="1"
|
|
751
|
+
max={matchUnit === "hours" ? 24 : 1440}
|
|
752
|
+
step="1"
|
|
822
753
|
required
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
step="0.00001"
|
|
826
|
-
bind:value={voidFractionInput}
|
|
754
|
+
aria-label={m.field_match_duration()}
|
|
755
|
+
bind:value={matchDuration}
|
|
827
756
|
/>
|
|
828
|
-
<
|
|
757
|
+
<div class="relative join-item w-24 shrink-0 border-0">
|
|
758
|
+
<select
|
|
759
|
+
class="duration-unit-select select w-full rounded-l-none select-sm"
|
|
760
|
+
aria-label={m.field_duration_unit()}
|
|
761
|
+
value={matchUnit}
|
|
762
|
+
onchange={(event) => {
|
|
763
|
+
const unit = event.currentTarget.value as "minutes" | "hours";
|
|
764
|
+
const minutes = matchDuration * (matchUnit === "hours" ? 60 : 1);
|
|
765
|
+
matchDuration = Math.min(
|
|
766
|
+
unit === "hours" ? 24 : 1440,
|
|
767
|
+
Math.max(1, Math.ceil(unit === "hours" ? minutes / 60 : minutes)),
|
|
768
|
+
);
|
|
769
|
+
matchUnit = unit;
|
|
770
|
+
}}
|
|
771
|
+
><option value="minutes">{m.unit_minutes()}</option><option value="hours"
|
|
772
|
+
>{m.unit_hours()}</option
|
|
773
|
+
></select
|
|
774
|
+
>
|
|
775
|
+
<span
|
|
776
|
+
aria-hidden="true"
|
|
777
|
+
class="pointer-events-none absolute inset-y-0 left-3 flex items-center text-sm text-base-content"
|
|
778
|
+
>
|
|
779
|
+
{matchUnit === "hours"
|
|
780
|
+
? m.unit_hours_selected({ count: matchDuration ?? 0 })
|
|
781
|
+
: m.unit_minutes_selected({ count: matchDuration ?? 0 })}
|
|
782
|
+
</span>
|
|
783
|
+
</div>
|
|
784
|
+
</div>
|
|
785
|
+
</div>
|
|
786
|
+
{/if}
|
|
787
|
+
{#if playMode === "solo"}
|
|
788
|
+
<div class="flex flex-col items-start gap-2" transition:slide={{ duration: 180 }}>
|
|
789
|
+
<label
|
|
790
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
791
|
+
for="tutorial-mode"
|
|
792
|
+
>
|
|
793
|
+
<span
|
|
794
|
+
><OptionHelp
|
|
795
|
+
label={m.field_tutorial_mode()}
|
|
796
|
+
help={m.help_tutorial_mode()}
|
|
797
|
+
/></span
|
|
798
|
+
>
|
|
829
799
|
<input
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
step="0.05"
|
|
837
|
-
bind:value={spikinessInput}
|
|
800
|
+
id="tutorial-mode"
|
|
801
|
+
type="checkbox"
|
|
802
|
+
class="checkbox shrink-0 rounded-sm checkbox-sm checkbox-primary"
|
|
803
|
+
aria-label={m.field_tutorial_mode()}
|
|
804
|
+
bind:checked={isTutorialMode}
|
|
805
|
+
disabled={sizePreset === "custom"}
|
|
838
806
|
/>
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
807
|
+
</label>
|
|
808
|
+
</div>
|
|
809
|
+
{/if}
|
|
810
|
+
{#if playMode !== "solo"}
|
|
811
|
+
{#if playMode === "territory"}
|
|
812
|
+
<div class="flex flex-col items-start gap-2" transition:slide={{ duration: 180 }}>
|
|
813
|
+
<div
|
|
814
|
+
class="form-control flex w-full flex-row items-center justify-between gap-4"
|
|
815
|
+
>
|
|
816
|
+
<label
|
|
817
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
818
|
+
><span
|
|
819
|
+
><OptionHelp
|
|
820
|
+
label={m.field_bordering()}
|
|
821
|
+
help={m.help_bordering()}
|
|
822
|
+
/></span
|
|
823
|
+
><input
|
|
824
|
+
type="checkbox"
|
|
825
|
+
class="checkbox shrink-0 rounded-sm checkbox-sm checkbox-primary"
|
|
826
|
+
aria-label={m.field_bordering()}
|
|
827
|
+
bind:checked={bordering}
|
|
828
|
+
/></label
|
|
829
|
+
>
|
|
830
|
+
</div>
|
|
831
|
+
<div
|
|
832
|
+
class="form-control flex w-full flex-row items-center justify-between gap-4"
|
|
845
833
|
>
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
834
|
+
<label
|
|
835
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
836
|
+
><span
|
|
837
|
+
><OptionHelp
|
|
838
|
+
label={m.field_turn_based()}
|
|
839
|
+
help={m.help_turn_based()}
|
|
840
|
+
/></span
|
|
841
|
+
><input
|
|
842
|
+
type="checkbox"
|
|
843
|
+
class="checkbox shrink-0 rounded-sm checkbox-sm checkbox-primary"
|
|
844
|
+
aria-label={m.field_turn_based()}
|
|
845
|
+
bind:checked={turnBased}
|
|
846
|
+
/></label
|
|
847
|
+
>
|
|
848
|
+
</div>
|
|
849
|
+
</div>
|
|
850
|
+
{/if}
|
|
851
|
+
{#if playMode === "territory" && turnBased}
|
|
852
|
+
<div class="grid gap-2" transition:slide={{ duration: 180 }}>
|
|
853
|
+
<label
|
|
854
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
855
|
+
><span
|
|
856
|
+
><OptionHelp
|
|
857
|
+
label={m.field_turn_timer()}
|
|
858
|
+
help={m.help_turn_timer()}
|
|
859
|
+
/></span
|
|
860
|
+
><input
|
|
861
|
+
type="checkbox"
|
|
862
|
+
class="checkbox shrink-0 rounded-sm checkbox-sm checkbox-primary"
|
|
863
|
+
aria-label={m.field_turn_timer()}
|
|
864
|
+
bind:checked={turnTimer}
|
|
865
|
+
/></label
|
|
866
|
+
>
|
|
867
|
+
{#if turnTimer}
|
|
868
|
+
<div
|
|
869
|
+
class="flex w-full items-center justify-between gap-4"
|
|
870
|
+
transition:slide={{ duration: 180 }}
|
|
871
|
+
>
|
|
872
|
+
<label
|
|
873
|
+
class="label text-left whitespace-normal text-base-content"
|
|
874
|
+
for="turn-duration"
|
|
881
875
|
>
|
|
876
|
+
<OptionHelp
|
|
877
|
+
label={m.field_turn_duration()}
|
|
878
|
+
help={m.help_turn_duration()}
|
|
879
|
+
/>
|
|
880
|
+
</label>
|
|
881
|
+
<div class="join w-36 shrink-0">
|
|
882
|
+
<input
|
|
883
|
+
id="turn-duration"
|
|
884
|
+
class="input join-item min-w-0 flex-1 text-right input-sm"
|
|
885
|
+
type="number"
|
|
886
|
+
min="1"
|
|
887
|
+
max={turnUnit === "minutes" ? 1440 : 86400}
|
|
888
|
+
step="1"
|
|
889
|
+
required
|
|
890
|
+
aria-label={m.field_turn_duration()}
|
|
891
|
+
bind:value={turnDuration}
|
|
892
|
+
/>
|
|
893
|
+
<div class="relative join-item w-24 shrink-0 border-0">
|
|
894
|
+
<select
|
|
895
|
+
class="duration-unit-select select w-full rounded-l-none select-sm"
|
|
896
|
+
aria-label={m.field_turn_duration_unit()}
|
|
897
|
+
value={turnUnit}
|
|
898
|
+
onchange={(event) => {
|
|
899
|
+
const unit = event.currentTarget.value as "seconds" | "minutes";
|
|
900
|
+
const seconds = turnDuration * (turnUnit === "minutes" ? 60 : 1);
|
|
901
|
+
turnDuration = Math.min(
|
|
902
|
+
unit === "minutes" ? 1440 : 86400,
|
|
903
|
+
Math.max(
|
|
904
|
+
1,
|
|
905
|
+
Math.ceil(unit === "minutes" ? seconds / 60 : seconds),
|
|
906
|
+
),
|
|
907
|
+
);
|
|
908
|
+
turnUnit = unit;
|
|
909
|
+
}}
|
|
910
|
+
>
|
|
911
|
+
<option value="seconds">{m.unit_seconds()}</option>
|
|
912
|
+
<option value="minutes">{m.unit_minutes()}</option>
|
|
913
|
+
</select>
|
|
914
|
+
<span
|
|
915
|
+
aria-hidden="true"
|
|
916
|
+
class="pointer-events-none absolute inset-y-0 left-3 flex items-center text-sm text-base-content"
|
|
917
|
+
>
|
|
918
|
+
{turnUnit === "minutes"
|
|
919
|
+
? m.unit_minutes_selected({ count: turnDuration ?? 0 })
|
|
920
|
+
: m.unit_seconds_selected({ count: turnDuration ?? 0 })}
|
|
921
|
+
</span>
|
|
922
|
+
</div>
|
|
923
|
+
</div>
|
|
882
924
|
</div>
|
|
883
|
-
|
|
925
|
+
{/if}
|
|
884
926
|
</div>
|
|
885
927
|
{/if}
|
|
928
|
+
<div class="form-control flex w-full flex-row items-center justify-between gap-4">
|
|
929
|
+
<label
|
|
930
|
+
class="label text-left whitespace-normal text-base-content"
|
|
931
|
+
for="flood-limit"
|
|
932
|
+
><OptionHelp label={m.field_flood_limit()} help={m.help_flood_limit()} /></label
|
|
933
|
+
>
|
|
934
|
+
<div class="join w-24 shrink-0" role="group" aria-label={m.field_flood_limit()}>
|
|
935
|
+
<input
|
|
936
|
+
id="flood-limit"
|
|
937
|
+
class="input join-item min-w-0 flex-1 text-right input-sm focus:outline-none"
|
|
938
|
+
aria-label={m.field_flood_cells()}
|
|
939
|
+
type="number"
|
|
940
|
+
min={infiniteFlood ? undefined : 0}
|
|
941
|
+
max={infiniteFlood ? undefined : 4096}
|
|
942
|
+
step="1"
|
|
943
|
+
required={!infiniteFlood}
|
|
944
|
+
class:input-ghost={infiniteFlood}
|
|
945
|
+
class:border-base-300={infiniteFlood}
|
|
946
|
+
class:border-2={!infiniteFlood}
|
|
947
|
+
class:input-primary={!infiniteFlood}
|
|
948
|
+
bind:value={floodLimit}
|
|
949
|
+
onclick={() => (infiniteFlood = false)}
|
|
950
|
+
/>
|
|
951
|
+
<button
|
|
952
|
+
type="button"
|
|
953
|
+
class="btn join-item btn-sm"
|
|
954
|
+
class:btn-primary={infiniteFlood}
|
|
955
|
+
class:btn-outline={!infiniteFlood}
|
|
956
|
+
class:border-base-300={!infiniteFlood}
|
|
957
|
+
aria-label={m.field_infinite_flood()}
|
|
958
|
+
aria-pressed={infiniteFlood}
|
|
959
|
+
onclick={() => (infiniteFlood = true)}
|
|
960
|
+
><span aria-hidden="true" class="text-xl">∞</span></button
|
|
961
|
+
>
|
|
962
|
+
</div>
|
|
963
|
+
</div>
|
|
964
|
+
{/if}
|
|
965
|
+
</fieldset>
|
|
966
|
+
<div class="mb-4 w-full px-3" role="group" aria-label={m.field_map()}>
|
|
967
|
+
<span id="map-label" class="field-label"
|
|
968
|
+
><OptionHelp label={m.field_map()} help={m.help_map()} /></span
|
|
969
|
+
>
|
|
970
|
+
<div class="grid grid-cols-2 gap-2 sm:grid-cols-4">
|
|
971
|
+
{#each SHAPE_KINDS as kind (kind)}
|
|
972
|
+
<button
|
|
973
|
+
type="button"
|
|
974
|
+
class="btn h-auto min-h-28 min-w-0 flex-col gap-2 px-2 py-3 font-normal"
|
|
975
|
+
class:btn-primary={shapeKindInput === kind}
|
|
976
|
+
aria-pressed={shapeKindInput === kind}
|
|
977
|
+
onclick={() => (shapeKindInput = kind)}
|
|
978
|
+
>
|
|
979
|
+
<span class="preset-icon"><MapIcon {kind} /></span>
|
|
980
|
+
<span class="text-xs whitespace-normal">{m.shape_label({ kind })}</span>
|
|
981
|
+
</button>
|
|
982
|
+
{/each}
|
|
886
983
|
</div>
|
|
887
984
|
</div>
|
|
888
|
-
<
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
985
|
+
<fieldset
|
|
986
|
+
class="mx-3 mb-6 fieldset w-full min-w-0 rounded-lg border border-secondary px-3"
|
|
987
|
+
transition:slide={{ duration: 180 }}
|
|
988
|
+
>
|
|
989
|
+
<legend class="fieldset-legend">{m.label_map_options()}</legend>
|
|
990
|
+
<div class="w-full">
|
|
991
|
+
<span class="field-label"
|
|
992
|
+
><OptionHelp label={m.field_map_size()} help={m.help_map_size()} /></span
|
|
993
|
+
>
|
|
994
|
+
<div class="grid grid-cols-4 gap-2">
|
|
995
|
+
{#each presetIcons as preset (preset.value)}
|
|
996
|
+
<button
|
|
997
|
+
type="button"
|
|
998
|
+
class="btn h-auto min-h-24 flex-col gap-1 py-3 font-normal"
|
|
999
|
+
class:btn-primary={sizePreset === preset.value}
|
|
1000
|
+
disabled={playMode !== "solo" && preset.value === "custom"}
|
|
1001
|
+
aria-pressed={sizePreset === preset.value}
|
|
1002
|
+
onclick={() => (sizePreset = preset.value)}
|
|
1003
|
+
>
|
|
1004
|
+
<span class="preset-icon">
|
|
1005
|
+
{#if preset.cells}
|
|
1006
|
+
<svg
|
|
1007
|
+
viewBox="0 0 40 40"
|
|
1008
|
+
fill="none"
|
|
1009
|
+
stroke="currentColor"
|
|
1010
|
+
stroke-width="1"
|
|
1011
|
+
stroke-linejoin="round"
|
|
1012
|
+
aria-hidden="true"
|
|
1013
|
+
>
|
|
1014
|
+
{#each preset.cells as points, i (i)}
|
|
1015
|
+
<polygon {points} />
|
|
1016
|
+
{/each}
|
|
1017
|
+
</svg>
|
|
1018
|
+
{:else}
|
|
1019
|
+
<svg
|
|
1020
|
+
viewBox="0 0 40 40"
|
|
1021
|
+
fill="none"
|
|
1022
|
+
stroke="currentColor"
|
|
1023
|
+
stroke-width="2"
|
|
1024
|
+
stroke-linecap="round"
|
|
1025
|
+
aria-hidden="true"
|
|
1026
|
+
>
|
|
1027
|
+
<line x1="8" y1="10" x2="32" y2="10" />
|
|
1028
|
+
<circle cx="15" cy="10" r="1.5" fill="currentColor" />
|
|
1029
|
+
<line x1="8" y1="20" x2="32" y2="20" />
|
|
1030
|
+
<circle cx="25" cy="20" r="1.5" fill="currentColor" />
|
|
1031
|
+
<line x1="8" y1="30" x2="32" y2="30" />
|
|
1032
|
+
<circle cx="19" cy="30" r="1.5" fill="currentColor" />
|
|
1033
|
+
</svg>
|
|
1034
|
+
{/if}
|
|
1035
|
+
</span>
|
|
1036
|
+
<span class="preset-label">{preset.label}</span>
|
|
1037
|
+
<span class="preset-count">
|
|
1038
|
+
{preset.value === "custom"
|
|
1039
|
+
? ""
|
|
1040
|
+
: m.cells_count({ count: SIZE_PRESETS[preset.value] })}
|
|
1041
|
+
</span>
|
|
1042
|
+
</button>
|
|
1043
|
+
{/each}
|
|
1044
|
+
</div>
|
|
1045
|
+
</div>
|
|
1046
|
+
{#if sizePreset === "custom"}
|
|
1047
|
+
<fieldset
|
|
1048
|
+
class="fieldset w-full min-w-0 rounded-lg border border-secondary px-3 pb-4"
|
|
1049
|
+
transition:slide={{ duration: 180 }}
|
|
1050
|
+
>
|
|
1051
|
+
<legend class="fieldset-legend">{m.label_custom_map_options()}</legend>
|
|
1052
|
+
<div class="form-control flex w-full flex-row items-center justify-between gap-4">
|
|
1053
|
+
<label
|
|
1054
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
1055
|
+
for="size-input"
|
|
1056
|
+
><OptionHelp label={m.field_size()} help={m.help_size()} />
|
|
1057
|
+
<input
|
|
1058
|
+
class="input w-32 input-sm"
|
|
1059
|
+
id="size-input"
|
|
1060
|
+
type="number"
|
|
1061
|
+
required
|
|
1062
|
+
min="32"
|
|
1063
|
+
max="5000"
|
|
1064
|
+
step="1"
|
|
1065
|
+
aria-label={m.field_size()}
|
|
1066
|
+
bind:value={numCellsInput}
|
|
1067
|
+
/>
|
|
1068
|
+
</label>
|
|
1069
|
+
</div>
|
|
1070
|
+
</fieldset>
|
|
1071
|
+
{/if}
|
|
1072
|
+
<div class="field-help my-4 w-full px-3">
|
|
1073
|
+
{usesFaceDensity
|
|
1074
|
+
? m.text_density_summary({ faces: faceCount, count: selectedCellCount })
|
|
1075
|
+
: m.cells_count({ count: selectedCellCount })}
|
|
1076
|
+
</div>
|
|
1077
|
+
</fieldset>
|
|
1078
|
+
{#if playMode === "solo"}
|
|
1079
|
+
<fieldset class="mb-4 fieldset w-full px-3" transition:slide={{ duration: 180 }}>
|
|
1080
|
+
<div
|
|
1081
|
+
class="advanced-settings"
|
|
1082
|
+
class:advanced-settings-open={isAdvancedSettingsOpen}
|
|
1083
|
+
>
|
|
1084
|
+
<button
|
|
1085
|
+
type="button"
|
|
1086
|
+
class="advanced-settings-summary w-full"
|
|
1087
|
+
aria-expanded={isAdvancedSettingsOpen}
|
|
1088
|
+
aria-controls="advanced-settings-content"
|
|
1089
|
+
onclick={() => (isAdvancedSettingsOpen = !isAdvancedSettingsOpen)}
|
|
1090
|
+
>
|
|
1091
|
+
{m.label_advanced_settings()}
|
|
1092
|
+
</button>
|
|
1093
|
+
{#if isAdvancedSettingsOpen}
|
|
1094
|
+
<div
|
|
1095
|
+
id="advanced-settings-content"
|
|
1096
|
+
class="advanced-settings-content"
|
|
1097
|
+
transition:slide={{ duration: 180 }}
|
|
1098
|
+
>
|
|
1099
|
+
<div
|
|
1100
|
+
class="form-control flex w-full flex-row items-center justify-between gap-4"
|
|
1101
|
+
>
|
|
1102
|
+
<label
|
|
1103
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
1104
|
+
><span
|
|
1105
|
+
><OptionHelp
|
|
1106
|
+
label={m.field_void_fraction()}
|
|
1107
|
+
help={m.help_void_fraction()}
|
|
1108
|
+
/></span
|
|
1109
|
+
><input
|
|
1110
|
+
class="input w-24 text-right input-sm"
|
|
1111
|
+
max="0.999"
|
|
1112
|
+
min="0"
|
|
1113
|
+
required
|
|
1114
|
+
step="0.00001"
|
|
1115
|
+
type="number"
|
|
1116
|
+
aria-label={m.field_void_fraction()}
|
|
1117
|
+
bind:value={voidFractionInput}
|
|
1118
|
+
/></label
|
|
1119
|
+
>
|
|
1120
|
+
</div>
|
|
1121
|
+
<div
|
|
1122
|
+
class="form-control flex w-full flex-row items-center justify-between gap-4"
|
|
1123
|
+
>
|
|
1124
|
+
<label
|
|
1125
|
+
class="label w-full justify-between gap-4 text-left whitespace-normal text-base-content"
|
|
1126
|
+
><span
|
|
1127
|
+
><OptionHelp
|
|
1128
|
+
label={m.field_spikiness()}
|
|
1129
|
+
help={m.help_spikiness()}
|
|
1130
|
+
/></span
|
|
1131
|
+
><input
|
|
1132
|
+
class="input w-16 text-right input-sm"
|
|
1133
|
+
max="1"
|
|
1134
|
+
min="0"
|
|
1135
|
+
required
|
|
1136
|
+
step="0.05"
|
|
1137
|
+
type="number"
|
|
1138
|
+
aria-label={m.field_spikiness()}
|
|
1139
|
+
bind:value={spikinessInput}
|
|
1140
|
+
/></label
|
|
1141
|
+
>
|
|
1142
|
+
</div>
|
|
1143
|
+
<div
|
|
1144
|
+
class="form-control flex w-full flex-row items-center justify-between gap-4"
|
|
1145
|
+
>
|
|
1146
|
+
<label
|
|
1147
|
+
class="label text-left whitespace-normal text-base-content"
|
|
1148
|
+
for="rng-seed-input"
|
|
1149
|
+
><OptionHelp label={m.field_seed()} help={m.help_seed()} /></label
|
|
1150
|
+
>
|
|
1151
|
+
<div class="join w-48 shrink-0" role="group" aria-label={m.field_seed()}>
|
|
1152
|
+
<input
|
|
1153
|
+
id="rng-seed-input"
|
|
1154
|
+
class="input join-item min-w-0 flex-1 text-right input-sm focus:outline-none"
|
|
1155
|
+
type="number"
|
|
1156
|
+
min="0"
|
|
1157
|
+
max={Number.MAX_SAFE_INTEGER}
|
|
1158
|
+
step="1"
|
|
1159
|
+
required
|
|
1160
|
+
class:input-ghost={randomSeed}
|
|
1161
|
+
class:border-base-300={randomSeed}
|
|
1162
|
+
class:border-2={!randomSeed}
|
|
1163
|
+
class:input-primary={!randomSeed}
|
|
1164
|
+
aria-label={m.field_seed()}
|
|
1165
|
+
bind:value={rngSeedInput}
|
|
1166
|
+
onclick={() => (randomSeed = false)}
|
|
1167
|
+
/>
|
|
1168
|
+
<button
|
|
1169
|
+
aria-label={m.action_random()}
|
|
1170
|
+
aria-pressed={randomSeed}
|
|
1171
|
+
class="btn join-item btn-sm"
|
|
1172
|
+
class:border-base-300={!randomSeed}
|
|
1173
|
+
class:btn-outline={!randomSeed}
|
|
1174
|
+
class:btn-primary={randomSeed}
|
|
1175
|
+
onclick={() => (randomSeed = true)}
|
|
1176
|
+
title={m.action_random()}
|
|
1177
|
+
type="button"><span aria-hidden="true" class="text-xl">⚄</span></button
|
|
1178
|
+
>
|
|
1179
|
+
</div>
|
|
1180
|
+
</div>
|
|
1181
|
+
</div>
|
|
1182
|
+
{/if}
|
|
1183
|
+
</div>
|
|
1184
|
+
</fieldset>
|
|
1185
|
+
{/if}
|
|
897
1186
|
</div>
|
|
898
1187
|
<div class="flex flex-wrap justify-center gap-2">
|
|
899
1188
|
<button class="btn btn-secondary" type="button" onclick={() => (setupMode = undefined)}>
|
|
@@ -912,16 +1201,12 @@
|
|
|
912
1201
|
}}
|
|
913
1202
|
>
|
|
914
1203
|
<div class="-mx-3 mb-2 flex flex-wrap">
|
|
915
|
-
<div class="mb-6 w-full px-3 md:mb-0">
|
|
916
|
-
<label class="field-label" for="join-player-name">{m.field_player_name()}</label>
|
|
917
|
-
<input class="field" id="join-player-name" type="text" bind:value={playerNameInput} />
|
|
918
|
-
</div>
|
|
919
1204
|
<div class="mb-6 w-full px-3 md:mb-0">
|
|
920
1205
|
<label class="field-label" for="ticket-input"
|
|
921
1206
|
>{m.field_ticket_or_invitation_url()}</label
|
|
922
1207
|
>
|
|
923
1208
|
<input
|
|
924
|
-
class="
|
|
1209
|
+
class="input mb-3 w-full input-sm"
|
|
925
1210
|
id="ticket-input"
|
|
926
1211
|
type="text"
|
|
927
1212
|
bind:value={ticketInput}
|
|
@@ -945,7 +1230,9 @@
|
|
|
945
1230
|
>
|
|
946
1231
|
{m.action_back()}
|
|
947
1232
|
</button>
|
|
948
|
-
<button class="btn btn-primary" type="submit"
|
|
1233
|
+
<button class="btn btn-primary" type="submit" disabled={!account || !competitive}
|
|
1234
|
+
>{m.action_join()}</button
|
|
1235
|
+
>
|
|
949
1236
|
</div>
|
|
950
1237
|
</form>
|
|
951
1238
|
{:else}
|
|
@@ -953,17 +1240,22 @@
|
|
|
953
1240
|
<button class="btn btn-primary" type="button" onclick={() => (setupMode = "host")}>
|
|
954
1241
|
{m.action_new_game()}
|
|
955
1242
|
</button>
|
|
956
|
-
<button
|
|
1243
|
+
<button
|
|
1244
|
+
class="btn btn-primary"
|
|
1245
|
+
type="button"
|
|
1246
|
+
disabled={!account || !competitive}
|
|
1247
|
+
onclick={() => (setupMode = "join")}
|
|
1248
|
+
>
|
|
957
1249
|
{m.action_join_game()}
|
|
958
1250
|
</button>
|
|
959
1251
|
</div>
|
|
960
1252
|
<div class="mt-4 flex justify-center" transition:slide={{ duration: 180 }}>
|
|
961
|
-
<label class="sr-only" for="language-select">
|
|
1253
|
+
<label class="sr-only" for="language-select">{m.field_language()}</label>
|
|
962
1254
|
<select
|
|
963
1255
|
id="language-select"
|
|
964
|
-
class="
|
|
1256
|
+
class="select w-40 select-sm"
|
|
965
1257
|
value={getLocale()}
|
|
966
|
-
aria-label=
|
|
1258
|
+
aria-label={m.field_language()}
|
|
967
1259
|
onchange={(event) => {
|
|
968
1260
|
setLocale((event.currentTarget as HTMLSelectElement).value as Locale);
|
|
969
1261
|
}}
|
|
@@ -976,32 +1268,6 @@
|
|
|
976
1268
|
</select>
|
|
977
1269
|
</div>
|
|
978
1270
|
{/if}
|
|
979
|
-
{:else if inviteTicket}
|
|
980
|
-
<div class="mt-3" transition:slide={{ duration: 200 }}>
|
|
981
|
-
<div class="mb-2 flex items-center justify-between gap-2">
|
|
982
|
-
<label class="field-label mb-0" for="invite-ticket">{m.field_invitation_url()}</label>
|
|
983
|
-
<button
|
|
984
|
-
class="icon-btn"
|
|
985
|
-
type="button"
|
|
986
|
-
aria-label={m.aria_close_invitation()}
|
|
987
|
-
onclick={() => (inviteTicket = "")}
|
|
988
|
-
>
|
|
989
|
-
×
|
|
990
|
-
</button>
|
|
991
|
-
</div>
|
|
992
|
-
<div class="flex items-stretch gap-2">
|
|
993
|
-
<input
|
|
994
|
-
id="invite-ticket"
|
|
995
|
-
class="field mb-0 flex-1"
|
|
996
|
-
type="text"
|
|
997
|
-
readonly
|
|
998
|
-
value={inviteUrl}
|
|
999
|
-
/>
|
|
1000
|
-
<button class="btn btn-secondary" type="button" onclick={copyInviteTicket}>
|
|
1001
|
-
{m.action_copy()}
|
|
1002
|
-
</button>
|
|
1003
|
-
</div>
|
|
1004
|
-
</div>
|
|
1005
1271
|
{/if}
|
|
1006
1272
|
</div>
|
|
1007
1273
|
</div>
|
|
@@ -1025,7 +1291,7 @@
|
|
|
1025
1291
|
/>
|
|
1026
1292
|
<Board
|
|
1027
1293
|
flat={isFlatMap}
|
|
1028
|
-
|
|
1294
|
+
{gameState}
|
|
1029
1295
|
{terrain}
|
|
1030
1296
|
{surfaceArea}
|
|
1031
1297
|
interactive={tutorial?.isExplorationAllowed ?? true}
|
|
@@ -1060,3 +1326,22 @@
|
|
|
1060
1326
|
</div>
|
|
1061
1327
|
</div>
|
|
1062
1328
|
{/if}
|
|
1329
|
+
|
|
1330
|
+
<style>
|
|
1331
|
+
.duration-unit-select {
|
|
1332
|
+
/* Hide only the native selected text; DaisyUI's arrow uses currentColor. */
|
|
1333
|
+
text-indent: -9999px;
|
|
1334
|
+
color: var(--color-base-content);
|
|
1335
|
+
outline: none;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
.duration-unit-select:focus-visible {
|
|
1339
|
+
outline: 2px solid var(--color-primary);
|
|
1340
|
+
outline-offset: 2px;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
.duration-unit-select option,
|
|
1344
|
+
.duration-unit-select::picker(select) {
|
|
1345
|
+
text-indent: 0;
|
|
1346
|
+
}
|
|
1347
|
+
</style>
|