@gjsify/adwaita-nativescript 0.64.1 → 0.64.2-next.254

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 (154) hide show
  1. package/lib/esm/builder/index.js +1 -1
  2. package/lib/esm/builder/param-values.js +1 -0
  3. package/lib/esm/canvas2d/canvas2d-bridge.js +1 -1
  4. package/lib/esm/capabilities.js +1 -1
  5. package/lib/esm/index.js +1 -1
  6. package/lib/esm/namespace/adw.js +1 -1
  7. package/lib/esm/namespace/gdk.js +1 -1
  8. package/lib/esm/namespace/gio.js +1 -1
  9. package/lib/esm/namespace/glib.js +1 -1
  10. package/lib/esm/namespace/gobject.js +1 -1
  11. package/lib/esm/namespace/gtk.js +1 -1
  12. package/lib/esm/widgets/adw-about-dialog.js +2 -1
  13. package/lib/esm/widgets/adw-action-row.js +1 -1
  14. package/lib/esm/widgets/adw-alert-dialog.js +1 -1
  15. package/lib/esm/widgets/adw-application-window.js +1 -1
  16. package/lib/esm/widgets/adw-avatar.js +1 -1
  17. package/lib/esm/widgets/adw-banner.js +1 -1
  18. package/lib/esm/widgets/adw-bottom-sheet.js +1 -1
  19. package/lib/esm/widgets/adw-button-content.js +1 -1
  20. package/lib/esm/widgets/adw-carousel.js +1 -1
  21. package/lib/esm/widgets/adw-combo-row.js +1 -1
  22. package/lib/esm/widgets/adw-data-grid.js +1 -1
  23. package/lib/esm/widgets/adw-dialog.js +1 -1
  24. package/lib/esm/widgets/adw-entry-row.js +1 -1
  25. package/lib/esm/widgets/adw-expander-row.js +1 -1
  26. package/lib/esm/widgets/adw-image-button.js +1 -1
  27. package/lib/esm/widgets/adw-navigation-page.js +1 -1
  28. package/lib/esm/widgets/adw-navigation-split-view.js +1 -1
  29. package/lib/esm/widgets/adw-navigation-view.js +1 -1
  30. package/lib/esm/widgets/adw-overlay-split-view.js +1 -1
  31. package/lib/esm/widgets/adw-password-entry-row.js +1 -1
  32. package/lib/esm/widgets/adw-preferences-dialog.js +1 -1
  33. package/lib/esm/widgets/adw-preferences-page.js +1 -1
  34. package/lib/esm/widgets/adw-sidebar.js +1 -1
  35. package/lib/esm/widgets/adw-slider-row.js +1 -1
  36. package/lib/esm/widgets/adw-spin-row.js +1 -1
  37. package/lib/esm/widgets/adw-spinner.js +1 -1
  38. package/lib/esm/widgets/adw-split-button.js +1 -1
  39. package/lib/esm/widgets/adw-switch-row.js +1 -1
  40. package/lib/esm/widgets/adw-tab-view.js +1 -1
  41. package/lib/esm/widgets/adw-toast-overlay.js +1 -1
  42. package/lib/esm/widgets/adw-toggle-group.js +1 -1
  43. package/lib/esm/widgets/adw-toolbar-view.js +1 -1
  44. package/lib/esm/widgets/adw-view-switcher-bar.js +1 -1
  45. package/lib/esm/widgets/adw-wrap-box.js +1 -1
  46. package/lib/esm/widgets/application.js +1 -1
  47. package/lib/esm/widgets/construct-props.js +1 -1
  48. package/lib/esm/widgets/gtk-action-bar.js +1 -1
  49. package/lib/esm/widgets/gtk-box.js +1 -1
  50. package/lib/esm/widgets/gtk-button.js +1 -1
  51. package/lib/esm/widgets/gtk-check-button.js +1 -1
  52. package/lib/esm/widgets/gtk-drawing-area.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-grid.js +1 -1
  56. package/lib/esm/widgets/gtk-image.js +1 -1
  57. package/lib/esm/widgets/gtk-label.js +1 -1
  58. package/lib/esm/widgets/gtk-list-box.js +1 -1
  59. package/lib/esm/widgets/gtk-menu-button.js +1 -1
  60. package/lib/esm/widgets/gtk-revealer.js +1 -1
  61. package/lib/esm/widgets/gtk-scrolled-window.js +1 -1
  62. package/lib/esm/widgets/gtk-stack.js +1 -1
  63. package/lib/esm/widgets/gtk-text-view.js +1 -1
  64. package/lib/esm/widgets/gtk-toggle-button.js +1 -1
  65. package/lib/esm/widgets/gtk-window.js +1 -1
  66. package/lib/esm/widgets/icon-path.js +1 -1
  67. package/lib/esm/widgets/icon-render.js +1 -0
  68. package/lib/esm/widgets/icon-theme.js +1 -1
  69. package/lib/esm/widgets/index.js +1 -1
  70. package/lib/esm/widgets/signals.js +1 -1
  71. package/lib/esm/widgets/stack-page.js +1 -1
  72. package/lib/esm/widgets/view-stack-page.js +1 -1
  73. package/lib/esm/widgets/widget-layout.js +1 -1
  74. package/lib/esm/widgets/widget-mapping.js +1 -0
  75. package/lib/types/about-dialog-doors.spec.d.ts +1 -0
  76. package/lib/types/builder/index.d.ts +4 -0
  77. package/lib/types/builder/param-values.d.ts +21 -0
  78. package/lib/types/carousel-doors.spec.d.ts +1 -0
  79. package/lib/types/gio-resource.spec.d.ts +1 -0
  80. package/lib/types/gio.spec.d.ts +2 -0
  81. package/lib/types/icon-resources.spec.d.ts +2 -0
  82. package/lib/types/index.d.ts +2 -2
  83. package/lib/types/namespace/adw.d.ts +1 -1
  84. package/lib/types/namespace/gdk.d.ts +1 -0
  85. package/lib/types/namespace/gio.d.ts +2 -0
  86. package/lib/types/namespace/glib.d.ts +2 -1
  87. package/lib/types/namespace/gtk.d.ts +1 -0
  88. package/lib/types/param-values.spec.d.ts +1 -0
  89. package/lib/types/testing/ns-core.d.mts +55 -14
  90. package/lib/types/widget-map.spec.d.ts +1 -0
  91. package/lib/types/widgets/adw-about-dialog.d.ts +34 -2
  92. package/lib/types/widgets/adw-action-row.d.ts +10 -1
  93. package/lib/types/widgets/adw-alert-dialog.d.ts +37 -13
  94. package/lib/types/widgets/adw-application-window.d.ts +0 -3
  95. package/lib/types/widgets/adw-avatar.d.ts +10 -1
  96. package/lib/types/widgets/adw-banner.d.ts +10 -1
  97. package/lib/types/widgets/adw-bottom-sheet.d.ts +10 -1
  98. package/lib/types/widgets/adw-button-content.d.ts +10 -1
  99. package/lib/types/widgets/adw-carousel.d.ts +24 -3
  100. package/lib/types/widgets/adw-clamp.d.ts +10 -1
  101. package/lib/types/widgets/adw-combo-row.d.ts +4 -0
  102. package/lib/types/widgets/adw-data-grid.d.ts +10 -1
  103. package/lib/types/widgets/adw-header-bar.d.ts +10 -1
  104. package/lib/types/widgets/adw-image-button.d.ts +13 -2
  105. package/lib/types/widgets/adw-navigation-page.d.ts +10 -1
  106. package/lib/types/widgets/adw-navigation-view.d.ts +10 -1
  107. package/lib/types/widgets/adw-preferences-dialog.d.ts +10 -1
  108. package/lib/types/widgets/adw-preferences-group.d.ts +10 -1
  109. package/lib/types/widgets/adw-preferences-page.d.ts +10 -1
  110. package/lib/types/widgets/adw-shortcut-label.d.ts +10 -1
  111. package/lib/types/widgets/adw-sidebar.d.ts +10 -1
  112. package/lib/types/widgets/adw-slider-row.d.ts +10 -1
  113. package/lib/types/widgets/adw-spinner.d.ts +10 -1
  114. package/lib/types/widgets/adw-split-button.d.ts +10 -1
  115. package/lib/types/widgets/adw-status-page.d.ts +10 -1
  116. package/lib/types/widgets/adw-switch-row.d.ts +2 -0
  117. package/lib/types/widgets/adw-tab-view.d.ts +10 -1
  118. package/lib/types/widgets/adw-toast-overlay.d.ts +21 -17
  119. package/lib/types/widgets/adw-toggle-group.d.ts +10 -1
  120. package/lib/types/widgets/adw-toggle.d.ts +10 -1
  121. package/lib/types/widgets/adw-toolbar-view.d.ts +10 -1
  122. package/lib/types/widgets/adw-view-stack.d.ts +10 -1
  123. package/lib/types/widgets/adw-view-switcher-bar.d.ts +10 -1
  124. package/lib/types/widgets/adw-window-title.d.ts +10 -1
  125. package/lib/types/widgets/adw-wrap-box.d.ts +10 -1
  126. package/lib/types/widgets/application.d.ts +2 -1
  127. package/lib/types/widgets/carousel-indicator-base.d.ts +10 -1
  128. package/lib/types/widgets/construct-props.d.ts +11 -2
  129. package/lib/types/widgets/gtk-action-bar.d.ts +10 -1
  130. package/lib/types/widgets/gtk-button.d.ts +13 -2
  131. package/lib/types/widgets/gtk-check-button.d.ts +10 -0
  132. package/lib/types/widgets/gtk-drop-down.d.ts +10 -1
  133. package/lib/types/widgets/gtk-entry.d.ts +10 -1
  134. package/lib/types/widgets/gtk-image.d.ts +13 -2
  135. package/lib/types/widgets/gtk-label.d.ts +10 -1
  136. package/lib/types/widgets/gtk-popover-menu.d.ts +10 -1
  137. package/lib/types/widgets/gtk-stack.d.ts +10 -1
  138. package/lib/types/widgets/gtk-text-view.d.ts +10 -1
  139. package/lib/types/widgets/gtk-window.d.ts +5 -0
  140. package/lib/types/widgets/icon-path.d.ts +9 -0
  141. package/lib/types/widgets/icon-render.d.ts +9 -0
  142. package/lib/types/widgets/icon-theme.d.ts +43 -40
  143. package/lib/types/widgets/index.d.ts +4 -4
  144. package/lib/types/widgets/signals.d.ts +16 -1
  145. package/lib/types/widgets/split-view-base.d.ts +10 -1
  146. package/lib/types/widgets/stack-page.d.ts +10 -1
  147. package/lib/types/widgets/styled-layout-base.d.ts +10 -1
  148. package/lib/types/widgets/view-stack-page.d.ts +10 -1
  149. package/lib/types/widgets/view-switcher-base.d.ts +10 -1
  150. package/lib/types/widgets/widget-layout.d.ts +14 -0
  151. package/lib/types/widgets/widget-mapping.d.ts +9 -0
  152. package/package.json +14 -13
  153. package/src/testing/ns-core.mts +147 -18
  154. package/src/theme/adwaita.css +13 -2
@@ -23,10 +23,10 @@
23
23
  // port imports that this file does not export fails the build — measured, by renaming
24
24
  // `Button` away: rolldown answers `MISSING_EXPORT "Button" is not exported by ns-core.mts`,
25
25
  // exit 1, no bundle. That is the reachable slice held exactly. The other direction is not
26
- // held by anything: `ListPicker` and `Screen` are in the `.d.ts` and deliberately absent
27
- // here, because the only modules importing them are `*.android.ts` / `*.ios.ts`, which no
28
- // off-device bundle resolves. If one of them ever moves into a platform-neutral module the
29
- // build will say so on the next run.
26
+ // held by anything: `ListPicker` is in the `.d.ts` and deliberately absent here, because the
27
+ // only modules importing it are `*.android.ts` / `*.ios.ts`, which no off-device bundle
28
+ // resolves. If it ever moves into a platform-neutral module the build will say so on the next
29
+ // run, as `Screen` did when the icon lookup started asking for the device scale.
30
30
  //
31
31
  // WHAT IT IS NOT, and the driver's header says this again where a reader of the result will
32
32
  // look: it is not a device and it is not a measurement of NativeScript. It carries no layout
@@ -155,18 +155,53 @@ export interface TouchGestureEventData extends EventData {
155
155
  /** Parent links, written by {@link LayoutBase} and read back through {@link View.parent}. */
156
156
  const PARENTS = new WeakMap<object, View>();
157
157
 
158
+ /** The views that are loaded — upstream's `_isLoaded`, kept off the instance for the reason {@link View.isLoaded} gives. */
159
+ const LOADED = new WeakSet<object>();
160
+
161
+ /** `ViewBase.loadView` / `unloadView`: a child follows its parent into and out of the tree. */
162
+ function loadView(view: View): void {
163
+ if (view && !LOADED.has(view)) view.callLoaded();
164
+ }
165
+
166
+ function unloadView(view: View): void {
167
+ if (view && LOADED.has(view)) view.callUnloaded();
168
+ }
169
+
170
+ /**
171
+ * `ui/styling/style/index.ts`'s `Style` is an `Observable`, and a CSS property's setter notifies
172
+ * `<name>Change` on it (`CssProperty`, `ui/core/properties/index.ts`) — never on the view.
173
+ */
174
+ export class Style extends Observable {
175
+ direction?: 'ltr' | 'rtl' | null = null;
176
+ readonly viewRef: WeakRef<View>;
177
+ #visibility = 'visible';
178
+
179
+ constructor(view: View) {
180
+ super();
181
+ this.viewRef = new WeakRef(view);
182
+ }
183
+
184
+ get visibility(): string {
185
+ return this.#visibility;
186
+ }
187
+
188
+ set visibility(value: string) {
189
+ const oldValue = this.#visibility;
190
+ if (value === oldValue) return;
191
+ this.#visibility = value;
192
+ this.notify({ eventName: 'visibilityChange', object: this, propertyName: 'visibility', value, oldValue });
193
+ }
194
+ }
195
+
158
196
  export class View extends Observable {
159
197
  /**
160
198
  * `View` keeps its `Style` in `_style` and answers it from `style`: a subclass field of that
161
199
  * name replaces it, and every inherited-CSS pass then reads `viewRef` off the wrong object
162
200
  * (`Cannot read properties of undefined (reading 'get')`, measured on a device).
163
201
  */
164
- _style: { direction?: 'ltr' | 'rtl' | null; viewRef: WeakRef<View> } = {
165
- direction: null,
166
- viewRef: new WeakRef(this),
167
- };
202
+ _style: Style = new Style(this);
168
203
 
169
- get style(): { direction?: 'ltr' | 'rtl' | null; viewRef: WeakRef<View> } {
204
+ get style(): Style {
170
205
  return this._style;
171
206
  }
172
207
 
@@ -221,8 +256,17 @@ export class View extends Observable {
221
256
  marginBottom = 0;
222
257
  marginLeft = 0;
223
258
  marginRight = 0;
224
- /** `'visible' | 'hidden' | 'collapse'` — NativeScript's own default is `'visible'`. */
225
- visibility = 'visible';
259
+ /**
260
+ * `'visible' | 'hidden' | 'collapse'` — NativeScript's own default is `'visible'`. A CSS
261
+ * property, so `View` reads and writes it on its {@link Style}, which notifies the change.
262
+ */
263
+ get visibility(): string {
264
+ return this._style.visibility;
265
+ }
266
+
267
+ set visibility(value: string) {
268
+ this._style.visibility = value;
269
+ }
226
270
  /** `isEnabledProperty` registers `defaultValue: true`. */
227
271
  isEnabled = true;
228
272
  /**
@@ -292,11 +336,48 @@ export class View extends Observable {
292
336
  isUserInteractionEnabled = true;
293
337
  translateX = 0;
294
338
  translateY = 0;
295
- /** Never loaded here: nothing mounts a view into a page without a platform. */
296
- readonly isLoaded: boolean = false;
297
- /** Nothing loads a view here; a spec calls these to stand in for the platform's. */
298
- onLoaded(): void {}
299
- onUnloaded(): void {}
339
+ /**
340
+ * Loaded once something calls {@link onLoaded}: nothing mounts a view into a page without a
341
+ * platform, so a spec calls it to stand in for the platform's. Read from {@link LOADED} and
342
+ * not from this getter by the lifecycle, as upstream reads `_isLoaded`: a spec may pin the
343
+ * getter with `Object.defineProperty`.
344
+ */
345
+ get isLoaded(): boolean {
346
+ return LOADED.has(this);
347
+ }
348
+
349
+ /**
350
+ * `ViewBase.onLoaded` (`ui/core/view-base/index.ts`): loads the children BEFORE it emits
351
+ * `loaded` on itself, and a second call does nothing.
352
+ */
353
+ onLoaded(): void {
354
+ if (LOADED.has(this)) return;
355
+ LOADED.add(this);
356
+ this.eachChildView((child) => {
357
+ loadView(child);
358
+ return true;
359
+ });
360
+ this._emit('loaded');
361
+ }
362
+
363
+ /** `ViewBase.onUnloaded`: unloads the children before it emits `unloaded` on itself. */
364
+ onUnloaded(): void {
365
+ if (!LOADED.has(this)) return;
366
+ this.eachChildView((child) => {
367
+ unloadView(child);
368
+ return true;
369
+ });
370
+ LOADED.delete(this);
371
+ this._emit('unloaded');
372
+ }
373
+
374
+ callLoaded(): void {
375
+ this.onLoaded();
376
+ }
377
+
378
+ callUnloaded(): void {
379
+ this.onUnloaded();
380
+ }
300
381
  androidOverflowEdge = 'none';
301
382
  accessibilityRole: string | undefined;
302
383
  accessibilityState: string | undefined;
@@ -416,14 +497,17 @@ export class LayoutBase extends View {
416
497
  PARENTS.set(view, this);
417
498
  }
418
499
 
500
+ /** `_addViewCore` loads a child added to a loaded parent; `_removeView` unloads it first. */
419
501
  addChild(view: View): void {
420
502
  this.#adopt(view);
421
503
  this.#children.push(view);
504
+ if (LOADED.has(this)) loadView(view);
422
505
  }
423
506
 
424
507
  insertChild(view: View, atIndex: number): void {
425
508
  this.#adopt(view);
426
509
  this.#children.splice(atIndex, 0, view);
510
+ if (LOADED.has(this)) loadView(view);
427
511
  }
428
512
 
429
513
  /** `_removeView` refuses a view that is not this parent's; a silent no-op would hide it. */
@@ -431,12 +515,16 @@ export class LayoutBase extends View {
431
515
  if (PARENTS.get(view) !== this) {
432
516
  throw new Error(`View not added to this instance. View: ${view?.constructor.name}`);
433
517
  }
518
+ unloadView(view);
434
519
  this.#children.splice(this.#children.indexOf(view), 1);
435
520
  PARENTS.delete(view);
436
521
  }
437
522
 
438
523
  removeChildren(): void {
439
- for (const view of this.#children) PARENTS.delete(view);
524
+ for (const view of this.#children) {
525
+ unloadView(view);
526
+ PARENTS.delete(view);
527
+ }
440
528
  this.#children.length = 0;
441
529
  }
442
530
 
@@ -660,8 +748,40 @@ export class ScrollView extends View {
660
748
  }
661
749
  }
662
750
 
751
+ /**
752
+ * Upstream's `content` setter (`ui/content-view/index.ts`) `_removeView`s the old view and
753
+ * `_addView`s the new one, and `eachChildView` answers that one view — so the tree members see
754
+ * through it and a view already parented elsewhere is refused, as on a device.
755
+ */
663
756
  export class ContentView extends LayoutBase {
664
- content: View = null;
757
+ #content: View | null = null;
758
+
759
+ get content(): View | null {
760
+ return this.#content;
761
+ }
762
+
763
+ set content(value: View | null) {
764
+ if (this.#content !== null) {
765
+ unloadView(this.#content);
766
+ PARENTS.delete(this.#content);
767
+ }
768
+ this.#content = null;
769
+ if (value) {
770
+ const parent = PARENTS.get(value);
771
+ if (parent !== undefined) {
772
+ throw new Error(
773
+ `View already has a parent. View: ${value.constructor.name} Parent: ${parent.constructor.name}`,
774
+ );
775
+ }
776
+ PARENTS.set(value, this);
777
+ this.#content = value;
778
+ if (LOADED.has(this)) loadView(value);
779
+ }
780
+ }
781
+
782
+ eachChildView(callback: (child: View) => boolean): void {
783
+ if (this.#content !== null) callback(this.#content);
784
+ }
665
785
  }
666
786
 
667
787
  export class WrapLayout extends LayoutBase {
@@ -739,14 +859,23 @@ export class ImageSource {
739
859
  constructor(nativeSource?: unknown) {
740
860
  this.nativeSource = nativeSource;
741
861
  }
862
+
863
+ /** Decodes nothing: the source keeps the base64 it was given, for a spec to read back. */
864
+ static fromBase64Sync(source: string): ImageSource {
865
+ return new ImageSource({ base64: source });
866
+ }
742
867
  }
743
868
 
744
869
  export class Image extends View {
745
870
  src: string | ImageSource | undefined;
746
871
  imageSource: ImageSource | undefined;
747
872
  stretch = 'aspectFit';
873
+ tintColor: string | undefined;
748
874
  }
749
875
 
876
+ /** One screen at scale 1, the density the port's own sizes are written in. */
877
+ export const Screen = { mainScreen: { scale: 1, widthDIPs: 0, heightDIPs: 0 } };
878
+
750
879
  export class SegmentedBarItem extends Observable {
751
880
  title = '';
752
881
  }
@@ -1671,6 +1671,11 @@ Page.adw-window {
1671
1671
  background-color: #3584e4;
1672
1672
  }
1673
1673
 
1674
+ /* A grouped check button draws the round radio (`radio { border-radius: 100% }`). */
1675
+ .adw-check-indicator.radio {
1676
+ border-radius: 10;
1677
+ }
1678
+
1674
1679
  .adw-check-label {
1675
1680
  font-size: 15;
1676
1681
  color: rgba(0, 0, 0, 0.8);
@@ -1788,7 +1793,10 @@ Page.adw-window {
1788
1793
  .adw-about-dialog-developer,
1789
1794
  .adw-about-dialog-comments,
1790
1795
  .adw-about-dialog-website,
1791
- .adw-about-dialog-copyright {
1796
+ .adw-about-dialog-copyright,
1797
+ .adw-about-dialog-release-notes,
1798
+ .adw-about-dialog-links,
1799
+ .adw-about-dialog-debug-info {
1792
1800
  font-size: 13;
1793
1801
  color: rgba(0, 0, 0, 0.6);
1794
1802
  margin: 2 0 2 0;
@@ -2622,7 +2630,10 @@ Page.ns-dark.adw-window {
2622
2630
  .ns-dark .adw-about-dialog-developer,
2623
2631
  .ns-dark .adw-about-dialog-comments,
2624
2632
  .ns-dark .adw-about-dialog-website,
2625
- .ns-dark .adw-about-dialog-copyright {
2633
+ .ns-dark .adw-about-dialog-copyright,
2634
+ .ns-dark .adw-about-dialog-release-notes,
2635
+ .ns-dark .adw-about-dialog-links,
2636
+ .ns-dark .adw-about-dialog-debug-info {
2626
2637
  color: rgba(255, 255, 255, 0.6);
2627
2638
  }
2628
2639