diff --git a/.gitmodules b/.gitmodules index 14608b3..5fbd823 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "external/slint"] path = external/slint url = https://github.com/slint-ui/slint +[submodule "external/selenite"] + path = external/selenite + url = https://codeberg.org/vyn/selenite.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 772d76e..4474499 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ target_link_libraries(mirai PRIVATE mirai-core) slint_target_sources( mirai ui/appwindow.slint NAMESPACE ui - LIBRARY_PATHS vynui=${CMAKE_CURRENT_SOURCE_DIR}/external/slint-vynui/index.slint + LIBRARY_PATHS selenite=${CMAKE_CURRENT_SOURCE_DIR}/external/selenite/index.slint ) # On Windows, copy the Slint DLL next to the application binary so that it's found. diff --git a/external/selenite b/external/selenite new file mode 160000 index 0000000..1774720 --- /dev/null +++ b/external/selenite @@ -0,0 +1 @@ +Subproject commit 1774720377afc932cb92303516e049f66d8bf7a0 diff --git a/external/slint-vynui/ActionButton.slint b/external/slint-vynui/ActionButton.slint deleted file mode 100644 index c763c27..0000000 --- a/external/slint-vynui/ActionButton.slint +++ /dev/null @@ -1,50 +0,0 @@ -import { Palette } from "Palette.slint"; -import { VText } from "Text.slint"; - -export component VActionButton inherits Rectangle { - - in property icon-source; - in property icon-colorize: Palette.foreground; - in property icon-size: 1rem; - in property icon-svg; - in property icon-svg-stroke-width: 2px; - in property enabled <=> ta.enabled; - callback clicked; - - private property active: false; - - background: enabled ? Palette.control-background : Palette.control-background.darker(0.2); - border-radius: 4px; - - ta := TouchArea { - mouse-cursor: pointer; - clicked => { - active = !active; - root.clicked(); - } - } - - HorizontalLayout { - alignment: center; - spacing: 8px; - padding: 8px; - if root.icon-svg != "" : VerticalLayout { - alignment: center; - Path { - padding: 8px; - commands: root.icon-svg; - stroke: icon-colorize; - stroke-width: icon-svg-stroke-width; - width: icon-size; - height: icon-size; - fill: icon-colorize; - } - } - if root.icon-source.width != 0 : Image { - padding: 8px; - source: icon-source; - colorize: icon-colorize; - width: icon-size; - } - } -} diff --git a/external/slint-vynui/Button.slint b/external/slint-vynui/Button.slint deleted file mode 100644 index 1610c8d..0000000 --- a/external/slint-vynui/Button.slint +++ /dev/null @@ -1,61 +0,0 @@ -import { Palette } from "Palette.slint"; -import { VText } from "Text.slint"; - -export component VButton inherits Rectangle { - - in property text; - in property text-color: Palette.foreground; - in property text-size: 1rem; - in property icon-source; - in property icon-colorize: Palette.foreground; - in property icon-size: 1rem; - in property icon-svg; - in property enabled <=> ta.enabled; - callback clicked; - - private property active: false; - - background: enabled ? Palette.control-background : Palette.control-background.darker(0.2); - border-radius: 4px; - - ta := TouchArea { - mouse-cursor: pointer; - clicked => { - active = !active; - root.clicked(); - } - } - - HorizontalLayout { - alignment: center; - spacing: 8px; - padding: 16px; - padding-top: 4px; - padding-bottom: 4px; - if root.icon-svg != "" : VerticalLayout { - alignment: center; - Path { - padding: 8px; - commands: root.icon-svg; - stroke: icon-colorize; - stroke-width: 2px; - width: icon-size; - height: icon-size; - } - } - if root.icon-source.width != 0 : Image { - padding: 8px; - source: icon-source; - colorize: icon-colorize; - width: icon-size; - } - if root.text != "" : VerticalLayout { - VText { - text: root.text; - font-size: root.text-size; - color: root.text-color; - horizontal-alignment: center; - } - } - } -} diff --git a/external/slint-vynui/CheckBox.slint b/external/slint-vynui/CheckBox.slint deleted file mode 100644 index a1f98c1..0000000 --- a/external/slint-vynui/CheckBox.slint +++ /dev/null @@ -1,42 +0,0 @@ -import { VLabeledComponent } from "LabeledComponent.slint"; -import { VText } from "Text.slint"; -import { Palette } from "Palette.slint"; - -export component VCheckBox { - in-out property text; - in property color <=> textComponent.color; - in-out property checked: false; - - callback toggled(bool); // toggled(state: bool) - - HorizontalLayout { - spacing: 8px; - VerticalLayout { - alignment: center; - if checked : Rectangle { - background: Palette.accent; - height: 1rem; - width: self.height; - border-radius: 32px; - } - if !checked : Rectangle { - border-color: Palette.accent; - border-width: 2px; - height: 1rem; - width: self.height; - border-radius: 32px; - } - } - textComponent := VText { - text: root.text; - vertical-alignment: center; - } - } - - ta := TouchArea { - clicked => { - checked = !checked; - root.toggled(checked) - } - } -} diff --git a/external/slint-vynui/DatePicker.slint b/external/slint-vynui/DatePicker.slint deleted file mode 100644 index 0a6a10a..0000000 --- a/external/slint-vynui/DatePicker.slint +++ /dev/null @@ -1,48 +0,0 @@ -import { Button, DatePickerPopup, Date, Palette } from "std-widgets.slint"; -import { VLabeledComponent } from "LabeledComponent.slint"; -import { VActionButton } from "ActionButton.slint"; -import { VButton } from "Button.slint"; -import { Svg } from "Svg.slint"; - -export component VDatePicker inherits VLabeledComponent { - in-out property date; - in-out property dateDisplay; - - pure function formatZeroPadding(number: int) -> string { - if (number < 10) { - return "0\{number}"; - } - return number; - } - - pure function getDateDisplay() -> string { - if (date.year == 0) { - return "Unscheduled"; - } - return formatZeroPadding(date.day) + "/" + formatZeroPadding(date.month) + "/" + date.year; - } - - function resetDate() { - date.year = 0; - date.month = 0; - date.day = 0; - } - - HorizontalLayout { - VButton { - text: getDateDisplay(); - enabled: root.enabled; - clicked => { taskDateInput.show() } - } - VActionButton { - icon-svg: Svg.reset; - icon-svg-stroke-width: 1px; - enabled: root.enabled; - clicked => { resetDate() } - } - } - - taskDateInput := DatePickerPopup { - accepted(date) => { root.date = date } - } -} diff --git a/external/slint-vynui/LabeledComponent.slint b/external/slint-vynui/LabeledComponent.slint deleted file mode 100644 index f112ca0..0000000 --- a/external/slint-vynui/LabeledComponent.slint +++ /dev/null @@ -1,60 +0,0 @@ -import { Palette } from "Palette.slint"; -import { VText } from "Text.slint"; - -export component VLabeledComponent { - in property label; - in property label-size: 1rem; - in property label-alignment: TextHorizontalAlignment.left; - in property enabled: true; - in property no-background: false; - - function calc-background() -> brush { - if (no-background == true) { - return Palette.control-background.transparentize(1); - } - if (enabled == false) { - return Palette.control-background.darker(0.2); - } - return Palette.control-background; - } - - VerticalLayout { - if root.label != "" : VerticalLayout { - padding-left: 4px; - padding-right: 4px; - VText { - text: root.label; - font-size: label-size; - horizontal-alignment: root.label-alignment; - } - } - - Rectangle { - background: calc-background(); - border-radius: 4px; - VerticalLayout { - @children - } - } - } -} - -export component CommonComponentBackground { - in property enabled: true; - in property no-background: false; - - function calc-background() -> brush { - if (no-background == true) { - return Palette.control-background.transparentize(1); - } - if (enabled == false) { - return Palette.control-background.darker(0.2); - } - return Palette.control-background; - } - - Rectangle { - background: calc-background(); - @children - } -} diff --git a/external/slint-vynui/Palette.slint b/external/slint-vynui/Palette.slint deleted file mode 100644 index e2e8b3b..0000000 --- a/external/slint-vynui/Palette.slint +++ /dev/null @@ -1,43 +0,0 @@ -// OneDark - -//black = "#181a1f", -//bg0 = "#282c34", -//bg1 = "#31353f", -//bg2 = "#393f4a", -//bg3 = "#3b3f4c", -//bg_d = "#21252b", -//bg_blue = "#73b8f1", -//bg_yellow = "#ebd09c", -//fg = "#abb2bf", -//purple = "#c678dd", -//green = "#98c379", -//orange = "#d19a66", -//blue = "#61afef", -//yellow = "#e5c07b", -//cyan = "#56b6c2", -//red = "#e86671", -//grey = "#5c6370", -//light_grey = "#848b98", -//dark_cyan = "#2b6f77", -//dark_red = "#993939", -//dark_yellow = "#93691d", -//dark_purple = "#8a3fa0", -//diff_add = "#31392b", -//diff_delete = "#382b2c", -//diff_change = "#1c3448", -//diff_text = "#2c5372", -// ---- - -export global Palette { - out property accent: Colors.cyan.darker(0.4); - out property foreground: #abb2bf; - out property foreground-hint: foreground.darker(0.2); - out property background: #282c34; - out property pane: #21252b; - out property control-foreground: #abb2bf; - out property control-background: #393f4a; - out property card-background: background.brighter(0.2); - out property green: Colors.greenyellow; - out property orange: Colors.orange; - out property red: Colors.red; -} diff --git a/external/slint-vynui/PopupIconMenu.slint b/external/slint-vynui/PopupIconMenu.slint deleted file mode 100644 index b50bd82..0000000 --- a/external/slint-vynui/PopupIconMenu.slint +++ /dev/null @@ -1,27 +0,0 @@ -import { Palette } from "Palette.slint"; -import { VButton } from "Button.slint"; - -export component VPopupIconMenu inherits Rectangle { - private property popup-x: 200px; - private property popup-y: 200px; - - public function show(x: length, y: length) { - popup-x = x; - popup-y = y; - popup.show(); - } - - popup := PopupWindow { - x: popup-x; - y: popup-y; - Rectangle { - background: Palette.background.brighter(0.2); - border-radius: 8px; - clip: true; - HorizontalLayout { - alignment: start; - @children - } - } - } -} diff --git a/external/slint-vynui/Slider.slint b/external/slint-vynui/Slider.slint deleted file mode 100644 index f4a4a61..0000000 --- a/external/slint-vynui/Slider.slint +++ /dev/null @@ -1,34 +0,0 @@ -import { VLabeledComponent } from "LabeledComponent.slint"; -import { Palette } from "Palette.slint"; -import { Slider } from "std-widgets.slint"; -import { VText } from "Text.slint"; - -export component VSlider inherits VLabeledComponent { - in property show-value; - in-out property value; - - init => { - sliderComponent.value = root.value; - } - - pure callback format-value(float) -> string; - format-value(value) => { - return "\{value}"; - } - - callback released <=> sliderComponent.released; - in property minimum <=> sliderComponent.minimum; - in property maximum <=> sliderComponent.maximum; - - VerticalLayout { - spacing: 8px; - VText { - horizontal-alignment: center; - text: format-value(sliderComponent.value); - color: Palette.foreground-hint; - } - sliderComponent := Slider { - - } - } -} diff --git a/external/slint-vynui/Svg.slint b/external/slint-vynui/Svg.slint deleted file mode 100644 index 7d216de..0000000 --- a/external/slint-vynui/Svg.slint +++ /dev/null @@ -1,12 +0,0 @@ -export global Svg { - out property burger: "M3 6h18M3 12h18M3 18h18"; - out property play: "M240 128a15.74 15.74 0 0 1-7.6 13.51L88.32 229.65a16 16 0 0 1-16.2.3A15.86 15.86 0 0 1 64 216.13V39.87a15.86 15.86 0 0 1 8.12-13.82a16 16 0 0 1 16.2.3l144.08 88.14A15.74 15.74 0 0 1 240 128"; - out property pause: "M216 48v160a16 16 0 0 1-16 16h-40a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h40a16 16 0 0 1 16 16M96 32H56a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16"; - out property reset: "M18 28A12 12 0 1 0 6 16v6.2l-3.6-3.6L1 20l6 6l6-6l-1.4-1.4L8 22.2V16a10 10 0 1 1 10 10Z"; - out property trash: "M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6z"; - out property plus: "M11 13H5v-2h6V5h2v6h6v2h-6v6h-2z"; - out property pen: "M3 17.46v3.04c0 .28.22.5.5.5h3.04c.13 0 .26-.05.35-.15L17.81 9.94l-3.75-3.75L3.15 17.1q-.15.15-.15.36M20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75z"; - out property visible: "M2.933 3.491C4.056 2.681 5.456 2 7 2s2.944.682 4.067 1.491c1.128.812 2.02 1.784 2.56 2.437l.005.005c.241.3.368.681.368 1.067s-.127.766-.368 1.067l-.005.005c-.54.653-1.432 1.625-2.56 2.437C9.944 11.32 8.544 12 7 12s-2.944-.682-4.067-1.49C1.805 9.696.913 8.724.373 8.071l-.005-.005A1.7 1.7 0 0 1 0 7c0-.386.127-.766.368-1.067l.005-.005c.54-.653 1.432-1.625 2.56-2.437M7 9.25a2.25 2.25 0 1 0 0-4.5a2.25 2.25 0 0 0 0 4.5"; - out property not-visible: "M.264 1.324a.75.75 0 0 1 1.06-1.06l2.629 2.628C4.86 2.393 5.893 2.04 7 2.04c1.532 0 2.92.677 4.035 1.48c1.118.805 2.003 1.769 2.539 2.417l.004.005c.24.298.366.675.366 1.058s-.126.76-.366 1.058l-.004.006a14.5 14.5 0 0 1-2.249 2.2l2.411 2.412a.75.75 0 0 1-1.06 1.06zm8.753 6.633a2.232 2.232 0 0 0-2.974-2.974zm-8.59-2.02c.319-.387.762-.885 1.305-1.395l7.104 7.104A5.7 5.7 0 0 1 7 11.96c-1.532 0-2.92-.676-4.035-1.479C1.847 9.675.962 8.711.426 8.064l-.004-.006A1.7 1.7 0 0 1 .056 7c0-.383.126-.76.366-1.058l.004-.005Z"; - -} diff --git a/external/slint-vynui/Tag.slint b/external/slint-vynui/Tag.slint deleted file mode 100644 index 6180058..0000000 --- a/external/slint-vynui/Tag.slint +++ /dev/null @@ -1,31 +0,0 @@ -import { Palette } from "Palette.slint"; -import { VText } from "Text.slint"; - -export component VTag inherits Rectangle { - - in property text <=> text-component.text; - in property text-color <=> text-component.color; - in property size <=> text-component.font-size; - in property background-color <=> self.background; - - callback clicked; - - background: Palette.control-background; - border-radius: 8px; - - ta := TouchArea { - mouse-cursor: pointer; - clicked => { - root.clicked(); - } - } - - VerticalLayout { - padding-left: 8px; - padding-right: 8px; - alignment: center; - text-component := VText { - horizontal-alignment: center; - } - } -} diff --git a/external/slint-vynui/Text.slint b/external/slint-vynui/Text.slint deleted file mode 100644 index c254d49..0000000 --- a/external/slint-vynui/Text.slint +++ /dev/null @@ -1,5 +0,0 @@ -import { Palette } from "Palette.slint"; - -export component VText inherits Text { - color: Palette.foreground; -} diff --git a/external/slint-vynui/TextInput.slint b/external/slint-vynui/TextInput.slint deleted file mode 100644 index f7c485b..0000000 --- a/external/slint-vynui/TextInput.slint +++ /dev/null @@ -1,47 +0,0 @@ -import { VLabeledComponent } from "LabeledComponent.slint"; -import { Palette } from "Palette.slint"; -import { VText } from "Text.slint"; - -export component VTextInput inherits VLabeledComponent { - in-out property text <=> textInputComponent.text; - out property has-focus <=> textInputComponent.has-focus; - in-out property placeholder <=> textInputComponent.accessible-placeholder-text; - in-out property wrap <=> textInputComponent.wrap; - callback accepted(); - callback edited(); - callback started-writting(); - - public function edit-text(text: string) { - root.text = text; - root.old-text = text; - } - - private property old-text: ""; - - VerticalLayout { - padding: 4px; - padding-left: 8px; - padding-right: 8px; - textInputComponent := TextInput { - color: Palette.foreground; - accepted => { root.accepted() } - edited => { - root.edited(); - if (textInputComponent.text != "" && old-text == "") { - root.started-writting(); - } - old-text = textInputComponent.text; - } - HorizontalLayout { - alignment: start; - VText { - visible: textInputComponent.text == ""; - color: Palette.foreground-hint; - text: root.placeholder; - } - } - - } - } - -} diff --git a/external/slint-vynui/TimePicker.slint b/external/slint-vynui/TimePicker.slint deleted file mode 100644 index 69b1c2f..0000000 --- a/external/slint-vynui/TimePicker.slint +++ /dev/null @@ -1,25 +0,0 @@ -import { Button, TimePickerPopup, Date, Palette, Time } from "std-widgets.slint"; -import { VLabeledComponent } from "LabeledComponent.slint"; -import { VButton } from "Button.slint"; - -export component VTimePicker inherits VLabeledComponent { - in-out property