Skip to content

Releases: Aylur/ags

v3.1.2

08 Apr 23:05

Choose a tag to compare

fix breaking change introduced gjs

v3.1.1

14 Dec 16:36

Choose a tag to compare

Fixes

nix: update npm hash

v3.1.0

27 Nov 23:49

Choose a tag to compare

3.1.0

Update Gnim to 1.9. See Gnim#21.

Changes

Accessor

New Accessor getter function syntax.

let a: Accessor<T>
let aReactive: T = a() // will track `a` as a dependency in reactive scopes
let aNonReactive: T = a.peek() // simply reads the value without tracking it

The .get() syntax has been renamed to .peek() to reflect its use-case
better. Note that .get() still works, its simply marked as deprecated.

createComputed

Array dependency and get syntax is deprecated and replaced with the new
Accessor syntax.

// deprecated
createComputed([dep1, dep2], (v1, v2) => v1 + v2)
createComputed((get) => get(dep1) + get(dep2))

// replaced by
createComputed(() => dep1() + dep2())

Note that they are simply marked as deprecated and still work, but newly written
code should use the new syntax.

New Features

createBinding nested properties

createBinding now supports passing multiple keys which behaves as a "path" to
the property

interface Nested extends GObject.Object {
  value: string
}

interface MyObject extends GObject.Object {
  nested: null | Nested
}

const value: Accessor<string | null> = createBinding(object, "nested", "value")

If any part of the path is nullable the resulting Accessor's value will also be
nullable.

createState custom equals

It is now possible to specify a custom equals function to customize when to
emit change notifications

const [value, setValue] = createState(0, {
  equals: (prev, next) => prev > next,
})

createEffect

Previously, users had to use .subscribe() on each dependency and manually
cleanup with onCleanup. Now you can do it in one function without worrying
about cleanups.

let a: Accessor<T>
let b: Accessor<T>

// immediately runs the function, and re-runs whenever a or b changes
createEffect(() => {
  console.log("a changed", a())
  console.log("b changed", b())
})

You can use .peek() to not track accessors.

// will only run once
createEffect(() => {
  console.log("a:", a.peek())
})

An effect with no dependencies is identical to onMount

createMemo

Its signature is identical to createComputed, but instead of invalidating its
value and only computing upon access, createMemo will eagerly recompute and
will only notify when the value actually changed.

let a: Accessor<number>
let b: Accessor<number>

const memo: Accessor<number> = createMemo(() => a() * b())

v3.0.0

22 Oct 11:30

Choose a tag to compare

v3

The previous JSX runtime implementation relied on GTK3's cascading destroy signal for resource management, which changed in GTK4 and could no longer be relied upon.

The JSX runtime has been reimagined with inspiration from modern web frameworks. It has been migrated to Gnim.

See the Migration Guide.

Changes and Features

  • astalify has been completely replaced by JSX, subclasses now work without wrappers

  • The Variable API has been replaced by Accessor and its constructor functions:

    • createState
    • createBinding
    • createComputed
  • The children prop is now properly type-annotated for TypeScript

  • children can no longer take reactive values directly: use <For> and <With> instead

  • <For> and <With> components for dynamic rendering

  • scoping mechanism and lifecycle hooks:

    • onCleanup
    • onMount
    • createRoot
    • getScope
  • GObject decorators have been updated to stage 3

  • new type-safe DBus decorators similar to GObject decorators

  • Signal handler type annotations are now automatically generated

  • The --gtk4 flag is no longer required, as it is inferred from the codebase

  • The -a flag for the run command has been removed and replaced with rest arguments

  • The bundle command now embeds JS code into a Bash script, removing the need to manually use LD_PRELOAD

  • The init command now defaults to GTK4

v2.3.0

04 Feb 16:18
a6a7a0a

Choose a tag to compare

What's Changed

  • feat: ags types --verbose flag
  • fix: relative paths ags run -d #661
  • feat: ags types now looks in EXTRA_GIR_DIRS (mainly meant to be used for nix)

Full Changelog: v2.2.1...v2.3.0

v2.2.1

28 Dec 10:40

Choose a tag to compare

Fixes

  • fix path resolutions when running ags run with default .config/ags argument
  • feat: --root flag which can be used in meson and other build tools where cd is not an option

Full Changelog: v2.2.0...v2.2.1

v2.2.0

28 Dec 00:47
bb963ed

Choose a tag to compare

What's Changed

  • --src and --tsconfig flag of the run and bundle commands are deprecated, use --define instead
  • type resolution of the astal package has been moved to package.json
  • templates have been updated to use a package.json
  • gtk4 support
  • gtk4 template

Full Changelog: v2.0.1...v2.2.0

v2.0.1

14 Nov 13:30

Choose a tag to compare

Hotifx for ags init --directory flag
Full Changelog: v2.0.0...v2.0.1

v2.0.0

13 Nov 23:25

Choose a tag to compare

After a lot of work, here is the release of AGS v2.

The core functionality of AGS has been reimplemented from scratch in Vala and C and was named Astal.
Services are now standalone libraries and can be cherry picked. Most of them also include a cli tool
to make them even more versatile. For example they could be paired with Eww.

I was debating whether to keep this project alive or move everything into Astal, but as Astal
was starting to get feature complete I realized what made AGS easy to use was missing. Namely
Astal in TypeScript/JavaScript requires a build step and it was not very convenient to just get started with.

Turns out there are quite a few things to consider when bundling and setting up a project especially when someone is not familiar with the mess of js tooling. So I repurposed AGS to act as a scaffolding tool for Astal projects written in TS/JS, while features are
done in Astal, bundling is outsourced to AGS.

Astal vs AGS v1

New features are:

  • TypeScript support ootb
  • JSX
  • widget fixes
    • EventBox hover, and hover-lost signals will now correctly work even when they are at the edge of a window.
    • Setting the size or the icon if an Icon widget will no longer flicker.
  • no more globals like App, Service and Utils
  • no more Service.import or resource:///com/github/aylur/ags, simply import from astal or gi://LibName
  • Service is no longer a thing, for "custom services" just simply subclass GObject.Object
  • instead of Service.register you can now use decorators
  • the cli client no longer uses dbus, which should be it a lot more faster
  • the cli client is a lot more powerful
    • there is no need for setting variables and functions global to then access them on cli
    • you can define a requestHandler which handles messages coming from the cli

AGS v2 bundler

This project is simply meant to be an esbuild distribution.

Currently it has a few plugins builtin:

  • importing .css will inline it in as a string
  • importing .scss will transpile them and inline it as a string
  • importing .blp will compile them and inline the xml as a string
  • importing something with inline: prefix will inline the file's contents as a string

Since Astal is a library it lost App.configDir.
The goal of these plugins is to be able to bundle everything into a single
executable and avoiding having to refer to files outside the script.
In cases where you still have to refer to the source dir, AGS defines a global SRC variable.

You can:
Setup a starter project with ags init
Generate types when adding new libs with ags types
Bundle the script with ags bundle
And run a project without bundling with ags run

Checkout the Astal website and the new AGS website

Special thanks to

  • kotontrion for writing some of the libraries and overall helping around
  • tokyoB0t for polishing the Lua lib and Lua docs
  • Xoores for being a subscriber on ko-fi from the beginning
  • and everyone else who contributed

I've never really said thanks for donators before, so I'd also like to thank now everyone who donated

  • awsumatt
  • Jas Singh
  • eXia
  • johndoe42
  • kotontrion
  • Rubén L
  • Francois Rigaut
  • Keule2
  • The_Branch_Manager
  • Keil Miller Jr
  • Grosheth
  • Iain
  • Harija
  • magic

and especially:

  • JNC
  • Chris Phillips

Also thanks to everyone that picked up Astal while being developed and reported bugs either on Discord or Github.

v1.8.2

29 Apr 14:52

Choose a tag to compare

Features

  • Calendar.detail
  • SpinButton.range
  • SpinButton.increments
  • Network.frequency
  • recursive Utils.monitorFile
  • add: Network.vpn
  • add write and writeAsync to Utils.subprocess (#388)

Fixes

  • compiles with typescript >= 5.0.4
  • DrawingArea.draw-fn
  • hyprland: active client empty on window close
  • dispose signal on Variable
  • skip unnecessary value setting in Utils.derive and Utils.merge
  • properly log errors from Variables
  • adjust Hyprland socket (#398)

Breaking Changes

  • Stream.is_muted corresponds to actual mute state
  • Utils.exec returns stderr on error

New Contributors

Full Changelog: v1.8.0...v1.8.2