diff --git a/supabase-ui/basic/button/default/default_button.gd b/supabase-ui/basic/button/default/default_button.gd index 76c0179..8066868 100644 --- a/supabase-ui/basic/button/default/default_button.gd +++ b/supabase-ui/basic/button/default/default_button.gd @@ -224,14 +224,15 @@ func set_font_size(_size : int) -> void: func _gui_input(event : InputEvent): if disabled: return if event is InputEventMouseButton: - if event.pressed: - pressing = true - _pressed() - emit_signal("pressed") - else: - pressing = false - _released() - emit_signal("released") + if event.get_button_index() == 1: + if event.pressed: + pressing = true + _pressed() + emit_signal("pressed") + else: + pressing = false + _released() + emit_signal("released") func _pressed() -> void: $Tween.stop_all() diff --git a/supabase-ui/basic/button/text/TextButton.tscn b/supabase-ui/basic/button/text/TextButton.tscn index 4207a50..28d2f64 100644 --- a/supabase-ui/basic/button/text/TextButton.tscn +++ b/supabase-ui/basic/button/text/TextButton.tscn @@ -9,8 +9,8 @@ size = 17 font_data = ExtResource( 2 ) [node name="TextButton" type="PanelContainer"] -margin_right = 26.0 -margin_bottom = 18.0 +margin_right = 101.0 +margin_bottom = 31.0 mouse_default_cursor_shape = 2 custom_styles/panel = ExtResource( 3 ) script = ExtResource( 1 ) diff --git a/supabase-ui/basic/containers/panel/Panel.tscn b/supabase-ui/basic/containers/panel/Panel.tscn index 510dbe0..b126d9b 100644 --- a/supabase-ui/basic/containers/panel/Panel.tscn +++ b/supabase-ui/basic/containers/panel/Panel.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://supabase-ui/basic/containers/panel/panel.gd" type="Script" id=9] +[ext_resource path="res://supabase-ui/basic/containers/panel/panel.gd" type="Script" id=1] [sub_resource type="StyleBoxFlat" id=1] resource_local_to_scene = true @@ -26,7 +26,7 @@ mouse_filter = 2 size_flags_horizontal = 0 size_flags_vertical = 0 custom_styles/panel = SubResource( 1 ) -script = ExtResource( 9 ) +script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } diff --git a/supabase-ui/basic/containers/panel/_panel.gd b/supabase-ui/basic/containers/panel/_panel.gd index 1b1e960..578e034 100644 --- a/supabase-ui/basic/containers/panel/_panel.gd +++ b/supabase-ui/basic/containers/panel/_panel.gd @@ -23,5 +23,6 @@ func _force_resize() : func _on_Panel_gui_input(event): - if event.is_pressed(): - emit_signal("pressed") + if event is InputEventMouseButton: + if event.get_button_index() == 1 and event.is_pressed(): + emit_signal("pressed") diff --git a/supabase-ui/basic/containers/panel/panel.gd b/supabase-ui/basic/containers/panel/panel.gd index 254e7f1..7857d9a 100644 --- a/supabase-ui/basic/containers/panel/panel.gd +++ b/supabase-ui/basic/containers/panel/panel.gd @@ -1,17 +1,3 @@ extends SPanel -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - diff --git a/supabase-ui/basic/containers/popup/Popup.tscn b/supabase-ui/basic/containers/popup/Popup.tscn new file mode 100644 index 0000000..0fd26a8 --- /dev/null +++ b/supabase-ui/basic/containers/popup/Popup.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://supabase-ui/basic/containers/popup/popup.gd" type="Script" id=1] + +[sub_resource type="StyleBoxFlat" id=1] +resource_local_to_scene = true +content_margin_left = 20.0 +content_margin_right = 20.0 +content_margin_top = 20.0 +content_margin_bottom = 20.0 +bg_color = Color( 0.164706, 0.164706, 0.164706, 1 ) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 +corner_detail = 20 + +[node name="Popup" type="PopupPanel"] +margin_right = 40.0 +margin_bottom = 40.0 +mouse_filter = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +custom_styles/panel = SubResource( 1 ) +script = ExtResource( 1 ) diff --git a/supabase-ui/basic/containers/popup/_popup.gd b/supabase-ui/basic/containers/popup/_popup.gd new file mode 100644 index 0000000..0ca436c --- /dev/null +++ b/supabase-ui/basic/containers/popup/_popup.gd @@ -0,0 +1,28 @@ +tool +class_name SPopup +extends PopupPanel + +signal pressed() + +const colors : Dictionary = { + "panel" : [Color.white, Color("#2a2a2a")] + } + +export (int, "Light Mode", "Dark Mode") var mode : int = 0 setget set_mode + +func _ready(): + add_to_group("supabase_components") + +func set_mode(_mode : int) : + mode = _mode + get("custom_styles/panel").set("bg_color", colors.panel[mode]) + +func _force_resize() : + hide() + show() + + +func _on_Panel_gui_input(event): + if event is InputEventMouseButton: + if event.get_button_index() == 1 and event.is_pressed(): + emit_signal("pressed") diff --git a/supabase-ui/basic/containers/popup/popup.gd b/supabase-ui/basic/containers/popup/popup.gd new file mode 100644 index 0000000..d7964d1 --- /dev/null +++ b/supabase-ui/basic/containers/popup/popup.gd @@ -0,0 +1 @@ +extends SPopup diff --git a/supabase-ui/components/auth/Auth.tscn b/supabase-ui/components/auth/Auth.tscn index f30e8dd..bc4dad1 100644 --- a/supabase-ui/components/auth/Auth.tscn +++ b/supabase-ui/components/auth/Auth.tscn @@ -249,6 +249,7 @@ margin_right = 146.0 margin_bottom = 31.0 size_flags_horizontal = 6 custom_fonts/font = SubResource( 2 ) +custom_colors/font_color = Color( 0.121569, 0.121569, 0.121569, 1 ) level = 2 font_size = 25 @@ -274,7 +275,7 @@ icon_enabled = true texture = ExtResource( 2 ) expand = null size = Vector2( 24, 24 ) -text = "user+supaadmin@user.mail" +text = "" placeholder = "" secret = false show_name = true @@ -343,7 +344,6 @@ custom_styles/normal = SubResource( 10 ) custom_colors/selection_color = Color( 0.145098, 0.376471, 1, 1 ) custom_colors/font_color_selected = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 ) -text = "user+supaadmin@user.mail" [node name="Description" type="Label" parent="Container/SignIn/EmailAddress/Container"] visible = false @@ -365,7 +365,6 @@ theme = SubResource( 11 ) custom_styles/panel = SubResource( 12 ) icon_enabled = true texture = ExtResource( 3 ) -text = "usermail" secret = true input_name = "Password" @@ -378,6 +377,7 @@ margin_bottom = 248.0 margin_right = 131.0 theme = SubResource( 14 ) text = "Remember Me" +pressed = false [node name="ForgotPassword" parent="Container/SignIn/HBoxContainer" instance=ExtResource( 5 )] margin_left = 135.0 @@ -522,6 +522,7 @@ margin_bottom = 264.0 margin_right = 131.0 theme = SubResource( 22 ) text = "Remember Me" +pressed = false [node name="HSeparator" type="HSeparator" parent="Container/SignUp"] margin_top = 274.0 diff --git a/supabase-ui/components/auth/auth.gd b/supabase-ui/components/auth/auth.gd index 7c37ceb..2493a7e 100644 --- a/supabase-ui/components/auth/auth.gd +++ b/supabase-ui/components/auth/auth.gd @@ -28,12 +28,14 @@ export (int, "Light Mode", "Dark Mode") var mode : int = 0 setget set_mode var remember_me : bool = false func _load_boxes(): + sign_in_box.show() sign_up_box.hide() forgot_password_box.hide() with_magic_link_box.hide() func load_user() -> void: + if Engine.editor_hint: return var file : File = File.new() var err := file.open_encrypted_with_pass("user://user.data", File.READ, OS.get_unique_id()) if err != OK: @@ -47,8 +49,7 @@ func load_user() -> void: file.close() func save_user() -> void: - if not remember_me: - return + if not remember_me: return var file : File = File.new() var err := file.open_encrypted_with_pass("user://user.data", File.WRITE, OS.get_unique_id()) if err != OK: @@ -64,7 +65,7 @@ func save_user() -> void: func _ready(): add_to_group("supabase_components") - _load_boxes() + _load_boxes() load_user() yield(Supabase, "ready") Supabase.auth.connect("error", self, "_on_auth_error") diff --git a/supabase-ui/data_input/checkbox/checkbox.gd b/supabase-ui/data_input/checkbox/checkbox.gd index 82ae728..bbe2280 100644 --- a/supabase-ui/data_input/checkbox/checkbox.gd +++ b/supabase-ui/data_input/checkbox/checkbox.gd @@ -21,7 +21,7 @@ var font_size : int = 15 setget set_font_size var text : String = "" setget set_text var description : String = "Description" setget set_description var show_description : bool = false setget set_show_description - +var pressed : bool = false setget set_pressed var pressing : bool = false var property_list : Array = [ @@ -42,6 +42,11 @@ var property_list : Array = [ "name": "text", "type": TYPE_STRING }, + { + "usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE, + "name": "pressed", + "type": TYPE_BOOL + }, { "usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE, "name": "show_description", @@ -77,7 +82,7 @@ func _ready(): _load_defaults() set_mode(mode) set_text(text) - + set_pressed(pressed) add_to_group("supabase_components") func set_text(_text : String) -> void: @@ -85,6 +90,11 @@ func set_text(_text : String) -> void: if has_node("CheckboxContainer/Text"): get_node("CheckboxContainer/Text").set_text(_text) +func set_pressed(_pressed : bool) -> void: + pressed = _pressed + if has_node("CheckboxContainer/CheckBox"): + get_node("CheckboxContainer/CheckBox").pressed = pressed + func get_text() -> String: return $CheckboxContainer/Text.get_text() diff --git a/supabase-ui/data_input/input/input.gd b/supabase-ui/data_input/input/input.gd index 6ab2268..0300d7b 100644 --- a/supabase-ui/data_input/input/input.gd +++ b/supabase-ui/data_input/input/input.gd @@ -299,5 +299,6 @@ func clear(): func _on_Text_gui_input(event): - if event.is_pressed(): - emit_signal("pressed") + if event is InputEventMouseButton: + if event.get_button_index() == 1 and event.is_pressed(): + emit_signal("pressed")