Skip to content

Commit

Permalink
Merge pull request #52 from gjsify/mark-types-for-47
Browse files Browse the repository at this point in the history
Mark a few types for GNOME 47
  • Loading branch information
JumpLink authored Sep 23, 2024
2 parents b6140e1 + faae7c6 commit 4e6e386
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 49 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"cSpell.words": [
"girs"
],
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs"
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
4 changes: 2 additions & 2 deletions packages/gnome-shell/src/misc/signals.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/misc/signals.js
// Credits https://github.com/swsnr/gnome-shell-extension-picture-of-the-day/blob/main/%40types/gnome-shell/misc/signals.d.ts
// TODO Move this SignalMethods to ts-fir-gir / @girs/gjs
// TODO Move this SignalMethods to ts-for-gir / @girs/gjs

type SignalMap<K> = {
[Signal in keyof K]: unknown[];
Expand Down Expand Up @@ -72,7 +72,7 @@ export interface SignalMethods<S extends SignalMap<S> = any> {
export interface EventEmitter<S extends SignalMap<S> = any> extends SignalMethods<S> {}

/**
* @version 46
* @version 47
*/
export class EventEmitter<S extends SignalMap<S> = any> {
connectObject(...args: any[]): number; // TODO: return type is return type of imports.misc.signalTracker.connectObject
Expand Down
32 changes: 16 additions & 16 deletions packages/gnome-shell/src/ui/messageTray.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import type * as MessageList from './messageList.js';

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L20
* @version 46
* @version 47
*/
export const ANIMATION_TIME: number;

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L36
* @version 46
* @version 47
*/
export enum State {
HIDDEN = 0,
Expand All @@ -38,7 +38,7 @@ export enum State {
* newer version having replaced them.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L51
* @version 46
* @version 47
*/
export enum NotificationDestroyedReason {
EXPIRED = 1,
Expand All @@ -54,7 +54,7 @@ export enum NotificationDestroyedReason {
* through the Telepathy client.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L62
* @version 46
* @version 47
*/
export enum Urgency {
LOW = 0,
Expand All @@ -72,7 +72,7 @@ export enum Urgency {
* of a notification is shown on the lock screen.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L76
* @version 46
* @version 47
*/
export enum PrivacyScope {
USER = 0,
Expand All @@ -86,7 +86,7 @@ export enum PrivacyScope {
* A notification without a policy object will inherit the default one.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L160
* @version 46
* @version 47
*/
export abstract class NotificationPolicy extends GObject.Object {
readonly enable: boolean;
Expand All @@ -109,7 +109,7 @@ export abstract class NotificationPolicy extends GObject.Object {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L213
* @version 46
* @version 47
*/
export class NotificationGenericPolicy extends NotificationPolicy {
public id: string;
Expand All @@ -126,7 +126,7 @@ export class NotificationGenericPolicy extends NotificationPolicy {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L243
* @version 46
* @version 47
*/
export class NotificationApplicationPolicy extends NotificationPolicy {
public id: string;
Expand All @@ -147,7 +147,7 @@ export class NotificationApplicationPolicy extends NotificationPolicy {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L316
* @version 46
* @version 47
*/
export class Sound extends GObject.Object {
constructor(file: Gio.File | null | undefined, themedName?: string);
Expand All @@ -157,7 +157,7 @@ export class Sound extends GObject.Object {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L335
* @version 46
* @version 47
*/
export class Action extends GObject.Object {
constructor(label: string, callback: () => void);
Expand All @@ -169,7 +169,7 @@ export class Action extends GObject.Object {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L482
* @version 46
* @version 47
*/
export declare namespace Source {
export interface ConstructorProps extends MessageList.Source.ConstructorProps {
Expand All @@ -179,7 +179,7 @@ export declare namespace Source {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L499
* @version 46
* @version 47
*/
export class Source extends MessageList.Source {
constructor(params?: Partial<Source.ConstructorProps>);
Expand Down Expand Up @@ -253,7 +253,7 @@ export declare namespace Notification {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L352
* @version 46
* @version 47
*/
export class Notification extends GObject.Object implements Notification.ObjectProperties {
constructor(params?: Notification.ConstructorProps);
Expand Down Expand Up @@ -316,7 +316,7 @@ export class Notification extends GObject.Object implements Notification.ObjectP

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L676
* @version 46
* @version 47
*/
export class MessageTray extends St.Widget {
constructor();
Expand All @@ -327,7 +327,7 @@ export class MessageTray extends St.Widget {

public readonly queueCount: number;

public bannerBlocked: boolean;
public set bannerBlocked(v: boolean);

public contains(descendant: Clutter.Actor): boolean;
public contains(source: Source): boolean;
Expand Down Expand Up @@ -392,6 +392,6 @@ export class MessageTray extends St.Widget {
* The {Source} that should be used to send system notifications.
*
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/messageTray.js#L1290
* @version 46
* @version 47
*/
export function getSystemSource(): Source;
8 changes: 4 additions & 4 deletions packages/gnome-shell/src/ui/modalDialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { ButtonInfo, Dialog } from './dialog.js';

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/modalDialog.js#L19
* @version 46
* @version 47
*/
export enum State {
OPENED = 0,
Expand All @@ -21,7 +21,7 @@ export enum State {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/modalDialog.js#L27
* @version 46
* @version 47
*/
export namespace ModalDialog {
export interface ConstructorProps extends St.Widget.ConstructorProps {
Expand All @@ -35,7 +35,7 @@ export namespace ModalDialog {

/**
* @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/modalDialog.js#L37
* @version 46
* @version 47
*/
export class ModalDialog extends St.Widget {
protected _state: State;
Expand All @@ -55,7 +55,7 @@ export class ModalDialog extends St.Widget {
public dialogLayout: Dialog;
public contentLayout: Dialog['contentLayout'];
public buttonLayout: Dialog['buttonLayout'];
public state: State;
public readonly state: State;

constructor(params?: Partial<ModalDialog.ConstructorProps>);

Expand Down
Loading

0 comments on commit 4e6e386

Please sign in to comment.