@gjsify/adwaita-nativescript 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/lib/esm/namespace.js +1 -0
  3. package/lib/esm/widgets/adw-about-dialog.js +1 -1
  4. package/lib/esm/widgets/adw-action-row.js +1 -1
  5. package/lib/esm/widgets/adw-avatar.js +1 -1
  6. package/lib/esm/widgets/adw-banner.js +1 -1
  7. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  8. package/lib/esm/widgets/adw-button-content.js +1 -1
  9. package/lib/esm/widgets/adw-button-row.js +1 -1
  10. package/lib/esm/widgets/adw-carousel.js +1 -1
  11. package/lib/esm/widgets/adw-clamp.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-entry-row.js +1 -1
  15. package/lib/esm/widgets/adw-expander-row.js +1 -1
  16. package/lib/esm/widgets/adw-header-bar.js +1 -1
  17. package/lib/esm/widgets/adw-icon.js +1 -1
  18. package/lib/esm/widgets/adw-image-button.js +1 -1
  19. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  20. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  21. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  22. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  23. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  24. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  25. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  26. package/lib/esm/widgets/adw-sidebar.js +1 -1
  27. package/lib/esm/widgets/adw-slider-row.js +1 -1
  28. package/lib/esm/widgets/adw-spin-row.js +1 -1
  29. package/lib/esm/widgets/adw-spinner.js +1 -1
  30. package/lib/esm/widgets/adw-split-button.js +1 -1
  31. package/lib/esm/widgets/adw-status-page.js +1 -1
  32. package/lib/esm/widgets/adw-switch-row.js +1 -1
  33. package/lib/esm/widgets/adw-tab-view.js +1 -1
  34. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  35. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  36. package/lib/esm/widgets/adw-view-stack.js +1 -1
  37. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  38. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  39. package/lib/esm/widgets/builder-slots.js +1 -0
  40. package/lib/esm/widgets/entry-row-view.js +1 -1
  41. package/lib/esm/widgets/{adw-button.js → gtk-button.js} +1 -1
  42. package/lib/esm/widgets/gtk-drop-down.js +1 -0
  43. package/lib/esm/widgets/gtk-entry.js +1 -0
  44. package/lib/esm/widgets/{adw-menu-button.js → gtk-menu-button.js} +1 -1
  45. package/lib/esm/widgets/host-insets.android.js +1 -0
  46. package/lib/esm/widgets/host-insets.ios.js +1 -0
  47. package/lib/esm/widgets/host-insets.js +1 -0
  48. package/lib/esm/widgets/icon-path.js +2 -2
  49. package/lib/esm/widgets/icons.android.js +1 -1
  50. package/lib/esm/widgets/icons.ios.js +1 -1
  51. package/lib/esm/widgets/index.js +1 -1
  52. package/lib/esm/widgets/split-view-base.js +1 -1
  53. package/lib/esm/widgets/view-switcher-base.js +1 -1
  54. package/lib/esm/widgets/window-insets.js +1 -1
  55. package/lib/esm/widgets/wrap-box-layout.js +1 -1
  56. package/lib/esm/widgets/xml-values.js +1 -0
  57. package/lib/types/index.d.ts +2 -1
  58. package/lib/types/namespace.d.ts +92 -0
  59. package/lib/types/widgets/adw-about-dialog.d.ts +1 -1
  60. package/lib/types/widgets/adw-action-row.d.ts +17 -2
  61. package/lib/types/widgets/adw-avatar.d.ts +1 -1
  62. package/lib/types/widgets/adw-banner.d.ts +2 -2
  63. package/lib/types/widgets/adw-bottom-sheet.d.ts +22 -3
  64. package/lib/types/widgets/adw-button-content.d.ts +4 -4
  65. package/lib/types/widgets/adw-button-row.d.ts +4 -4
  66. package/lib/types/widgets/adw-carousel.d.ts +16 -4
  67. package/lib/types/widgets/adw-clamp.d.ts +15 -3
  68. package/lib/types/widgets/adw-combo-row.d.ts +3 -3
  69. package/lib/types/widgets/adw-data-grid.d.ts +1 -1
  70. package/lib/types/widgets/adw-entry-row.d.ts +4 -4
  71. package/lib/types/widgets/adw-expander-row.d.ts +22 -2
  72. package/lib/types/widgets/adw-header-bar.d.ts +15 -2
  73. package/lib/types/widgets/adw-icon.d.ts +3 -3
  74. package/lib/types/widgets/adw-image-button.d.ts +3 -3
  75. package/lib/types/widgets/adw-navigation-split-view.d.ts +1 -1
  76. package/lib/types/widgets/adw-navigation-view.d.ts +13 -2
  77. package/lib/types/widgets/adw-overlay-split-view.d.ts +1 -1
  78. package/lib/types/widgets/adw-password-entry-row.d.ts +2 -2
  79. package/lib/types/widgets/adw-preferences-dialog.d.ts +9 -2
  80. package/lib/types/widgets/adw-preferences-group.d.ts +13 -1
  81. package/lib/types/widgets/adw-preferences-page.d.ts +9 -2
  82. package/lib/types/widgets/adw-sidebar.d.ts +1 -1
  83. package/lib/types/widgets/adw-slider-row.d.ts +4 -4
  84. package/lib/types/widgets/adw-spin-row.d.ts +4 -4
  85. package/lib/types/widgets/adw-spinner.d.ts +2 -2
  86. package/lib/types/widgets/adw-split-button.d.ts +23 -7
  87. package/lib/types/widgets/adw-status-page.d.ts +11 -3
  88. package/lib/types/widgets/adw-switch-row.d.ts +1 -1
  89. package/lib/types/widgets/adw-tab-view.d.ts +2 -2
  90. package/lib/types/widgets/adw-toast-overlay.d.ts +2 -1
  91. package/lib/types/widgets/adw-toggle-group.d.ts +2 -2
  92. package/lib/types/widgets/adw-toolbar-view.d.ts +22 -4
  93. package/lib/types/widgets/adw-view-stack.d.ts +3 -2
  94. package/lib/types/widgets/adw-view-switcher-bar.d.ts +2 -2
  95. package/lib/types/widgets/adw-wrap-box.d.ts +7 -7
  96. package/lib/types/widgets/builder-slots.d.ts +16 -0
  97. package/lib/types/widgets/entry-row-view.d.ts +1 -1
  98. package/lib/types/widgets/{adw-button.d.ts → gtk-button.d.ts} +7 -2
  99. package/lib/types/widgets/{adw-drop-down.d.ts → gtk-drop-down.d.ts} +4 -4
  100. package/lib/types/widgets/{adw-entry.d.ts → gtk-entry.d.ts} +6 -6
  101. package/lib/types/widgets/{adw-menu-button.d.ts → gtk-menu-button.d.ts} +3 -3
  102. package/lib/types/widgets/host-insets.android.d.ts +4 -0
  103. package/lib/types/widgets/host-insets.d.ts +13 -0
  104. package/lib/types/widgets/host-insets.ios.d.ts +4 -0
  105. package/lib/types/widgets/icon-path.d.ts +72 -7
  106. package/lib/types/widgets/index.d.ts +21 -14
  107. package/lib/types/widgets/split-button.d.ts +2 -2
  108. package/lib/types/widgets/split-view-base.d.ts +15 -6
  109. package/lib/types/widgets/view-switcher-base.d.ts +1 -1
  110. package/lib/types/widgets/window-insets.d.ts +24 -0
  111. package/lib/types/widgets/wrap-box-layout.d.ts +3 -60
  112. package/lib/types/widgets/xml-values.d.ts +18 -0
  113. package/package.json +11 -8
  114. package/lib/esm/widgets/adw-drop-down.js +0 -1
  115. package/lib/esm/widgets/adw-entry.js +0 -1
@@ -18,6 +18,30 @@ export interface InsetPadding {
18
18
  readonly contentBottom: number;
19
19
  }
20
20
  export declare const NO_INSETS: WindowInsets;
21
+ /**
22
+ * The edges a HOST layout already pays, so the widget must not pay them again.
23
+ *
24
+ * Declared here rather than beside the platform files that answer it, so this module
25
+ * stays the one place the inset arithmetic lives and keeps importing nothing.
26
+ */
27
+ export interface HostPaidEdges {
28
+ readonly top: boolean;
29
+ readonly bottom: boolean;
30
+ }
31
+ /** Nothing above the widget pays anything — it owes every edge. */
32
+ export declare const NO_HOST_PAYMENT: HostPaidEdges;
33
+ /**
34
+ * Drop the edges a host layout already paid, leaving what the widget still owes.
35
+ *
36
+ * Separate from {@link toolbarViewInsetPadding} because it answers a different question:
37
+ * that one splits an owed inset between the slots of ONE widget, this one decides
38
+ * whether the inset is owed at all. Which edges a host pays is a per-platform fact
39
+ * (`host-insets.{android,ios}.ts`); how much of it lands on which slot is not.
40
+ *
41
+ * Left and right pass through: no host in this tree pays them, and dropping an edge
42
+ * nobody paid is how an inset silently goes missing.
43
+ */
44
+ export declare function insetsOwedBy(insets: WindowInsets, paidByHost: HostPaidEdges): WindowInsets;
21
45
  /**
22
46
  * Assign `insets` to the slots of a toolbar view of `shape`.
23
47
  *
@@ -1,5 +1,6 @@
1
- import { normalizeWrapBoxSpacing, type AdwWrapBoxJustify, type AdwWrapBoxOrientation, type AdwWrapBoxPackDirection, type AdwWrapPolicy } from '@gjsify/adwaita-core';
2
- export { normalizeWrapBoxSpacing };
1
+ import { normalizeWrapBoxSpacing, wrapBoxChildFlex, wrapBoxFlexStyle, type WrapBoxChildFlex, type WrapBoxFlexInput, type WrapBoxFlexStyle } from '@gjsify/adwaita-core';
2
+ export { normalizeWrapBoxSpacing, wrapBoxChildFlex, wrapBoxFlexStyle };
3
+ export type { WrapBoxChildFlex, WrapBoxFlexInput, WrapBoxFlexStyle };
3
4
  /** `Adw.WrapBox:child-spacing` / `:line-spacing` default, in DIPs. Both are 0 in C. */
4
5
  export declare const DEFAULT_WRAP_BOX_SPACING = 0;
5
6
  /**
@@ -22,61 +23,3 @@ export declare function wrapBoxSpacingChanges(current: number, next: unknown): b
22
23
  * the NS CSS subset cannot be trusted with.
23
24
  */
24
25
  export declare function wrapBoxChildMargin(childSpacing: number, lineSpacing: number): string;
25
- /** The `FlexboxLayout` knobs a wrap box's properties resolve to. */
26
- export interface WrapBoxFlexStyle {
27
- /** `FlexboxLayout:flexDirection` — the main axis, reversed for `end-to-start`. */
28
- flexDirection: 'row' | 'row-reverse' | 'column' | 'column-reverse';
29
- /** `FlexboxLayout:flexWrap` — always wrapping; reversed by `wrap-reverse`. */
30
- flexWrap: 'wrap' | 'wrap-reverse';
31
- /** `FlexboxLayout:justifyContent` — where a COMPLETE line's leftover goes. */
32
- justifyContent: 'flex-start' | 'center' | 'flex-end' | 'space-between';
33
- /** `FlexboxLayout:alignContent` — `line-homogeneous` stretches the lines. */
34
- alignContent: 'stretch' | 'flex-start';
35
- /** `FlexboxLayout.setFlexGrow` for a child on a complete line. */
36
- childFlexGrow: number;
37
- /** `FlexboxLayout.setFlexShrink` for every child — `wrap-policy`. */
38
- childFlexShrink: number;
39
- }
40
- /** The widget properties the two resolvers read. */
41
- export interface WrapBoxFlexInput {
42
- orientation: AdwWrapBoxOrientation;
43
- packDirection: AdwWrapBoxPackDirection;
44
- wrapReverse: boolean;
45
- justify: AdwWrapBoxJustify;
46
- justifyLastLine: boolean;
47
- align: number;
48
- lineHomogeneous: boolean;
49
- wrapPolicy: AdwWrapPolicy;
50
- }
51
- /**
52
- * The CONTAINER half of the decision, resolved onto `FlexboxLayout`.
53
- *
54
- * The line DECISION is `resolveWrapBoxLine` in `@gjsify/adwaita-core`, held to
55
- * `WRAP_BOX_LINE_VECTORS`; this function only maps its answer onto the knobs NS has.
56
- *
57
- * `FlexboxLayout` has ONE `justifyContent` for every line, so it can only carry the
58
- * COMPLETE-line rule. NativeScript offers no `:only-child` selector and no generated
59
- * content, so the final-line rule has no container-level expression at all; the
60
- * single-child case is reached through {@link wrapBoxChildFlex}.
61
- */
62
- export declare function wrapBoxFlexStyle(input: WrapBoxFlexInput): WrapBoxFlexStyle;
63
- /** What one child of the box gets set on it. */
64
- export interface WrapBoxChildFlex {
65
- /** `FlexboxLayout.setFlexGrow` — whether this child absorbs the line's leftover. */
66
- flexGrow: number;
67
- /** `FlexboxLayout.setFlexShrink` — `wrap-policy`, the same for every child. */
68
- flexShrink: number;
69
- }
70
- /**
71
- * The PER-CHILD half of the decision, which the container knobs cannot carry.
72
- *
73
- * A box with exactly ONE child has one line, that line is the LAST one, and its
74
- * child is alone on it — so it is governed by `justify-last-line`, and `spread`
75
- * STRETCHES it rather than spreading anything (C guards the keep-at-minimum branch
76
- * with `n_children > 1`).
77
- *
78
- * `childCount` is the box's own child count, the most a renderer knows without a
79
- * layout pass: 1 is the lone-child-on-the-final-line case exactly, anything more
80
- * means at least one complete line.
81
- */
82
- export declare function wrapBoxChildFlex(input: WrapBoxFlexInput, childCount: number): WrapBoxChildFlex;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * An attribute as a finite number, or `fallback` when it is not one.
3
+ *
4
+ * A string is trimmed and parsed; empty is NOT zero (`Number('')` is 0, which is how
5
+ * a missing value becomes a real setting). `NaN` and `Infinity` are refused, so a
6
+ * caller can keep validating a RANGE without also having to re-check the type.
7
+ */
8
+ export declare function xmlNumber(value: unknown, fallback: number): number;
9
+ /**
10
+ * An attribute as a boolean.
11
+ *
12
+ * Only the two spellings XML can mean are accepted — anything else takes the
13
+ * `fallback` rather than the truthiness of the string, because truthiness is exactly
14
+ * what made `revealed="false"` reveal. `'True'`/`'FALSE'` are accepted too: XML
15
+ * attribute VALUES are not case-normalised by any parser, and a template that means
16
+ * one of the two booleans should not depend on which case its author typed.
17
+ */
18
+ export declare function xmlBoolean(value: unknown, fallback: boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-nativescript",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
5
5
  "type": "module",
6
6
  "module": "lib/esm/index.js",
@@ -47,10 +47,10 @@
47
47
  "design-system"
48
48
  ],
49
49
  "dependencies": {
50
- "@gjsify/adwaita-core": "^0.44.0",
51
- "@gjsify/adwaita-fonts": "^0.44.0",
52
- "@gjsify/adwaita-icons": "^0.44.0",
53
- "@gjsify/native-platform": "^0.44.0"
50
+ "@gjsify/adwaita-core": "^0.46.0",
51
+ "@gjsify/adwaita-fonts": "^0.46.0",
52
+ "@gjsify/adwaita-icons": "^0.46.0",
53
+ "@gjsify/native-platform": "^0.46.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@nativescript/core": "*"
@@ -61,8 +61,8 @@
61
61
  }
62
62
  },
63
63
  "devDependencies": {
64
- "@gjsify/cli": "^0.44.0",
65
- "@gjsify/unit": "^0.44.0",
64
+ "@gjsify/cli": "^0.46.0",
65
+ "@gjsify/unit": "^0.46.0",
66
66
  "@types/node": "^25.9.2",
67
67
  "typescript": "^6.0.3"
68
68
  },
@@ -77,7 +77,10 @@
77
77
  "nativescriptPlatforms": [
78
78
  "android",
79
79
  "ios"
80
- ]
80
+ ],
81
+ "widgetVocabulary": {
82
+ "role": "renderer"
83
+ }
81
84
  },
82
85
  "license": "MIT",
83
86
  "repository": {
@@ -1 +0,0 @@
1
- import"../_virtual/_rolldown/runtime.js";import{AdwIcon as e}from"./adw-icon.js";import{attachRowPressFeedback as t}from"./row-press.js";import{Label as n,StackLayout as r,action as i}from"@nativescript/core";import{ComboState as a}from"@gjsify/adwaita-core";import{panDownSymbolic as o}from"@gjsify/adwaita-icons/ui";const s=`notify::selected`;var AdwDropDown=class extends r{_label;_chevron;_state=new a;_chooserTitle=``;constructor(){super(),this.orientation=`horizontal`,this.className=`adw-drop-down`;let r=new n;r.className=`adw-drop-down-label`,r.text=``;let i=new e;i.className=`adw-drop-down-chevron`,i.icon=o,this.addChild(r),this.addChild(i),this._label=r,this._chevron=i,this._state.subscribe(e=>{if(this._label.text=e.label,e.interactive){let t={eventName:s,object:this,selected:e.selected,value:e.value,label:e.label};this.notify(t)}}),this.addEventListener(`tap`,()=>{this._openChooser()}),t(this)}async _openChooser(){if(this._state.count===0)return;let e=this._state.options.map(e=>e.label),t=await i({title:this._chooserTitle||void 0,cancelButtonText:`Cancel`,actions:e});this._state.select(e.indexOf(t))}get options(){return this._state.options}set options(e){this._state.setOptions(e)}get selected(){return this._state.selectedIndex}set selected(e){this._state.setSelectedIndex(e)}get selectedValue(){return this._state.selectedValue}set selectedValue(e){this._state.setSelectedValue(e)}get selectedItem(){return this._state.options[this._state.selectedIndex]??null}get chooserTitle(){return this._chooserTitle}set chooserTitle(e){this._chooserTitle=e??``}};export{AdwDropDown,s as NOTIFY_SELECTED};
@@ -1 +0,0 @@
1
- import"../_virtual/_rolldown/runtime.js";import{GridLayout as e,ItemSpec as t,TextField as n}from"@nativescript/core";import{ENTRY_ROW_MAX_LENGTH_LIMIT as r,clampEntryText as i,entryTextLength as a}from"@gjsify/adwaita-core";const o=`notify::text`,s=`activate`;var AdwEntry=class extends e{_field;_text=``;_maxLength=0;constructor(){super(),this.className=`adw-entry`,this.addColumn(new t(1,`star`)),this.addRow(new t(1,`auto`));let e=new n;e.className=`adw-entry-input`,e.set(`backgroundColor`,`transparent`),e.set(`borderWidth`,0),this.addChild(e),this._field=e,e.addEventListener(`textChange`,()=>this._applyText(this._field.text??``)),e.addEventListener(`returnPress`,()=>{let e={eventName:s,object:this};this.notify(e)})}_applyText(e){let t=i(e,this._maxLength);if(this._field.text!==t&&(this._field.text=t),t===this._text)return;this._text=t;let n={eventName:o,object:this,text:t,textLength:a(t)};this.notify(n)}get text(){return this._text}set text(e){this._applyText(e??``)}get textLength(){return a(this._text)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(r,Math.max(0,Math.trunc(e))):0,this._applyText(this._text)}get placeholder(){return this._field.hint??``}set placeholder(e){this._field.hint=e??``}get editable(){return this._field.editable}set editable(e){this._field.editable=!!e}get field(){return this._field}};export{s as ACTIVATE,AdwEntry,o as NOTIFY_TEXT};