Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/rollup-4.22.4
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink authored Nov 7, 2024
2 parents f49094a + 84baa3a commit 027e892
Show file tree
Hide file tree
Showing 238 changed files with 109,757 additions and 195,946 deletions.
6 changes: 3 additions & 3 deletions .ts-for-gir.packages-gtk4.rc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import gtk4PackagesConfig from './.ts-for-gir.gtk4.rc.js';
import allPackagesConfig from './.ts-for-gir.packages-all.rc.js';

export default {
...gtk4PackagesConfig,
package: true,
...allPackagesConfig,
modules: ['Gtk-4.0', 'Adw-1.0'],
}
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"yoavbls.pretty-ts-errors"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
"cSpell.words": [
"outdir"
]
Expand Down
725 changes: 367 additions & 358 deletions .yarn/releases/yarn-4.5.0.cjs → .yarn/releases/yarn-4.5.1.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 @@ -16,4 +16,4 @@ packageExtensions:
dependencies:
"@parcel/core": "*"

yarnPath: .yarn/releases/yarn-4.5.0.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
27 changes: 12 additions & 15 deletions examples/adw-1-hello/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,22 @@
* @see https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/examples/hello-world/hello.c
*/

import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Gtk from 'gi://Gtk?version=4.0';
import Adw from 'gi://Adw';
import Gio from 'gi://Gio'
import GLib from 'gi://GLib'
import Gtk from 'gi://Gtk?version=4.0'
import Adw from 'gi://Adw'

const loop = GLib.MainLoop.new(null, false)

const app = new Adw.Application({
applicationId: 'com.github.jumplink.gjs.adw-1-hello',
flags: Gio.ApplicationFlags.FLAGS_NONE
});

const onQuit = () => {
loop.quit()
app.quit()
}
flags: Gio.ApplicationFlags.FLAGS_NONE,
})

const onActivate = (app: Adw.Application) => {
// Should support both camelCase and default property names, see https://github.com/gjsify/ts-for-gir/issues/138
const label = new Gtk.Label({
label: "Hello World",
label: 'Hello World',
marginBottom: 11,
marginTop: 11,
})
Expand All @@ -38,12 +33,14 @@ const onActivate = (app: Adw.Application) => {
window.set_title('Hello')
window.set_default_size(200, 200)

window.connect('close-request', onQuit)
window.connect('close-request', () => {
app.quit()
return false
})

window.set_child(label)
window.present()
}

app.connect('activate', onActivate)
app.run([imports.system.programInvocationName].concat(ARGV));
loop.run()
app.run([imports.system.programInvocationName].concat(ARGV))
6 changes: 3 additions & 3 deletions examples/adw-1-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/adw-1-hello-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "Simple GJS Typescript hello-world example using Libadwaita",
"type": "module",
"private": true,
Expand All @@ -18,8 +18,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.2",
"vite": "^5.4.6"
"typescript": "^5.6.3",
"vite": "^5.4.10"
},
"dependencies": {
"@girs/adw-1": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions examples/cairo-surfaces-tsc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/cairo-surfaces-tsc",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "Simple cairo-surfaces GJS example",
"type": "module",
"private": true,
Expand All @@ -18,7 +18,7 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gjs": "workspace:^"
Expand Down
4 changes: 2 additions & 2 deletions examples/console-tsc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/console-tsc",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "Simple console example",
"type": "module",
"private": true,
Expand All @@ -18,7 +18,7 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gjs": "workspace:^"
Expand Down
71 changes: 71 additions & 0 deletions examples/gio-2-async/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import GLib from 'gi://GLib'
import Gio from 'gi://Gio'

// Example demonstrating promisified async file operations

// Promisify Gio.File operations
Gio._promisify(Gio.File.prototype, 'enumerate_children_async', 'enumerate_children_finish')
Gio._promisify(Gio.FileEnumerator.prototype, 'next_files_async', 'next_files_finish')
Gio._promisify(Gio.File.prototype, 'load_contents_async', 'load_contents_finish')

async function main() {
try {
const dir = Gio.File.new_for_path('.')

// Test load_contents_async behavior
console.log('\nTesting load_contents_async:')
const thisFile = Gio.File.new_for_path('main.ts')
const contents = await thisFile.load_contents_async(null)
// contents is [Uint8Array, string], not [boolean, Uint8Array, string]
console.log('Number of returned items:', contents.length)
console.log(
'Types of returned items:',
contents.map((item) => typeof item),
)
console.log('Content preview:', new TextDecoder().decode(contents[0]).slice(0, 50))

// List directory contents asynchronously
const enumerator = await dir.enumerate_children_async(
'standard::*',
Gio.FileQueryInfoFlags.NONE,
GLib.PRIORITY_DEFAULT,
null,
)

while (true) {
// Get next files asynchronously
const files = await enumerator.next_files_async(
10, // Number of files to fetch
GLib.PRIORITY_DEFAULT,
null,
)

if (!files.length) {
break
}

// Process each file info
for (const info of files) {
const name = info.get_name()
const type = info.get_file_type()
const size = info.get_size()

console.log(`${name} (${type === Gio.FileType.DIRECTORY ? 'Directory' : 'File'}, ${size} bytes)`)
}
}
} catch (error) {
console.error('Error:', error)
}

// Required to properly terminate the program
mainLoop.quit()
}

// Create main loop
const mainLoop = new GLib.MainLoop(null, false)

// Start async operation
main()

// Run main loop
mainLoop.run()
23 changes: 23 additions & 0 deletions examples/gio-2-async/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@ts-for-gir-example/gio-2-async",
"version": "4.0.0-beta.18",
"description": "Example demonstrating promisified GIO async operations",
"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.6.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
"@girs/gjs": "workspace:^"
}
}
18 changes: 18 additions & 0 deletions examples/gio-2-async/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/gio-2.0"],
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"outDir": "./dist"
},
"files": [
"main.ts"
]
}
6 changes: 3 additions & 3 deletions examples/gio-2-cat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-cat-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "Simple GJS Gtk 3 example app that shows how to use Gio-2.0 to read a file from the local file system",
"main": "index.js",
"type": "module",
Expand All @@ -19,8 +19,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.23.1",
"typescript": "^5.6.2"
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions examples/gio-2-dbus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-dbus-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "GJS example showing how to build a DBus server/client",
"main": "index.js",
"type": "module",
Expand All @@ -21,8 +21,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.23.1",
"typescript": "^5.6.2"
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions examples/gio-2-list-model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-list-model-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "An example of implementing the GListModel interface in GJS",
"main": "index.js",
"type": "module",
Expand All @@ -19,8 +19,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.23.1",
"typescript": "^5.6.2"
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions examples/glib-2-spawn-command/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-spawn-command-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "",
"type": "module",
"private": true,
Expand All @@ -22,8 +22,8 @@
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^9.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.6.2",
"webpack": "^5.94.0",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/glib-2-variant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-variant-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"description": "ts-for-gir GVariant example based on https://gjs.guide/guides/glib/gvariant.html",
"type": "module",
"private": true,
Expand All @@ -18,8 +18,8 @@
"author": "Pascal Garber <[email protected]>",
"license": "MIT",
"devDependencies": {
"esbuild": "^0.23.1",
"typescript": "^5.6.2"
"esbuild": "^0.24.0",
"typescript": "^5.6.3"
},
"dependencies": {
"@girs/gio-2.0": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions examples/gtk-3-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-browser-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"type": "module",
"private": true,
"scripts": {
Expand All @@ -21,8 +21,8 @@
"devDependencies": {
"fork-ts-checker-webpack-plugin": "^9.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.6.2",
"webpack": "^5.94.0",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/gtk-3-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-builder-example",
"version": "4.0.0-beta.16",
"version": "4.0.0-beta.18",
"type": "module",
"private": true,
"scripts": {
Expand All @@ -22,8 +22,8 @@
"fork-ts-checker-webpack-plugin": "^9.0.2",
"raw-loader": "^4.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.6.2",
"webpack": "^5.94.0",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 027e892

Please sign in to comment.