Comparing version 3.0.0-beta.16 to 3.0.0
{ | ||
"name": "@girs/gjs", | ||
"version": "3.0.0-beta.16", | ||
"version": "3.0.0", | ||
"description": "GJS TypeScript type definitions for Gjs", | ||
@@ -63,4 +63,4 @@ "type": "module", | ||
"dependencies": { | ||
"@girs/gobject-2.0": "^2.76.1-3.0.0-beta.16", | ||
"@girs/glib-2.0": "^2.76.1-3.0.0-beta.16" | ||
"@girs/gobject-2.0": "^2.76.1-3.0.0", | ||
"@girs/glib-2.0": "^2.76.1-3.0.0" | ||
}, | ||
@@ -67,0 +67,0 @@ "devDependencies": { |
# Gjs | ||
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.0.0-beta.16. | ||
GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.0.0. | ||
[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 | ||
@@ -13,2 +15,3 @@ | ||
## Usage | ||
@@ -26,5 +29,21 @@ | ||
### Global types | ||
After the import, the global types of GJS are also available: | ||
```ts | ||
console.log('Hello World from console'); | ||
print('Hello World from print'); | ||
const ByteArray = imports.byteArray; | ||
const encoder = new TextEncoder(); | ||
const encoded = encoder.encode('𝓽𝓮𝔁𝓽'); | ||
// And so on... | ||
``` | ||
### Ambient Modules | ||
You can import core [ambient module](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) types. | ||
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: | ||
@@ -47,5 +66,4 @@ | ||
``` | ||
Now you can import `gettext` and `system` in ESM style with Typescript support: | ||
Now you can import `gettext`, `system` and `cairo` in ESM style with Typescript support: | ||
@@ -55,8 +73,27 @@ ```ts | ||
import system from 'system'; | ||
import cairo from 'cairo'; | ||
``` | ||
### GIR modules | ||
If you want to have more types for GIR 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). | ||
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/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 | ||
@@ -63,0 +100,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
58006
0
103