mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-22 09:32:38 +00:00
feat: update system
This commit is contained in:
@@ -18,30 +18,23 @@ App.connect("window-toggled", (_, name, visible) => {
|
||||
export const Arrow = (name, activate) => {
|
||||
let deg = 0;
|
||||
let iconOpened = false;
|
||||
const icon = Widget.Icon(icons.ui.arrow.right).hook(opened, () => {
|
||||
if (
|
||||
(opened.value === name && !iconOpened) ||
|
||||
(opened.value !== name && iconOpened)
|
||||
) {
|
||||
const step = opened.value === name ? 10 : -10;
|
||||
iconOpened = !iconOpened;
|
||||
for (let i = 0; i < 9; ++i) {
|
||||
Utils.timeout(15 * i, () => {
|
||||
deg += step;
|
||||
icon.setCss(`-gtk-icon-transform: rotate(${deg}deg);`);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return Widget.Button({
|
||||
child: Widget.Icon({
|
||||
icon: icons.ui.arrow.right,
|
||||
connections: [
|
||||
[
|
||||
opened,
|
||||
(icon) => {
|
||||
if (
|
||||
(opened.value === name && !iconOpened) ||
|
||||
(opened.value !== name && iconOpened)
|
||||
) {
|
||||
const step = opened.value === name ? 10 : -10;
|
||||
iconOpened = !iconOpened;
|
||||
for (let i = 0; i < 9; ++i) {
|
||||
Utils.timeout(15 * i, () => {
|
||||
deg += step;
|
||||
icon.setCss(`-gtk-icon-transform: rotate(${deg}deg);`);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
],
|
||||
}),
|
||||
child: icon,
|
||||
on_clicked: () => {
|
||||
opened.value = opened.value === name ? "" : name;
|
||||
if (typeof activate === "function") activate();
|
||||
@@ -70,14 +63,10 @@ export const ArrowToggleButton = ({
|
||||
}) =>
|
||||
Widget.Box({
|
||||
class_name: "toggle-button",
|
||||
connections: [
|
||||
[
|
||||
service,
|
||||
(box) => {
|
||||
box.toggleClassName("active", condition());
|
||||
},
|
||||
],
|
||||
],
|
||||
setup: (self) =>
|
||||
self.hook(service, () => {
|
||||
self.toggleClassName("active", condition());
|
||||
}),
|
||||
children: [
|
||||
Widget.Button({
|
||||
child: Widget.Box({
|
||||
@@ -108,7 +97,7 @@ export const ArrowToggleButton = ({
|
||||
export const Menu = ({ name, icon, title, content }) =>
|
||||
Widget.Revealer({
|
||||
transition: "slide_down",
|
||||
binds: [["reveal-child", opened, "value", (v) => v === name]],
|
||||
reveal_child: opened.bind().transform((v) => v === name),
|
||||
child: Widget.Box({
|
||||
class_names: ["menu", name],
|
||||
vertical: true,
|
||||
@@ -136,14 +125,10 @@ export const SimpleToggleButton = ({
|
||||
}) =>
|
||||
Widget.Button({
|
||||
class_name: "simple-toggle",
|
||||
connections: [
|
||||
[
|
||||
service,
|
||||
(box) => {
|
||||
box.toggleClassName("active", condition());
|
||||
},
|
||||
],
|
||||
],
|
||||
setup: (self) =>
|
||||
self.hook(service, () => {
|
||||
self.toggleClassName("active", condition());
|
||||
}),
|
||||
child: icon,
|
||||
on_clicked: toggle,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user