Skip to content

Commit

Permalink
Merge branch 'main' into package-props-defined
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Feb 17, 2025
2 parents 964ad57 + 70f9c42 commit 1a0e663
Show file tree
Hide file tree
Showing 103 changed files with 30,367 additions and 31,099 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Update package repository
run: sudo apt-get update; # sudo apt-get upgrade
- name: Install dependencies
run: sudo apt-get --yes install gjs libappindicator3-dev libgda-5.0-dev libgirepository1.0-dev libgtk-3-dev libgtk-4-dev libgtksourceview-3.0-dev libnotify-dev libsoup2.4-dev libsoup-3.0-dev libwebkit2gtk-4.0-dev libadwaita-1-dev gnome-shell-common libmutter-10-dev libgcr-3-dev libgnome-desktop-3-dev build-essential gobject-introspection libgirepository1.0-dev libcairo2-dev
run: sudo apt-get --yes install gjs libappindicator3-dev libgda-5.0-dev libgirepository1.0-dev libgtk-3-dev libgtk-4-dev libgtksourceview-3.0-dev libnotify-dev libsoup2.4-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev libadwaita-1-dev gnome-shell-common libmutter-14-dev libgcr-3-dev libgnome-desktop-4-dev build-essential gobject-introspection libgirepository1.0-dev libcairo2-dev
- run: yarn --version
- run: node --version
- run: gjs --version
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
556 changes: 278 additions & 278 deletions .yarn/releases/yarn-4.5.1.cjs → .yarn/releases/yarn-4.6.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ packageExtensions:
dependencies:
"@parcel/core": "*"

yarnPath: .yarn/releases/yarn-4.5.1.cjs
yarnPath: .yarn/releases/yarn-4.6.0.cjs
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sudo apt-get update && sudo apt-get install \
libadwaita-1-dev

# Fedora
sudo dnf update && sudo dnf install \
sudo dnf install \
libappindicator-gtk3-devel \
libgda-devel \
gobject-introspection-devel \
Expand Down Expand Up @@ -152,4 +152,4 @@ NODE_OPTIONS=--max-old-space-size=25600 yarn ...
* [gjs-ts](https://github.com/niagr/gjs-ts) - Typescript bindings for GJS
* [Typescript Doclet](https://github.com/gjsify/doclet) - Experimental TypeScript binding generator written in Vala as a Valadoc extension
* [gi.ts](https://gitlab.gnome.org/ewlsh/gi.ts) - Highly accurate TypeScript bindings for GJS
* [gi-ts](https://github.com/gi-ts) TypeScript Type definitions for the GNOME base stack (e.g. GLib, GObject)
* [gi-ts](https://github.com/gi-ts) TypeScript Type definitions for the GNOME base stack (e.g. GLib, GObject)
4 changes: 2 additions & 2 deletions examples/adw-1-hello/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.3",
"vite": "^5.4.10"
"typescript": "^5.7.3",
"vite": "^6.1.0"
},
"dependencies": {
"@girs/adw-1": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion examples/cairo-surfaces-tsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.3"
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gjs": "workspace:^"
Expand Down
2 changes: 1 addition & 1 deletion examples/console-tsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.3"
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gjs": "workspace:^"
Expand Down
8 changes: 8 additions & 0 deletions examples/gio-2-action-entries/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import GObject from 'gi://GObject';
import System from 'system';

console.log('GJS Version:', System.version);

if(System.version < 18200) {
console.log('GJS version 1.82.0 or higher is required for this example, skipping example');
System.exit(0);
}

export class ExampleApplication extends Gio.Application {
static {
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-action-entries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clear": "rm -rf dist"
},
"devDependencies": {
"typescript": "^5.6.3"
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clear": "rm -rf dist"
},
"devDependencies": {
"typescript": "^5.6.3"
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions examples/gio-2-cat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
"esbuild": "^0.25.0",
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions examples/gio-2-dbus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
"esbuild": "^0.25.0",
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
8 changes: 8 additions & 0 deletions examples/gio-2-iterate/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import GLib from 'gi://GLib'
import Gio from 'gi://Gio'
import System from 'system';

console.log('GJS Version:', System.version);

if(System.version < 18200) {
console.log('GJS version 1.82.0 or higher is required for this example, skipping example');
System.exit(0);
}

Gio._promisify(Gio.File.prototype, 'enumerate_children_async', 'enumerate_children_finish')

Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-iterate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"clear": "rm -rf dist"
},
"devDependencies": {
"typescript": "^5.6.3"
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions examples/gio-2-list-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
"esbuild": "^0.25.0",
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
9 changes: 4 additions & 5 deletions examples/glib-2-spawn-command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^9.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
"ts-loader": "^9.5.2",
"typescript": "^5.7.3",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@girs/gjs": "workspace:^",
Expand Down
7 changes: 1 addition & 6 deletions examples/glib-2-spawn-command/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';

export default {
mode: 'production',
entry: ['./main.ts'],
Expand Down Expand Up @@ -35,8 +33,5 @@ export default {
return callback(null, 'module ' +request);
}
callback();
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
],
}
};
4 changes: 2 additions & 2 deletions examples/glib-2-variant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
"esbuild": "^0.25.0",
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
121 changes: 121 additions & 0 deletions examples/gobject-param-spec/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import GObject from 'gi://GObject';
import System from 'system';

console.log('GJS Version:', System.version);

if(System.version < 18200) {
console.log('GJS version 1.82.0 or higher is required for nullable nick and blurb in GObject.ParamSpec, skipping example');
System.exit(0);
}

// Example class demonstrating different ParamSpec usages
class ExampleObject extends GObject.Object {
static {
GObject.registerClass({
GTypeName: 'ExampleObject',
Properties: {
// Property with all fields
'full-property': GObject.ParamSpec.string(
'full-property', // name (required)
'Full Property', // nick (optional)
'A complete property', // blurb (optional)
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
'default value'
),

// Property with null nick and blurb
'minimal-property': GObject.ParamSpec.string(
'minimal-property',
null, // nick can be null
null, // blurb can be null
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
''
),

// Number property with null documentation
'count': GObject.ParamSpec.int(
'count',
null, // nick can be null
null, // blurb can be null
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
0, // minimum
100, // maximum
0 // default value
),

// Boolean property with partial documentation
'active': GObject.ParamSpec.boolean(
'active',
'Active', // providing nick
null, // but blurb can still be null
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
false
)
}
}, this);
}

// Property values
private _fullProperty: string = 'default value';
private _minimalProperty: string = '';
private _count: number = 0;
private _active: boolean = false;

// Property getters/setters
get full_property(): string {
return this._fullProperty;
}

set full_property(value: string) {
this._fullProperty = value;
}

get minimal_property(): string {
return this._minimalProperty;
}

set minimal_property(value: string) {
this._minimalProperty = value;
}

get count(): number {
return this._count;
}

set count(value: number) {
this._count = value;
}

get active(): boolean {
return this._active;
}

set active(value: boolean) {
this._active = value;
}
}

// Create and test the object
const obj = new ExampleObject();

// Test property access and type safety
obj.full_property = 'New Value';
obj.minimal_property = 'Test';
obj.count = 42;
obj.active = true;

// Print current values
console.log('Full Property:', obj.full_property);
console.log('Minimal Property:', obj.minimal_property);
console.log('Count:', obj.count);
console.log('Active:', obj.active);

// Get property info using GObject introspection
const properties = ExampleObject.list_properties();

console.log('\nProperty Information:');
for (const pspec of properties) {
console.log(`\nProperty: ${pspec.get_name()}`);
console.log(`Nick: ${pspec.get_nick() || '(null)'}`);
console.log(`Blurb: ${pspec.get_blurb() || '(null)'}`);
}
24 changes: 24 additions & 0 deletions examples/gobject-param-spec/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@ts-for-gir-example/gobject-param-spec",
"version": "4.0.0-beta.19",
"description": "Example demonstrating GObject.ParamSpec with nullable fields",
"type": "module",
"private": true,
"scripts": {
"build:app": "tsc",
"build": "yarn build:app",
"start:app": "gjs -m dist/main.js",
"start": "yarn build && yarn start:app",
"validate": "yarn validate:types",
"validate:types": "tsc --noEmit",
"clear": "rm -rf dist"
},
"devDependencies": {
"typescript": "^5.7.3"
},
"dependencies": {
"@girs/gjs": "workspace:^",
"@girs/glib-2.0": "workspace:^",
"@girs/gobject-2.0": "workspace:^"
}
}
18 changes: 18 additions & 0 deletions examples/gobject-param-spec/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"types": ["@girs/gjs", "@girs/gjs/dom", "@girs/gobject-2.0", "@girs/glib-2.0"],
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"outDir": "./dist"
},
"files": [
"main.ts"
]
}
9 changes: 4 additions & 5 deletions examples/gtk-3-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^9.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
"ts-loader": "^9.5.2",
"typescript": "^5.7.3",
"webpack": "^5.97.1",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@girs/gjs": "workspace:^",
Expand Down
7 changes: 1 addition & 6 deletions examples/gtk-3-browser/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';

export default {
mode: 'production',
entry: ['./main.ts'],
Expand Down Expand Up @@ -35,8 +33,5 @@ export default {
return callback(null, 'module ' +request);
}
callback();
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
],
}
};
Loading

0 comments on commit 1a0e663

Please sign in to comment.