From 6a61c4e62343d0cc061464c300d801c58556b6c4 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sat, 21 Sep 2024 12:14:57 +0200 Subject: [PATCH 1/5] Check popup menu module for GNOME 47 --- packages/gnome-shell/src/ui/popupMenu.d.ts | 61 +++++++++++-------- .../gnome-shell/src/ui/status/keyboard.d.ts | 2 + 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/packages/gnome-shell/src/ui/popupMenu.d.ts b/packages/gnome-shell/src/ui/popupMenu.d.ts index 24d8fc8..aacc890 100644 --- a/packages/gnome-shell/src/ui/popupMenu.d.ts +++ b/packages/gnome-shell/src/ui/popupMenu.d.ts @@ -10,7 +10,7 @@ import * as BoxPointer from './boxpointer.js'; /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L16 - * @version 46 + * @version 47 */ export enum Ornament { NONE = 0, @@ -22,20 +22,20 @@ export enum Ornament { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L39 - * @version 46 + * @version 47 */ export function arrowIcon(side: St.Side): St.Icon; /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L67 - * @version 46 + * @version 47 */ declare namespace PopupBaseMenuItem { export interface ConstructorProps { reactive: boolean; activate: boolean; hover: boolean; - style_class: string; + style_class: string | null; can_focus: boolean; } } @@ -50,7 +50,7 @@ declare class PopupBaseMenuItem extends St.BoxLayout { sensitive: boolean; constructor(params?: Partial); - override _init(...args: any[]): void; + override _init(params?: Partial): void; activate(event: Clutter.Event): void; @@ -72,7 +72,7 @@ declare class PopupBaseMenuItem extends St.BoxLayout { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L285 - * @version 46 + * @version 47 */ export namespace PopupMenuItem { export interface ConstructorProps extends PopupBaseMenuItem.ConstructorProps {} @@ -80,10 +80,12 @@ export namespace PopupMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L286 - * @version 46 + * @version 47 */ export class PopupMenuItem extends PopupBaseMenuItem { constructor(text: string, params?: Partial); + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupMenuItem.ConstructorProps): void; override _init(text: string, params?: Partial): void; readonly label: St.Label; @@ -91,10 +93,12 @@ export class PopupMenuItem extends PopupBaseMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L302 - * @version 46 + * @version 47 */ export class PopupSeparatorMenuItem extends PopupBaseMenuItem { constructor(text?: string); + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupBaseMenuItem.ConstructorProps): void; override _init(text?: string): void; readonly label: St.Label; @@ -102,7 +106,7 @@ export class PopupSeparatorMenuItem extends PopupBaseMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L332 - * @version 46 + * @version 47 */ export namespace Switch { export interface ConstructorProps extends St.Bin.ConstructorProps { @@ -112,7 +116,7 @@ export namespace Switch { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L339 - * @version 46 + * @version 47 */ export class Switch extends St.Bin { state: boolean; @@ -121,7 +125,6 @@ export class Switch extends St.Bin { override _init(config?: Switch.ConstructorProps): void; override _init(state: boolean): void; - setToggleState(state: boolean): void; toggle(): void; // General signal handler methods @@ -137,7 +140,7 @@ export class Switch extends St.Bin { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L415 - * @version 46 + * @version 47 */ export namespace PopupSwitchMenuItem { export interface ConstructorProps extends PopupBaseMenuItem.ConstructorProps {} @@ -145,12 +148,14 @@ export namespace PopupSwitchMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L417 - * @version 46 + * @version 47 */ export class PopupSwitchMenuItem extends PopupBaseMenuItem { readonly state: boolean; constructor(text: string, active: boolean, params?: PopupSwitchMenuItem.ConstructorProps); + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupSwitchMenuItem.ConstructorProps): void; override _init(text: string, active: boolean, params?: PopupSwitchMenuItem.ConstructorProps): void; setStatus(text: string): void; @@ -180,10 +185,12 @@ export namespace PopupImageMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L506 - * @version 46 + * @version 47 */ export class PopupImageMenuItem extends PopupBaseMenuItem { constructor(text: string, icon: Gio.Icon | string, params?: PopupImageMenuItem.ConstructorProps); + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupImageMenuItem.ConstructorProps): void; override _init(text: string, icon: Gio.Icon | string, params?: PopupImageMenuItem.ConstructorProps): void; setIcon(icon: Gio.Icon | string): void; @@ -191,7 +198,7 @@ export class PopupImageMenuItem extends PopupBaseMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L542 - * @version 46 + * @version 47 */ export namespace PopupMenuBase { interface SignalMap {} @@ -203,7 +210,7 @@ export namespace PopupMenuBase { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L542 - * @version 46 + * @version 47 */ export class PopupMenuBase = PopupMenuBase.SignalMap> extends Signals.EventEmitter { protected constructor(sourceActor: St.Widget, styleClass?: string); @@ -217,7 +224,6 @@ export class PopupMenuBase = PopupMenuBase.Signal readonly firstMenuItem: PopupBaseMenuItem | PopupMenuSection; readonly numMenuItems: number; - _getMenuItems(): (PopupBaseMenuItem | PopupMenuSection)[]; getSensitive(): boolean; setSensitive(sensitive: boolean): void; addAction(title: string, callback: () => void, icon?: Gio.Icon): void; @@ -226,6 +232,7 @@ export class PopupMenuBase = PopupMenuBase.Signal itemActivated(animate: boolean): void; moveMenuItem(item: PopupMenuBase.MenuItemType, position: number): void; addMenuItem(item: PopupMenuBase.MenuItemType, position?: number): void; + _getMenuItems(): (PopupBaseMenuItem | PopupMenuSection)[]; removeAll(): void; toggle(): void; destroy(): void; @@ -233,7 +240,7 @@ export class PopupMenuBase = PopupMenuBase.Signal /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L871 - * @version 46 + * @version 47 */ export namespace PopupMenu { interface SignalMap extends PopupMenuBase.SignalMap {} @@ -241,7 +248,7 @@ export namespace PopupMenu { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L871 - * @version 46 + * @version 47 */ export class PopupMenu = PopupMenu.SignalMap> extends PopupMenuBase { constructor(sourceActor: St.Widget, arrowAlignment: number, arrowSide: St.Side); @@ -256,7 +263,7 @@ export class PopupMenu = PopupMenu.SignalMap> ext /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1015 - * @version 46 + * @version 47 */ export class PopupDummyMenu extends Signals.EventEmitter { constructor(sourceActor: St.Widget); @@ -273,7 +280,7 @@ export class PopupDummyMenu extends Signals.EventEmitter { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1053 - * @version 46 + * @version 47 */ export namespace PopupSubMenu { interface SignalMap extends PopupMenuBase.SignalMap {} @@ -281,7 +288,7 @@ export namespace PopupSubMenu { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1053 - * @version 46 + * @version 47 */ export class PopupSubMenu = PopupSubMenu.SignalMap> extends PopupMenuBase { actor: St.ScrollView; @@ -297,7 +304,7 @@ export class PopupSubMenu = PopupSubMenu.SignalMa /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1192 - * @version 46 + * @version 47 */ export namespace PopupMenuSection { interface SignalMap extends PopupMenuBase.SignalMap {} @@ -312,7 +319,7 @@ export namespace PopupMenuSection { * to the user * * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1192 - * @version 46 + * @version 47 */ export class PopupMenuSection = PopupMenuSection.SignalMap> extends PopupMenuBase { constructor(); @@ -325,7 +332,7 @@ export class PopupMenuSection = PopupMenuSection. /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1215 - * @version 46 + * @version 47 */ export class PopupSubMenuMenuItem extends PopupBaseMenuItem { readonly menu: PopupSubMenu; @@ -333,6 +340,8 @@ export class PopupSubMenuMenuItem extends PopupBaseMenuItem { readonly label: St.Label; constructor(text: string, wantIcon?: boolean); + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupBaseMenuItem.ConstructorProps): void; override _init(text: string, wantIcon?: boolean): void; syncSensitive(): boolean; @@ -342,7 +351,7 @@ export class PopupSubMenuMenuItem extends PopupBaseMenuItem { /** * @see https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/js/ui/popupMenu.js#L1321 - * @version 46 + * @version 47 */ export namespace PopupMenuManager { export interface ConstructorProps { diff --git a/packages/gnome-shell/src/ui/status/keyboard.d.ts b/packages/gnome-shell/src/ui/status/keyboard.d.ts index f4df637..3e8a649 100644 --- a/packages/gnome-shell/src/ui/status/keyboard.d.ts +++ b/packages/gnome-shell/src/ui/status/keyboard.d.ts @@ -19,6 +19,8 @@ export declare class LayoutMenuItem extends PopupMenu.PopupBaseMenuItem { label: St.Label; indicator: St.Label; + /** @hidden Defined only to resolve type conflicts */ + override _init(config?: PopupMenu.PopupBaseMenuItem.ConstructorProps): void; /** * Initializes a new instance of `LayoutMenuItem`. */ From cb3dc389125c3517282e6ae44b4877b5b1baf234 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sat, 21 Sep 2024 12:18:26 +0200 Subject: [PATCH 2/5] Set default formatter for typescript --- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 0c78fef..3435465 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" + } } From a2eda2ddd6ebf0a498a3f2a24139bbb4c2996926 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sat, 21 Sep 2024 19:35:31 +0200 Subject: [PATCH 3/5] Verify modelDialog for GNOME 47 --- packages/gnome-shell/src/ui/modalDialog.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/gnome-shell/src/ui/modalDialog.d.ts b/packages/gnome-shell/src/ui/modalDialog.d.ts index 8d4e1e9..e83b0a1 100644 --- a/packages/gnome-shell/src/ui/modalDialog.d.ts +++ b/packages/gnome-shell/src/ui/modalDialog.d.ts @@ -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, @@ -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 { @@ -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; @@ -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); From bf01e3c40bc0a02df928ff4bb8ce540697169105 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sat, 21 Sep 2024 20:14:20 +0200 Subject: [PATCH 4/5] Check messageTray --- packages/gnome-shell/src/ui/messageTray.d.ts | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/gnome-shell/src/ui/messageTray.d.ts b/packages/gnome-shell/src/ui/messageTray.d.ts index cf58647..de5bef2 100644 --- a/packages/gnome-shell/src/ui/messageTray.d.ts +++ b/packages/gnome-shell/src/ui/messageTray.d.ts @@ -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, @@ -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, @@ -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, @@ -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, @@ -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; @@ -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; @@ -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; @@ -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); @@ -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); @@ -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 { @@ -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); @@ -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); @@ -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(); @@ -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; @@ -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; From faae7c67c0b156bc02a2ab4d8a83cbb2ec17cd16 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sat, 21 Sep 2024 20:17:06 +0200 Subject: [PATCH 5/5] Check signals for GNOME 47 --- packages/gnome-shell/src/misc/signals.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gnome-shell/src/misc/signals.d.ts b/packages/gnome-shell/src/misc/signals.d.ts index 71e394c..bc52ffb 100644 --- a/packages/gnome-shell/src/misc/signals.d.ts +++ b/packages/gnome-shell/src/misc/signals.d.ts @@ -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 = { [Signal in keyof K]: unknown[]; @@ -72,7 +72,7 @@ export interface SignalMethods = any> { export interface EventEmitter = any> extends SignalMethods {} /** - * @version 46 + * @version 47 */ export class EventEmitter = any> { connectObject(...args: any[]): number; // TODO: return type is return type of imports.misc.signalTracker.connectObject