Delete and ignore node_modules
This commit is contained in:
@@ -43,3 +43,5 @@ msbuild.wrn
|
|||||||
|
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
|
|
||||||
|
generated/ble-unlock\@daniel.demus.dk/node_modules/
|
||||||
|
|||||||
-1
@@ -1 +0,0 @@
|
|||||||
../acorn/bin/acorn
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../esbuild/bin/esbuild
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../nanoid/bin/nanoid.cjs
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../which/bin/node-which
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../rollup/dist/bin/rollup
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsc
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsserver
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../vite/bin/vite.js
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../vite-node/vite-node.mjs
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../vitest/vitest.mjs
|
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
../why-is-node-running/cli.js
|
|
||||||
-3369
File diff suppressed because it is too large
Load Diff
-1
@@ -1 +0,0 @@
|
|||||||
{"version":"1.6.1","results":[[":tests/integration/bleMonitor.test.ts",{"duration":2,"failed":false}],[":tests/unit/thresholds.test.ts",{"duration":2,"failed":false}]]}
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
# esbuild
|
|
||||||
|
|
||||||
This is the Linux ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
|
||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@esbuild/linux-arm64",
|
|
||||||
"version": "0.21.5",
|
|
||||||
"description": "The Linux ARM 64-bit binary for esbuild, a JavaScript bundler.",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/evanw/esbuild.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"preferUnplugged": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
],
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# AccountsService-1.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for AccountsService-1.0, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/accountsservice-1.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import AccountsService from '@girs/accountsservice-1.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/accountsservice-1.0` or `@girs/accountsservice-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/accountsservice-1.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/accountsservice-1.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import AccountsService from 'gi://AccountsService?version=1.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/accountsservice-1.0` or `@girs/accountsservice-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/accountsservice-1.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/accountsservice-1.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const AccountsService = imports.gi.AccountsService;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://AccountsService?version=1.0' {
|
|
||||||
import AccountsService10 from '@girs/accountsservice-1.0';
|
|
||||||
export default AccountsService10;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://AccountsService' {
|
|
||||||
import AccountsService10 from 'gi://AccountsService?version=1.0';
|
|
||||||
export default AccountsService10;
|
|
||||||
}
|
|
||||||
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
import type AccountsService10 from '@girs/accountsservice-1.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
AccountsService: typeof AccountsService10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
-971
@@ -1,971 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import '@girs/gjs';
|
|
||||||
|
|
||||||
// Module dependencies
|
|
||||||
import type Gio from '@girs/gio-2.0';
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
import type GLib from '@girs/glib-2.0';
|
|
||||||
import type GModule from '@girs/gmodule-2.0';
|
|
||||||
|
|
||||||
export namespace AccountsService {
|
|
||||||
/**
|
|
||||||
* AccountsService-1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of user account
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of user account
|
|
||||||
*/
|
|
||||||
export namespace UserAccountType {
|
|
||||||
export const $gtype: GObject.GType<UserAccountType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum UserAccountType {
|
|
||||||
/**
|
|
||||||
* Normal non-administrative user
|
|
||||||
*/
|
|
||||||
STANDARD,
|
|
||||||
/**
|
|
||||||
* Administrative user
|
|
||||||
*/
|
|
||||||
ADMINISTRATOR,
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Various error codes returned by the accounts service.
|
|
||||||
*/
|
|
||||||
class UserManagerError extends GLib.Error {
|
|
||||||
static $gtype: GObject.GType<UserManagerError>;
|
|
||||||
|
|
||||||
// Static fields
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generic failure
|
|
||||||
*/
|
|
||||||
static FAILED: number;
|
|
||||||
/**
|
|
||||||
* The user already exists
|
|
||||||
*/
|
|
||||||
static USER_EXISTS: number;
|
|
||||||
/**
|
|
||||||
* The user does not exist
|
|
||||||
*/
|
|
||||||
static USER_DOES_NOT_EXIST: number;
|
|
||||||
/**
|
|
||||||
* Permission denied
|
|
||||||
*/
|
|
||||||
static PERMISSION_DENIED: number;
|
|
||||||
/**
|
|
||||||
* Operation not supported
|
|
||||||
*/
|
|
||||||
static NOT_SUPPORTED: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(options: { message: string; code: number });
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
|
|
||||||
// Static methods
|
|
||||||
|
|
||||||
static quark(): GLib.Quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mode for setting the user's password.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mode for setting the user's password.
|
|
||||||
*/
|
|
||||||
export namespace UserPasswordMode {
|
|
||||||
export const $gtype: GObject.GType<UserPasswordMode>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum UserPasswordMode {
|
|
||||||
/**
|
|
||||||
* Password set normally
|
|
||||||
*/
|
|
||||||
REGULAR,
|
|
||||||
/**
|
|
||||||
* Password will be chosen at next login
|
|
||||||
*/
|
|
||||||
SET_AT_LOGIN,
|
|
||||||
/**
|
|
||||||
* No password set
|
|
||||||
*/
|
|
||||||
NONE,
|
|
||||||
}
|
|
||||||
function user_manager_error_quark(): GLib.Quark;
|
|
||||||
namespace User {
|
|
||||||
// Signal signatures
|
|
||||||
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
||||||
changed: () => void;
|
|
||||||
'sessions-changed': () => void;
|
|
||||||
'notify::account-type': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::automatic-login': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::email': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::home-directory': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::icon-file': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::is-loaded': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::language': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::local-account': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::location': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::locked': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::login-frequency': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::login-history': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::login-time': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::nonexistent': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::password-hint': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::password-mode': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::real-name': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::shell': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::system-account': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::uid': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::user-name': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::x-session': (pspec: GObject.ParamSpec) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constructor properties interface
|
|
||||||
|
|
||||||
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
||||||
account_type: number;
|
|
||||||
accountType: number;
|
|
||||||
automatic_login: boolean;
|
|
||||||
automaticLogin: boolean;
|
|
||||||
email: string;
|
|
||||||
home_directory: string;
|
|
||||||
homeDirectory: string;
|
|
||||||
icon_file: string;
|
|
||||||
iconFile: string;
|
|
||||||
is_loaded: boolean;
|
|
||||||
isLoaded: boolean;
|
|
||||||
language: string;
|
|
||||||
local_account: boolean;
|
|
||||||
localAccount: boolean;
|
|
||||||
location: string;
|
|
||||||
locked: boolean;
|
|
||||||
login_frequency: number;
|
|
||||||
loginFrequency: number;
|
|
||||||
login_history: GLib.Variant;
|
|
||||||
loginHistory: GLib.Variant;
|
|
||||||
login_time: number;
|
|
||||||
loginTime: number;
|
|
||||||
nonexistent: boolean;
|
|
||||||
password_hint: string;
|
|
||||||
passwordHint: string;
|
|
||||||
password_mode: number;
|
|
||||||
passwordMode: number;
|
|
||||||
real_name: string;
|
|
||||||
realName: string;
|
|
||||||
shell: string;
|
|
||||||
system_account: boolean;
|
|
||||||
systemAccount: boolean;
|
|
||||||
uid: number;
|
|
||||||
user_name: string;
|
|
||||||
userName: string;
|
|
||||||
x_session: string;
|
|
||||||
xSession: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a user account on the system.
|
|
||||||
*/
|
|
||||||
class User extends GObject.Object {
|
|
||||||
static $gtype: GObject.GType<User>;
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
|
|
||||||
get account_type(): number;
|
|
||||||
get accountType(): number;
|
|
||||||
get automatic_login(): boolean;
|
|
||||||
get automaticLogin(): boolean;
|
|
||||||
get email(): string;
|
|
||||||
get home_directory(): string;
|
|
||||||
get homeDirectory(): string;
|
|
||||||
get icon_file(): string;
|
|
||||||
get iconFile(): string;
|
|
||||||
get is_loaded(): boolean;
|
|
||||||
get isLoaded(): boolean;
|
|
||||||
/**
|
|
||||||
* The user’s locale, in the format
|
|
||||||
* `language[_territory][.codeset][`modifier]``, where `language` is an
|
|
||||||
* ISO 639 language code, `territory` is an ISO 3166 country code, and
|
|
||||||
* `codeset` is a character set or encoding identifier like `ISO-8859-1`
|
|
||||||
* or `UTF-8`; as specified by [`setlocale(3)`](man:setlocale(3)).
|
|
||||||
*
|
|
||||||
* The locale may be the empty string, which means the user is using the
|
|
||||||
* system default locale.
|
|
||||||
*
|
|
||||||
* The property may be %NULL if it wasn’t possible to load it from the
|
|
||||||
* daemon.
|
|
||||||
*/
|
|
||||||
get language(): string;
|
|
||||||
get local_account(): boolean;
|
|
||||||
get localAccount(): boolean;
|
|
||||||
get location(): string;
|
|
||||||
get locked(): boolean;
|
|
||||||
get login_frequency(): number;
|
|
||||||
get loginFrequency(): number;
|
|
||||||
get login_history(): GLib.Variant;
|
|
||||||
get loginHistory(): GLib.Variant;
|
|
||||||
get login_time(): number;
|
|
||||||
get loginTime(): number;
|
|
||||||
get nonexistent(): boolean;
|
|
||||||
get password_hint(): string;
|
|
||||||
get passwordHint(): string;
|
|
||||||
get password_mode(): number;
|
|
||||||
get passwordMode(): number;
|
|
||||||
get real_name(): string;
|
|
||||||
get realName(): string;
|
|
||||||
get shell(): string;
|
|
||||||
get system_account(): boolean;
|
|
||||||
get systemAccount(): boolean;
|
|
||||||
get uid(): number;
|
|
||||||
get user_name(): string;
|
|
||||||
get userName(): string;
|
|
||||||
get x_session(): string;
|
|
||||||
get xSession(): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile-time signal type information.
|
|
||||||
*
|
|
||||||
* This instance property is generated only for TypeScript type checking.
|
|
||||||
* It is not defined at runtime and should not be accessed in JS code.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
$signals: User.SignalSignatures;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(properties?: Partial<User.ConstructorProps>, ...args: any[]);
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
|
|
||||||
// Signals
|
|
||||||
|
|
||||||
connect<K extends keyof User.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
callback: GObject.SignalCallback<this, User.SignalSignatures[K]>,
|
|
||||||
): number;
|
|
||||||
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
||||||
connect_after<K extends keyof User.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
callback: GObject.SignalCallback<this, User.SignalSignatures[K]>,
|
|
||||||
): number;
|
|
||||||
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
||||||
emit<K extends keyof User.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
...args: GObject.GjsParameters<User.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
|
|
||||||
): void;
|
|
||||||
emit(signal: string, ...args: any[]): void;
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Organize the user by login frequency and names.
|
|
||||||
* @param user2 a user
|
|
||||||
* @returns negative if @user1 is before @user2, zero if equal or positive if @user1 is after @user2
|
|
||||||
*/
|
|
||||||
collate(user2: User): number;
|
|
||||||
/**
|
|
||||||
* Retrieves the account type of `user`.
|
|
||||||
* @returns a #ActUserAccountType
|
|
||||||
*/
|
|
||||||
get_account_type(): UserAccountType;
|
|
||||||
/**
|
|
||||||
* Returns whether or not #ActUser is automatically logged in at boot time.
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
get_automatic_login(): boolean;
|
|
||||||
/**
|
|
||||||
* Retrieves the email address set by `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_email(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves the home directory for `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_home_dir(): string;
|
|
||||||
/**
|
|
||||||
* Returns the path to the account icon belonging to `user`.
|
|
||||||
* @returns a path to an icon
|
|
||||||
*/
|
|
||||||
get_icon_file(): string;
|
|
||||||
/**
|
|
||||||
* Returns the value of #ActUser:language.
|
|
||||||
* @returns the user’s language, or the empty string if they are using the system default language, or %NULL if there is no connection to the daemon
|
|
||||||
*/
|
|
||||||
get_language(): string | null;
|
|
||||||
/**
|
|
||||||
* Returns the value of #ActUser:languages.
|
|
||||||
* @returns the user’s preferred languages, or the empty string if they are using the system default language, or %NULL if there is no connection to the daemon
|
|
||||||
*/
|
|
||||||
get_languages(): string[] | null;
|
|
||||||
/**
|
|
||||||
* Retrieves the location set by `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_location(): string;
|
|
||||||
/**
|
|
||||||
* Returns whether or not the #ActUser account is locked.
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
get_locked(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns the number of times `user` has logged in.
|
|
||||||
* @returns the login frequency
|
|
||||||
*/
|
|
||||||
get_login_frequency(): number;
|
|
||||||
/**
|
|
||||||
* Returns the login history for `user`.
|
|
||||||
* @returns a pointer to GVariant of type "a(xxa{sv})" which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_login_history(): GLib.Variant;
|
|
||||||
/**
|
|
||||||
* Returns the last login time for `user`.
|
|
||||||
* @returns the login time
|
|
||||||
*/
|
|
||||||
get_login_time(): number;
|
|
||||||
/**
|
|
||||||
* Get the number of sessions for a user that are graphical and on the
|
|
||||||
* same seat as the session of the calling process.
|
|
||||||
* @returns the number of sessions
|
|
||||||
*/
|
|
||||||
get_num_sessions(): number;
|
|
||||||
/**
|
|
||||||
* Get the number of sessions for a user on any seat of any type.
|
|
||||||
* See also act_user_get_num_sessions().
|
|
||||||
*
|
|
||||||
* (Currently, this function is only implemented for systemd-logind.
|
|
||||||
* For ConsoleKit, it is equivalent to act_user_get_num_sessions.)
|
|
||||||
* @returns the number of sessions
|
|
||||||
*/
|
|
||||||
get_num_sessions_anywhere(): number;
|
|
||||||
/**
|
|
||||||
* Returns the user accounts service object path of `user,`
|
|
||||||
* or %NULL if `user` doesn't have an object path associated
|
|
||||||
* with it.
|
|
||||||
* @returns the object path of the user
|
|
||||||
*/
|
|
||||||
get_object_path(): string;
|
|
||||||
/**
|
|
||||||
* Get the password expiration policy for a user.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
*/
|
|
||||||
get_password_expiration_policy(): [number, number, number, number, number, number];
|
|
||||||
/**
|
|
||||||
* Retrieves the password hint set by `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_password_hint(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves the password mode of `user`.
|
|
||||||
* @returns a #ActUserPasswordMode
|
|
||||||
*/
|
|
||||||
get_password_mode(): UserPasswordMode;
|
|
||||||
/**
|
|
||||||
* Returns the id of the primary session of `user,` or %NULL if `user`
|
|
||||||
* has no primary session. The primary session will always be
|
|
||||||
* graphical and will be chosen from the sessions on the same seat as
|
|
||||||
* the seat of the session of the calling process.
|
|
||||||
* @returns the id of the primary session of the user
|
|
||||||
*/
|
|
||||||
get_primary_session_id(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves the display name of `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_real_name(): string;
|
|
||||||
/**
|
|
||||||
* Returns whether or not the #ActUser account has retained state in accountsservice.
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
get_saved(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns the path to the configured session for `user`.
|
|
||||||
* @returns a path to an icon
|
|
||||||
*/
|
|
||||||
get_session(): string;
|
|
||||||
/**
|
|
||||||
* Returns the type of the configured session for `user`.
|
|
||||||
* @returns a path to an icon
|
|
||||||
*/
|
|
||||||
get_session_type(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves the shell assigned to `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_shell(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves the ID of `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_uid(): number;
|
|
||||||
/**
|
|
||||||
* Retrieves the login name of `user`.
|
|
||||||
* @returns a pointer to an array of characters which must not be modified or freed, or %NULL.
|
|
||||||
*/
|
|
||||||
get_user_name(): string;
|
|
||||||
/**
|
|
||||||
* Returns the path to the configured X session for `user`.
|
|
||||||
* @returns a path to an icon
|
|
||||||
*/
|
|
||||||
get_x_session(): string;
|
|
||||||
/**
|
|
||||||
* Retrieves whether the user is a local account or not.
|
|
||||||
* @returns %TRUE if the user is local
|
|
||||||
*/
|
|
||||||
is_local_account(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns whether or not #ActUser is currently graphically logged in
|
|
||||||
* on the same seat as the seat of the session of the calling process.
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
is_logged_in(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns whether or not #ActUser is currently logged in in any way
|
|
||||||
* whatsoever. See also act_user_is_logged_in().
|
|
||||||
*
|
|
||||||
* (Currently, this function is only implemented for systemd-logind.
|
|
||||||
* For ConsoleKit, it is equivalent to act_user_is_logged_in.)
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
is_logged_in_anywhere(): boolean;
|
|
||||||
/**
|
|
||||||
* Retrieves whether the user is nonexistent or not.
|
|
||||||
* @returns %TRUE if the user is nonexistent
|
|
||||||
*/
|
|
||||||
is_nonexistent(): boolean;
|
|
||||||
/**
|
|
||||||
* Returns whether or not #ActUser represents a 'system account' like
|
|
||||||
* 'root' or 'nobody'.
|
|
||||||
* @returns %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
is_system_account(): boolean;
|
|
||||||
/**
|
|
||||||
* Changes the account type of `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param account_type a #ActUserAccountType
|
|
||||||
*/
|
|
||||||
set_account_type(account_type: UserAccountType | null): void;
|
|
||||||
/**
|
|
||||||
* If enabled is set to %TRUE then this user will automatically be logged in
|
|
||||||
* at boot up time. Only one user can be configured to auto login at any given
|
|
||||||
* time, so subsequent calls to act_user_set_automatic_login() override previous
|
|
||||||
* calls.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param enabled whether or not to autologin for user.
|
|
||||||
*/
|
|
||||||
set_automatic_login(enabled: boolean): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new email to `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param email an email address
|
|
||||||
*/
|
|
||||||
set_email(email: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new icon for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param icon_file path to an icon
|
|
||||||
*/
|
|
||||||
set_icon_file(icon_file: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new locale for `user,` setting #ActUser:language.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param language a locale (for example, `en_US.utf8`), or the empty string to use the system default locale
|
|
||||||
*/
|
|
||||||
set_language(language: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns preferred languages for `user,` setting #ActUser:languages, and
|
|
||||||
* overriding #ActUser:language with the first item in the list if there is one.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param languages an array of locale (for example, `en_US.utf8`), or the empty string to use the system default locale
|
|
||||||
*/
|
|
||||||
set_languages(languages: string[]): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new location for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param location a location
|
|
||||||
*/
|
|
||||||
set_location(location: string): void;
|
|
||||||
/**
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param locked whether or not the account is locked
|
|
||||||
*/
|
|
||||||
set_locked(locked: boolean): void;
|
|
||||||
/**
|
|
||||||
* Changes the password of `user` to `password`.
|
|
||||||
* `hint` is displayed to the user if they forget the password.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param password a password
|
|
||||||
* @param hint a hint to help user recall password
|
|
||||||
*/
|
|
||||||
set_password(password: string, hint: string): void;
|
|
||||||
/**
|
|
||||||
* Set the password expiration policy for a user.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param min_days_between_changes location to write minimum number of days needed between password changes.
|
|
||||||
* @param max_days_between_changes location to write maximum number of days password can stay unchanged.
|
|
||||||
* @param days_to_warn location to write number of days to warn user password is about to expire.
|
|
||||||
* @param days_after_expiration_until_lock location to write number of days account will be locked after password expires.
|
|
||||||
*/
|
|
||||||
set_password_expiration_policy(
|
|
||||||
min_days_between_changes: number,
|
|
||||||
max_days_between_changes: number,
|
|
||||||
days_to_warn: number,
|
|
||||||
days_after_expiration_until_lock: number,
|
|
||||||
): void;
|
|
||||||
set_password_hint(hint: string): void;
|
|
||||||
/**
|
|
||||||
* Changes the password of `user`. If `password_mode` is
|
|
||||||
* ACT_USER_PASSWORD_MODE_SET_AT_LOGIN then the user will
|
|
||||||
* be asked for a new password at the next login. If `password_mode`
|
|
||||||
* is ACT_USER_PASSWORD_MODE_NONE then the user will not require
|
|
||||||
* a password to log in.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param password_mode a #ActUserPasswordMode
|
|
||||||
*/
|
|
||||||
set_password_mode(password_mode: UserPasswordMode | null): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new name for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param real_name a new name
|
|
||||||
*/
|
|
||||||
set_real_name(real_name: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new session for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param session a session (e.g. gnome)
|
|
||||||
*/
|
|
||||||
set_session(session: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns a type to the session for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param session_type a type of session (e.g. "wayland" or "x11")
|
|
||||||
*/
|
|
||||||
set_session_type(session_type: string): void;
|
|
||||||
/**
|
|
||||||
* Set the user expiration policy for a user.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param expiration_time location to write users expires timestamp
|
|
||||||
*/
|
|
||||||
set_user_expiration_policy(expiration_time: number): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new username for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param user_name a new user name
|
|
||||||
*/
|
|
||||||
set_user_name(user_name: string): void;
|
|
||||||
/**
|
|
||||||
* Assigns a new x session for `user`.
|
|
||||||
*
|
|
||||||
* Note this function is synchronous and ignores errors.
|
|
||||||
* @param x_session an x session (e.g. gnome)
|
|
||||||
*/
|
|
||||||
set_x_session(x_session: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace UserManager {
|
|
||||||
// Signal signatures
|
|
||||||
interface SignalSignatures extends GObject.Object.SignalSignatures {
|
|
||||||
'user-added': (arg0: User) => void;
|
|
||||||
'user-changed': (arg0: User) => void;
|
|
||||||
'user-is-logged-in-changed': (arg0: User) => void;
|
|
||||||
'user-removed': (arg0: User) => void;
|
|
||||||
'notify::exclude-usernames-list': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::has-multiple-users': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::include-usernames-list': (pspec: GObject.ParamSpec) => void;
|
|
||||||
'notify::is-loaded': (pspec: GObject.ParamSpec) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constructor properties interface
|
|
||||||
|
|
||||||
interface ConstructorProps extends GObject.Object.ConstructorProps {
|
|
||||||
exclude_usernames_list: any;
|
|
||||||
excludeUsernamesList: any;
|
|
||||||
has_multiple_users: boolean;
|
|
||||||
hasMultipleUsers: boolean;
|
|
||||||
include_usernames_list: any;
|
|
||||||
includeUsernamesList: any;
|
|
||||||
is_loaded: boolean;
|
|
||||||
isLoaded: boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A user manager object.
|
|
||||||
*/
|
|
||||||
class UserManager extends GObject.Object {
|
|
||||||
static $gtype: GObject.GType<UserManager>;
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
|
|
||||||
get exclude_usernames_list(): any;
|
|
||||||
set exclude_usernames_list(val: any);
|
|
||||||
get excludeUsernamesList(): any;
|
|
||||||
set excludeUsernamesList(val: any);
|
|
||||||
get has_multiple_users(): boolean;
|
|
||||||
set has_multiple_users(val: boolean);
|
|
||||||
get hasMultipleUsers(): boolean;
|
|
||||||
set hasMultipleUsers(val: boolean);
|
|
||||||
get include_usernames_list(): any;
|
|
||||||
set include_usernames_list(val: any);
|
|
||||||
get includeUsernamesList(): any;
|
|
||||||
set includeUsernamesList(val: any);
|
|
||||||
get is_loaded(): boolean;
|
|
||||||
get isLoaded(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile-time signal type information.
|
|
||||||
*
|
|
||||||
* This instance property is generated only for TypeScript type checking.
|
|
||||||
* It is not defined at runtime and should not be accessed in JS code.
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
$signals: UserManager.SignalSignatures;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(properties?: Partial<UserManager.ConstructorProps>, ...args: any[]);
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
|
|
||||||
// Signals
|
|
||||||
|
|
||||||
connect<K extends keyof UserManager.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
callback: GObject.SignalCallback<this, UserManager.SignalSignatures[K]>,
|
|
||||||
): number;
|
|
||||||
connect(signal: string, callback: (...args: any[]) => any): number;
|
|
||||||
connect_after<K extends keyof UserManager.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
callback: GObject.SignalCallback<this, UserManager.SignalSignatures[K]>,
|
|
||||||
): number;
|
|
||||||
connect_after(signal: string, callback: (...args: any[]) => any): number;
|
|
||||||
emit<K extends keyof UserManager.SignalSignatures>(
|
|
||||||
signal: K,
|
|
||||||
...args: GObject.GjsParameters<UserManager.SignalSignatures[K]> extends [any, ...infer Q] ? Q : never
|
|
||||||
): void;
|
|
||||||
emit(signal: string, ...args: any[]): void;
|
|
||||||
|
|
||||||
// Static methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the user manager singleton instance. Calling this function will
|
|
||||||
* automatically being loading the user list if it isn't loaded already.
|
|
||||||
* The #ActUserManager:is-loaded property will be set to %TRUE when the users
|
|
||||||
* are finished loading and then act_user_manager_list_users() can be called.
|
|
||||||
*/
|
|
||||||
static get_default(): UserManager;
|
|
||||||
|
|
||||||
// Virtual methods
|
|
||||||
|
|
||||||
vfunc_user_added(user: User): void;
|
|
||||||
vfunc_user_changed(user: User): void;
|
|
||||||
vfunc_user_is_logged_in_changed(user: User): void;
|
|
||||||
vfunc_user_removed(user: User): void;
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate the session for a given user.
|
|
||||||
* @param user the user to activate
|
|
||||||
* @returns whether successfully activated
|
|
||||||
*/
|
|
||||||
activate_user_session(user: User): boolean;
|
|
||||||
/**
|
|
||||||
* Caches a user account so it shows up via act_user_manager_list_users().
|
|
||||||
* @param username a user name
|
|
||||||
* @returns user object
|
|
||||||
*/
|
|
||||||
cache_user(username: string): User;
|
|
||||||
/**
|
|
||||||
* Asynchronously caches a user account so it shows up via
|
|
||||||
* act_user_manager_list_users().
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_cache_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
*/
|
|
||||||
cache_user_async(username: string, cancellable?: Gio.Cancellable | null): globalThis.Promise<User>;
|
|
||||||
/**
|
|
||||||
* Asynchronously caches a user account so it shows up via
|
|
||||||
* act_user_manager_list_users().
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_cache_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
cache_user_async(
|
|
||||||
username: string,
|
|
||||||
cancellable: Gio.Cancellable | null,
|
|
||||||
callback: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): void;
|
|
||||||
/**
|
|
||||||
* Asynchronously caches a user account so it shows up via
|
|
||||||
* act_user_manager_list_users().
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_cache_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
cache_user_async(
|
|
||||||
username: string,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): globalThis.Promise<User> | void;
|
|
||||||
/**
|
|
||||||
* Finishes an asynchronous user caching.
|
|
||||||
*
|
|
||||||
* See act_user_manager_cache_user_async().
|
|
||||||
* @param result a #GAsyncResult
|
|
||||||
* @returns user object
|
|
||||||
*/
|
|
||||||
cache_user_finish(result: Gio.AsyncResult): User;
|
|
||||||
/**
|
|
||||||
* Check whether the user can switch to another session.
|
|
||||||
* @returns whether we can switch to another session
|
|
||||||
*/
|
|
||||||
can_switch(): boolean;
|
|
||||||
/**
|
|
||||||
* Creates a user account on the system.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param fullname a unix GECOS value
|
|
||||||
* @param accounttype a #ActUserAccountType
|
|
||||||
* @returns user object
|
|
||||||
*/
|
|
||||||
create_user(username: string, fullname: string, accounttype: UserAccountType | null): User;
|
|
||||||
/**
|
|
||||||
* Asynchronously creates a user account on the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_create_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param fullname a unix GECOS value
|
|
||||||
* @param accounttype a #ActUserAccountType
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
*/
|
|
||||||
create_user_async(
|
|
||||||
username: string,
|
|
||||||
fullname: string,
|
|
||||||
accounttype: UserAccountType | null,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
): globalThis.Promise<User>;
|
|
||||||
/**
|
|
||||||
* Asynchronously creates a user account on the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_create_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param fullname a unix GECOS value
|
|
||||||
* @param accounttype a #ActUserAccountType
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
create_user_async(
|
|
||||||
username: string,
|
|
||||||
fullname: string,
|
|
||||||
accounttype: UserAccountType | null,
|
|
||||||
cancellable: Gio.Cancellable | null,
|
|
||||||
callback: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): void;
|
|
||||||
/**
|
|
||||||
* Asynchronously creates a user account on the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_create_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param username a unix user name
|
|
||||||
* @param fullname a unix GECOS value
|
|
||||||
* @param accounttype a #ActUserAccountType
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
create_user_async(
|
|
||||||
username: string,
|
|
||||||
fullname: string,
|
|
||||||
accounttype: UserAccountType | null,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): globalThis.Promise<User> | void;
|
|
||||||
/**
|
|
||||||
* Finishes an asynchronous user creation.
|
|
||||||
*
|
|
||||||
* See act_user_manager_create_user_async().
|
|
||||||
* @param result a #GAsyncResult
|
|
||||||
* @returns user object
|
|
||||||
*/
|
|
||||||
create_user_finish(result: Gio.AsyncResult): User;
|
|
||||||
/**
|
|
||||||
* Deletes a user account on the system.
|
|
||||||
* @param user an #ActUser object
|
|
||||||
* @param remove_files %TRUE to delete the users home directory
|
|
||||||
* @returns %TRUE if the user account was successfully deleted
|
|
||||||
*/
|
|
||||||
delete_user(user: User, remove_files: boolean): boolean;
|
|
||||||
/**
|
|
||||||
* Asynchronously deletes a user account from the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_delete_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param user a #ActUser object
|
|
||||||
* @param remove_files %TRUE to delete the users home directory
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
*/
|
|
||||||
delete_user_async(
|
|
||||||
user: User,
|
|
||||||
remove_files: boolean,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
): globalThis.Promise<boolean>;
|
|
||||||
/**
|
|
||||||
* Asynchronously deletes a user account from the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_delete_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param user a #ActUser object
|
|
||||||
* @param remove_files %TRUE to delete the users home directory
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
delete_user_async(
|
|
||||||
user: User,
|
|
||||||
remove_files: boolean,
|
|
||||||
cancellable: Gio.Cancellable | null,
|
|
||||||
callback: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): void;
|
|
||||||
/**
|
|
||||||
* Asynchronously deletes a user account from the system.
|
|
||||||
*
|
|
||||||
* For more details, see act_user_manager_delete_user(), which
|
|
||||||
* is the synchronous version of this call.
|
|
||||||
* @param user a #ActUser object
|
|
||||||
* @param remove_files %TRUE to delete the users home directory
|
|
||||||
* @param cancellable optional #GCancellable object, %NULL to ignore
|
|
||||||
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
|
|
||||||
*/
|
|
||||||
delete_user_async(
|
|
||||||
user: User,
|
|
||||||
remove_files: boolean,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): globalThis.Promise<boolean> | void;
|
|
||||||
/**
|
|
||||||
* Finishes an asynchronous user account deletion.
|
|
||||||
*
|
|
||||||
* See act_user_manager_delete_user_async().
|
|
||||||
* @param result a #GAsyncResult
|
|
||||||
* @returns %TRUE if the user account was successfully deleted
|
|
||||||
*/
|
|
||||||
delete_user_finish(result: Gio.AsyncResult): boolean;
|
|
||||||
/**
|
|
||||||
* Retrieves a pointer to the #ActUser object for the login `username`
|
|
||||||
* from `manager`. Trying to use this object before its
|
|
||||||
* #ActUser:is-loaded property is %TRUE will result in undefined
|
|
||||||
* behavior.
|
|
||||||
* @param username the login name of the user to get.
|
|
||||||
* @returns #ActUser object
|
|
||||||
*/
|
|
||||||
get_user(username: string): User;
|
|
||||||
/**
|
|
||||||
* Retrieves a pointer to the #ActUser object for the user with the
|
|
||||||
* given uid from `manager`. Trying to use this object before its
|
|
||||||
* #ActUser:is-loaded property is %TRUE will result in undefined
|
|
||||||
* behavior.
|
|
||||||
* @param id the uid of the user to get.
|
|
||||||
* @returns #ActUser object
|
|
||||||
*/
|
|
||||||
get_user_by_id(id: number): User;
|
|
||||||
/**
|
|
||||||
* Switch the display to the login manager.
|
|
||||||
* @returns whether successful or not
|
|
||||||
*/
|
|
||||||
goto_login_session(): boolean;
|
|
||||||
/**
|
|
||||||
* Get a list of system user accounts
|
|
||||||
* @returns List of #ActUser objects
|
|
||||||
*/
|
|
||||||
list_users(): User[];
|
|
||||||
/**
|
|
||||||
* Check whether or not the accounts service is running.
|
|
||||||
* @returns whether or not accounts service is running
|
|
||||||
*/
|
|
||||||
no_service(): boolean;
|
|
||||||
/**
|
|
||||||
* Releases all metadata about a user account, including icon,
|
|
||||||
* language and session. If the user account is from a remote
|
|
||||||
* server and the user has never logged in before, then that
|
|
||||||
* account will no longer show up in ListCachedUsers() output.
|
|
||||||
* @param username a user name
|
|
||||||
* @returns %TRUE if successful, otherwise %FALSE
|
|
||||||
*/
|
|
||||||
uncache_user(username: string): boolean;
|
|
||||||
uncache_user_async(username: string, cancellable?: Gio.Cancellable | null): globalThis.Promise<boolean>;
|
|
||||||
uncache_user_async(
|
|
||||||
username: string,
|
|
||||||
cancellable: Gio.Cancellable | null,
|
|
||||||
callback: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): void;
|
|
||||||
uncache_user_async(
|
|
||||||
username: string,
|
|
||||||
cancellable?: Gio.Cancellable | null,
|
|
||||||
callback?: Gio.AsyncReadyCallback<this> | null,
|
|
||||||
): globalThis.Promise<boolean> | void;
|
|
||||||
/**
|
|
||||||
* Finishes an asynchronous user uncaching.
|
|
||||||
*
|
|
||||||
* See act_user_manager_uncache_user_async().
|
|
||||||
* @param result a #GAsyncResult
|
|
||||||
* @returns %TRUE if the user account was successfully uncached
|
|
||||||
*/
|
|
||||||
uncache_user_finish(result: Gio.AsyncResult): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserClass = typeof User;
|
|
||||||
type UserManagerClass = typeof UserManager;
|
|
||||||
/**
|
|
||||||
* Name of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
||||||
*/
|
|
||||||
const __name__: string;
|
|
||||||
/**
|
|
||||||
* Version of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
||||||
*/
|
|
||||||
const __version__: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AccountsService;
|
|
||||||
|
|
||||||
// END
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import AccountsService from 'gi://AccountsService?version=1.0';
|
|
||||||
export default AccountsService;
|
|
||||||
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './accountsservice-1.0-ambient.d.ts';
|
|
||||||
|
|
||||||
import './accountsservice-1.0-import.d.ts';
|
|
||||||
|
|
||||||
import AccountsService from './accountsservice-1.0.js';
|
|
||||||
export default AccountsService;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import AccountsService from './accountsservice-1.0.js';
|
|
||||||
export default AccountsService;
|
|
||||||
|
|
||||||
Generated
Vendored
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# cairo-1.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for cairo-1.0, generated from library version 1.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/cairo-1.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import cairo from '@girs/cairo-1.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/cairo-1.0` or `@girs/cairo-1.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/cairo-1.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/cairo-1.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import cairo from 'gi://cairo?version=1.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/cairo-1.0` or `@girs/cairo-1.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/cairo-1.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/cairo-1.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const cairo = imports.gi.cairo;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
generated/node_modules/@girs/accountsservice-1.0/node_modules/@girs/cairo-1.0/cairo-1.0-ambient.d.ts
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://cairo?version=1.0' {
|
|
||||||
import Cairo10 from '@girs/cairo-1.0';
|
|
||||||
export default Cairo10;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://cairo' {
|
|
||||||
import Cairo10 from 'gi://cairo?version=1.0';
|
|
||||||
export default Cairo10;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
import type Cairo10 from '@girs/cairo-1.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
cairo: typeof Cairo10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
Generated
Vendored
-529
@@ -1,529 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import '@girs/gjs';
|
|
||||||
|
|
||||||
// Module dependencies
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
import type GLib from '@girs/glib-2.0';
|
|
||||||
|
|
||||||
export namespace cairo {
|
|
||||||
/**
|
|
||||||
* cairo-1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
export namespace Status {
|
|
||||||
export const $gtype: GObject.GType<Status>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Status {
|
|
||||||
SUCCESS,
|
|
||||||
NO_MEMORY,
|
|
||||||
INVALID_RESTORE,
|
|
||||||
INVALID_POP_GROUP,
|
|
||||||
NO_CURRENT_POINT,
|
|
||||||
INVALID_MATRIX,
|
|
||||||
INVALID_STATUS,
|
|
||||||
NULL_POINTER,
|
|
||||||
INVALID_STRING,
|
|
||||||
INVALID_PATH_DATA,
|
|
||||||
READ_ERROR,
|
|
||||||
WRITE_ERROR,
|
|
||||||
SURFACE_FINISHED,
|
|
||||||
SURFACE_TYPE_MISMATCH,
|
|
||||||
PATTERN_TYPE_MISMATCH,
|
|
||||||
INVALID_CONTENT,
|
|
||||||
INVALID_FORMAT,
|
|
||||||
INVALID_VISUAL,
|
|
||||||
FILE_NOT_FOUND,
|
|
||||||
INVALID_DASH,
|
|
||||||
INVALID_DSC_COMMENT,
|
|
||||||
INVALID_INDEX,
|
|
||||||
CLIP_NOT_REPRESENTABLE,
|
|
||||||
TEMP_FILE_ERROR,
|
|
||||||
INVALID_STRIDE,
|
|
||||||
FONT_TYPE_MISMATCH,
|
|
||||||
USER_FONT_IMMUTABLE,
|
|
||||||
USER_FONT_ERROR,
|
|
||||||
NEGATIVE_COUNT,
|
|
||||||
INVALID_CLUSTERS,
|
|
||||||
INVALID_SLANT,
|
|
||||||
INVALID_WEIGHT,
|
|
||||||
INVALID_SIZE,
|
|
||||||
USER_FONT_NOT_IMPLEMENTED,
|
|
||||||
DEVICE_TYPE_MISMATCH,
|
|
||||||
DEVICE_ERROR,
|
|
||||||
INVALID_MESH_CONSTRUCTION,
|
|
||||||
DEVICE_FINISHED,
|
|
||||||
JBIG2_GLOBAL_MISSING,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Content {
|
|
||||||
export const $gtype: GObject.GType<Content>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Content {
|
|
||||||
COLOR,
|
|
||||||
ALPHA,
|
|
||||||
COLOR_ALPHA,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Operator {
|
|
||||||
export const $gtype: GObject.GType<Operator>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Operator {
|
|
||||||
CLEAR,
|
|
||||||
SOURCE,
|
|
||||||
OVER,
|
|
||||||
IN,
|
|
||||||
OUT,
|
|
||||||
ATOP,
|
|
||||||
DEST,
|
|
||||||
DEST_OVER,
|
|
||||||
DEST_IN,
|
|
||||||
DEST_OUT,
|
|
||||||
DEST_ATOP,
|
|
||||||
XOR,
|
|
||||||
ADD,
|
|
||||||
SATURATE,
|
|
||||||
MULTIPLY,
|
|
||||||
SCREEN,
|
|
||||||
OVERLAY,
|
|
||||||
DARKEN,
|
|
||||||
LIGHTEN,
|
|
||||||
COLOR_DODGE,
|
|
||||||
COLOR_BURN,
|
|
||||||
HARD_LIGHT,
|
|
||||||
SOFT_LIGHT,
|
|
||||||
DIFFERENCE,
|
|
||||||
EXCLUSION,
|
|
||||||
HSL_HUE,
|
|
||||||
HSL_SATURATION,
|
|
||||||
HSL_COLOR,
|
|
||||||
HSL_LUMINOSITY,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Antialias {
|
|
||||||
export const $gtype: GObject.GType<Antialias>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Antialias {
|
|
||||||
DEFAULT,
|
|
||||||
NONE,
|
|
||||||
GRAY,
|
|
||||||
SUBPIXEL,
|
|
||||||
FAST,
|
|
||||||
GOOD,
|
|
||||||
BEST,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace FillRule {
|
|
||||||
export const $gtype: GObject.GType<FillRule>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FillRule {
|
|
||||||
WINDING,
|
|
||||||
EVEN_ODD,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace LineCap {
|
|
||||||
export const $gtype: GObject.GType<LineCap>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum LineCap {
|
|
||||||
BUTT,
|
|
||||||
ROUND,
|
|
||||||
SQUARE,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace LineJoin {
|
|
||||||
export const $gtype: GObject.GType<LineJoin>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum LineJoin {
|
|
||||||
MITER,
|
|
||||||
ROUND,
|
|
||||||
BEVEL,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace TextClusterFlags {
|
|
||||||
export const $gtype: GObject.GType<TextClusterFlags>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum TextClusterFlags {
|
|
||||||
BACKWARD,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace FontSlant {
|
|
||||||
export const $gtype: GObject.GType<FontSlant>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FontSlant {
|
|
||||||
NORMAL,
|
|
||||||
ITALIC,
|
|
||||||
OBLIQUE,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace FontWeight {
|
|
||||||
export const $gtype: GObject.GType<FontWeight>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FontWeight {
|
|
||||||
NORMAL,
|
|
||||||
BOLD,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace SubpixelOrder {
|
|
||||||
export const $gtype: GObject.GType<SubpixelOrder>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum SubpixelOrder {
|
|
||||||
DEFAULT,
|
|
||||||
RGB,
|
|
||||||
BGR,
|
|
||||||
VRGB,
|
|
||||||
VBGR,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace HintStyle {
|
|
||||||
export const $gtype: GObject.GType<HintStyle>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum HintStyle {
|
|
||||||
DEFAULT,
|
|
||||||
NONE,
|
|
||||||
SLIGHT,
|
|
||||||
MEDIUM,
|
|
||||||
FULL,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace HintMetrics {
|
|
||||||
export const $gtype: GObject.GType<HintMetrics>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum HintMetrics {
|
|
||||||
DEFAULT,
|
|
||||||
OFF,
|
|
||||||
ON,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace FontType {
|
|
||||||
export const $gtype: GObject.GType<FontType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FontType {
|
|
||||||
TOY,
|
|
||||||
FT,
|
|
||||||
WIN32,
|
|
||||||
QUARTZ,
|
|
||||||
USER,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace PathDataType {
|
|
||||||
export const $gtype: GObject.GType<PathDataType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum PathDataType {
|
|
||||||
MOVE_TO,
|
|
||||||
LINE_TO,
|
|
||||||
CURVE_TO,
|
|
||||||
CLOSE_PATH,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace DeviceType {
|
|
||||||
export const $gtype: GObject.GType<DeviceType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum DeviceType {
|
|
||||||
DRM,
|
|
||||||
GL,
|
|
||||||
SCRIPT,
|
|
||||||
XCB,
|
|
||||||
XLIB,
|
|
||||||
XML,
|
|
||||||
COGL,
|
|
||||||
WIN32,
|
|
||||||
INVALID,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace SurfaceType {
|
|
||||||
export const $gtype: GObject.GType<SurfaceType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum SurfaceType {
|
|
||||||
IMAGE,
|
|
||||||
PDF,
|
|
||||||
PS,
|
|
||||||
XLIB,
|
|
||||||
XCB,
|
|
||||||
GLITZ,
|
|
||||||
QUARTZ,
|
|
||||||
WIN32,
|
|
||||||
BEOS,
|
|
||||||
DIRECTFB,
|
|
||||||
SVG,
|
|
||||||
OS2,
|
|
||||||
WIN32_PRINTING,
|
|
||||||
QUARTZ_IMAGE,
|
|
||||||
SCRIPT,
|
|
||||||
QT,
|
|
||||||
RECORDING,
|
|
||||||
VG,
|
|
||||||
GL,
|
|
||||||
DRM,
|
|
||||||
TEE,
|
|
||||||
XML,
|
|
||||||
SKIA,
|
|
||||||
SUBSURFACE,
|
|
||||||
COGL,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Format {
|
|
||||||
export const $gtype: GObject.GType<Format>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Format {
|
|
||||||
INVALID,
|
|
||||||
ARGB32,
|
|
||||||
RGB24,
|
|
||||||
A8,
|
|
||||||
A1,
|
|
||||||
RGB16_565,
|
|
||||||
RGB30,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace PatternType {
|
|
||||||
export const $gtype: GObject.GType<PatternType>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum PatternType {
|
|
||||||
SOLID,
|
|
||||||
SURFACE,
|
|
||||||
LINEAR,
|
|
||||||
RADIAL,
|
|
||||||
MESH,
|
|
||||||
RASTER_SOURCE,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Extend {
|
|
||||||
export const $gtype: GObject.GType<Extend>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Extend {
|
|
||||||
NONE,
|
|
||||||
REPEAT,
|
|
||||||
REFLECT,
|
|
||||||
PAD,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Filter {
|
|
||||||
export const $gtype: GObject.GType<Filter>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Filter {
|
|
||||||
FAST,
|
|
||||||
GOOD,
|
|
||||||
BEST,
|
|
||||||
NEAREST,
|
|
||||||
BILINEAR,
|
|
||||||
GAUSSIAN,
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace RegionOverlap {
|
|
||||||
export const $gtype: GObject.GType<RegionOverlap>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum RegionOverlap {
|
|
||||||
IN,
|
|
||||||
OUT,
|
|
||||||
PART,
|
|
||||||
}
|
|
||||||
function image_surface_create(): void;
|
|
||||||
class Context {
|
|
||||||
static $gtype: GObject.GType<Context>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Device {
|
|
||||||
static $gtype: GObject.GType<Device>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Surface {
|
|
||||||
static $gtype: GObject.GType<Surface>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Matrix {
|
|
||||||
static $gtype: GObject.GType<Matrix>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Pattern {
|
|
||||||
static $gtype: GObject.GType<Pattern>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Region {
|
|
||||||
static $gtype: GObject.GType<Region>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class FontOptions {
|
|
||||||
static $gtype: GObject.GType<FontOptions>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class FontFace {
|
|
||||||
static $gtype: GObject.GType<FontFace>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ScaledFont {
|
|
||||||
static $gtype: GObject.GType<ScaledFont>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Path {
|
|
||||||
static $gtype: GObject.GType<Path>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Rectangle {
|
|
||||||
static $gtype: GObject.GType<Rectangle>;
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
properties?: Partial<{
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}>,
|
|
||||||
);
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RectangleInt {
|
|
||||||
static $gtype: GObject.GType<RectangleInt>;
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
properties?: Partial<{
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}>,
|
|
||||||
);
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Glyph {
|
|
||||||
static $gtype: GObject.GType<Glyph>;
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
index: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
properties?: Partial<{
|
|
||||||
index: number;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}>,
|
|
||||||
);
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TextCluster {
|
|
||||||
static $gtype: GObject.GType<TextCluster>;
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
num_bytes: number;
|
|
||||||
num_glyphs: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
properties?: Partial<{
|
|
||||||
num_bytes: number;
|
|
||||||
num_glyphs: number;
|
|
||||||
}>,
|
|
||||||
);
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
||||||
*/
|
|
||||||
const __name__: string;
|
|
||||||
/**
|
|
||||||
* Version of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
||||||
*/
|
|
||||||
const __version__: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default cairo;
|
|
||||||
|
|
||||||
// END
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import cairo from 'gi://cairo?version=1.0';
|
|
||||||
export default cairo;
|
|
||||||
|
|
||||||
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './cairo-1.0-ambient.d.ts';
|
|
||||||
|
|
||||||
import './cairo-1.0-import.d.ts';
|
|
||||||
|
|
||||||
import cairo from './cairo-1.0.js';
|
|
||||||
export default cairo;
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import cairo from './cairo-1.0.js';
|
|
||||||
export default cairo;
|
|
||||||
|
|
||||||
Generated
Vendored
-53
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@girs/cairo-1.0",
|
|
||||||
"version": "1.0.0-4.0.0-beta.38",
|
|
||||||
"description": "GJS TypeScript type definitions for cairo-1.0, generated from library version 1.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"module": "cairo-1.0.js",
|
|
||||||
"main": "cairo-1.0.js",
|
|
||||||
"exports": {
|
|
||||||
"./ambient": {
|
|
||||||
"types": "./cairo-1.0-ambient.d.ts",
|
|
||||||
"import": "./cairo-1.0-ambient.js",
|
|
||||||
"default": "./cairo-1.0-ambient.js"
|
|
||||||
},
|
|
||||||
"./import": {
|
|
||||||
"types": "./cairo-1.0-import.d.ts",
|
|
||||||
"import": "./cairo-1.0-import.js",
|
|
||||||
"default": "./cairo-1.0-import.js"
|
|
||||||
},
|
|
||||||
"./cairo-1.0": {
|
|
||||||
"types": "./cairo-1.0.d.ts",
|
|
||||||
"import": "./cairo-1.0.js",
|
|
||||||
"default": "./cairo-1.0.js"
|
|
||||||
},
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js",
|
|
||||||
"default": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tsc --project tsconfig.json"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@girs/gjs": "4.0.0-beta.38",
|
|
||||||
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/glib-2.0": "2.86.0-4.0.0-beta.38" },
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "*"
|
|
||||||
},
|
|
||||||
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "cairo-1.0"],
|
|
||||||
"author": "ts-for-gir",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gjsify/types.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/gjsify/types/tree/main/cairo-1.0#readme"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// General settings for code interpretation
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": [],
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"rootDir": ".",
|
|
||||||
// General settings for code generation
|
|
||||||
"removeComments": false,
|
|
||||||
"inlineSourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"newLine": "LF",
|
|
||||||
// Show diagnostics
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": ["./cairo-1.0.d.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPoints": ["./cairo-1.0.d.ts"],
|
|
||||||
"readme": "./README.md",
|
|
||||||
"name": "cairo-1.0",
|
|
||||||
"tsconfig": "./tsconfig.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
Generated
Vendored
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# Gio-2.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for Gio-2.0, generated from library version 2.86.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/gio-2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import Gio from '@girs/gio-2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/gio-2.0` or `@girs/gio-2.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gio-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gio-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import Gio from 'gi://Gio?version=2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/gio-2.0` or `@girs/gio-2.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gio-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gio-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const Gio = imports.gi.Gio;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://Gio?version=2.0' {
|
|
||||||
import Gio20 from '@girs/gio-2.0';
|
|
||||||
export default Gio20;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://Gio' {
|
|
||||||
import Gio20 from 'gi://Gio?version=2.0';
|
|
||||||
export default Gio20;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
import type Gio20 from '@girs/gio-2.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
Gio: typeof Gio20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
Generated
Vendored
-87760
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import Gio from 'gi://Gio?version=2.0';
|
|
||||||
export default Gio;
|
|
||||||
|
|
||||||
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './gio-2.0-ambient.d.ts';
|
|
||||||
|
|
||||||
import './gio-2.0-import.d.ts';
|
|
||||||
|
|
||||||
import Gio from './gio-2.0.js';
|
|
||||||
export default Gio;
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import Gio from './gio-2.0.js';
|
|
||||||
export default Gio;
|
|
||||||
|
|
||||||
Generated
Vendored
-54
@@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@girs/gio-2.0",
|
|
||||||
"version": "2.86.0-4.0.0-beta.38",
|
|
||||||
"description": "GJS TypeScript type definitions for Gio-2.0, generated from library version 2.86.0",
|
|
||||||
"type": "module",
|
|
||||||
"module": "gio-2.0.js",
|
|
||||||
"main": "gio-2.0.js",
|
|
||||||
"exports": {
|
|
||||||
"./ambient": {
|
|
||||||
"types": "./gio-2.0-ambient.d.ts",
|
|
||||||
"import": "./gio-2.0-ambient.js",
|
|
||||||
"default": "./gio-2.0-ambient.js"
|
|
||||||
},
|
|
||||||
"./import": {
|
|
||||||
"types": "./gio-2.0-import.d.ts",
|
|
||||||
"import": "./gio-2.0-import.js",
|
|
||||||
"default": "./gio-2.0-import.js"
|
|
||||||
},
|
|
||||||
"./gio-2.0": {
|
|
||||||
"types": "./gio-2.0.d.ts",
|
|
||||||
"import": "./gio-2.0.js",
|
|
||||||
"default": "./gio-2.0.js"
|
|
||||||
},
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js",
|
|
||||||
"default": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tsc --project tsconfig.json"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@girs/gjs": "4.0.0-beta.38",
|
|
||||||
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/glib-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/gmodule-2.0": "2.0.0-4.0.0-beta.38" },
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "*"
|
|
||||||
},
|
|
||||||
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "Gio-2.0"],
|
|
||||||
"author": "ts-for-gir",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gjsify/types.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/gjsify/types/tree/main/gio-2.0#readme"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// General settings for code interpretation
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": [],
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"rootDir": ".",
|
|
||||||
// General settings for code generation
|
|
||||||
"removeComments": false,
|
|
||||||
"inlineSourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"newLine": "LF",
|
|
||||||
// Show diagnostics
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": ["./gio-2.0.d.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPoints": ["./gio-2.0.d.ts"],
|
|
||||||
"readme": "./README.md",
|
|
||||||
"name": "Gio-2.0",
|
|
||||||
"tsconfig": "./tsconfig.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
Generated
Vendored
-126
@@ -1,126 +0,0 @@
|
|||||||
|
|
||||||
# Gjs
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
[GJS](https://gitlab.gnome.org/GNOME/gjs) is a JavaScript runtime for the GNOME ecosystem. Using GJS and the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/gjs
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import Gjs from '@girs/gjs';
|
|
||||||
```
|
|
||||||
|
|
||||||
Or if you prefer CommonJS, you can also use this:
|
|
||||||
```ts
|
|
||||||
const Gjs = require('@girs/gjs');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global types
|
|
||||||
|
|
||||||
After the import, the global types of GJS are also available:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import '@girs/gjs';
|
|
||||||
|
|
||||||
print('Hello World from print');
|
|
||||||
|
|
||||||
const ByteArray = imports.byteArray;
|
|
||||||
|
|
||||||
// And so on...
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global DOM types
|
|
||||||
|
|
||||||
Some types that conflict with the DOM are outsourced to allow frameworks like Gjsify to rebuild the DOM API without causing type conflicts.
|
|
||||||
But you can easily import them:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import '@girs/gjs/dom';
|
|
||||||
|
|
||||||
console.log('Hello World from console');
|
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
|
||||||
const encoded = encoder.encode('𝓽𝓮𝔁𝓽');
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
// ...
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
// And so on...
|
|
||||||
```
|
|
||||||
|
|
||||||
To avoid a type conflict with the DOM types it is recommended to either modify your `tsconfig.json` or `jsconfig.json` file to exclude the DOM lib, or to enable the `noLib` property.
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can import the built in [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) of GJS.
|
|
||||||
For this you need to include the `@girs/gjs` or `@girs/gjs/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gjs'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gjs"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import `gettext`, `system` and `cairo` in ESM style with Typescript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import gettext from 'gettext';
|
|
||||||
import system from 'system';
|
|
||||||
import cairo from 'cairo';
|
|
||||||
```
|
|
||||||
|
|
||||||
### GIR modules
|
|
||||||
|
|
||||||
If you want to have types for [GObject Introspection](https://gi.readthedocs.io/en/latest/) modules, you have to add them to your dependencies and import them as well, see the description of these modules, e.g. [gtk-4.0](https://www.npmjs.com/package/@girs/gtk-4.0), [gio-2.0](https://www.npmjs.com/package/@girs/gio-2.0), [adw-1](https://www.npmjs.com/package/@girs/adw-1) and [much more](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
These types will then be available to you:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import '@girs/gjs'
|
|
||||||
import '@girs/gjs/dom'
|
|
||||||
import '@girs/gio-2.0'
|
|
||||||
import '@girs/gtk-4.0'
|
|
||||||
import '@girs/adw-1'
|
|
||||||
|
|
||||||
import Gio from 'gi://Gio?version=2.0';
|
|
||||||
import Gtk from 'gi://Gtk?version=4.0';
|
|
||||||
import Adwaita from 'gi://adw?version=1';
|
|
||||||
|
|
||||||
const button = new Gtk.Button();
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-843
@@ -1,843 +0,0 @@
|
|||||||
// Cairo 1.0
|
|
||||||
import Cairo from '@girs/cairo-1.0';
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
|
|
||||||
declare namespace giCairo {
|
|
||||||
// Re-export enums directly from Cairo
|
|
||||||
export import Status = Cairo.Status;
|
|
||||||
export import Content = Cairo.Content;
|
|
||||||
export import Operator = Cairo.Operator;
|
|
||||||
export import Antialias = Cairo.Antialias;
|
|
||||||
export import FillRule = Cairo.FillRule;
|
|
||||||
export import LineCap = Cairo.LineCap;
|
|
||||||
export import LineJoin = Cairo.LineJoin;
|
|
||||||
export import TextClusterFlags = Cairo.TextClusterFlags;
|
|
||||||
export import FontSlant = Cairo.FontSlant;
|
|
||||||
export import FontWeight = Cairo.FontWeight;
|
|
||||||
export import SubpixelOrder = Cairo.SubpixelOrder;
|
|
||||||
export import HintStyle = Cairo.HintStyle;
|
|
||||||
export import HintMetrics = Cairo.HintMetrics;
|
|
||||||
export import FontType = Cairo.FontType;
|
|
||||||
export import PathDataType = Cairo.PathDataType;
|
|
||||||
export import DeviceType = Cairo.DeviceType;
|
|
||||||
export import SurfaceType = Cairo.SurfaceType;
|
|
||||||
export import Format = Cairo.Format;
|
|
||||||
export import PatternType = Cairo.PatternType;
|
|
||||||
export import Extend = Cairo.Extend;
|
|
||||||
export import Filter = Cairo.Filter;
|
|
||||||
export import RegionOverlap = Cairo.RegionOverlap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Describes the metrics of a string of text
|
|
||||||
*/
|
|
||||||
export interface TextExtents {
|
|
||||||
/** The horizontal distance from the origin to the leftmost part of the text */
|
|
||||||
xBearing: number;
|
|
||||||
/** The vertical distance from the origin to the topmost part of the text */
|
|
||||||
yBearing: number;
|
|
||||||
/** The width of the text */
|
|
||||||
width: number;
|
|
||||||
/** The height of the text */
|
|
||||||
height: number;
|
|
||||||
/** The distance to advance horizontally after drawing the text */
|
|
||||||
xAdvance: number;
|
|
||||||
/** The distance to advance vertically after drawing the text */
|
|
||||||
yAdvance: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The main Cairo drawing context
|
|
||||||
*
|
|
||||||
* A Cairo context is used to draw to surfaces and perform drawing operations.
|
|
||||||
* When you're done with a context, you must call $dispose() to free memory.
|
|
||||||
*/
|
|
||||||
export class Context extends Cairo.Context {
|
|
||||||
/**
|
|
||||||
* Creates a new Cairo context for drawing to the given surface
|
|
||||||
* @param surface The surface to draw on
|
|
||||||
*/
|
|
||||||
constructor(surface: Surface);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free a Cairo.Context and all associated memory
|
|
||||||
*
|
|
||||||
* Unlike other objects in GJS, Cairo contexts must be explicitly disposed
|
|
||||||
* to avoid memory leaks.
|
|
||||||
*/
|
|
||||||
$dispose(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a circular arc of the given radius to the current path
|
|
||||||
* @param xc X coordinate of the center of the arc
|
|
||||||
* @param yc Y coordinate of the center of the arc
|
|
||||||
* @param radius Radius of the arc
|
|
||||||
* @param angle1 Starting angle in radians
|
|
||||||
* @param angle2 End angle in radians
|
|
||||||
*/
|
|
||||||
arc(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a circular arc of the given radius to the current path, but draws
|
|
||||||
* the arc in the opposite direction from arc()
|
|
||||||
* @param xc X coordinate of the center of the arc
|
|
||||||
* @param yc Y coordinate of the center of the arc
|
|
||||||
* @param radius Radius of the arc
|
|
||||||
* @param angle1 Starting angle in radians
|
|
||||||
* @param angle2 End angle in radians
|
|
||||||
*/
|
|
||||||
arcNegative(xc: number, yc: number, radius: number, angle1: number, angle2: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a cubic Bézier spline to the current path
|
|
||||||
* @param x1 X coordinate of the first control point
|
|
||||||
* @param y1 Y coordinate of the first control point
|
|
||||||
* @param x2 X coordinate of the second control point
|
|
||||||
* @param y2 Y coordinate of the second control point
|
|
||||||
* @param x3 X coordinate of the end point
|
|
||||||
* @param y3 Y coordinate of the end point
|
|
||||||
*/
|
|
||||||
curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Establishes a new clip region by intersecting the current clip region
|
|
||||||
* with the current path, then clearing the current path
|
|
||||||
*/
|
|
||||||
clip(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like clip() but preserves the current path
|
|
||||||
*/
|
|
||||||
clipPreserve(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current clip extents as [x1, y1, x2, y2]
|
|
||||||
* @returns An array with [x1, y1, x2, y2] clip extents
|
|
||||||
*/
|
|
||||||
clipExtents(): [number, number, number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes the current path by drawing a line to the beginning of the current subpath
|
|
||||||
*/
|
|
||||||
closePath(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emits the current page, but doesn't clear it
|
|
||||||
*/
|
|
||||||
copyPage(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a coordinate from device space to user space
|
|
||||||
* @param x X coordinate
|
|
||||||
* @param y Y coordinate
|
|
||||||
* @returns An array with [x, y] transformed coordinates
|
|
||||||
*/
|
|
||||||
deviceToUser(x: number, y: number): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a distance vector from device space to user space
|
|
||||||
* @param x X component of the distance vector
|
|
||||||
* @param y Y component of the distance vector
|
|
||||||
* @returns An array with [x, y] transformed distance vector
|
|
||||||
*/
|
|
||||||
deviceToUserDistance(x: number, y: number): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fills the current path using the current fill rule, then clears the path
|
|
||||||
*/
|
|
||||||
fill(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fills the current path using the current fill rule, but doesn't clear the path
|
|
||||||
*/
|
|
||||||
fillPreserve(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current fill extents as [x1, y1, x2, y2]
|
|
||||||
* @returns An array with [x1, y1, x2, y2] fill extents
|
|
||||||
*/
|
|
||||||
fillExtents(): [number, number, number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current antialiasing mode
|
|
||||||
* @returns The current antialiasing mode
|
|
||||||
*/
|
|
||||||
getAntialias(): Antialias;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current point of the current path
|
|
||||||
* @returns An array with [x, y] coordinates of the current point
|
|
||||||
*/
|
|
||||||
getCurrentPoint(): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current dash count
|
|
||||||
* @returns The number of elements in the current dash pattern
|
|
||||||
*/
|
|
||||||
getDashCount(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current fill rule
|
|
||||||
* @returns The current fill rule
|
|
||||||
*/
|
|
||||||
getFillRule(): FillRule;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current line cap style
|
|
||||||
* @returns The current line cap style
|
|
||||||
*/
|
|
||||||
getLineCap(): LineCap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current line join style
|
|
||||||
* @returns The current line join style
|
|
||||||
*/
|
|
||||||
getLineJoin(): LineJoin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current line width
|
|
||||||
* @returns The current line width
|
|
||||||
*/
|
|
||||||
getLineWidth(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current miter limit
|
|
||||||
* @returns The current miter limit
|
|
||||||
*/
|
|
||||||
getMiterLimit(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current compositing operator
|
|
||||||
* @returns The current compositing operator
|
|
||||||
*/
|
|
||||||
getOperator(): Operator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current source pattern
|
|
||||||
* @returns The current source pattern
|
|
||||||
*/
|
|
||||||
getSource(): Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the surface the Cairo context is drawing on
|
|
||||||
* @returns The target surface
|
|
||||||
*/
|
|
||||||
getTarget(): Surface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current tolerance value
|
|
||||||
* @returns The current tolerance value
|
|
||||||
*/
|
|
||||||
getTolerance(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if there is a current point defined
|
|
||||||
* @returns True if there is a current point
|
|
||||||
*/
|
|
||||||
hasCurrentPoint(): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the current transformation matrix to the identity matrix
|
|
||||||
*/
|
|
||||||
identityMatrix(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests whether the given point is inside the area filled by the current path
|
|
||||||
* @param x X coordinate of the point to test
|
|
||||||
* @param y Y coordinate of the point to test
|
|
||||||
* @returns True if the point is inside the path
|
|
||||||
*/
|
|
||||||
inFill(x: number, y: number): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests whether the given point is inside the area that would be inked
|
|
||||||
* by the current path with the current line width and stroke parameters
|
|
||||||
* @param x X coordinate of the point to test
|
|
||||||
* @param y Y coordinate of the point to test
|
|
||||||
* @returns True if the point would be inked
|
|
||||||
*/
|
|
||||||
inStroke(x: number, y: number): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a line to the current path from the current point to the given point
|
|
||||||
* @param x X coordinate of the end point
|
|
||||||
* @param y Y coordinate of the end point
|
|
||||||
*/
|
|
||||||
lineTo(x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current mask pattern used for painting operations
|
|
||||||
* @param pattern A pattern to use as mask
|
|
||||||
*/
|
|
||||||
mask(pattern: Pattern): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current mask to a surface
|
|
||||||
* @param surface A surface to use as mask
|
|
||||||
* @param x X coordinate at which to place the origin of the surface
|
|
||||||
* @param y Y coordinate at which to place the origin of the surface
|
|
||||||
*/
|
|
||||||
maskSurface(surface: Surface, x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Begins a new subpath at the given point
|
|
||||||
* @param x X coordinate of the new position
|
|
||||||
* @param y Y coordinate of the new position
|
|
||||||
*/
|
|
||||||
moveTo(x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the current path and begins a new path
|
|
||||||
*/
|
|
||||||
newPath(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Begins a new subpath without changing the current point
|
|
||||||
*/
|
|
||||||
newSubPath(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Paints the current source everywhere within the current clip region
|
|
||||||
*/
|
|
||||||
paint(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Paints the current source everywhere within the current clip region
|
|
||||||
* using the given alpha value
|
|
||||||
* @param alpha Alpha value to use, between 0 and 1
|
|
||||||
*/
|
|
||||||
paintWithAlpha(alpha: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current path extents as [x1, y1, x2, y2]
|
|
||||||
* @returns An array with [x1, y1, x2, y2] path extents
|
|
||||||
*/
|
|
||||||
pathExtents(): [number, number, number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminates the current pattern group and returns a new pattern
|
|
||||||
* representing everything drawn to the group
|
|
||||||
* @returns A new pattern representing the group
|
|
||||||
*/
|
|
||||||
popGroup(): Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminates the current pattern group and makes it the current source pattern
|
|
||||||
*/
|
|
||||||
popGroupToSource(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporarily redirects drawing to an intermediate surface
|
|
||||||
*/
|
|
||||||
pushGroup(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporarily redirects drawing to an intermediate surface with the given content
|
|
||||||
* @param content The content type for the group
|
|
||||||
*/
|
|
||||||
pushGroupWithContent(content: Content): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a rectangle to the current path
|
|
||||||
* @param x X coordinate of the top-left corner
|
|
||||||
* @param y Y coordinate of the top-left corner
|
|
||||||
* @param width Width of the rectangle
|
|
||||||
* @param height Height of the rectangle
|
|
||||||
*/
|
|
||||||
rectangle(x: number, y: number, width: number, height: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a cubic Bézier spline to the current path using relative coordinates
|
|
||||||
* @param dx1 X offset to the first control point from current point
|
|
||||||
* @param dy1 Y offset to the first control point from current point
|
|
||||||
* @param dx2 X offset to the second control point from current point
|
|
||||||
* @param dy2 Y offset to the second control point from current point
|
|
||||||
* @param dx3 X offset to the end point from current point
|
|
||||||
* @param dy3 Y offset to the end point from current point
|
|
||||||
*/
|
|
||||||
relCurveTo(dx1: number, dy1: number, dx2: number, dy2: number, dx3: number, dy3: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a line to the current path relative to the current point
|
|
||||||
* @param dx X offset from the current point
|
|
||||||
* @param dy Y offset from the current point
|
|
||||||
*/
|
|
||||||
relLineTo(dx: number, dy: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Begins a new subpath relative to the current point
|
|
||||||
* @param dx X offset from the current point
|
|
||||||
* @param dy Y offset from the current point
|
|
||||||
*/
|
|
||||||
relMoveTo(dx: number, dy: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the current clip region to its original, unrestricted state
|
|
||||||
*/
|
|
||||||
resetClip(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores the context state from the stack
|
|
||||||
*/
|
|
||||||
restore(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rotates the current transformation matrix
|
|
||||||
* @param angle Angle of rotation in radians
|
|
||||||
*/
|
|
||||||
rotate(angle: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the current context state to the stack
|
|
||||||
*/
|
|
||||||
save(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scales the current transformation matrix
|
|
||||||
* @param sx Scale factor for the X dimension
|
|
||||||
* @param sy Scale factor for the Y dimension
|
|
||||||
*/
|
|
||||||
scale(sx: number, sy: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Selects a font face
|
|
||||||
* @param family A font family name
|
|
||||||
* @param slant A font slant
|
|
||||||
* @param weight A font weight
|
|
||||||
*/
|
|
||||||
selectFontFace(family: string, slant: number, weight: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the antialiasing mode
|
|
||||||
* @param antialias The new antialiasing mode
|
|
||||||
*/
|
|
||||||
setAntialias(antialias: Antialias): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the dash pattern to be used by stroke()
|
|
||||||
* @param dashes Array of dash lengths
|
|
||||||
* @param offset Offset into the dash pattern
|
|
||||||
*/
|
|
||||||
setDash(dashes: number[], offset: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current font size in user space units
|
|
||||||
* @param size Font size in user space units
|
|
||||||
*/
|
|
||||||
setFontSize(size: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current fill rule
|
|
||||||
* @param fillRule The new fill rule
|
|
||||||
*/
|
|
||||||
setFillRule(fillRule: FillRule): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current line cap style
|
|
||||||
* @param lineCap The new line cap style
|
|
||||||
*/
|
|
||||||
setLineCap(lineCap: LineCap): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current line join style
|
|
||||||
* @param lineJoin The new line join style
|
|
||||||
*/
|
|
||||||
setLineJoin(lineJoin: LineJoin): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current line width
|
|
||||||
* @param width The new line width
|
|
||||||
*/
|
|
||||||
setLineWidth(width: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current miter limit
|
|
||||||
* @param limit The new miter limit
|
|
||||||
*/
|
|
||||||
setMiterLimit(limit: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current compositing operator
|
|
||||||
* @param op The new compositing operator
|
|
||||||
*/
|
|
||||||
setOperator(op: Operator): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current source pattern
|
|
||||||
* @param pattern The new source pattern
|
|
||||||
*/
|
|
||||||
setSource(pattern: Pattern): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the source pattern to an RGB opaque color
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
*/
|
|
||||||
setSourceRGB(red: number, green: number, blue: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the source pattern to an RGBA color
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
* @param alpha Alpha component, between 0 and 1
|
|
||||||
*/
|
|
||||||
setSourceRGBA(red: number, green: number, blue: number, alpha: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the source pattern to the given surface
|
|
||||||
* @param surface The new source surface
|
|
||||||
* @param x X coordinate where to place the surface origin
|
|
||||||
* @param y Y coordinate where to place the surface origin
|
|
||||||
*/
|
|
||||||
setSourceSurface(surface: Surface, x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the tolerance used when converting paths to trapezoids
|
|
||||||
* @param tolerance The new tolerance value
|
|
||||||
*/
|
|
||||||
setTolerance(tolerance: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emits the current page and clears it
|
|
||||||
*/
|
|
||||||
showPage(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws text at the current position
|
|
||||||
* @param utf8 A string of text encoded in UTF-8
|
|
||||||
*/
|
|
||||||
showText(utf8: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Strokes the current path using the current line width, line join,
|
|
||||||
* line cap, and dash settings, then clears the path
|
|
||||||
*/
|
|
||||||
stroke(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like stroke() but preserves the current path
|
|
||||||
*/
|
|
||||||
strokePreserve(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current stroke extents as [x1, y1, x2, y2]
|
|
||||||
* @returns An array with [x1, y1, x2, y2] stroke extents
|
|
||||||
*/
|
|
||||||
strokeExtents(): [number, number, number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the extents of the given text if it were drawn at the current point
|
|
||||||
* @param utf8 A string of text encoded in UTF-8
|
|
||||||
* @returns Text extents information
|
|
||||||
*/
|
|
||||||
textExtents(utf8: string): TextExtents;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Translates the current transformation matrix
|
|
||||||
* @param tx Translation in the X direction
|
|
||||||
* @param ty Translation in the Y direction
|
|
||||||
*/
|
|
||||||
translate(tx: number, ty: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a coordinate from user space to device space
|
|
||||||
* @param x X coordinate
|
|
||||||
* @param y Y coordinate
|
|
||||||
* @returns An array with [x, y] transformed coordinates
|
|
||||||
*/
|
|
||||||
userToDevice(x: number, y: number): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transforms a distance vector from user space to device space
|
|
||||||
* @param x X component of the distance vector
|
|
||||||
* @param y Y component of the distance vector
|
|
||||||
* @returns An array with [x, y] transformed distance vector
|
|
||||||
*/
|
|
||||||
userToDeviceDistance(x: number, y: number): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a copy of the current path and returns it
|
|
||||||
* @returns A copy of the current path
|
|
||||||
*/
|
|
||||||
copyPath(): Path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Appends a path to the current path
|
|
||||||
* @param path A path to append
|
|
||||||
*/
|
|
||||||
appendPath(path: Path): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for all Cairo surfaces
|
|
||||||
*/
|
|
||||||
export abstract class Surface extends Cairo.Surface {
|
|
||||||
/**
|
|
||||||
* Gets the device scale of the surface
|
|
||||||
* @returns An array with [x, y] device scale
|
|
||||||
*/
|
|
||||||
getDeviceScale(): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the device scale of the surface
|
|
||||||
* @param x X scale factor
|
|
||||||
* @param y Y scale factor
|
|
||||||
*/
|
|
||||||
setDeviceScale(x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the device offset of the surface
|
|
||||||
* @returns An array with [x, y] device offset
|
|
||||||
*/
|
|
||||||
getDeviceOffset(): [number, number];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the device offset of the surface
|
|
||||||
* @param x X offset
|
|
||||||
* @param y Y offset
|
|
||||||
*/
|
|
||||||
setDeviceOffset(x: number, y: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs all pending drawing operations
|
|
||||||
*/
|
|
||||||
flush(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finishes the surface and drops all references to external resources
|
|
||||||
*/
|
|
||||||
finish(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A surface that uses in-memory image data buffers
|
|
||||||
*/
|
|
||||||
export class ImageSurface extends Surface {
|
|
||||||
/**
|
|
||||||
* Creates a new image surface
|
|
||||||
* @param format The format of pixels in the surface
|
|
||||||
* @param width Width of the surface in pixels
|
|
||||||
* @param height Height of the surface in pixels
|
|
||||||
*/
|
|
||||||
constructor(format: Format, width: number, height: number);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new image surface from a PNG file
|
|
||||||
* @param filename Path to a PNG file
|
|
||||||
* @returns A new image surface
|
|
||||||
*/
|
|
||||||
static createFromPNG(filename: string): ImageSurface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the format of the surface
|
|
||||||
* @returns The format of the surface
|
|
||||||
*/
|
|
||||||
getFormat(): Format;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the width of the surface in pixels
|
|
||||||
* @returns The width of the surface
|
|
||||||
*/
|
|
||||||
getWidth(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the height of the surface in pixels
|
|
||||||
* @returns The height of the surface
|
|
||||||
*/
|
|
||||||
getHeight(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the contents of the surface to a PNG file
|
|
||||||
* @param filename Path to the PNG file to write
|
|
||||||
*/
|
|
||||||
writeToPNG(filename: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A surface that produces output in the PDF format
|
|
||||||
*/
|
|
||||||
export class PDFSurface extends Surface {
|
|
||||||
/**
|
|
||||||
* Creates a new PDF surface
|
|
||||||
* @param filename Path to the PDF file to write to
|
|
||||||
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
||||||
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
||||||
*/
|
|
||||||
constructor(filename: string, width: number, height: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A surface that produces output in the PostScript format
|
|
||||||
*/
|
|
||||||
export class PSSurface extends Surface {
|
|
||||||
/**
|
|
||||||
* Creates a new PostScript surface
|
|
||||||
* @param filename Path to the PostScript file to write to
|
|
||||||
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
||||||
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
||||||
*/
|
|
||||||
constructor(filename: string, width: number, height: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A surface that produces output in the SVG format
|
|
||||||
*/
|
|
||||||
export class SVGSurface extends Surface {
|
|
||||||
/**
|
|
||||||
* Creates a new SVG surface
|
|
||||||
* @param filename Path to the SVG file to write to
|
|
||||||
* @param width Width of the surface in points (1 point = 1/72 inch)
|
|
||||||
* @param height Height of the surface in points (1 point = 1/72 inch)
|
|
||||||
*/
|
|
||||||
constructor(filename: string, width: number, height: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for all Cairo patterns
|
|
||||||
*/
|
|
||||||
export class Pattern extends Cairo.Pattern {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for all gradient patterns
|
|
||||||
*/
|
|
||||||
export class Gradient extends Pattern {
|
|
||||||
/**
|
|
||||||
* Adds a color stop to the gradient at the given offset
|
|
||||||
* @param offset Offset position of the stop, between 0 and 1
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
* @param alpha Alpha component, between 0 and 1
|
|
||||||
*/
|
|
||||||
addColorStopRGBA(offset: number, red: number, green: number, blue: number, alpha: number): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an opaque color stop to the gradient at the given offset
|
|
||||||
* @param offset Offset position of the stop, between 0 and 1
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
*/
|
|
||||||
addColorStopRGB(offset: number, red: number, green: number, blue: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pattern for linear gradients
|
|
||||||
*/
|
|
||||||
export class LinearGradient extends Gradient {
|
|
||||||
/**
|
|
||||||
* Creates a new linear gradient pattern
|
|
||||||
* @param x0 X coordinate of the start point
|
|
||||||
* @param y0 Y coordinate of the start point
|
|
||||||
* @param x1 X coordinate of the end point
|
|
||||||
* @param y1 Y coordinate of the end point
|
|
||||||
*/
|
|
||||||
constructor(x0: number, y0: number, x1: number, y1: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pattern for radial gradients
|
|
||||||
*/
|
|
||||||
export class RadialGradient extends Gradient {
|
|
||||||
/**
|
|
||||||
* Creates a new radial gradient pattern
|
|
||||||
* @param cx0 X coordinate of the start circle
|
|
||||||
* @param cy0 Y coordinate of the start circle
|
|
||||||
* @param radius0 Radius of the start circle
|
|
||||||
* @param cx1 X coordinate of the end circle
|
|
||||||
* @param cy1 Y coordinate of the end circle
|
|
||||||
* @param radius1 Radius of the end circle
|
|
||||||
*/
|
|
||||||
constructor(cx0: number, cy0: number, radius0: number, cx1: number, cy1: number, radius1: number);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pattern that uses a surface as its source
|
|
||||||
*/
|
|
||||||
export class SurfacePattern extends Pattern {
|
|
||||||
/**
|
|
||||||
* Creates a new pattern for the given surface
|
|
||||||
* @param surface The surface to use
|
|
||||||
*/
|
|
||||||
constructor(surface: Surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pattern for solid colors
|
|
||||||
*/
|
|
||||||
export class SolidPattern extends Pattern {
|
|
||||||
/**
|
|
||||||
* Creates a new solid pattern with an opaque color
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
* @returns A new solid pattern
|
|
||||||
*/
|
|
||||||
static createRGB(red: number, green: number, blue: number): SolidPattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new solid pattern with a transparent color
|
|
||||||
* @param red Red component, between 0 and 1
|
|
||||||
* @param green Green component, between 0 and 1
|
|
||||||
* @param blue Blue component, between 0 and 1
|
|
||||||
* @param alpha Alpha component, between 0 and 1
|
|
||||||
* @returns A new solid pattern
|
|
||||||
*/
|
|
||||||
static createRGBA(red: number, green: number, blue: number, alpha: number): SolidPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Path extends Cairo.Path {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A rectangle
|
|
||||||
*/
|
|
||||||
export class Rectangle extends Cairo.Rectangle {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A rectangle integer
|
|
||||||
*/
|
|
||||||
export class RectangleInt extends Cairo.RectangleInt {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A region object used for representing a set of pixels
|
|
||||||
*/
|
|
||||||
export class Region extends Cairo.Region {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A matrix object used for transforming coordinates
|
|
||||||
*/
|
|
||||||
export class Matrix extends Cairo.Matrix {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A font face object used for storing and manipulating font faces
|
|
||||||
*/
|
|
||||||
export class FontFace extends Cairo.FontFace {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A scaled font object used for storing and manipulating scaled fonts
|
|
||||||
*/
|
|
||||||
export class ScaledFont extends Cairo.ScaledFont {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A glyph object used for storing and manipulating glyphs
|
|
||||||
*/
|
|
||||||
export class Glyph extends Cairo.Glyph {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A text cluster object used for storing and manipulating text clusters
|
|
||||||
*/
|
|
||||||
export class TextCluster extends Cairo.TextCluster {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A font options object used for storing and manipulating font options
|
|
||||||
*/
|
|
||||||
export class FontOptions extends Cairo.FontOptions {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A device object used for storing and manipulating devices
|
|
||||||
*/
|
|
||||||
export class Device extends Cairo.Device {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default giCairo;
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
import Cairo from 'cairo';
|
|
||||||
|
|
||||||
// cairo doesn't have named exports, see https://gitlab.gnome.org/GNOME/gjs/-/blob/c2a714f348d6848037f072063e0a914fd537c4f4/installed-tests/js/testCairoModule.js#L14
|
|
||||||
export default Cairo;
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-21
@@ -1,21 +0,0 @@
|
|||||||
/**
|
|
||||||
* @param logDomain the GLib log domain this Console should print
|
|
||||||
* with. Defaults to 'Gjs-Console'.
|
|
||||||
*/
|
|
||||||
export function setConsoleLogDomain(logDomain: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param logDomain the GLib log domain this Console should print
|
|
||||||
* with. Defaults to 'Gjs-Console'.
|
|
||||||
*/
|
|
||||||
export function getConsoleLogDomain(): string;
|
|
||||||
|
|
||||||
export declare const DEFAULT_LOG_DOMAIN: string;
|
|
||||||
|
|
||||||
declare const Console: {
|
|
||||||
setConsoleLogDomain: typeof setConsoleLogDomain;
|
|
||||||
getConsoleLogDomain: typeof getConsoleLogDomain;
|
|
||||||
DEFAULT_LOG_DOMAIN: typeof DEFAULT_LOG_DOMAIN;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Console;
|
|
||||||
Generated
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
import Console, { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN } from 'console';
|
|
||||||
|
|
||||||
export { getConsoleLogDomain, setConsoleLogDomain, DEFAULT_LOG_DOMAIN }
|
|
||||||
export default Console;
|
|
||||||
|
|
||||||
|
|
||||||
-304
@@ -1,304 +0,0 @@
|
|||||||
/**
|
|
||||||
* Gjs has implemented some functionality from the DOM API,
|
|
||||||
* this leads to a conflict when all DOM (`lib.dom.d.ts`) should be used.
|
|
||||||
* This should normally not be the case, since the other - not yet reimplemented - API's cannot be used in GJS anyway.
|
|
||||||
*
|
|
||||||
* If for some reason the entire DOM types should still be used,
|
|
||||||
* this file can be ignored and `lib.dom.d.ts` used instead, otherwise this file should be imported in your project.
|
|
||||||
*
|
|
||||||
* See also https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type GLib from '@girs/glib-2.0';
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface ImportMeta {
|
|
||||||
/**
|
|
||||||
* The absolute file: or resource: URL of the module.
|
|
||||||
*
|
|
||||||
* @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/ESModules.md#importmetaurl
|
|
||||||
*/
|
|
||||||
url: string; // with readonly this type is incompatible with e.g. https://github.com/vitejs/vite/blob/main/packages/vite/types/importMeta.d.ts
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timers
|
|
||||||
// See https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/esm/_timers.js
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version Gjs 1.71.1
|
|
||||||
* @param callback a callback function
|
|
||||||
* @param delay the duration in milliseconds to wait before running callback
|
|
||||||
* @param args arguments to pass to callback
|
|
||||||
*/
|
|
||||||
function setTimeout(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version Gjs 1.71.1
|
|
||||||
* @param callback a callback function
|
|
||||||
* @param delay the duration in milliseconds to wait between calling callback
|
|
||||||
* @param args arguments to pass to callback
|
|
||||||
*/
|
|
||||||
function setInterval(callback: (...args: any[]) => any, delay?: number, ...args: any[]): GLib.Source;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version Gjs 1.71.1
|
|
||||||
* @param timeout the timeout to clear
|
|
||||||
*/
|
|
||||||
function clearTimeout(timeout: GLib.Source): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version Gjs 1.71.1
|
|
||||||
* @param timeout the timeout to clear
|
|
||||||
*/
|
|
||||||
function clearInterval(timeout: GLib.Source): void;
|
|
||||||
|
|
||||||
interface Console {
|
|
||||||
/**
|
|
||||||
* Logs a critical message if the condition is not truthy.
|
|
||||||
* {@link console.error()} for additional information.
|
|
||||||
*
|
|
||||||
* @param condition a boolean condition which, if false, causes
|
|
||||||
* the log to print
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
assert(condition: boolean, ...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets grouping and clears the terminal on systems supporting ANSI
|
|
||||||
* terminal control sequences.
|
|
||||||
*
|
|
||||||
* In file-based stdout or systems which do not support clearing,
|
|
||||||
* console.clear() has no visual effect.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
clear(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a message with severity equal to {@link GLib.LogLevelFlags.DEBUG}.
|
|
||||||
*
|
|
||||||
* @param {...any} data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
debug(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a message with severity equal to {@link GLib.LogLevelFlags.CRITICAL}.
|
|
||||||
* Does not use {@link GLib.LogLevelFlags.ERROR} to avoid asserting and
|
|
||||||
* forcibly shutting down the application.
|
|
||||||
*
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
error(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a message with severity equal to {@link GLib.LogLevelFlags.INFO}.
|
|
||||||
*
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
info(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs a message with severity equal to {@link GLib.LogLevelFlags.MESSAGE}.
|
|
||||||
*
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
log(...data: any[]): void;
|
|
||||||
|
|
||||||
// 1.1.7 table(tabularData, properties)
|
|
||||||
table(tabularData: any, _properties: never): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
trace(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
warn(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param item an item to format generically
|
|
||||||
* @param [options] any additional options for the formatter. Unused
|
|
||||||
* in our implementation.
|
|
||||||
*/
|
|
||||||
dir(item: object, options: never): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
dirxml(...data: any[]): void;
|
|
||||||
|
|
||||||
// 1.2 Counting functions
|
|
||||||
// https://console.spec.whatwg.org/#counting
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs how many times console.count(label) has been called with a given
|
|
||||||
* label.
|
|
||||||
* {@link console.countReset()} for resetting a count.
|
|
||||||
*
|
|
||||||
* @param label unique identifier for this action
|
|
||||||
*/
|
|
||||||
count(label: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param label the unique label to reset the count for
|
|
||||||
*/
|
|
||||||
countReset(label: string): void;
|
|
||||||
|
|
||||||
// 1.3 Grouping functions
|
|
||||||
// https://console.spec.whatwg.org/#grouping
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
group(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias for console.group()
|
|
||||||
*
|
|
||||||
* @param {...any} data formatting substitutions, if applicable
|
|
||||||
*/
|
|
||||||
groupCollapsed(...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
groupEnd(): void;
|
|
||||||
|
|
||||||
// 1.4 Timing functions
|
|
||||||
// https://console.spec.whatwg.org/#timing
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param label unique identifier for this action, pass to
|
|
||||||
* console.timeEnd() to complete
|
|
||||||
*/
|
|
||||||
time(label: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs the time since the last call to console.time(label) where label is
|
|
||||||
* the same.
|
|
||||||
*
|
|
||||||
* @param label unique identifier for this action, pass to
|
|
||||||
* console.timeEnd() to complete
|
|
||||||
* @param data string substitutions, if applicable
|
|
||||||
*/
|
|
||||||
timeLog(label: string, ...data: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logs the time since the last call to console.time(label) and completes
|
|
||||||
* the action.
|
|
||||||
* Call console.time(label) again to re-measure.
|
|
||||||
*
|
|
||||||
* @param label unique identifier for this action
|
|
||||||
*/
|
|
||||||
timeEnd(label: string): void;
|
|
||||||
|
|
||||||
// Non-standard functions which are de-facto standards.
|
|
||||||
// Similar to Node, we define these as no-ops for now.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Not implemented in GJS
|
|
||||||
*
|
|
||||||
* @param _label unique identifier for this action, pass to
|
|
||||||
* console.profileEnd to complete
|
|
||||||
*/
|
|
||||||
profile(_label: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Not implemented in GJS
|
|
||||||
*
|
|
||||||
* @param _label unique identifier for this action
|
|
||||||
*/
|
|
||||||
profileEnd(_label: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Not implemented in GJS
|
|
||||||
*
|
|
||||||
* @param _label unique identifier for this action
|
|
||||||
*/
|
|
||||||
timeStamp(_label: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TextDecodeOptions {
|
|
||||||
// As of Gjs 1.73.2 stream mode is not supported yet.
|
|
||||||
// stream?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TextDecoderOptions {
|
|
||||||
/** Indicates whether the error mode is fatal. */
|
|
||||||
fatal?: boolean;
|
|
||||||
/** Indicates whether whether the byte order mark is ignored. */
|
|
||||||
ignoreBOM?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The TextDecoder interface represents a decoder for a specific text encoding.
|
|
||||||
* It takes a stream of bytes as input and emits a stream of code points.
|
|
||||||
*
|
|
||||||
* @version Gjs 1.69.2
|
|
||||||
*/
|
|
||||||
interface TextDecoder {
|
|
||||||
/** A string containing the name of the decoder, that is a string describing the method the TextDecoder will use. */
|
|
||||||
readonly encoding: TextDecoderEncoding;
|
|
||||||
/** A Boolean indicating whether the error mode is fatal. */
|
|
||||||
readonly fatal: boolean;
|
|
||||||
/** A Boolean indicating whether the byte order mark is ignored. */
|
|
||||||
readonly ignoreBOM: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a string containing the text decoded with the method of the specific TextDecoder object.
|
|
||||||
*
|
|
||||||
* If the error mode is "fatal" and the encoder method encounter an error it WILL THROW a TypeError.
|
|
||||||
*
|
|
||||||
* @param input Buffer containing the text to decode
|
|
||||||
* @param options Object defining the decode options
|
|
||||||
*/
|
|
||||||
decode(input?: ArrayBufferView | ArrayBuffer, options?: TextDecodeOptions): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TextEncoderEncodeIntoResult {
|
|
||||||
read?: number;
|
|
||||||
written?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TextEncoder takes a stream of code points as input and emits a stream of bytes.
|
|
||||||
*
|
|
||||||
* @version Gjs 1.69.2
|
|
||||||
*/
|
|
||||||
interface TextEncoder {
|
|
||||||
readonly encoding: 'utf-8';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes a string as input, and returns a buffer containing the text given in parameters encoded with the UTF-8 method.
|
|
||||||
*
|
|
||||||
* @param input Text to encode.
|
|
||||||
*/
|
|
||||||
encode(input?: string): Uint8Array;
|
|
||||||
/**
|
|
||||||
* Takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into,
|
|
||||||
* and returns a dictionary object indicating the progress of the encoding.
|
|
||||||
*
|
|
||||||
* This is potentially more performant than the older encode() method.
|
|
||||||
*
|
|
||||||
* @param source Text to encode.
|
|
||||||
* @param destination Buffer where to place the resulting UTF-8 encoded text into.
|
|
||||||
*/
|
|
||||||
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
const console: Console;
|
|
||||||
|
|
||||||
const TextDecoder: {
|
|
||||||
prototype: TextDecoder;
|
|
||||||
new (label?: TextDecoderEncoding, options?: TextDecoderOptions): TextDecoder;
|
|
||||||
};
|
|
||||||
|
|
||||||
const TextEncoder: {
|
|
||||||
prototype: TextEncoder;
|
|
||||||
new (): TextEncoder;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export {};
|
|
||||||
-3
@@ -1,3 +0,0 @@
|
|||||||
export {};
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-41
@@ -1,41 +0,0 @@
|
|||||||
export enum LocaleCategory {
|
|
||||||
ALL,
|
|
||||||
COLLATE,
|
|
||||||
CTYPE,
|
|
||||||
MESSAGES,
|
|
||||||
MONETARY,
|
|
||||||
NUMERIC,
|
|
||||||
TIME,
|
|
||||||
}
|
|
||||||
export function setlocale(category: number, locale: string | null): string;
|
|
||||||
export function textdomain(domainname: string | null): string;
|
|
||||||
export function bindtextdomain(domainname: string, dirname: string | null): string;
|
|
||||||
export function gettext(msgid: string): string;
|
|
||||||
export function dgettext(domainname: string | null, msgid: string): string;
|
|
||||||
export function dcgettext(domainname: string | null, msgid: string, category: number): string;
|
|
||||||
export function ngettext(msgid: string, msgid_plural: string, n: number): string;
|
|
||||||
export function dngettext(domainname: string, msgid: string, msgid_plural: string, n: number): string;
|
|
||||||
export function pgettext(context: string, msgid: string): string;
|
|
||||||
export function dpgettext(dom: string | null, context: string, msgid: string): string;
|
|
||||||
export function domain(domainName: string): {
|
|
||||||
gettext: (msgid: string) => string;
|
|
||||||
ngettext: (msgid: string, msgid_plural: string, n: number) => string;
|
|
||||||
pgettext: (context: string, msgid: string) => string;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const Gettext: {
|
|
||||||
LocaleCategory: typeof LocaleCategory;
|
|
||||||
setlocale: typeof setlocale;
|
|
||||||
textdomain: typeof textdomain;
|
|
||||||
bindtextdomain: typeof bindtextdomain;
|
|
||||||
gettext: typeof gettext;
|
|
||||||
dgettext: typeof dgettext;
|
|
||||||
dcgettext: typeof dcgettext;
|
|
||||||
ngettext: typeof ngettext;
|
|
||||||
dngettext: typeof dngettext;
|
|
||||||
pgettext: typeof pgettext;
|
|
||||||
dpgettext: typeof dpgettext;
|
|
||||||
domain: typeof domain;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Gettext;
|
|
||||||
Generated
Vendored
-6
@@ -1,6 +0,0 @@
|
|||||||
import Gettext, { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain } from 'gettext';
|
|
||||||
|
|
||||||
export { setlocale, textdomain, bindtextdomain, gettext, dgettext, dcgettext, ngettext, dngettext, pgettext, dpgettext, domain }
|
|
||||||
export default Gettext;
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
// https://www.typescriptlang.org/docs/handbook/modules.html#ambient-modules
|
|
||||||
// https://stackoverflow.com/questions/45099605/ambient-declaration-with-an-imported-type-in-typescript
|
|
||||||
|
|
||||||
declare module 'gettext' {
|
|
||||||
export * from '@girs/gjs/gettext';
|
|
||||||
import Gettext from '@girs/gjs/gettext';
|
|
||||||
export default Gettext;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'system' {
|
|
||||||
export * from '@girs/gjs/system';
|
|
||||||
import System from '@girs/gjs/system';
|
|
||||||
export default System;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'cairo' {
|
|
||||||
import Cairo from '@girs/gjs/cairo';
|
|
||||||
export default Cairo;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'console' {
|
|
||||||
import Console, { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN } from '@girs/gjs/console';
|
|
||||||
export { setConsoleLogDomain, getConsoleLogDomain, DEFAULT_LOG_DOMAIN };
|
|
||||||
export default Console;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
export {};
|
|
||||||
|
|
||||||
|
|
||||||
-732
@@ -1,732 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in ts-for-gir itself or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*/
|
|
||||||
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
import type GLib from '@girs/glib-2.0';
|
|
||||||
|
|
||||||
import gettext from './gettext.js';
|
|
||||||
import system from './system.js';
|
|
||||||
import cairo from './cairo.js';
|
|
||||||
|
|
||||||
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.72.0/modules/script/package.js
|
|
||||||
declare namespace package {
|
|
||||||
/**
|
|
||||||
* Although there are references in the documentation of more properties that
|
|
||||||
* this object should accepts, only the following are actually used in the init code,
|
|
||||||
* and all the other have their values derived from them.
|
|
||||||
*/
|
|
||||||
interface PackageInitParams {
|
|
||||||
/** The base name of the entry point (eg. org.foo.Bar.App) */
|
|
||||||
name: string;
|
|
||||||
/** The version of the package */
|
|
||||||
version: string;
|
|
||||||
/** The prefix of the package */
|
|
||||||
prefix: string;
|
|
||||||
/**
|
|
||||||
* The final datadir and libdir when installed;
|
|
||||||
* usually, these would be prefix + '/share' and
|
|
||||||
* and prefix + '/lib' (or '/lib64')
|
|
||||||
*/
|
|
||||||
libdir: string;
|
|
||||||
/**
|
|
||||||
* The final datadir and libdir when installed;
|
|
||||||
* usually, these would be prefix + '/share' and
|
|
||||||
* and prefix + '/lib' (or '/lib64')
|
|
||||||
*/
|
|
||||||
datadir?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base name of the entry point (eg. org.foo.Bar.App)
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const name: string;
|
|
||||||
/**
|
|
||||||
* The version of the package
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const version: string;
|
|
||||||
/**
|
|
||||||
* The prefix of the package
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const prefix: string;
|
|
||||||
/**
|
|
||||||
* The final datadir when installed; usually, these would be prefix + '/share'
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const datadir: string;
|
|
||||||
/**
|
|
||||||
* The final libdir when installed; usually, these would be prefix + '/lib' (or '/lib64')
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const libdir: string;
|
|
||||||
/**
|
|
||||||
* The final pkglibdir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const pkglibdir: string;
|
|
||||||
/**
|
|
||||||
* The final moduledir when installed; usually, this would be prefix + '/lib' (or '/lib64')
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const moduledir: string;
|
|
||||||
/**
|
|
||||||
* The directory containing gettext translation files; this will be datadir + '/locale' when installed and './po' in the source tree
|
|
||||||
*
|
|
||||||
* Note: Run `pkg.init()` before accessing this property.
|
|
||||||
*/
|
|
||||||
export const localedir: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize directories and global variables. Must be called
|
|
||||||
* before any of other API in Package is used.
|
|
||||||
* `params` must be an object with at least the following keys:
|
|
||||||
* - name: the package name ($(PACKAGE_NAME) in autotools,
|
|
||||||
* eg. org.foo.Bar)
|
|
||||||
* - version: the package version
|
|
||||||
* - prefix: the installation prefix
|
|
||||||
*
|
|
||||||
* init() will take care to check if the program is running from
|
|
||||||
* the source directory or not, by looking for a 'src' directory.
|
|
||||||
*
|
|
||||||
* At the end, the global variable 'pkg' will contain the
|
|
||||||
* Package module (imports.package). Additionally, the following
|
|
||||||
* module variables will be available:
|
|
||||||
* - name: the base name of the entry point (eg. org.foo.Bar.App)
|
|
||||||
* - version: same as in @params
|
|
||||||
* - prefix: the installation prefix (as passed in @params)
|
|
||||||
* - datadir, libdir: the final datadir and libdir when installed;
|
|
||||||
* usually, these would be prefix + '/share' and
|
|
||||||
* and prefix + '/lib' (or '/lib64')
|
|
||||||
* - pkgdatadir: the directory to look for private data files, such as
|
|
||||||
* images, stylesheets and UI definitions;
|
|
||||||
* this will be datadir + name when installed and
|
|
||||||
* './data' when running from the source tree
|
|
||||||
* - pkglibdir: the directory to look for private typelibs and C
|
|
||||||
* libraries;
|
|
||||||
* this will be libdir + name when installed and
|
|
||||||
* './lib' when running from the source tree
|
|
||||||
* - moduledir: the directory to look for JS modules;
|
|
||||||
* this will be pkglibdir when installed and
|
|
||||||
* './src' when running from the source tree
|
|
||||||
* - localedir: the directory containing gettext translation files;
|
|
||||||
* this will be datadir + '/locale' when installed
|
|
||||||
* and './po' in the source tree
|
|
||||||
*
|
|
||||||
* All paths are absolute and will not end with '/'.
|
|
||||||
*
|
|
||||||
* As a side effect, init() calls GLib.set_prgname().
|
|
||||||
*
|
|
||||||
* @param {object} params package parameters
|
|
||||||
*/
|
|
||||||
export function init(params: PackageInitParams): void;
|
|
||||||
/**
|
|
||||||
* This is the function to use if you want to have multiple
|
|
||||||
* entry points in one package.
|
|
||||||
* You must define a main(ARGV) function inside the passed
|
|
||||||
* in module, and then the launcher would be
|
|
||||||
*
|
|
||||||
* imports.package.init(...);
|
|
||||||
* imports.package.run(imports.entrypoint);
|
|
||||||
*
|
|
||||||
* @param module the module to run
|
|
||||||
* @returns the exit code of the module's main() function
|
|
||||||
*/
|
|
||||||
export function run(module: { main: (argv: string[]) => void }): number | undefined;
|
|
||||||
/**
|
|
||||||
* This is a convenience function if your package has a
|
|
||||||
* single entry point.
|
|
||||||
* You must define a main(ARGV) function inside a main.js
|
|
||||||
* module in moduledir.
|
|
||||||
*
|
|
||||||
* @param params see init()
|
|
||||||
*/
|
|
||||||
export function start(params: PackageInitParams): void;
|
|
||||||
/**
|
|
||||||
* Mark a dependency on a specific version of one or more
|
|
||||||
* external GI typelibs.
|
|
||||||
* `libs` must be an object whose keys are a typelib name,
|
|
||||||
* and values are the respective version. The empty string
|
|
||||||
* indicates any version.
|
|
||||||
* @param deps The external dependencies to import
|
|
||||||
*/
|
|
||||||
export function require(deps: Record<string, string>): void;
|
|
||||||
/**
|
|
||||||
* As checkSymbol(), but exit with an error if the
|
|
||||||
* dependency cannot be satisfied.
|
|
||||||
*
|
|
||||||
* @param lib an external dependency to import
|
|
||||||
* @param ver version of the dependency
|
|
||||||
* @param symbol symbol to check for
|
|
||||||
*/
|
|
||||||
export function requireSymbol(lib: string, ver?: string, symbol?: string): void;
|
|
||||||
/**
|
|
||||||
* Check whether an external GI typelib can be imported
|
|
||||||
* and provides @symbol.
|
|
||||||
*
|
|
||||||
* Symbols may refer to
|
|
||||||
* - global functions ('main_quit')
|
|
||||||
* - classes ('Window')
|
|
||||||
* - class / instance methods ('IconTheme.get_default' / 'IconTheme.has_icon')
|
|
||||||
* - GObject properties ('Window.default_height')
|
|
||||||
*
|
|
||||||
* @param lib an external dependency to import
|
|
||||||
* @param ver version of the dependency
|
|
||||||
* @param symbol symbol to check for
|
|
||||||
* @returns true if `lib` can be imported and provides `symbol`, false
|
|
||||||
* otherwise
|
|
||||||
*/
|
|
||||||
export function checkSymbol(lib: string, ver: string, symbol: string): boolean;
|
|
||||||
/**
|
|
||||||
* Initialize `gettext`.
|
|
||||||
* After calling this method `globalThis._`, `globalThis.C_` and `globalThis.N_` will be available.
|
|
||||||
*/
|
|
||||||
export function initGettext(): void;
|
|
||||||
/**
|
|
||||||
* Initializes string formatting capabilities by adding a format() method to String.prototype.
|
|
||||||
*
|
|
||||||
* After calling this method, you can use a printf-style string formatting by calling
|
|
||||||
* the format() method on any string:
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* pkg.initFormat();
|
|
||||||
*
|
|
||||||
* // Now you can use format() on any string
|
|
||||||
* const name = "User";
|
|
||||||
* const count = 5;
|
|
||||||
* const formatted = "Hello %s, you have %d items".format(name, count);
|
|
||||||
* // formatted = "Hello User, you have 5 items"
|
|
||||||
*
|
|
||||||
* // Format numbers with precision
|
|
||||||
* const price = 10.5;
|
|
||||||
* const priceStr = "Price: $%.2f".format(price);
|
|
||||||
* // priceStr = "Price: $10.50"
|
|
||||||
*
|
|
||||||
* // Pad with zeros
|
|
||||||
* const id = 42;
|
|
||||||
* const idStr = "ID: %05d".format(id);
|
|
||||||
* // idStr = "ID: 00042"
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export function initFormat(): void;
|
|
||||||
/**
|
|
||||||
* As checkSymbol(), but exit with an error if the
|
|
||||||
* dependency cannot be satisfied.
|
|
||||||
*
|
|
||||||
* @param lib an external dependency to import
|
|
||||||
* @param ver version of the dependency
|
|
||||||
* @param symbol symbol to check for
|
|
||||||
*/
|
|
||||||
export function initSubmodule(lib: string, ver?: string, symbol?: string): void;
|
|
||||||
/**
|
|
||||||
* Load and register a GResource named @name. @name is optional and defaults to ${package-name}
|
|
||||||
* @param name The name of the GResource to load
|
|
||||||
*/
|
|
||||||
export function loadResource(name?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace byteArray {
|
|
||||||
export class ByteArray {
|
|
||||||
static get(target: any, property: string, receiver: any): any;
|
|
||||||
static set(target: any, property: string, value: any, receiver: any): boolean;
|
|
||||||
|
|
||||||
length: number;
|
|
||||||
protected _array: Uint8Array;
|
|
||||||
|
|
||||||
constructor(x: Uint8Array | number);
|
|
||||||
toString(encoding?: TextDecoderEncoding): string;
|
|
||||||
fromString(input: string, encoding?: TextDecoderEncoding): ByteArray;
|
|
||||||
toGBytes(): GLib.Bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use {@link TextEncoder.encode} instead */
|
|
||||||
export function fromString(input: string, encoding?: TextDecoderEncoding): Uint8Array;
|
|
||||||
|
|
||||||
/** @deprecated Use {@link GLib.Bytes.toArray} instead */
|
|
||||||
export function fromGBytes(input: GLib.Bytes): Uint8Array;
|
|
||||||
|
|
||||||
/** @deprecated Use {@link TextDecoder.decode} instead */
|
|
||||||
export function toString(x: Uint8Array, encoding?: TextDecoderEncoding): string;
|
|
||||||
|
|
||||||
/** @deprecated Use {@link GLib.Bytes new GLib.Bytes() } instead */
|
|
||||||
export function toGBytes(x: Uint8Array): GLib.Bytes;
|
|
||||||
|
|
||||||
/** @deprecated Use {@link ByteArray new ByteArray()} instead */
|
|
||||||
export function fromArray(array: Iterable<number>): ByteArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace lang {
|
|
||||||
// TODO: There is a lot more in Lang
|
|
||||||
export function Class(props: any): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace format {
|
|
||||||
/**
|
|
||||||
* Formats a string using printf-style format specifiers.
|
|
||||||
*
|
|
||||||
* @param str The format string
|
|
||||||
* @param args The arguments to be formatted
|
|
||||||
* @returns The formatted string
|
|
||||||
*/
|
|
||||||
export function vprintf(str: string, args: (string | number | boolean | null | undefined)[]): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prints a formatted string to the console.
|
|
||||||
* Similar to C's printf function.
|
|
||||||
*
|
|
||||||
* @param fmt The format string
|
|
||||||
* @param args The arguments to be formatted
|
|
||||||
*/
|
|
||||||
export function printf(fmt: string, ...args: (string | number | boolean | null | undefined)[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Formats a string with the given arguments.
|
|
||||||
* This is the implementation that backs String.prototype.format
|
|
||||||
* when pkg.initFormat() is called.
|
|
||||||
*
|
|
||||||
* Supported format specifiers:
|
|
||||||
* - %s: Formats as a string
|
|
||||||
* - %d: Formats as an integer
|
|
||||||
* - %x: Formats as a hexadecimal number
|
|
||||||
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
||||||
*
|
|
||||||
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
||||||
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* format.format("Hello %s, you have %d items", "User", 5);
|
|
||||||
* // Returns: "Hello User, you have 5 items"
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param fmt The format string
|
|
||||||
* @param args The arguments to format the string with
|
|
||||||
* @returns The formatted string
|
|
||||||
*/
|
|
||||||
export function format(fmt: string, ...args: (string | number | boolean | null | undefined)[]): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace mainloop {
|
|
||||||
export function quit(name: string): void;
|
|
||||||
export function idle_source(handler: any, priority?: number): any;
|
|
||||||
export function idle_add(handler: any, priority?: number): any;
|
|
||||||
export function timeout_source(timeout: any, handler: any, priority?: number): any;
|
|
||||||
export function timeout_seconds_source(timeout: any, handler: any, priority?: number): any;
|
|
||||||
export function timeout_add(timeout: any, handler: any, priority?: number): any;
|
|
||||||
export function timeout_add_seconds(timeout: any, handler: any, priority?: number): any;
|
|
||||||
export function source_remove(id: any): any;
|
|
||||||
export function run(name: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* You can use the `Signals.addSignalMethods` method to apply the `Signals` convenience methods to an `Object`.
|
|
||||||
* Generally, this is called on an object prototype, but may also be called on an object instance.
|
|
||||||
* You can use this Interface for this object or prototype to make the methods in typescript known
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* const Signals = imports.signals;
|
|
||||||
*
|
|
||||||
* // Define an interface with the same name of your class to make the methods known
|
|
||||||
* interface Events extends Signals.Methods {}
|
|
||||||
*
|
|
||||||
* class Events {}
|
|
||||||
* Signals.addSignalMethods(Events.prototype);
|
|
||||||
*
|
|
||||||
* const events = new Events();
|
|
||||||
*
|
|
||||||
* // Typescript will not complain here
|
|
||||||
* events.emit("test-signal", "test argument");
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export interface SignalMethods {
|
|
||||||
/**
|
|
||||||
* Connects a callback to a signal for an object. Pass the returned ID to
|
|
||||||
* `disconnect()` to remove the handler.
|
|
||||||
*
|
|
||||||
* If `callback` returns `true`, emission will stop and no other handlers will be
|
|
||||||
* invoked.
|
|
||||||
*
|
|
||||||
* > Warning: Unlike GObject signals, `this` within a signal callback will always
|
|
||||||
* > refer to the global object (ie. `globalThis`).
|
|
||||||
*
|
|
||||||
* @param sigName A signal name
|
|
||||||
* @param callback A callback function
|
|
||||||
* @returns A handler ID
|
|
||||||
*/
|
|
||||||
connect(sigName: string, callback: (self: any, ...args: any[]) => void): number;
|
|
||||||
/**
|
|
||||||
* Emits a signal for an object. Emission stops if a signal handler returns `true`.
|
|
||||||
*
|
|
||||||
* Unlike GObject signals, it is not necessary to declare signals or define their
|
|
||||||
* signature. Simply call `emit()` with whatever signal name you wish, with
|
|
||||||
* whatever arguments you wish.
|
|
||||||
* @param sigName A signal name
|
|
||||||
* @param args Any number of arguments, of any type
|
|
||||||
*/
|
|
||||||
emit(sigName: string, ...args: any[]): void;
|
|
||||||
/**
|
|
||||||
* Disconnects a handler for a signal.
|
|
||||||
* @param id The ID of the handler to be disconnected
|
|
||||||
*/
|
|
||||||
disconnect(id: number): void;
|
|
||||||
/**
|
|
||||||
* Disconnects all signal handlers for an object.
|
|
||||||
*/
|
|
||||||
disconnectAll(): void;
|
|
||||||
/**
|
|
||||||
* Checks if a handler ID is connected.
|
|
||||||
* @param id The ID of the handler to be disconnected
|
|
||||||
* @returns `true` if connected, or `false` if not
|
|
||||||
*/
|
|
||||||
signalHandlerIsConnected(id: number): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace signals {
|
|
||||||
export function addSignalMethods<T = any>(proto: T): proto is T & SignalMethods;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
// https://gitlab.gnome.org/GNOME/gjs/-/blob/1.73.2/modules/esm/_encoding/encodingMap.js#L7-232
|
|
||||||
type TextDecoderEncoding =
|
|
||||||
| 'unicode-1-1-utf-8'
|
|
||||||
| 'unicode11utf8'
|
|
||||||
| 'unicode20utf8'
|
|
||||||
| 'utf-8'
|
|
||||||
| 'utf8'
|
|
||||||
| 'x-unicode20utf8'
|
|
||||||
| '866'
|
|
||||||
| 'cp866'
|
|
||||||
| 'csibm866'
|
|
||||||
| 'ibm866'
|
|
||||||
| 'csisolatin2'
|
|
||||||
| 'iso-8859-2'
|
|
||||||
| 'iso-ir-101'
|
|
||||||
| 'iso8859-2'
|
|
||||||
| 'iso88592'
|
|
||||||
| 'iso_8859-2'
|
|
||||||
| 'iso_8859-2:1987'
|
|
||||||
| 'l2'
|
|
||||||
| 'latin2'
|
|
||||||
| 'csisolatin3'
|
|
||||||
| 'iso-8859-3'
|
|
||||||
| 'iso-ir-109'
|
|
||||||
| 'iso8859-3'
|
|
||||||
| 'iso88593'
|
|
||||||
| 'iso_8859-3'
|
|
||||||
| 'iso_8859-3:1988'
|
|
||||||
| 'l3'
|
|
||||||
| 'latin3'
|
|
||||||
| 'csisolatin4'
|
|
||||||
| 'iso-8859-4'
|
|
||||||
| 'iso-ir-110'
|
|
||||||
| 'iso8859-4'
|
|
||||||
| 'iso88594'
|
|
||||||
| 'iso_8859-4'
|
|
||||||
| 'iso_8859-4:1988'
|
|
||||||
| 'l4'
|
|
||||||
| 'latin4'
|
|
||||||
| 'csisolatincyrillic'
|
|
||||||
| 'cyrillic'
|
|
||||||
| 'iso-8859-5'
|
|
||||||
| 'iso-ir-144'
|
|
||||||
| 'iso8859-5'
|
|
||||||
| 'iso88595'
|
|
||||||
| 'iso_8859-5'
|
|
||||||
| 'iso_8859-5:1988'
|
|
||||||
| 'arabic'
|
|
||||||
| 'asmo-708'
|
|
||||||
| 'csiso88596e'
|
|
||||||
| 'csiso88596i'
|
|
||||||
| 'csisolatinarabic'
|
|
||||||
| 'ecma-114'
|
|
||||||
| 'iso-8859-6'
|
|
||||||
| 'iso-8859-6-e'
|
|
||||||
| 'iso-8859-6-i'
|
|
||||||
| 'iso-ir-127'
|
|
||||||
| 'iso8859-6'
|
|
||||||
| 'iso88596'
|
|
||||||
| 'iso_8859-6'
|
|
||||||
| 'iso_8859-6:1987'
|
|
||||||
| 'csisolatingreek'
|
|
||||||
| 'ecma-118'
|
|
||||||
| 'elot_928'
|
|
||||||
| 'greek'
|
|
||||||
| 'greek8'
|
|
||||||
| 'iso-8859-7'
|
|
||||||
| 'iso-ir-126'
|
|
||||||
| 'iso8859-7'
|
|
||||||
| 'iso88597'
|
|
||||||
| 'iso_8859-7'
|
|
||||||
| 'iso_8859-7:1987'
|
|
||||||
| 'sun_eu_greek'
|
|
||||||
| 'csiso88598e'
|
|
||||||
| 'csisolatinhebrew'
|
|
||||||
| 'hebrew'
|
|
||||||
| 'iso-8859-8'
|
|
||||||
| 'iso-8859-8-e'
|
|
||||||
| 'iso-ir-138'
|
|
||||||
| 'iso8859-8'
|
|
||||||
| 'iso88598'
|
|
||||||
| 'iso_8859-8'
|
|
||||||
| 'iso_8859-8:1988'
|
|
||||||
| 'visual'
|
|
||||||
| 'csiso88598i'
|
|
||||||
| 'iso-8859-8-i'
|
|
||||||
| 'logical'
|
|
||||||
| 'csisolatin6'
|
|
||||||
| 'iso-8859-10'
|
|
||||||
| 'iso-ir-157'
|
|
||||||
| 'iso8859-10'
|
|
||||||
| 'iso885910'
|
|
||||||
| 'l6'
|
|
||||||
| 'latin6'
|
|
||||||
| 'iso-8859-13'
|
|
||||||
| 'iso8859-13'
|
|
||||||
| 'iso885913'
|
|
||||||
| 'iso-8859-14'
|
|
||||||
| 'iso8859-14'
|
|
||||||
| 'iso885914'
|
|
||||||
| 'csisolatin9'
|
|
||||||
| 'iso-8859-15'
|
|
||||||
| 'iso8859-15'
|
|
||||||
| 'iso885915'
|
|
||||||
| 'iso_8859-15'
|
|
||||||
| 'l9'
|
|
||||||
| 'iso-8859-16'
|
|
||||||
| 'cskoi8r'
|
|
||||||
| 'koi'
|
|
||||||
| 'koi8'
|
|
||||||
| 'koi8-r'
|
|
||||||
| 'koi8_r'
|
|
||||||
| 'koi8-ru'
|
|
||||||
| 'koi8-u'
|
|
||||||
| 'csmacintosh'
|
|
||||||
| 'mac'
|
|
||||||
| 'macintosh'
|
|
||||||
| 'x-mac-roman'
|
|
||||||
| 'dos-874'
|
|
||||||
| 'iso-8859-11'
|
|
||||||
| 'iso8859-11'
|
|
||||||
| 'iso885911'
|
|
||||||
| 'tis-620'
|
|
||||||
| 'windows-874'
|
|
||||||
| 'cp1250'
|
|
||||||
| 'windows-1250'
|
|
||||||
| 'x-cp1250'
|
|
||||||
| 'cp1251'
|
|
||||||
| 'windows-1251'
|
|
||||||
| 'x-cp1251'
|
|
||||||
| 'ansi_x3.4-1968'
|
|
||||||
| 'ascii'
|
|
||||||
| 'cp1252'
|
|
||||||
| 'cp819'
|
|
||||||
| 'csisolatin1'
|
|
||||||
| 'ibm819'
|
|
||||||
| 'iso-8859-1'
|
|
||||||
| 'iso-ir-100'
|
|
||||||
| 'iso8859-1'
|
|
||||||
| 'iso88591'
|
|
||||||
| 'iso_8859-1'
|
|
||||||
| 'iso_8859-1:1987'
|
|
||||||
| 'l1'
|
|
||||||
| 'latin1'
|
|
||||||
| 'us-ascii'
|
|
||||||
| 'windows-1252'
|
|
||||||
| 'x-cp1252'
|
|
||||||
| 'cp1253'
|
|
||||||
| 'windows-1253'
|
|
||||||
| 'x-cp1253'
|
|
||||||
| 'cp1254'
|
|
||||||
| 'csisolatin5'
|
|
||||||
| 'iso-8859-9'
|
|
||||||
| 'iso-ir-148'
|
|
||||||
| 'iso8859-9'
|
|
||||||
| 'iso88599'
|
|
||||||
| 'iso_8859-9'
|
|
||||||
| 'iso_8859-9:1989'
|
|
||||||
| 'l5'
|
|
||||||
| 'latin5'
|
|
||||||
| 'windows-1254'
|
|
||||||
| 'x-cp1254'
|
|
||||||
| 'cp1255'
|
|
||||||
| 'windows-1255'
|
|
||||||
| 'x-cp1255'
|
|
||||||
| 'cp1256'
|
|
||||||
| 'windows-1256'
|
|
||||||
| 'x-cp1256'
|
|
||||||
| 'cp1257'
|
|
||||||
| 'windows-1257'
|
|
||||||
| 'x-cp1257'
|
|
||||||
| 'cp1258'
|
|
||||||
| 'windows-1258'
|
|
||||||
| 'x-cp1258'
|
|
||||||
| 'x-mac-cyrillic'
|
|
||||||
| 'x-mac-ukrainian'
|
|
||||||
| 'chinese'
|
|
||||||
| 'csgb2312'
|
|
||||||
| 'csiso58gb231280'
|
|
||||||
| 'gb2312'
|
|
||||||
| 'gb_2312'
|
|
||||||
| 'gb_2312-80'
|
|
||||||
| 'gbk'
|
|
||||||
| 'iso-ir-58'
|
|
||||||
| 'x-gbk'
|
|
||||||
| 'gb18030'
|
|
||||||
| 'big5'
|
|
||||||
| 'cn-big5'
|
|
||||||
| 'csbig5'
|
|
||||||
| 'x-x-big5'
|
|
||||||
| 'cseucpkdfmtjapanese'
|
|
||||||
| 'euc-jp'
|
|
||||||
| 'x-euc-jp'
|
|
||||||
| 'csiso2022jp'
|
|
||||||
| 'iso-2022-jp'
|
|
||||||
| 'csshiftjis'
|
|
||||||
| 'ms932'
|
|
||||||
| 'ms_kanji'
|
|
||||||
| 'shift-jis'
|
|
||||||
| 'shift_jis'
|
|
||||||
| 'sjis'
|
|
||||||
| 'windows-31j'
|
|
||||||
| 'x-sjis'
|
|
||||||
| 'cseuckr'
|
|
||||||
| 'csksc56011987'
|
|
||||||
| 'euc-kr'
|
|
||||||
| 'iso-ir-149'
|
|
||||||
| 'korean'
|
|
||||||
| 'ks_c_5601-1987'
|
|
||||||
| 'ks_c_5601-1989'
|
|
||||||
| 'ksc5601'
|
|
||||||
| 'ksc_5601'
|
|
||||||
| 'windows-949'
|
|
||||||
| 'unicodefffe'
|
|
||||||
| 'utf-16be'
|
|
||||||
| 'csunicode'
|
|
||||||
| 'iso-10646-ucs-2'
|
|
||||||
| 'ucs-2'
|
|
||||||
| 'unicode'
|
|
||||||
| 'unicodefeff'
|
|
||||||
| 'utf-16'
|
|
||||||
| 'utf-16le';
|
|
||||||
|
|
||||||
interface GjsGiImports {
|
|
||||||
// Will be extended by the import of more gir types
|
|
||||||
versions: {
|
|
||||||
[namespace: string]: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GjsImports {
|
|
||||||
gi: GjsGiImports;
|
|
||||||
lang: typeof lang;
|
|
||||||
system: typeof system;
|
|
||||||
signals: typeof signals;
|
|
||||||
package: typeof package;
|
|
||||||
mainloop: typeof mainloop;
|
|
||||||
searchPath: string[];
|
|
||||||
gettext: typeof gettext;
|
|
||||||
byteArray: typeof byteArray;
|
|
||||||
format: typeof format;
|
|
||||||
cairo: typeof cairo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overwrites, see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/modules/script/package.js
|
|
||||||
/**
|
|
||||||
* Run `pkg.initGettext()` before using this.
|
|
||||||
* See {@link gettext.gettext}
|
|
||||||
*/
|
|
||||||
const _: typeof gettext.gettext;
|
|
||||||
/**
|
|
||||||
* Run `pkg.initGettext()` before using this.
|
|
||||||
* See {@link gettext.pgettext}
|
|
||||||
*/
|
|
||||||
const C_: typeof gettext.pgettext;
|
|
||||||
/**
|
|
||||||
* Run `pkg.initGettext()` before using this.
|
|
||||||
* Currently not implemented.
|
|
||||||
*/
|
|
||||||
const N_: (x: string) => string;
|
|
||||||
|
|
||||||
function print(...args: any[]): void;
|
|
||||||
function printerr(...args: any[]): void;
|
|
||||||
function log(obj: object, others?: object[]): void;
|
|
||||||
function log(msg: string, substitutions?: any[]): void;
|
|
||||||
function logError(exception: object, message?: any): void;
|
|
||||||
function logError(message?: any): void;
|
|
||||||
|
|
||||||
const pkg: typeof package;
|
|
||||||
|
|
||||||
interface BooleanConstructor {
|
|
||||||
$gtype: GObject.GType<boolean>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NumberConstructor {
|
|
||||||
$gtype: GObject.GType<number>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface StringConstructor {
|
|
||||||
$gtype: GObject.GType<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface StringConstructor {
|
|
||||||
$gtype: GObject.GType<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ObjectConstructor {
|
|
||||||
$gtype: GObject.GType<Object>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const imports: GjsImports;
|
|
||||||
|
|
||||||
const ARGV: string[];
|
|
||||||
|
|
||||||
interface String {
|
|
||||||
/**
|
|
||||||
* Formats a string with the given arguments.
|
|
||||||
* This method is made available by calling `pkg.initFormat()`.
|
|
||||||
*
|
|
||||||
* Supported format specifiers:
|
|
||||||
* - %s: Formats as a string
|
|
||||||
* - %d: Formats as an integer
|
|
||||||
* - %x: Formats as a hexadecimal number
|
|
||||||
* - %f: Formats as a floating point number, optionally with precision (e.g. %.2f)
|
|
||||||
*
|
|
||||||
* All specifiers can be prefixed with a minimum field width, e.g. "%5s" will pad with spaces.
|
|
||||||
* If the width is prefixed with '0', it will pad with zeroes instead of spaces.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* // After calling pkg.initFormat()
|
|
||||||
* "Hello %s, you have %d items".format("User", 5);
|
|
||||||
* // Returns: "Hello User, you have 5 items"
|
|
||||||
*
|
|
||||||
* "Price: $%.2f".format(10.5);
|
|
||||||
* // Returns: "Price: $10.50"
|
|
||||||
*
|
|
||||||
* "ID: %05d".format(42);
|
|
||||||
* // Returns: "ID: 00042"
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param args The arguments to format the string with
|
|
||||||
* @returns The formatted string
|
|
||||||
*/
|
|
||||||
format(...args: (string | number | boolean | null | undefined)[]): string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const _imports: GjsImports;
|
|
||||||
export default _imports;
|
|
||||||
export { _imports as imports };
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
const imports = globalThis.imports || {};
|
|
||||||
|
|
||||||
export { imports }
|
|
||||||
export default imports;
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-13
@@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './gjs-ambient.d.ts';
|
|
||||||
|
|
||||||
import gjs from './gjs.js';
|
|
||||||
export default gjs;
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import gjs from './gjs.js';
|
|
||||||
export default gjs;
|
|
||||||
|
|
||||||
Generated
Vendored
-74
@@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@girs/gjs",
|
|
||||||
"version": "4.0.0-beta.38",
|
|
||||||
"description": "GJS TypeScript type definitions for Gjs",
|
|
||||||
"type": "module",
|
|
||||||
"module": "gjs.js",
|
|
||||||
"main": "gjs.js",
|
|
||||||
"exports": {
|
|
||||||
"./ambient": {
|
|
||||||
"types": "./gjs-ambient.d.ts",
|
|
||||||
"import": "./gjs-ambient.js",
|
|
||||||
"default": "./gjs-ambient.js"
|
|
||||||
},
|
|
||||||
"./dom": {
|
|
||||||
"types": "./dom.d.ts",
|
|
||||||
"import": "./dom.js",
|
|
||||||
"default": "./dom.js"
|
|
||||||
},
|
|
||||||
"./gettext": {
|
|
||||||
"types": "./gettext.d.ts",
|
|
||||||
"import": "./gettext.js",
|
|
||||||
"default": "./gettext.js"
|
|
||||||
},
|
|
||||||
"./system": {
|
|
||||||
"types": "./system.d.ts",
|
|
||||||
"import": "./system.js",
|
|
||||||
"default": "./system.js"
|
|
||||||
},
|
|
||||||
"./cairo": {
|
|
||||||
"types": "./cairo.d.ts",
|
|
||||||
"import": "./cairo.js",
|
|
||||||
"default": "./cairo.js"
|
|
||||||
},
|
|
||||||
"./console": {
|
|
||||||
"types": "./console.d.ts",
|
|
||||||
"import": "./console.js",
|
|
||||||
"default": "./console.js"
|
|
||||||
},
|
|
||||||
"./gjs": {
|
|
||||||
"types": "./gjs.d.ts",
|
|
||||||
"import": "./gjs.js",
|
|
||||||
"default": "./gjs.js"
|
|
||||||
},
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js",
|
|
||||||
"default": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tsc --project tsconfig.json"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/glib-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/gio-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/cairo-1.0": "1.0.0-4.0.0-beta.38" },
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "*"
|
|
||||||
},
|
|
||||||
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "Gjs"],
|
|
||||||
"author": "ts-for-gir",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gjsify/types.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/gjsify/types/tree/main/gjs#readme"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-174
@@ -1,174 +0,0 @@
|
|||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property contains the name of the script as it was invoked from the command
|
|
||||||
* line. In C and other languages, this information is contained in the first element of
|
|
||||||
* the platform's equivalent of argv, but GJS's ARGV only contains the
|
|
||||||
* subsequent command-line arguments. In other words, `ARGV[0]` in GJS is the same as `argv[1]` in C.
|
|
||||||
* @version Gjs 1.68
|
|
||||||
*/
|
|
||||||
export const programInvocationName: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This property contains version information about GJS.
|
|
||||||
*/
|
|
||||||
export const version: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The full path of the executed program.
|
|
||||||
* @version Gjs 1.68
|
|
||||||
*/
|
|
||||||
export const programPath: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of arguments passed to the current process.
|
|
||||||
* This is effectively an alias for the global `ARGV`, which is misleading in that
|
|
||||||
* it is not equivalent to the platform'`s` argv.
|
|
||||||
* @version Gjs 1.68
|
|
||||||
*/
|
|
||||||
export const programArgs: string[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the memory address of any object as a string.
|
|
||||||
* This is the address of memory being managed by the JavaScript engine, which may
|
|
||||||
* represent a wrapper around memory elsewhere.
|
|
||||||
* **Caution**, don't use this as a unique identifier!
|
|
||||||
* JavaScript's garbage collector can move objects around in memory, or
|
|
||||||
* deduplicate identical objects, so this value may change during the execution
|
|
||||||
* of a program.
|
|
||||||
* @param o Any Object
|
|
||||||
* @returns A hexadecimal string (e.g. `0xb4f170f0`)
|
|
||||||
*/
|
|
||||||
export function addressOf(o: object): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the memory address of any GObject as a string.
|
|
||||||
* See also {@link addressOf}
|
|
||||||
* @param o Any {@link GObject.Object}-derived instance
|
|
||||||
* @returns A hexadecimal string (e.g. `0xb4f170f0`)
|
|
||||||
* @version Gjs 1.58
|
|
||||||
*/
|
|
||||||
export function addressOfGObject(o: GObject.Object): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inserts a breakpoint instruction into the code.
|
|
||||||
* **Warning**: Using this function in code run outside of GDB will abort the process.
|
|
||||||
* With `System.breakpoint()` calls in your code, a GJS program can be debugged by
|
|
||||||
* running it in GDB:
|
|
||||||
* ```bash
|
|
||||||
* gdb --args gjs script.js
|
|
||||||
* ```
|
|
||||||
* Once GDB has started, you can start the program with run. When the debugger
|
|
||||||
* hits a breakpoint it will pause execution of the process and return to the
|
|
||||||
* prompt. You can then use the standard `backtrace` command to print a C++ stack
|
|
||||||
* trace, or use `call gjs_dumpstack()` to print a JavaScript stack trace:
|
|
||||||
* ```bash
|
|
||||||
* (gdb) run
|
|
||||||
* tarting program: /usr/bin/gjs -m script.js
|
|
||||||
* ...
|
|
||||||
* Thread 1 "gjs" received signal SIGTRAP, Trace/breakpoint trap.
|
|
||||||
* (gdb) call gjs_dumpstack()
|
|
||||||
* == Stack trace for context 0x5555555b7180 ==
|
|
||||||
* #0 555555640548 i file:///path/to/script.js:4 (394b8c3cc060 @ 12)
|
|
||||||
* #1 5555556404c8 i file:///path/to/script.js:7 (394b8c3cc0b0 @ 6)
|
|
||||||
* #2 7fffffffd3a0 b self-hosted:2408 (394b8c3a9650 @ 753)
|
|
||||||
* #3 5555556403e8 i self-hosted:2355 (394b8c3a9600 @ 375)
|
|
||||||
* (gdb)
|
|
||||||
* ```
|
|
||||||
* To continue executing the program, you can use the `continue` (or `cont`) to
|
|
||||||
* resume the process and debug further.
|
|
||||||
* Remember that if you run the program outside of GDB, it will abort at the
|
|
||||||
* breakpoint, so make sure to remove any calls to `System.breakpoint()` when
|
|
||||||
* you're done debugging.
|
|
||||||
*/
|
|
||||||
export function breakpoint(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the timezone cache.
|
|
||||||
* This is a workaround for SpiderMonkey Bug [#1004706](https://bugzilla.mozilla.org/show_bug.cgi?id=1004706).
|
|
||||||
*/
|
|
||||||
export function clearDateCaches(): void;
|
|
||||||
|
|
||||||
/** Runs the garbage collector */
|
|
||||||
export function gc(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the reference count of any GObject-derived type. When an object's
|
|
||||||
* reference count is zero, it is cleaned up and erased from memory.
|
|
||||||
* @param o A {@link GObject.Object}
|
|
||||||
*/
|
|
||||||
export function refcount(o: GObject.Object): number;
|
|
||||||
/**
|
|
||||||
* See also: The [heapgraph](https://gitlab.gnome.org/GNOME/gjs/blob/HEAD/tools/heapgraph.md) utility in the GJS repository.
|
|
||||||
* Dump a representation of internal heap memory. If `path` is not given, GJS will
|
|
||||||
* write the contents to `stdout`.
|
|
||||||
* @param path Optional file path
|
|
||||||
*/
|
|
||||||
export function dumpHeap(path?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dump internal garbage collector statistics. If `path` is not given, GJS will
|
|
||||||
* write the contents to `stdout`.
|
|
||||||
* @param path Optional file path
|
|
||||||
* @version Gjs 1.70
|
|
||||||
* @example Output:
|
|
||||||
* ```json
|
|
||||||
* {
|
|
||||||
* "gcBytes": 794624,
|
|
||||||
* "gcMaxBytes": 4294967295,
|
|
||||||
* "mallocBytes": 224459,
|
|
||||||
* "gcIsHighFrequencyMode": true,
|
|
||||||
* "gcNumber": 1,
|
|
||||||
* "majorGCCount": 1,
|
|
||||||
* "minorGCCount": 1,
|
|
||||||
* "sliceCount": 1,
|
|
||||||
* "zone": {
|
|
||||||
* "gcBytes": 323584,
|
|
||||||
* "gcTriggerBytes": 42467328,
|
|
||||||
* "gcAllocTrigger": 36097228.8,
|
|
||||||
* "mallocBytes": 120432,
|
|
||||||
* "mallocTriggerBytes": 59768832,
|
|
||||||
* "gcNumber": 1
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export function dumpMemoryInfo(path?: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This works the same as C's exit() function; exits the program, passing a
|
|
||||||
* certain error code to the shell. The shell expects the error code to be zero if
|
|
||||||
* there was no error, or non-zero (any value you please) to indicate an error.
|
|
||||||
*
|
|
||||||
* This value is used by other tools such as `make`; if `make` calls a program that
|
|
||||||
* returns a non-zero error code, then `make` aborts the build.
|
|
||||||
* @param code An exit code
|
|
||||||
*/
|
|
||||||
export function exit(code: number): never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The System module provides common low-level facilities such as access to
|
|
||||||
* process arguments and exit(), as well as a number of useful functions and
|
|
||||||
* properties for debugging.
|
|
||||||
*
|
|
||||||
* Note that the majority of the functions and properties in this module should not
|
|
||||||
* be used in normal operation of a GJS application.
|
|
||||||
*/
|
|
||||||
declare const System: {
|
|
||||||
programInvocationName: typeof programInvocationName;
|
|
||||||
version: typeof version;
|
|
||||||
programPath: typeof programPath;
|
|
||||||
programArgs: typeof programArgs;
|
|
||||||
addressOf: typeof addressOf;
|
|
||||||
addressOfGObject: typeof addressOfGObject;
|
|
||||||
breakpoint: typeof breakpoint;
|
|
||||||
clearDateCaches: typeof clearDateCaches;
|
|
||||||
gc: typeof gc;
|
|
||||||
refcount: typeof refcount;
|
|
||||||
dumpHeap: typeof dumpHeap;
|
|
||||||
dumpMemoryInfo: typeof dumpMemoryInfo;
|
|
||||||
exit: typeof exit;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default System;
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
import System, { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo } from 'system';
|
|
||||||
|
|
||||||
export { programInvocationName, version, programPath, programArgs, exit, addressOfGObject, addressOf, gc, refcount, dumpHeap, dumpMemoryInfo };
|
|
||||||
export default System;
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// General settings for code interpretation
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": [],
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"rootDir": ".",
|
|
||||||
// General settings for code generation
|
|
||||||
"removeComments": false,
|
|
||||||
"inlineSourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"newLine": "LF",
|
|
||||||
// Show diagnostics
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": ["./dom.d.ts","./gjs.d.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPoints": ["./gjs.d.ts"],
|
|
||||||
"readme": "./README.md",
|
|
||||||
"name": "Gjs",
|
|
||||||
"tsconfig": "./tsconfig.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
Generated
Vendored
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# GLib-2.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for GLib-2.0, generated from library version 2.86.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/glib-2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import GLib from '@girs/glib-2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/glib-2.0` or `@girs/glib-2.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/glib-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/glib-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import GLib from 'gi://GLib?version=2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/glib-2.0` or `@girs/glib-2.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/glib-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/glib-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const GLib = imports.gi.GLib;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://GLib?version=2.0' {
|
|
||||||
import GLib20 from '@girs/glib-2.0';
|
|
||||||
export default GLib20;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://GLib' {
|
|
||||||
import GLib20 from 'gi://GLib?version=2.0';
|
|
||||||
export default GLib20;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
import type GLib20 from '@girs/glib-2.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
GLib: typeof GLib20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
Generated
Vendored
-27258
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import GLib from 'gi://GLib?version=2.0';
|
|
||||||
export default GLib;
|
|
||||||
|
|
||||||
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './glib-2.0-ambient.d.ts';
|
|
||||||
|
|
||||||
import './glib-2.0-import.d.ts';
|
|
||||||
|
|
||||||
import GLib from './glib-2.0.js';
|
|
||||||
export default GLib;
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import GLib from './glib-2.0.js';
|
|
||||||
export default GLib;
|
|
||||||
|
|
||||||
Generated
Vendored
-52
@@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@girs/glib-2.0",
|
|
||||||
"version": "2.86.0-4.0.0-beta.38",
|
|
||||||
"description": "GJS TypeScript type definitions for GLib-2.0, generated from library version 2.86.0",
|
|
||||||
"type": "module",
|
|
||||||
"module": "glib-2.0.js",
|
|
||||||
"main": "glib-2.0.js",
|
|
||||||
"exports": {
|
|
||||||
"./ambient": {
|
|
||||||
"types": "./glib-2.0-ambient.d.ts",
|
|
||||||
"import": "./glib-2.0-ambient.js",
|
|
||||||
"default": "./glib-2.0-ambient.js"
|
|
||||||
},
|
|
||||||
"./import": {
|
|
||||||
"types": "./glib-2.0-import.d.ts",
|
|
||||||
"import": "./glib-2.0-import.js",
|
|
||||||
"default": "./glib-2.0-import.js"
|
|
||||||
},
|
|
||||||
"./glib-2.0": {
|
|
||||||
"types": "./glib-2.0.d.ts",
|
|
||||||
"import": "./glib-2.0.js",
|
|
||||||
"default": "./glib-2.0.js"
|
|
||||||
},
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js",
|
|
||||||
"default": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tsc --project tsconfig.json"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@girs/gjs": "4.0.0-beta.38",
|
|
||||||
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.38" },
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "*"
|
|
||||||
},
|
|
||||||
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "GLib-2.0"],
|
|
||||||
"author": "ts-for-gir",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gjsify/types.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/gjsify/types/tree/main/glib-2.0#readme"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// General settings for code interpretation
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": [],
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"rootDir": ".",
|
|
||||||
// General settings for code generation
|
|
||||||
"removeComments": false,
|
|
||||||
"inlineSourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"newLine": "LF",
|
|
||||||
// Show diagnostics
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": ["./glib-2.0.d.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPoints": ["./glib-2.0.d.ts"],
|
|
||||||
"readme": "./README.md",
|
|
||||||
"name": "GLib-2.0",
|
|
||||||
"tsconfig": "./tsconfig.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
Generated
Vendored
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# GModule-2.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for GModule-2.0, generated from library version 2.0.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/gmodule-2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import GModule from '@girs/gmodule-2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/gmodule-2.0` or `@girs/gmodule-2.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gmodule-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gmodule-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import GModule from 'gi://GModule?version=2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/gmodule-2.0` or `@girs/gmodule-2.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gmodule-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gmodule-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const GModule = imports.gi.GModule;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://GModule?version=2.0' {
|
|
||||||
import GModule20 from '@girs/gmodule-2.0';
|
|
||||||
export default GModule20;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://GModule' {
|
|
||||||
import GModule20 from 'gi://GModule?version=2.0';
|
|
||||||
export default GModule20;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
import type GModule20 from '@girs/gmodule-2.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
GModule: typeof GModule20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
Generated
Vendored
-200
@@ -1,200 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import '@girs/gjs';
|
|
||||||
|
|
||||||
// Module dependencies
|
|
||||||
import type GLib from '@girs/glib-2.0';
|
|
||||||
import type GObject from '@girs/gobject-2.0';
|
|
||||||
|
|
||||||
export namespace GModule {
|
|
||||||
/**
|
|
||||||
* GModule-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Errors returned by g_module_open_full().
|
|
||||||
*/
|
|
||||||
class ModuleError extends GLib.Error {
|
|
||||||
static $gtype: GObject.GType<ModuleError>;
|
|
||||||
|
|
||||||
// Static fields
|
|
||||||
|
|
||||||
/**
|
|
||||||
* there was an error loading or opening a module file
|
|
||||||
*/
|
|
||||||
static FAILED: number;
|
|
||||||
/**
|
|
||||||
* a module returned an error from its `g_module_check_init()` function
|
|
||||||
*/
|
|
||||||
static CHECK_FAILED: number;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
constructor(options: { message: string; code: number });
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MODULE_IMPL_AR: number;
|
|
||||||
const MODULE_IMPL_DL: number;
|
|
||||||
const MODULE_IMPL_NONE: number;
|
|
||||||
const MODULE_IMPL_WIN32: number;
|
|
||||||
/**
|
|
||||||
* A portable way to build the filename of a module. The platform-specific
|
|
||||||
* prefix and suffix are added to the filename, if needed, and the result
|
|
||||||
* is added to the directory, using the correct separator character.
|
|
||||||
*
|
|
||||||
* The directory should specify the directory where the module can be found.
|
|
||||||
* It can be %NULL or an empty string to indicate that the module is in a
|
|
||||||
* standard platform-specific directory, though this is not recommended
|
|
||||||
* since the wrong module may be found.
|
|
||||||
*
|
|
||||||
* For example, calling g_module_build_path() on a Linux system with a
|
|
||||||
* `directory` of `/lib` and a `module_name` of "mylibrary" will return
|
|
||||||
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
|
|
||||||
* directory it will return `\Windows\mylibrary.dll`.
|
|
||||||
* @param directory the directory where the module is. This can be %NULL or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended
|
|
||||||
* @param module_name the name of the module
|
|
||||||
* @returns the complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed
|
|
||||||
*/
|
|
||||||
function module_build_path(directory: string | null, module_name: string): string;
|
|
||||||
/**
|
|
||||||
* Gets a string describing the last module error.
|
|
||||||
* @returns a string describing the last module error
|
|
||||||
*/
|
|
||||||
function module_error(): string;
|
|
||||||
function module_error_quark(): GLib.Quark;
|
|
||||||
/**
|
|
||||||
* Checks if modules are supported on the current platform.
|
|
||||||
* @returns %TRUE if modules are supported
|
|
||||||
*/
|
|
||||||
function module_supported(): boolean;
|
|
||||||
interface ModuleCheckInit {
|
|
||||||
(module: Module): string;
|
|
||||||
}
|
|
||||||
interface ModuleUnload {
|
|
||||||
(module: Module): void;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Flags passed to g_module_open().
|
|
||||||
* Note that these flags are not supported on all platforms.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags passed to g_module_open().
|
|
||||||
* Note that these flags are not supported on all platforms.
|
|
||||||
*/
|
|
||||||
export namespace ModuleFlags {
|
|
||||||
export const $gtype: GObject.GType<ModuleFlags>;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ModuleFlags {
|
|
||||||
/**
|
|
||||||
* specifies that symbols are only resolved when
|
|
||||||
* needed. The default action is to bind all symbols when the module
|
|
||||||
* is loaded.
|
|
||||||
*/
|
|
||||||
LAZY,
|
|
||||||
/**
|
|
||||||
* specifies that symbols in the module should
|
|
||||||
* not be added to the global name space. The default action on most
|
|
||||||
* platforms is to place symbols in the module in the global name space,
|
|
||||||
* which may cause conflicts with existing symbols.
|
|
||||||
*/
|
|
||||||
LOCAL,
|
|
||||||
/**
|
|
||||||
* mask for all flags.
|
|
||||||
*/
|
|
||||||
MASK,
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The #GModule struct is an opaque data structure to represent a
|
|
||||||
* [dynamically-loaded module](modules.html#dynamic-loading-of-modules).
|
|
||||||
* It should only be accessed via the following functions.
|
|
||||||
*/
|
|
||||||
abstract class Module {
|
|
||||||
static $gtype: GObject.GType<Module>;
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
_init(...args: any[]): void;
|
|
||||||
|
|
||||||
// Static methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A portable way to build the filename of a module. The platform-specific
|
|
||||||
* prefix and suffix are added to the filename, if needed, and the result
|
|
||||||
* is added to the directory, using the correct separator character.
|
|
||||||
*
|
|
||||||
* The directory should specify the directory where the module can be found.
|
|
||||||
* It can be %NULL or an empty string to indicate that the module is in a
|
|
||||||
* standard platform-specific directory, though this is not recommended
|
|
||||||
* since the wrong module may be found.
|
|
||||||
*
|
|
||||||
* For example, calling g_module_build_path() on a Linux system with a
|
|
||||||
* `directory` of `/lib` and a `module_name` of "mylibrary" will return
|
|
||||||
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
|
|
||||||
* directory it will return `\Windows\mylibrary.dll`.
|
|
||||||
* @param directory the directory where the module is. This can be %NULL or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended
|
|
||||||
* @param module_name the name of the module
|
|
||||||
*/
|
|
||||||
static build_path(directory: string | null, module_name: string): string;
|
|
||||||
/**
|
|
||||||
* Gets a string describing the last module error.
|
|
||||||
*/
|
|
||||||
static error(): string;
|
|
||||||
static error_quark(): GLib.Quark;
|
|
||||||
/**
|
|
||||||
* Checks if modules are supported on the current platform.
|
|
||||||
*/
|
|
||||||
static supported(): boolean;
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes a module.
|
|
||||||
* @returns %TRUE on success
|
|
||||||
*/
|
|
||||||
close(): boolean;
|
|
||||||
/**
|
|
||||||
* Ensures that a module will never be unloaded.
|
|
||||||
* Any future g_module_close() calls on the module will be ignored.
|
|
||||||
*/
|
|
||||||
make_resident(): void;
|
|
||||||
/**
|
|
||||||
* Returns the filename that the module was opened with.
|
|
||||||
*
|
|
||||||
* If `module` refers to the application itself, "main" is returned.
|
|
||||||
* @returns the filename of the module
|
|
||||||
*/
|
|
||||||
name(): string;
|
|
||||||
/**
|
|
||||||
* Gets a symbol pointer from a module, such as one exported
|
|
||||||
* by %G_MODULE_EXPORT. Note that a valid symbol can be %NULL.
|
|
||||||
* @param symbol_name the name of the symbol to find
|
|
||||||
* @returns %TRUE on success
|
|
||||||
*/
|
|
||||||
symbol(symbol_name: string): [boolean, any];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
|
|
||||||
*/
|
|
||||||
const __name__: string;
|
|
||||||
/**
|
|
||||||
* Version of the imported GIR library
|
|
||||||
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
|
|
||||||
*/
|
|
||||||
const __version__: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GModule;
|
|
||||||
|
|
||||||
// END
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import GModule from 'gi://GModule?version=2.0';
|
|
||||||
export default GModule;
|
|
||||||
|
|
||||||
Generated
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Type Definitions for Gjs (https://gjs.guide/)
|
|
||||||
*
|
|
||||||
* These type definitions are automatically generated, do not edit them by hand.
|
|
||||||
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
|
|
||||||
*
|
|
||||||
* This template is used to generate the index.d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
import './gmodule-2.0-ambient.d.ts';
|
|
||||||
|
|
||||||
import './gmodule-2.0-import.d.ts';
|
|
||||||
|
|
||||||
import GModule from './gmodule-2.0.js';
|
|
||||||
export default GModule;
|
|
||||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import GModule from './gmodule-2.0.js';
|
|
||||||
export default GModule;
|
|
||||||
|
|
||||||
Generated
Vendored
-53
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@girs/gmodule-2.0",
|
|
||||||
"version": "2.0.0-4.0.0-beta.38",
|
|
||||||
"description": "GJS TypeScript type definitions for GModule-2.0, generated from library version 2.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"module": "gmodule-2.0.js",
|
|
||||||
"main": "gmodule-2.0.js",
|
|
||||||
"exports": {
|
|
||||||
"./ambient": {
|
|
||||||
"types": "./gmodule-2.0-ambient.d.ts",
|
|
||||||
"import": "./gmodule-2.0-ambient.js",
|
|
||||||
"default": "./gmodule-2.0-ambient.js"
|
|
||||||
},
|
|
||||||
"./import": {
|
|
||||||
"types": "./gmodule-2.0-import.d.ts",
|
|
||||||
"import": "./gmodule-2.0-import.js",
|
|
||||||
"default": "./gmodule-2.0-import.js"
|
|
||||||
},
|
|
||||||
"./gmodule-2.0": {
|
|
||||||
"types": "./gmodule-2.0.d.ts",
|
|
||||||
"import": "./gmodule-2.0.js",
|
|
||||||
"default": "./gmodule-2.0.js"
|
|
||||||
},
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js",
|
|
||||||
"default": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tsc --project tsconfig.json"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@girs/gjs": "4.0.0-beta.38",
|
|
||||||
"@girs/glib-2.0": "2.86.0-4.0.0-beta.38",
|
|
||||||
"@girs/gobject-2.0": "2.86.0-4.0.0-beta.38" },
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "*"
|
|
||||||
},
|
|
||||||
"keywords": ["Gir", "TypeScript", "types", "GObject-Introspection", "GJS", "GModule-2.0"],
|
|
||||||
"author": "ts-for-gir",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/gjsify/types.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/gjsify/ts-for-gir/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/gjsify/types/tree/main/gmodule-2.0#readme"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// General settings for code interpretation
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"types": [],
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"rootDir": ".",
|
|
||||||
// General settings for code generation
|
|
||||||
"removeComments": false,
|
|
||||||
"inlineSourceMap": false,
|
|
||||||
"inlineSources": false,
|
|
||||||
"newLine": "LF",
|
|
||||||
// Show diagnostics
|
|
||||||
"diagnostics": true
|
|
||||||
},
|
|
||||||
"include": ["./gmodule-2.0.d.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"entryPoints": ["./gmodule-2.0.d.ts"],
|
|
||||||
"readme": "./README.md",
|
|
||||||
"name": "GModule-2.0",
|
|
||||||
"tsconfig": "./tsconfig.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
Generated
Vendored
-85
@@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# GObject-2.0
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
GJS TypeScript type definitions for GObject-2.0, generated from library version 2.86.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v4.0.0-beta.38.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
To use this type definitions, install them with NPM:
|
|
||||||
```bash
|
|
||||||
npm install @girs/gobject-2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can import this package into your project like this:
|
|
||||||
```ts
|
|
||||||
import GObject from '@girs/gobject-2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ambient Modules
|
|
||||||
|
|
||||||
You can also use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) to import this module like you would do this in JavaScript.
|
|
||||||
For this you need to include `@girs/gobject-2.0` or `@girs/gobject-2.0/ambient` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gobject-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gobject-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can import the ambient module with TypeScript support:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import GObject from 'gi://GObject?version=2.0';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Global import
|
|
||||||
|
|
||||||
You can also import the module with Typescript support using the global `imports.gi` object of GJS.
|
|
||||||
For this you need to include `@girs/gobject-2.0` or `@girs/gobject-2.0/import` in your `tsconfig` or entry point Typescript file:
|
|
||||||
|
|
||||||
`index.ts`:
|
|
||||||
```ts
|
|
||||||
import '@girs/gobject-2.0'
|
|
||||||
```
|
|
||||||
|
|
||||||
`tsconfig.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"include": ["@girs/gobject-2.0"],
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you have also type support for this, too:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const GObject = imports.gi.GObject;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bundle
|
|
||||||
|
|
||||||
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
||||||
|
|
||||||
## Other packages
|
|
||||||
|
|
||||||
All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
declare module 'gi://GObject?version=2.0' {
|
|
||||||
import GObject20 from '@girs/gobject-2.0';
|
|
||||||
export default GObject20;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'gi://GObject' {
|
|
||||||
import GObject20 from 'gi://GObject?version=2.0';
|
|
||||||
export default GObject20;
|
|
||||||
}
|
|
||||||
Generated
Vendored
-2
@@ -1,2 +0,0 @@
|
|||||||
export {}
|
|
||||||
|
|
||||||
Generated
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
import type GObject20 from '@girs/gobject-2.0';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
export interface GjsGiImports {
|
|
||||||
GObject: typeof GObject20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GjsGiImports;
|
|
||||||
Generated
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
const gi = globalThis.imports?.gi || {};
|
|
||||||
export default gi;
|
|
||||||
|
|
||||||
Generated
Vendored
-7249
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
import GObject from 'gi://GObject?version=2.0';
|
|
||||||
export default GObject;
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user