@gjsify/adwaita-nativescript 0.64.13-next.283 → 0.64.14

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.
Files changed (107) hide show
  1. package/lib/esm/builder/index.js +1 -1
  2. package/lib/esm/index.js +1 -1
  3. package/lib/esm/namespace/gio.js +1 -1
  4. package/lib/esm/namespace/gtk.js +1 -1
  5. package/lib/esm/widgets/adw-about-dialog.js +3 -3
  6. package/lib/esm/widgets/adw-action-row.js +1 -1
  7. package/lib/esm/widgets/adw-avatar.js +1 -1
  8. package/lib/esm/widgets/adw-banner.js +1 -1
  9. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  10. package/lib/esm/widgets/adw-button-row.js +1 -1
  11. package/lib/esm/widgets/adw-carousel.js +1 -1
  12. package/lib/esm/widgets/adw-combo-row.js +1 -1
  13. package/lib/esm/widgets/adw-data-grid.js +1 -1
  14. package/lib/esm/widgets/adw-dialog.js +1 -1
  15. package/lib/esm/widgets/adw-entry-row.js +1 -1
  16. package/lib/esm/widgets/adw-image-button.js +1 -1
  17. package/lib/esm/widgets/adw-navigation-page.js +1 -1
  18. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  19. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  20. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  21. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  22. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  23. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  24. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  25. package/lib/esm/widgets/adw-sidebar.js +1 -1
  26. package/lib/esm/widgets/adw-slider-row.js +1 -1
  27. package/lib/esm/widgets/adw-spin-row.js +1 -1
  28. package/lib/esm/widgets/adw-split-button.js +1 -1
  29. package/lib/esm/widgets/adw-tab-view.js +1 -1
  30. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  31. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  32. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  33. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  34. package/lib/esm/widgets/box-layout.js +1 -1
  35. package/lib/esm/widgets/construct-props.js +1 -1
  36. package/lib/esm/widgets/gtk-action-bar.js +1 -1
  37. package/lib/esm/widgets/gtk-box.js +1 -1
  38. package/lib/esm/widgets/gtk-button.js +1 -1
  39. package/lib/esm/widgets/gtk-check-button.js +1 -1
  40. package/lib/esm/widgets/gtk-drawing-area.js +1 -1
  41. package/lib/esm/widgets/gtk-drop-down.js +1 -1
  42. package/lib/esm/widgets/gtk-entry.js +1 -1
  43. package/lib/esm/widgets/gtk-grid.js +1 -1
  44. package/lib/esm/widgets/gtk-icon-size.js +1 -1
  45. package/lib/esm/widgets/gtk-image.js +1 -1
  46. package/lib/esm/widgets/gtk-label.js +2 -2
  47. package/lib/esm/widgets/gtk-list-box.js +1 -1
  48. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  49. package/lib/esm/widgets/gtk-popover-menu.js +1 -1
  50. package/lib/esm/widgets/gtk-revealer.js +1 -1
  51. package/lib/esm/widgets/gtk-scrolled-window.js +1 -1
  52. package/lib/esm/widgets/gtk-stack.js +1 -1
  53. package/lib/esm/widgets/gtk-text-view.js +1 -1
  54. package/lib/esm/widgets/gtk-toggle-button.js +1 -1
  55. package/lib/esm/widgets/gtk-window.js +1 -1
  56. package/lib/esm/widgets/index.js +1 -1
  57. package/lib/esm/widgets/label-markup-native.android.js +1 -0
  58. package/lib/esm/widgets/label-markup-native.ios.js +1 -0
  59. package/lib/esm/widgets/label-markup-native.js +1 -0
  60. package/lib/esm/widgets/label-markup.js +1 -1
  61. package/lib/esm/widgets/menu-slot.js +1 -0
  62. package/lib/esm/widgets/popup-menu-view.js +1 -1
  63. package/lib/esm/widgets/popup-menu.js +1 -1
  64. package/lib/esm/widgets/scrolled-window-policy.js +1 -1
  65. package/lib/esm/widgets/signals.js +1 -1
  66. package/lib/esm/widgets/single-child-base.js +1 -1
  67. package/lib/esm/widgets/single-child-cell.js +1 -0
  68. package/lib/esm/widgets/stack-page.js +1 -1
  69. package/lib/esm/widgets/transition-type.js +1 -1
  70. package/lib/esm/widgets/view-stack-page.js +1 -1
  71. package/lib/esm/widgets/widget-layout.js +1 -1
  72. package/lib/esm/widgets/xml-values.js +1 -1
  73. package/lib/types/clamped-bin.spec.d.ts +2 -0
  74. package/lib/types/combo-row-properties.spec.d.ts +2 -0
  75. package/lib/types/drop-down-properties.spec.d.ts +2 -0
  76. package/lib/types/entry-properties.spec.d.ts +1 -0
  77. package/lib/types/index.d.ts +4 -2
  78. package/lib/types/menu-model-door.spec.d.ts +1 -0
  79. package/lib/types/namespace/gio.d.ts +1 -1
  80. package/lib/types/single-child-cell.spec.d.ts +2 -0
  81. package/lib/types/template-xalign.spec.d.ts +2 -0
  82. package/lib/types/testing/ns-core.d.mts +35 -2
  83. package/lib/types/widgets/actions.d.ts +3 -3
  84. package/lib/types/widgets/adw-combo-row.d.ts +42 -26
  85. package/lib/types/widgets/adw-split-button.d.ts +17 -7
  86. package/lib/types/widgets/box-layout.d.ts +37 -0
  87. package/lib/types/widgets/gtk-box.d.ts +11 -5
  88. package/lib/types/widgets/gtk-drop-down.d.ts +41 -33
  89. package/lib/types/widgets/gtk-entry.d.ts +62 -34
  90. package/lib/types/widgets/gtk-label.d.ts +24 -0
  91. package/lib/types/widgets/gtk-menu-button.d.ts +22 -13
  92. package/lib/types/widgets/gtk-popover-menu.d.ts +7 -7
  93. package/lib/types/widgets/index.d.ts +2 -4
  94. package/lib/types/widgets/label-markup-native.android.d.ts +5 -0
  95. package/lib/types/widgets/label-markup-native.d.ts +19 -0
  96. package/lib/types/widgets/label-markup-native.ios.d.ts +5 -0
  97. package/lib/types/widgets/label-markup.d.ts +62 -1
  98. package/lib/types/widgets/menu-slot.d.ts +40 -0
  99. package/lib/types/widgets/popup-menu-view.d.ts +3 -2
  100. package/lib/types/widgets/popup-menu.d.ts +8 -6
  101. package/lib/types/widgets/signals.d.ts +33 -8
  102. package/lib/types/widgets/single-child-base.d.ts +5 -0
  103. package/lib/types/widgets/single-child-cell.d.ts +13 -0
  104. package/lib/types/widgets/xml-values.d.ts +12 -0
  105. package/package.json +13 -14
  106. package/src/testing/ns-core.mts +74 -2
  107. package/src/theme/adwaita.css +24 -11
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.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(t){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,e(this,t)}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(e){t(e,!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
+ 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{builderSlotsOf as e,resolveBuilderSlot as t}from"./builder-slots.js";import{applyConstructProps as n}from"./construct-props.js";import{withSignals as r}from"./signals.js";import{StyleClassList as i}from"./style-classes.js";import{PREFERENCES_GROUP_HEADER_CLASS as a,preferencesGroupVisuals as o}from"./preferences-group-state.js";import{GridLayout as s,ItemSpec as c,Label as l,StackLayout as u}from"@nativescript/core";const d=[`headerSuffix`,`header-suffix`];var AdwPreferencesGroup=class extends r(u){static GTypeName=`AdwPreferencesGroup`;static builderSlots=e(d,`row`);_header;_titleLabel;_descriptionLabel;_suffixHost;_listbox;_title=``;_description=``;_headerSuffix=null;_classList=new i(`adw-preferences-group`);constructor(e){super(),this.orientation=`vertical`,this._restyle();let t=new s;t.className=a,t.addColumn(new c(1,`star`)),t.addColumn(new c(1,`auto`)),t.addRow(new c(1,`auto`));let r=new u;r.orientation=`vertical`,r.className=`adw-preferences-group-labels`,r.verticalAlignment=`middle`,s.setColumn(r,0),t.addChild(r);let i=new l;i.className=`adw-preferences-group-title`,i.textWrap=!0,r.addChild(i);let o=new l;o.className=`adw-preferences-group-description`,o.textWrap=!0,r.addChild(o);let d=new u;d.orientation=`horizontal`,d.className=`adw-preferences-group-suffix`,d.verticalAlignment=`middle`,s.setColumn(d,1),t.addChild(d);let f=new u;f.orientation=`vertical`,f.className=`boxed-list adw-preferences-group-listbox`,this.addChild(t),this.addChild(f),this._header=t,this._titleLabel=i,this._descriptionLabel=o,this._suffixHost=d,this._listbox=f,this._applyVisuals(),n(this,e)}get title(){return this._title}set title(e){this._title=e??``,this._titleLabel.text=this._title,this._applyVisuals()}get description(){return this._description}set description(e){this._description=e??``,this._descriptionLabel.text=this._description,this._applyVisuals()}get headerSuffix(){return this._headerSuffix}set headerSuffix(e){e!==this._headerSuffix&&(this._headerSuffix&&this._suffixHost.removeChild(this._headerSuffix),this._headerSuffix=e,this._headerSuffix&&this._suffixHost.addChild(this._headerSuffix),this._applyVisuals())}_addChildFromBuilder(e,n){let r=t(e,d,`row`);if(r===`headerSuffix`||r===`header-suffix`){this.headerSuffix=n;return}this.add(n)}add(e){this._listbox.addChild(e),this._refreshRowEdges(),this._applyVisuals()}remove(e){this._listbox.removeChild(e),this._refreshRowEdges(),this._applyVisuals()}searchRows(){let e=[],t=this._listbox.getChildrenCount();for(let n=0;n<t;n++)e.push(this._listbox.getChildAt(n));return e}_applyVisuals(){let e=o({title:this._title,description:this._description,hasHeaderSuffix:this._headerSuffix!==null,rowCount:this._listbox.getChildrenCount()});this._titleLabel.visibility=e.titleVisibility,this._descriptionLabel.visibility=e.descriptionVisibility,this._header.visibility=e.headerVisibility,this._header.className=e.headerClassName,this._listbox.visibility=e.listboxVisibility}_refreshRowEdges(){let e=this._listbox.getChildrenCount();for(let t=0;t<e;t++){let e=this._listbox.getChildAt(t);e&&this._setFlushTop(e,t===0)}}_setFlushTop(e,t){let n=(e.className??``).replace(/\s*\badw-row-flush-top\b/g,``);e.className=t?`${n} adw-row-flush-top`.trim():n.trim()}get listbox(){return this._listbox}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{AdwPreferencesGroup};
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{withSignals as r}from"./signals.js";import{StyleClassList as i}from"./style-classes.js";import{applyTemplateXalign as a}from"./gtk-label.js";import{PREFERENCES_GROUP_HEADER_CLASS as o,preferencesGroupVisuals as s}from"./preferences-group-state.js";import{GridLayout as c,ItemSpec as l,Label as u,StackLayout as d}from"@nativescript/core";const f=[`headerSuffix`,`header-suffix`];var AdwPreferencesGroup=class extends r(d){static GTypeName=`AdwPreferencesGroup`;static builderSlots=e(f,`row`);_header;_titleLabel;_descriptionLabel;_suffixHost;_listbox;_title=``;_description=``;_headerSuffix=null;_classList=new i(`adw-preferences-group`);constructor(e){super(),this.orientation=`vertical`,this._restyle();let t=new c;t.className=o,t.addColumn(new l(1,`star`)),t.addColumn(new l(1,`auto`)),t.addRow(new l(1,`auto`));let r=new d;r.orientation=`vertical`,r.className=`adw-preferences-group-labels`,r.verticalAlignment=`middle`,c.setColumn(r,0),t.addChild(r);let i=new u;i.className=`adw-preferences-group-title`,i.textWrap=!0,a(i,0),r.addChild(i);let s=new u;s.className=`adw-preferences-group-description`,s.textWrap=!0,a(s,0),r.addChild(s);let f=new d;f.orientation=`horizontal`,f.className=`adw-preferences-group-suffix`,f.verticalAlignment=`middle`,c.setColumn(f,1),t.addChild(f);let p=new d;p.orientation=`vertical`,p.className=`boxed-list adw-preferences-group-listbox`,this.addChild(t),this.addChild(p),this._header=t,this._titleLabel=i,this._descriptionLabel=s,this._suffixHost=f,this._listbox=p,this._applyVisuals(),n(this,e)}get title(){return this._title}set title(e){this._title=e??``,this._titleLabel.text=this._title,this._applyVisuals()}get description(){return this._description}set description(e){this._description=e??``,this._descriptionLabel.text=this._description,this._applyVisuals()}get headerSuffix(){return this._headerSuffix}set headerSuffix(e){e!==this._headerSuffix&&(this._headerSuffix&&this._suffixHost.removeChild(this._headerSuffix),this._headerSuffix=e,this._headerSuffix&&this._suffixHost.addChild(this._headerSuffix),this._applyVisuals())}_addChildFromBuilder(e,n){let r=t(e,f,`row`);if(r===`headerSuffix`||r===`header-suffix`){this.headerSuffix=n;return}this.add(n)}add(e){this._listbox.addChild(e),this._refreshRowEdges(),this._applyVisuals()}remove(e){this._listbox.removeChild(e),this._refreshRowEdges(),this._applyVisuals()}searchRows(){let e=[],t=this._listbox.getChildrenCount();for(let n=0;n<t;n++)e.push(this._listbox.getChildAt(n));return e}_applyVisuals(){let e=s({title:this._title,description:this._description,hasHeaderSuffix:this._headerSuffix!==null,rowCount:this._listbox.getChildrenCount()});this._titleLabel.visibility=e.titleVisibility,this._descriptionLabel.visibility=e.descriptionVisibility,this._header.visibility=e.headerVisibility,this._header.className=e.headerClassName,this._listbox.visibility=e.listboxVisibility}_refreshRowEdges(){let e=this._listbox.getChildrenCount();for(let t=0;t<e;t++){let e=this._listbox.getChildAt(t);e&&this._setFlushTop(e,t===0)}}_setFlushTop(e,t){let n=(e.className??``).replace(/\s*\badw-row-flush-top\b/g,``);e.className=t?`${n} adw-row-flush-top`.trim():n.trim()}get listbox(){return this._listbox}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{AdwPreferencesGroup};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.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(t){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,e(this,t)}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(e){this._useUnderline=t(e,!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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlNumber as t}from"./xml-values.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(t){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)}),e(this,t)}_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(e){let n=t(e,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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlNumber as t}from"./xml-values.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(t){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)}),e(this,t)}_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(e){this._state.setValue(a(this._state.adjustment,t(e,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
+ 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{applyConstructProps as n}from"./construct-props.js";import{xmlNumber as r}from"./xml-values.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 r=new l;r.className=`adw-spin-value`,r.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(r),t.addChild(i),t.addChild(o),this.add_suffix(t),this._minusButton=i,this._plusButton=o,this._valueLabel=r,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()),n(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(r(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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.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(t){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(),e(this,t)}_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(e){let n=!!t(e,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
+ 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{MenuSlot as s}from"./menu-slot.js";import{showMenuPopup as c}from"./popup-menu-view.js";import{splitButtonArrowSvg as l}from"./split-button.js";import{ArrowType as u}from"./gtk-enums.js";import{SPLIT_BUTTON_DISABLED_OPACITY as d,SplitButtonState as f}from"@gjsify/adwaita-core";import{GridLayout as p,ItemSpec as m,Label as h,StackLayout as g}from"@nativescript/core";const _=`notify::direction`,v=`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(p,{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=[_];_actionPart;_actionLabel;_actionIcon;_dropdownPart;_chevron;_state=new f;_slot=new s(`AdwSplitButton`,()=>void 0);_actions=null;_showingIcon=!1;_sensitive=!0;_contentGate=!1;constructor(e){super(),this.className=`adw-split-button`,this.addColumn(new m(1,`auto`)),this.addColumn(new m(1,`auto`)),this.addRow(new m(1,`auto`));let n=new g;n.orientation=`horizontal`,n.className=`adw-split-button-action`,n.horizontalAlignment=`center`,p.setColumn(n,0);let o=new h;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 p;c.className=`adw-split-button-dropdown`,c.addColumn(new m(1,`star`)),c.addRow(new m(1,`star`)),p.setColumn(c,1);let u=new r;u.className=`${u.className} adw-split-button-chevron`.trim(),u.iconName=l(this._state.direction),u.horizontalAlignment=`center`,u.verticalAlignment=`middle`,c.addChild(u),this.addChild(c),this._dropdownPart=c,this._chevron=u,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{c(this._dropdownPart,{tree:this._slot.tree,actions:this._actions,onActivated:(e,t)=>{let n=this._state.activateMenuItem(t);if(n===null)return;let r={eventName:v,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=l(e),this._dropdownPart.opacity=t?1:d,this.opacity=this._sensitive?1:d}get menuModel(){return this._slot.model}set menuModel(e){let t=this._slot.model;this._slot.write(e),this._state.setMenuModel(this._slot.model)&&this.notifyPropertyChange(`menuModel`,this._slot.model,t)}get actions(){return this._actions}set actions(e){this._actions=e??null}get_direction(){return u[this._state.direction.toUpperCase()]}set_direction(e){let t=e,n=typeof t==`number`?t:/^\d+$/.test(String(t))?Number(t):u[String(t).toUpperCase()],r=Object.keys(u).find(e=>u[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:_,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,v as MENU_TAPPED,_ as NOTIFY_DIRECTION};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.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(t){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)}),e(this,t)}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(e){let n=t(e,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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlNumber as t}from"./xml-values.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(t){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)}),e(this,t)}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(e){let n=t(e,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
+ 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{applyConstructProps as n}from"./construct-props.js";import{xmlBoolean as r}from"./xml-values.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 r=new y;r.orientation=`vertical`,r.className=b.bottomBar,_.setRow(r,2),this.addChild(r),this._bottomBox=r,this.addEventListener(`layoutChanged`,()=>this._syncClasses()),r.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}),n(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?r(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=r(e,this.extendContentToTopEdge);this._props.extendContentToTopEdge=!!t,this._applyBarPlacement()}get extendContentToBottomEdge(){return this._props.extendContentToBottomEdge}set extendContentToBottomEdge(e){let t=r(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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.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(t){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()),e(this,t)}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(e){let n=t(e,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
+ 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{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t,xmlNumber as n}from"./xml-values.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(t){super(),this.className=`adw-wrap-box`,this._applyLayout(),e(this,t)}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 t=n(e,this._childSpacing);l(this._childSpacing,t)&&(this._childSpacing=a(t),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 t=n(e,this._lineSpacing);l(this._lineSpacing,t)&&(this._lineSpacing=a(t),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 t=_(n(e,this.align));t!==this._align&&(this._align=t,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(e){let n=!!t(e,this.justifyLastLine);n!==this._justifyLastLine&&(this._justifyLastLine=n,this._applyLayout(),this._notify(`justify-last-line`))}get lineHomogeneous(){return this._lineHomogeneous}set lineHomogeneous(e){let n=!!t(e,this.lineHomogeneous);n!==this._lineHomogeneous&&(this._lineHomogeneous=n,this._applyLayout(),this._notify(`line-homogeneous`))}get wrapReverse(){return this._wrapReverse}set wrapReverse(e){let n=!!t(e,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 t=g(n(e,this.naturalLineLength));t!==this._naturalLineLength&&(this._naturalLineLength=t,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
+ 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{DEFAULT_BOX_SPACING as e,normalizeBoxSpacing as t,resolveWrapBoxChildOrder as n}from"@gjsify/adwaita-core";function boxSpacingChanges(e,n){return t(n)!==t(e)}function boxTrackPlan(e,n,r){let i=t(n),a=[];for(let[t,n]of e.entries())t>0&&a.push({unit:`pixel`,value:i}),a.push({unit:r||n?`star`:`auto`,value:1});return a}function boxChildTrack(e){return e*2}export{e as DEFAULT_BOX_SPACING,boxChildTrack,boxSpacingChanges,boxTrackPlan,t as normalizeBoxSpacing,n as resolveBoxChildOrder};
1
+ import"../_virtual/_rolldown/runtime.js";import{DEFAULT_BOX_SPACING as e,normalizeBoxSpacing as t,resolveWrapBoxChildOrder as n}from"@gjsify/adwaita-core";function boxSpacingChanges(e,n){return t(n)!==t(e)}function boxTrackPlan(e,n,r){let i=t(n),a=[];for(let[t,n]of e.entries())t>0&&a.push({unit:`pixel`,value:i}),a.push({unit:r||n?`star`:`auto`,value:1});return a}function boxChildTrack(e){return e*2}function boxTrackDiff(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r].unit===t[r].unit&&e[r].value===t[r].value;)r+=1;return{keep:r,add:t.slice(r)}}function boxPlacementStart(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}export{e as DEFAULT_BOX_SPACING,boxChildTrack,boxPlacementStart,boxSpacingChanges,boxTrackDiff,boxTrackPlan,t as normalizeBoxSpacing,n as resolveBoxChildOrder};
@@ -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{iconSizeNickOf as o}from"./gtk-icon-size.js";const s={horizontalAlignment:`horizontal`,verticalAlignment:`vertical`},c={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 o=t===`horizontal`?r:i,s=null;if(typeof e==`number`){if(s=Object.keys(n).find(t=>n[t]===e)??null,s===null)throw TypeError(`${e} 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)&&(s=e);if(s===null)return e;let c=o[s];if(c!==void 0)return c;throw TypeError(`Gtk.Align '${s}' has no ${t} counterpart in NativeScript: ${a(s)} The ${t} alignments that do are ${Object.keys(o).join(`, `)}.`)}function applyConstructProps(n,r){if(r!=null)for(let[i,a]of Object.entries(r)){let r=e(i),l=t(n,r);if(l.kind===`refused`)throw TypeError(`${n.constructor.name}: ${l.why}`);if(l.kind===`verbs`){a!==void 0&&n[l.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=s[r];n[r]=u===void 0?Object.hasOwn(c,r)?o(a):a:nsAlignment(a,u)}}export{applyConstructProps,nsAlignment};
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};
@@ -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{xmlBoolean as r}from"./xml-values.js";import{withSignals as i}from"./signals.js";import{GridLayout as a,ItemSpec as o,StackLayout as s}from"@nativescript/core";const c=[`start`,`center`,`end`];var GtkActionBar=class extends i(a){static GTypeName=`GtkActionBar`;static builderSlots=e(c,`start`);_startBox;_endBox;_centerWidget=null;_revealed=!0;constructor(e){super(),this.className=`adw-action-bar`,this.addColumn(new o(1,`star`)),this.addColumn(new o(1,`auto`)),this.addColumn(new o(1,`star`)),this.addRow(new o(1,`auto`));let t=new s;t.orientation=`horizontal`,t.className=`adw-action-bar-start`,t.horizontalAlignment=`left`,a.setColumn(t,0),this.addChild(t),this._startBox=t;let r=new s;r.orientation=`horizontal`,r.className=`adw-action-bar-end`,r.horizontalAlignment=`right`,a.setColumn(r,2),this.addChild(r),this._endBox=r,n(this,e)}pack_start(e){this._startBox.addChild(e)}pack_end(e){this._endBox.insertChild(e,0)}set_center_widget(e){this._centerWidget&&this.removeChild(this._centerWidget),this._centerWidget=e,e&&(e.verticalAlignment=`middle`,a.setColumn(e,1),this.addChild(e))}get centerWidget(){return this._centerWidget}get startBox(){return this._startBox}get endBox(){return this._endBox}_addChildFromBuilder(e,n){switch(t(e,c,`start`)){case`center`:this.set_center_widget(n);return;case`end`:this.pack_end(n);return;default:this.pack_start(n)}}get revealed(){return this._revealed}set revealed(e){this._revealed=r(e,this._revealed),this.visibility=this._revealed?`visible`:`collapse`}};export{GtkActionBar};
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{GridLayout as a,ItemSpec as o,StackLayout as s}from"@nativescript/core";const c=[`start`,`center`,`end`];var GtkActionBar=class extends i(a){static GTypeName=`GtkActionBar`;static builderSlots=e(c,`start`);_startBox;_endBox;_centerWidget=null;_revealed=!0;constructor(e){super(),this.className=`adw-action-bar`,this.addColumn(new o(1,`star`)),this.addColumn(new o(1,`auto`)),this.addColumn(new o(1,`star`)),this.addRow(new o(1,`auto`));let t=new s;t.orientation=`horizontal`,t.className=`adw-action-bar-start`,t.horizontalAlignment=`left`,a.setColumn(t,0),this.addChild(t),this._startBox=t;let n=new s;n.orientation=`horizontal`,n.className=`adw-action-bar-end`,n.horizontalAlignment=`right`,a.setColumn(n,2),this.addChild(n),this._endBox=n,r(this,e)}pack_start(e){this._startBox.addChild(e)}pack_end(e){this._endBox.insertChild(e,0)}set_center_widget(e){this._centerWidget&&this.removeChild(this._centerWidget),this._centerWidget=e,e&&(e.verticalAlignment=`middle`,a.setColumn(e,1),this.addChild(e))}get centerWidget(){return this._centerWidget}get startBox(){return this._startBox}get endBox(){return this._endBox}_addChildFromBuilder(e,n){switch(t(e,c,`start`)){case`center`:this.set_center_widget(n);return;case`end`:this.pack_end(n);return;default:this.pack_start(n)}}get revealed(){return this._revealed}set revealed(e){this._revealed=n(e,this._revealed),this.visibility=this._revealed?`visible`:`collapse`}};export{GtkActionBar};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t,xmlNumber as n}from"./xml-values.js";import{NOTIFY_HEXPAND as r,NOTIFY_VEXPAND as i}from"./widget-layout.js";import{AdwStyledLayoutBase as a}from"./styled-layout-base.js";import{DEFAULT_BOX_SPACING as o,boxChildTrack as s,boxSpacingChanges as c,boxTrackPlan as l,normalizeBoxSpacing as u,resolveBoxChildOrder as d}from"./box-layout.js";import{normalizeBoxOrientation as f}from"@gjsify/adwaita-core";import{GridLayout as p,ItemSpec as m}from"@nativescript/core";var GtkBox=class extends a{static GTypeName=`GtkBox`;_spacing=o;_orientation=`horizontal`;_homogeneous=!1;_trackKey=``;_followers=new Map;constructor(t){super(),e(this,t)}append(e){this.addChild(e)}prepend(e){this.insertChild(e,0)}remove(e){this.removeChild(e)}addChild(e){super.addChild(e),this._follow(e),this._applyChildren()}insertChild(e,t){let n=super.insertChild(e,t);return this._follow(e),this._applyChildren(),n}removeChild(e){this._unfollow(e),super.removeChild(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)}get spacing(){return this._spacing}set spacing(e){let t=n(e,this._spacing);c(this._spacing,t)&&(this._spacing=u(t),this._applyChildren(),this.notify({eventName:`notify::spacing`,object:this}))}get orientation(){return this._orientation}set orientation(e){let t=f(e===1?`vertical`:e);t!==this._orientation&&(this._orientation=t,this._applyChildren(),this.notify({eventName:`notify::orientation`,object:this}))}get homogeneous(){return this._homogeneous}set homogeneous(e){let n=t(e,this._homogeneous);n!==this._homogeneous&&(this._homogeneous=n,this._applyChildren())}_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=d({children:r,child:t,sibling:n,op:e});return i===null?!1:(r.includes(t)&&this.removeChild(t),this.insertChild(t,i.indexOf(t)),!0)}_follow(e){if(this._followers.has(e))return;let follower=()=>this._applyChildren();this._followers.set(e,follower),e.addEventListener(r,follower),e.addEventListener(i,follower)}_unfollow(e){let t=this._followers.get(e);t!==void 0&&(e.removeEventListener(r,t),e.removeEventListener(i,t),this._followers.delete(e))}_applyChildren(){let e=this._orientation===`vertical`,t=this._childViews(),n=l(t.map(t=>{let n=t;return(e?n.vexpand:n.hexpand)===!0}),this._spacing,this._homogeneous),r=`${e?`v`:`h`}${n.map(({unit:e,value:t})=>`${e}${t}`).join(`,`)}`;if(r!==this._trackKey){this._trackKey=r,this.removeColumns(),this.removeRows();let cross=()=>new m(1,`star`),along=e=>{for(let{unit:t,value:r}of n)e(new m(r,t))};e?(this.addColumn(cross()),along(e=>this.addRow(e))):(this.addRow(cross()),along(e=>this.addColumn(e)))}for(let[n,r]of t.entries())p.setColumn(r,e?0:s(n)),p.setRow(r,e?s(n):0)}};export{o as DEFAULT_BOX_SPACING,GtkBox};
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{NOTIFY_HEXPAND as r,NOTIFY_VEXPAND as i}from"./widget-layout.js";import{AdwStyledLayoutBase as a}from"./styled-layout-base.js";import{DEFAULT_BOX_SPACING as o,boxChildTrack as s,boxPlacementStart as c,boxSpacingChanges as l,boxTrackDiff as u,boxTrackPlan as d,normalizeBoxSpacing as f,resolveBoxChildOrder as p}from"./box-layout.js";import{normalizeBoxOrientation as m}from"@gjsify/adwaita-core";import{GridLayout as h,ItemSpec as g}from"@nativescript/core";var GtkBox=class extends a{static GTypeName=`GtkBox`;_spacing=o;_orientation=`horizontal`;_homogeneous=!1;_tracks=[];_tracksVertical=null;_specs=[];_placed=[];_followers=new Map;constructor(e){super(),n(this,e)}append(e){this.addChild(e)}prepend(e){this.insertChild(e,0)}remove(e){this.removeChild(e)}addChild(e){super.addChild(e),this._follow(e),this._applyChildren()}insertChild(e,t){let n=super.insertChild(e,t);return this._follow(e),this._applyChildren(),n}removeChild(e){this._unfollow(e),super.removeChild(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)}get spacing(){return this._spacing}set spacing(e){let n=t(e,this._spacing);l(this._spacing,n)&&(this._spacing=f(n),this._applyChildren(),this.notify({eventName:`notify::spacing`,object:this}))}get orientation(){return this._orientation}set orientation(e){let t=m(e===1?`vertical`:e);t!==this._orientation&&(this._orientation=t,this._applyChildren(),this.notify({eventName:`notify::orientation`,object:this}))}get homogeneous(){return this._homogeneous}set homogeneous(t){let n=e(t,this._homogeneous);n!==this._homogeneous&&(this._homogeneous=n,this._applyChildren())}_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=p({children:r,child:t,sibling:n,op:e});return i===null?!1:(r.includes(t)&&this.removeChild(t),this.insertChild(t,i.indexOf(t)),!0)}_follow(e){if(this._followers.has(e))return;let follower=()=>this._applyChildren();this._followers.set(e,follower),e.addEventListener(r,follower),e.addEventListener(i,follower)}_unfollow(e){let t=this._followers.get(e);t!==void 0&&(e.removeEventListener(r,t),e.removeEventListener(i,t),this._followers.delete(e))}_applyChildren(){let e=this._orientation===`vertical`,t=this._childViews(),n=d(t.map(t=>{let n=t;return(e?n.vexpand:n.hexpand)===!0}),this._spacing,this._homogeneous);e!==this._tracksVertical&&(this.removeColumns(),this.removeRows(),e?this.addColumn(new g(1,`star`)):this.addRow(new g(1,`star`)),this._tracksVertical=e,this._tracks=[],this._specs.length=0,this._placed=[]);let{keep:r,add:i}=u(this._tracks,n);if(r<this._tracks.length||i.length>0){for(;this._specs.length>r;){let t=this._specs.pop();e?this.removeRow(t):this.removeColumn(t)}for(let{unit:t,value:n}of i){let r=new g(n,t);this._specs.push(r),e?this.addRow(r):this.addColumn(r)}this._tracks=n}for(let n=c(this._placed,t);n<t.length;n+=1){let r=t[n];h.setColumn(r,e?0:s(n)),h.setRow(r,e?s(n):0)}this._placed=t}};export{o as DEFAULT_BOX_SPACING,GtkBox};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{applyConstructProps as t}from"./construct-props.js";import{xmlBoolean as n}from"./xml-values.js";import{activateWidgetAction as r}from"./actions.js";import{applyNativeTooltip as i}from"./native-tooltip.js";import{withSignals as a}from"./signals.js";import{GtkImage as o}from"./gtk-image.js";import{attachRowPressFeedback as s}from"./row-press.js";import{classNameWith as c,normalizeStyleClasses as l,withCssClass as u,withoutCssClass as d}from"./style-classes.js";import{buttonSlotAfterWrite as f,buttonSlotDetaches as p}from"./button-slot.js";import{labelDisplayText as m}from"@gjsify/adwaita-core";import{GridLayout as h,ItemSpec as g,Label as _}from"@nativescript/core";const v=`clicked`,y=`image-button`,b=`adw-button-label`;var GtkButton=class extends a(h,{GTypeName:`GtkButton`,Signals:{clicked:{}}}){static GTypeName=`GtkButton`;static builderSlots=e([`child`],`child`);_styleClasses=[];_label=``;_iconName=``;_tooltipText=``;_useUnderline=!1;_slot=`empty`;_content=null;constructor(e){super(),this.className=c(`adw-button`,this._styleClasses),this.addRow(new g(1,`star`)),this.addColumn(new g(1,`star`)),s(this),this.addEventListener(`tap`,()=>{this.emit(v),this.actionName&&r(this,this.actionName)}),this.addEventListener(`loaded`,()=>{i(this,this.tooltipText),this._pinIconColor()}),t(this,e)}get label(){return this._label}set label(e){this._label=e??``,this._fill(`label`,this._label)}actionName=null;get iconName(){return this._iconName}set iconName(e){this._iconName=e??``,this._fill(`icon`,this._iconName)}get tooltipText(){return this._tooltipText}set tooltipText(e){let t=e??``;(this.accessibilityHint??``)===this._tooltipText&&(this.accessibilityHint=t),this._tooltipText=t,i(this,t)}get child(){return this._slot===`child`?this._content:null}set child(e){this._fill(`child`,e??null)}set_child(e){this.child=e}get_child(){return this.child}_addChildFromBuilder(e,t){this.child=t}get useUnderline(){return this._useUnderline}set useUnderline(e){this._useUnderline=n(e,this._useUnderline),this._slot===`label`&&this._fill(`label`,this._label)}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(l(e))}add_css_class(e){this._setClasses(u(this._styleClasses,e))}remove_css_class(e){this._setClasses(d(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(l([...e].join(` `)))}_setClasses(e){this._styleClasses=[...e],this._restyle()}_restyle(){this.className=c(`adw-button`,[...this._styleClasses,...this._stateClasses()]),this._pinIconColor()}_stateClasses(){return this._slot===`icon`?[y]:[]}_fill(e,t){let n=f(e,t);p(this._slot,n)&&this._detach();let r=this._slot===`icon`;if(this._slot=n,r!==(n===`icon`)&&this._restyle(),n===`empty`){this._detach();return}if(n===`child`){let e=t;if(this._content===e)return;this._detach(),this._adopt(e);let n=e;`hostButton`in n&&(n.hostButton=this);return}if(n===`label`){let e=this._content instanceof _?this._content:this._adopt(new _);e.className=b,e.text=m(this._label,!1,this._useUnderline);return}let i=this._content instanceof o?this._content:this._adopt(new o);i.iconName=this._iconName,this._pinIconColor()}_pinIconColor(){this._content instanceof o&&(this._styleClasses.some(e=>e===`osd`||e===`suggested-action`)||this._inOsdContainer())&&(this._content.iconColor=`#ffffff`)}_inOsdContainer(){for(let e=this.parent;e;e=e.parent)if((e.className??``).split(/\s+/).includes(`osd`))return!0;return!1}_detach(){this._content&&this.removeChild(this._content),this._content=null}_adopt(e){return e.horizontalAlignment=`center`,e.verticalAlignment=`middle`,h.setColumn(e,0),h.setRow(e,0),this.addChild(e),this._content=e,e}};export{v as GTK_BUTTON_CLICKED,y as GTK_BUTTON_IMAGE_CLASS,b as GTK_BUTTON_LABEL_CLASS,GtkButton};
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{activateWidgetAction as r}from"./actions.js";import{applyNativeTooltip as i}from"./native-tooltip.js";import{withSignals as a}from"./signals.js";import{GtkImage as o}from"./gtk-image.js";import{classNameWith as s,normalizeStyleClasses as c,withCssClass as l,withoutCssClass as u}from"./style-classes.js";import{attachRowPressFeedback as d}from"./row-press.js";import{buttonSlotAfterWrite as f,buttonSlotDetaches as p}from"./button-slot.js";import{labelDisplayText as m}from"@gjsify/adwaita-core";import{GridLayout as h,ItemSpec as g,Label as _}from"@nativescript/core";const v=`clicked`,y=`image-button`,b=`adw-button-label`;var GtkButton=class extends a(h,{GTypeName:`GtkButton`,Signals:{clicked:{}}}){static GTypeName=`GtkButton`;static builderSlots=e([`child`],`child`);_styleClasses=[];_label=``;_iconName=``;_tooltipText=``;_useUnderline=!1;_slot=`empty`;_content=null;constructor(e){super(),this.className=s(`adw-button`,this._styleClasses),this.addRow(new g(1,`star`)),this.addColumn(new g(1,`star`)),d(this),this.addEventListener(`tap`,()=>{this.emit(v),this.actionName&&r(this,this.actionName)}),this.addEventListener(`loaded`,()=>{i(this,this.tooltipText),this._pinIconColor()}),n(this,e)}get label(){return this._label}set label(e){this._label=e??``,this._fill(`label`,this._label)}actionName=null;get iconName(){return this._iconName}set iconName(e){this._iconName=e??``,this._fill(`icon`,this._iconName)}get tooltipText(){return this._tooltipText}set tooltipText(e){let t=e??``;(this.accessibilityHint??``)===this._tooltipText&&(this.accessibilityHint=t),this._tooltipText=t,i(this,t)}get child(){return this._slot===`child`?this._content:null}set child(e){this._fill(`child`,e??null)}set_child(e){this.child=e}get_child(){return this.child}_addChildFromBuilder(e,t){this.child=t}get useUnderline(){return this._useUnderline}set useUnderline(e){this._useUnderline=t(e,this._useUnderline),this._slot===`label`&&this._fill(`label`,this._label)}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(c(e))}add_css_class(e){this._setClasses(l(this._styleClasses,e))}remove_css_class(e){this._setClasses(u(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(c([...e].join(` `)))}_setClasses(e){this._styleClasses=[...e],this._restyle()}_restyle(){this.className=s(`adw-button`,[...this._styleClasses,...this._stateClasses()]),this._pinIconColor()}_stateClasses(){return this._slot===`icon`?[y]:[]}_fill(e,t){let n=f(e,t);p(this._slot,n)&&this._detach();let r=this._slot===`icon`;if(this._slot=n,r!==(n===`icon`)&&this._restyle(),n===`empty`){this._detach();return}if(n===`child`){let e=t;if(this._content===e)return;this._detach(),this._adopt(e);let n=e;`hostButton`in n&&(n.hostButton=this);return}if(n===`label`){let e=this._content instanceof _?this._content:this._adopt(new _);e.className=b,e.text=m(this._label,!1,this._useUnderline);return}let i=this._content instanceof o?this._content:this._adopt(new o);i.iconName=this._iconName,this._pinIconColor()}_pinIconColor(){this._content instanceof o&&(this._styleClasses.some(e=>e===`osd`||e===`suggested-action`)||this._inOsdContainer())&&(this._content.iconColor=`#ffffff`)}_inOsdContainer(){for(let e=this.parent;e;e=e.parent)if((e.className??``).split(/\s+/).includes(`osd`))return!0;return!1}_detach(){this._content&&this.removeChild(this._content),this._content=null}_adopt(e){return e.horizontalAlignment=`center`,e.verticalAlignment=`middle`,h.setColumn(e,0),h.setRow(e,0),this.addChild(e),this._content=e,e}};export{v as GTK_BUTTON_CLICKED,y as GTK_BUTTON_IMAGE_CLASS,b as GTK_BUTTON_LABEL_CLASS,GtkButton};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{applyConstructProps as t}from"./construct-props.js";import{xmlBoolean as n}from"./xml-values.js";import{GtkImage as r}from"./gtk-image.js";import{attachRowPressFeedback as i}from"./row-press.js";import{classNameWith as a}from"./style-classes.js";import{AdwStyledLayoutBase as o}from"./styled-layout-base.js";import{resolveIdReference as s}from"./id-reference.js";import{checkActivationFlips as c,checkGroupNeighbours as l,isRadioCheck as u,labelDisplayText as d,setCheckGroup as f}from"@gjsify/adwaita-core";import{GridLayout as p,ItemSpec as m,Label as h}from"@nativescript/core";import{objectSelectSymbolic as g}from"@gjsify/adwaita-icons/actions";const _=`toggled`,v=`activate`,y=`notify::active`,b=`checked`,x=`inconsistent`;var S=class GtkCheckButton extends o{static GTypeName=`GtkCheckButton`;static emittedSignals=[_,v,y];static builderSlots=e([`child`],`child`);static builderReferences=[`group`];_indicator;_mark;_text;_active=!1;_inconsistent=!1;_label=null;_useUnderline=!1;_child=null;_groupId=null;_contentUnit=`auto`;constructor(e){super(),this.addColumn(new m(1,`auto`)),this.addColumn(new m(1,`auto`)),this.addRow(new m(1,`auto`));let n=new p;n.className=`adw-check-indicator`,n.addColumn(new m(1,`star`)),n.addRow(new m(1,`star`)),n.verticalAlignment=`middle`,p.setColumn(n,0),p.setRow(n,0);let a=new r;a.iconName=g,a.pixelSize=14,a.iconColor=`#ffffff`,a.horizontalAlignment=`center`,a.verticalAlignment=`middle`,a.visibility=`collapse`,n.addChild(a),this.addChild(n),this._indicator=n,this._mark=a;let o=new h;o.className=`adw-check-label`,o.verticalAlignment=`middle`,o.visibility=`collapse`,p.setColumn(o,1),p.setRow(o,0),this.addChild(o),this._text=o,this.addEventListener(`loaded`,()=>this._resolveGroupId()),i(this),this.addEventListener(`tap`,()=>{c(this,this._active)&&(this._inconsistent=!1,this.active=!this._active,this._restyle(),this.notify({eventName:v,object:this}))}),this._restyle(),t(this,e)}get active(){return this._active}set active(e){let t=n(e,this._active);if(t!==this._active){if(t)for(let e of l(this))e.active=!1;this._active=t,this._restyle(),this.notify({eventName:_,object:this}),this.notify({eventName:y,object:this})}}set group(e){if(typeof e==`string`){this._groupId=e,this.isLoaded&&this.set_group(s(this,`group`,e,GtkCheckButton));return}this._groupId=null,this.set_group(e)}set_group(e){f(this,e),this._restyle(),e?._restyle()}_resolveGroupId(){let e=this._groupId;e!==null&&(this._groupId=null,this.set_group(s(this,`group`,e,GtkCheckButton)))}get inconsistent(){return this._inconsistent}set inconsistent(e){let t=n(e,this._inconsistent);t!==this._inconsistent&&(this._inconsistent=t,this._restyle(),this.notify({eventName:`notify::inconsistent`,object:this}))}get label(){return this._label}set label(e){this._label=e??null,this._paintLabel()}get useUnderline(){return this._useUnderline}set useUnderline(e){this._useUnderline=!!n(e,this._useUnderline),this._paintLabel()}_paintLabel(){this._text.text=d(this._label??``,!1,this._useUnderline),this._syncContent()}get child(){return this._child}set child(e){let t=e??null;t!==this._child&&(this._child&&this.removeChild(this._child),this._child=t,t&&(p.setColumn(t,1),p.setRow(t,0),this.addChild(t)),this._syncContent())}set_child(e){this.child=e}get_child(){return this._child}get_active(){return this._active}set_active(e){this.active=e}_addChildFromBuilder(e,t){this.child=t}_syncContent(){let e=!!this._child||!!this._label;this._text.visibility=!this._child&&this._label?`visible`:`collapse`;let t=e?`star`:`auto`;t!==this._contentUnit&&(this._contentUnit=t,this.removeColumns(),this.addColumn(new m(1,`auto`)),this.addColumn(new m(1,t)))}get _ownClass(){return`adw-check-button`}_restyle(){let e=[];this._active&&e.push(b),this._inconsistent&&e.push(x),this.className=a(this._ownClass,[...this.styleClasses,...e]),this._indicator.className=a(`adw-check-indicator`,u(this)?[...e,`radio`]:e),this._mark.visibility=this._active||this._inconsistent?`visible`:`collapse`}};export{v as GTK_CHECK_BUTTON_ACTIVATE,b as GTK_CHECK_BUTTON_CHECKED_CLASS,x as GTK_CHECK_BUTTON_INCONSISTENT_CLASS,_ as GTK_CHECK_BUTTON_TOGGLED,S as GtkCheckButton,y as NOTIFY_CHECK_ACTIVE};
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{GtkImage as r}from"./gtk-image.js";import{classNameWith as i}from"./style-classes.js";import{attachRowPressFeedback as a}from"./row-press.js";import{AdwStyledLayoutBase as o}from"./styled-layout-base.js";import{resolveIdReference as s}from"./id-reference.js";import{checkActivationFlips as c,checkGroupNeighbours as l,isRadioCheck as u,labelDisplayText as d,setCheckGroup as f}from"@gjsify/adwaita-core";import{GridLayout as p,ItemSpec as m,Label as h}from"@nativescript/core";import{objectSelectSymbolic as g}from"@gjsify/adwaita-icons/actions";const _=`toggled`,v=`activate`,y=`notify::active`,b=`checked`,x=`inconsistent`;var S=class GtkCheckButton extends o{static GTypeName=`GtkCheckButton`;static emittedSignals=[_,v,y];static builderSlots=e([`child`],`child`);static builderReferences=[`group`];_indicator;_mark;_text;_active=!1;_inconsistent=!1;_label=null;_useUnderline=!1;_child=null;_groupId=null;_contentUnit=`auto`;constructor(e){super(),this.addColumn(new m(1,`auto`)),this.addColumn(new m(1,`auto`)),this.addRow(new m(1,`auto`));let t=new p;t.className=`adw-check-indicator`,t.addColumn(new m(1,`star`)),t.addRow(new m(1,`star`)),t.verticalAlignment=`middle`,p.setColumn(t,0),p.setRow(t,0);let i=new r;i.iconName=g,i.pixelSize=14,i.iconColor=`#ffffff`,i.horizontalAlignment=`center`,i.verticalAlignment=`middle`,i.visibility=`collapse`,t.addChild(i),this.addChild(t),this._indicator=t,this._mark=i;let o=new h;o.className=`adw-check-label`,o.verticalAlignment=`middle`,o.visibility=`collapse`,p.setColumn(o,1),p.setRow(o,0),this.addChild(o),this._text=o,this.addEventListener(`loaded`,()=>this._resolveGroupId()),a(this),this.addEventListener(`tap`,()=>{c(this,this._active)&&(this._inconsistent=!1,this.active=!this._active,this._restyle(),this.notify({eventName:v,object:this}))}),this._restyle(),n(this,e)}get active(){return this._active}set active(e){let n=t(e,this._active);if(n!==this._active){if(n)for(let e of l(this))e.active=!1;this._active=n,this._restyle(),this.notify({eventName:_,object:this}),this.notify({eventName:y,object:this})}}set group(e){if(typeof e==`string`){this._groupId=e,this.isLoaded&&this.set_group(s(this,`group`,e,GtkCheckButton));return}this._groupId=null,this.set_group(e)}set_group(e){f(this,e),this._restyle(),e?._restyle()}_resolveGroupId(){let e=this._groupId;e!==null&&(this._groupId=null,this.set_group(s(this,`group`,e,GtkCheckButton)))}get inconsistent(){return this._inconsistent}set inconsistent(e){let n=t(e,this._inconsistent);n!==this._inconsistent&&(this._inconsistent=n,this._restyle(),this.notify({eventName:`notify::inconsistent`,object:this}))}get label(){return this._label}set label(e){this._label=e??null,this._paintLabel()}get useUnderline(){return this._useUnderline}set useUnderline(e){this._useUnderline=!!t(e,this._useUnderline),this._paintLabel()}_paintLabel(){this._text.text=d(this._label??``,!1,this._useUnderline),this._syncContent()}get child(){return this._child}set child(e){let t=e??null;t!==this._child&&(this._child&&this.removeChild(this._child),this._child=t,t&&(p.setColumn(t,1),p.setRow(t,0),this.addChild(t)),this._syncContent())}set_child(e){this.child=e}get_child(){return this._child}get_active(){return this._active}set_active(e){this.active=e}_addChildFromBuilder(e,t){this.child=t}_syncContent(){let e=!!this._child||!!this._label;this._text.visibility=!this._child&&this._label?`visible`:`collapse`;let t=e?`star`:`auto`;t!==this._contentUnit&&(this._contentUnit=t,this.removeColumns(),this.addColumn(new m(1,`auto`)),this.addColumn(new m(1,t)))}get _ownClass(){return`adw-check-button`}_restyle(){let e=[];this._active&&e.push(b),this._inconsistent&&e.push(x),this.className=i(this._ownClass,[...this.styleClasses,...e]),this._indicator.className=i(`adw-check-indicator`,u(this)?[...e,`radio`]:e),this._mark.visibility=this._active||this._inconsistent?`visible`:`collapse`}};export{v as GTK_CHECK_BUTTON_ACTIVATE,b as GTK_CHECK_BUTTON_CHECKED_CLASS,x as GTK_CHECK_BUTTON_INCONSISTENT_CLASS,_ as GTK_CHECK_BUTTON_TOGGLED,S as GtkCheckButton,y as NOTIFY_CHECK_ACTIVE};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlNumber as t}from"./xml-values.js";import{AdwStyledLayoutBase as n}from"./styled-layout-base.js";const r=`Gtk.DrawingArea.set_draw_func is not supported on NativeScript: there is no cairo context to draw into. Render through a NativeScript view (an Image, or @nativescript/canvas) instead.`;var GtkDrawingArea=class extends n{static GTypeName=`GtkDrawingArea`;_contentWidth=0;_contentHeight=0;constructor(t){super(),e(this,t)}get contentWidth(){return this._contentWidth}set contentWidth(e){let n=Math.max(0,Math.trunc(t(e,this._contentWidth)));this._contentWidth=n,this.minWidth=n}get contentHeight(){return this._contentHeight}set contentHeight(e){let n=Math.max(0,Math.trunc(t(e,this._contentHeight)));this._contentHeight=n,this.minHeight=n}set_draw_func(e){throw Error(r)}queue_draw(){}};export{r as DRAWING_AREA_REFUSAL,GtkDrawingArea};
1
+ import"../_virtual/_rolldown/runtime.js";import{xmlNumber as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{AdwStyledLayoutBase as n}from"./styled-layout-base.js";const r=`Gtk.DrawingArea.set_draw_func is not supported on NativeScript: there is no cairo context to draw into. Render through a NativeScript view (an Image, or @nativescript/canvas) instead.`;var GtkDrawingArea=class extends n{static GTypeName=`GtkDrawingArea`;_contentWidth=0;_contentHeight=0;constructor(e){super(),t(this,e)}get contentWidth(){return this._contentWidth}set contentWidth(t){let n=Math.max(0,Math.trunc(e(t,this._contentWidth)));this._contentWidth=n,this.minWidth=n}get contentHeight(){return this._contentHeight}set contentHeight(t){let n=Math.max(0,Math.trunc(e(t,this._contentHeight)));this._contentHeight=n,this.minHeight=n}set_draw_func(e){throw Error(r)}queue_draw(){}};export{r as DRAWING_AREA_REFUSAL,GtkDrawingArea};
@@ -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{xmlNumber as r}from"./xml-values.js";import{withSignals as i}from"./signals.js";import{GtkImage as a}from"./gtk-image.js";import{attachRowPressFeedback as o}from"./row-press.js";import{ComboState as s,GjsifyOptionList as c,readModelWrite as l}from"@gjsify/adwaita-core";import{Label as u,StackLayout as d,action as f}from"@nativescript/core";import{panDownSymbolic as p}from"@gjsify/adwaita-icons/ui";const m=`notify::selected`,h=`notify::selected-item`;var GtkDropDown=class extends i(d){static GTypeName=`GtkDropDown`;static emittedSignals=[m,h];static builderSlots=e([`model`],`model`);_label;_chevron;_state=new s;_authored=c.new(null);_chooserTitle=``;constructor(e){super(),this.orientation=`horizontal`,this.className=`adw-drop-down`;let t=new u;t.className=`adw-drop-down-label`,t.text=``;let r=new a;r.className=`adw-drop-down-chevron`,r.iconName=p,this.addChild(t),this.addChild(r),this._label=t,this._chevron=r,this._state.subscribe(e=>{if(this._label.text=e.label,e.interactive)for(let t of[m,h]){let n={eventName:t,object:this,selected:e.selected,value:e.value,label:e.label};this.notify(n)}}),this.addEventListener(`tap`,()=>{this._openChooser()}),o(this),n(this,e)}async _openChooser(){if(this._state.count===0)return;let e=this._state.options.map(e=>e.label),t=await f({title:this._chooserTitle||void 0,cancelButtonText:`Cancel`,actions:e});this._state.select(e.indexOf(t))}get model(){return this._state.model}set model(e){this._state.setModel(l(e,this._authored))}get options(){return this._state.options}set_model(e){this.model=e}get_model(){return this.model}_addChildFromBuilder(e,n){if(t(e,[`model`],`child`)!==`model`)throw Error(`Gtk.DropDown takes no child widget; <${e}> is placed nowhere.`);this.model=n}get selected(){return this._state.selectedIndex}set selected(e){let t=r(e,this.selected);this._state.setSelectedIndex(t)}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 selectedItem(){return this._state.selectedItem}get_selected_item(){return this.selectedItem}get chooserTitle(){return this._chooserTitle}set chooserTitle(e){this._chooserTitle=e??``}};export{GtkDropDown,m as NOTIFY_SELECTED,h as NOTIFY_SELECTED_ITEM};
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,withSignals as a}from"./signals.js";import{GtkImage as o}from"./gtk-image.js";import{attachRowPressFeedback as s}from"./row-press.js";import{ADW_COMBO_NO_SELECTION as c,ComboState as l,GjsifyOptionList as u,ListModel as d,TYPE_OBJECT as f,readModelWrite as p}from"@gjsify/adwaita-core";import{Label as m,StackLayout as h,action as g}from"@nativescript/core";import{panDownSymbolic as _}from"@gjsify/adwaita-icons/ui";const v=`notify::selected`,y=`notify::selected-item`;var GtkDropDown=class extends a(h,{GTypeName:`GtkDropDown`,Properties:{model:{kind:`object`,valueType:d,explicitNotify:!0,blurb:`Model for the displayed items`,normalize:(e,t)=>p(e,t._authored),afterNotify:e=>e._applyModel()},selected:{kind:`int`,default:c,explicitNotify:!0,blurb:`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:f,explicitNotify:!0,blurb:`The selected item`,normalize:(e,t)=>t._state.selectedItem}}}){static GTypeName=`GtkDropDown`;static builderSlots=e([`model`],`model`);_label;_chevron;_state=new l;_authored=u.new(null);_chooserTitle=``;_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.orientation=`horizontal`,this.className=`adw-drop-down`;let t=new m;t.className=`adw-drop-down-label`,t.text=``;let i=new o;i.className=`adw-drop-down-chevron`,i.iconName=_,this.addChild(t),this.addChild(i),this._label=t,this._chevron=i,this._state.subscribe(e=>{r(this,`selected`,e.selected),r(this,`selected-item`,this._state.selectedItem),this._label.text=e.label}),this._state.subscribeNotify(e=>{r(this,e,this._valueOf(e)),this.notify(e)}),this.addEventListener(`tap`,()=>{this._openChooser()}),s(this),n(this,e)}_valueOf(e){return e===`model`?this._state.model:e===`selected`?this._state.selectedIndex:this._state.selectedItem}async _openChooser(){if(this._state.count===0)return;let e=this._state.options.map(e=>e.label),t=await g({title:this._chooserTitle||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`],`child`)!==`model`)throw Error(`Gtk.DropDown takes no child widget; <${e}> is placed nowhere.`);this.model=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}get chooserTitle(){return this._chooserTitle}set chooserTitle(e){this._chooserTitle=e??``}};export{GtkDropDown,v as NOTIFY_SELECTED,y as NOTIFY_SELECTED_ITEM};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t,xmlNumber as n}from"./xml-values.js";import{withSignals as r}from"./signals.js";import{ENTRY_ROW_MAX_LENGTH_LIMIT as i,clampEntryText as a,entryTextLength as o}from"@gjsify/adwaita-core";import{GridLayout as s,ItemSpec as c,TextField as l}from"@nativescript/core";const u=`notify::text`,d=`activate`,f=`changed`;var GtkEntry=class extends r(s){static GTypeName=`GtkEntry`;static emittedSignals=[f,u,d];_field;_text=``;_maxLength=0;constructor(t){super(),this.className=`adw-entry`,this.addColumn(new c(1,`star`)),this.addRow(new c(1,`auto`));let n=new l;n.className=`adw-entry-input`,n.set(`backgroundColor`,`transparent`),n.set(`borderWidth`,0),this.addChild(n),this._field=n,n.addEventListener(`textChange`,()=>this._applyText(this._field.text??``)),n.addEventListener(`returnPress`,()=>{let e={eventName:d,object:this};this.notify(e)}),e(this,t)}_applyText(e){let t=a(e,this._maxLength);if(this._field.text!==t&&(this._field.text=t),t===this._text)return;this._text=t;let n={eventName:u,object:this,text:t,textLength:o(t)};this.notify({eventName:f,object:this}),this.notify(n)}get text(){return this._text}set text(e){this._applyText(e??``)}get textLength(){return o(this._text)}get maxLength(){return this._maxLength}set maxLength(e){let t=n(e,this.maxLength);this._maxLength=Number.isFinite(t)?Math.min(i,Math.max(0,Math.trunc(t))):0,this._applyText(this._text)}get placeholderText(){return this._field.hint??``}set placeholderText(e){this._field.hint=e??``}get editable(){return this._field.editable}set editable(e){let n=t(e,this.editable);this._field.editable=!!n}get field(){return this._field}};export{d as ACTIVATE,f as CHANGED,GtkEntry,u as NOTIFY_TEXT};
1
+ import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{readDeclaredValue as t,withSignals as n}from"./signals.js";import{clampEntryMaxLength as r,clampEntryText as i,entryTextLength as a}from"@gjsify/adwaita-core";import{GridLayout as o,ItemSpec as s,TextField as c}from"@nativescript/core";const l=`notify::text`,u=`notify::text-length`,d=`notify::max-length`,f=`notify::placeholder-text`,p=`notify::editable`,m=`activate`,h=`changed`;var GtkEntry=class extends n(o,{GTypeName:`GtkEntry`,Properties:{text:{kind:`string`,default:``,explicitNotify:!0,blurb:`The contents of the entry`,normalize:(e,t)=>e==null?t.text:i(String(e),t.maxLength),afterNotify:e=>e._applyText()},"text-length":{kind:`uint`,default:0,blurb:`Number of characters in the text`,normalize:(e,t)=>a(t.text)},"max-length":{kind:`int`,default:0,explicitNotify:!0,blurb:`Maximum number of characters for this entry`,normalize:e=>r(t(`max-length`,`int`,e)),afterNotify:e=>e._applyMaxLength()},"placeholder-text":{kind:`string`,default:``,blurb:`Show text in the entry when it is empty and unfocused`,normalize:e=>e==null?``:String(e),changed:()=>!0,afterNotify:e=>e._applyPlaceholderText()},editable:{kind:`boolean`,default:!0,blurb:`Whether the entry contents can be edited`,afterNotify:e=>e._applyEditable()}},Signals:{changed:{},activate:{}}}){static GTypeName=`GtkEntry`;_field;_typing=!1;constructor(t){super(),this.className=`adw-entry`,this.addColumn(new s(1,`star`)),this.addRow(new s(1,`auto`));let n=new c;n.className=`adw-entry-input`,n.set(`backgroundColor`,`transparent`),n.set(`borderWidth`,0),this.addChild(n),this._field=n,n.addEventListener(`textChange`,()=>{let e=this._typing;this._typing=!0;try{this.text=this._field.text??``}finally{this._typing=e}}),n.addEventListener(`returnPress`,()=>this.emit(m)),e(this,t)}_applyText(){let e=this._typing,t=this.text;this._field.text!==t&&(this._field.text=t),e?(this.notify(`text`),this.emit(h)):(this.emit(h),this.notify(`text`)),this.textLength=a(t)}_applyMaxLength(){let e=this.text;this.text=e,this.notify(`max-length`)}_applyPlaceholderText(){this._field.hint=this.placeholderText}_applyEditable(){this._field.editable=this.editable}get_text(){return this.text}set_text(e){this.text=e}get_max_length(){return this.maxLength}set_max_length(e){this.maxLength=e}get field(){return this._field}};export{m as ACTIVATE,h as CHANGED,GtkEntry,p as NOTIFY_EDITABLE,d as NOTIFY_MAX_LENGTH,f as NOTIFY_PLACEHOLDER_TEXT,l as NOTIFY_TEXT,u as NOTIFY_TEXT_LENGTH};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{lengthValue as t}from"./ns-length.js";import{xmlBoolean as n,xmlNumber as r}from"./xml-values.js";import{AdwStyledLayoutBase as i}from"./styled-layout-base.js";import{gridChildAt as a,gridGap as o,gridSpacing as s,gridTrackCounts as c}from"./grid-state.js";import{GridLayout as l,ItemSpec as u}from"@nativescript/core";const d=[`colChange`,`rowChange`,`colSpanChange`,`rowSpanChange`];var GtkGrid=class extends i{static GTypeName=`GtkGrid`;_rowSpacing=0;_columnSpacing=0;_rowHomogeneous=!1;_columnHomogeneous=!1;_columnKey=``;_rowKey=``;_gaps=new Map;_followers=new Map;constructor(t){super(),e(this,t)}attach(e,t,n,r=1,i=1){e.column=t,e.row=n,e.columnSpan=r,e.rowSpan=i,this.addChild(e)}remove(e){this.removeChild(e)}get_child_at(e,t){return a(this._placed(),e,t)}addChild(e){super.addChild(e),this._follow(e),this._relayout()}insertChild(e,t){let n=super.insertChild(e,t);return this._follow(e),this._relayout(),n}removeChild(e){this._unfollow(e),super.removeChild(e),this._relayout()}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){let t=s(r(e,NaN),e,this._rowSpacing,`rowSpacing`);t!==this._rowSpacing&&(this._rowSpacing=t,this._relayout())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){let t=s(r(e,NaN),e,this._columnSpacing,`columnSpacing`);t!==this._columnSpacing&&(this._columnSpacing=t,this._relayout())}get rowHomogeneous(){return this._rowHomogeneous}set rowHomogeneous(e){let t=n(e,this._rowHomogeneous);t!==this._rowHomogeneous&&(this._rowHomogeneous=t,this._relayout())}get columnHomogeneous(){return this._columnHomogeneous}set columnHomogeneous(e){let t=n(e,this._columnHomogeneous);t!==this._columnHomogeneous&&(this._columnHomogeneous=t,this._relayout())}_childViews(){let e=[];for(let t=0;t<this.getChildrenCount();t++)e.push(this.getChildAt(t));return e}_placementOf(e){return{column:l.getColumn(e),row:l.getRow(e),columnSpan:l.getColumnSpan(e),rowSpan:l.getRowSpan(e)}}_placed(){return this._childViews().map(e=>({child:e,placement:this._placementOf(e)}))}_follow(e){if(this._followers.has(e))return;let follower=()=>this._relayout();this._followers.set(e,follower);for(let t of d)e.addEventListener(t,follower)}_unfollow(e){let t=this._followers.get(e);if(t!==void 0){for(let n of d)e.removeEventListener(n,t);this._followers.delete(e),this._withGap(e,{left:0,top:0}),this._gaps.delete(e)}}_withGap(e,n){let r=this._gaps.get(e)??{left:0,top:0};r.left!==n.left&&(e.marginLeft=(t(e.marginLeft)??0)-r.left+n.left),r.top!==n.top&&(e.marginTop=(t(e.marginTop)??0)-r.top+n.top),this._gaps.set(e,n)}_relayout(){let e=this._placed(),{columns:t,rows:n}=c(e.map(({placement:e})=>e));this._syncTracks(t,n);for(let{child:t,placement:n}of e)this._withGap(t,o(n,this._columnSpacing,this._rowSpacing))}_syncTracks(e,t){let n=`${e}:${this._columnHomogeneous}`,r=`${t}:${this._rowHomogeneous}`;if(n!==this._columnKey){this.removeColumns();for(let t=0;t<e;t++)this.addColumn(new u(1,this._columnHomogeneous?`star`:`auto`));this._columnKey=n}if(r!==this._rowKey){this.removeRows();for(let e=0;e<t;e++)this.addRow(new u(1,this._rowHomogeneous?`star`:`auto`));this._rowKey=r}}};export{GtkGrid};
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{lengthValue as r}from"./ns-length.js";import{AdwStyledLayoutBase as i}from"./styled-layout-base.js";import{gridChildAt as a,gridGap as o,gridSpacing as s,gridTrackCounts as c}from"./grid-state.js";import{GridLayout as l,ItemSpec as u}from"@nativescript/core";const d=[`colChange`,`rowChange`,`colSpanChange`,`rowSpanChange`];var GtkGrid=class extends i{static GTypeName=`GtkGrid`;_rowSpacing=0;_columnSpacing=0;_rowHomogeneous=!1;_columnHomogeneous=!1;_columnKey=``;_rowKey=``;_gaps=new Map;_followers=new Map;constructor(e){super(),n(this,e)}attach(e,t,n,r=1,i=1){e.column=t,e.row=n,e.columnSpan=r,e.rowSpan=i,this.addChild(e)}remove(e){this.removeChild(e)}get_child_at(e,t){return a(this._placed(),e,t)}addChild(e){super.addChild(e),this._follow(e),this._relayout()}insertChild(e,t){let n=super.insertChild(e,t);return this._follow(e),this._relayout(),n}removeChild(e){this._unfollow(e),super.removeChild(e),this._relayout()}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){let n=s(t(e,NaN),e,this._rowSpacing,`rowSpacing`);n!==this._rowSpacing&&(this._rowSpacing=n,this._relayout())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){let n=s(t(e,NaN),e,this._columnSpacing,`columnSpacing`);n!==this._columnSpacing&&(this._columnSpacing=n,this._relayout())}get rowHomogeneous(){return this._rowHomogeneous}set rowHomogeneous(t){let n=e(t,this._rowHomogeneous);n!==this._rowHomogeneous&&(this._rowHomogeneous=n,this._relayout())}get columnHomogeneous(){return this._columnHomogeneous}set columnHomogeneous(t){let n=e(t,this._columnHomogeneous);n!==this._columnHomogeneous&&(this._columnHomogeneous=n,this._relayout())}_childViews(){let e=[];for(let t=0;t<this.getChildrenCount();t++)e.push(this.getChildAt(t));return e}_placementOf(e){return{column:l.getColumn(e),row:l.getRow(e),columnSpan:l.getColumnSpan(e),rowSpan:l.getRowSpan(e)}}_placed(){return this._childViews().map(e=>({child:e,placement:this._placementOf(e)}))}_follow(e){if(this._followers.has(e))return;let follower=()=>this._relayout();this._followers.set(e,follower);for(let t of d)e.addEventListener(t,follower)}_unfollow(e){let t=this._followers.get(e);if(t!==void 0){for(let n of d)e.removeEventListener(n,t);this._followers.delete(e),this._withGap(e,{left:0,top:0}),this._gaps.delete(e)}}_withGap(e,t){let n=this._gaps.get(e)??{left:0,top:0};n.left!==t.left&&(e.marginLeft=(r(e.marginLeft)??0)-n.left+t.left),n.top!==t.top&&(e.marginTop=(r(e.marginTop)??0)-n.top+t.top),this._gaps.set(e,t)}_relayout(){let e=this._placed(),{columns:t,rows:n}=c(e.map(({placement:e})=>e));this._syncTracks(t,n);for(let{child:t,placement:n}of e)this._withGap(t,o(n,this._columnSpacing,this._rowSpacing))}_syncTracks(e,t){let n=`${e}:${this._columnHomogeneous}`,r=`${t}:${this._rowHomogeneous}`;if(n!==this._columnKey){this.removeColumns();for(let t=0;t<e;t++)this.addColumn(new u(1,this._columnHomogeneous?`star`:`auto`));this._columnKey=n}if(r!==this._rowKey){this.removeRows();for(let e=0;e<t;e++)this.addRow(new u(1,this._rowHomogeneous?`star`:`auto`));this._rowKey=r}}};export{GtkGrid};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";const e=[`inherit`,`normal`,`large`],t={inherit:16,normal:16,large:32},n=t.inherit,r=Object.freeze(Object.fromEntries(e.map((e,t)=>[e,t])));function isGtkIconSizeNick(t){return typeof t==`string`&&e.includes(t)}function iconSizeNickOf(t){if(typeof t!=`number`)return t;let n=e.find(e=>r[e]===t);if(n!==void 0)return n;throw TypeError(`${t} is not a Gtk.IconSize constant. The three members are ${e.join(`, `)}, holding the values ${e.map(e=>r[e]).join(`, `)}. For a size in DIPs use \`pixelSize\`, which is what \`Gtk.Image:pixel-size\` is.`)}function gtkIconSizeNick(t,n){if(isGtkIconSizeNick(t))return t;throw TypeError(`Gtk.IconSize: ${JSON.stringify(t)} is not a member — it takes one of ${e.join(`, `)} (staying at '${n}'). For a size in DIPs use \`pixelSize\`, which is what \`Gtk.Image:pixel-size\` is.`)}const i=-1;function storedPixelSize(e){return Number.isFinite(e)&&e>0?e:-1}function iconPixelSize(e,n){return Number.isFinite(n)&&n>0?n:t[e]}export{n as DEFAULT_ICON_PIXEL_SIZE,r as GTK_ICON_SIZE,e as GTK_ICON_SIZE_NICKS,t as GTK_ICON_SIZE_PIXELS,i as PIXEL_SIZE_UNSET,gtkIconSizeNick,iconPixelSize,iconSizeNickOf,isGtkIconSizeNick,storedPixelSize};
1
+ import"../_virtual/_rolldown/runtime.js";import{gtkBuilderInteger as e}from"./xml-values.js";const t=[`inherit`,`normal`,`large`],n={inherit:16,normal:16,large:32},r=n.inherit,i=Object.freeze(Object.fromEntries(t.map((e,t)=>[e,t])));function isGtkIconSizeNick(e){return typeof e==`string`&&t.includes(e)}function iconSizeNickOf(e){if(typeof e!=`number`)return e;let n=t.find(t=>i[t]===e);if(n!==void 0)return n;throw TypeError(`${e} is not a Gtk.IconSize constant. The three members are ${t.join(`, `)}, holding the values ${t.map(e=>i[e]).join(`, `)}. For a size in DIPs use \`pixelSize\`, which is what \`Gtk.Image:pixel-size\` is.`)}function gtkIconSizeNick(n,r){if(isGtkIconSizeNick(n))return n;let i=typeof n==`string`?e(n):void 0;if(i!==void 0){let e=iconSizeNickOf(i);if(isGtkIconSizeNick(e))return e}throw TypeError(`Gtk.IconSize: ${JSON.stringify(n)} is not a member — it takes one of ${t.join(`, `)} (staying at '${r}'). For a size in DIPs use \`pixelSize\`, which is what \`Gtk.Image:pixel-size\` is.`)}const a=-1;function storedPixelSize(e){return Number.isFinite(e)&&e>0?e:-1}function iconPixelSize(e,t){return Number.isFinite(t)&&t>0?t:n[e]}export{r as DEFAULT_ICON_PIXEL_SIZE,i as GTK_ICON_SIZE,t as GTK_ICON_SIZE_NICKS,n as GTK_ICON_SIZE_PIXELS,a as PIXEL_SIZE_UNSET,gtkIconSizeNick,iconPixelSize,iconSizeNickOf,isGtkIconSizeNick,storedPixelSize};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{DEFAULT_ICON_PIXEL_SIZE as e,gtkIconSizeNick as t,iconPixelSize as n,storedPixelSize as r}from"./gtk-icon-size.js";import{applyConstructProps as i}from"./construct-props.js";import{xmlNumber as a}from"./xml-values.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{Image as f}from"@nativescript/core";const p=e;var GtkImage=class extends o(f){static GTypeName=`GtkImage`;_icon=``;_iconColor=c();_explicitColor=!1;_iconSize=`inherit`;_pixelSize=-1;_unsubScheme=null;_unsubIcons=null;constructor(e){super(),this.className=`adw-icon`,this.stretch=`aspectFit`,this._applySize(),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}),i(this,e)}_syncThemeColor(){if(this._explicitColor)return;let e=c();e!==this._iconColor&&(this._iconColor=e,this._render())}get _renderedSize(){return n(this._iconSize,this._pixelSize)}_applySize(){let e=this._renderedSize;this.width=e,this.height=e,this._render()}_render(){u(this,this._icon,this._renderedSize,this._iconColor)}get iconName(){return this._icon}set iconName(e){this._icon=e??``,this._render()}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=t(e,this._iconSize),this._applySize()}get pixelSize(){return this._pixelSize}set pixelSize(e){this._pixelSize=r(a(e,this._pixelSize)),this._applySize()}};export{p as DEFAULT_GTK_IMAGE_SIZE,GtkImage};
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{Image as f}from"@nativescript/core";const p=t;var GtkImage=class extends o(f){static GTypeName=`GtkImage`;_icon=``;_iconColor=c();_explicitColor=!1;_iconSize=`inherit`;_pixelSize=-1;_unsubScheme=null;_unsubIcons=null;constructor(e){super(),this.className=`adw-icon`,this.stretch=`aspectFit`,this._applySize(),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.width=e,this.height=e,this._render()}_render(){u(this,this._icon,this._renderedSize,this._iconColor)}get iconName(){return this._icon}set iconName(e){this._icon=e??``,this._render()}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()}};export{p as DEFAULT_GTK_IMAGE_SIZE,GtkImage};
@@ -1,2 +1,2 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t,xmlNumber as n}from"./xml-values.js";import{androidApiLevel as r}from"./native-tooltip.js";import{withSignals as i}from"./signals.js";import{nativePlatformHost as a}from"../platform-host.js";import{classNameWith as o,normalizeStyleClasses as s,withCssClass as c,withoutCssClass as l}from"./style-classes.js";import{labelMarkupFormattedString as u,labelMarkupNeedsSpans as d}from"./label-markup.js";import{DEFAULT_LABEL_LINES as f,DEFAULT_LABEL_XALIGN as p,HandledAccumulator as m,LABEL_JUSTIFICATIONS as h,createAppInfo as g,labelActivateLink as _,labelDisplayText as v,labelEffectiveLines as y,labelEllipsizeOverflowValue as b,labelHasLinks as x,labelLinkVisited as S,labelMarkupRender as C,normalizeLabelEllipsize as w,normalizeLabelLines as T,normalizeLabelXalign as E}from"@gjsify/adwaita-core";import{Label as D}from"@nativescript/core";const O=`activate-link`,k=g(a),A=new Map([[0,`start`],[.5,`center`],[1,`end`]]),j={left:`start`,right:`end`,center:`center`,fill:`start`};function physical(e,t){return e===`center`?`center`:e===`start`===t?`right`:`left`}var GtkLabel=class extends i(D){static GTypeName=`GtkLabel`;_label=``;_useMarkup=!1;_useUnderline=!1;_ellipsize=`none`;_lines=-1;_styleClasses=[];_xalign=p;_xalignWritten=!1;_justify=`left`;_selectable=!1;_links=[];constructor(t){super(),this.addEventListener(`loaded`,()=>{this._applySelectable(),this._applyJustificationMode()}),e(this,t)}get label(){return this._label}set label(e){this._label=e??``,this._render()}get useMarkup(){return this._useMarkup}set useMarkup(e){this._useMarkup=t(e,this._useMarkup),this._render()}get useUnderline(){return this._useUnderline}set useUnderline(e){this._useUnderline=t(e,this._useUnderline),this._render()}get wrap(){return this.textWrap}set wrap(e){let n=t(e,this.textWrap);this._applyAlignment({wrap:n}),this.textWrap=n}get ellipsize(){return this._ellipsize}set ellipsize(e){this._ellipsize=w(e),this.textOverflow=b(this._ellipsize),this._applyLines()}get lines(){return this._lines}set lines(e){this._lines=T(n(e,f)),this._applyLines()}get selectable(){return this._selectable}set selectable(e){this._selectable=t(e,this._selectable),this._applySelectable()}_applySelectable(){this.nativeViewProtected?.setTextIsSelectable?.(this._selectable)}_applyLines(){this.maxLines=y(this._lines,this._ellipsize)??0}get justify(){return this._justify}set justify(e){let t=h.includes(e)?e:h[n(e,-1)];if(t===void 0)throw TypeError(`'${String(e)}' is not a Gtk.Justification, so it cannot be 'justify'. The members are ${h.join(`, `)}, or their values 0 to 3.`);this._applyAlignment({justify:t})}get xalign(){return this._xalign}set xalign(e){let t=E(n(e,p));if(!A.has(t))throw TypeError(`Gtk.Label xalign ${t} has no NativeScript counterpart: textAlignment places text at the start, the centre or the end, so only 0, 0.5 and 1 render as written. Snapping it would show a different label than GTK does with no sign of the difference.`);this._applyAlignment({xalign:t})}_applyAlignment(e){let t=e.xalign??(this._xalignWritten?this._xalign:null),n=e.justify??this._justify,r=e.text??this.text??``,i=(e.wrap??this.textWrap)||r.includes(`
2
- `),a=j[n],o=t===null?null:A.get(t),s;if(o===null)s=n===`left`?null:a;else if(o===a||!i||n===`left`)s=o;else throw TypeError(`Gtk.Label justify ${n} beside xalign ${t} has no NativeScript counterpart on a label that can show several lines: GTK places the text block at its ${o} and aligns the lines inside it to their ${a}, and textAlignment is one alignment for both. An xalign on the justify edge, or a label without wrap and newline, renders exactly.`);if(e.xalign!==void 0&&(this._xalign=e.xalign,this._xalignWritten=!0),e.justify!==void 0&&(this._justify=e.justify),s===null){(e.xalign!==void 0||e.justify!==void 0)&&(this.textAlignment=`initial`);return}let c=physical(s,this.style?.direction===`rtl`);this.textAlignment=n===`fill`&&c===`left`?`justify`:c,this._applyJustificationMode()}_applyJustificationMode(){this.textAlignment===`justify`||r()<26||this.nativeViewProtected?.setJustificationMode?.(+(this._justify===`fill`))}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(s(e))}get_label(){return this.label}set_label(e){this.label=e}set_markup(e){this._label=e??``,this._useMarkup=!0,this._render()}get_text(){return this.text??``}add_css_class(e){this._setClasses(c(this._styleClasses,e))}remove_css_class(e){this._setClasses(l(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(s([...e].join(` `)))}_setClasses(e){this._styleClasses=[...e],this.className=o(``,this._styleClasses)}_render(){let e=this._useMarkup?C(this._label,this._links):null;this._links=e?.links??[];let t=v(this._label,this._useMarkup,this._useUnderline);this._applyAlignment({text:t});let n=x(this._links);if(n!==this._styleClasses.includes(`link`)&&this._setClasses(n?c(this._styleClasses,`link`):l(this._styleClasses,`link`)),e!==null&&d(e)){this.text=t,this.formattedText=u(e,this._useUnderline,this.style.fontSize,e=>this._activateLink(e));return}this.formattedText!==null&&this.formattedText!==void 0&&(this.formattedText=null),this.text=t}_activateLink(e){let t=this._links[e];t!==void 0&&_(t.href,{rooted:this.isLoaded,emit:()=>{let e=new m;return this.notify({eventName:O,object:this,uri:t.href,accumulator:e}),e.stopped},launch:e=>this.launch(e)})&&(this._links=S(this._links,e))}launch(e){try{k.launch_default_for_uri(e,null)}catch{}}};export{O as ACTIVATE_LINK,GtkLabel};
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{androidApiLevel as r}from"./native-tooltip.js";import{withSignals as i}from"./signals.js";import{nativePlatformHost as a}from"../platform-host.js";import{classNameWith as o,normalizeStyleClasses as s,withCssClass as c,withoutCssClass as l}from"./style-classes.js";import{labelMarkupFormattedString as u,labelMarkupNeedsSpans as d}from"./label-markup.js";import{labelMarkupDrawNative as f,labelMarkupHoldNative as p}from"./label-markup-native.js";import{DEFAULT_LABEL_LINES as m,DEFAULT_LABEL_XALIGN as h,HandledAccumulator as g,LABEL_JUSTIFICATIONS as _,createAppInfo as v,labelActivateLink as y,labelDisplayText as b,labelEffectiveLines as x,labelEllipsizeOverflowValue as S,labelHasLinks as C,labelLinkVisited as w,labelMarkupRender as T,normalizeLabelEllipsize as E,normalizeLabelLines as D,normalizeLabelXalign as O}from"@gjsify/adwaita-core";import{Label as k}from"@nativescript/core";const A=`activate-link`,j=v(a),M=new Map([[0,`start`],[.5,`center`],[1,`end`]]),N={left:`start`,right:`end`,center:`center`,fill:`start`};function physical(e,t){return e===`center`?`center`:e===`start`===t?`right`:`left`}function applyTemplateXalign(e,t){e.textAlignment=t===0?`initial`:`center`}var GtkLabel=class extends i(k){static GTypeName=`GtkLabel`;_label=``;_useMarkup=!1;_useUnderline=!1;_ellipsize=`none`;_lines=-1;_styleClasses=[];_xalign=h;_xalignWritten=!1;_justify=`left`;_selectable=!1;_links=[];constructor(e){super(),this.addEventListener(`loaded`,()=>{this._applySelectable(),this._applyJustificationMode()}),this._applyAlignment({}),n(this,e)}get label(){return this._label}set label(e){this._label=e??``,this._render()}get useMarkup(){return this._useMarkup}set useMarkup(t){this._useMarkup=e(t,this._useMarkup),this._render()}get useUnderline(){return this._useUnderline}set useUnderline(t){this._useUnderline=e(t,this._useUnderline),this._render()}get wrap(){return this.textWrap}set wrap(t){let n=e(t,this.textWrap);this._applyAlignment({wrap:n}),this.textWrap=n}get ellipsize(){return this._ellipsize}set ellipsize(e){this._ellipsize=E(e),this.textOverflow=S(this._ellipsize),this._applyLines()}get lines(){return this._lines}set lines(e){this._lines=D(t(e,m)),this._applyLines()}get selectable(){return this._selectable}set selectable(t){this._selectable=e(t,this._selectable),this._applySelectable()}_applySelectable(){this.nativeViewProtected?.setTextIsSelectable?.(this._selectable)}_applyLines(){this.maxLines=x(this._lines,this._ellipsize)??0}get justify(){return this._justify}set justify(e){let n=_.includes(e)?e:_[t(e,-1)];if(n===void 0)throw TypeError(`'${String(e)}' is not a Gtk.Justification, so it cannot be 'justify'. The members are ${_.join(`, `)}, or their values 0 to 3.`);this._applyAlignment({justify:n})}get xalign(){return this._xalign}set xalign(e){let n=O(t(e,h));if(!M.has(n))throw TypeError(`Gtk.Label xalign ${n} has no NativeScript counterpart: textAlignment places text at the start, the centre or the end, so only 0, 0.5 and 1 render as written. Snapping it would show a different label than GTK does with no sign of the difference.`);this._applyAlignment({xalign:n})}_applyAlignment(e){let t=e.xalign??this._xalign,n=e.xalign!==void 0||this._xalignWritten,r=e.justify??this._justify,i=e.text??this.text??``,a=(e.wrap??this.textWrap)||i.includes(`
2
+ `),o=N[r],s=M.get(t),c;if(s===o||!a||r===`left`)c=s;else if(!n)c=o;else throw TypeError(`Gtk.Label justify ${r} beside xalign ${t} has no NativeScript counterpart on a label that can show several lines: GTK places the text block at its ${s} and aligns the lines inside it to their ${o}, and textAlignment is one alignment for both. An xalign on the justify edge, or a label without wrap and newline, renders exactly.`);e.xalign!==void 0&&(this._xalign=e.xalign,this._xalignWritten=!0),e.justify!==void 0&&(this._justify=e.justify);let l=physical(c,this.style?.direction===`rtl`);this.textAlignment=r===`fill`&&l===`left`?`justify`:l,this._applyJustificationMode()}_applyJustificationMode(){this.textAlignment===`justify`||r()<26||this.nativeViewProtected?.setJustificationMode?.(+(this._justify===`fill`))}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(s(e))}get_label(){return this.label}set_label(e){this.label=e}set_markup(e){this._label=e??``,this._useMarkup=!0,this._render()}get_text(){return this.text??``}add_css_class(e){this._setClasses(c(this._styleClasses,e))}remove_css_class(e){this._setClasses(l(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(s([...e].join(` `)))}_setClasses(e){this._styleClasses=[...e],this.className=o(``,this._styleClasses)}_render(){let e=this._useMarkup?T(this._label,this._links):null;this._links=e?.links??[];let t=b(this._label,this._useMarkup,this._useUnderline);this._applyAlignment({text:t});let n=C(this._links);if(n!==this._styleClasses.includes(`link`)&&this._setClasses(n?c(this._styleClasses,`link`):l(this._styleClasses,`link`)),e!==null&&d(e)){if(p(this,{render:e,mnemonics:this._useUnderline,onLinkTap:e=>this._activateLink(e)})){this.formattedText!==null&&this.formattedText!==void 0&&(this.formattedText=null),this.text=t;return}this.text=t,this.formattedText=u(e,this._useUnderline,this.style.fontSize,e=>this._activateLink(e));return}p(this,null),this.formattedText!==null&&this.formattedText!==void 0&&(this.formattedText=null),this.text=t}_setNativeText(e=!1){f(this,e)||super._setNativeText(e)}_activateLink(e){let t=this._links[e];t!==void 0&&y(t.href,{rooted:this.isLoaded,emit:()=>{let e=new g;return this.notify({eventName:A,object:this,uri:t.href,accumulator:e}),e.stopped},launch:e=>this.launch(e)})&&(this._links=w(this._links,e))}launch(e){try{j.launch_default_for_uri(e,null)}catch{}}};export{A as ACTIVATE_LINK,GtkLabel,applyTemplateXalign};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.js";import{ACTIVATED as n}from"./adw-action-row.js";import{addMarkerClass as r,removeMarkerClass as i}from"./bottom-sheet-state.js";import{AdwStyledLayoutBase as a}from"./styled-layout-base.js";import{DEFAULT_LIST_SELECTION_MODE as o,selectionAfterModeChange as s,selectionAfterTap as c,selectionMode as l}from"./list-box-state.js";import{GridLayout as u,ItemSpec as d}from"@nativescript/core";const f=`row-activated`,p=`row-selected`,m=`adw-list-row-selected`,h=`adw-row-flush-top`;function markRow(e,t,n){let a=n?r(e.className,t):i(e.className,t);a!==(e.className??``)&&(e.className=a)}var GtkListBox=class extends a{static GTypeName=`GtkListBox`;_selectionMode=o;_activateOnSingleClick=!0;_showSeparators=!1;_acceptUnpairedRelease=!1;_selected=[];_listeners=new Map;constructor(t){super(),this.addColumn(new d(1,`star`)),e(this,t)}append(e){this.addChild(e)}prepend(e){this.insert(e,0)}insert(e,t){let n=this.getChildrenCount();if(t<0||t>=n){this.addChild(e);return}this.insertChild(e,t)}remove(e){this.removeChild(e)}remove_all(){for(let e of this._rowViews())this.removeChild(e)}get_row_at_index(e){return this._rowViews()[e]??null}addChild(e){super.addChild(e),this._adopt(e)}insertChild(e,t){let n=super.insertChild(e,t);return this._adopt(e),n}removeChild(e){this._release(e),super.removeChild(e),this._renumber()}_addChildFromBuilder(e,t){this.append(t)}get_selected_row(){return this._selected[0]??null}get_selected_rows(){return this._rowViews().filter(e=>this._selected.includes(e))}select_row(e){if(e===null){this.unselect_all();return}this._selectionMode===`none`||!this._rowViews().includes(e)||this._setSelected(this._selectionMode===`multiple`?[...this._selected,e]:[e])}unselect_row(e){this._setSelected(this._selected.filter(t=>t!==e))}select_all(){this._selectionMode===`multiple`&&this._setSelected(this._rowViews())}unselect_all(){this._setSelected([])}get selectionMode(){return this._selectionMode}set selectionMode(e){this._selectionMode=l(e),this._setSelected(s(this._selectionMode,this._selected))}get activateOnSingleClick(){return this._activateOnSingleClick}set activateOnSingleClick(e){this._activateOnSingleClick=t(e,this._activateOnSingleClick)}get showSeparators(){return this._showSeparators}set showSeparators(e){this._showSeparators=t(e,this._showSeparators)}get acceptUnpairedRelease(){return this._acceptUnpairedRelease}set acceptUnpairedRelease(e){this._acceptUnpairedRelease=t(e,this._acceptUnpairedRelease)}_rowViews(){let e=[];for(let t=0;t<this.getChildrenCount();t++)e.push(this.getChildAt(t));return e}_renumber(){let e=this._rowViews();this.removeRows();for(let[t,n]of e.entries())this.addRow(new d(1,`auto`)),u.setColumn(n,0),u.setRow(n,t),markRow(n,h,t===0)}_adopt(e){if(this._renumber(),this._listeners.has(e))return;let t={tap:()=>{this._tapped(e),`activatable`in e||this._activated(e)},activated:()=>this._activated(e)};this._listeners.set(e,t),e.addEventListener(`tap`,t.tap),e.addEventListener(n,t.activated)}_release(e){let t=this._listeners.get(e);t!==void 0&&(e.removeEventListener(`tap`,t.tap),e.removeEventListener(n,t.activated),this._listeners.delete(e)),markRow(e,h,!1),markRow(e,m,!1),this._selected.includes(e)&&this._setSelected(this._selected.filter(t=>t!==e))}_tapped(e){this._setSelected(c(this._selectionMode,this._selected,e))}_activated(e){let t={eventName:f,object:this,row:e};this.notify(t)}_setSelected(e){let t=this._selected;if(t.length===e.length&&t.every((t,n)=>t===e[n]))return;for(let n of t)e.includes(n)||markRow(n,m,!1);for(let t of e)markRow(t,m,!0);this._selected=[...e];let n={eventName:p,object:this,row:this._selected[0]??null};this.notify(n)}};export{GtkListBox,f as LIST_BOX_ROW_ACTIVATED,p as LIST_BOX_ROW_SELECTED,m as LIST_ROW_SELECTED_CLASS};
1
+ import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{ACTIVATED as n}from"./adw-action-row.js";import{addMarkerClass as r,removeMarkerClass as i}from"./bottom-sheet-state.js";import{AdwStyledLayoutBase as a}from"./styled-layout-base.js";import{DEFAULT_LIST_SELECTION_MODE as o,selectionAfterModeChange as s,selectionAfterTap as c,selectionMode as l}from"./list-box-state.js";import{GridLayout as u,ItemSpec as d}from"@nativescript/core";const f=`row-activated`,p=`row-selected`,m=`adw-list-row-selected`,h=`adw-row-flush-top`;function markRow(e,t,n){let a=n?r(e.className,t):i(e.className,t);a!==(e.className??``)&&(e.className=a)}var GtkListBox=class extends a{static GTypeName=`GtkListBox`;_selectionMode=o;_activateOnSingleClick=!0;_showSeparators=!1;_acceptUnpairedRelease=!1;_selected=[];_listeners=new Map;constructor(e){super(),this.addColumn(new d(1,`star`)),t(this,e)}append(e){this.addChild(e)}prepend(e){this.insert(e,0)}insert(e,t){let n=this.getChildrenCount();if(t<0||t>=n){this.addChild(e);return}this.insertChild(e,t)}remove(e){this.removeChild(e)}remove_all(){for(let e of this._rowViews())this.removeChild(e)}get_row_at_index(e){return this._rowViews()[e]??null}addChild(e){super.addChild(e),this._adopt(e)}insertChild(e,t){let n=super.insertChild(e,t);return this._adopt(e),n}removeChild(e){this._release(e),super.removeChild(e),this._renumber()}_addChildFromBuilder(e,t){this.append(t)}get_selected_row(){return this._selected[0]??null}get_selected_rows(){return this._rowViews().filter(e=>this._selected.includes(e))}select_row(e){if(e===null){this.unselect_all();return}this._selectionMode===`none`||!this._rowViews().includes(e)||this._setSelected(this._selectionMode===`multiple`?[...this._selected,e]:[e])}unselect_row(e){this._setSelected(this._selected.filter(t=>t!==e))}select_all(){this._selectionMode===`multiple`&&this._setSelected(this._rowViews())}unselect_all(){this._setSelected([])}get selectionMode(){return this._selectionMode}set selectionMode(e){this._selectionMode=l(e),this._setSelected(s(this._selectionMode,this._selected))}get activateOnSingleClick(){return this._activateOnSingleClick}set activateOnSingleClick(t){this._activateOnSingleClick=e(t,this._activateOnSingleClick)}get showSeparators(){return this._showSeparators}set showSeparators(t){this._showSeparators=e(t,this._showSeparators)}get acceptUnpairedRelease(){return this._acceptUnpairedRelease}set acceptUnpairedRelease(t){this._acceptUnpairedRelease=e(t,this._acceptUnpairedRelease)}_rowViews(){let e=[];for(let t=0;t<this.getChildrenCount();t++)e.push(this.getChildAt(t));return e}_renumber(){let e=this._rowViews();this.removeRows();for(let[t,n]of e.entries())this.addRow(new d(1,`auto`)),u.setColumn(n,0),u.setRow(n,t),markRow(n,h,t===0)}_adopt(e){if(this._renumber(),this._listeners.has(e))return;let t={tap:()=>{this._tapped(e),`activatable`in e||this._activated(e)},activated:()=>this._activated(e)};this._listeners.set(e,t),e.addEventListener(`tap`,t.tap),e.addEventListener(n,t.activated)}_release(e){let t=this._listeners.get(e);t!==void 0&&(e.removeEventListener(`tap`,t.tap),e.removeEventListener(n,t.activated),this._listeners.delete(e)),markRow(e,h,!1),markRow(e,m,!1),this._selected.includes(e)&&this._setSelected(this._selected.filter(t=>t!==e))}_tapped(e){this._setSelected(c(this._selectionMode,this._selected,e))}_activated(e){let t={eventName:f,object:this,row:e};this.notify(t)}_setSelected(e){let t=this._selected;if(t.length===e.length&&t.every((t,n)=>t===e[n]))return;for(let n of t)e.includes(n)||markRow(n,m,!1);for(let t of e)markRow(t,m,!0);this._selected=[...e];let n={eventName:p,object:this,row:this._selected[0]??null};this.notify(n)}};export{GtkListBox,f as LIST_BOX_ROW_ACTIVATED,p as LIST_BOX_ROW_SELECTED,m as LIST_ROW_SELECTED_CLASS};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{xmlBoolean as t}from"./xml-values.js";import{classNameWith as n,normalizeStyleClasses as r,withCssClass as i,withoutCssClass as a}from"./style-classes.js";import{AdwImageButton as o}from"./adw-image-button.js";import{assertPopupMenuAssignable as s,refuseMenuString as c}from"./popup-menu.js";import{showMenuPopup as l}from"./popup-menu-view.js";import{normalizeMenuModel as u}from"@gjsify/adwaita-core";const d=`menuItemActivated`;var GtkMenuButton=class extends o{static GTypeName=`GtkMenuButton`;_model=[];_actions=null;_menuTitle=``;_primary=!1;_baseClassName;_styleClasses=[];constructor(t){super(),this._baseClassName=`${this.className} adw-menu-button`.trim(),this.className=this._baseClassName,this.addEventListener(`tap`,()=>this._openMenu()),e(this,t)}get menuModel(){return this._model}set menuModel(e){c(e,`GtkMenuButton`);let t=u(e);s(t),this._model=t}get menu_model(){return this.menuModel}set menu_model(e){this.menuModel=e}get_menu_model(){return this.menuModel}set_menu_model(e){this.menuModel=e}get actions(){return this._actions}set actions(e){this._actions=e??null}get menuTitle(){return this._menuTitle}set menuTitle(e){this._menuTitle=e??``}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(r(e))}get primary(){return this._primary}set primary(e){this._primary=t(e,this._primary)}add_css_class(e){this._setClasses(i(this._styleClasses,e))}remove_css_class(e){this._setClasses(a(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(r([...e].join(` `)))}_setClasses(e){this._styleClasses=e,this.className=n(this._baseClassName,e)}_openMenu(){this._model.length!==0&&l(this,{model:this._model,actions:this._actions,onActivated:(e,t)=>{let n={eventName:d,object:this,id:e.id??e.label,label:e.label,path:t,action:e.action};this.notify(n)}})}};export{GtkMenuButton,d as MENU_ITEM_ACTIVATED};
1
+ import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e}from"./xml-values.js";import{applyConstructProps as t}from"./construct-props.js";import{classNameWith as n,normalizeStyleClasses as r,withCssClass as i,withoutCssClass as a}from"./style-classes.js";import{AdwImageButton as o}from"./adw-image-button.js";import{MenuSlot as s}from"./menu-slot.js";import{showMenuPopup as c}from"./popup-menu-view.js";const l=`menuItemActivated`;var GtkMenuButton=class extends o{static GTypeName=`GtkMenuButton`;_slot=new s(`GtkMenuButton`,()=>void 0);_actions=null;_menuTitle=``;_primary=!1;_baseClassName;_styleClasses=[];constructor(e){super(),this._baseClassName=`${this.className} adw-menu-button`.trim(),this.className=this._baseClassName,this.addEventListener(`tap`,()=>this._openMenu()),t(this,e)}get menuModel(){return this._slot.model}set menuModel(e){let t=this._slot.model;this._slot.write(e),this.notifyPropertyChange(`menuModel`,this._slot.model,t)}get menu_model(){return this.menuModel}set menu_model(e){this.menuModel=e}get_menu_model(){return this.menuModel}set_menu_model(e){this.menuModel=e}get actions(){return this._actions}set actions(e){this._actions=e??null}get menuTitle(){return this._menuTitle}set menuTitle(e){this._menuTitle=e??``}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(r(e))}get primary(){return this._primary}set primary(t){this._primary=e(t,this._primary)}add_css_class(e){this._setClasses(i(this._styleClasses,e))}remove_css_class(e){this._setClasses(a(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(r([...e].join(` `)))}_setClasses(e){this._styleClasses=e,this.className=n(this._baseClassName,e)}_openMenu(){this._slot.isEmpty||c(this,{tree:this._slot.tree,actions:this._actions,onActivated:(e,t)=>{let n={eventName:l,object:this,id:e.id??e.label,label:e.label,path:t,action:e.action};this.notify(n)}})}};export{GtkMenuButton,l as MENU_ITEM_ACTIVATED};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{withSignals as t}from"./signals.js";import{assertPopupMenuAssignable as n,refuseMenuString as r}from"./popup-menu.js";import{showMenuPopup as i}from"./popup-menu-view.js";import{normalizeMenuModel as a}from"@gjsify/adwaita-core";import{Observable as o}from"@nativescript/core";const s=`closed`,unsupported=(e,t)=>Error(`Gtk.PopoverMenu.${e} is not supported: ${t} (ADR 0097 § 2).`);var GtkPopoverMenu=class extends t(o){static GTypeName=`GtkPopoverMenu`;_model=[];_actions=null;_parent=null;_open=null;constructor(t){super(),e(this,t)}get menuModel(){return this._model}set menuModel(e){r(e,`GtkPopoverMenu`);let t=a(e);n(t),this._model=t}set_menu_model(e){this.menuModel=e??[]}get_menu_model(){return this._model}get actions(){return this._actions}set actions(e){this._actions=e??null}get parent(){return this._parent}set parent(e){e!==this._parent&&(this.popdown(),this._parent=e??null)}set_parent(e){this.parent=e}unparent(){this.parent=null}popup(){if(this._parent===null)throw unsupported(`popup()`,`a PopupMenu is anchored at a view, so call set_parent(widget) first`);if(this._open!==null||this._model.length===0)return;let e=i(this._parent,{model:this._model,actions:this._actions,onDismiss:()=>{this._open!==null&&(this._open=null,this.notify({eventName:s,object:this}))}});this._open=e}popdown(){this._open?.dismiss()}get hasArrow(){return!0}set hasArrow(e){if(e!==!0)throw unsupported(`has_arrow = false`,`a PopupMenu has no arrow to hide`)}get autohide(){return!0}set autohide(e){if(e!==!0)throw unsupported(`autohide = false`,`a PopupMenu always closes on an outside tap`)}get position(){return`bottom`}set position(e){if(e!==`bottom`&&e!==3)throw unsupported(`position = ${String(e)}`,`a PopupMenu opens where Android places it`)}get flags(){return`nested`}set flags(e){if(e!==`nested`)throw unsupported(`flags = ${String(e)}`,`only nested submenus exist`)}get pointingTo(){throw unsupported(`pointing_to`,`a PopupMenu is anchored at the whole parent view`)}set pointingTo(e){throw unsupported(`pointing_to`,`a PopupMenu is anchored at the whole parent view`)}get_pointing_to(){throw unsupported(`get_pointing_to()`,`a PopupMenu is anchored at the whole parent view`)}set_pointing_to(e){throw unsupported(`set_pointing_to()`,`a PopupMenu is anchored at the whole parent view`)}add_child(e,t){throw unsupported(`add_child()`,`a PopupMenu row is a title, not a widget`)}remove_child(e){throw unsupported(`remove_child()`,`a PopupMenu row is a title, not a widget`)}};export{s as CLOSED,GtkPopoverMenu};
1
+ import"../_virtual/_rolldown/runtime.js";import{applyConstructProps as e}from"./construct-props.js";import{withSignals as t}from"./signals.js";import{MenuSlot as n}from"./menu-slot.js";import{showMenuPopup as r}from"./popup-menu-view.js";import{Observable as i}from"@nativescript/core";const a=`closed`,unsupported=(e,t)=>Error(`Gtk.PopoverMenu.${e} is not supported: ${t} (ADR 0097 § 2).`);var GtkPopoverMenu=class extends t(i){static GTypeName=`GtkPopoverMenu`;_slot=new n(`GtkPopoverMenu`,()=>void 0);_actions=null;_parent=null;_open=null;constructor(t){super(),e(this,t)}get menuModel(){return this._slot.model}set menuModel(e){let t=this._slot.model;this._slot.write(e),this.notifyPropertyChange(`menuModel`,this._slot.model,t)}set_menu_model(e){this.menuModel=e}get_menu_model(){return this._slot.model}get actions(){return this._actions}set actions(e){this._actions=e??null}get parent(){return this._parent}set parent(e){e!==this._parent&&(this.popdown(),this._parent=e??null)}set_parent(e){this.parent=e}unparent(){this.parent=null}popup(){if(this._parent===null)throw unsupported(`popup()`,`a PopupMenu is anchored at a view, so call set_parent(widget) first`);if(this._open!==null||this._slot.isEmpty)return;let e=r(this._parent,{tree:this._slot.tree,actions:this._actions,onDismiss:()=>{this._open!==null&&(this._open=null,this.notify({eventName:a,object:this}))}});this._open=e}popdown(){this._open?.dismiss()}get hasArrow(){return!0}set hasArrow(e){if(e!==!0)throw unsupported(`has_arrow = false`,`a PopupMenu has no arrow to hide`)}get autohide(){return!0}set autohide(e){if(e!==!0)throw unsupported(`autohide = false`,`a PopupMenu always closes on an outside tap`)}get position(){return`bottom`}set position(e){if(e!==`bottom`&&e!==3)throw unsupported(`position = ${String(e)}`,`a PopupMenu opens where Android places it`)}get flags(){return`nested`}set flags(e){if(e!==`nested`)throw unsupported(`flags = ${String(e)}`,`only nested submenus exist`)}get pointingTo(){throw unsupported(`pointing_to`,`a PopupMenu is anchored at the whole parent view`)}set pointingTo(e){throw unsupported(`pointing_to`,`a PopupMenu is anchored at the whole parent view`)}get_pointing_to(){throw unsupported(`get_pointing_to()`,`a PopupMenu is anchored at the whole parent view`)}set_pointing_to(e){throw unsupported(`set_pointing_to()`,`a PopupMenu is anchored at the whole parent view`)}add_child(e,t){throw unsupported(`add_child()`,`a PopupMenu row is a title, not a widget`)}remove_child(e){throw unsupported(`remove_child()`,`a PopupMenu row is a title, not a widget`)}};export{a as CLOSED,GtkPopoverMenu};
@@ -1 +1 @@
1
- import"../_virtual/_rolldown/runtime.js";import{builderSlotsOf as e}from"./builder-slots.js";import{applyConstructProps as t}from"./construct-props.js";import{xmlBoolean as n,xmlNumber as r}from"./xml-values.js";import{GTK_REVEALER_TRANSITIONS as i,transitionNick as a}from"./transition-type.js";import{AdwSingleChildBase as o}from"./single-child-base.js";import{revealerChildVisibility as s}from"./revealer-state.js";const c=`notify::reveal-child`;var GtkRevealer=class extends o{static GTypeName=`GtkRevealer`;static builderSlots=e([`child`],`child`);_revealChild=!1;_transitionType=`slide-down`;_transitionDuration=250;constructor(e){super(),t(this,e)}get revealChild(){return this._revealChild}set revealChild(e){let t=n(e,this._revealChild);t!==this._revealChild&&(this._revealChild=t,this._applyReveal(),this.notify({eventName:c,object:this}))}get childRevealed(){return this._revealChild}get transitionType(){return this._transitionType}set transitionType(e){this._transitionType=a(e,i,`Gtk.RevealerTransitionType`)}get transitionDuration(){return this._transitionDuration}set transitionDuration(e){this._transitionDuration=Math.max(0,r(e,this._transitionDuration))}_adopt(e){super._adopt(e),this._applyReveal()}_applyReveal(){let e=this.child;e&&(e.visibility=s(this._revealChild))}};export{GtkRevealer,c as NOTIFY_REVEAL_CHILD};
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{GTK_REVEALER_TRANSITIONS as i,transitionNick as a}from"./transition-type.js";import{AdwSingleChildBase as o}from"./single-child-base.js";import{revealerChildVisibility as s}from"./revealer-state.js";const c=`notify::reveal-child`;var GtkRevealer=class extends o{static GTypeName=`GtkRevealer`;static builderSlots=e([`child`],`child`);_revealChild=!1;_transitionType=`slide-down`;_transitionDuration=250;constructor(e){super(),r(this,e)}get revealChild(){return this._revealChild}set revealChild(e){let n=t(e,this._revealChild);n!==this._revealChild&&(this._revealChild=n,this._applyReveal(),this.notify({eventName:c,object:this}))}get childRevealed(){return this._revealChild}get transitionType(){return this._transitionType}set transitionType(e){this._transitionType=a(e,i,`Gtk.RevealerTransitionType`)}get transitionDuration(){return this._transitionDuration}set transitionDuration(e){this._transitionDuration=Math.max(0,n(e,this._transitionDuration))}_adopt(e){super._adopt(e),this._applyReveal()}_applyReveal(){let e=this.child;e&&(e.visibility=s(this._revealChild))}};export{GtkRevealer,c as NOTIFY_REVEAL_CHILD};