@gjsify/adwaita-nativescript 0.39.0 → 0.41.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.
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{Button as e,GridLayout as t,ItemSpec as n,Label as r,ScrollView as i,StackLayout as a}from"@nativescript/core";const o=`closed`;var AdwAboutDialog=class extends t{_card;_iconLabel;_nameLabel;_versionLabel;_developerLabel;_commentsLabel;_websiteLabel;_copyrightLabel;_applicationName=``;_applicationIcon=``;_developerName=``;_version=``;_comments=``;_website=``;_copyright=``;constructor(){super(),this.className=`adw-about-dialog`,this.visibility=`collapse`,this.addColumn(new n(1,`star`)),this.addRow(new n(1,`star`));let r=new i;r.orientation=`vertical`,r.verticalAlignment=`middle`,r.horizontalAlignment=`center`,t.setColumn(r,0),t.setRow(r,0);let o=new a;o.orientation=`vertical`,o.className=`adw-about-dialog-card`,r.content=o,this.addChild(r),this._card=o,this._iconLabel=this._addCardLabel(o,`adw-about-dialog-icon`),this._nameLabel=this._addCardLabel(o,`adw-about-dialog-name`),this._versionLabel=this._addCardLabel(o,`adw-about-dialog-version`),this._developerLabel=this._addCardLabel(o,`adw-about-dialog-developer`),this._commentsLabel=this._addCardLabel(o,`adw-about-dialog-comments`),this._websiteLabel=this._addCardLabel(o,`adw-about-dialog-website`),this._copyrightLabel=this._addCardLabel(o,`adw-about-dialog-copyright`);let s=new e;s.text=`Close`,s.className=`adw-about-dialog-close`,s.set(`androidElevation`,0),s.addEventListener(`tap`,()=>this.close()),o.addChild(s)}_addCardLabel(e,t){let n=new r;return n.className=t,n.horizontalAlignment=`center`,n.textWrap=!0,e.addChild(n),n}get applicationName(){return this._applicationName}set applicationName(e){this._applicationName=e??``,this._nameLabel.text=this._applicationName}get applicationIcon(){return this._applicationIcon}set applicationIcon(e){this._applicationIcon=e??``,this._iconLabel.text=this._applicationIcon}get version(){return this._version}set version(e){this._version=e??``,this._versionLabel.text=this._version}get developerName(){return this._developerName}set developerName(e){this._developerName=e??``,this._developerLabel.text=this._developerName}get comments(){return this._comments}set comments(e){this._comments=e??``,this._commentsLabel.text=this._comments}get website(){return this._website}set website(e){this._website=e??``,this._websiteLabel.text=this._website}get copyright(){return this._copyright}set copyright(e){this._copyright=e??``,this._copyrightLabel.text=this._copyright}present(){this.visibility=`visible`}close(){this.visibility=`collapse`;let e={eventName:o,object:this};this.notify(e)}get open(){return this.visibility===`visible`}set open(e){e?this.present():this.close()}};export{AdwAboutDialog,o as CLOSED};
1
+ import"../_virtual/_rolldown/runtime.js";import{Button as e,GridLayout as t,ItemSpec as n,Label as r,ScrollView as i,StackLayout as a}from"@nativescript/core";import{aboutDialogVisibility as o}from"@gjsify/adwaita-core";const s=`closed`;var AdwAboutDialog=class extends t{_card;_iconLabel;_nameLabel;_versionLabel;_developerLabel;_commentsLabel;_websiteLabel;_copyrightLabel;_applicationName=``;_applicationIcon=``;_developerName=``;_version=``;_comments=``;_website=``;_copyright=``;constructor(){super(),this.className=`adw-about-dialog`,this.visibility=`collapse`,this.addColumn(new n(1,`star`)),this.addRow(new n(1,`star`));let r=new i;r.orientation=`vertical`,r.verticalAlignment=`middle`,r.horizontalAlignment=`center`,t.setColumn(r,0),t.setRow(r,0);let o=new a;o.orientation=`vertical`,o.className=`adw-about-dialog-card`,r.content=o,this.addChild(r),this._card=o,this._iconLabel=this._addCardLabel(o,`adw-about-dialog-icon`),this._nameLabel=this._addCardLabel(o,`adw-about-dialog-name`),this._versionLabel=this._addCardLabel(o,`adw-about-dialog-version`),this._developerLabel=this._addCardLabel(o,`adw-about-dialog-developer`),this._commentsLabel=this._addCardLabel(o,`adw-about-dialog-comments`),this._websiteLabel=this._addCardLabel(o,`adw-about-dialog-website`),this._copyrightLabel=this._addCardLabel(o,`adw-about-dialog-copyright`);let s=new e;s.text=`Close`,s.className=`adw-about-dialog-close`,s.set(`androidElevation`,0),s.addEventListener(`tap`,()=>this.close()),o.addChild(s),this._render()}_addCardLabel(e,t){let n=new r;return n.className=t,n.horizontalAlignment=`center`,n.textWrap=!0,e.addChild(n),n}get applicationName(){return this._applicationName}set applicationName(e){this._applicationName=e??``,this._render()}get applicationIcon(){return this._applicationIcon}set applicationIcon(e){this._applicationIcon=e??``,this._render()}get version(){return this._version}set version(e){this._version=e??``,this._render()}get developerName(){return this._developerName}set developerName(e){this._developerName=e??``,this._render()}get comments(){return this._comments}set comments(e){this._comments=e??``,this._render()}get website(){return this._website}set website(e){this._website=e??``,this._render()}get copyright(){return this._copyright}set copyright(e){this._copyright=e??``,this._render()}_render(){let e=o({applicationName:this._applicationName,applicationIcon:this._applicationIcon,developerName:this._developerName,version:this._version,comments:this._comments,website:this._website}),show=(e,t,n)=>{e.text=t,e.visibility=n?`visible`:`collapse`};show(this._iconLabel,this._applicationIcon,e.appIcon),show(this._nameLabel,this._applicationName,e.appName),show(this._versionLabel,this._version,e.version),show(this._developerLabel,this._developerName,e.developerName),show(this._commentsLabel,this._comments,e.commentsLabel),show(this._websiteLabel,this._website,e.websiteRow),show(this._copyrightLabel,this._copyright,this._copyright.length>0)}present(){this.visibility=`visible`}close(){this.visibility=`collapse`;let e={eventName:s,object:this};this.notify(e)}get open(){return this.visibility===`visible`}set open(e){e?this.present():this.close()}};export{AdwAboutDialog,s as CLOSED};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{Button as e}from"@nativescript/core";const t={"suggested-action":`suggested-action`,"destructive-action":`destructive-action`,flat:`flat`,pill:`pill`},n=Object.values(t);var AdwButton=class extends e{_variant=`default`;constructor(){super(),this.className=`adw-button`,this.set(`androidElevation`,0)}get variant(){return this._variant}set variant(e){this._variant=e;let n=[`adw-button`];e!=="default"&&n.push(t[e]),this.className=n.join(` `)}static get variantClasses(){return n}};export{AdwButton};
1
+ import"../_virtual/_rolldown/runtime.js";import{Button as e}from"@nativescript/core";import{ADW_BUTTON_STYLE_CLASSES as t,buttonStyleClass as n}from"@gjsify/adwaita-core";var AdwButton=class extends e{_variant=`default`;constructor(){super(),this.className=`adw-button`,this.set(`androidElevation`,0)}get variant(){return this._variant}set variant(e){this._variant=e;let t=e==="default"?null:n(e);this.className=t?`adw-button ${t}`:`adw-button`}static get variantClasses(){return t}};export{AdwButton};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{defaultToolbarViewProps as e,toolbarViewClassNames as t}from"./chrome.js";import{GridLayout as n,ItemSpec as r,StackLayout as i}from"@nativescript/core";const a={view:`adw-toolbar-view`,topBar:`adw-toolbar-view-top`,bottomBar:`adw-toolbar-view-bottom`};var AdwToolbarView=class extends n{_topBox;_bottomBox;_content=null;_props=e();constructor(){super(),this.className=a.view,this.addColumn(new r(1,`star`)),this.addRow(new r(1,`auto`)),this.addRow(new r(1,`star`)),this.addRow(new r(1,`auto`));let e=new i;e.orientation=`vertical`,e.className=a.topBar,n.setRow(e,0),this.addChild(e),this._topBox=e;let t=new i;t.orientation=`vertical`,t.className=a.bottomBar,n.setRow(t,2),this.addChild(t),this._bottomBox=t,this.addEventListener(`layoutChanged`,()=>this._syncClasses())}addTopBar(e){this._topBox.addChild(e)}addBottomBar(e){this._bottomBox.addChild(e)}setContent(e){this._content&&=(this.removeChild(this._content),null),e&&(n.setRow(e,1),this.addChild(e),this._content=e),this._restackBars()}get content(){return this._content}get topBar(){return this._topBox}get bottomBar(){return this._bottomBox}get topBarStyle(){return this._props.topBarStyle}set topBarStyle(e){this._props.topBarStyle=e,this._syncClasses()}get bottomBarStyle(){return this._props.bottomBarStyle}set bottomBarStyle(e){this._props.bottomBarStyle=e,this._syncClasses()}get extendContentToTopEdge(){return this._props.extendContentToTopEdge}set extendContentToTopEdge(e){this._props.extendContentToTopEdge=!!e,this._applyBarPlacement()}get extendContentToBottomEdge(){return this._props.extendContentToBottomEdge}set extendContentToBottomEdge(e){this._props.extendContentToBottomEdge=!!e,this._applyBarPlacement()}_applyBarPlacement(){n.setRow(this._topBox,+!!this._props.extendContentToTopEdge),this._topBox.verticalAlignment=this._props.extendContentToTopEdge?`top`:`stretch`,n.setRow(this._bottomBox,this._props.extendContentToBottomEdge?1:2),this._bottomBox.verticalAlignment=this._props.extendContentToBottomEdge?`bottom`:`stretch`,this._restackBars(),this._syncClasses()}_restackBars(){if(!(!this._props.extendContentToTopEdge&&!this._props.extendContentToBottomEdge))for(let e of[this._topBox,this._bottomBox])this.removeChild(e),this.addChild(e)}_syncClasses(){let e={topBarHeight:this._topBox.getActualSize?.().height??0,bottomBarHeight:this._bottomBox.getActualSize?.().height??0},n=t({view:this.className,topBar:this._topBox.className,bottomBar:this._bottomBox.className},this._props,e);this.className!==n.view&&(this.className=n.view),this._topBox.className!==n.topBar&&(this._topBox.className=n.topBar),this._bottomBox.className!==n.bottomBar&&(this._bottomBox.className=n.bottomBar)}};export{AdwToolbarView};
1
+ import"../_virtual/_rolldown/runtime.js";import{defaultToolbarViewProps as e,toolbarViewClassNames as t}from"./chrome.js";import{NO_INSETS as n,toolbarViewInsetPadding as r}from"./window-insets.js";import{observeWindowInsets as i}from"./window-insets-source.js";import{GridLayout as a,ItemSpec as o,StackLayout as s}from"@nativescript/core";const c={view:`adw-toolbar-view`,topBar:`adw-toolbar-view-top`,bottomBar:`adw-toolbar-view-bottom`};var AdwToolbarView=class extends a{_topBox;_bottomBox;_content=null;_props=e();_insets=n;_topBarCount=0;_bottomBarCount=0;_detachInsets=null;constructor(){super(),this.className=c.view,this.addColumn(new o(1,`star`)),this.addRow(new o(1,`auto`)),this.addRow(new o(1,`star`)),this.addRow(new o(1,`auto`));let e=new s;e.orientation=`vertical`,e.className=c.topBar,a.setRow(e,0),this.addChild(e),this._topBox=e;let t=new s;t.orientation=`vertical`,t.className=c.bottomBar,a.setRow(t,2),this.addChild(t),this._bottomBox=t,this.addEventListener(`layoutChanged`,()=>this._syncClasses()),this.addEventListener(`loaded`,()=>{this._detachInsets??=i(e=>this._applyInsets(e))}),this.addEventListener(`unloaded`,()=>{this._detachInsets?.(),this._detachInsets=null})}addTopBar(e){this._topBox.addChild(e),this._topBarCount+=1,this._applyInsets(this._insets)}addBottomBar(e){this._bottomBox.addChild(e),this._bottomBarCount+=1,this._applyInsets(this._insets)}setContent(e){this._content&&=(this.removeChild(this._content),null),e&&(a.setRow(e,1),this.addChild(e),this._content=e),this._restackBars()}get content(){return this._content}get topBar(){return this._topBox}get bottomBar(){return this._bottomBox}get topBarStyle(){return this._props.topBarStyle}set topBarStyle(e){this._props.topBarStyle=e,this._syncClasses()}get bottomBarStyle(){return this._props.bottomBarStyle}set bottomBarStyle(e){this._props.bottomBarStyle=e,this._syncClasses()}get extendContentToTopEdge(){return this._props.extendContentToTopEdge}set extendContentToTopEdge(e){this._props.extendContentToTopEdge=!!e,this._applyBarPlacement()}get extendContentToBottomEdge(){return this._props.extendContentToBottomEdge}set extendContentToBottomEdge(e){this._props.extendContentToBottomEdge=!!e,this._applyBarPlacement()}_applyBarPlacement(){a.setRow(this._topBox,+!!this._props.extendContentToTopEdge),this._topBox.verticalAlignment=this._props.extendContentToTopEdge?`top`:`stretch`,a.setRow(this._bottomBox,this._props.extendContentToBottomEdge?1:2),this._bottomBox.verticalAlignment=this._props.extendContentToBottomEdge?`bottom`:`stretch`,this._restackBars(),this._syncClasses()}_restackBars(){if(!(!this._props.extendContentToTopEdge&&!this._props.extendContentToBottomEdge))for(let e of[this._topBox,this._bottomBox])this.removeChild(e),this.addChild(e)}_applyInsets(e){this._insets=e;let t=r(e,{hasTopBar:this._topBarCount>0,hasBottomBar:this._bottomBarCount>0});this._topBox.paddingTop=t.topBarTop,this._bottomBox.paddingBottom=t.bottomBarBottom,this.paddingTop=t.contentTop,this.paddingBottom=t.contentBottom}_syncClasses(){let e={topBarHeight:this._topBox.getActualSize?.().height??0,bottomBarHeight:this._bottomBox.getActualSize?.().height??0},n=t({view:this.className,topBar:this._topBox.className,bottomBar:this._bottomBox.className},this._props,e);this.className!==n.view&&(this.className=n.view),this._topBox.className!==n.topBar&&(this._topBox.className=n.topBar),this._bottomBox.className!==n.bottomBar&&(this._bottomBox.className=n.bottomBar)}};export{AdwToolbarView};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";function statusPageLabelVisibility(e){return e?`visible`:`collapse`}function statusPageIconVisibility(e){return e?`visible`:`collapse`}export{statusPageIconVisibility,statusPageLabelVisibility};
1
+ import"../_virtual/_rolldown/runtime.js";import{stringIsNotEmpty as e}from"@gjsify/adwaita-core";function statusPageLabelVisibility(t){return e(t)?`visible`:`collapse`}function statusPageIconVisibility(t){return e(t)?`visible`:`collapse`}export{statusPageIconVisibility,statusPageLabelVisibility};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{WindowInsetsBroadcast as e}from"./window-insets.js";import{Application as t,Screen as n}from"@nativescript/core";const r=new e;let i=!1;function toDips(e){let t=n.mainScreen?.scale??1;return t>0?e/t:e}function install(){if(i)return;let e=androidx?.core?.view;if(!e)return;let n=(t.android?.foregroundActivity??t.android?.startActivity)?.getWindow?.(),a=n?.getDecorView?.();if(!n||!a)return;i=!0,e.WindowCompat.setDecorFitsSystemWindows(n,!1);let o=e.WindowInsetsCompat.Type.systemBars()|e.WindowInsetsCompat.Type.displayCutout();e.ViewCompat.setOnApplyWindowInsetsListener(a,new e.OnApplyWindowInsetsListener({onApplyWindowInsets(e,t){let n=t.getInsets(o);return r.publish({top:toDips(n.top),bottom:toDips(n.bottom),left:toDips(n.left),right:toDips(n.right)}),t}}))}function observeWindowInsets(e){return install(),r.subscribe(e)}export{observeWindowInsets};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{WindowInsetsBroadcast as e}from"./window-insets.js";import{Application as t}from"@nativescript/core";const n=new e;function read(){let e=t.ios?.window?.safeAreaInsets;e&&n.publish(e)}const r=[`orientationChanged`,`resume`];function observeWindowInsets(e){read();let i=n.subscribe(e),reread=()=>read();for(let e of r)t.on?.(e,reread);return()=>{for(let e of r)t.off?.(e,reread);i()}}export{observeWindowInsets};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";import{WindowInsetsBroadcast as e}from"./window-insets.js";const t=new e;function observeWindowInsets(e){return t.subscribe(e)}export{observeWindowInsets};
@@ -0,0 +1 @@
1
+ import"../_virtual/_rolldown/runtime.js";const e={top:0,bottom:0,left:0,right:0};function toolbarViewInsetPadding(e,t){return{topBarTop:t.hasTopBar?e.top:0,contentTop:t.hasTopBar?0:e.top,bottomBarBottom:t.hasBottomBar?e.bottom:0,contentBottom:t.hasBottomBar?0:e.bottom}}function normaliseInsets(e){let at=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?e:0;return{top:at(e?.top),bottom:at(e?.bottom),left:at(e?.left),right:at(e?.right)}}var WindowInsetsBroadcast=class{_listeners=new Set;_last=e;get last(){return this._last}subscribe(e){return this._listeners.add(e),e(this._last),()=>{this._listeners.delete(e)}}publish(e){let t=normaliseInsets(e);if(t.top===this._last.top&&t.bottom===this._last.bottom&&t.left===this._last.left&&t.right===this._last.right)return!1;this._last=t;for(let e of[...this._listeners])e(t);return!0}};export{e as NO_INSETS,WindowInsetsBroadcast,normaliseInsets,toolbarViewInsetPadding};
@@ -40,6 +40,24 @@ export declare class AdwAboutDialog extends GridLayout {
40
40
  /** The copyright line. */
41
41
  get copyright(): string;
42
42
  set copyright(value: string);
43
+ /**
44
+ * Push the seven strings onto their labels, and COLLAPSE the ones with nothing
45
+ * to say.
46
+ *
47
+ * Every label used to be unconditionally visible, so an about dialog without a
48
+ * version rendered a blank line where the version belongs — the exact case
49
+ * `aboutDialogVisibility` answers for the browser port (`adw-about-dialog.c`
50
+ * binds each part's `visible` to a closure over the property that feeds it).
51
+ * Same input, two different dialogs, and nothing said so.
52
+ *
53
+ * The core's record covers a nineteen-part dialog; this port is a flat card, so
54
+ * it reads the parts it has. `copyright` is NOT one of them: upstream has no
55
+ * copyright LABEL, it derives the string into the Legal page this port does not
56
+ * build (`legalSectionVisible` takes it as a separate argument). It therefore
57
+ * keeps the same non-empty rule directly. The website row is the core's
58
+ * `websiteRow`, which is the flat-card equivalent here.
59
+ */
60
+ private _render;
43
61
  /** Reveal the about overlay. */
44
62
  present(): void;
45
63
  /** Hide the about overlay and emit `closed`. */
@@ -1,12 +1,19 @@
1
+ import { type AdwButtonStyleClass } from '@gjsify/adwaita-core';
1
2
  import { Button } from '@nativescript/core';
2
- /** The Adwaita button variants this widget can apply. `'default'` = plain button. */
3
- export type AdwButtonVariant = 'default' | 'suggested-action' | 'destructive-action' | 'flat' | 'pill';
3
+ /**
4
+ * The Adwaita button variants this widget can apply. `'default'` = plain button.
5
+ *
6
+ * The class list is `@gjsify/adwaita-core`'s, not a local table: this widget's own
7
+ * one was MISSING `circular`, which the browser element had, and neither file could
8
+ * see the other. `circular` is now here because the shared table says it exists.
9
+ */
10
+ export type AdwButtonVariant = 'default' | AdwButtonStyleClass;
4
11
  export declare class AdwButton extends Button {
5
12
  private _variant;
6
13
  constructor();
7
14
  /**
8
15
  * The Adwaita style variant. Setting it swaps the corresponding CSS class
9
- * (`.suggested-action`/`.destructive-action`/`.flat`/`.pill`) onto the button,
16
+ * (one of `AdwButton.variantClasses`) onto the button,
10
17
  * preserving the base `adw-button` class. Note that `pill` is the rounded
11
18
  * SHAPE and combines with no other variant here (set the shape OR the accent
12
19
  * intent — matching how this CSS subset expresses them as flat classes).
@@ -1,14 +1,18 @@
1
+ import type { AdwMenuEntry } from '@gjsify/adwaita-core';
1
2
  import { type EventData } from '@nativescript/core';
2
3
  import { AdwImageButton } from './adw-image-button.js';
3
4
  /** Event name emitted when a menu item is chosen. */
4
5
  export declare const MENU_ITEM_ACTIVATED = "menuItemActivated";
5
- /** One entry in an {@link AdwMenuButton}'s menu. */
6
- export interface AdwMenuItem {
7
- /** Stable identifier reported on activation (defaults to {@link label}). */
8
- id?: string;
9
- /** The menu item's display label. */
10
- label: string;
11
- }
6
+ /**
7
+ * One entry in an {@link AdwMenuButton}'s menu — `@gjsify/adwaita-core`'s
8
+ * {@link AdwMenuEntry}, under the name this widget has always used.
9
+ *
10
+ * It used to be a THIRD declaration of the same shape (the browser element had a
11
+ * second, and the core the original), and this one was missing `icon` — so a menu
12
+ * written for one renderer was not the same object on the other. The browser side
13
+ * adopted the core type in #1191; this is its twin.
14
+ */
15
+ export type AdwMenuItem = AdwMenuEntry;
12
16
  /** Payload of the {@link MENU_ITEM_ACTIVATED} event. */
13
17
  export interface MenuItemActivatedEventData extends EventData {
14
18
  /** The chosen item's id (or its label when no id was given). */
@@ -8,6 +8,11 @@ export declare class AdwToolbarView extends GridLayout {
8
8
  /** The currently-installed content view (row 1), if any. */
9
9
  private _content;
10
10
  private _props;
11
+ /** The last window insets seen, so a shape change can be re-paid without waiting. */
12
+ private _insets;
13
+ private _topBarCount;
14
+ private _bottomBarCount;
15
+ private _detachInsets;
11
16
  constructor();
12
17
  /** Append a widget (e.g. an {@link AdwHeaderBar}) to the top-bar slot. */
13
18
  addTopBar(view: View): void;
@@ -48,6 +53,16 @@ export declare class AdwToolbarView extends GridLayout {
48
53
  * while neither edge is extended, since the boxes then have their own rows.
49
54
  */
50
55
  private _restackBars;
56
+ /**
57
+ * Pay each edge's inset out of the slot that sits on it.
58
+ *
59
+ * The assignment is decided by the pure sibling (`toolbarViewInsetPadding`); this
60
+ * only spells it in NativeScript. Where that module says "the content pays", the
61
+ * padding goes on THIS view rather than on the content view: the content belongs
62
+ * to the consumer, and a chrome that writes padding into a consumer's widget
63
+ * would silently overwrite whatever they set there.
64
+ */
65
+ private _applyInsets;
51
66
  /**
52
67
  * Re-derive the four libadwaita style classes from the current state.
53
68
  *
@@ -0,0 +1,3 @@
1
+ import { type WindowInsetsListener } from './window-insets.js';
2
+ /** Subscribe to window-inset changes. Returns the unsubscribe. */
3
+ export declare function observeWindowInsets(listener: WindowInsetsListener): () => void;
@@ -0,0 +1,8 @@
1
+ import { type WindowInsetsListener } from './window-insets.js';
2
+ /**
3
+ * Subscribe to window-inset changes. Returns the unsubscribe.
4
+ *
5
+ * The listener is called once, immediately, with zero insets — the same contract
6
+ * the platform variants keep, so a consumer never needs a platform branch.
7
+ */
8
+ export declare function observeWindowInsets(listener: WindowInsetsListener): () => void;
@@ -0,0 +1,3 @@
1
+ import { type WindowInsetsListener } from './window-insets.js';
2
+ /** Subscribe to safe-area changes. Returns the unsubscribe. */
3
+ export declare function observeWindowInsets(listener: WindowInsetsListener): () => void;
@@ -0,0 +1,63 @@
1
+ /** The four window insets, in device-independent pixels. */
2
+ export interface WindowInsets {
3
+ readonly top: number;
4
+ readonly bottom: number;
5
+ readonly left: number;
6
+ readonly right: number;
7
+ }
8
+ /** What the toolbar view looks like, as far as inset assignment cares. */
9
+ export interface ToolbarViewShape {
10
+ readonly hasTopBar: boolean;
11
+ readonly hasBottomBar: boolean;
12
+ }
13
+ /** Extra padding each slot must add on top of whatever the theme gives it. */
14
+ export interface InsetPadding {
15
+ readonly topBarTop: number;
16
+ readonly contentTop: number;
17
+ readonly bottomBarBottom: number;
18
+ readonly contentBottom: number;
19
+ }
20
+ export declare const NO_INSETS: WindowInsets;
21
+ /**
22
+ * Assign `insets` to the slots of a toolbar view of `shape`.
23
+ *
24
+ * Total per edge is always exactly the inset — never doubled across two slots, which
25
+ * would leave a visible gap the width of the status bar, and never dropped.
26
+ */
27
+ export declare function toolbarViewInsetPadding(insets: WindowInsets, shape: ToolbarViewShape): InsetPadding;
28
+ /**
29
+ * Read the four values off whatever the platform handed over, clamping to ≥ 0.
30
+ *
31
+ * Defensive because the source is a native object across the NS bridge: a missing
32
+ * field arrives as `undefined` and would poison a `padding` assignment with `NaN`,
33
+ * which NS renders as zero padding on one edge and no error anywhere.
34
+ */
35
+ export declare function normaliseInsets(raw: Partial<WindowInsets> | null | undefined): WindowInsets;
36
+ /** Notified whenever the window's insets change. */
37
+ export type WindowInsetsListener = (insets: WindowInsets) => void;
38
+ /**
39
+ * One inset reading, many widgets.
40
+ *
41
+ * The platform hands insets to ONE listener — `setOnApplyWindowInsetsListener`
42
+ * REPLACES whatever was there — while an app has as many toolbar views as it has
43
+ * panes (the storybook has two, sidebar and content). So the native listener is
44
+ * installed once and this fans the reading out.
45
+ *
46
+ * Two behaviours are load-bearing and both are checked from a Linux runner:
47
+ *
48
+ * - a subscriber gets the LAST reading immediately. Insets are dispatched once,
49
+ * early; a pane built afterwards would otherwise sit un-inset until the next
50
+ * rotation, which is the shape of bug that looks like "sometimes it works".
51
+ * - an unchanged reading is dropped. Android re-dispatches insets on every
52
+ * layout pass, and a `padding` write schedules another layout pass.
53
+ */
54
+ export declare class WindowInsetsBroadcast {
55
+ private readonly _listeners;
56
+ private _last;
57
+ /** The most recent reading — {@link NO_INSETS} until the platform reports one. */
58
+ get last(): WindowInsets;
59
+ /** Subscribe, receiving {@link last} at once. Returns the unsubscribe. */
60
+ subscribe(listener: WindowInsetsListener): () => void;
61
+ /** Publish a platform reading. Normalised first; a no-change is not published. */
62
+ publish(raw: Partial<WindowInsets> | null | undefined): boolean;
63
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-nativescript",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -47,10 +47,10 @@
47
47
  "design-system"
48
48
  ],
49
49
  "dependencies": {
50
- "@gjsify/adwaita-core": "^0.39.0",
51
- "@gjsify/adwaita-fonts": "^0.39.0",
52
- "@gjsify/adwaita-icons": "^0.39.0",
53
- "@gjsify/native-platform": "^0.39.0"
50
+ "@gjsify/adwaita-core": "^0.41.0",
51
+ "@gjsify/adwaita-fonts": "^0.41.0",
52
+ "@gjsify/adwaita-icons": "^0.41.0",
53
+ "@gjsify/native-platform": "^0.41.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@nativescript/core": "*"
@@ -61,8 +61,8 @@
61
61
  }
62
62
  },
63
63
  "devDependencies": {
64
- "@gjsify/cli": "^0.39.0",
65
- "@gjsify/unit": "^0.39.0",
64
+ "@gjsify/cli": "^0.41.0",
65
+ "@gjsify/unit": "^0.41.0",
66
66
  "@types/node": "^25.9.2",
67
67
  "typescript": "^6.0.3"
68
68
  },
@@ -603,22 +603,24 @@ Page.adw-window {
603
603
  background-color: #fafafb;
604
604
  }
605
605
 
606
+ /* The header-bar background, so the status-bar inset the widget pads with is painted
607
+ * in the header colour: the chrome reaches the screen edge, the header content stops
608
+ * short of the clock.
609
+ *
610
+ * The PADDING is no longer here. It used to be `padding-top: var(--safeAreaInsetTop,
611
+ * 0)`, with "the host app feeds the variable" — and nothing in this repo ever fed it,
612
+ * on any platform, so the fallback was the only value it ever had. It could not have
613
+ * worked either way: this NS CSS subset has no custom properties at all, which is the
614
+ * same reason the accent has to be inlined as a literal. AdwToolbarView applies the
615
+ * real reading now (#1128). */
606
616
  .adw-toolbar-view-top {
607
- /* Match the header-bar background so the TOP safe-area inset (status bar) is
608
- * painted in the header colour — the chrome reaches the screen edge but the
609
- * header content does not slide under the clock. Host app feeds the inset
610
- * into --safeAreaInsetTop (falls back to 0 when unset). */
611
617
  background-color: #ffffff;
612
- padding-top: var(--safeAreaInsetTop, 0);
613
618
  }
614
619
 
615
620
  .adw-toolbar-view-bottom {
616
621
  background-color: #ffffff;
617
622
  border-top-width: 1;
618
623
  border-top-color: rgba(0, 0, 0, 0.1);
619
- /* BOTTOM safe-area inset (nav bar / gesture pill) painted in the bottom-bar
620
- * colour. Host app feeds --safeAreaInsetBottom (falls back to 0). */
621
- padding-bottom: var(--safeAreaInsetBottom, 0);
622
624
  }
623
625
 
624
626
  /* top-bar-style / bottom-bar-style = raised: an opaque background with a