craft-native 0.0.250 → 0.0.251

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2842,7 +2842,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
2842
2842
  `);
2843
2843
  }
2844
2844
  // package.json
2845
- var version = "0.0.250";
2845
+ var version = "0.0.251";
2846
2846
 
2847
2847
  // bin/cli.ts
2848
2848
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -373,7 +373,7 @@ function craftBinaryNotFoundMessage(triedPath) {
373
373
  `);
374
374
  }
375
375
  // package.json
376
- var version = "0.0.250";
376
+ var version = "0.0.251";
377
377
 
378
378
  // src/sdk-version.ts
379
379
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function craftBinaryNotFoundMessage(triedPath) {
117
117
  `);
118
118
  }
119
119
  // package.json
120
- var version = "0.0.250";
120
+ var version = "0.0.251";
121
121
 
122
122
  // src/sdk-version.ts
123
123
  var SDK_VERSION = version;
@@ -139,6 +139,30 @@ final class DriverTests: XCTestCase {
139
139
  return nil
140
140
  }
141
141
 
142
+ /// About a third of a screen of scrolling, as a held drag.
143
+ ///
144
+ /// `app.swipeUp()` is a flick, and how far a flick throws a scroll view
145
+ /// depends on how its touches arrive: on a loaded machine, with a map
146
+ /// keeping the app busy, eight of them moved a trail page less than one
147
+ /// screen. A drag that stops before it lifts moves the content by its
148
+ /// own length every time. It runs between the middle of the screen and
149
+ /// the upper part, where a flick began too, so it stays off the keys when
150
+ /// a keyboard is up - an iOS 27 simulator reports its keyboard's frame
151
+ /// below the screen while drawing it over the lower half - and it stops
152
+ /// short of a keyboard whose frame is known.
153
+ func scrollPage(towardTop: Bool) {
154
+ let frame = app.frame
155
+ var lower = frame.minY + frame.height * 0.55
156
+ let keyboard = app.keyboards.firstMatch
157
+ if keyboard.exists, !keyboard.frame.isEmpty, keyboard.frame.minY < frame.maxY {
158
+ lower = min(lower, keyboard.frame.minY - 24)
159
+ }
160
+ let upper = max(frame.minY + frame.height * 0.15, lower - frame.height * 0.4)
161
+ let point = { (y: CGFloat) in self.app.coordinate(withNormalizedOffset: .zero).withOffset(CGVector(dx: frame.midX, dy: y)) }
162
+ let (from, to) = towardTop ? (point(upper), point(lower)) : (point(lower), point(upper))
163
+ from.press(forDuration: 0.05, thenDragTo: to, withVelocity: .default, thenHoldForDuration: 0.2)
164
+ }
165
+
142
166
  /// Whether `target`, or a field inside it, holds the keyboard.
143
167
  func hasKeyboardFocus(_ target: XCUIElement) -> Bool {
144
168
  if (target.value(forKey: "hasKeyboardFocus") as? Bool) == true { return true }
@@ -478,14 +502,11 @@ final class DriverTests: XCTestCase {
478
502
  else { XCTFail("Element not found"); note("FAIL tab \(arg): NOT FOUND") }
479
503
  case "scrollto":
480
504
  var found = element(containing: arg)
481
- var swipes = 0
482
- while (found == nil || !(found!.isHittable)) && swipes < 8 {
483
- if let target = found, !target.frame.isEmpty, target.frame.midY < app.frame.midY {
484
- app.swipeDown()
485
- } else {
486
- app.swipeUp()
487
- }
488
- swipes += 1
505
+ var drags = 0
506
+ while (found == nil || !(found!.isHittable)) && drags < 12 {
507
+ let towardTop = found.map { !$0.frame.isEmpty && $0.frame.midY < app.frame.midY } ?? false
508
+ scrollPage(towardTop: towardTop)
509
+ drags += 1
489
510
  found = element(containing: arg)
490
511
  }
491
512
  check(found != nil && found!.isHittable, "scrollto \(arg)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.250",
3
+ "version": "0.0.251",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",