@gjsify/adwaita-app 0.63.1-next.235 → 0.63.1-next.237
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/about-dialog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{appdataLocale as e,parseAppdata as t}from"./appdata.js";import n from"gi://Adw?version=1";import r from"gi://Gio?version=2.0";import i from"gi://GLib?version=2.0";import a from"gi://Gtk?version=4.0";const o={"GPL-2.0-or-later":a.License.GPL_2_0,"GPL-3.0-or-later":a.License.GPL_3_0,"LGPL-2.1-or-later":a.License.LGPL_2_1,"LGPL-3.0-or-later":a.License.LGPL_3_0,"BSD-2-Clause":a.License.BSD,MIT:a.License.MIT_X11,"Artistic-2.0":a.License.ARTISTIC,"GPL-2.0-only":a.License.GPL_2_0_ONLY,"GPL-3.0-only":a.License.GPL_3_0_ONLY,"LGPL-2.1-only":a.License.LGPL_2_1_ONLY,"LGPL-3.0-only":a.License.LGPL_3_0_ONLY,"AGPL-3.0-or-later":a.License.AGPL_3_0,"AGPL-3.0-only":a.License.AGPL_3_0_ONLY,"BSD-3-Clause":a.License.BSD_3,"Apache-2.0":a.License.APACHE_2_0,"MPL-2.0":a.License.MPL_2_0,"0BSD":a.License[`0BSD`],"GPL-2.0":a.License.GPL_2_0_ONLY,"GPL-3.0":a.License.GPL_3_0_ONLY};function licenseTypeFor(e){return o[e]??a.License.CUSTOM}function hasAppdataConstructor(e=n){try{return typeof e?.AboutDialog?.new_from_appdata==`function`}catch{return!1}}function applyAppdataFields(e,t,n){return t.applicationId!==null&&(e.applicationIcon=t.applicationId),t.applicationName!==null&&(e.applicationName=t.applicationName),t.developerName!==null&&(e.developerName=t.developerName),t.website!==null&&(e.website=t.website),t.supportUrl!==null&&(e.supportUrl=t.supportUrl),t.issueUrl!==null&&(e.issueUrl=t.issueUrl),t.license!==null&&(e.licenseType=licenseTypeFor(t.license)),n!==void 0&&n!==``&&(e.releaseNotesVersion=n),t.releaseNotes!==null&&(e.releaseNotes=t.releaseNotes),t.version!==null&&(e.version=t.version),e}function buildAboutDialogFromAppdata(r,a={}){let o=t(r,{locale:a.locale??e(i.get_language_names(),{LANG:i.getenv(`LANG`)??void 0}),releaseNotesVersion:a.releaseNotesVersion});return applyAppdataFields(new n.AboutDialog,o,a.releaseNotesVersion)}function resourceExists(e){try{return r.resources_get_info(e,r.ResourceLookupFlags.NONE),!0}catch{return!1}}function readResource(e){try{let t=r.resources_lookup_data(e,r.ResourceLookupFlags.NONE);return new TextDecoder().decode(t.toArray())}catch{return null}}function readFile(e){try{let[t,n]=i.file_get_contents(e);return t?new TextDecoder().decode(n):null}catch{return null}}let s=!1;function createAboutDialog(e={}){let{appdataResource:t,appdataPath:r,releaseNotesVersion:i}=e,a=t!==void 0&&resourceExists(t),o;if(!e.forceParsedAppdata&&a&&hasAppdataConstructor())o=n.AboutDialog.new_from_appdata(t,i??``);else{let c=(a?readResource(t):null)??(r===void 0?null:readFile(r));c===null?(console.error(`@gjsify/adwaita-app: no AppStream metainfo found for the About dialog; looked at resource ${t??`(none given)`} and file ${r??`(none given)`}`),o=new n.AboutDialog):(!s&&!e.forceParsedAppdata&&a&&(s=!0,console.log(`@gjsify/adwaita-app: Adw.AboutDialog.new_from_appdata is not in this GTK runtime (expected on Windows — gjsify/gjsify#1662); building the About dialog from the AppStream metainfo directly.`)),o=buildAboutDialogFromAppdata(c,{releaseNotesVersion:i}))}return e.applicationIcon!==void 0&&(o.applicationIcon=e.applicationIcon),e.version!==void 0&&(o.version=e.version),o}export{applyAppdataFields,buildAboutDialogFromAppdata,createAboutDialog,hasAppdataConstructor,licenseTypeFor};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{appdataLocale as e,parseAppdata as t}from"./appdata.js";import n from"gi://Adw?version=1";import r from"gi://Gio?version=2.0";import i from"gi://GLib?version=2.0";import a from"gi://Gtk?version=4.0";const o={"GPL-2.0-or-later":a.License.GPL_2_0,"GPL-3.0-or-later":a.License.GPL_3_0,"LGPL-2.1-or-later":a.License.LGPL_2_1,"LGPL-3.0-or-later":a.License.LGPL_3_0,"BSD-2-Clause":a.License.BSD,MIT:a.License.MIT_X11,"Artistic-2.0":a.License.ARTISTIC,"GPL-2.0-only":a.License.GPL_2_0_ONLY,"GPL-3.0-only":a.License.GPL_3_0_ONLY,"LGPL-2.1-only":a.License.LGPL_2_1_ONLY,"LGPL-3.0-only":a.License.LGPL_3_0_ONLY,"AGPL-3.0-or-later":a.License.AGPL_3_0,"AGPL-3.0-only":a.License.AGPL_3_0_ONLY,"BSD-3-Clause":a.License.BSD_3,"Apache-2.0":a.License.APACHE_2_0,"MPL-2.0":a.License.MPL_2_0,"0BSD":a.License[`0BSD`],"GPL-2.0":a.License.GPL_2_0_ONLY,"GPL-3.0":a.License.GPL_3_0_ONLY};function licenseTypeFor(e){return o[e]??a.License.CUSTOM}function hasAppdataConstructor(e=n){try{return typeof e?.AboutDialog?.new_from_appdata==`function`}catch{return!1}}function applyAppdataFields(e,t,n){return t.applicationId!==null&&(e.applicationIcon=t.applicationId),t.applicationName!==null&&(e.applicationName=t.applicationName),t.developerName!==null&&(e.developerName=t.developerName),t.website!==null&&(e.website=t.website),t.supportUrl!==null&&(e.supportUrl=t.supportUrl),t.issueUrl!==null&&(e.issueUrl=t.issueUrl),t.license!==null&&(e.licenseType=licenseTypeFor(t.license)),n!==void 0&&n!==``&&(e.releaseNotesVersion=n),t.releaseNotes!==null&&(e.releaseNotes=t.releaseNotes),t.version!==null&&(e.version=t.version),e}function buildAboutDialogFromAppdata(r,a={}){let o=t(r,{locale:a.locale??e(i.get_language_names(),{LANG:i.getenv(`LANG`)??void 0}),releaseNotesVersion:a.releaseNotesVersion});return applyAppdataFields(new n.AboutDialog,o,a.releaseNotesVersion)}function resourceExists(e){try{return r.resources_get_info(e,r.ResourceLookupFlags.NONE),!0}catch{return!1}}function readResource(e){try{let t=r.resources_lookup_data(e,r.ResourceLookupFlags.NONE);return new TextDecoder().decode(t.toArray())}catch{return null}}function readFile(e){try{let[t,n]=i.file_get_contents(e);return t?new TextDecoder().decode(n):null}catch{return null}}let s=!1;function createAboutDialog(e={}){let{appdataResource:t,appdataPath:r,releaseNotesVersion:i}=e,a=t!==void 0&&resourceExists(t),o;if(!e.forceParsedAppdata&&a&&hasAppdataConstructor())o=n.AboutDialog.new_from_appdata(t,i??``);else{let c=(a?readResource(t):null)??(r===void 0?null:readFile(r));c===null?(console.error(`@gjsify/adwaita-app: no AppStream metainfo found for the About dialog; looked at resource ${t??`(none given)`} and file ${r??`(none given)`}`),o=new n.AboutDialog):(!s&&!e.forceParsedAppdata&&a&&(s=!0,console.log(`@gjsify/adwaita-app: Adw.AboutDialog.new_from_appdata is not in this GTK runtime (expected on Windows — gjsify/gjsify#1662); building the About dialog from the AppStream metainfo directly.`)),o=buildAboutDialogFromAppdata(c,{releaseNotesVersion:i}))}return e.applicationIcon!==void 0&&(o.applicationIcon=e.applicationIcon),e.version!==void 0&&(o.version=e.version),o}function applyAboutLinks(e,t){for(let n of t??[])n.title&&n.url&&e.add_link(n.title,n.url)}export{applyAboutLinks,applyAppdataFields,buildAboutDialogFromAppdata,createAboutDialog,hasAppdataConstructor,licenseTypeFor};
|
package/lib/esm/application.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{createAboutDialog as
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{applyAboutLinks as e,createAboutDialog as t}from"./about-dialog.js";import{installBundledIconTheme as n}from"./icon-theme.js";import r from"gi://Adw?version=1";import i from"gi://Gio?version=2.0";import a from"gi://Gtk?version=4.0";import o from"gi://Gdk?version=4.0";import s from"gi://GObject?version=2.0";import c from"system";import{installDevtools as l}from"@gjsify/devtools";var u=class AdwaitaApp extends r.Application{static{s.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??i.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 i.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||this._options.aboutAppdata){let e=new i.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._installBundledIcons(),this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_installBundledIcons(){let e=this._options.bundledIcons;e!==!1&&n(typeof e==`object`?e:{})}_loadCss(e){let t=o.Display.get_default();if(!t){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let n=new a.CssProvider;n.load_from_string(e),a.StyleContext.add_provider_for_display(t,n,a.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};l(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let n=this._options.aboutAppdata;if(n){t(n).present(this.get_active_window());return}let i=this._options.about;if(!i)return;let a=new r.AboutDialog({application_name:i.applicationName,application_icon:i.applicationIcon??this._options.applicationId});i.version&&(a.version=i.version),i.developerName&&(a.developer_name=i.developerName),i.website&&(a.website=i.website),i.issueUrl&&(a.issue_url=i.issueUrl),i.license&&(a.license=i.license),i.comments&&(a.comments=i.comments),i.copyright&&(a.copyright=i.copyright),i.developers?.length&&a.set_developers(i.developers),e(a,i.links),a.present(this.get_active_window())}};async function runAdwaitaApp(e){return runApplication(new u(e),[c.programInvocationName,...c.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}s.type_ensure(u.$gtype);export{u as AdwaitaApp,runAdwaitaApp,runApplication};
|
|
@@ -125,3 +125,8 @@ export declare function buildAboutDialogFromAppdata(xml: string, options?: {
|
|
|
125
125
|
* a dialog assembled from whatever source did answer.
|
|
126
126
|
*/
|
|
127
127
|
export declare function createAboutDialog(options?: CreateAboutDialogOptions): Adw.AboutDialog;
|
|
128
|
+
/** Add each of `links` to `dialog` via `Adw.AboutDialog.add_link`, skipping entries with no title or url. */
|
|
129
|
+
export declare function applyAboutLinks(dialog: Adw.AboutDialog, links: readonly {
|
|
130
|
+
title: string;
|
|
131
|
+
url: string;
|
|
132
|
+
}[] | undefined): void;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -25,4 +25,4 @@ export type { OnMacosAccentColorChangedOptions, ReadMacosAccentColorOptions } fr
|
|
|
25
25
|
export { readAppDevHooks } from './dev-hooks.js';
|
|
26
26
|
export type { AppDevHooks, ReadAppDevHooksOptions } from './dev-hooks.js';
|
|
27
27
|
export { findNavItem, resolveInitialNavIndex } from './nav-model.js';
|
|
28
|
-
export type { AboutInfo, ConfirmResponse, NavItem } from './types.js';
|
|
28
|
+
export type { AboutInfo, AboutLink, ConfirmResponse, NavItem } from './types.js';
|
package/lib/types/types.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface NavItem {
|
|
|
15
15
|
* Fields for the standard `app.about` dialog. All optional except the name;
|
|
16
16
|
* omitted fields are simply not set on the `Adw.AboutDialog`.
|
|
17
17
|
*/
|
|
18
|
+
/** One extra link in the About dialog. */
|
|
19
|
+
export interface AboutLink {
|
|
20
|
+
title: string;
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
18
23
|
export interface AboutInfo {
|
|
19
24
|
/** Application name shown at the top of the dialog. */
|
|
20
25
|
applicationName: string;
|
|
@@ -36,4 +41,6 @@ export interface AboutInfo {
|
|
|
36
41
|
copyright?: string;
|
|
37
42
|
/** Extra description shown under the header. */
|
|
38
43
|
comments?: string;
|
|
44
|
+
/** Extra links shown in the dialog (`Adw.AboutDialog.add_link`), e.g. a support page. */
|
|
45
|
+
links?: AboutLink[];
|
|
39
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-app",
|
|
3
|
-
"version": "0.63.1-next.
|
|
3
|
+
"version": "0.63.1-next.237",
|
|
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, promise dialog/toast/file helpers, and a display-less reader of the desktop accent and colour scheme (`./appearance`)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"@girs/glib-2.0": "5.4.0",
|
|
58
58
|
"@girs/gobject-2.0": "5.4.0",
|
|
59
59
|
"@girs/gtk-4.0": "5.4.0",
|
|
60
|
-
"@gjsify/adwaita-core": "0.63.1-next.
|
|
61
|
-
"@gjsify/devtools": "0.63.1-next.
|
|
60
|
+
"@gjsify/adwaita-core": "0.63.1-next.237",
|
|
61
|
+
"@gjsify/devtools": "0.63.1-next.237"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@gjsify/cli": "0.63.1-next.
|
|
65
|
-
"@gjsify/storybook": "0.63.1-next.
|
|
66
|
-
"@gjsify/unit": "0.63.1-next.
|
|
64
|
+
"@gjsify/cli": "0.63.1-next.237",
|
|
65
|
+
"@gjsify/storybook": "0.63.1-next.237",
|
|
66
|
+
"@gjsify/unit": "0.63.1-next.237",
|
|
67
67
|
"@types/node": "^25.9.2",
|
|
68
68
|
"typescript": "^6.0.3"
|
|
69
69
|
},
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
102
102
|
},
|
|
103
103
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/framework/adwaita-app#readme",
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "a349db400a7e68befc11ba6381ddb0e4caff09b6"
|
|
105
105
|
}
|