Skip to content

Commit

Permalink
Fix global interfaces and example
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Jan 3, 2024
1 parent 31a397e commit 6fbc0ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion examples/hello-world/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@girs/gjs'; // For global types like `log()`
import St from '@girs/st-13';
import GObject from '@girs/gobject-2.0';

import "@girs/gnome-shell/global"; // For global shell types
import "@girs/gnome-shell/extensions/global"; // For global shell types
import { Extension, gettext as _ } from '@girs/gnome-shell/extensions/extension';
import * as panelMenu from '@girs/gnome-shell/ui/panelMenu';
import { PopupMenuItem } from '@girs/gnome-shell/ui/popupMenu';
Expand Down
46 changes: 23 additions & 23 deletions packages/gnome-shell/src/extensions/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ declare global {
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L253
*/
const global: Shell.Global;
}

// Gnome shell monkey-patches format into `String` which is the recommended way to use formatting for translatable strings.
// See https://gjs.guide/extensions/development/translations.html#marking-strings-for-translation
interface String {
/**
* Format this string with the given `args`.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L355
* @param args
*/
format(...args: any[]): string;
}
// Gnome shell monkey-patches format into `String` which is the recommended way to use formatting for translatable strings.
// See https://gjs.guide/extensions/development/translations.html#marking-strings-for-translation
interface String {
/**
* Format this string with the given `args`.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L355
* @param args
*/
format(...args: any[]): string;
}

interface Math {
/**
* Returns {@link x} clamped to the inclusive range of {@link min} and {@link max}.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L357
* @param x The value to be clamped.
* @param min The lower bound of the result.
* @param max The upper bound of the result.
*/
clamp(x: number, min: number, max: number): number;
}
interface Math {
/**
* Returns {@link x} clamped to the inclusive range of {@link min} and {@link max}.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/8a8539ee6766058b39d0a5c0961a08f76799f4da/js/ui/environment.js#L357
* @param x The value to be clamped.
* @param min The lower bound of the result.
* @param max The upper bound of the result.
*/
clamp(x: number, min: number, max: number): number;
}
}

0 comments on commit 6fbc0ea

Please sign in to comment.