@gjsify/adwaita-app 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/application.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/types/application.d.ts +21 -0
- package/lib/types/index.d.ts +1 -1
- package/package.json +5 -5
package/lib/esm/application.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import e from"@girs/adw-1";import t from"@girs/gdk-4.0";import n from"@girs/gio-2.0";import r from"@girs/gobject-2.0";import i from"@girs/gtk-4.0";import a from"system";import{installDevtools as o}from"@gjsify/devtools";var s=class AdwaitaApp extends e.Application{static{r.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??n.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new n.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about){let e=new n.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_loadCss(e){let n=t.Display.get_default();if(!n){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let r=new i.CssProvider;r.load_from_string(e),i.StyleContext.add_provider_for_display(n,r,i.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};o(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let t=this._options.about;if(!t)return;let n=new e.AboutDialog({application_name:t.applicationName,application_icon:t.applicationIcon??this._options.applicationId});t.version&&(n.version=t.version),t.developerName&&(n.developer_name=t.developerName),t.website&&(n.website=t.website),t.issueUrl&&(n.issue_url=t.issueUrl),t.license&&(n.license=t.license),t.comments&&(n.comments=t.comments),t.copyright&&(n.copyright=t.copyright),t.developers?.length&&n.set_developers(t.developers),n.present(this.get_active_window())}};async function runAdwaitaApp(e){return new s(e)
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import e from"@girs/adw-1";import t from"@girs/gdk-4.0";import n from"@girs/gio-2.0";import r from"@girs/gobject-2.0";import i from"@girs/gtk-4.0";import a from"system";import{installDevtools as o}from"@gjsify/devtools";var s=class AdwaitaApp extends e.Application{static{r.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??n.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new n.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about){let e=new n.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_loadCss(e){let n=t.Display.get_default();if(!n){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let r=new i.CssProvider;r.load_from_string(e),i.StyleContext.add_provider_for_display(n,r,i.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};o(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let t=this._options.about;if(!t)return;let n=new e.AboutDialog({application_name:t.applicationName,application_icon:t.applicationIcon??this._options.applicationId});t.version&&(n.version=t.version),t.developerName&&(n.developer_name=t.developerName),t.website&&(n.website=t.website),t.issueUrl&&(n.issue_url=t.issueUrl),t.license&&(n.license=t.license),t.comments&&(n.comments=t.comments),t.copyright&&(n.copyright=t.copyright),t.developers?.length&&n.set_developers(t.developers),n.present(this.get_active_window())}};async function runAdwaitaApp(e){return runApplication(new s(e),[a.programInvocationName,...a.programArgs])}async function runApplication(e,t){let n=!1;try{e.register(null),n=e.get_is_remote()}catch{n=!1}let r=await e.runAsync(t);return n&&console.error(`${e.applicationId??`This application`} is already running — brought the existing instance to the front instead of opening a second window.`),r}r.type_ensure(s.$gtype);export{s as AdwaitaApp,runAdwaitaApp,runApplication};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AdwaitaApp as e,runAdwaitaApp as t}from"./application.js";import{readAppDevHooks as
|
|
1
|
+
import{AdwaitaApp as e,runAdwaitaApp as t,runApplication as n}from"./application.js";import{readAppDevHooks as r}from"./dev-hooks.js";import{confirmDialog as i,errorDialog as a}from"./dialogs.js";import{pickFile as o,saveFile as s}from"./file-dialog.js";import{createNavShell as c}from"./nav-shell.js";import{LoadToken as l,loadIntoStack as u}from"./view-loader.js";import{LoadingStack as d}from"./loading-stack.js";import{registerToastOverlay as f,showToast as p}from"./toast.js";import{findNavItem as m,resolveInitialNavIndex as h}from"./nav-model.js";export{e as AdwaitaApp,l as LoadToken,d as LoadingStack,i as confirmDialog,c as createNavShell,a as errorDialog,m as findNavItem,u as loadIntoStack,o as pickFile,r as readAppDevHooks,f as registerToastOverlay,h as resolveInitialNavIndex,t as runAdwaitaApp,n as runApplication,s as saveFile,p as showToast};
|
|
@@ -54,3 +54,24 @@ export declare class AdwaitaApp extends Adw.Application {
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
export declare function runAdwaitaApp(options: AdwaitaAppOptions): Promise<number>;
|
|
57
|
+
/**
|
|
58
|
+
* Run a `Gio.Application` on the `runAsync` lifecycle and SAY SO when the launch
|
|
59
|
+
* was a single-instance handoff.
|
|
60
|
+
*
|
|
61
|
+
* GApplication is single-instance by default: launching a second time claims no
|
|
62
|
+
* bus name, sends `activate` to the process that already owns it, and returns 0.
|
|
63
|
+
* That is correct, and it is indistinguishable from a crash — the second launch
|
|
64
|
+
* prints nothing, opens no window and exits successfully. A cross-platform run
|
|
65
|
+
* of the homepage's showcases read exactly that as "exits 0 after ~2 s, no
|
|
66
|
+
* window, no output, no error — worse than a crash, because nothing tells the
|
|
67
|
+
* user anything went wrong", on a box where a storybook from another session was
|
|
68
|
+
* still running. So the silence cost a real diagnosis, and this is the line that
|
|
69
|
+
* removes it.
|
|
70
|
+
*
|
|
71
|
+
* `register()` BEFORE `run()`, because the answer is only available while the
|
|
72
|
+
* application is registered: `run()` unregisters on the way out, and
|
|
73
|
+
* `get_is_remote()` afterwards is a `g_application_get_is_remote: assertion
|
|
74
|
+
* 'application->priv->is_registered' failed` returning false — measured. `run()`
|
|
75
|
+
* registers by itself when nobody did, so doing it here changes nothing else.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runApplication(app: Gio.Application, argv: string[]): Promise<number>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AdwaitaApp, runAdwaitaApp } from './application.js';
|
|
1
|
+
export { AdwaitaApp, runAdwaitaApp, runApplication } from './application.js';
|
|
2
2
|
export type { AdwaitaAppOptions } from './application.js';
|
|
3
3
|
export { createNavShell } from './nav-shell.js';
|
|
4
4
|
export type { NavShell, NavShellOptions } from './nav-shell.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Native Adwaita application shell for GJS/GTK apps — Adw.Application lifecycle (runAsync + devtools + CSS), a data-driven NavigationSplitView nav shell, an async-view mounter, and promise dialog/toast/file helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@girs/glib-2.0": "^4.1.0",
|
|
47
47
|
"@girs/gobject-2.0": "^4.1.0",
|
|
48
48
|
"@girs/gtk-4.0": "^4.1.0",
|
|
49
|
-
"@gjsify/devtools": "^0.
|
|
49
|
+
"@gjsify/devtools": "^0.38.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@gjsify/cli": "^0.
|
|
53
|
-
"@gjsify/storybook": "^0.
|
|
54
|
-
"@gjsify/unit": "^0.
|
|
52
|
+
"@gjsify/cli": "^0.38.0",
|
|
53
|
+
"@gjsify/storybook": "^0.38.0",
|
|
54
|
+
"@gjsify/unit": "^0.38.0",
|
|
55
55
|
"@types/node": "^25.9.2",
|
|
56
56
|
"typescript": "^6.0.3"
|
|
57
57
|
},
|