@gjsify/adwaita-nativescript 0.48.0 → 0.50.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 (147) hide show
  1. package/lib/esm/index.js +1 -1
  2. package/lib/esm/namespace/gtk.js +1 -1
  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-alert-dialog.js +1 -1
  6. package/lib/esm/widgets/adw-avatar.js +1 -1
  7. package/lib/esm/widgets/adw-banner.js +1 -1
  8. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  9. package/lib/esm/widgets/adw-button-content.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-clamp.js +1 -1
  13. package/lib/esm/widgets/adw-combo-row.js +1 -1
  14. package/lib/esm/widgets/adw-data-grid.js +1 -1
  15. package/lib/esm/widgets/adw-entry-row.js +1 -1
  16. package/lib/esm/widgets/adw-expander-row.js +1 -1
  17. package/lib/esm/widgets/adw-header-bar.js +1 -1
  18. package/lib/esm/widgets/adw-image-button.js +1 -1
  19. package/lib/esm/widgets/adw-inline-view-switcher.js +1 -1
  20. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  21. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  22. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  23. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  24. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  25. package/lib/esm/widgets/adw-preferences-group.js +1 -1
  26. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  27. package/lib/esm/widgets/adw-shortcut-label.js +1 -1
  28. package/lib/esm/widgets/adw-sidebar.js +1 -1
  29. package/lib/esm/widgets/adw-slider-row.js +1 -1
  30. package/lib/esm/widgets/adw-spin-row.js +1 -1
  31. package/lib/esm/widgets/adw-spinner.js +1 -1
  32. package/lib/esm/widgets/adw-split-button.js +1 -1
  33. package/lib/esm/widgets/adw-status-page.js +1 -1
  34. package/lib/esm/widgets/adw-switch-row.js +1 -1
  35. package/lib/esm/widgets/adw-tab-view.js +1 -1
  36. package/lib/esm/widgets/adw-toast-overlay.js +1 -1
  37. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  38. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  39. package/lib/esm/widgets/adw-view-stack.js +1 -1
  40. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  41. package/lib/esm/widgets/adw-view-switcher.js +1 -1
  42. package/lib/esm/widgets/adw-window-title.js +1 -1
  43. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  44. package/lib/esm/widgets/avatar-view.js +1 -0
  45. package/lib/esm/widgets/box-layout.js +1 -0
  46. package/lib/esm/widgets/button-content.js +1 -1
  47. package/lib/esm/widgets/button-slot.js +1 -0
  48. package/lib/esm/widgets/construct-props.js +1 -0
  49. package/lib/esm/widgets/entry-row-view.js +1 -1
  50. package/lib/esm/widgets/gtk-align.js +1 -0
  51. package/lib/esm/widgets/gtk-box.js +1 -0
  52. package/lib/esm/widgets/gtk-button.js +1 -1
  53. package/lib/esm/widgets/gtk-drop-down.js +1 -1
  54. package/lib/esm/widgets/gtk-entry.js +1 -1
  55. package/lib/esm/widgets/gtk-icon-size.js +1 -0
  56. package/lib/esm/widgets/gtk-image.js +1 -1
  57. package/lib/esm/widgets/gtk-label.js +1 -0
  58. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  59. package/lib/esm/widgets/icon-theme.js +1 -0
  60. package/lib/esm/widgets/index.js +1 -1
  61. package/lib/esm/widgets/label-text.js +1 -0
  62. package/lib/esm/widgets/signals.js +1 -0
  63. package/lib/esm/widgets/split-view-base.js +1 -1
  64. package/lib/esm/widgets/style-classes.js +1 -0
  65. package/lib/esm/widgets/view-switcher-base.js +1 -1
  66. package/lib/esm/widgets/view-switcher-model.js +1 -1
  67. package/lib/types/avatar.spec.d.ts +2 -0
  68. package/lib/types/box-layout.spec.d.ts +2 -0
  69. package/lib/types/button-slot.spec.d.ts +2 -0
  70. package/lib/types/construct-props.spec.d.ts +2 -0
  71. package/lib/types/icon-size.spec.d.ts +2 -0
  72. package/lib/types/icon-theme.spec.d.ts +2 -0
  73. package/lib/types/index.d.ts +2 -2
  74. package/lib/types/label-text.spec.d.ts +2 -0
  75. package/lib/types/namespace/gtk.d.ts +2 -0
  76. package/lib/types/signals.spec.d.ts +2 -0
  77. package/lib/types/style-classes.spec.d.ts +2 -0
  78. package/lib/types/widgets/adw-about-dialog.d.ts +16 -3
  79. package/lib/types/widgets/adw-action-row.d.ts +38 -10
  80. package/lib/types/widgets/adw-alert-dialog.d.ts +30 -13
  81. package/lib/types/widgets/adw-avatar.d.ts +49 -3
  82. package/lib/types/widgets/adw-banner.d.ts +16 -3
  83. package/lib/types/widgets/adw-bottom-sheet.d.ts +32 -16
  84. package/lib/types/widgets/adw-button-content.d.ts +18 -4
  85. package/lib/types/widgets/adw-button-row.d.ts +6 -3
  86. package/lib/types/widgets/adw-carousel.d.ts +19 -7
  87. package/lib/types/widgets/adw-clamp.d.ts +17 -5
  88. package/lib/types/widgets/adw-combo-row.d.ts +2 -1
  89. package/lib/types/widgets/adw-data-grid.d.ts +17 -4
  90. package/lib/types/widgets/adw-entry-row.d.ts +13 -11
  91. package/lib/types/widgets/adw-expander-row.d.ts +19 -8
  92. package/lib/types/widgets/adw-header-bar.d.ts +39 -14
  93. package/lib/types/widgets/adw-image-button.d.ts +52 -10
  94. package/lib/types/widgets/adw-inline-view-switcher.d.ts +2 -1
  95. package/lib/types/widgets/adw-navigation-split-view.d.ts +2 -1
  96. package/lib/types/widgets/adw-navigation-view.d.ts +40 -21
  97. package/lib/types/widgets/adw-overlay-split-view.d.ts +3 -2
  98. package/lib/types/widgets/adw-password-entry-row.d.ts +2 -1
  99. package/lib/types/widgets/adw-preferences-dialog.d.ts +16 -3
  100. package/lib/types/widgets/adw-preferences-group.d.ts +19 -6
  101. package/lib/types/widgets/adw-preferences-page.d.ts +37 -8
  102. package/lib/types/widgets/adw-shortcut-label.d.ts +15 -2
  103. package/lib/types/widgets/adw-sidebar.d.ts +15 -2
  104. package/lib/types/widgets/adw-slider-row.d.ts +15 -2
  105. package/lib/types/widgets/adw-spin-row.d.ts +2 -1
  106. package/lib/types/widgets/adw-spinner.d.ts +14 -2
  107. package/lib/types/widgets/adw-split-button.d.ts +15 -2
  108. package/lib/types/widgets/adw-status-page.d.ts +20 -6
  109. package/lib/types/widgets/adw-switch-row.d.ts +2 -1
  110. package/lib/types/widgets/adw-tab-view.d.ts +34 -8
  111. package/lib/types/widgets/adw-toast-overlay.d.ts +19 -7
  112. package/lib/types/widgets/adw-toggle-group.d.ts +14 -2
  113. package/lib/types/widgets/adw-toolbar-view.d.ts +21 -8
  114. package/lib/types/widgets/adw-view-stack.d.ts +38 -5
  115. package/lib/types/widgets/adw-view-switcher-bar.d.ts +16 -3
  116. package/lib/types/widgets/adw-view-switcher.d.ts +2 -1
  117. package/lib/types/widgets/adw-window-title.d.ts +16 -3
  118. package/lib/types/widgets/adw-wrap-box.d.ts +21 -8
  119. package/lib/types/widgets/avatar-view.d.ts +57 -0
  120. package/lib/types/widgets/bottom-sheet-state.d.ts +1 -1
  121. package/lib/types/widgets/box-layout.d.ts +39 -0
  122. package/lib/types/widgets/button-content.d.ts +4 -4
  123. package/lib/types/widgets/button-slot.d.ts +16 -0
  124. package/lib/types/widgets/construct-props.d.ts +102 -0
  125. package/lib/types/widgets/entry-row-view.d.ts +8 -7
  126. package/lib/types/widgets/gtk-align.d.ts +59 -0
  127. package/lib/types/widgets/gtk-box.d.ts +75 -0
  128. package/lib/types/widgets/gtk-button.d.ts +110 -28
  129. package/lib/types/widgets/gtk-drop-down.d.ts +15 -2
  130. package/lib/types/widgets/gtk-entry.d.ts +15 -2
  131. package/lib/types/widgets/gtk-icon-size.d.ts +96 -0
  132. package/lib/types/widgets/gtk-image.d.ts +61 -10
  133. package/lib/types/widgets/gtk-label.d.ts +82 -0
  134. package/lib/types/widgets/gtk-menu-button.d.ts +2 -1
  135. package/lib/types/widgets/icon-theme.d.ts +77 -0
  136. package/lib/types/widgets/icons.d.ts +3 -1
  137. package/lib/types/widgets/index.d.ts +15 -3
  138. package/lib/types/widgets/label-text.d.ts +13 -0
  139. package/lib/types/widgets/row-state.d.ts +1 -1
  140. package/lib/types/widgets/signals.d.ts +40 -0
  141. package/lib/types/widgets/split-view-base.d.ts +18 -6
  142. package/lib/types/widgets/status-page-content.d.ts +1 -1
  143. package/lib/types/widgets/style-classes.d.ts +61 -0
  144. package/lib/types/widgets/view-switcher-base.d.ts +12 -1
  145. package/lib/types/widgets/view-switcher-model.d.ts +2 -11
  146. package/package.json +7 -7
  147. package/src/theme/adwaita.css +58 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * What a `styleClasses` write means here.
3
+ *
4
+ * THE DOOR TAKES A STRING AND THE READ-BACK IS A LIST, which is the DOM's own
5
+ * `className`/`classList` split and not a compromise: the two places that WRITE this are a
6
+ * NativeScript XML attribute and `View.className`, and both are strings, while
7
+ * `GtkWidget:css-classes` holds a list and so does the getter. An array-taking door would
8
+ * need a fourth attribute kind in `check-generated-website-data` — it has `number`,
9
+ * `boolean` and `json`, and `json` there means "parses to a plain OBJECT", so not even
10
+ * `'["pill"]'` reaches it — and inventing one to offer a second spelling of a door that
11
+ * already works is the "second way to say what the table can already say" that gate's own
12
+ * header refuses.
13
+ *
14
+ * NO ARRAY ARM. It had one, "because the widget's internals rebuild the list through it";
15
+ * the internals are the two setters and both are typed `string | null | undefined`, so the
16
+ * arm was unreachable and its `String(name)` coercion guarded nothing.
17
+ */
18
+ export type AdwStyleClassesInput = string | null | undefined;
19
+ /**
20
+ * The class list a `styleClasses` write means: split on whitespace, trimmed,
21
+ * de-duplicated, order preserved.
22
+ *
23
+ * A STRING IS THE XML DOOR. NativeScript's `setPropertyValue` ends in `instance[name] =
24
+ * value`, so `<gtk:Button styleClasses="pill suggested-action">` hands the setter that
25
+ * whole string — the same fact `xmlNumber`/`xmlBoolean` exist for, one type over.
26
+ */
27
+ export declare function normalizeStyleClasses(value: AdwStyleClassesInput): string[];
28
+ /**
29
+ * `className` for a widget whose own class is `base` and which carries `classes`.
30
+ *
31
+ * AN EMPTY `base` IS A WIDGET WITH NO CLASS OF ITS OWN, and two of them ship: `Gtk.Box`
32
+ * and `Gtk.Label` are transparent — there is no Adwaita fill, radius or typography to give
33
+ * a box or a bare label, so they carry only what a caller puts on them. The empties are
34
+ * filtered rather than joined, because `` `${''} ${'title-1'}` `` is a leading space and
35
+ * NativeScript's `className` splitter turns that into an empty class name.
36
+ */
37
+ export declare function classNameWith(base: string, classes: readonly string[]): string;
38
+ /**
39
+ * The list after `gtk_widget_add_css_class(name)` — GTK's own method, and the door a GJS
40
+ * snippet reaches for.
41
+ *
42
+ * WHY THE METHODS EXIST BESIDE THE `styleClasses` PROPERTY. A NativeScript XML attribute
43
+ * can only carry a string, which is what `styleClasses` is for; a TypeScript caller ported
44
+ * off GJS writes `button.add_css_class('pill')`, and that line is in every Adwaita snippet
45
+ * that gives a button a look. The two doors hold the SAME list, so a widget that offers
46
+ * both cannot have them disagree — which is why the mutation is a pure function over the
47
+ * list rather than a second `className` rewrite per method.
48
+ *
49
+ * ADDS AT THE END, AND ONLY IF ABSENT. `gtk_widget_add_css_class` is a no-op for a class
50
+ * the widget already has (the quark is already in the list), so a second add does not move
51
+ * it — measured under gjs 1.88.1: `add_css_class('a'); add_css_class('b');
52
+ * add_css_class('a')` reads back two classes.
53
+ *
54
+ * ONE NAME, TRIMMED. GTK takes a single class name and would happily intern `'a b'` as one
55
+ * unmatchable class; here the string door already means "a whitespace-separated list", so a
56
+ * name with whitespace in it is the caller confusing the two doors. It is trimmed, and an
57
+ * empty name is dropped rather than added as a class nothing can be.
58
+ */
59
+ export declare function withCssClass(classes: readonly string[], name: string): string[];
60
+ /** The list after `gtk_widget_remove_css_class(name)`. Absent is a no-op, as in C. */
61
+ export declare function withoutCssClass(classes: readonly string[], name: string): string[];
@@ -11,11 +11,22 @@ export declare const NOTIFY_SELECTED = "notify::selected";
11
11
  */
12
12
  export interface NotifyViewSelectedEventData extends EventData, ViewSwitcherNotifyPayload {
13
13
  }
14
+ declare const AdwViewSwitcherBase_base: (abstract new (...args: any[]) => {
15
+ connect(eventName: string, callback: (self: /*elided*/ any, data: EventData) => void): number;
16
+ disconnect(handlerId: number): void;
17
+ _emit(eventName: string): void;
18
+ addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: unknown, once?: boolean): void;
19
+ removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: unknown): void;
20
+ notify<T extends EventData>(data: T): void;
21
+ notifyPropertyChange(name: string, value: unknown, oldValue?: unknown): void;
22
+ set(name: string, value: unknown): void;
23
+ get(name: string): unknown;
24
+ }) & typeof GridLayout;
14
25
  /**
15
26
  * Shared base: a switcher bar (row 0) + a content area (row 1), one page visible.
16
27
  * Subclasses set the bar/button CSS classes for their look.
17
28
  */
18
- export declare abstract class AdwViewSwitcherBase extends GridLayout {
29
+ export declare abstract class AdwViewSwitcherBase extends AdwViewSwitcherBase_base {
19
30
  /** The horizontal switcher bar holding the buttons. */
20
31
  protected readonly _bar: GridLayout;
21
32
  /** `Adw.ViewSwitcher:policy`, default NARROW as in C. */
@@ -10,7 +10,7 @@ import type { AdwViewSwitcherPageInit, ViewSwitcherStateChange } from '@gjsify/a
10
10
  *
11
11
  * `icon` is an Adwaita symbolic SVG DOCUMENT here, not a GTK icon name: `GtkImage`
12
12
  * rasterises the path data natively. The core treats the field as an opaque
13
- * handle and only ever interprets "absent or empty"; {@link nsIconSvg} resolves
13
+ * handle and only ever interprets "absent or empty"; `icon-theme.ts` resolves
14
14
  * the fallback sentinel it hands back.
15
15
  */
16
16
  export interface AdwViewPage {
@@ -18,7 +18,7 @@ export interface AdwViewPage {
18
18
  title?: string;
19
19
  /** The page content view, shown when this page is selected. */
20
20
  content: View;
21
- /** Adwaita symbolic SVG shown on the switcher button; absent means none. */
21
+ /** The icon shown on the switcher button — a NAME or SVG source; absent means none. */
22
22
  icon?: string;
23
23
  /** Stable id used by `visible-child-name`; defaults to the page's position. */
24
24
  name?: string;
@@ -47,15 +47,6 @@ export declare function createViewSwitcherBarState(): ViewSwitcherBarState;
47
47
  export declare function viewSwitcherPageSpec(page: AdwViewPage, index: number): AdwViewSwitcherPageInit;
48
48
  /** {@link viewSwitcherPageSpec} over a whole page list. */
49
49
  export declare function viewSwitcherPageSpecs(pages: readonly AdwViewPage[]): AdwViewSwitcherPageInit[];
50
- /**
51
- * Resolve the core's icon slot to something `GtkImage` can rasterise.
52
- *
53
- * The core substitutes the NAME `image-missing` for an absent icon. On the browser
54
- * side that name becomes a CSS mask class; here it has to become the actual
55
- * symbolic document, so the sentinel is swapped for the vendored
56
- * `image-missing-symbolic` SVG. Anything else is already an SVG and passes through.
57
- */
58
- export declare function nsIconSvg(iconName: string): string;
59
50
  /**
60
51
  * The `visibility` each page's content view must carry for the current
61
52
  * selection, in page order. Exactly one entry is `'visible'` — none when nothing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/adwaita-nativescript",
3
- "version": "0.48.0",
3
+ "version": "0.50.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",
@@ -51,10 +51,10 @@
51
51
  "design-system"
52
52
  ],
53
53
  "dependencies": {
54
- "@gjsify/adwaita-core": "^0.48.0",
55
- "@gjsify/adwaita-fonts": "^0.48.0",
56
- "@gjsify/adwaita-icons": "^0.48.0",
57
- "@gjsify/native-platform": "^0.48.0"
54
+ "@gjsify/adwaita-core": "^0.50.0",
55
+ "@gjsify/adwaita-fonts": "^0.50.0",
56
+ "@gjsify/adwaita-icons": "^0.50.0",
57
+ "@gjsify/native-platform": "^0.50.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@nativescript/core": "*"
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "devDependencies": {
68
- "@gjsify/cli": "^0.48.0",
69
- "@gjsify/unit": "^0.48.0",
68
+ "@gjsify/cli": "^0.50.0",
69
+ "@gjsify/unit": "^0.50.0",
70
70
  "@types/node": "^25.9.2",
71
71
  "typescript": "^6.0.3"
72
72
  },
@@ -499,6 +499,49 @@ Page.adw-window {
499
499
  padding: 10 32 10 32;
500
500
  }
501
501
 
502
+ /* `%circular_button` — the explicit exception to the 9px rounded square: a full
503
+ * circle at 34×34 with no padding (_buttons.scss:312-317). It is the shape an
504
+ * icon-only button takes, which is why the rule arrives with the icon: while
505
+ * `Gtk.Button` was the platform's text-only `Button` the variant "had no counterpart
506
+ * at all", and a class with no rule would have drawn a rounded rectangle instead. The
507
+ * 34 is the same number `.adw-image-button` above carries, from the same line. */
508
+ .adw-button.circular {
509
+ width: 34;
510
+ height: 34;
511
+ border-radius: 9999;
512
+ padding: 0;
513
+ }
514
+
515
+ /* The button's OWN label, and it exists because the button is a `GridLayout`.
516
+ *
517
+ * `.adw-button` above declares `color` and `font-weight`; a `GridLayout` has no text,
518
+ * so neither reaches anything and the label would render at the platform default —
519
+ * silently, since a wrong font is not an error. `.adw-button-content-label` next to it
520
+ * had to exist for the same reason, and these are the same numbers: the 15pt / 700 of
521
+ * libadwaita's `button { font-weight: bold }` (_buttons.scss:1) over the label colour
522
+ * `.adw-button` carries.
523
+ *
524
+ * NOT MERGED WITH `.adw-button-content-label`: that class is `Adw.ButtonContent`'s and
525
+ * comes with the icon's 6 right-margin and the content's own padding rule; a plain
526
+ * text button has neither, and one selector for both would give every text button
527
+ * `image-text-button` spacing. */
528
+ .adw-button-label {
529
+ font-size: 15;
530
+ font-weight: 700;
531
+ color: rgba(0, 0, 0, 0.8);
532
+ }
533
+
534
+ /* On a suggested/destructive button the label takes the button's intent colour — the
535
+ * explicit label colour above would otherwise win over the inherited one, which is the
536
+ * same override `.adw-button-content-label` needs two blocks down. */
537
+ .adw-button.suggested-action .adw-button-label {
538
+ color: #ffffff;
539
+ }
540
+
541
+ .adw-button.destructive-action .adw-button-label {
542
+ color: #c01c28;
543
+ }
544
+
502
545
  /* Pressed (`:highlighted`) — Adwaita darkens the button on press rather than
503
546
  * showing a Material ripple. Mirrors adwaita-web's `:active` shades
504
547
  * (`--button-active-color` / darker `--accent-color`). Pill inherits the base. */
@@ -1740,6 +1783,21 @@ Page.ns-dark.adw-window {
1740
1783
  color: #ffffff;
1741
1784
  }
1742
1785
 
1786
+ /* Dark: the button's own label. Same three colours the dark `.adw-button` rules
1787
+ * carry — near-white on the plain and flat button, white on suggested, the dark
1788
+ * destructive red. */
1789
+ .ns-dark .adw-button-label {
1790
+ color: #ffffff;
1791
+ }
1792
+
1793
+ .ns-dark .adw-button.suggested-action .adw-button-label {
1794
+ color: #ffffff;
1795
+ }
1796
+
1797
+ .ns-dark .adw-button.destructive-action .adw-button-label {
1798
+ color: #ff7b80;
1799
+ }
1800
+
1743
1801
  /* Dark pressed (`:highlighted`) — Adwaita's lighter-overlay press shade. */
1744
1802
  .ns-dark .adw-button:highlighted {
1745
1803
  background-color: rgba(255, 255, 255, 0.22);