craft-native 0.0.231 → 0.0.233

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.
@@ -4563,12 +4563,28 @@ class MainActivity : AppCompatActivity() {
4563
4563
  }
4564
4564
 
4565
4565
  /** Applies a screen-specific background, falling back to the dynamic app colour. */
4566
+ @Suppress("DEPRECATION")
4566
4567
  private fun applyScreenBackground(screen: Screen) {
4567
4568
  val configured = screen.options.opt("backgroundColor")
4568
4569
  ?.takeUnless { it == JSONObject.NULL }
4569
4570
  ?.let { craftNativeOptionalString(it) }
4570
4571
  ?.let { runCatching { craftNativeColor(it) }.getOrNull() }
4571
- screen.view.setBackgroundColor(configured ?: ContextCompat.getColor(this, R.color.background))
4572
+ val background = configured ?: ContextCompat.getColor(this, R.color.background)
4573
+ screen.view.setBackgroundColor(background)
4574
+ // The root also paints the window-inset padding above/below the
4575
+ // screen. Retained screens still receive options and theme updates;
4576
+ // only the visible one may change the colour behind system bars.
4577
+ if (visibleScreen === screen) {
4578
+ root.setBackgroundColor(background)
4579
+ WindowCompat.getInsetsController(window, window.decorView)
4580
+ .isAppearanceLightNavigationBars = Color.luminance(background) >= 0.5f
4581
+ // Android 15+ draws the root behind transparent system bars.
4582
+ // Older releases still paint separate window bar surfaces.
4583
+ if (Build.VERSION.SDK_INT < 35) {
4584
+ window.statusBarColor = background
4585
+ window.navigationBarColor = background
4586
+ }
4587
+ }
4572
4588
  }
4573
4589
 
4574
4590
  /** Refresh controls use a contrasting system tint when no color is authored. */
package/dist/cli.js CHANGED
@@ -3424,7 +3424,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3424
3424
  `);
3425
3425
  }
3426
3426
  // package.json
3427
- var version = "0.0.231";
3427
+ var version = "0.0.233";
3428
3428
 
3429
3429
  // bin/cli.ts
3430
3430
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -309,7 +309,7 @@ function craftBinaryNotFoundMessage(triedPath) {
309
309
  `);
310
310
  }
311
311
  // package.json
312
- var version = "0.0.231";
312
+ var version = "0.0.233";
313
313
 
314
314
  // src/sdk-version.ts
315
315
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ function craftBinaryNotFoundMessage(triedPath) {
57
57
  `);
58
58
  }
59
59
  // package.json
60
- var version = "0.0.231";
60
+ var version = "0.0.233";
61
61
 
62
62
  // src/sdk-version.ts
63
63
  var SDK_VERSION = version;
@@ -6837,17 +6837,21 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
6837
6837
  ) {
6838
6838
  let id = ObjectIdentifier(textView)
6839
6839
  textView.delegate = self
6840
- textView.textColor = color(style["color"]) ?? .label
6841
- textView.font = textFont(style, default: .systemFont(ofSize: 16))
6842
- textView.textAlignment = textAlignment(style["textAlign"])
6843
- textView.tintColor = color(props["selectionColor"])
6844
- textView.keyboardType = keyboardType(props["keyboardType"])
6845
- textView.returnKeyType = returnKeyType(props["returnKeyType"])
6846
- textView.autocorrectionType = props["autoCorrect"] as? Bool == false ? .no : .default
6847
- textView.autocapitalizationType = capitalizationType(props["autoCapitalize"])
6848
- textView.isSecureTextEntry = props["secureTextEntry"] as? Bool == true
6840
+ // UIKit owns marked text until the keyboard commits it. Reapplying
6841
+ // typography or input traits during composition can commit that draft.
6842
+ if textView.markedTextRange == nil {
6843
+ textView.textColor = color(style["color"]) ?? .label
6844
+ textView.font = textFont(style, default: .systemFont(ofSize: 16))
6845
+ textView.textAlignment = textAlignment(style["textAlign"])
6846
+ textView.tintColor = color(props["selectionColor"])
6847
+ textView.keyboardType = keyboardType(props["keyboardType"])
6848
+ textView.returnKeyType = returnKeyType(props["returnKeyType"])
6849
+ textView.autocorrectionType = props["autoCorrect"] as? Bool == false ? .no : .default
6850
+ textView.autocapitalizationType = capitalizationType(props["autoCapitalize"])
6851
+ textView.isSecureTextEntry = props["secureTextEntry"] as? Bool == true
6852
+ applyAutofill(to: textView, props: props)
6853
+ }
6849
6854
  textView.isEditable = props["editable"] as? Bool != false
6850
- applyAutofill(to: textView, props: props)
6851
6855
  // The style's padding is where the text starts, as in a web textarea.
6852
6856
  let padding = paddingInsets(style)
6853
6857
  if let craftTextView = textView as? CraftNativeTextView {
@@ -6875,12 +6879,17 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
6875
6879
  craftTextView.placeholderFont = textView.font
6876
6880
  }
6877
6881
  updateTextView(textView, value: (props["value"] as? String) ?? defaultValue)
6878
- let selectedRange = textView.selectedRange
6879
- let attributes = inputTextAttributes(style, font: textView.font ?? .systemFont(ofSize: 16), alignment: textView.textAlignment)
6880
- textView.typingAttributes = attributes
6881
- if !textView.text.isEmpty {
6882
- textView.attributedText = NSAttributedString(string: textView.text, attributes: attributes)
6883
- textView.selectedRange = selectedRange
6882
+ if textView.markedTextRange == nil {
6883
+ let attributes = inputTextAttributes(style, font: textView.font ?? .systemFont(ofSize: 16), alignment: textView.textAlignment)
6884
+ let styled = NSAttributedString(string: textView.text ?? "", attributes: attributes)
6885
+ if !textView.text.isEmpty, textView.attributedText?.isEqual(to: styled) != true {
6886
+ let selectedRange = textView.selectedRange
6887
+ textView.attributedText = styled
6888
+ textView.selectedRange = selectedRange
6889
+ }
6890
+ if !(textView.typingAttributes as NSDictionary).isEqual(attributes as NSDictionary) {
6891
+ textView.typingAttributes = attributes
6892
+ }
6884
6893
  }
6885
6894
  (textView as? CraftNativeTextView)?.refreshPlaceholder()
6886
6895
  updateHandler(nonEmptyHandler(events["onChange"]) ?? nonEmptyHandler(events["onChangeText"]), for: textView)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.231",
3
+ "version": "0.0.233",
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>",