craft-native 0.0.182 → 0.0.183

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
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3303
3303
  `);
3304
3304
  }
3305
3305
  // package.json
3306
- var version = "0.0.182";
3306
+ var version = "0.0.183";
3307
3307
 
3308
3308
  // bin/cli.ts
3309
3309
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -310,7 +310,7 @@ function craftBinaryNotFoundMessage(triedPath) {
310
310
  `);
311
311
  }
312
312
  // package.json
313
- var version = "0.0.182";
313
+ var version = "0.0.183";
314
314
 
315
315
  // src/sdk-version.ts
316
316
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ function craftBinaryNotFoundMessage(triedPath) {
58
58
  `);
59
59
  }
60
60
  // package.json
61
- var version = "0.0.182";
61
+ var version = "0.0.183";
62
62
 
63
63
  // src/sdk-version.ts
64
64
  var SDK_VERSION = version;
@@ -1572,8 +1572,12 @@ final class CraftHybridController: UIViewController, UINavigationControllerDeleg
1572
1572
  // title unless it asked for the bar; a pushed native screen gets the
1573
1573
  // bar and its Back.
1574
1574
  // A root screen that asked for its own bar (setOptions) keeps it.
1575
- let asksForBar = (viewController as? CraftNativeScreenController)?.wantsNavigationBar ?? false
1576
- let bare = viewController is CraftHybridWebSlot || (navigationController.viewControllers.first === viewController && !asksForBar)
1575
+ // A screen that put its bar away (`hidden: true`, a tour drawing its
1576
+ // own Back and Skip) stays bare, pushed or not.
1577
+ let native = viewController as? CraftNativeScreenController
1578
+ let asksForBar = native?.wantsNavigationBar ?? false
1579
+ let bare = viewController is CraftHybridWebSlot || native?.navigationBarHidden == true
1580
+ || (navigationController.viewControllers.first === viewController && !asksForBar)
1577
1581
  navigationController.setNavigationBarHidden(bare, animated: animated)
1578
1582
  }
1579
1583
 
@@ -3883,7 +3883,7 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
3883
3883
  private var rootTrailingToSafeArea: NSLayoutConstraint?
3884
3884
  private var rootTrailingToView: NSLayoutConstraint?
3885
3885
  private var rootIsSafeAreaView = false
3886
- private var navigationBarHidden: Bool?
3886
+ private(set) var navigationBarHidden: Bool?
3887
3887
  /// A native `<StatusBar>` node overrides the app default for this screen.
3888
3888
  private var statusBarStyleOverride: UIStatusBarStyle?
3889
3889
  private var statusBarHiddenOverride: Bool?
@@ -5340,17 +5340,26 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
5340
5340
  }
5341
5341
 
5342
5342
  private func explicitKey(_ node: [String: Any], props: [String: Any]) -> String? {
5343
+ if let authored = authoredKey(node, props: props) { return authored }
5344
+ return (node["id"] as? String).flatMap { $0.isEmpty ? nil : $0 }
5345
+ }
5346
+
5347
+ /// The key a node's author gave it. A wrapper of one child (a
5348
+ /// component's) is keyed by what it wraps, so a keyed row drawn through
5349
+ /// a component keeps its key. Never a key further down beside siblings:
5350
+ /// one an `:if` shows and hides (a Back button) changed the identity of
5351
+ /// everything above it, and the whole subtree was built again, a pager's
5352
+ /// scroll position with it.
5353
+ private func authoredKey(_ node: [String: Any], props: [String: Any]) -> String? {
5343
5354
  // The current @stacksjs/stx native compiler emits key in props; accept the IR
5344
5355
  // field too so keyed children keep working when the compiler adopts it.
5345
5356
  let direct = [node["key"], props["key"], props["testID"]]
5346
5357
  .compactMap { $0 as? String }
5347
5358
  .first { !$0.isEmpty }
5348
5359
  if let direct { return direct }
5349
- for child in node["children"] as? [[String: Any]] ?? [] {
5350
- let childProps = child["props"] as? [String: Any] ?? [:]
5351
- if let nested = explicitKey(child, props: childProps) { return nested }
5352
- }
5353
- return (node["id"] as? String).flatMap { $0.isEmpty ? nil : $0 }
5360
+ let children = node["children"] as? [Any] ?? []
5361
+ guard children.count == 1, let only = children.first as? [String: Any] else { return nil }
5362
+ return authoredKey(only, props: only["props"] as? [String: Any] ?? [:])
5354
5363
  }
5355
5364
 
5356
5365
  private func accessibilityIdentifier(_ node: [String: Any], props: [String: Any]) -> String? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.182",
3
+ "version": "0.0.183",
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>",