@nstudio/nativescript-compiler 9.2.0-alpha.18 → 9.2.0-alpha.20

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 (85) hide show
  1. package/config.js +1 -0
  2. package/dist/kotlin/arguments.js +6 -0
  3. package/dist/kotlin/class-methods.js +4 -4
  4. package/dist/kotlin/overrides.js +1 -1
  5. package/dist/kotlin/placement.js +23 -2
  6. package/dist/kotlin/untyped-values.js +5 -0
  7. package/dist/semantics/conversion.js +9 -1
  8. package/dist/semantics/runtime.js +1 -0
  9. package/dist/semantics/signals.js +1 -1
  10. package/dist/semantics/throws.js +1 -1
  11. package/dist/swift/arguments.js +14 -9
  12. package/dist/swift/assignment.js +6 -1
  13. package/dist/swift/calls.js +7 -2
  14. package/dist/swift/class-methods.js +2 -1
  15. package/dist/swift/library.js +2 -2
  16. package/dist/swift/method-values.js +2 -1
  17. package/dist/swift/names.js +4 -4
  18. package/dist/swift/native/calls.js +9 -3
  19. package/dist/swift/placement.js +18 -3
  20. package/dist/swift/static-calls.js +1 -1
  21. package/dist/swift/syntax.js +1 -1
  22. package/dist/swift/types.js +2 -2
  23. package/kit-android/generated/kotlin/org/nativescript/kit/data_observable_array_index.kt +8 -0
  24. package/kit-android/generated/kotlin/org/nativescript/kit/data_observable_index.kt +16 -0
  25. package/kit-android/generated/kotlin/org/nativescript/kit/ui_builder_index.kt +2 -0
  26. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_properties_index.kt +38 -37
  27. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_base_index.kt +9 -0
  28. package/kit-android/generated/source-lines.json +1 -1
  29. package/kit-android/src/fromcore/kotlin/org/nativescript/kit/NativeScriptApplication.kt +9 -0
  30. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Dynamic.kt +28 -13
  31. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Language.kt +10 -2
  32. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Values.kt +11 -10
  33. package/kit-apple/Overlays/xml-free/Core/ui.builder.index.swift +6 -2
  34. package/kit-apple/Sources/NativeScriptKit/Core/data.observable-array.index.swift +1 -1
  35. package/kit-apple/Sources/NativeScriptKit/Core/file-system.file-system-access.ios.swift +7 -7
  36. package/kit-apple/Sources/NativeScriptKit/Core/file-system.index.swift +10 -10
  37. package/kit-apple/Sources/NativeScriptKit/Core/http.http-request-internal.index.ios.swift +1 -1
  38. package/kit-apple/Sources/NativeScriptKit/Core/http.index.swift +3 -3
  39. package/kit-apple/Sources/NativeScriptKit/Core/image-source.index.ios.swift +2 -2
  40. package/kit-apple/Sources/NativeScriptKit/Core/js-libs.easysax.easysax.swift +4 -22
  41. package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +2 -1
  42. package/kit-apple/Sources/NativeScriptKit/Core/ui.action-bar.index.ios.swift +33 -21
  43. package/kit-apple/Sources/NativeScriptKit/Core/ui.activity-indicator.index.ios.swift +12 -6
  44. package/kit-apple/Sources/NativeScriptKit/Core/ui.animation.keyframe-animation.swift +1 -1
  45. package/kit-apple/Sources/NativeScriptKit/Core/ui.builder.index.swift +6 -2
  46. package/kit-apple/Sources/NativeScriptKit/Core/ui.button.index.ios.swift +14 -13
  47. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.properties.index.swift +8 -7
  48. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.index.ios.swift +79 -59
  49. package/kit-apple/Sources/NativeScriptKit/Core/ui.date-picker.index.ios.swift +17 -16
  50. package/kit-apple/Sources/NativeScriptKit/Core/ui.dialogs.index.ios.swift +2 -2
  51. package/kit-apple/Sources/NativeScriptKit/Core/ui.editable-text-base.index.ios.swift +27 -18
  52. package/kit-apple/Sources/NativeScriptKit/Core/ui.html-view.index.ios.swift +9 -9
  53. package/kit-apple/Sources/NativeScriptKit/Core/ui.image.index.ios.swift +6 -6
  54. package/kit-apple/Sources/NativeScriptKit/Core/ui.label.index.ios.swift +8 -8
  55. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.layout-base.ios.swift +4 -3
  56. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.liquid-glass-container.index.ios.swift +1 -1
  57. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.liquid-glass.index.ios.swift +1 -1
  58. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.root-layout.index.ios.swift +2 -2
  59. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.root-layout.root-layout-common.swift +9 -9
  60. package/kit-apple/Sources/NativeScriptKit/Core/ui.list-picker.index.ios.swift +9 -6
  61. package/kit-apple/Sources/NativeScriptKit/Core/ui.list-view.index.ios.swift +38 -20
  62. package/kit-apple/Sources/NativeScriptKit/Core/ui.page.index.ios.swift +2 -2
  63. package/kit-apple/Sources/NativeScriptKit/Core/ui.progress.index.ios.swift +12 -10
  64. package/kit-apple/Sources/NativeScriptKit/Core/ui.scroll-view.index.ios.swift +18 -9
  65. package/kit-apple/Sources/NativeScriptKit/Core/ui.search-bar.index.ios.swift +28 -18
  66. package/kit-apple/Sources/NativeScriptKit/Core/ui.segmented-bar.index.ios.swift +19 -12
  67. package/kit-apple/Sources/NativeScriptKit/Core/ui.slider.index.ios.swift +14 -12
  68. package/kit-apple/Sources/NativeScriptKit/Core/ui.split-view.index.ios.swift +14 -9
  69. package/kit-apple/Sources/NativeScriptKit/Core/ui.switch.index.ios.swift +12 -10
  70. package/kit-apple/Sources/NativeScriptKit/Core/ui.tab-view.index.ios.swift +36 -20
  71. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.formatted-string.swift +2 -2
  72. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.index.ios.swift +25 -22
  73. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.text-base-common.swift +2 -3
  74. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-field.index.ios.swift +21 -14
  75. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-view.index.ios.swift +33 -21
  76. package/kit-apple/Sources/NativeScriptKit/Core/ui.time-picker.index.ios.swift +22 -18
  77. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.shared-transition-helper.ios.swift +15 -15
  78. package/kit-apple/Sources/NativeScriptKit/Core/ui.web-view.index.ios.swift +1 -1
  79. package/kit-apple/Sources/NativeScriptKit/Core/ui.web-view.web-view-common.swift +2 -2
  80. package/kit-apple/Sources/NativeScriptKit/Core/utils.index.ios.swift +2 -2
  81. package/kit-apple/Sources/NativeScriptKit/Runtime/Dynamic.swift +6 -2
  82. package/kit-apple/Sources/NativeScriptKit/Runtime/Functions.swift +3 -1
  83. package/kit-apple/Sources/NativeScriptKit/Runtime/Native.swift +2 -1
  84. package/kit-apple/Sources/NativeScriptKit/Runtime/Values.swift +5 -2
  85. package/package.json +5 -3
@@ -88,10 +88,10 @@ open class WebViewBase: ContainerView {
88
88
  }
89
89
  #sourceLocation()
90
90
  open override func jsSymbolMethod(_ key: String) -> JSMethod? {
91
- if key == ((Core_ui_web_view_web_view_common.srcProperty?.getDefault)?.key ?? "undefined") {
91
+ if key == (try? ((Core_ui_web_view_web_view_common.srcProperty?.getDefault)?.key ?? "undefined")) {
92
92
  return { __this, __a in return try (jsCastPresent(__this) as WebViewBase).symbol_getDefault_src() }
93
93
  }
94
- if key == ((Core_ui_web_view_web_view_common.srcProperty?.setNative)?.key ?? "undefined") {
94
+ if key == (try? ((Core_ui_web_view_web_view_common.srcProperty?.setNative)?.key ?? "undefined")) {
95
95
  return { __this, __a in
96
96
  try (jsCastPresent(__this) as WebViewBase).symbol_setNative_src((try jsConvertedString(jsArg(__a, 0))))
97
97
  return nil
@@ -152,13 +152,13 @@ public enum Utils {
152
152
  try
153
153
  ({ (success: Bool) throws -> Void in
154
154
  #sourceLocation(file:"@nativescript/core/utils.index.ios.ts",line:97)
155
- __resolvers1.resolve(success)
155
+ try __resolvers1.resolve(success)
156
156
  })(success)
157
157
  }
158
158
  })
159
159
  } else {
160
160
  #sourceLocation(file:"@nativescript/core/utils.index.ios.ts",line:100)
161
- __resolvers1.resolve(false)
161
+ try __resolvers1.resolve(false)
162
162
  }
163
163
  } catch {
164
164
  #sourceLocation()
@@ -37,6 +37,8 @@ public func jsDelete(_ object: Any?, _ key: String) throws -> Bool {
37
37
  struct JSPropertySlot {
38
38
  var get: ((Any?) throws -> Any?)?
39
39
  var set: ((Any?, Any?) throws -> Void)?
40
+ var rawGet: Any?
41
+ var rawSet: Any?
40
42
  var isAccessor = false
41
43
  var enumerable = true
42
44
  var writable = true
@@ -50,6 +52,8 @@ public struct JSPropertyDescriptor {
50
52
  public var value: Any??
51
53
  public var get: ((Any?) throws -> Any?)?
52
54
  public var set: ((Any?, Any?) throws -> Void)?
55
+ var rawGet: Any?
56
+ var rawSet: Any?
53
57
  public var enumerable: Bool?
54
58
  public var writable: Bool?
55
59
  public var configurable: Bool?
@@ -68,8 +72,8 @@ public struct JSPropertyDescriptor {
68
72
  guard let o = jsFlat(object) as? JSDynamic else { throw JSException(JSTypeError("Property description must be an object: \(jsToString(object))")) }
69
73
  let has = { (k: String) in jsHasKey(o, k) }
70
74
  if has("value") { value = .some(o[jsKey: "value"]) }
71
- if has("get"), let g = jsFlat(o[jsKey: "get"]) { let f = jsReceiving(g); get = { this in try f(this, []) } }
72
- if has("set"), let s = jsFlat(o[jsKey: "set"]) { let f = jsReceiving(s); set = { this, v in _ = try f(this, [v]) } }
75
+ if has("get"), let g = jsFlat(o[jsKey: "get"]) { rawGet = g; let f = jsReceiving(g); get = { this in try f(this, []) } }
76
+ if has("set"), let s = jsFlat(o[jsKey: "set"]) { rawSet = s; let f = jsReceiving(s); set = { this, v in _ = try f(this, [v]) } }
73
77
  if has("enumerable") { enumerable = jsIsTruthy(o[jsKey: "enumerable"]) }
74
78
  if has("writable") { writable = jsIsTruthy(o[jsKey: "writable"]) }
75
79
  if has("configurable") { configurable = jsIsTruthy(o[jsKey: "configurable"]) }
@@ -187,7 +187,9 @@ public final class JSFunctionAlias {
187
187
 
188
188
  /// A typed view of an untyped function value: the function object itself is the identity.
189
189
  public init(of source: Any?) {
190
- if let f = jsFlat(source) as? JSFunctionObject { target = .object(f.identity ?? f) } else { target = .none }
190
+ if let f = jsFlat(source) as? JSFunctionObject { target = .object(f.identity ?? f) }
191
+ else if let m = jsFlat(source) as? JSMethod { target = .object(JSFunctionObject("", 0, m)) }
192
+ else { target = .none }
191
193
  }
192
194
 
193
195
  /// An adapter of a typed closure, which the adapter calls (and so keeps alive).
@@ -560,7 +560,8 @@ public func jsNativePropertySet(_ native: Any?, _ setter: String, _ value: Any?)
560
560
  /// `a || b` on untyped values.
561
561
  public func jsOr(_ a: Any?, _ b: Any?) -> Any? { jsTruthy(a) ? a : b }
562
562
 
563
- func jsNativeSet(_ object: NSObject, _ key: String, _ value: Any?) {
563
+ public func jsNativeSet(_ object: NSObject?, _ key: String, _ value: Any?) {
564
+ guard let object else { return }
564
565
  if JSNativeDispatch.set?(object, key, value) == true { return }
565
566
  if let own = object as? JSNativeMembers, own.jsSetMember(key, value) { return }
566
567
  // A block property the headers declare is set by the dispatch, of its block type; key-value coding
@@ -861,10 +861,12 @@ public final class JSObject: JSDynamic, JSSymbolKeyed, JSAccessorKeyed, JSReacti
861
861
  if d.get != nil || d.set != nil {
862
862
  slot.get = d.get
863
863
  slot.set = d.set
864
+ slot.rawGet = d.rawGet
865
+ slot.rawSet = d.rawSet
864
866
  slot.isAccessor = true
865
867
  slot.writable = false
866
868
  } else if d.value != nil || d.writable != nil {
867
- if slot.isAccessor { slot.get = nil; slot.set = nil; slot.isAccessor = false }
869
+ if slot.isAccessor { slot.get = nil; slot.set = nil; slot.rawGet = nil; slot.rawSet = nil; slot.isAccessor = false }
868
870
  }
869
871
  if let v = d.enumerable { slot.enumerable = v }
870
872
  if let v = d.writable { slot.writable = v }
@@ -884,7 +886,8 @@ public final class JSObject: JSDynamic, JSSymbolKeyed, JSAccessorKeyed, JSReacti
884
886
  guard storage[k] != nil else { return nil }
885
887
  let slot = slots[k] ?? JSPropertySlot()
886
888
  if slot.isAccessor {
887
- return JSObject([("get", slot.get.map { g in { (_: [Any?]) throws -> Any? in try g(self) } as JSFunction } as Any?), ("set", slot.set.map { s in { (a: [Any?]) throws -> Any? in try s(self, jsArg(a, 0)); return nil } as JSFunction } as Any?),
889
+ return JSObject([("get", slot.rawGet ?? (slot.get.map { g in ({ (selfArg: Any?, _: [Any?]) throws -> Any? in try g(selfArg) } as JSMethod) } as Any?)),
890
+ ("set", slot.rawSet ?? (slot.set.map { s in ({ (selfArg: Any?, a: [Any?]) throws -> Any? in try s(selfArg, jsArg(a, 0)); return nil } as JSMethod) } as Any?)),
888
891
  ("enumerable", slot.enumerable), ("configurable", slot.configurable)])
889
892
  }
890
893
  return JSObject([("value", storage[k] ?? nil), ("writable", slot.writable), ("enumerable", slot.enumerable), ("configurable", slot.configurable)])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nstudio/nativescript-compiler",
3
- "version": "9.2.0-alpha.18",
3
+ "version": "9.2.0-alpha.20",
4
4
  "description": "NativeScript CLI plugin (`ns compile`) and compiler turning a NativeScript app into native Swift (iOS) or Kotlin (Android) with no JavaScript runtime; framework adapters (`@nstudio/nativescript-compiler-<framework>`) compile each framework.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -39,13 +39,15 @@
39
39
  "default": "./dist/api/binding-api.js"
40
40
  },
41
41
  "./config": {
42
- "types": "./config.d.ts"
42
+ "types": "./config.d.ts",
43
+ "default": "./config.js"
43
44
  },
44
45
  "./package.json": "./package.json"
45
46
  },
46
47
  "files": [
47
48
  "bin/",
48
49
  "config.d.ts",
50
+ "config.js",
49
51
  "dist/",
50
52
  "verify/",
51
53
  "kit-apple/Package.swift",
@@ -71,7 +73,7 @@
71
73
  },
72
74
  "peerDependencies": {
73
75
  "@nativescript/core": "9.2.0-next.2",
74
- "nativescript": ">=9.1.0"
76
+ "nativescript": "*"
75
77
  },
76
78
  "peerDependenciesMeta": {
77
79
  "@nativescript/core": {