Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Port demos to TypeScript #201

Draft
wants to merge 144 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
6ff8c7b
Use 'my_custom_class" for the programmaticaly set style (#214)
UrtsiSantsi Oct 31, 2024
123772b
chore: rename all .js files to .ts
vixalien Aug 12, 2024
eb627b4
chore: add README.typescript.md
vixalien Aug 12, 2024
c98893d
feat: add tsconfig
vixalien Aug 12, 2024
2946c45
chore: add generated types
vixalien Aug 12, 2024
85a27a2
port: Welcome
vixalien Aug 12, 2024
5aef6a5
port: Accessibility
vixalien Aug 12, 2024
286a4e0
port: Account
vixalien Aug 12, 2024
dcda1cb
port: Action Bar
vixalien Aug 12, 2024
ff4a78d
port: Actions
vixalien Aug 12, 2024
158f215
port: Animation
vixalien Aug 12, 2024
9593f33
port: Audio
vixalien Aug 12, 2024
370edc2
port: Avatar
vixalien Aug 12, 2024
3d20414
port: Banner
vixalien Aug 12, 2024
39d7605
port: Box
vixalien Aug 12, 2024
4c748b9
port: Boxed Lists
vixalien Aug 12, 2024
76cc7bd
port: Breakpoints
vixalien Aug 12, 2024
7acaa2f
port: Button
vixalien Aug 12, 2024
81a2e33
port: Calendar
vixalien Aug 12, 2024
a89e1fd
chore: ignore all JavaScript files
vixalien Aug 20, 2024
7b7e39e
port: CSS Gradients
vixalien Aug 20, 2024
26e767b
port: Camera
vixalien Aug 20, 2024
084164b
port: Carousel
vixalien Aug 20, 2024
9159323
port: Checkboxes
vixalien Aug 20, 2024
3080456
port: Clamp
vixalien Aug 20, 2024
9b31fc1
port: Color Dialog
vixalien Aug 20, 2024
db0556e
port: Color Picker
vixalien Aug 20, 2024
3543580
port: Column View
vixalien Aug 20, 2024
ac04d9c
port: Context Menu
vixalien Aug 20, 2024
6437f75
port: Dialog
vixalien Aug 20, 2024
6399260
port: Drop Down
vixalien Aug 20, 2024
20faa25
port: Drop Zone
vixalien Aug 20, 2024
d8480f5
port: Email
vixalien Aug 20, 2024
6f9a61b
port: Emoji Chooser
vixalien Aug 20, 2024
f5fcd08
port: Event Controllers
vixalien Aug 20, 2024
67d28e3
port: File Monitor
vixalien Aug 20, 2024
c9affa3
port: WebSocket Client
vixalien Aug 24, 2024
a120287
port: Web View
vixalien Aug 24, 2024
f9611f5
port: Wallpaper
vixalien Aug 24, 2024
b680748
port: View Switcher
vixalien Aug 24, 2024
cb52d85
port: Video
vixalien Aug 24, 2024
01e367b
port: Toggle Button
vixalien Aug 24, 2024
45e307c
port: Toasts
vixalien Aug 24, 2024
b0bdb07
port: Text View
vixalien Aug 24, 2024
c791dbf
port: Text Fields
vixalien Aug 24, 2024
f74c0d5
port: Text Colors
vixalien Aug 24, 2024
a4d34dd
port: Tooltip
vixalien Aug 24, 2024
4bf185f
port: Tab View
vixalien Aug 24, 2024
9f4d74b
port: Switch
vixalien Aug 24, 2024
8ee1894
port: Styling with CSS
vixalien Aug 24, 2024
578e50e
port: Stack
vixalien Aug 24, 2024
5cd19f2
port: Spinner
vixalien Aug 24, 2024
da29f58
port: Spin Button
vixalien Aug 24, 2024
8635dc5
port: Spell Checker
vixalien Aug 24, 2024
d04a31d
port: Source View
vixalien Aug 24, 2024
21bd3e0
port: Snapshot
vixalien Aug 24, 2024
ea147f7
port: Session Monitor and Inhibit
vixalien Aug 24, 2024
dc34fba
port: Separator
vixalien Aug 24, 2024
5ffd877
port: Select Folder
vixalien Aug 24, 2024
d067266
port: Search
vixalien Aug 24, 2024
1611d20
port: Scrolled Window
vixalien Aug 24, 2024
c7ecfda
port: Screenshot
vixalien Aug 24, 2024
f06b4c7
port: Screencast
vixalien Aug 24, 2024
de0d25a
port: Scale
vixalien Aug 24, 2024
a07fb22
port: Save File
vixalien Aug 24, 2024
4de4839
port: SVG
vixalien Aug 24, 2024
77b1f8a
port: Revealer
vixalien Aug 24, 2024
4bd3c0a
port: Radio Buttons
vixalien Aug 24, 2024
bd86711
port: Progress Bar
vixalien Aug 24, 2024
9ce0959
port: Preferences Dialog
vixalien Aug 24, 2024
012e50c
port: Power Profile Monitor
vixalien Aug 24, 2024
8be3546
port: Picture
vixalien Sep 3, 2024
ee0dda6
port: Overlay
vixalien Sep 3, 2024
0f091f4
port: Overlay Split View
vixalien Sep 3, 2024
d8e9737
port: Open File
vixalien Sep 3, 2024
460615b
port: Network Monitor
vixalien Sep 3, 2024
e47ea7d
port: Navigation View
vixalien Sep 3, 2024
9efae1c
port: Message Dialogs
vixalien Sep 3, 2024
51a24d2
port: Menu
vixalien Sep 3, 2024
ac33cf9
port: Menu Button
vixalien Sep 3, 2024
dc0657a
port: Map
vixalien Sep 3, 2024
8f23390
port: Location
vixalien Sep 3, 2024
095f908
port: List View
vixalien Sep 3, 2024
da2ee9b
port: List Model
vixalien Sep 3, 2024
52cc072
port: Level Bars
vixalien Sep 3, 2024
43194e2
port: Launcher
vixalien Sep 3, 2024
ef096cf
port: Label
vixalien Sep 3, 2024
f38a0e7
port: Image
vixalien Sep 3, 2024
56cc363
port: HTTP Server
vixalien Sep 3, 2024
e531352
port: HTTP Request
vixalien Sep 3, 2024
faa5b4b
port: HTTP Image
vixalien Sep 3, 2024
f5a7ccc
port: Grid
vixalien Sep 3, 2024
63a844f
port: Grid View
vixalien Sep 3, 2024
a2026c2
port: Frame
vixalien Sep 3, 2024
7e6eb51
port: Font Dialog
vixalien Sep 3, 2024
e3fd847
chore: regenerate types with `@ts-for-gir/[email protected]`
vixalien Sep 3, 2024
5cff4b0
port: Drawing Area
vixalien Sep 3, 2024
aeea1bf
port: Drag and Drop
vixalien Sep 3, 2024
5ba0b81
port: List View with a Tree
vixalien Oct 31, 2024
729ed3a
port: List View with Sections
vixalien Oct 31, 2024
750d25b
doc: update typescript instructions
vixalien Oct 31, 2024
0b8eeb2
chore: update types
vixalien Oct 31, 2024
fb3eea3
port: Database
vixalien Oct 31, 2024
41fc6c5
port: Gamepad
vixalien Oct 31, 2024
5d9bca3
Use generic get_object
UrtsiSantsi Oct 31, 2024
d7e1d9d
Use generic get_object
UrtsiSantsi Oct 31, 2024
554b6d2
Use generic get_object
UrtsiSantsi Oct 31, 2024
6d9bdbf
Use generic get_object
UrtsiSantsi Oct 31, 2024
e61e956
Use generic get_object
UrtsiSantsi Oct 31, 2024
c556015
Use generic get_object
UrtsiSantsi Oct 31, 2024
d4ae65f
Use generic get_object
UrtsiSantsi Oct 31, 2024
f23ff45
Use generic get_object
UrtsiSantsi Oct 31, 2024
5ae3969
Use generic get_object
UrtsiSantsi Oct 31, 2024
bcd46ab
Use generic get_object
UrtsiSantsi Oct 31, 2024
1b662ff
Use generic get_object
UrtsiSantsi Oct 31, 2024
01a1984
Use generic get_object
UrtsiSantsi Oct 31, 2024
d3c494c
Use generic get_object
UrtsiSantsi Oct 31, 2024
7e71520
Use generic get_object
UrtsiSantsi Oct 31, 2024
cafd2fe
Use generic get_object
UrtsiSantsi Oct 31, 2024
dab417a
Use generic get_object
UrtsiSantsi Oct 31, 2024
dd70686
Use generic get_object
UrtsiSantsi Oct 31, 2024
5c53d5a
Use generic get_object
UrtsiSantsi Oct 31, 2024
d166c7e
Use generic get_object
UrtsiSantsi Oct 31, 2024
40c974a
Use generic get_object
UrtsiSantsi Oct 31, 2024
98323a1
Use generic get_object
UrtsiSantsi Oct 31, 2024
e17e325
Use generic get_object
UrtsiSantsi Oct 31, 2024
38e2bb2
Use generic get_object
UrtsiSantsi Oct 31, 2024
d46fd97
Use generic get_object
UrtsiSantsi Oct 31, 2024
57df644
Use generic get_object
UrtsiSantsi Oct 31, 2024
1fe367c
Use generic get_object
UrtsiSantsi Oct 31, 2024
4bc73e8
Use generic get_object
UrtsiSantsi Oct 31, 2024
290020a
Use generic get_object
UrtsiSantsi Oct 31, 2024
3226224
Use generic get_object
UrtsiSantsi Oct 31, 2024
dc30136
Use generic get_object
UrtsiSantsi Oct 31, 2024
dc0f4e0
Use generic get_object
UrtsiSantsi Oct 31, 2024
051d601
Use generic get_object
UrtsiSantsi Oct 31, 2024
8b1f0d2
Use generic get_object
UrtsiSantsi Oct 31, 2024
039b299
Use generic get_object
UrtsiSantsi Oct 31, 2024
cb26bda
Use generic get_object
UrtsiSantsi Oct 31, 2024
9e3c277
Use generic get_object
UrtsiSantsi Oct 31, 2024
724a307
Use generic get_object
UrtsiSantsi Oct 31, 2024
829ac24
Use generic get_object
UrtsiSantsi Oct 31, 2024
b07559a
Use generic get_object
UrtsiSantsi Oct 31, 2024
4555635
Use generic get_object
UrtsiSantsi Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ __pycache__
.idea
.vscode

# compiled typescript
out

# extra GIRs from Workbench
workbench-girs

# Project files - sync with Makefile
src/*/settings
src/*/workbench.vala
Expand All @@ -35,3 +41,6 @@ src/*/*.gresource.xml
src/*/jsconfig.json
src/*/rustc-ice-*.txt
src/*/*.sqlite*

# All JavaScript files
src/**/*.js
52 changes: 52 additions & 0 deletions README.typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Demos TypeScript

Here is how you generate TypeScript declaration files for the various platform
GIRs (Gtk4, Adw, GObject, etc..) and other dependencies used by Workbench
(Libportal/Xdp, Jsonrpc, Shumate, Vte, etc..).

Due to current limitations
(https://github.com/workbenchdev/Workbench/issues/980), you cannot directly
generate the types from within Workbench's sandbox automatically.

### 0. Copy the built GIRs from Workbench

First enter the Build Terminal. On VSCode you can easily do this by pressing
`Ctrl+P` then selecting `Flatpak: Enter Build Terminal`.

You can also enter Workbench Terminal using the following command:

```bash
flatpak run --command=bash --filesystem=$(pwd) re.sonny.Workbench.Devel
```

Then you can copy all the GIRs build from Workbench

```bash
mkdir -p workbench-girs
cp /app/share/gir-1.0/* workbench-girs
```

### 1. Enter the flatpak sandbox

```bash
FLATPAK_ENABLE_SDK_EXT=node20,typescript flatpak run --share=network --command=bash --filesystem=$(pwd) org.gnome.Sdk//master

# Enable the node20 and typescript SDK extensions
source /usr/lib/sdk/node20/enable.sh
export PATH=/usr/lib/sdk/typescript/bin:$PATH
```

### 2. Install ts-for-gir (in the flatpak sandbox)

```bash
YARN_GLOBAL_DIR=/tmp/yarn-global
export PATH="$YARN_GLOBAL_DIR/node_modules/.bin:$PATH"

yarn --global-folder $YARN_GLOBAL_DIR global add @ts-for-gir/[email protected]
```

### Generate modules

```bash
ts-for-gir generate -g workbench-girs/ -g /usr/share/gir-1.0/ -o workbench-types/ --ignoreVersionConflicts
```
20 changes: 20 additions & 0 deletions ambient/workbench.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// <reference path="../workbench-types/adw-1.d.ts" />
/// <reference path="../workbench-types/gtk-4.0.d.ts" />
/// <reference path="../workbench-types/gobject-2.0.d.ts" />

import Gtk from "gi://Gtk?version=4.0";
import Adw from "gi://Adw";
import GObject from "gi://GObject";

declare global {
// global workbench object
declare const workbench: {
window: Adw.ApplicationWindow;
application: Adw.Application;
builder: Gtk.Builder;
template: string;
resolve(path: string): string;
preview(object: Gtk.Widget): void;
build(params: Record<string, Function | GObject.Object>): void;
};
}
2 changes: 1 addition & 1 deletion src/About Dialog/main.js → src/About Dialog/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gettext as _ } from "gettext";
import Adw from "gi://Adw";
import Gtk from "gi://Gtk?version=4.0";

const button = workbench.builder.get_object("button");
const button = workbench.builder.get_object<Gtk.Button>("button");

function openAboutDialog() {
const dialog = new Adw.AboutDialog({
Expand Down
2 changes: 1 addition & 1 deletion src/Accessibility/main.js → src/Accessibility/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import GObject from "gi://GObject";
import Gdk from "gi://Gdk?version=4.0";
import Gtk from "gi://Gtk?version=4.0";

const button = workbench.builder.get_object("custom_button");
const button = workbench.builder.get_object<Gtk.Button>("custom_button");

const clicker = new Gtk.GestureClick();
clicker.connect("released", () => toggleButton(button));
Expand Down
23 changes: 16 additions & 7 deletions src/Account/main.js → src/Account/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Adw from "gi://Adw";
import Gdk from "gi://Gdk?version=4.0";
import Gio from "gi://Gio";
import GLib from "gi://GLib?version=2.0";
import Gtk from "gi://Gtk?version=4.0";
import Xdp from "gi://Xdp?version=1.0";
import XdpGtk from "gi://XdpGtk4";

Expand All @@ -12,16 +15,22 @@ Gio._promisify(
const portal = new Xdp.Portal();
const parent = XdpGtk.parent_new_gtk(workbench.window);

const revealer = workbench.builder.get_object("revealer");
const button = workbench.builder.get_object("button");
const avatar = workbench.builder.get_object("avatar");
const entry = workbench.builder.get_object("entry");
const username = workbench.builder.get_object("username");
const display = workbench.builder.get_object("name");
const revealer = workbench.builder.get_object<Gtk.Revealer>("revealer");
const button = workbench.builder.get_object<Gtk.Button>("button");
const avatar = workbench.builder.get_object<Adw.Avatar>("avatar");
const entry = workbench.builder.get_object<Adw.EntryRow>("entry");
const username = workbench.builder.get_object<Gtk.Label>("username");
const display = workbench.builder.get_object<Gtk.Label>("name");

async function onClicked() {
const reason = entry.get_text();
const result = await portal.get_user_information(parent, reason, null, null);
// @ts-expect-error this function's isn't detected as `async` yet.
const result = await portal.get_user_information(
parent,
reason,
null,
null,
) as GLib.Variant;

/*
result is a GVariant dictionary containing the following fields
Expand Down
16 changes: 0 additions & 16 deletions src/Action Bar/main.js

This file was deleted.

18 changes: 18 additions & 0 deletions src/Action Bar/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Gtk from "gi://Gtk?version=4.0";

const action_bar = workbench.builder.get_object<Gtk.ActionBar>("action_bar");
const button = workbench.builder.get_object<Gtk.ToggleButton>("button");
const start_widget = workbench.builder.get_object<Gtk.Button>("start_widget");
const end_widget = workbench.builder.get_object<Gtk.Button>("end_widget");

button.connect("notify::active", () => {
action_bar.revealed = !button.active;
});

start_widget.connect("clicked", () => {
console.log("Start widget");
});

end_widget.connect("clicked", () => {
console.log("End widget");
});
6 changes: 4 additions & 2 deletions src/Actions/main.js → src/Actions/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Gtk from "gi://Gtk?version=4.0";
import Adw from "gi://Adw";
import GLib from "gi://GLib";
import Gio from "gi://Gio";

const demo = workbench.builder.get_object("demo");
const demo = workbench.builder.get_object<Adw.StatusPage>("demo");

const demo_group = new Gio.SimpleActionGroup();
demo.insert_action_group("demo", demo_group);
Expand Down Expand Up @@ -55,7 +57,7 @@ scale_action.connect("notify::state", (action) => {

demo_group.add_action(scale_action);

const text = workbench.builder.get_object("text");
const text = workbench.builder.get_object<Gtk.Label>("text");

const alignment_action = new Gio.PropertyAction({
name: "text-align",
Expand Down
9 changes: 5 additions & 4 deletions src/Animation/main.js → src/Animation/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Adw from "gi://Adw";
import Graphene from "gi://Graphene";
import Gsk from "gi://Gsk";
import Gtk from "gi://Gtk?version=4.0";

const button_timed = workbench.builder.get_object("button_timed");
const progress_bar = workbench.builder.get_object("progress_bar");
const button_timed = workbench.builder.get_object<Gtk.Button>("button_timed");
const progress_bar = workbench.builder.get_object<Gtk.ProgressBar>("progress_bar");
const target_timed = Adw.PropertyAnimationTarget.new(progress_bar, "fraction");

const animation_timed = new Adw.TimedAnimation({
Expand All @@ -23,8 +24,8 @@ animation_timed.connect("done", () => {
animation_timed.reset();
});

const button_spring = workbench.builder.get_object("button_spring");
const ball = workbench.builder.get_object("ball");
const button_spring = workbench.builder.get_object<Gtk.Button>("button_spring");
const ball = workbench.builder.get_object<Adw.Bin>("ball");

const target_spring = Adw.CallbackAnimationTarget.new(animation_cb);
const params = Adw.SpringParams.new(
Expand Down
2 changes: 1 addition & 1 deletion src/Audio/main.js → src/Audio/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Gio from "gi://Gio";
import Gtk from "gi://Gtk?version=4.0";

const controls = workbench.builder.get_object("controls");
const controls = workbench.builder.get_object<Gtk.MediaControls>("controls");

const buttons = ["sound", "music"];
const audio_files = {
Expand Down
8 changes: 5 additions & 3 deletions src/Avatar/main.js → src/Avatar/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Adw from "gi://Adw";
import Gdk from "gi://Gdk?version=4.0";
import Gio from "gi://Gio";
import Gtk from "gi://Gtk?version=4.0";

Gio._promisify(Gtk.FileDialog.prototype, "open", "open_finish");

const avatar_image = workbench.builder.get_object("avatar_image");
const button = workbench.builder.get_object("button");
const avatar_image = workbench.builder.get_object<Adw.Avatar>("avatar_image");
const button = workbench.builder.get_object<Gtk.Button>("button");

const file_filter = new Gtk.FileFilter();
file_filter.add_pixbuf_formats();
Expand All @@ -21,7 +22,8 @@ button.connect("clicked", () => {
});

async function onClicked() {
const file = await file_dialog.open(workbench.window, null);
// @ts-expect-error this function's type isn't detected as async yet
const file = await file_dialog.open(workbench.window, null) as Gio.File;
const texture = Gdk.Texture.new_from_file(file);
avatar_image.set_custom_image(texture);
}
7 changes: 4 additions & 3 deletions src/Banner/main.js → src/Banner/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Adw from "gi://Adw";
import Gtk from "gi://Gtk?version=4.0";

const banner = workbench.builder.get_object("banner");
const overlay = workbench.builder.get_object("overlay");
const button_show_banner = workbench.builder.get_object("button_show_banner");
const banner = workbench.builder.get_object<Adw.Banner>("banner");
const overlay = workbench.builder.get_object<Adw.ToastOverlay>("overlay");
const button_show_banner = workbench.builder.get_object<Gtk.Button>("button_show_banner");

function alert() {
const toast = new Adw.Toast({
Expand Down
30 changes: 15 additions & 15 deletions src/Box/main.js → src/Box/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Gtk from "gi://Gtk?version=4.0";

const interactive_box = workbench.builder.get_object("interactive_box");
const button_append = workbench.builder.get_object("button_append");
const button_prepend = workbench.builder.get_object("button_prepend");
const button_remove = workbench.builder.get_object("button_remove");
const interactive_box = workbench.builder.get_object<Gtk.Box>("interactive_box");
const button_append = workbench.builder.get_object<Gtk.Button>("button_append");
const button_prepend = workbench.builder.get_object<Gtk.Button>("button_prepend");
const button_remove = workbench.builder.get_object<Gtk.Button>("button_remove");
let count = 0;

button_append.connect("clicked", append);
button_prepend.connect("clicked", prepend);
button_remove.connect("clicked", remove);

const toggle_orientation_horizontal = workbench.builder.get_object(
const toggle_orientation_horizontal = workbench.builder.get_object<Gtk.ToggleButton>(
"toggle_orientation_horizontal",
);
const toggle_orientation_vertical = workbench.builder.get_object(
const toggle_orientation_vertical = workbench.builder.get_object<Gtk.ToggleButton>(
"toggle_orientation_vertical",
);

Expand All @@ -27,19 +27,19 @@ toggle_orientation_vertical.connect("toggled", () => {
interactive_box.orientation = Gtk.Orientation.VERTICAL;
});

const highlight = workbench.builder.get_object("highlight");
const highlight = workbench.builder.get_object<Gtk.CheckButton>("highlight");
highlight.connect("toggled", () => {
highlight.active
? interactive_box.add_css_class("border")
: interactive_box.remove_css_class("border");
});

const halign_toggle_fill = workbench.builder.get_object("halign_toggle_fill");
const halign_toggle_start = workbench.builder.get_object("halign_toggle_start");
const halign_toggle_center = workbench.builder.get_object(
const halign_toggle_fill = workbench.builder.get_object<Gtk.ToggleButton>("halign_toggle_fill");
const halign_toggle_start = workbench.builder.get_object<Gtk.ToggleButton>("halign_toggle_start");
const halign_toggle_center = workbench.builder.get_object<Gtk.ToggleButton>(
"halign_toggle_center",
);
const halign_toggle_end = workbench.builder.get_object("halign_toggle_end");
const halign_toggle_end = workbench.builder.get_object<Gtk.ToggleButton>("halign_toggle_end");

halign_toggle_fill.connect("toggled", () => {
if (halign_toggle_fill.active) interactive_box.halign = Gtk.Align.FILL;
Expand All @@ -57,12 +57,12 @@ halign_toggle_end.connect("toggled", () => {
if (halign_toggle_end.active) interactive_box.halign = Gtk.Align.END;
});

const valign_toggle_fill = workbench.builder.get_object("valign_toggle_fill");
const valign_toggle_start = workbench.builder.get_object("valign_toggle_start");
const valign_toggle_center = workbench.builder.get_object(
const valign_toggle_fill = workbench.builder.get_object<Gtk.ToggleButton>("valign_toggle_fill");
const valign_toggle_start = workbench.builder.get_object<Gtk.ToggleButton>("valign_toggle_start");
const valign_toggle_center = workbench.builder.get_object<Gtk.ToggleButton>(
"valign_toggle_center",
);
const valign_toggle_end = workbench.builder.get_object("valign_toggle_end");
const valign_toggle_end = workbench.builder.get_object<Gtk.ToggleButton>("valign_toggle_end");

valign_toggle_fill.connect("toggled", () => {
if (valign_toggle_fill.active) interactive_box.valign = Gtk.Align.FILL;
Expand Down
16 changes: 0 additions & 16 deletions src/Boxed Lists/main.js

This file was deleted.

18 changes: 18 additions & 0 deletions src/Boxed Lists/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Adw from "gi://Adw";
import GObject from "gi://GObject";
import Gtk from "gi://Gtk?version=4.0";

const drop_down = workbench.builder.get_object<Adw.ComboRow>("drop_down");

drop_down.connect("notify::selected-item", () => {
const selected_item = drop_down.selected_item as Gtk.StringObject;
const selected_string = selected_item.get_string();
console.log(selected_string);
});

const expression = Gtk.ClosureExpression.new(
GObject.TYPE_STRING,
(obj) => obj.string,
null,
);
drop_down.expression = expression;
4 changes: 3 additions & 1 deletion src/Breakpoints/main.js → src/Breakpoints/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const breakpoint = workbench.builder.get_object("breakpoint");
import Adw from "gi://Adw";

const breakpoint = workbench.builder.get_object<Adw.Breakpoint>("breakpoint");

breakpoint.connect("apply", () => {
console.log("Breakpoint Applied");
Expand Down
File renamed without changes.
Loading
Loading