@gjsify/adwaita-nativescript 0.64.13-next.283 → 0.64.13
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/widgets/adw-about-dialog.js +3 -3
- package/lib/esm/widgets/adw-avatar.js +1 -1
- package/lib/esm/widgets/adw-banner.js +1 -1
- package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
- package/lib/esm/widgets/adw-carousel.js +1 -1
- package/lib/esm/widgets/adw-combo-row.js +1 -1
- package/lib/esm/widgets/adw-data-grid.js +1 -1
- package/lib/esm/widgets/adw-dialog.js +1 -1
- package/lib/esm/widgets/adw-image-button.js +1 -1
- package/lib/esm/widgets/adw-navigation-page.js +1 -1
- package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
- package/lib/esm/widgets/adw-navigation-view.js +1 -1
- package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
- package/lib/esm/widgets/adw-password-entry-row.js +1 -1
- package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
- package/lib/esm/widgets/adw-preferences-page.js +1 -1
- package/lib/esm/widgets/adw-sidebar.js +1 -1
- package/lib/esm/widgets/adw-slider-row.js +1 -1
- package/lib/esm/widgets/adw-spin-row.js +1 -1
- package/lib/esm/widgets/adw-split-button.js +1 -1
- package/lib/esm/widgets/adw-tab-view.js +1 -1
- package/lib/esm/widgets/adw-toggle-group.js +1 -1
- package/lib/esm/widgets/adw-toolbar-view.js +1 -1
- package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
- package/lib/esm/widgets/adw-wrap-box.js +1 -1
- package/lib/esm/widgets/construct-props.js +1 -1
- package/lib/esm/widgets/gtk-action-bar.js +1 -1
- package/lib/esm/widgets/gtk-box.js +1 -1
- package/lib/esm/widgets/gtk-button.js +1 -1
- package/lib/esm/widgets/gtk-check-button.js +1 -1
- package/lib/esm/widgets/gtk-drawing-area.js +1 -1
- package/lib/esm/widgets/gtk-drop-down.js +1 -1
- package/lib/esm/widgets/gtk-entry.js +1 -1
- package/lib/esm/widgets/gtk-grid.js +1 -1
- package/lib/esm/widgets/gtk-icon-size.js +1 -1
- package/lib/esm/widgets/gtk-image.js +1 -1
- package/lib/esm/widgets/gtk-label.js +1 -1
- package/lib/esm/widgets/gtk-list-box.js +1 -1
- package/lib/esm/widgets/gtk-menu-button.js +1 -1
- package/lib/esm/widgets/gtk-revealer.js +1 -1
- package/lib/esm/widgets/gtk-scrolled-window.js +1 -1
- package/lib/esm/widgets/gtk-stack.js +1 -1
- package/lib/esm/widgets/gtk-text-view.js +1 -1
- package/lib/esm/widgets/gtk-toggle-button.js +1 -1
- package/lib/esm/widgets/gtk-window.js +1 -1
- package/lib/esm/widgets/label-markup.js +1 -1
- package/lib/esm/widgets/scrolled-window-policy.js +1 -1
- package/lib/esm/widgets/signals.js +1 -1
- package/lib/esm/widgets/single-child-base.js +1 -1
- package/lib/esm/widgets/single-child-cell.js +1 -0
- package/lib/esm/widgets/stack-page.js +1 -1
- package/lib/esm/widgets/transition-type.js +1 -1
- package/lib/esm/widgets/view-stack-page.js +1 -1
- package/lib/esm/widgets/widget-layout.js +1 -1
- package/lib/esm/widgets/xml-values.js +1 -1
- package/lib/types/clamped-bin.spec.d.ts +2 -0
- package/lib/types/combo-row-properties.spec.d.ts +2 -0
- package/lib/types/drop-down-properties.spec.d.ts +2 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/single-child-cell.spec.d.ts +2 -0
- package/lib/types/testing/ns-core.d.mts +24 -2
- package/lib/types/widgets/adw-combo-row.d.ts +42 -26
- package/lib/types/widgets/gtk-drop-down.d.ts +41 -33
- package/lib/types/widgets/index.d.ts +1 -2
- package/lib/types/widgets/signals.d.ts +33 -8
- package/lib/types/widgets/single-child-base.d.ts +2 -0
- package/lib/types/widgets/single-child-cell.d.ts +8 -0
- package/lib/types/widgets/xml-values.d.ts +12 -0
- package/package.json +13 -14
- package/src/testing/ns-core.mts +55 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{nativeClipboardHost as i}from"../clipboard-host.js";import{nativePlatformHost as a}from"../platform-host.js";import{GtkImage as o}from"./gtk-image.js";import{findDialogHost as s}from"./window-state.js";import{ADW_ABOUT_DIALOG_LABELS as c,ADW_LICENSE_DEFAULTS as l,HandledAccumulator as u,aboutDialogVisibility as d,acknowledgementSections as f,createAppInfo as p,creditsSections as m,flatCardShowsWebsite as h,isLicenseType as g,legalMarkupText as _,legalSections as v,legalVisible as y,licenseTypeForNick as b,refuseNewFromAppdata as x,releaseNotesBuffer as S,setLicense as C,setLicenseType as w,stripMnemonic as T}from"@gjsify/adwaita-core";import{Button as E,GridLayout as D,ItemSpec as O,Label as k,ScrollView as A,StackLayout as j}from"@nativescript/core";const M=`closed`,N=`activate-link`,P=p(a);function creditsText(e){return e.map(e=>[...e.title===null?[]:[e.title],...e.people.map(e=>e.name)].join(`
|
|
2
2
|
`)).join(`
|
|
3
3
|
|
|
4
|
-
`)}var AdwAboutDialog=class extends r(D){static GTypeName=`AdwAboutDialog`;_card;_appIcon;_nameLabel;_versionLabel;_developerLabel;_commentsLabel;_websiteButton;_supportButton;_issueButton;_creditsLabel;_acknowledgementsLabel;_legalLabel;_releaseNotesLabel;_linksBox;_debugInfoLabel;_copyButton;_applicationName=``;_applicationIcon=``;_developerName=``;_version=``;_comments=``;_website=``;_supportUrl=``;_issueUrl=``;_copyright=``;_licenseState={...l};_developers=[];_designers=[];_artists=[];_documenters=[];_translatorCredits=``;_releaseNotes=``;_releaseNotesVersion=``;_debugInfo=``;_links=[];_creditSections=[];_acknowledgementSections=[];_legalSections=[];_releaseNotesSegments=[];_host=null;constructor(
|
|
4
|
+
`)}var AdwAboutDialog=class extends r(D){static GTypeName=`AdwAboutDialog`;_card;_appIcon;_nameLabel;_versionLabel;_developerLabel;_commentsLabel;_websiteButton;_supportButton;_issueButton;_creditsLabel;_acknowledgementsLabel;_legalLabel;_releaseNotesLabel;_linksBox;_debugInfoLabel;_copyButton;_applicationName=``;_applicationIcon=``;_developerName=``;_version=``;_comments=``;_website=``;_supportUrl=``;_issueUrl=``;_copyright=``;_licenseState={...l};_developers=[];_designers=[];_artists=[];_documenters=[];_translatorCredits=``;_releaseNotes=``;_releaseNotesVersion=``;_debugInfo=``;_links=[];_creditSections=[];_acknowledgementSections=[];_legalSections=[];_releaseNotesSegments=[];_host=null;constructor(e){super(),this.className=`adw-about-dialog`,this.visibility=`collapse`,this.addColumn(new O(1,`star`)),this.addRow(new O(1,`star`));let t=new A;t.orientation=`vertical`,t.verticalAlignment=`middle`,t.horizontalAlignment=`center`,D.setColumn(t,0),D.setRow(t,0);let r=new j;r.orientation=`vertical`,r.className=`adw-about-dialog-card`,t.content=r,this.addChild(t),this._card=r;let i=new o;i.className=`adw-icon adw-about-dialog-icon`,i.pixelSize=128,i.horizontalAlignment=`center`,r.addChild(i),this._appIcon=i,this._nameLabel=this._addCardLabel(r,`adw-about-dialog-name`),this._versionLabel=this._addCardLabel(r,`adw-about-dialog-version`),this._developerLabel=this._addCardLabel(r,`adw-about-dialog-developer`),this._commentsLabel=this._addCardLabel(r,`adw-about-dialog-comments`),this._releaseNotesLabel=this._addCardLabel(r,`adw-about-dialog-release-notes`),this._websiteButton=this._addLinkButton(r,`adw-about-dialog-website`),this._linksBox=new j,this._linksBox.className=`adw-about-dialog-links`,r.addChild(this._linksBox),this._supportButton=this._addLinkButton(r,`adw-about-dialog-support`),this._issueButton=this._addLinkButton(r,`adw-about-dialog-issue`),this._creditsLabel=this._addCardLabel(r,`adw-about-dialog-credits`),this._acknowledgementsLabel=this._addCardLabel(r,`adw-about-dialog-acknowledgements`),this._legalLabel=this._addCardLabel(r,`adw-about-dialog-legal`),this._debugInfoLabel=this._addCardLabel(r,`adw-about-dialog-debug-info`);let a=new E;a.text=T(c.copyText),a.className=`adw-about-dialog-copy`,a.set(`androidElevation`,0),a.addEventListener(`tap`,()=>this._copyDebugInfo()),r.addChild(a),this._copyButton=a;let s=new E;s.text=`Close`,s.className=`adw-about-dialog-close`,s.set(`androidElevation`,0),s.addEventListener(`tap`,()=>this.close()),r.addChild(s),this._render(),n(this,e)}_addCardLabel(e,t){let n=new k;return n.className=t,n.horizontalAlignment=`center`,n.textWrap=!0,e.addChild(n),n}_addLinkButton(e,t){let n=new E;return n.className=`adw-about-dialog-link ${t}`,n.set(`androidElevation`,0),e.addChild(n),n}_activateLink(e){let t=new u;if(this.notify({eventName:N,object:this,uri:e,accumulator:t}),!t.stopped)try{P.launch_default_for_uri(e,null)}catch{}}_setLink(e,t,n,r){e.text=t,e.visibility=r?`visible`:`collapse`;let i=e;i._uriTap&&e.removeEventListener(`tap`,i._uriTap),i._uriTap=()=>this._activateLink(n),e.addEventListener(`tap`,i._uriTap)}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 supportUrl(){return this._supportUrl}set supportUrl(e){this._supportUrl=e??``,this._render()}get issueUrl(){return this._issueUrl}set issueUrl(e){this._issueUrl=e??``,this._render()}get copyright(){return this._copyright}set copyright(e){this._copyright=e??``,this._render()}get license(){return this._licenseState.license}set license(e){this._licenseState=C(this._licenseState,e??``).state,this._render()}get licenseType(){return this._licenseState.licenseType}set licenseType(e){let n=(typeof e==`string`?b(e.trim()):void 0)??t(e,-1);this._licenseState=w(this._licenseState,n).state,this._render()}get developers(){return this._developers}set developers(e){this._developers=[...e??[]],this._render()}get designers(){return this._designers}set designers(e){this._designers=[...e??[]],this._render()}get artists(){return this._artists}set artists(e){this._artists=[...e??[]],this._render()}get documenters(){return this._documenters}set documenters(e){this._documenters=[...e??[]],this._render()}get translatorCredits(){return this._translatorCredits}set translatorCredits(e){this._translatorCredits=e??``,this._render()}get releaseNotes(){return this._releaseNotes}set releaseNotes(e){this._releaseNotes=e??``,this._updateReleaseNotes()}get releaseNotesVersion(){return this._releaseNotesVersion}set releaseNotesVersion(e){this._releaseNotesVersion=e??``,this._updateReleaseNotes()}get debugInfo(){return this._debugInfo}set debugInfo(e){this._debugInfo=e??``,this._render()}add_link(e,t){this._links.push({title:e,url:t}),this._render()}add_credit_section(e,t){this._creditSections.push({title:e,people:[...t]}),this._render()}add_acknowledgement_section(e,t){this._acknowledgementSections.push({title:e,people:[...t]}),this._render()}add_legal_section(e,t,n,r){g(n)&&(this._legalSections.push({title:e,copyright:t,licenseType:n,license:r}),this._render())}static new_from_appdata(e,t){x()}_updateReleaseNotes(){this._releaseNotesSegments=S({releaseNotes:this._releaseNotes,releaseNotesVersion:this._releaseNotesVersion,version:this._version},c).segments,this._render()}_render(){let e=m({developers:this._developers,designers:this._designers,artists:this._artists,documenters:this._documenters,translatorCredits:this._translatorCredits,creditSections:this._creditSections}),t=f(this._acknowledgementSections),n={copyright:this._copyright,licenseType:this._licenseState.licenseType,license:this._licenseState.license,legalSections:this._legalSections},r=d({applicationName:this._applicationName,applicationIcon:this._applicationIcon,developerName:this._developerName,version:this._version,comments:this._comments,website:this._website,supportUrl:this._supportUrl,issueUrl:this._issueUrl,debugInfo:this._debugInfo,releaseNotes:this._releaseNotes,hasCustomLinks:this._links.length>0,hasCredits:e.length>0,hasLegal:y(n),hasAcknowledgements:t.length>0}),show=(e,t,n)=>{e.text=t,e.visibility=n?`visible`:`collapse`};this._appIcon.iconName=this._applicationIcon,this._appIcon.visibility=r.appIcon?`visible`:`collapse`,show(this._nameLabel,this._applicationName,r.appName),show(this._versionLabel,this._version,r.version),show(this._developerLabel,this._developerName,r.developerName),show(this._commentsLabel,this._comments,r.commentsLabel),this._setLink(this._websiteButton,T(c.websiteRow),this._website,h(r)),this._setLink(this._supportButton,T(c.supportRow),this._supportUrl,r.supportRow),this._setLink(this._issueButton,T(c.issueRow),this._issueUrl,r.issueRow),show(this._creditsLabel,creditsText(e),r.creditsRow),show(this._acknowledgementsLabel,creditsText(t),r.acknowledgementsRow),show(this._legalLabel,v(n).map(e=>[e.title??``,_(e.markup)].filter(e=>e.length>0).join(`
|
|
5
5
|
`)).join(`
|
|
6
6
|
|
|
7
|
-
`),r.legalRow),show(this._releaseNotesLabel,this._releaseNotesSegments.map(e=>e.text).join(``),r.whatsNewRow),this._linksBox.removeChildren();for(let e of this._links){let t=this._addLinkButton(this._linksBox,`adw-about-dialog-links-item`);this._setLink(t,T(e.title),e.url,!0)}this._linksBox.visibility=this._links.length>0?`visible`:`collapse`,show(this._debugInfoLabel,this._debugInfo,r.troubleshootingRow),this._copyButton.visibility=r.troubleshootingRow?`visible`:`collapse`}_copyDebugInfo(){let e=this._debugInfo;Promise.resolve().then(()=>i.writeText(e)).catch(()=>void 0)}present(e){if(!this.open){if(this.parent===null||this.parent===void 0){let t=s(e??null);if(t===null)throw Error(`${this.constructor.name} has no window to appear in: pass a widget that sits inside an Adw.Window / Adw.ApplicationWindow to present(), or add the dialog to a layout first.`);t._hostDialog(this),this._host=t}this.visibility=`visible`}}close(){this.visibility=`collapse`,this._host!==null&&(this._host._unhostDialog(this),this._host=null);let e={eventName:M,object:this};this.notify(e)}get open(){return this.visibility===`visible`}set open(
|
|
7
|
+
`),r.legalRow),show(this._releaseNotesLabel,this._releaseNotesSegments.map(e=>e.text).join(``),r.whatsNewRow),this._linksBox.removeChildren();for(let e of this._links){let t=this._addLinkButton(this._linksBox,`adw-about-dialog-links-item`);this._setLink(t,T(e.title),e.url,!0)}this._linksBox.visibility=this._links.length>0?`visible`:`collapse`,show(this._debugInfoLabel,this._debugInfo,r.troubleshootingRow),this._copyButton.visibility=r.troubleshootingRow?`visible`:`collapse`}_copyDebugInfo(){let e=this._debugInfo;Promise.resolve().then(()=>i.writeText(e)).catch(()=>void 0)}present(e){if(!this.open){if(this.parent===null||this.parent===void 0){let t=s(e??null);if(t===null)throw Error(`${this.constructor.name} has no window to appear in: pass a widget that sits inside an Adw.Window / Adw.ApplicationWindow to present(), or add the dialog to a layout first.`);t._hostDialog(this),this._host=t}this.visibility=`visible`}}close(){this.visibility=`collapse`,this._host!==null&&(this._host._unhostDialog(this),this._host=null);let e={eventName:M,object:this};this.notify(e)}get open(){return this.visibility===`visible`}set open(t){e(t,!1)?this.present():this.close()}};export{N as ACTIVATE_LINK,AdwAboutDialog,M as CLOSED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{GtkImage as i}from"./gtk-image.js";import{avatarColor as a,avatarInitials as o}from"./avatar-color.js";import{AVATAR_DEFAULT_ICON as s,avatarViewState as c}from"./avatar-view.js";import{avatarIconSize as l,avatarMaxFontSize as u}from"@gjsify/adwaita-core";import{GridLayout as d,ItemSpec as f,Label as p}from"@nativescript/core";const m=48;var AdwAvatar=class extends r(d){static GTypeName=`AdwAvatar`;_label;_icon;_text=``;_size=48;_showInitials=!1;_iconName=``;constructor(e){super(),this.className=`adw-avatar`,this.addColumn(new f(1,`star`)),this.addRow(new f(1,`star`));let t=new p;t.className=`adw-avatar-label`,t.horizontalAlignment=`center`,t.verticalAlignment=`middle`,d.setColumn(t,0),d.setRow(t,0),this.addChild(t),this._label=t;let r=new i;r.className=`adw-icon adw-avatar-icon`,r.horizontalAlignment=`center`,r.verticalAlignment=`middle`,d.setColumn(r,0),d.setRow(r,0),this.addChild(r),this._icon=r,this._applySize(),this._applyColor(),this._applyMode(),n(this,e)}_applySize(){this.width=this._size,this.height=this._size,this.set(`borderRadius`,this._size/2),this._label.set(`fontSize`,Math.round(Math.min(this._size*.4,u(this._size)))),this._icon.pixelSize=l(this._size)}_applyColor(){let{fill:e,fg:t}=a(this._text);this.set(`backgroundColor`,e),this._label.set(`color`,t),this._icon.iconColor=t}_applyMode(){let e=c({showInitials:this._showInitials,text:this._text,iconName:this._iconName});this._label.visibility=e.label,this._icon.visibility=e.icon,e.icon===`visible`&&(this._icon.iconName=e.iconName)}get text(){return this._text}set text(e){this._text=e??``,this._label.text=o(this._text),this._applyColor(),this._applyMode()}get size(){return this._size}set size(e){let n=t(e,48);this._size=n>0?n:48,this._applySize()}get showInitials(){return this._showInitials}set showInitials(t){this._showInitials=e(t,!1),this._applyMode()}get iconName(){return this._iconName}set iconName(e){this._iconName=e??``,this._applyMode()}};export{s as AVATAR_DEFAULT_ICON,AdwAvatar,m as DEFAULT_AVATAR_SIZE,a as avatarColor,o as avatarInitials};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{bannerButtonClassName as r,bannerTitleText as i,bannerVisibility as a,defaultBannerProps as o}from"./chrome.js";import{bannerButtonText as s,bannerButtonVisible as c,parseBannerButtonStyle as l}from"@gjsify/adwaita-core";import{Button as u,GridLayout as d,ItemSpec as f,Label as p}from"@nativescript/core";const m=`buttonClicked`;var AdwBanner=class extends n(d){static GTypeName=`AdwBanner`;_titleLabel;_button;_hasButton=!1;_props=o();constructor(e){super(),this.className=`adw-banner`,this.addColumn(new f(1,`star`)),this.addColumn(new f(1,`auto`)),this.addRow(new f(1,`auto`));let n=new p;n.className=`adw-banner-title`,n.textWrap=!0,d.setColumn(n,0),this.addChild(n),this._titleLabel=n;let r=new u;r.className=`adw-banner-button`,r.set(`androidElevation`,0),d.setColumn(r,1),this._button=r,r.addEventListener(`tap`,()=>{let e={eventName:m,object:this};this.notify(e)}),this.visibility=a(this._props.revealed),t(this,e)}get title(){return this._props.title}set title(e){this._props.title=e??``,this._renderTitle()}get useMarkup(){return this._props.useMarkup}set useMarkup(t){this._props.useMarkup=e(t,!1),this._renderTitle()}get buttonLabel(){return this._props.buttonLabel}set buttonLabel(e){let t=e??``;this._props.buttonLabel=t,this._button.text=s(t);let n=c(t);n&&!this._hasButton?(this.addChild(this._button),this._hasButton=!0):!n&&this._hasButton&&(this.removeChild(this._button),this._hasButton=!1)}get buttonStyle(){return this._props.buttonStyle}set buttonStyle(e){this._props.buttonStyle=l(e),this._button.className=r(this._button.className,this._props.buttonStyle)}get revealed(){return this._props.revealed}set revealed(t){this._props.revealed=e(t,!1),this.visibility=a(this._props.revealed)}_renderTitle(){this._titleLabel.text=i(this._props.title,this._props.useMarkup)}};export{AdwBanner,m as BUTTON_CLICKED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{xmlBoolean as n}from"./xml-values.js";import{applyConstructProps as r}from"./construct-props.js";import{withSignals as i}from"./signals.js";import{BOTTOM_BAR_CLASS as a,CLOSE_ATTEMPT as o,DIMMING_CLASS as s,NOTIFY_OPEN as c,SHEET_CLOSE as l,addMarkerClass as u,applyBottomSheetChrome as d,createBottomSheetPresentation as f,removeMarkerClass as p,requestBottomSheetClose as m}from"./bottom-sheet-state.js";import{bottomSheetInsetPadding as h}from"./bottom-sheet-insets.js";import{NestedDragTracker as g,dragOffset as _,dragProgress as v,releaseVelocity as y,settle as b,sheetHeight as x,sheetTravel as S}from"./bottom-sheet-drag.js";import{attachRowPressFeedback as C}from"./row-press.js";import{GridLayout as w,ItemSpec as T,Label as E,ScrollView as D,StackLayout as O}from"@nativescript/core";const k=`notify::modal`,A=new WeakMap;function bottomSheetPanel(e){let t=A.get(e);if(!t)throw Error(`bottomSheetPanel: not an AdwBottomSheet`);return t}const j=`adw-bottom-sheet-content`,M=`adw-bottom-sheet-sheet`,N=[`sheet`,`bottomBar`,`bottom-bar`,`content`];var AdwBottomSheet=class extends i(w){static GTypeName=`AdwBottomSheet`;static emittedSignals=[c,k];static builderSlots=e(N,`content`);_content=null;_dimming;_sheetPanel;_sheetPage;_drag=null;_nested=new g;_scrolls=new Set;_bottomInset=0;_barHeight=0;_bottomBarBin;_sheetChild=null;_bottomBar=null;_state=f();constructor(e){super(),this.className=`adw-bottom-sheet`,this.addColumn(new T(1,`star`)),this.addRow(new T(1,`star`));let t=new w;t.className=s,w.setColumn(t,0),w.setRow(t,0),t.addEventListener(`tap`,()=>this.requestClose(`dimming`)),this.addChild(t),this._dimming=t;let n=new O;n.orientation=`vertical`,n.className=`adw-bottom-sheet-panel`,n.verticalAlignment=`bottom`,w.setColumn(n,0),w.setRow(n,0);let i=new O;i.orientation=`vertical`,i.className=a,i.addEventListener(`tap`,()=>this.requestOpen(`bottom-bar`)),C(i),n.addChild(i);let o=new w;o.className=`adw-bottom-sheet-page`,o.addRow(new T(1,`star`)),n.addChild(o);let l=new E;l.className=`adw-bottom-sheet-handle`,l.horizontalAlignment=`center`,l.isUserInteractionEnabled=!1,l.verticalAlignment=`top`,w.setRow(l,0),o.addChild(l);let u=new O;u.className=`adw-bottom-sheet-grip`,u.verticalAlignment=`top`,u.height=48,u.addEventListener(`tap`,()=>{}),w.setRow(u,0),o.addChild(u),n.addEventListener(`pan`,e=>this._onPan(e)),t.addEventListener(`pan`,e=>this._onPan(e)),this.addChild(n),this._sheetPanel=n,A.set(this,n),this._sheetPage=o,this._bottomBarBin=i,this._paintChrome(),this._applyInsetPadding(),this.addEventListener(`layoutChanged`,()=>{this._syncHeight(),!this._state.open&&!this._drag&&(this._barHeight=this._sheetPanel.getActualSize().height)}),this._state.subscribe(e=>{this._paintChrome(),this._syncHeight();let t={eventName:c,object:this,open:e};this.notify(t)}),r(this,e)}applyBottomInset(e){this._bottomInset=e,this._applyInsetPadding()}_applyInsetPadding(){let e=h(this._bottomInset,{sheetScrolls:this._scrolls.size>0});this._bottomBarBin.paddingBottom=e.bar,this._sheetPage.paddingBottom=e.page;for(let t of this._scrolls){let n=t.content;n&&(n.paddingBottom=e.scrollEnd)}}_paintChrome(){d({dimming:this._dimming,panel:this._sheetPanel,page:this._sheetPage,bottomBar:this._bottomBarBin},this._state.chrome)}_syncHeight(){let e=this._sheetPanel;if(this._drag)return;if(!this._state.open){e.height!==`auto`&&(e.height=`auto`);return}let t=x(this.getActualSize().height);t>0&&e.height!==t&&(e.height=t)}_watchScrolling(e){if(e instanceof D){if(this._scrolls.has(e))return;this._scrolls.add(e),e.addEventListener(`touch`,t=>this._onNestedTouch(e,t)),this._applyInsetPadding();return}let t=e;t.content&&this._watchScrolling(t.content);let n=t.getChildrenCount?.()??0;for(let e=0;e<n;e++)this._watchScrolling(t.getChildAt(e))}_onNestedTouch(e,t){if(!this._state.open&&!this._nested.dragging)return;let n=t.getY()+(this._sheetPanel.translateY||0),r;if(t.action===`down`){if(this._drag)return;this._nested.down(n);return}r=t.action===`move`?this._nested.move(n,e.verticalOffset):this._nested.up(t.action===`cancel`),r.kind===`begin`?this._beginDrag():r.kind===`move`?this._moveDrag(r.dy):r.kind===`end`&&this._endDrag(r.dy,!1)}_onPan(e){this._nested.ignorePan(e.state)||(e.state===1?this._beginDrag():e.state===2?this._moveDrag(e.deltaY):this._endDrag(e.deltaY,e.state===0))}_beginDrag(){if(this._drag)return;let e=this._state.open;if(!e&&!this._bottomBar)return;let t=x(this.getActualSize().height);if(t<=0)return;let n=S(t,this._barHeight),r=this._sheetPanel;this._drag={start:e?`open`:`closed`,height:t,travel:n,samples:[],offset:e?0:n},r.height=t,!e&&(this._dimming.visibility=`visible`,this._dimming.opacity=0,this._bottomBarBin.visibility=`collapse`,this._sheetPage.visibility=`visible`,r.visibility=`visible`,r.translateY=n)}_moveDrag(e){let t=this._drag;t&&(t.samples.push({dy:e,time:Date.now()}),t.offset=_(t.start,e,t.travel),this._sheetPanel.translateY=t.offset,(t.start===`closed`||this._state.modal)&&(this._dimming.opacity=v(t.offset,t.travel)))}_endDrag(e,t){let n=this._drag;if(!n)return;n.samples.push({dy:e,time:Date.now()}),n.offset=_(n.start,e,n.travel);let r=t?n.start:b(n.offset,n.travel,y(n.samples)),i=r===`open`?0:n.travel,done=()=>{this._drag=null,this._sheetPanel.translateY=0,this._dimming.opacity=1,r!==n.start&&(r===`open`?this.requestOpen(`swipe`):this.requestClose(`swipe`)),this._paintChrome(),this._syncHeight()};this._sheetPanel.animate({translate:{x:0,y:i},duration:180,curve:`easeOut`}).then(done,done)}set_content(e){this._content!==e&&(this._content&&(this._content.className=p(this._content.className,j),this.removeChild(this._content)),this._content=e,e&&(e.className=u(e.className,j),w.setColumn(e,0),w.setRow(e,0),this.insertChild(e,0)))}set_sheet(e){this._sheetChild!==e&&(this._sheetChild&&(this._sheetChild.className=p(this._sheetChild.className,M),this._sheetPage.removeChild(this._sheetChild),this._scrolls.clear()),this._sheetChild=e,e&&(e.className=u(e.className,M),w.setRow(e,0),this._sheetPage.insertChild(e,0),this._watchScrolling(e),e.addEventListener(`loaded`,()=>this._watchScrolling(e))),this._applyInsetPadding())}set_bottom_bar(e){this._bottomBar!==e&&(this._bottomBar&&this._bottomBarBin.removeChild(this._bottomBar),this._bottomBar=e,e&&this._bottomBarBin.addChild(e),this._state.setHasBottomBar(e!==null),this._paintChrome())}_addChildFromBuilder(e,n){let r=t(e,N,`content`);r===`sheet`?this.set_sheet(n):r===`bottomBar`||r===`bottom-bar`?this.set_bottom_bar(n):this.set_content(n)}get content(){return this._content}set content(e){this.set_content(e)}get sheet(){return this._sheetChild}set sheet(e){this.set_sheet(e)}get bottomBar(){return this._bottomBar}set bottomBar(e){this.set_bottom_bar(e)}get open(){return this._state.open}set open(e){this._state.setOpen(n(e,!1))}get_modal(){return this._state.modal}set_modal(e){this._state.setModal(n(e,this.get_modal()))&&(this._paintChrome(),this.notify({eventName:k,object:this,value:this.get_modal()}))}get canClose(){return this._state.canClose}set canClose(e){let t=n(e,this.canClose);this._state.setCanClose(t)}get canOpen(){return this._state.canOpen}set canOpen(e){this._state.setCanOpen(n(e,this.canOpen))&&this._paintChrome()}get revealBottomBar(){return this._state.revealBottomBar}set revealBottomBar(e){this._state.setRevealBottomBar(n(e,this.revealBottomBar))&&this._paintChrome()}requestClose(e){let{outcome:t,eventName:n}=m(this._state,e);return n&&this.notify({eventName:n,object:this}),t}requestOpen(e){return this._state.requestOpen(e)}};export{AdwBottomSheet,o as CLOSE_ATTEMPT,k as NOTIFY_MODAL,c as NOTIFY_OPEN,l as SHEET_CLOSE,bottomSheetPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{CarouselScrollSync as i,DEFAULT_CAROUSEL_PAGE_WIDTH as a,carouselNotifyPayload as o,carouselPositionAtOffset as s,carouselScrollOffset as c,createCarouselState as l,normalizeCarouselPageWidth as u}from"./carousel-state.js";import{GridLayout as d,ItemSpec as f,ScrollView as p,StackLayout as m}from"@nativescript/core";const h=`notify::position`,g=`notify::n-pages`,_=`page-changed`;var AdwCarousel=class extends r(d){static GTypeName=`AdwCarousel`;_scroller;_track;_state=l({onScrollTo:e=>this._performScroll(e)});_sync=new i;_views=new Map;_nextPageId=0;_pageWidth=320;_animateScroll=!0;constructor(e){super(),this.className=`adw-carousel`,this.addColumn(new f(1,`star`)),this.addRow(new f(1,`star`));let t=new p;t.orientation=`horizontal`,t.className=`adw-carousel-scroller`,d.setRow(t,0);let r=new m;r.orientation=`horizontal`,r.className=`adw-carousel-track`,t.content=r,this.addChild(t),this._scroller=t,this._track=r,t.addEventListener(`scroll`,e=>{let t=s(e.scrollX,this._distance());this._sync.apply(this._state,t)}),this._state.subscribe(e=>{let t={eventName:e.reason===`n-pages`?g:h,object:this,...o(e)};this.notify(t)}),this._state.onPageChanged(e=>{let t={eventName:_,object:this,index:e};this.notify(t)}),n(this,e)}append(e){this.insert(e,-1)}_addChildFromBuilder(e,t){this.append(t)}insert(e,t=-1){let n=`page-${this._nextPageId++}`;return e.width=this._pageWidth,e.className=`${e.className??``} adw-carousel-page`.trim(),this._views.set(n,e),this._state.insertPage(n,t)?(this._state.skipReveal(n),this._syncTrack(),!0):(this._views.delete(n),!1)}remove(e){let t=this._idOf(e);return t===null||!this._state.removePage(t)?!1:(this._state.skipReveal(t),this._views.delete(t),this._syncTrack(),!0)}reorder(e,t){let n=this._idOf(e);return n===null||!this._state.reorderPage(n,t)?!1:(this._syncTrack(),!0)}scroll_to(e,t=!0){let n=this._idOf(e);if(n!==null){this._animateScroll=t;try{this._scrollToIndex(this._state.indexOf(n))}finally{this._animateScroll=!0}}}get_nth_page(e){if(!Number.isInteger(e)||e<0||e>=this._state.nPages)return null;let t=this._state.ids[e];return(t===void 0?void 0:this._views.get(t))??null}get_n_pages(){return this._state.nPages}get_position(){return this._state.position}navigate(e){return this._state.navigate(e)}get pages(){let e=[];for(let t=0;t<this._track.getChildrenCount();t++)e.push(this._track.getChildAt(t));return e}get nPages(){return this._state.nPages}get position(){return this._state.position}set position(e){let n=t(e,this.position);if(!Number.isFinite(n))return;let r=this._state.pageAt(n);r>=0&&this._scrollToIndex(r)}get currentPage(){return this._state.pageAt(this._state.position)}get interactive(){return this._state.interactive}set interactive(t){let n=e(t,this.interactive);this._state.setInteractive(n)}get pageWidth(){return this._pageWidth}set pageWidth(e){let n=t(e,this.pageWidth);this._pageWidth=u(n);for(let e of this._views.values())e.width=this._pageWidth}_distance(){return this._state.pageDistance(this._pageWidth)}_scrollToIndex(e){this._state.scrollTo(e,{interactive:!0})}_idOf(e){for(let[t,n]of this._views)if(n===e)return t;return null}_performScroll(e){this._sync.expect(e.position),this._scroller.scrollToHorizontalOffset(c(e.position,this._distance()),this._animateScroll)}_syncTrack(){for(;this._track.getChildrenCount()>0;)this._track.removeChild(this._track.getChildAt(0));for(let e of this._state.ids){let t=this._views.get(e);t&&this._track.addChild(t)}}};export{AdwCarousel,a as DEFAULT_CAROUSEL_PAGE_WIDTH,g as NOTIFY_N_PAGES,h as NOTIFY_POSITION,_ as PAGE_CHANGED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{applyConstructProps as n}from"./construct-props.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{applyConstructProps as n}from"./construct-props.js";import{pushDeclared as r,readDeclaredValue as i,withProperties as a}from"./signals.js";import{GtkImage as o}from"./gtk-image.js";import{AdwActionRow as s}from"./adw-action-row.js";import{attachRowPressFeedback as c}from"./row-press.js";import{ADW_COMBO_NO_SELECTION as l,ComboState as u,ComboState as d,GjsifyOptionList as f,ListModel as p,TYPE_OBJECT as m,readModelWrite as h}from"@gjsify/adwaita-core";import{Label as g,StackLayout as _,action as v}from"@nativescript/core";import{panDownSymbolic as y}from"@gjsify/adwaita-icons/ui";const b=`notify::selected`;var AdwComboRow=class extends a(s,{GTypeName:`AdwComboRow`,Properties:{model:{kind:`object`,valueType:p,explicitNotify:!0,blurb:`The model used by the combo row`,normalize:(e,t)=>h(e,t._authored),afterNotify:e=>e._applyModel()},selected:{kind:`int`,default:l,explicitNotify:!0,blurb:`The position of the selected item`,normalize:(e,t)=>{let n=t,r=i(`selected`,`int`,e);return n._state.count===0?(n._pendingSelected=r,n.selected):n._state.hasIndex(r)?r:n.selected},afterNotify:e=>e._applySelected()},"selected-item":{kind:`object`,valueType:m,explicitNotify:!0,blurb:`The selected item`,normalize:(e,t)=>t._state.selectedItem}}}){static GTypeName=`AdwComboRow`;static builderSlots=e([...s.builderSlots,`model`],`suffix`);_valueLabel;_chevron;_state=new d;_authored=f.new(null);_pendingSelected=null;_applyModel(){this._state.setModel(this.model);let e=this._pendingSelected;e!==null&&this._state.hasIndex(e)&&(this._pendingSelected=null,this._state.setSelectedIndex(e))}_applySelected(){this._state.setSelectedIndex(this.selected)}constructor(e){super(),this.className=`adw-row adw-action-row adw-combo-row`;let t=new _;t.orientation=`horizontal`,t.className=`adw-combo-suffix`;let i=new g;i.className=`adw-combo-value`,i.text=``;let a=new o;a.className=`adw-combo-chevron`,a.iconColor=`#9a9a9a`,a.pixelSize=16,a.iconName=y,t.addChild(i),t.addChild(a),this.add_suffix(t),this._valueLabel=i,this._chevron=a,this._state.subscribe(e=>{r(this,`selected`,e.selected),r(this,`selected-item`,this._state.selectedItem),this._valueLabel.text=e.label,this._syncChooser()}),this._state.subscribeNotify(e=>{r(this,e,this._valueOf(e)),this.notify(e)}),this.addEventListener(`tap`,()=>{this._openChooser()}),c(this),this._syncChooser(),n(this,e)}_valueOf(e){return e===`model`?this._state.model:e===`selected`?this._state.selectedIndex:this._state.selectedItem}_syncChooser(){this._chevron.visibility=this._state.presentsChooser?`visible`:`collapse`}async _openChooser(){if(!this._state.presentsChooser)return;let e=this._state.options.map(e=>e.label),t=await v({title:this.title||void 0,cancelButtonText:`Cancel`,actions:e});this._state.select(e.indexOf(t))}get options(){return this._state.options}set_model(e){this.model=e}get_model(){return this.model}_addChildFromBuilder(e,n){if(t(e,[`model`],`edge`)===`model`){this.model=n;return}super._addChildFromBuilder(e,n)}get_selected(){return this.selected}set_selected(e){this.selected=e}get selectedValue(){return this._state.selectedValue}set selectedValue(e){this._state.setSelectedValue(e)}get_selected_item(){return this.selectedItem}};export{AdwComboRow,u as ComboState,b as NOTIFY_SELECTED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{attachRowPressFeedback as r}from"./row-press.js";import{DATA_GRID_HEADER_CELL_CLASS as i,DATA_GRID_HEADER_ROW_CLASS as a,DATA_GRID_SECTION_CELL_CLASS as o,dataGridCellClass as s,dataGridItemSpec as c,dataGridRowClass as l,dataGridShapeKey as u,dataGridTracksKey as d}from"./data-grid-model.js";import{dataGridCellText as f,dataGridColumnClasses as p,dataGridRowInteractive as m,dataGridTracks as h,normalizeDataGridColumns as g,normalizeDataGridVariant as _}from"@gjsify/adwaita-core";import{GridLayout as v,ItemSpec as y,Label as b,StackLayout as x}from"@nativescript/core";const S=`row-activated`;var AdwDataGrid=class extends n(v){static GTypeName=`AdwDataGrid`;_columns=[];_dataRows=[];_interactive=!1;_header=null;_rowNodes=[];_trackKey=``;_shapeKey=``;constructor(e){super(),this.className=`adw-data-grid`,t(this,e)}get_columns(){return this._columns}set_columns(e){this._columns=g(e),this._render()}get_rows(){return this._dataRows}set_rows(e){this._dataRows=Array.isArray(e)?e.map(e=>({...e})):[],this._render()}get interactive(){return this._interactive}set interactive(t){let n=e(t,this.interactive);this._interactive=!!n,this._paint()}_render(){this._syncColumns(),this._syncNodes(),this._paint()}_syncColumns(){let e=h(this._columns),t=d(e);if(t!==this._trackKey){this._trackKey=t,this.removeColumns();for(let t of e){let e=c(t);this.addColumn(new y(e.value,e.type))}}}_syncNodes(){let e=this._columns.length,t=u(e,this._dataRows.length);if(t!==this._shapeKey){this._shapeKey=t;for(let e of[this._header,...this._rowNodes])if(e!==null){this.removeChild(e.background);for(let t of e.cells)this.removeChild(t)}this._header=null,this._rowNodes=[],this.removeRows(),e!==0&&(this.addRow(new y(1,`auto`)),this._header=this._buildRow(0,e,!1),this._rowNodes=this._dataRows.map((t,n)=>(this.addRow(new y(1,`auto`)),this._buildRow(n+1,e,!0))))}}_buildRow(e,t,n){let i=new x;v.setRow(i,e),v.setColumn(i,0),v.setColumnSpan(i,t),this.addChild(i),n&&(r(i),i.addEventListener(`tap`,()=>this._activate(e-1)));let a=[];for(let n=0;n<t;n++){let t=new b;t.textWrap=!1,v.setRow(t,e),v.setColumn(t,n),this.addChild(t),a.push(t)}return{background:i,cells:a}}_paint(){let e=this._header;e!==null&&(e.background.className=a,this._columns.forEach((t,n)=>{let r=e.cells[n];r!==void 0&&(r.className=`${p(t).join(` `)} ${i}`,r.text=t.label??t.key,this._showCell(r,1))}),this._dataRows.forEach((e,t)=>{let n=this._rowNodes[t];if(n===void 0)return;let r=_(e.variant),i=m(r,e.interactive,this._interactive);if(n.background.className=l(r,i),r===`section`){let t=this._columns[0]?.key??``;n.cells.forEach((n,r)=>{r===0?(n.className=o,n.text=f(e[t]),this._showCell(n,this._columns.length)):(n.text=``,n.visibility=`collapse`,v.setColumnSpan(n,1))});return}this._columns.forEach((t,i)=>{let a=n.cells[i];a!==void 0&&(a.className=s(p(t),r),a.text=f(e[t.key]),this._showCell(a,1))})}))}_showCell(e,t){e.visibility=`visible`,v.setColumnSpan(e,t)}_activate(e){let t=this._dataRows[e];if(t===void 0||!m(_(t.variant),t.interactive,this._interactive))return;let n={eventName:S,object:this,index:e,row:t};this.notify(n)}};export{AdwDataGrid,S as ROW_ACTIVATED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{xmlBoolean as t,xmlNumber as n}from"./xml-values.js";import{applyConstructProps as r}from"./construct-props.js";import{DEFAULT_DIALOG_PRESENTATION_MODE as i,dialogCardLayout as a,dialogPresentationMode as o,findDialogHost as s,surfaceSize as c}from"./window-state.js";import{AdwSingleChildBase as l}from"./single-child-base.js";import{GridLayout as u,ItemSpec as d}from"@nativescript/core";const f=`closed`,p=`close-attempt`,m=`adw-dialog`;var AdwDialog=class extends l{static GTypeName=`AdwDialog`;static builderSlots=e([`child`],`child`);_card;_title=``;_contentWidth=-1;_contentHeight=-1;_followsContentSize=!0;_canClose=!0;_presentationMode=i;_host=null;_available=null;constructor(e){super(),this._restyle(),this.visibility=`collapse`;let t=new u;t.className=`${m}-card`,t.addColumn(new d(1,`star`)),t.addRow(new d(1,`star`)),u.setColumn(t,0),u.setRow(t,0),this.addChild(t),this._card=t,this._layoutCard(),this.addEventListener(`layoutChanged`,()=>this._measureWindow()),r(this,e)}get _ownClass(){return m}_adopt(e){u.setColumn(e,0),u.setRow(e,0),this._card.addChild(e)}_release(e){this._card.removeChild(e)}get title(){return this._title}set title(e){this._title=e??``,this._card.accessibilityLabel=this._title===``?void 0:this._title}get contentWidth(){return this._contentWidth}set contentWidth(e){this._contentWidth=c(n(e,NaN),e,this._contentWidth,`contentWidth`),this._layoutCard()}get contentHeight(){return this._contentHeight}set contentHeight(e){this._contentHeight=c(n(e,NaN),e,this._contentHeight,`contentHeight`),this._layoutCard()}get followsContentSize(){return this._followsContentSize}set followsContentSize(e){this._followsContentSize=t(e,this._followsContentSize)}get canClose(){return this._canClose}set canClose(e){this._canClose=t(e,this._canClose)}get presentationMode(){return this._presentationMode}set presentationMode(e){this._presentationMode=o(e),this._layoutCard()}get open(){return this.visibility===`visible`}present(e){if(!this.open){if(this.parent===null||this.parent===void 0){let t=s(e??null);if(t===null)throw Error(`${this.constructor.name} has no window to appear in: pass a widget that sits inside an Adw.Window / Adw.ApplicationWindow to present(), or add the dialog to a layout first.`);t._hostDialog(this),this._host=t}this.visibility=`visible`}}close(){if(!this._canClose){this.notify({eventName:p,object:this});return}this.force_close()}force_close(){this.open&&(this.visibility=`collapse`,this._host!==null&&(this._host._unhostDialog(this),this._host=null),this.notify({eventName:f,object:this}))}_measureWindow(){let e=this.getActualSize?.();if(!e||e.width<=0||e.height<=0)return;let t=this._available;t!==null&&t.width===e.width&&t.height===e.height||(this._available={width:e.width,height:e.height},this._layoutCard())}_layoutCard(){let e=this._card,t=a(this._available,this._presentationMode,this._contentWidth,this._contentHeight);e.width=t.width,e.height=t.height,e.horizontalAlignment=t.sheet?`stretch`:`center`,e.verticalAlignment=t.sheet?`bottom`:`middle`}};export{m as ADW_DIALOG_CLASS,f as ADW_DIALOG_CLOSED,p as ADW_DIALOG_CLOSE_ATTEMPT,AdwDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{DEFAULT_ICON_PIXEL_SIZE as
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlNumber as e}from"./xml-values.js";import{DEFAULT_ICON_PIXEL_SIZE as t,gtkIconSizeNick as n,iconPixelSize as r,storedPixelSize as i}from"./gtk-icon-size.js";import{applyConstructProps as a}from"./construct-props.js";import{withSignals as o}from"./signals.js";import{onAdwaitaColorSchemeChanged as s,themeIconColor as c}from"./color-scheme.js";import{DEFAULT_ICON_COLOR as l}from"./icon-path.js";import{drawIcon as u,onIconsChanged as d}from"./icon-render.js";import{attachRowPressFeedback as f}from"./row-press.js";import{GridLayout as p,Image as m,ItemSpec as h}from"@nativescript/core";const g=t;var AdwImageButton=class extends o(p){static GTypeName=`AdwImageButton`;_image;_icon=``;_iconColor=c();_explicitColor=!1;_iconSize=`inherit`;_pixelSize=-1;_unsubScheme=null;_unsubIcons=null;constructor(e){super(),this.className=`adw-image-button`,this.addRow(new h(1,`star`)),this.addColumn(new h(1,`star`));let t=new m;t.className=`adw-image-button-icon`,t.stretch=`aspectFit`,t.width=this._renderedSize,t.height=this._renderedSize,t.horizontalAlignment=`center`,t.verticalAlignment=`middle`,this.addChild(t),this._image=t,f(this),this.addEventListener(`loaded`,()=>{this._syncThemeColor(),this._unsubScheme??=s(()=>this._syncThemeColor()),this._unsubIcons??=d(()=>this._render())}),this.addEventListener(`unloaded`,()=>{this._unsubScheme?.(),this._unsubScheme=null,this._unsubIcons?.(),this._unsubIcons=null}),a(this,e)}_syncThemeColor(){if(this._explicitColor)return;let e=c();e!==this._iconColor&&(this._iconColor=e,this._render())}get _renderedSize(){return r(this._iconSize,this._pixelSize)}_applySize(){let e=this._renderedSize;this._image.width=e,this._image.height=e,this._render()}_render(){u(this._image,this._icon,this._renderedSize,this._iconColor)}get iconName(){return this._icon}set iconName(e){this._icon=e??``,this._applySize()}get iconColor(){return this._iconColor}set iconColor(e){this._explicitColor=!0,this._iconColor=e||l,this._render()}get iconSize(){return this._iconSize}set iconSize(e){this._iconSize=n(e,this._iconSize),this._applySize()}get pixelSize(){return this._pixelSize}set pixelSize(t){this._pixelSize=i(e(t,this._pixelSize)),this._applySize()}get image(){return this._image}};export{AdwImageButton,g as DEFAULT_ICON_BUTTON_ICON_SIZE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{xmlBoolean as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{GridLayout as i,ItemSpec as a}from"@nativescript/core";var AdwNavigationPage=class extends r(i){static GTypeName=`AdwNavigationPage`;static builderSlots=e([`child`],`child`);_child=null;_tag=null;_title=``;_canPop=!0;_owner=null;constructor(e){super(),this.className=`adw-navigation-page`,this.addColumn(new a(1,`star`)),this.addRow(new a(1,`star`)),n(this,e)}set_child(e){this._child&&this.removeChild(this._child),this._child=e,e&&(i.setColumn(e,0),i.setRow(e,0),this.addChild(e))}get child(){return this._child}_addChildFromBuilder(e,t){this.set_child(t)}get tag(){return this._tag}set tag(e){this._tag=e,this._owner?.setPageTag(this,e)}get title(){return this._title}set title(e){this._title=e??``,this._owner?.setPageTitle(this,this._title)}get canPop(){return this._canPop}set canPop(e){this._canPop=t(e,this._canPop),this._owner?.setPageCanPop(this,this._canPop)}_setOwner(e){this._owner=e}};export{AdwNavigationPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{NsNavigationSplitViewState as n,splitViewColumns as r}from"./split-view-state.js";import{AdwSplitViewBase as i}from"./split-view-base.js";import{GridLayout as a}from"@nativescript/core";var o=class AdwNavigationSplitView extends i{static GTypeName=`AdwNavigationSplitView`;constructor(e){super(`adw-navigation-split-view`,`navigation`,new n({onCritical:e=>console.error(e),onDelegate:(e,t)=>{for(let n=this.parent;n;n=n.parent)if(n instanceof AdwNavigationSplitView)return(e===`push`?n.push(t):n.pop()).kind!==`not-found`;return!1}})),this._applyLayout(),t(this,e)}_applyLayout(){if(!this._state.collapsed){let e=r(this._state.sidebarPosition,this.textDirection);this._sidebar&&(this._sidebar.visibility=`visible`,this._sidebar.translateX=0,a.setColumn(this._sidebar,e.sidebar),a.setColumnSpan(this._sidebar,1),this._sidebar.width=this.sidebarWidth),this._content&&(this._content.visibility=`visible`,this._content.translateX=0,a.setColumn(this._content,e.content),a.setColumnSpan(this._content,1));return}let e=this._state.visiblePane;this._sidebar&&(this._sidebar.visibility=e===`sidebar`?`visible`:`collapse`,this._sidebar.translateX=0,a.setColumn(this._sidebar,0),a.setColumnSpan(this._sidebar,2),this._sidebar.width=`auto`),this._content&&(this._content.visibility=e===`content`?`visible`:`collapse`,this._content.translateX=0,a.setColumn(this._content,0),a.setColumnSpan(this._content,2))}_transitionSidebar(){if(!this._shouldAnimate()||!this._sidebar||!this._content){this._applyLayout();return}this._cancelPending();for(let e of[this._sidebar,this._content])a.setColumn(e,0),a.setColumnSpan(e,2);this._sidebar.width=`auto`;let e=this._paneWidth(),t=this._state.transition===`push`,n=this._state.visiblePane===`sidebar`?this._sidebar:this._content,r=n===this._sidebar?this._content:this._sidebar,i=t?e:-e,o=t?-e:e;n.visibility=`visible`,n.translateX=i,r.visibility=`visible`,r.translateX=0,this._track(n.animate({translate:{x:0,y:0},duration:200,curve:`easeOut`})),this._track(r.animate({translate:{x:o,y:0},duration:200,curve:`easeIn`})).then(()=>this._settleAfterSwap(n,r)).catch(()=>{})}_settleAfterSwap(e,t){(this._state.visiblePane===`sidebar`?this._sidebar:this._content)===e&&(t.visibility=`collapse`,t.translateX=0)}_paneWidth(){let e=this.getActualSize();return e&&e.width>0?e.width:1024}get sidebarTag(){return this._state.sidebarTag}set sidebarTag(e){this._state.setTag(`sidebar`,e)}get contentTag(){return this._state.contentTag}set contentTag(e){this._state.setTag(`content`,e)}push(e){return this._state.push(e)}pop(){return this._state.pop()}get showContent(){return this._state.showContent}set showContent(t){let n=e(t,this.showContent);this._state.showContent=n}};export{o as AdwNavigationSplitView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{AdwNavigationPage as r}from"./adw-navigation-page.js";import{NOTIFY_VISIBLE_PAGE as i,NsNavigationStack as a,POPPED as o,PUSHED as s,REPLACED as c,navigationPageClassName as l}from"./navigation-stack.js";import{describeNavigationDiagnostic as u}from"@gjsify/adwaita-core";import{GridLayout as d,ItemSpec as f}from"@nativescript/core";var AdwNavigationView=class extends n(d){static GTypeName=`AdwNavigationView`;_nav;constructor(e){super(),this.className=`adw-navigation-view`,this.addColumn(new f(1,`star`)),this.addRow(new f(1,`star`)),this._nav=new a({attachPage:e=>{e.className=l(e.className),d.setColumn(e,0),d.setRow(e,0),this.addChild(e)},detachPage:e=>this.removeChild(e),setPageVisibility:(e,t)=>{e.visibility=t},emit:e=>this._emitNavigation(e)},{onDiagnostic:e=>console.warn(`[AdwNavigationView] ${u(e)}`)}),t(this,e)}add(e,t=null,n={}){return this._nav.add(e,t,n)}_addChildFromBuilder(e,t){if(t instanceof r){this.add(t,t.tag,{title:t.title,canPop:t.canPop}),t._setOwner(this);return}this.add(t)}remove(e){return this._nav.remove(e)}push(e,t={}){return this._nav.push(e,t)}push_by_tag(e){return this._nav.pushByTag(e)}pop(){return this._nav.pop()}pop_to_page(e){return this._nav.popToPage(e)}pop_to_tag(e){return this._nav.popToTag(e)}replace(e){this._nav.replace(e)}replace_with_tags(e){this._nav.replaceWithTags(e)}find_page(e){return this._nav.findPage(e)}get_previous_page(e){return this._nav.getPreviousPage(e)}setPageTag(e,t){return this._nav.setTag(e,t)}setPageTitle(e,t){return this._nav.setTitle(e,t)}setPageCanPop(e,t){return this._nav.setCanPop(e,t)}canGoBack(){return this._nav.canGoBack()}backButtonTooltip(e){return this._nav.backButtonTooltip(e)}popFromShortcut(){return this._nav.popFromShortcut()}popFromEscape(){return this._nav.popFromEscape()}get visiblePage(){return this._nav.visiblePage}get visiblePageTag(){return this._nav.visiblePageTag}get_visible_page_tag(){return this._nav.visiblePageTag}get depth(){return this._nav.depth}get navigationStack(){return this._nav.stack}get pages(){return this._nav.pages}get animateTransitions(){return this._nav.animateTransitions}set animateTransitions(t){let n=e(t,this.animateTransitions);this._nav.setAnimateTransitions(n)}get popOnEscape(){return this._nav.popOnEscape}set popOnEscape(t){let n=e(t,this.popOnEscape);this._nav.setPopOnEscape(n)}_emitNavigation(e){let t={eventName:e.name,object:this,page:e.page,tag:e.tag,depth:e.depth};this.notify(t)}};export{AdwNavigationView,i as NOTIFY_VISIBLE_PAGE,o as POPPED,s as PUSHED,c as REPLACED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{NsOverlaySplitViewState as n,splitViewColumns as r}from"./split-view-state.js";import{AdwSplitViewBase as i}from"./split-view-base.js";import{GridLayout as a}from"@nativescript/core";var AdwOverlaySplitView=class extends i{static GTypeName=`AdwOverlaySplitView`;_scrim=null;constructor(e){super(`adw-overlay-split-view`,`overlay`,new n),this._applyLayout(),t(this,e)}get show_sidebar(){return this.showSidebar}set show_sidebar(t){this.showSidebar=e(t,this.showSidebar)}get_show_sidebar(){return this.showSidebar}set_show_sidebar(e){this.showSidebar=e}get pinSidebar(){return this._state.pinSidebar}set pinSidebar(t){let n=e(t,this.pinSidebar);this._state.setPinSidebar(!!n)}_applyLayout(){let e=r(this._state.sidebarPosition),t=this._state.sidebarPosition===`end`;if(!this._state.collapsed){this._detachScrim();let t=this._state.showSidebar;this._sidebar&&(this._sidebar.visibility=t?`visible`:`collapse`,this._sidebar.translateX=0,this._sidebar.opacity=1,a.setColumn(this._sidebar,e.sidebar),a.setColumnSpan(this._sidebar,1),this._sidebar.width=this.sidebarWidth,this._sidebar.className=this._paneClassName(this._sidebar.className,!1),this._sidebar.horizontalAlignment=`stretch`),this._content&&(this._content.visibility=`visible`,a.setColumn(this._content,t?e.content:0),a.setColumnSpan(this._content,t?1:2)),this._applyPaneFocus();return}this._content&&(this._content.visibility=`visible`,a.setColumn(this._content,0),a.setColumnSpan(this._content,2)),this._raiseOverlayChildren(),this._scrim&&(a.setColumn(this._scrim,0),a.setColumnSpan(this._scrim,2),this._scrim.visibility=this._state.shieldVisible?`visible`:`collapse`,this._scrim.opacity=+!!this._state.shieldVisible),this._sidebar&&(a.setColumn(this._sidebar,0),a.setColumnSpan(this._sidebar,2),this._sidebar.width=this.sidebarWidth,this._sidebar.horizontalAlignment=t?`right`:`left`,this._sidebar.className=this._paneClassName(this._sidebar.className,!0),this._sidebar.visibility=this._state.showSidebar?`visible`:`collapse`,this._sidebar.translateX=this._state.showSidebar?0:this._hiddenOffset(),this._sidebar.opacity=1),this._applyPaneFocus()}_transitionSidebar(){if(!this._state.collapsed||!this._shouldAnimate()){this._applyLayout();return}this._cancelPending(),this._prepareCollapsedStructure(),this._applyPaneFocus(),this._state.showSidebar?this._animateOpen():this._animateClose()}_applyPaneFocus(){this._sidebar&&(this._sidebar.isUserInteractionEnabled=this._state.sidebarFocusable),this._content&&(this._content.isUserInteractionEnabled=this._state.contentFocusable)}_ensureScrim(){if(this._scrim)return this._scrim;let e=new a;return e.className=`adw-overlay-scrim`,e.visibility=`collapse`,e.opacity=0,e.addEventListener(`tap`,()=>this.hideSidebarPane()),this._scrim=e,e}_raiseOverlayChildren(){let e=this._ensureScrim();this._isChild(e)&&this.removeChild(e);let t=this._sidebar;t&&this._isChild(t)&&this.removeChild(t),this.addChild(e),t&&this.addChild(t)}_detachScrim(){this._scrim&&this._isChild(this._scrim)&&this.removeChild(this._scrim)}_prepareCollapsedStructure(){let e=this._state.sidebarPosition===`end`;this._content&&(this._content.visibility=`visible`,a.setColumn(this._content,0),a.setColumnSpan(this._content,2)),this._raiseOverlayChildren(),this._scrim&&(a.setColumn(this._scrim,0),a.setColumnSpan(this._scrim,2)),this._sidebar&&(a.setColumn(this._sidebar,0),a.setColumnSpan(this._sidebar,2),this._sidebar.width=this.sidebarWidth,this._sidebar.horizontalAlignment=e?`right`:`left`,this._sidebar.className=this._paneClassName(this._sidebar.className,!0))}_animateOpen(){let e=this._scrim;e&&(e.visibility=`visible`,e.opacity=0,this._track(e.animate({opacity:1,duration:200,curve:`easeOut`})));let t=this._sidebar;t&&(t.visibility=`visible`,t.translateX=this._hiddenOffset(),t.opacity=1,this._track(t.animate({translate:{x:0,y:0},duration:200,curve:`easeOut`})))}_animateClose(){let e=this._scrim,t=this._sidebar,n=[];e&&n.push(this._track(e.animate({opacity:0,duration:200,curve:`easeIn`}))),t&&n.push(this._track(t.animate({translate:{x:this._hiddenOffset(),y:0},duration:200,curve:`easeIn`}))),Promise.all(n).then(()=>{this._state.showSidebar||(t&&(t.visibility=`collapse`),e&&(e.visibility=`collapse`))}).catch(()=>{})}_hiddenOffset(){let e=this.sidebarWidth;return this._state.sidebarPosition===`end`?e:-e}_paneClassName(e,t){return`${(e??``).split(/\s+/).filter(e=>e&&e!==`adw-overlay-active`&&e!==`adw-split-view-sidebar`).join(` `)} adw-split-view-sidebar${t?` adw-overlay-active`:``}`.trim()}};export{AdwOverlaySplitView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{AdwImageButton as n}from"./adw-image-button.js";import{NS_PASSWORD_ENTRY_ROW_CLASS as r,applyPasswordEntryRowState as i}from"./entry-row-view.js";import{AdwEntryRow as a}from"./adw-entry-row.js";import{PasswordEntryRowState as o,PasswordEntryRowState as s}from"@gjsify/adwaita-core";import{dialogWarningSymbolic as c}from"@gjsify/adwaita-icons/status";const l=`notify::revealed`;var AdwPasswordEntryRow=class extends a{static GTypeName=`AdwPasswordEntryRow`;_password=new s(this);_peekButton;constructor(e){super(),this._field.className=`adw-entry-field adw-password-field`;let r=new n;r.className=`${r.className} adw-password-peek`.trim(),r.addEventListener(`tap`,()=>this._password.togglePeek()),this.add_suffix(r),this._peekButton=r,this.setIndicatorIcon(c),this._renderPassword(this._password.state),this._password.subscribe(e=>{this._renderPassword(e);let t={eventName:l,object:this,revealed:e.revealed};this.notify(t)}),t(this,e)}get revealed(){return this._password.revealed}set revealed(t){this._password.setRevealed(e(t,!1))}get peeking(){return this._password.revealed}set peeking(t){this._password.setRevealed(e(t,!1))}togglePeek(){return this._password.togglePeek()}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}get _baseClassName(){return r}_renderPassword(e){i({field:this._field,peekButton:this._peekButton},e)}};export{AdwPasswordEntryRow,l as NOTIFY_REVEALED,o as PasswordEntryRowState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{ADW_DIALOG_CLOSED as n,AdwDialog as r}from"./adw-dialog.js";import{AdwImageButton as i}from"./adw-image-button.js";import{searchNsPreferences as a}from"./preferences-search.js";import{GridLayout as o,ItemSpec as s,Label as c}from"@nativescript/core";import{windowCloseSymbolic as l}from"@gjsify/adwaita-icons/ui";const u=n;var AdwPreferencesDialog=class extends r{static GTypeName=`AdwPreferencesDialog`;_headerBox;_titleLabel;_body;constructor(e){super(),this._card.className=`adw-preferences-dialog-card`;let n=new o;n.addColumn(new s(1,`star`)),n.addRow(new s(1,`auto`)),n.addRow(new s(1,`star`));let r=new o;r.className=`adw-preferences-dialog-header`,r.addColumn(new s(1,`star`)),r.addColumn(new s(1,`auto`)),r.addRow(new s(1,`auto`)),o.setRow(r,0),n.addChild(r),this._headerBox=r;let a=new c;a.className=`adw-preferences-dialog-title`,o.setColumn(a,0),r.addChild(a),this._titleLabel=a;let u=new i;u.iconName=l,u.className=`${u.className} adw-preferences-dialog-close`.trim(),u.addEventListener(`tap`,()=>this.close()),o.setColumn(u,1),r.addChild(u);let d=new o;d.className=`adw-preferences-dialog-body`,d.addColumn(new s(1,`star`)),o.setRow(d,1),n.addChild(d),this._body=d,this.child=n,this.title=`Preferences`,this.contentWidth=640,t(this,e)}get _ownClass(){return`adw-preferences-dialog`}get title(){return super.title}set title(e){super.title=e,this._titleLabel.text=super.title}add(e){this._body.addChild(e),this._layoutBody()}_addChildFromBuilder(e,t){this.add(t)}remove(e){this._body.removeChild(e),this._layoutBody()}get searchPages(){let e=[],t=this._body.getChildrenCount();for(let n=0;n<t;n++){let t=this._body.getChildAt(n);typeof t.searchGroups==`function`&&e.push(t)}return e}search(e,t){return a(this.searchPages,e,t)}get open(){return super.open}set open(t){e(t,!1)?this.present():this.close()}get body(){return this._body}_layoutBody(){let e=this._body;e.removeRows();let t=e.getChildrenCount();for(let n=0;n<t;n++)e.addRow(new s(1,`star`)),o.setRow(e.getChildAt(n),n)}};export{AdwPreferencesDialog,u as CLOSED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{StyleClassList as r}from"./style-classes.js";import{ScrollView as i,StackLayout as a}from"@nativescript/core";var AdwPreferencesPage=class extends n(i){static GTypeName=`AdwPreferencesPage`;_groups;_title=``;_name=``;_iconName=``;_useUnderline=!1;_classList=new r(`adw-preferences-page`);constructor(e){super(),this.orientation=`vertical`,this._restyle();let n=new a;n.orientation=`vertical`,n.className=`adw-preferences-page-content`,this.content=n,this._groups=n,t(this,e)}get title(){return this._title}set title(e){this._title=e??``}get name(){return this._name}set name(e){this._name=e??``}get iconName(){return this._iconName}set iconName(e){this._iconName=e??``}get useUnderline(){return this._useUnderline}set useUnderline(t){this._useUnderline=e(t,!1)}add(e){this._groups.addChild(e)}remove(e){this._groups.removeChild(e)}_addChildFromBuilder(e,t){this.add(t)}searchGroups(){let e=[],t=this._groups.getChildrenCount();for(let n=0;n<t;n++){let t=this._groups.getChildAt(n);typeof t.searchRows==`function`&&e.push(t)}return e}get groups(){return this._groups}get styleClasses(){return this._classList.classes}set styleClasses(e){this._classList.replace(e),this._restyle()}add_css_class(e){this._classList.add(e),this._restyle()}remove_css_class(e){this._classList.remove(e),this._restyle()}has_css_class(e){return this._classList.has(e)}get_css_classes(){return this._classList.classes}set_css_classes(e){this._classList.replaceAll(e),this._restyle()}_restyle(){this.className=this._classList.className}};export{AdwPreferencesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlNumber as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{attachRowPressFeedback as r}from"./row-press.js";import{AdwSidebarSection as i}from"../values/sidebar.js";import{SidebarState as a,sidebarRowClassName as o,sidebarSectionsFromLabels as s}from"./sidebar-model.js";import{GridLayout as c,ItemSpec as l,Label as u,ScrollView as d,StackLayout as f}from"@nativescript/core";const p=`notify::selected`,m=`activated`;var AdwSidebar=class extends n(d){static GTypeName=`AdwSidebar`;_list;_state=new a;_pendingSelected=null;_rows=[];constructor(e){super(),this.orientation=`vertical`,this.className=`adw-sidebar`;let n=new f;n.orientation=`vertical`,n.className=`adw-sidebar-list`,this.content=n,this._list=n,this._state.subscribe(e=>{this._applySelection();let t={eventName:p,object:this,selected:e.selected,title:e.item?.title??``,previous:e.previous,interactive:e.interactive};this.notify(t)}),t(this,e)}_addChildFromBuilder(e,t){if(!(t instanceof i))throw Error(`Adw.Sidebar takes only Adw.SidebarSection children, not \`${t.constructor.name}\`.`);this.setSections([...this._state.sections,t])}setItems(e){this.setSections(s(Array.isArray(e)?e:[]))}setSections(e){for(let t of e)t instanceof i&&t._bindOwner(()=>this.setSections(this._state.sections));if(this._state.setSections(e),this._pendingSelected!==null&&this._pendingSelected<this._state.items.length){let e=this._pendingSelected;this._pendingSelected=null,this._state.setSelected(e)}this._rebuild()}_rebuild(){for(let e of this._rows)this._list.removeChild(e.view);this._rows.length=0;for(let e of this._state.visibleItems){let t=new c;t.className=`adw-sidebar-row`,t.addColumn(new l(1,`star`)),t.addRow(new l(1,`auto`));let n=new u;n.className=`adw-sidebar-row-title`,n.text=e.item.title,n.textWrap=!0,c.setColumn(n,0),t.addChild(n),e.item.visible===!1&&(t.visibility=`collapse`),e.item.enabled===!1&&(t.opacity=.5),t.addEventListener(`tap`,()=>this._activate(e.index)),r(t),this._list.addChild(t),this._rows.push({view:t,index:e.index})}this._applySelection()}_activate(e){if(!this._state.activate(e).activated)return;let t={eventName:m,object:this,index:e,title:this._state.itemAt(e)?.title??``};this.notify(t)}_applySelection(){let e=this._state.selected,t=this._state.selectionVisible;for(let n of this._rows)n.view.className=o(n.index===e,t)}get items(){return this._state.items.map(e=>e.item.title)}set items(e){this.setItems(e)}get sections(){return this._state.sections}set sections(e){this.setSections(e)}get selected(){return this._state.selected}set selected(t){let n=e(t,this.selected);if(this._state.items.length===0){this._pendingSelected=n;return}this._state.setSelected(n)}get selectedItem(){return this._state.selectedItem}get mode(){return this._state.mode}set mode(e){this._state.setMode(e)&&this._applySelection()}get filter(){return this._state.filter}set filter(e){this._state.setFilter(e),this._rebuild()}get isEmpty(){return this._state.isEmpty}};export{m as ACTIVATED,AdwSidebar,p as NOTIFY_SELECTED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlNumber as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{SpinState as r,parseAdjustment as i,snapAdjustmentValue as a}from"@gjsify/adwaita-core";import{GridLayout as o,ItemSpec as s,Label as c,Slider as l,StackLayout as u}from"@nativescript/core";const d=`notify::value`;var AdwSliderRow=class extends n(u){static GTypeName=`AdwSliderRow`;_titleLabel;_valueLabel;_slider;_state=new r;_suppress=!1;constructor(e){super(),this.orientation=`vertical`,this.className=`adw-slider-row`;let n=new o;n.className=`adw-slider-header`,n.addRow(new s(1,`auto`)),n.addColumn(new s(1,`star`)),n.addColumn(new s(1,`auto`));let r=new c;r.className=`adw-slider-title`,r.textWrap=!1,o.setColumn(r,0),n.addChild(r);let i=new c;i.className=`adw-slider-value`,i.text=String(this._state.value),o.setColumn(i,1),n.addChild(i);let u=this._state.adjustment,f=new l;f.className=`adw-slider`,f.minValue=u.lower,f.maxValue=u.upper,f.value=u.value,this.addChild(n),this.addChild(f),this._titleLabel=r,this._valueLabel=i,this._slider=f,this._state.subscribe(e=>{if(this._valueLabel.text=String(e.value),e.interactive){let t={eventName:d,object:this,value:e.value};this.notify(t)}else this._sync()}),this._state.subscribeChanged(e=>{this._slider.minValue=e.lower,this._slider.maxValue=e.upper;let t=a(e,this._state.value);t===this._state.value?this._sync():this._state.setValue(t)}),f.addEventListener(`valueChange`,()=>{if(this._suppress)return;let e=a(this._state.adjustment,this._slider.value);e!==this._slider.value&&(this._suppress=!0,this._slider.value=e,this._suppress=!1),this._state.setValueInteractive(e)}),t(this,e)}_sync(){this._suppress=!0,this._slider.value=this._state.value,this._suppress=!1,this._valueLabel.text=String(this._state.value)}get title(){return this._titleLabel.text??``}set title(e){this._titleLabel.text=e??``}get value(){return this._state.value}set value(t){this._state.setValue(a(this._state.adjustment,e(t,this.value)))}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?i(e):e)}get slider(){return this._slider}};export{AdwSliderRow,d as NOTIFY_SLIDER_VALUE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{xmlNumber as n}from"./xml-values.js";import{applyConstructProps as r}from"./construct-props.js";import{AdwActionRow as i}from"./adw-action-row.js";import{AdwImageButton as a}from"./adw-image-button.js";import{SpinState as o,SpinState as s,parseAdjustment as c}from"@gjsify/adwaita-core";import{Label as l,StackLayout as u}from"@nativescript/core";import{valueDecreaseSymbolic as d,valueIncreaseSymbolic as f}from"@gjsify/adwaita-icons/actions";const p=`notify::value`;var AdwSpinRow=class extends i{static GTypeName=`AdwSpinRow`;static builderSlots=e([...i.builderSlots,`adjustment`],`suffix`);_minusButton;_plusButton;_valueLabel;_state=new s;constructor(e){super(),this.className=`adw-row adw-action-row adw-spin-row`;let t=new u;t.orientation=`horizontal`,t.className=`adw-spin-control`;let n=new l;n.className=`adw-spin-value`,n.text=String(this._state.value);let i=new a;i.iconName=d,i.className=`${i.className} adw-spin-button adw-spin-minus`.trim();let o=new a;o.iconName=f,o.className=`${o.className} adw-spin-button adw-spin-plus`.trim(),t.addChild(n),t.addChild(i),t.addChild(o),this.add_suffix(t),this._minusButton=i,this._plusButton=o,this._valueLabel=n,this._state.subscribe(e=>{if(this._valueLabel.text=String(e.value),e.interactive){let t={eventName:p,object:this,value:e.value};this.notify(t)}}),i.addEventListener(`tap`,()=>this._state.decrement()),o.addEventListener(`tap`,()=>this._state.increment()),r(this,e)}_addChildFromBuilder(e,n){if(t(e,[`adjustment`],`edge`)===`adjustment`){this.adjustment=n;return}super._addChildFromBuilder(e,n)}get value(){return this._state.value}set value(e){this._state.setValue(n(e,this._state.value))}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?c(e):e)}};export{AdwSpinRow,p as NOTIFY_VALUE,o as SpinState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{GtkImage as r}from"./gtk-image.js";import{attachRowPressFeedback as i}from"./row-press.js";import{buttonContentClassName as a,buttonContentLabelText as o}from"./button-content.js";import{assertPopupMenuAssignable as s,refuseMenuString as c}from"./popup-menu.js";import{showMenuPopup as l}from"./popup-menu-view.js";import{splitButtonArrowSvg as u}from"./split-button.js";import{ArrowType as d}from"./gtk-enums.js";import{SPLIT_BUTTON_DISABLED_OPACITY as f,SplitButtonState as p}from"@gjsify/adwaita-core";import{GridLayout as m,ItemSpec as h,Label as g,StackLayout as _}from"@nativescript/core";const v=`notify::direction`,y=`menuTapped`,clearOtherSlot=(e,t)=>{if(!(e._contentGate||e[t]===null)){e._contentGate=!0;try{e[t]=null}finally{e._contentGate=!1}}};var AdwSplitButton=class extends n(m,{GTypeName:`AdwSplitButton`,Signals:{clicked:{},activate:{}},Properties:{label:{kind:`string`,default:null,blurb:`The label to show in the button`,normalize:(e,t)=>{let n=t;return n._contentGate?null:e==null?n.label:String(e)},afterNotify:e=>clearOtherSlot(e,`iconName`)},"icon-name":{kind:`string`,default:null,blurb:`The name of the icon used to automatically populate the button`,normalize:(e,t)=>{let n=t;return n._contentGate?null:e==null?n.iconName:String(e)===``?null:String(e)},changed:(e,t,n)=>e!==t||n===``,afterNotify:e=>clearOtherSlot(e,`label`)},"use-underline":{kind:`boolean`,default:!1,blurb:`Whether an underline in the text indicates a mnemonic`},"can-shrink":{kind:`boolean`,default:!1,blurb:`Whether the button can be smaller than the natural size of its contents`},"dropdown-tooltip":{kind:`string`,default:``,blurb:`The tooltip of the dropdown button`}}}){static GTypeName=`AdwSplitButton`;static emittedSignals=[v];_actionPart;_actionLabel;_actionIcon;_dropdownPart;_chevron;_state=new p;_actions=null;_showingIcon=!1;_sensitive=!0;_contentGate=!1;constructor(e){super(),this.className=`adw-split-button`,this.addColumn(new h(1,`auto`)),this.addColumn(new h(1,`auto`)),this.addRow(new h(1,`auto`));let n=new _;n.orientation=`horizontal`,n.className=`adw-split-button-action`,n.horizontalAlignment=`center`,m.setColumn(n,0);let o=new g;o.className=`adw-split-button-label`,o.verticalAlignment=`middle`,n.addChild(o);let s=new r;s.className=`${s.className} adw-split-button-action-icon`.trim(),s.verticalAlignment=`middle`,this.addChild(n),this._actionPart=n,this._actionLabel=o,this._actionIcon=s;let c=new m;c.className=`adw-split-button-dropdown`,c.addColumn(new h(1,`star`)),c.addRow(new h(1,`star`)),m.setColumn(c,1);let l=new r;l.className=`${l.className} adw-split-button-chevron`.trim(),l.iconName=u(this._state.direction),l.horizontalAlignment=`center`,l.verticalAlignment=`middle`,c.addChild(l),this.addChild(c),this._dropdownPart=c,this._chevron=l,n.addEventListener(`tap`,()=>this._click()),this.connect(`activate`,e=>e._click()),c.addEventListener(`tap`,()=>{this._openMenu()}),i(n),i(c),this.connect(`notify::label`,e=>e._renderContent()),this.connect(`notify::icon-name`,e=>e._renderContent()),this.connect(`notify::use-underline`,e=>e._renderContent()),this.connect(`notify::can-shrink`,e=>{e._actionLabel.className=a(e._actionLabel.className,e.canShrink)}),this._state.subscribe(()=>this._render()),this._render(),t(this,e)}_openMenu(){if(!(!this._sensitive||this._state.open||!this._state.dropdownEnabled)){this._state.toggleMenu();try{l(this._dropdownPart,{model:this._state.menuModel??[],actions:this._actions,onActivated:(e,t)=>{let n=this._state.activateMenuItem(t);if(n===null)return;let r={eventName:y,object:this,item:n.label,id:n.id??n.label,path:t,action:n.action};this.notify(r)},onDismiss:()=>this._state.closeMenu()})}catch(e){throw this._state.closeMenu(),e}}}_click(){this._sensitive&&this.emit(`clicked`)}_renderContent(){let e=this.iconName!==null;e?this._actionIcon.iconName=this.iconName??``:this._actionLabel.text=o(this.label??``,this.useUnderline),e!==this._showingIcon&&(this._actionPart.removeChild(this._showingIcon?this._actionIcon:this._actionLabel),this._actionPart.addChild(e?this._actionIcon:this._actionLabel),this._showingIcon=e)}_render(){let{direction:e,dropdownEnabled:t}=this._state;this._chevron.iconName=u(e),this._dropdownPart.opacity=t?1:f,this.opacity=this._sensitive?1:f}get menuModel(){return this._state.menuModel??[]}set menuModel(e){c(e,`AdwSplitButton`),this._state.setMenuModel(e),s(this._state.menuModel??[])}get actions(){return this._actions}set actions(e){this._actions=e??null}get_direction(){return d[this._state.direction.toUpperCase()]}set_direction(e){let t=e,n=typeof t==`number`?t:/^\d+$/.test(String(t))?Number(t):d[String(t).toUpperCase()],r=Object.keys(d).find(e=>d[e]===n)?.toLowerCase();if(r===void 0)throw TypeError(`${String(t)} is not a valid value for enum argument direction (Gtk.ArrowType)`);this._state.setDirection(r)&&this.notify({eventName:v,object:this,value:this.get_direction()})}get sensitive(){return this._sensitive}set sensitive(t){let n=!!e(t,this._sensitive);n!==this._sensitive&&(this._sensitive=n,this._render())}get actionButton(){return this._actionPart}};export{AdwSplitButton,y as MENU_TAPPED,v as NOTIFY_DIRECTION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{GtkImage as r}from"./gtk-image.js";import{attachRowPressFeedback as i}from"./row-press.js";import{AdwImageButton as a}from"./adw-image-button.js";import{AdwTabPage as o}from"../values/tab-page.js";import{applyTabViewVisibility as s,createTabViewState as c,tabBarVisibility as l,tabCloseVisibilities as u,tabLabelText as d,tabViewNotifyPayload as f}from"./tab-view-state.js";import{tabIconState as p}from"@gjsify/adwaita-core";import{GridLayout as m,ItemSpec as h,Label as g,StackLayout as _}from"@nativescript/core";import{windowCloseSymbolic as v}from"@gjsify/adwaita-icons/ui";const pageHandle=e=>typeof e==`string`?e:e.id,y=`notify::selected-page`,b=`pages-changed`,x=`close-page`;var AdwTabView=class extends n(m){static GTypeName=`AdwTabView`;_state=c({onClosePage:e=>this._requestClose(e)});_bar;_contentArea;_chips=new Map;_autohide=!1;_defaultIcon=null;_generatedIds=0;closeHandler=null;constructor(e){super(),this.className=`adw-tab-view`,this.addColumn(new h(1,`star`)),this.addRow(new h(1,`auto`)),this.addRow(new h(1,`star`));let n=new _;n.orientation=`horizontal`,n.horizontalAlignment=`stretch`,n.className=`adw-tab-view-bar`,m.setRow(n,0),this.addChild(n),this._bar=n;let r=new m;r.addColumn(new h(1,`star`)),r.addRow(new h(1,`star`)),m.setRow(r,1),this.addChild(r),this._contentArea=r,this._state.subscribePages(e=>this._onPagesChange(e)),this._state.subscribe(e=>{this._applySelection();let t={eventName:y,object:this,...f(e)};this.notify(t)}),t(this,e)}get pages(){return this._state.pages}get nPages(){return this._state.nPages}get nPinnedPages(){return this._state.nPinnedPages}get selectedId(){return this._state.selectedId}get selectedIndex(){return this._state.selectedIndex}get selectedPage(){return this._state.selectedPage}set selectedPage(e){this._state.setSelectedPage(e)}isClosing(e){return this._state.isClosing(e)}set_selected_page(e){return this._state.setSelectedPage(e)}selectNthPage(e){return this._state.selectNthPage(e)}select_previous_page(){return this._state.selectPreviousPage()}select_next_page(){return this._state.selectNextPage()}selectFirstPage(){return this._state.selectFirstPage()}selectLastPage(){return this._state.selectLastPage()}cycleNextPage(){return this._state.cycleNextPage()}cyclePreviousPage(){return this._state.cyclePreviousPage()}add_page(e,t=null){return this._state.addPage(e,t===null?null:pageHandle(t))}insert(e,t){return this._state.insertPage(e,t)}prepend(e){return this._state.prependPage(e)}append(e){return this._state.appendPage(e)}insert_pinned(e,t){return this._state.insertPinnedPage(e,t)}prepend_pinned(e){return this._state.prependPinnedPage(e)}append_pinned(e){return this._state.appendPinnedPage(e)}set_page_pinned(e,t){return this._state.setPagePinned(pageHandle(e),t)}close_page(e){return this._state.closePage(pageHandle(e))}close_page_finish(e,t){return this._state.closePageFinish(pageHandle(e),t)}close_other_pages(e){this._state.closeOtherPages(pageHandle(e))}close_pages_before(e){this._state.closePagesBefore(pageHandle(e))}close_pages_after(e){this._state.closePagesAfter(pageHandle(e))}detachPage(e){return this._state.detachPage(e)}reorder_page(e,t){return this._state.reorderPage(pageHandle(e),t)}reorder_backward(e){return this._state.reorderBackward(pageHandle(e))}reorder_forward(e){return this._state.reorderForward(pageHandle(e))}reorder_first(e){return this._state.reorderFirst(pageHandle(e))}reorder_last(e){return this._state.reorderLast(pageHandle(e))}setPageTitle(e,t){return this._state.setPageTitle(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageLoading(e,t){return this._state.setPageLoading(e,t)}setPageNeedsAttention(e,t){return this._state.setPageNeedsAttention(e,t)}get diagnostics(){return this._state.diagnostics}get autohide(){return this._autohide}set autohide(t){let n=e(t,this.autohide);this._autohide=!!n,this._applyBarVisibility()}get defaultIcon(){return this._defaultIcon}set defaultIcon(e){this._defaultIcon=e;for(let e of this._state.pages)this._refreshChip(e.id)}_addChildFromBuilder(e,t){if(t instanceof o){if(t.child===null)throw Error(`Adw.TabPage has no child: a tab page is a page around one.`);this._state.appendPage({id:this._nextId(),title:t.title,content:t.child});return}this._state.appendPage({id:this._nextId(),content:t})}setViews(e){for(let e of this._state.pages)this._state.detachPage(e.id);for(let t of e)this._state.appendPage({id:this._nextId(),title:t.title,icon:t.icon??null,content:t.content})}get views(){return this._state.pages.map(e=>({title:e.title,content:e.content,icon:e.icon??void 0}))}set views(e){this.setViews(Array.isArray(e)?e:[])}get tabs(){return this.views}set tabs(e){this.views=e}_onPagesChange(e){switch(e.kind){case`attached`:{let t=this._state.getPage(e.id);t&&this._insertChip(t,e.position);break}case`detached`:{let t=this._chips.get(e.id);t&&this._bar.removeChild(t.button),this._chips.delete(e.id);break}case`reordered`:case`pinned`:{let t=this._chips.get(e.id);t&&(this._bar.removeChild(t.button),this._bar.insertChild(t.button,e.position)),this._refreshChip(e.id);break}case`updated`:this._refreshChip(e.id);break}this._applyBarVisibility(),this._applySelection();let t={eventName:b,object:this,...e};this.notify(t)}_insertChip(e,t){let n=new _;n.orientation=`horizontal`,n.className=`adw-tab-view-tab`,n.verticalAlignment=`middle`;let o=new r;o.className=`${o.className} adw-tab-view-tab-icon`.trim(),o.verticalAlignment=`middle`,n.addChild(o);let s=new r;s.className=`${s.className} adw-tab-view-tab-icon`.trim(),s.verticalAlignment=`middle`,n.addChild(s);let c=new g;c.className=`adw-tab-view-tab-label`,c.verticalAlignment=`middle`,n.addChild(c);let l=new a;l.className=`${l.className} adw-tab-close`.trim(),l.iconName=v,l.pixelSize=12,l.verticalAlignment=`middle`,l.addEventListener(`tap`,()=>this._state.closePage(e.id)),n.addChild(l),i(n),n.addEventListener(`tap`,()=>this._state.setSelectedPage(e.id)),this._bar.insertChild(n,t),this._chips.set(e.id,{button:n,icon:o,indicator:s,label:c,close:l});let u=e.content;u&&(m.setColumn(u,0),m.setRow(u,0),this._contentArea.addChild(u)),this._refreshChip(e.id)}_refreshChip(e){let t=this._state.getPage(e),n=this._chips.get(e);if(!t||!n)return;n.label.text=d(t),n.label.visibility=t.pinned?`collapse`:`visible`;let r=p(t,this._defaultIcon);n.icon.iconName=r.icon??``,n.icon.visibility=r.iconVisible&&r.icon!==null?`visible`:`collapse`,n.indicator.iconName=t.indicatorIcon??``,n.indicator.visibility=r.indicatorVisible?`visible`:`collapse`}_applySelection(){s(this._state);let e=u(this._state),t=this._state.selectedId;this._state.pages.forEach((n,r)=>{let i=this._chips.get(n.id);i&&(i.button.className=n.id===t?`adw-tab-view-tab active`:`adw-tab-view-tab`,i.close.visibility=e[r])})}_applyBarVisibility(){this._bar.visibility=l(this._state,this._autohide)}_requestClose(e){let t={eventName:x,object:this,id:e.id,index:this._state.getPagePosition(e.id)};return this.notify(t),this.closeHandler?this.closeHandler(e):!e.pinned}_nextId(){return this._generatedIds+=1,`tab-${this._generatedIds}`}};export{AdwTabView,x as CLOSE_PAGE,y as NOTIFY_SELECTED_PAGE,b as PAGES_CHANGED};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlNumber as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{GtkImage as r}from"./gtk-image.js";import{AdwToggle as i}from"./adw-toggle.js";import{ToggleGroupState as a,ToggleGroupState as o,keptToggles as s,toggleIndexOfName as c}from"@gjsify/adwaita-core";import{Label as l,StackLayout as u}from"@nativescript/core";const d=`notify::selected`;var AdwToggleGroup=class extends n(u){static GTypeName=`AdwToggleGroup`;_toggles=[];_pendingActive=null;_pendingActiveName=null;_segments=[];_state=new o;constructor(e){super(),this.orientation=`horizontal`,this.className=`adw-toggle-group`,this.horizontalAlignment=`center`,this._state.subscribe(e=>{this._applySelection();let t={eventName:d,object:this,selected:e.selected,value:e.value};this.notify(t)}),t(this,e)}get options(){return this._toggles.map(e=>e.label)}set options(e){this.setToggles((Array.isArray(e)?e:[]).map(e=>({label:e})))}setToggles(e){this._rebuild(e),this._applyPending(!1)}_rebuild(e){for(let e of this._segments)this.removeChild(e);this._segments.length=0,this._toggles=s(Array.isArray(e)?e:[]),this._toggles.forEach((e,t)=>{let n=new u;if(n.orientation=`horizontal`,n.className=`adw-toggle-button`,n.horizontalAlignment=`center`,e.icon){let t=new r;t.className=`${t.className} adw-toggle-icon`.trim(),t.verticalAlignment=`middle`,t.iconName=e.icon,n.addChild(t)}let i=new l;i.text=e.label,i.className=`adw-toggle-label`,i.verticalAlignment=`middle`,n.addChild(i),n.addEventListener(`tap`,()=>{this._state.setSelected(t)}),this.addChild(n),this._segments.push(n)}),this._state.setLabels(this._toggles.map(e=>e.label)),this._applySelection()}_addChildFromBuilder(e,t){if(!(t instanceof i))throw Error(`Adw.ToggleGroup takes only Adw.Toggle children, not \`${t.constructor.name}\`.`);let n=this._toggles.length;this._rebuild([...this._toggles,{label:t.label,icon:t.iconName??void 0,name:t.name===``?null:t.name}]),this._toggles.length===n&&console.warn(`[AdwToggleGroup] a toggle named '${t.name}' already exists; this one is not added`),this._applyPending(!0)}_applyPending(e){if(this._pendingActive!==null&&this._pendingActive<this._toggles.length){let e=this._pendingActive;this._pendingActive=null,this._state.setSelected(e)}if(this._pendingActiveName!==null){let t=c(this._toggles.map(e=>e.name),this._pendingActiveName);e||(this._pendingActiveName=null),t!==-1&&this._state.setSelected(t)}}_applySelection(){let e=this._state.selected;this._segments.forEach((t,n)=>{t.className=n===e?`adw-toggle-button active`:`adw-toggle-button`})}get active(){return this._state.selected}set active(t){let n=e(t,this.active);if(n>=this._toggles.length){this._pendingActive=n;return}this._state.setSelected(n)}get activeName(){return this._toggles[this.active]?.name??null}set activeName(e){this._pendingActiveName=e,this._applyPending(!0)}get selectedValue(){return this._state.selectedValue}};export{AdwToggleGroup,d as NOTIFY_SELECTED,a as ToggleGroupState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{xmlBoolean as n}from"./xml-values.js";import{applyConstructProps as r}from"./construct-props.js";import{withSignals as i}from"./signals.js";import{defaultToolbarViewProps as a,toolbarViewClassNames as o}from"./chrome.js";import{NO_INSETS as s,insetsOwedBy as c,toolbarViewInsetPadding as l,withKeyboard as u}from"./window-insets.js";import{resolveHostInsets as d}from"./host-insets.js";import{observeWindowInsets as f}from"./window-insets-source.js";import{observeSystemBars as p}from"./system-bars-source.js";import{insetsForEdges as m,resolveEdges as h,systemBarsConfig as g}from"./system-bars.js";import{GridLayout as _,ItemSpec as v,StackLayout as y}from"@nativescript/core";const b={view:`adw-toolbar-view`,topBar:`adw-toolbar-view-top`,bottomBar:`adw-toolbar-view-bottom`},x=[`topBar`,`bottomBar`,`content`,`top`,`bottom`];var AdwToolbarView=class extends i(_){static GTypeName=`AdwToolbarView`;static builderSlots=e(x,`content`);_topBox;_bottomBox;_content=null;_props=a();_insets=s;_topBarCount=0;_bottomBarCount=0;_bottomBarShown=!1;_detachInsets=null;_detachBars=null;_detachConfig=null;_systemInsets=null;constructor(e){super(),this.className=b.view,this.addColumn(new v(1,`star`)),this.addRow(new v(1,`auto`)),this.addRow(new v(1,`star`)),this.addRow(new v(1,`auto`));let t=new y;t.orientation=`vertical`,t.className=b.topBar,_.setRow(t,0),this.addChild(t),this._topBox=t;let n=new y;n.orientation=`vertical`,n.className=b.bottomBar,_.setRow(n,2),this.addChild(n),this._bottomBox=n,this.addEventListener(`layoutChanged`,()=>this._syncClasses()),n.addEventListener(`layoutChanged`,()=>{this._bottomBarCount>0&&this._hasShownBottomBar()!==this._bottomBarShown&&this._applyInsets(this._insets)}),this.addEventListener(`loaded`,()=>{this._detachInsets??=f(e=>this._applyInsets(e)),this._detachBars??=p(),this._detachConfig??=g.subscribe(()=>this._applyInsets(this._insets))}),this.addEventListener(`unloaded`,()=>{this._detachInsets?.(),this._detachInsets=null,this._detachBars?.(),this._detachBars=null,this._detachConfig?.(),this._detachConfig=null}),r(this,e)}add_top_bar(e){this._topBox.addChild(e),this._topBarCount+=1,this._applyInsets(this._insets)}add_bottom_bar(e){this._bottomBox.addChild(e),this._bottomBarCount+=1,this._applyInsets(this._insets)}set_content(e){this._content&&=(this.removeChild(this._content),null),e&&(_.setRow(e,1),this.addChild(e),this._content=e),this._restackBars()}_addChildFromBuilder(e,n){switch(t(e,x,`content`)){case`topBar`:case`top`:this.add_top_bar(n);return;case`bottomBar`:case`bottom`:this.add_bottom_bar(n);return;default:this.set_content(n)}}get content(){return this._content}set content(e){this.set_content(e)}get topBar(){return this._topBox}get bottomBar(){return this._bottomBox}get systemInsets(){return this._systemInsets}set systemInsets(e){if(typeof e==`string`){let t=/^\s*(true|false)\s*$/i.test(e);this._systemInsets=t?n(e,!0):null}else this._systemInsets=e;this._applyInsets(this._insets)}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){let t=n(e,this.extendContentToTopEdge);this._props.extendContentToTopEdge=!!t,this._applyBarPlacement()}get extendContentToBottomEdge(){return this._props.extendContentToBottomEdge}set extendContentToBottomEdge(e){let t=n(e,this.extendContentToBottomEdge);this._props.extendContentToBottomEdge=!!t,this._applyBarPlacement()}_applyBarPlacement(){_.setRow(this._topBox,+!!this._props.extendContentToTopEdge),this._topBox.verticalAlignment=this._props.extendContentToTopEdge?`top`:`stretch`,_.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)}_hasShownBottomBar(){for(let e=0;e<this._bottomBox.getChildrenCount();e++)if(this._bottomBox.getChildAt(e).visibility===`visible`)return!0;return!1}_applyInsets(e){this._insets=e;let t=h(this._systemInsets,g.bars.insets),n=this._hasShownBottomBar(),r=l(m(c(u(e),d(this,e)),t),{hasTopBar:this._topBarCount>0,hasBottomBar:this._bottomBarCount>0,bottomBarShown:n});this._bottomBarShown=n,this._topBox.paddingTop=r.topBarTop,this._bottomBox.paddingBottom=r.bottomBarBottom,this.paddingTop=r.contentTop,this.paddingBottom=r.contentBottom}_syncClasses(){let e={topBarHeight:this._topBox.getActualSize?.().height??0,bottomBarHeight:this._bottomBox.getActualSize?.().height??0},t=o({view:this.className,topBar:this._topBox.className,bottomBar:this._bottomBox.className},this._props,e);this.className!==t.view&&(this.className=t.view),this._topBox.className!==t.topBar&&(this._topBox.className=t.topBar),this._bottomBox.className!==t.bottomBar&&(this._bottomBox.className=t.bottomBar)}};export{AdwToolbarView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{withSignals as n}from"./signals.js";import{GtkImage as r}from"./gtk-image.js";import{attachRowPressFeedback as i}from"./row-press.js";import{resolveIdReference as a}from"./id-reference.js";import{AdwViewStack as o,NOTIFY_VISIBLE_CHILD as s}from"./adw-view-stack.js";import{createViewSwitcherBarState as c}from"./view-switcher-model.js";import{buildViewSwitcherButtons as l,viewSwitcherPagesFromStack as u}from"@gjsify/adwaita-core";import{GridLayout as d,ItemSpec as f,Label as p,StackLayout as m}from"@nativescript/core";var AdwViewSwitcherBar=class extends n(d){static GTypeName=`AdwViewSwitcherBar`;static builderReferences=[`stack`];_bar;_nodes=[];_stack=null;_stackId=null;_stackListener=null;_barState=c();constructor(e){super(),this.className=`adw-viewswitcherbar`,this.addColumn(new f(1,`star`)),this.addRow(new f(1,`auto`));let n=new d;n.className=`adw-viewswitcherbar-box`,n.addRow(new f(1,`auto`)),d.setRow(n,0),this.addChild(n),this._bar=n,this._barState.subscribe(()=>this._applyRevealed()),this._applyRevealed(),this.addEventListener(`loaded`,()=>{this._stackId!==null&&(this.stack=a(this,`stack`,this._stackId,o)),this._bindStack(),this._rebuild()}),this.addEventListener(`unloaded`,()=>this._unbindStack()),t(this,e)}set_stack(e){this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild()}get stack(){return this._stack}set stack(e){if(typeof e==`string`){this._stackId=e,this.isLoaded&&(this.stack=a(this,`stack`,e,o));return}this._stackId=null,this.set_stack(e)}get reveal(){return this._barState.reveal}set reveal(t){let n=e(t,this.reveal);this._barState.setReveal(n)}get revealed(){return this._barState.revealed}refresh(){this._rebuild()}_bindStack(){if(!this._stack||this._stackListener)return;let listener=()=>this._rebuild();this._stack.addEventListener(s,listener),this._stackListener=listener}_unbindStack(){!this._stack||!this._stackListener||(this._stack.removeEventListener(s,this._stackListener),this._stackListener=null)}_rebuild(){let e=this._stack?.pages??[];this._barState.setPages(e);let t=this._stack?.pageIcons()??[],n=l(u(e).map((e,n)=>({...e,iconName:(t[n]??``).length>0?t[n]:e.iconName})),this._stack?.visibleChildIndex??-1,`narrow`);if(n.length!==this._nodes.length){for(let e of this._nodes)this._bar.removeChild(e.button);this._nodes=[],this._bar.removeColumns(),this._nodes=n.map((e,t)=>(this._bar.addColumn(new f(1,`star`)),this._buildButton(e.pageIndex,t)))}n.forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.visibility=e.visible?`visible`:`collapse`,n.button.className=e.selected?`adw-viewswitcherbar-button active`:`adw-viewswitcherbar-button`,n.icon.iconName=e.iconName,n.label.text=e.label,n.badge.text=e.badgeLabel,n.badge.visibility=e.badgeLabel.length>0||e.needsAttention?`visible`:`collapse`,n.badge.className=e.badgeLabel.length===0&&e.needsAttention?`adw-viewswitcherbar-button-badge needs-attention`:`adw-viewswitcherbar-button-badge`)}),this._applyRevealed()}_buildButton(e,t){let n=new m;n.orientation=`vertical`,n.className=`adw-viewswitcherbar-button`,n.horizontalAlignment=`stretch`;let a=new r;a.className=`${a.className} adw-viewswitcherbar-button-icon`.trim(),a.horizontalAlignment=`center`,n.addChild(a);let o=new p;o.className=`adw-viewswitcherbar-button-label`,o.horizontalAlignment=`center`,o.textAlignment=`center`,n.addChild(o);let s=new p;return s.className=`adw-viewswitcherbar-button-badge`,s.horizontalAlignment=`center`,s.textAlignment=`center`,n.addChild(s),i(n),n.addEventListener(`tap`,()=>{this._stack?.selectNthPage(e)}),d.setColumn(n,t),this._bar.addChild(n),{button:n,icon:a,label:o,badge:s}}_applyRevealed(){this.visibility=this._barState.revealed?`visible`:`collapse`,this.parent?.requestLayout()}};export{AdwViewSwitcherBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{DEFAULT_WRAP_BOX_SPACING as i,normalizeWrapBoxSpacing as a,wrapBoxChildFlex as o,wrapBoxChildMargin as s,wrapBoxFlexStyle as c,wrapBoxSpacingChanges as l}from"./wrap-box-layout.js";import{ADW_WRAP_BOX_DEFAULT_ALIGN as u,ADW_WRAP_BOX_DEFAULT_JUSTIFY as d,ADW_WRAP_BOX_DEFAULT_LENGTH_UNIT as f,ADW_WRAP_BOX_DEFAULT_PACK_DIRECTION as p,ADW_WRAP_BOX_DEFAULT_WRAP_POLICY as m,ADW_WRAP_BOX_NATURAL_LINE_LENGTH_UNSET as h,normalizeNaturalLineLength as g,normalizeWrapBoxAlign as _,normalizeWrapBoxJustify as v,normalizeWrapBoxLengthUnit as y,normalizeWrapBoxPackDirection as b,normalizeWrapPolicy as x,resolveWrapBoxChildOrder as S,wrapBoxLengthToPx as C}from"@gjsify/adwaita-core";import{FlexboxLayout as w}from"@nativescript/core";var AdwWrapBox=class extends r(w){static GTypeName=`AdwWrapBox`;_childSpacing=i;_lineSpacing=i;_childSpacingUnit=f;_lineSpacingUnit=f;_align=u;_justify=d;_justifyLastLine=!1;_lineHomogeneous=!1;_wrapReverse=!1;_wrapPolicy=m;_packDirection=p;_orientation=`horizontal`;_naturalLineLength=h;_naturalLineLengthUnit=f;constructor(e){super(),this.className=`adw-wrap-box`,this._applyLayout(),n(this,e)}append(e){this.addChild(e)}remove(e){this.removeChild(e)}remove_all(){this.removeChildren()}addChild(e){super.addChild(e),this._applyChildren()}insert_child_after(e,t=null){return this._applyOrder(`insert-after`,e,t)}reorder_child_after(e,t=null){return this._applyOrder(`reorder-after`,e,t)}_childViews(){let e=[];for(let t=0;t<this.getChildrenCount();t++)e.push(this.getChildAt(t));return e}_applyOrder(e,t,n){let r=this._childViews(),i=S({children:r,child:t,sibling:n,op:e});return i===null?!1:(r.includes(t)&&this.removeChild(t),this.insertChild(t,i.indexOf(t)),this._applyChildren(),!0)}get childSpacing(){return this._childSpacing}set childSpacing(e){let n=t(e,this._childSpacing);l(this._childSpacing,n)&&(this._childSpacing=a(n),this._applyChildren(),this._notify(`child-spacing`))}get childSpacingUnit(){return this._childSpacingUnit}set childSpacingUnit(e){let t=y(e);t!==this._childSpacingUnit&&(this._childSpacingUnit=t,this._applyChildren(),this._notify(`child-spacing-unit`))}get lineSpacing(){return this._lineSpacing}set lineSpacing(e){let n=t(e,this._lineSpacing);l(this._lineSpacing,n)&&(this._lineSpacing=a(n),this._applyChildren(),this._notify(`line-spacing`))}get lineSpacingUnit(){return this._lineSpacingUnit}set lineSpacingUnit(e){let t=y(e);t!==this._lineSpacingUnit&&(this._lineSpacingUnit=t,this._applyChildren(),this._notify(`line-spacing-unit`))}get align(){return this._align}set align(e){let n=_(t(e,this.align));n!==this._align&&(this._align=n,this._applyLayout(),this._notify(`align`))}get justify(){return this._justify}set justify(e){let t=v(e);t!==this._justify&&(this._justify=t,this._applyLayout(),this._notify(`justify`))}get justifyLastLine(){return this._justifyLastLine}set justifyLastLine(t){let n=!!e(t,this.justifyLastLine);n!==this._justifyLastLine&&(this._justifyLastLine=n,this._applyLayout(),this._notify(`justify-last-line`))}get lineHomogeneous(){return this._lineHomogeneous}set lineHomogeneous(t){let n=!!e(t,this.lineHomogeneous);n!==this._lineHomogeneous&&(this._lineHomogeneous=n,this._applyLayout(),this._notify(`line-homogeneous`))}get wrapReverse(){return this._wrapReverse}set wrapReverse(t){let n=!!e(t,this.wrapReverse);n!==this._wrapReverse&&(this._wrapReverse=n,this._applyLayout(),this._notify(`wrap-reverse`))}get wrapPolicy(){return this._wrapPolicy}set wrapPolicy(e){let t=x(e);t!==this._wrapPolicy&&(this._wrapPolicy=t,this._applyLayout(),this._notify(`wrap-policy`))}get packDirection(){return this._packDirection}set packDirection(e){let t=b(e);t!==this._packDirection&&(this._packDirection=t,this._applyLayout(),this._notify(`pack-direction`))}get orientation(){return this._orientation}set orientation(e){let t=e===`vertical`?`vertical`:`horizontal`;t!==this._orientation&&(this._orientation=t,this._applyLayout(),this._notify(`orientation`))}get naturalLineLength(){return this._naturalLineLength}set naturalLineLength(e){let n=g(t(e,this.naturalLineLength));n!==this._naturalLineLength&&(this._naturalLineLength=n,this._notify(`natural-line-length`))}get naturalLineLengthUnit(){return this._naturalLineLengthUnit}set naturalLineLengthUnit(e){let t=y(e);t!==this._naturalLineLengthUnit&&(this._naturalLineLengthUnit=t,this._notify(`natural-line-length-unit`))}get naturalLineLengthPx(){return C(this._naturalLineLength,this._naturalLineLengthUnit)}_notify(e){this.notify({eventName:`notify::${e}`,object:this})}_flexInput(){return{orientation:this._orientation,packDirection:this._packDirection,wrapReverse:this._wrapReverse,justify:this._justify,justifyLastLine:this._justifyLastLine,align:this._align,lineHomogeneous:this._lineHomogeneous,wrapPolicy:this._wrapPolicy}}_applyLayout(){let e=c(this._flexInput());this.flexDirection=e.flexDirection,this.flexWrap=e.flexWrap,this.justifyContent=e.justifyContent,this.alignContent=e.alignContent,this.alignItems=`stretch`,this._applyChildren()}_applyChildren(){let e=s(C(this._childSpacing,this._childSpacingUnit),C(this._lineSpacing,this._lineSpacingUnit)),t=this._childViews(),n=o(this._flexInput(),t.length);for(let r of t)r.set(`margin`,e),w.setFlexGrow(r,n.flexGrow),w.setFlexShrink(r,n.flexShrink)}};export{AdwWrapBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{camelProperty as e,gtkPropertyDoor as t}from"./shadowed-properties.js";import{GTK_ALIGN as n,NS_HORIZONTAL_ALIGNMENT as r,NS_VERTICAL_ALIGNMENT as i,gtkAlignRefusal as a}from"./gtk-align.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{camelProperty as e,gtkPropertyDoor as t}from"./shadowed-properties.js";import{GTK_ALIGN as n,NS_HORIZONTAL_ALIGNMENT as r,NS_VERTICAL_ALIGNMENT as i,gtkAlignRefusal as a}from"./gtk-align.js";import{gtkBuilderInteger as o}from"./xml-values.js";import{iconSizeNickOf as s}from"./gtk-icon-size.js";const c={horizontalAlignment:`horizontal`,verticalAlignment:`vertical`},l={iconSize:!0};function settableDoor(e,t){for(let n=e;n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e.set===void 0?e.get===void 0&&e.writable===!0?`data`:null:`accessor`}return null}function nsAlignment(e,t){let s=t===`horizontal`?r:i,c=null,l=typeof e==`number`?e:typeof e==`string`?o(e):void 0;if(l!==void 0){if(c=Object.keys(n).find(e=>n[e]===l)??null,c===null)throw TypeError(`${l} is not a Gtk.Align constant. The seven members are ${Object.keys(n).join(`, `)}, holding the values ${[...new Set(Object.values(n))].join(`, `)}.`)}else typeof e==`string`&&Object.hasOwn(n,e)&&(c=e);if(c===null)return e;let u=s[c];if(u!==void 0)return u;throw TypeError(`Gtk.Align '${c}' has no ${t} counterpart in NativeScript: ${a(c)} The ${t} alignments that do are ${Object.keys(s).join(`, `)}.`)}function applyConstructProps(n,r){if(r!=null)for(let[i,a]of Object.entries(r)){let r=e(i),o=t(n,r);if(o.kind===`refused`)throw TypeError(`${n.constructor.name}: ${o.why}`);if(o.kind===`verbs`){a!==void 0&&n[o.set](a);continue}if(settableDoor(n,r)===null)throw TypeError(`${n.constructor.name} has no settable '${r}'. A construct-props bag goes through the declared setters, so a key nothing declares is refused here rather than left as a dead own-property that renders nothing — the silent drop \`xml-values.ts\` exists for one door over.`);if(a===void 0)continue;let u=c[r];n[r]=u===void 0?Object.hasOwn(l,r)?s(a):a:nsAlignment(a,u)}}export{applyConstructProps,nsAlignment};
|