# Migration Guide ## From v2 ### Import paths `astal` namespace have been dropped. AGS is now using [Gnim](https://github.com/aylur/gnim) which is reexported from the `ags` namespace. ```ts // [!code --:2] import { App, Gtk } from "astal/gtk3" import { bind, Variable } from "astal/state" // [!code ++:3] import app from "ags/gtk3/app" import Gtk from "gi://Gtk?version=3.0" import { createBinding, createState } from "ags" ``` ### Subclassing `astalify` has been removed, `jsx` function and JSX expressions handle everything. It is possible to use Gtk widgets directly without any prior setup. ```tsx // [!code --:2] const Calendar = astalify(Gtk.Calendar) const _ = // [!code ++:1] const _ = ``` If you still prefer to use regular JS functions instead of JSX, you can do ```ts import { CCProps } from "ags" import { Gtk } from "ags/gtk4" type BoxProps = Partial> const Box = (props: BoxProps) => jsx(Gtk.Box, props) Box({ orientation: state, children: [Box()], }) ``` ### GObject decorators They were updated to the stage 3 proposal. You can read more about them on the [Gnim](https://aylur.github.io/gnim/gobject.html) documentation. ```ts @register() class MyObj extends GObject.Object { @property(String) declare myProp: string // [!code --] @property(String) myProp = "" // [!code ++] @property(String) // [!code --] @getter(String) // [!code ++] get myProp() { return "" } @property(String) // [!code --] @setter(String) // [!code ++] set myProp(v: string) { // } } ``` Make sure to also update `tsconfig.json` ```jsonc { "compilerOptions": { "experimentalDecorators": false, // [!code ++] "target": "ES2020", // [!code ++] }, } ``` ### Syntax changes - `setup` -> `$` - `className` -> `class` ```tsx