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

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 (186) hide show
  1. package/README.md +3 -0
  2. package/dist/kit/kit-index.js +9 -0
  3. package/dist/kotlin/access.js +14 -15
  4. package/dist/kotlin/arguments.js +2 -2
  5. package/dist/kotlin/assignment.js +22 -13
  6. package/dist/kotlin/builtins.js +67 -0
  7. package/dist/kotlin/calls.js +3 -2
  8. package/dist/kotlin/class-declaration.js +16 -1
  9. package/dist/kotlin/class-methods.js +2 -2
  10. package/dist/kotlin/components.js +2 -7
  11. package/dist/kotlin/core-api.js +3 -22
  12. package/dist/kotlin/declarations.js +86 -9
  13. package/dist/kotlin/expression-statements.js +13 -1
  14. package/dist/kotlin/functions.js +2 -4
  15. package/dist/kotlin/global-calls.js +1 -4
  16. package/dist/kotlin/literals.js +3 -10
  17. package/dist/kotlin/names.js +6 -4
  18. package/dist/kotlin/native/api.js +1 -1
  19. package/dist/kotlin/native/classfiles.js +2 -13
  20. package/dist/kotlin/operators.js +36 -30
  21. package/dist/kotlin/optional-chains.js +3 -10
  22. package/dist/kotlin/overrides.js +5 -17
  23. package/dist/kotlin/placement.js +1 -12
  24. package/dist/kotlin/state-backend.js +6 -2
  25. package/dist/kotlin/statements.js +1 -13
  26. package/dist/kotlin/translator.js +3 -11
  27. package/dist/kotlin/type-tests.js +1 -1
  28. package/dist/kotlin/types.js +6 -23
  29. package/dist/program/core-facts.js +9 -0
  30. package/dist/semantics/classes.js +15 -0
  31. package/dist/semantics/facts.js +38 -2
  32. package/dist/semantics/lang.js +29 -0
  33. package/dist/semantics/lower.js +144 -0
  34. package/dist/semantics/lowering-methods.js +120 -3
  35. package/dist/semantics/marks.js +30 -0
  36. package/dist/semantics/placement.js +9 -3
  37. package/dist/semantics/refusals.js +12 -11
  38. package/dist/semantics/signals.js +11 -0
  39. package/dist/semantics/states/missing.js +7 -0
  40. package/dist/semantics/tdz.js +142 -8
  41. package/dist/semantics/throws.js +1 -1
  42. package/dist/semantics/translator-methods.js +1 -1
  43. package/dist/swift/access.js +13 -17
  44. package/dist/swift/assignment.js +30 -16
  45. package/dist/swift/calls.js +13 -5
  46. package/dist/swift/classes.js +22 -10
  47. package/dist/swift/components.js +3 -7
  48. package/dist/swift/control-flow.js +1 -1
  49. package/dist/swift/conversion.js +5 -2
  50. package/dist/swift/core-api.js +11 -31
  51. package/dist/swift/declarations.js +1 -6
  52. package/dist/swift/expression-statements.js +7 -0
  53. package/dist/swift/expressions.js +6 -2
  54. package/dist/swift/from-any.js +1 -1
  55. package/dist/swift/functions.js +5 -6
  56. package/dist/swift/global-calls.js +1 -5
  57. package/dist/swift/lenient.js +0 -7
  58. package/dist/swift/literals.js +8 -3
  59. package/dist/swift/method-values.js +1 -19
  60. package/dist/swift/modules.js +5 -3
  61. package/dist/swift/names.js +3 -12
  62. package/dist/swift/native/api.js +3 -1
  63. package/dist/swift/native/calls.js +1 -1
  64. package/dist/swift/native/dispatch.js +2 -8
  65. package/dist/swift/object-classes.js +84 -1
  66. package/dist/swift/operators.js +37 -34
  67. package/dist/swift/optional-chains.js +1 -8
  68. package/dist/swift/parameters.js +0 -4
  69. package/dist/swift/placement.js +5 -15
  70. package/dist/swift/results.js +0 -4
  71. package/dist/swift/state-backend.js +3 -2
  72. package/dist/swift/statements.js +1 -13
  73. package/dist/swift/static-calls.js +2 -3
  74. package/dist/swift/syntax.js +9 -5
  75. package/dist/swift/translator.js +1 -11
  76. package/dist/swift/type-facts.js +3 -3
  77. package/dist/swift/types.js +3 -3
  78. package/dist/targets/ios/build.js +1 -1
  79. package/dist/types/adapter-api.d.ts +3 -3
  80. package/kit-android/generated/kotlin/org/nativescript/kit/__Modules.kt +1 -0
  81. package/kit-android/generated/kotlin/org/nativescript/kit/__Objects.kt +525 -99
  82. package/kit-android/generated/kotlin/org/nativescript/kit/accessibility_accessibility_common.kt +2 -2
  83. package/kit-android/generated/kotlin/org/nativescript/kit/application_application_common.kt +29 -6
  84. package/kit-android/generated/kotlin/org/nativescript/kit/application_helpers_common.kt +14 -0
  85. package/kit-android/generated/kotlin/org/nativescript/kit/color_color_utils.kt +3 -3
  86. package/kit-android/generated/kotlin/org/nativescript/kit/css_mediaquery_index.kt +49 -1
  87. package/kit-android/generated/kotlin/org/nativescript/kit/data_observable_array_index.kt +0 -8
  88. package/kit-android/generated/kotlin/org/nativescript/kit/data_observable_index.kt +0 -16
  89. package/kit-android/generated/kotlin/org/nativescript/kit/data_virtual_array_index.kt +6 -4
  90. package/kit-android/generated/kotlin/org/nativescript/kit/http_http_request_index.kt +19 -7
  91. package/kit-android/generated/kotlin/org/nativescript/kit/http_http_request_internal_http_request_internal_common.kt +14 -0
  92. package/kit-android/generated/kotlin/org/nativescript/kit/http_http_request_internal_index.kt +19 -10
  93. package/kit-android/generated/kotlin/org/nativescript/kit/matrix_index.kt +17 -29
  94. package/kit-android/generated/kotlin/org/nativescript/kit/media_query_list_index.kt +144 -22
  95. package/kit-android/generated/kotlin/org/nativescript/kit/npm_css_what_src_parse.kt +8 -3
  96. package/kit-android/generated/kotlin/org/nativescript/kit/org.nativescript.NativeScriptLifecycleCallbacks.kt +2 -10
  97. package/kit-android/generated/kotlin/org/nativescript/kit/ui_builder_index.kt +0 -2
  98. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_bindable_expression_parser.kt +6 -10
  99. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_properties_index.kt +531 -8
  100. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_base_index.kt +0 -9
  101. package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_weak_event_listener_index.kt +3 -3
  102. package/kit-android/generated/kotlin/org/nativescript/kit/ui_styling_style_index.kt +19 -0
  103. package/kit-android/generated/kotlin/org/nativescript/kit/ui_styling_style_properties.kt +5 -2
  104. package/kit-android/generated/kotlin/org/nativescript/kit/ui_styling_style_scope.kt +232 -174
  105. package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_view_text_view_common.kt +1 -1
  106. package/kit-android/generated/kotlin/org/nativescript/kit/utils_android_runtime_version.kt +75 -0
  107. package/kit-android/generated/manifest.json +21 -18
  108. package/kit-android/generated/source-lines.json +1 -1
  109. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Array.kt +547 -51
  110. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Intl.kt +1 -1
  111. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/JSON.kt +52 -6
  112. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Language.kt +33 -0
  113. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Prototypes.kt +9 -1
  114. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Strings.kt +32 -18
  115. package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Values.kt +137 -28
  116. package/kit-apple/Overlays/xml-free/Core/ui.builder.index.swift +1 -1
  117. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity1.swift +14 -10
  118. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity2.swift +3 -9
  119. package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity3Plus.swift +20 -21
  120. package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_index_section_view_ios_android.swift +5 -7
  121. package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_ios_android_.swift +130 -0
  122. package/kit-apple/Sources/NativeScriptKit/Core/Object_eventName_object_oldIndex_newIndex.swift +2 -4
  123. package/kit-apple/Sources/NativeScriptKit/Core/Object_specified_substituted_reads.swift +115 -0
  124. package/kit-apple/Sources/NativeScriptKit/Core/Object_substituted_values_reads.swift +113 -0
  125. package/kit-apple/Sources/NativeScriptKit/Core/Object_substituted_values_reads_.swift +113 -0
  126. package/kit-apple/Sources/NativeScriptKit/Core/application.application-common.swift +348 -330
  127. package/kit-apple/Sources/NativeScriptKit/Core/application.application.ios.swift +358 -359
  128. package/kit-apple/Sources/NativeScriptKit/Core/application.helpers-common.swift +47 -29
  129. package/kit-apple/Sources/NativeScriptKit/Core/connectivity.index.ios.swift +3 -1
  130. package/kit-apple/Sources/NativeScriptKit/Core/css-mediaquery.index.swift +95 -53
  131. package/kit-apple/Sources/NativeScriptKit/Core/css.CSS3Parser.swift +1 -1
  132. package/kit-apple/Sources/NativeScriptKit/Core/css.parser.swift +1 -1
  133. package/kit-apple/Sources/NativeScriptKit/Core/data.observable-array.index.swift +2 -2
  134. package/kit-apple/Sources/NativeScriptKit/Core/file-system.file-system-access.ios.swift +52 -43
  135. package/kit-apple/Sources/NativeScriptKit/Core/http.http-request-internal.http-request-internal-common.swift +18 -0
  136. package/kit-apple/Sources/NativeScriptKit/Core/http.http-request-internal.index.ios.swift +66 -51
  137. package/kit-apple/Sources/NativeScriptKit/Core/image-source.index.ios.swift +67 -51
  138. package/kit-apple/Sources/NativeScriptKit/Core/js-libs.easysax.easysax.swift +24 -6
  139. package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +143 -32
  140. package/kit-apple/Sources/NativeScriptKit/Core/manifest.json +30 -19
  141. package/kit-apple/Sources/NativeScriptKit/Core/media-query-list.index.swift +190 -78
  142. package/kit-apple/Sources/NativeScriptKit/Core/native-window.native-window.ios.swift +1 -1
  143. package/kit-apple/Sources/NativeScriptKit/Core/npm.css-what.src.parse.swift +205 -201
  144. package/kit-apple/Sources/NativeScriptKit/Core/npm.css-what.src.stringify.swift +41 -42
  145. package/kit-apple/Sources/NativeScriptKit/Core/npm.css-what.src.types.swift +1 -1
  146. package/kit-apple/Sources/NativeScriptKit/Core/trace.index.swift +2 -2
  147. package/kit-apple/Sources/NativeScriptKit/Core/ui.animation.index.ios.swift +77 -65
  148. package/kit-apple/Sources/NativeScriptKit/Core/ui.builder.index.swift +4 -4
  149. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.properties.index.swift +1272 -824
  150. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view-base.index.swift +2 -2
  151. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.index.ios.swift +8 -8
  152. package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view.view-common.swift +1 -1
  153. package/kit-apple/Sources/NativeScriptKit/Core/ui.frame.frame-common.swift +2 -1
  154. package/kit-apple/Sources/NativeScriptKit/Core/ui.frame.index.ios.swift +6 -6
  155. package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.flexbox-layout.index.ios.swift +22 -21
  156. package/kit-apple/Sources/NativeScriptKit/Core/ui.page.index.ios.swift +202 -188
  157. package/kit-apple/Sources/NativeScriptKit/Core/ui.repeater.index.swift +2 -6
  158. package/kit-apple/Sources/NativeScriptKit/Core/ui.split-view.index.ios.swift +3 -3
  159. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.background.ios.swift +2 -2
  160. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.clip-path-function.swift +1 -1
  161. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.css-animation-parser.swift +1 -1
  162. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.css-selector.swift +2 -2
  163. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.font-common.swift +2 -2
  164. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.style-scope.swift +869 -838
  165. package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.style.index.swift +46 -31
  166. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.formatted-string.swift +1 -2
  167. package/kit-apple/Sources/NativeScriptKit/Core/ui.text-view.text-view-common.swift +1 -1
  168. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.index.ios.swift +2 -2
  169. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.modal-transition.ios.swift +4 -4
  170. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.page-transition.ios.swift +2 -2
  171. package/kit-apple/Sources/NativeScriptKit/Core/ui.transition.shared-transition-helper.ios.swift +17 -17
  172. package/kit-apple/Sources/NativeScriptKit/Core/utils.android-runtime-version.swift +77 -0
  173. package/kit-apple/Sources/NativeScriptKit/Core/utils.debug-source.swift +2 -2
  174. package/kit-apple/Sources/NativeScriptKit/Core/xhr.index.swift +62 -61
  175. package/kit-apple/Sources/NativeScriptKit/Runtime/Array.swift +4 -0
  176. package/kit-apple/Sources/NativeScriptKit/Runtime/Dynamic.swift +2 -0
  177. package/kit-apple/Sources/NativeScriptKit/Runtime/Interop.swift +1 -1
  178. package/kit-apple/Sources/NativeScriptKit/Runtime/Intl.swift +1 -1
  179. package/kit-apple/Sources/NativeScriptKit/Runtime/Iterators.swift +1 -1
  180. package/kit-apple/Sources/NativeScriptKit/Runtime/JSON.swift +413 -73
  181. package/kit-apple/Sources/NativeScriptKit/Runtime/Lowering.swift +3 -2
  182. package/kit-apple/Sources/NativeScriptKit/Runtime/Prototypes.swift +14 -1
  183. package/kit-apple/Sources/NativeScriptKit/Runtime/Symbol.swift +1 -0
  184. package/kit-apple/Sources/NativeScriptKit/Runtime/Values.swift +1 -0
  185. package/kit-apple/Sources/NativeScriptKit/Runtime/Views.swift +2 -0
  186. package/package.json +2 -2
@@ -412,92 +412,100 @@ open class XMLHttpRequest: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
412
412
  } else if data is JSArrayBuffer {
413
413
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:247)
414
414
  try jsSet(self._options, "content", (data as? JSArrayBuffer))
415
+ } else if JSArrayBuffer.isView(data) {
416
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:249)
417
+ try jsSet(
418
+ self._options, "content",
419
+ JSUint8Array.from(
420
+ jsUnwrap(data as? JSArrayBufferView, "buffer").buffer,
421
+ jsUnwrap(data as? JSArrayBufferView, "byteOffset").byteOffset,
422
+ jsUnwrap(data as? JSArrayBufferView, "byteLength").byteLength))
415
423
  }
416
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:250)
417
- self._sendFlag = true
418
424
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:252)
419
- try self.emitEvent("loadstart", JSArray<Any?>())
425
+ self._sendFlag = true
420
426
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:254)
427
+ try self.emitEvent("loadstart", JSArray<Any?>())
428
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:256)
421
429
  _ = try jsUnwrap(
422
430
  jsUnwrap(Core_http_http_request_index.request(self._options), "then").then({ (r: Any?) throws -> Void in
423
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:256)
431
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:258)
424
432
  if !self._errorFlag && self._sendFlag {
425
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:257)
433
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:259)
426
434
  try self._loadResponse(r)
427
435
  }
428
436
  }), "catch"
429
437
  ).catch({ (e: Any?) throws -> Void in
430
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:261)
438
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:263)
431
439
  self._errorFlag = true
432
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:262)
440
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:264)
433
441
  self._sendFlag = false
434
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:263)
442
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:265)
435
443
  try self._setRequestError("error", e)
436
444
  })
437
445
  }
438
446
  #sourceLocation()
439
447
  open func setRequestHeader(_ header: String, _ value: String) throws {
440
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:268)
448
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:270)
441
449
  if !jsLenientNumberEquals(self._readyState, self.OPENED) || self._sendFlag {
442
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:269)
450
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:271)
443
451
  throw JSException(
444
452
  value: JSError(
445
453
  "Failed to execute 'setRequestHeader' on 'XMLHttpRequest': " + "The object's state must be OPENED.")
446
454
  )
447
455
  }
448
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:272)
456
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:274)
449
457
  if Core_utils_types.isString(header) && Core_utils_types.isString(value) {
450
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:273)
458
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:275)
451
459
  try jsSet(jsGet(self._options, "headers"), header, value)
452
460
  }
453
461
  }
454
462
  #sourceLocation()
455
463
  open func getAllResponseHeaders() throws -> String {
456
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:278)
464
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:280)
457
465
  if self._readyState < 2 || self._errorFlag {
458
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:279)
466
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:281)
459
467
  return ""
460
468
  }
461
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:282)
462
- var result: String = ""
463
469
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:284)
470
+ var result: String = ""
471
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:286)
464
472
  for i in jsKeysOf(self._headers) {
465
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:285)
473
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:287)
466
474
  try result += i + ": " + jsToStringDefaultThrowing(jsGet(self._headers, i)) + "\r\n"
467
475
  }
468
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:288)
476
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:290)
469
477
  return jsSubstr(result, 0, Double(result.utf16.count) - 2)
470
478
  }
471
479
  #sourceLocation()
472
480
  open func getResponseHeader(_ header: String) throws -> String? {
473
481
  var header = header
474
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:292)
482
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:294)
475
483
  if (Core_utils_types.isString(header) && self._readyState > 1 && jsTruthy(self._headers)) && !self._errorFlag {
476
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:293)
484
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:295)
477
485
  header = header.lowercased()
478
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:294)
486
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:296)
479
487
  for i in jsKeysOf(self._headers) {
480
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:295)
488
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:297)
481
489
  if jsStringEquals(i.lowercased(), header) {
482
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:296)
490
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:298)
483
491
  return try jsConvertedStringOrNil(jsGet(self._headers, i))
484
492
  }
485
493
  }
486
494
  }
487
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:301)
495
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:303)
488
496
  return nil
489
497
  }
490
498
  #sourceLocation()
491
499
  open func overrideMimeType(_ mime: String) throws {
492
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:305)
500
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:307)
493
501
  if jsLenientNumberEquals(self._readyState, self.LOADING) || jsLenientNumberEquals(self._readyState, self.DONE) {
494
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:306)
502
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:308)
495
503
  throw JSException(
496
504
  value: JSError(
497
505
  "Failed to execute 'overrideMimeType' on 'XMLHttpRequest': "
498
506
  + "MimeType cannot be overridden when the state is LOADING or DONE."))
499
507
  }
500
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:309)
508
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:311)
501
509
  self._overrideMimeType = mime
502
510
  }
503
511
  #sourceLocation()
@@ -794,7 +802,7 @@ open class FormData: JSDynamic, JSStringConvertible, JSExpando, JSStaticKeyed {
794
802
  nonisolated deinit {}
795
803
  open var _data: JSMap<String, Any?>? = JSMap<String, Any?>()
796
804
  public init() {
797
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:360)
805
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:362)
798
806
  self._data = JSMap<String, Any?>()
799
807
  }
800
808
  #sourceLocation()
@@ -807,19 +815,19 @@ open class FormData: JSDynamic, JSStringConvertible, JSExpando, JSStaticKeyed {
807
815
  open var jsSymbolKeys: [String] { jsExpando?.jsSymbolKeys ?? [] }
808
816
  open func jsDeleteOwn(_ key: String) -> Bool { jsExpando?.delete(key) ?? true }
809
817
  open func append(_ name: String, _ value: Any?) throws {
810
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:364)
818
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:366)
811
819
  _ = try jsUnwrap(self._data, "set").set(name, value)
812
820
  }
813
821
  #sourceLocation()
814
822
  open func toString() throws -> String {
815
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:368)
816
- let arr: JSArray<String> = JSArray<String>()
817
823
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:370)
824
+ let arr: JSArray<String> = JSArray<String>()
825
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:372)
818
826
  try jsUnwrap(self._data, "forEach").forEach { (value: Any?, name: String, map: JSMap<String, Any?>) -> Void in
819
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:371)
827
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:373)
820
828
  _ = arr.push("\(jsEncodeURIComponent(name))=\(jsEncodeURIComponent(jsToString(value)))")
821
829
  }
822
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:374)
830
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:376)
823
831
  return arr.join("&")
824
832
  }
825
833
  #sourceLocation()
@@ -877,7 +885,7 @@ open class BlobInternalAccessor: JSDynamic, JSExpando, JSConstructibleType, JSSt
877
885
  open var jsSymbolKeys: [String] { jsExpando?.jsSymbolKeys ?? [] }
878
886
  open func jsDeleteOwn(_ key: String) -> Bool { jsExpando?.delete(key) ?? true }
879
887
  open class func getBuffer(_ blob: Blob?) throws -> JSUint8Array? {
880
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:381)
888
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:383)
881
889
  return try jsUnwrap(blob, "_buffer")._buffer
882
890
  }
883
891
  #sourceLocation()
@@ -904,41 +912,34 @@ open class Blob: JSDynamic, JSStringConvertible, JSToStringTag, JSExpando, JSKey
904
912
  open var _type: String = ""
905
913
  open var jsToStringTag: String = "Blob"
906
914
  public init(_ chunks: JSArray<Any?>? = nil, _ opts: Any? = nil) throws {
907
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:399)
915
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:401)
908
916
  let chunks: JSArray<Any?> = chunks ?? JSArray<Any?>()
909
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:399)
917
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:401)
910
918
  let opts: Any? = opts ?? JSObject([])
911
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:400)
919
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:402)
912
920
  let dataChunks: JSArray<JSUint8Array> = JSArray<JSUint8Array>()
913
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:401)
921
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:403)
914
922
  for chunk in try jsIterated(chunks, "chunks is not iterable") {
915
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:402)
923
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:404)
916
924
  if chunk is Blob {
917
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:403)
925
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:405)
918
926
  _ = try dataChunks.push(
919
927
  jsObjectRequired(jsUnwrap(jsShaped(chunk) { try NativeScriptKit.Blob() }, "_buffer")._buffer))
920
928
  } else if jsStringEquals(jsTypeof(chunk), "string") {
921
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:405)
929
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:407)
922
930
  let textEncoder: JSTextEncoder = JSTextEncoder()
923
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:406)
924
- _ = try dataChunks.push(jsObjectRequired(textEncoder.encode(jsLenientString(chunk))))
925
- } else if chunk is JSDataView {
926
931
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:408)
927
- _ = try dataChunks.push(
928
- JSUint8Array.from(jsCallMethod(jsUnwrap(chunk as? JSDataView, "buffer").buffer, "slice", Double(0)))
929
- )
930
- } else if (chunk is JSArrayBuffer) || JSArrayBuffer.isView((chunk as? JSArrayBufferView)) {
932
+ _ = try dataChunks.push(jsObjectRequired(textEncoder.encode(jsLenientString(chunk))))
933
+ } else if (chunk is JSArrayBuffer) || JSArrayBuffer.isView(chunk) {
931
934
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:410)
932
935
  _ = try dataChunks.push(
933
- JSUint8Array(
934
- buffer: jsObjectRequired(
935
- (JSArrayBuffer.isView(chunk)
936
- ? jsObjectRequired(
937
- jsUnwrap(
938
- jsUnwrap(chunk as? JSArrayBufferView, "buffer").buffer as? JSArrayBuffer,
939
- "slice"
940
- ).slice(0)) : jsObjectRequired(jsUnwrap(chunk as? JSArrayBuffer, "slice").slice(0)))
941
- )))
936
+ JSUint8Array.from(
937
+ (JSArrayBuffer.isView(chunk)
938
+ ? jsCallMethod(
939
+ jsGet(chunk, "buffer"), "slice", jsGet(chunk, "byteOffset"),
940
+ jsConvertedNumber(jsGet(chunk, "byteOffset"))
941
+ + jsConvertedNumber(jsGet(chunk, "byteLength")))
942
+ : (jsObjectRequired(jsUnwrap(chunk as? JSArrayBuffer, "slice").slice(0)) as Any?))))
942
943
  } else {
943
944
  #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:412)
944
945
  let textEncoder: JSTextEncoder = JSTextEncoder()
@@ -988,12 +989,12 @@ open class Blob: JSDynamic, JSStringConvertible, JSToStringTag, JSExpando, JSKey
988
989
  }
989
990
  #sourceLocation()
990
991
  open var size: Double {
991
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:393)
992
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:395)
992
993
  return self._size
993
994
  }
994
995
  #sourceLocation()
995
996
  open var type: String {
996
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:396)
997
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:398)
997
998
  return self._type
998
999
  }
999
1000
  #sourceLocation()
@@ -1671,7 +1672,7 @@ public func __init_Core_xhr_index() {
1671
1672
  guard let __o = __this as? XMLHttpRequest else { throw JSException(JSTypeError("Illegal invocation")) }
1672
1673
  return __o.statusText
1673
1674
  }, set: nil)
1674
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:379)
1675
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:381)
1675
1676
  JSPrototypes.declareStatics(
1676
1677
  BlobInternalAccessor.self,
1677
1678
  [
@@ -1682,7 +1683,7 @@ public func __init_Core_xhr_index() {
1682
1683
  }
1683
1684
  )
1684
1685
  ])
1685
- #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:385)
1686
+ #sourceLocation(file:"@nativescript/core/xhr.index.ts",line:387)
1686
1687
  JSPrototypes.declare(
1687
1688
  Blob.self, "size",
1688
1689
  get: { (__this: Any?) throws -> Any? in
@@ -1267,6 +1267,10 @@ extension JSArray: JSArrayViewing {
1267
1267
  static func jsViewing(_ source: JSArrayProtocol) -> AnyObject { source.jsView(as: Element.self) }
1268
1268
  }
1269
1269
 
1270
+ extension Optional: JSArrayViewing where Wrapped: JSArrayViewing {
1271
+ static func jsViewing(_ source: JSArrayProtocol) -> AnyObject { Wrapped.jsViewing(source) }
1272
+ }
1273
+
1270
1274
  /// An array type an array of another element type, whose elements it can hold, becomes, keeping that array as its view.
1271
1275
  protocol JSArrayAdopting {
1272
1276
  static func jsAdopt(_ plain: JSArrayAdoptable) -> AnyObject?
@@ -252,6 +252,7 @@ public func jsDefineProperty(_ object: Any?, _ key: String, _ descriptor: Any?)
252
252
 
253
253
  /// An object of a program class whose declared fields `Object.defineProperty` may give a descriptor (an accessor, read-only,
254
254
  /// hidden): such a field's reads and writes go through `subscript(jsKey:)`, which defers to the descriptor kept beside the object.
255
+ @MainActor
255
256
  public protocol JSDefinable: JSDynamic {
256
257
  func jsDefinable(_ key: String) -> Bool
257
258
  }
@@ -399,6 +400,7 @@ public func jsObjectFromEntries<S: Sequence>(_ entries: S) throws -> JSRecord<An
399
400
  }
400
401
 
401
402
  /// An object that can lose an own property (`delete o.x`).
403
+ @MainActor
402
404
  public protocol JSDeletable: AnyObject {
403
405
  func jsDeleteOwn(_ key: String) -> Bool
404
406
  }
@@ -27,7 +27,7 @@ public final class InteropReference {
27
27
  }
28
28
  /// A Core Foundation error out-parameter: what the function writes is owned by the caller, and held as an NSError.
29
29
  public var cfError: Unmanaged<CFError>? {
30
- get { (value as? NSError).map { Unmanaged.passUnretained($0 as CFError) } }
30
+ get { (value as? NSError).map { Unmanaged.passUnretained(unsafeBitCast($0, to: CFError.self)) } }
31
31
  set { value = newValue.map { $0.takeRetainedValue() as Error as NSError } }
32
32
  }
33
33
  }
@@ -696,7 +696,7 @@ public final class JSDateTimeFormat: JSDynamic {
696
696
  }
697
697
 
698
698
  private func zoneName(_ date: Date, long: Bool) -> String {
699
- if timeZoneId == "UTC" { return long ? "Coordinated Universal Time" : "UTC" }
699
+ if timeZoneId == "UTC" || timeZoneId == "GMT" || timeZoneId == "Etc/UTC" { return long ? "Coordinated Universal Time" : "UTC" }
700
700
  // ICU's zone names start in 1970; before, a zone is its offset from GMT.
701
701
  if date.timeIntervalSince1970 < 0 { return offsetName(date, long: long) }
702
702
  if long {
@@ -646,7 +646,7 @@ public func jsAsyncIteratorOf(_ value: Any?) throws -> JSAsyncIterator<Any?> {
646
646
  }
647
647
 
648
648
  /// AsyncIteratorClose for `for await` leaving early: awaits `return()` when the iterator has one.
649
- public func jsAsyncClose(_ iterator: JSAsyncIteratorProtocol, _ then: @escaping () -> Void, _ onError: @escaping (Any?) -> Void) {
649
+ public func jsAsyncClose(_ iterator: JSAsyncIteratorProtocol, _ then: @escaping @MainActor () -> Void, _ onError: @escaping (Any?) -> Void) {
650
650
  guard let promise = iterator.jsReturnPromise(nil) else { return then() }
651
651
  jsAwait(promise, { result in
652
652
  guard let object = jsFlat(result), jsIsObject(object), !(object is JSNull) else { return onError(JSTypeError("Iterator result \(jsToString(result)) is not an object")) }