@nstudio/nativescript-compiler 9.2.0-alpha.13 → 9.2.0-alpha.15
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/css/worker.js +2 -2
- package/dist/driver/compile.js +4 -3
- package/dist/kotlin/arguments.js +7 -3
- package/dist/kotlin/assignment.js +3 -0
- package/dist/kotlin/builtins.js +15 -4
- package/dist/kotlin/class-constructor.js +3 -1
- package/dist/kotlin/class-methods.js +9 -2
- package/dist/kotlin/components.js +39 -14
- package/dist/kotlin/construction.js +4 -5
- package/dist/kotlin/conversion.js +19 -3
- package/dist/kotlin/core-api.js +31 -7
- package/dist/kotlin/declarations.js +8 -3
- package/dist/kotlin/expressions.js +10 -5
- package/dist/kotlin/library.js +2 -2
- package/dist/kotlin/modules.js +9 -4
- package/dist/kotlin/names.js +5 -2
- package/dist/kotlin/narrowing.js +2 -1
- package/dist/kotlin/optional-chains.js +24 -5
- package/dist/kotlin/overrides.js +7 -2
- package/dist/kotlin/placement.js +5 -4
- package/dist/kotlin/static-calls.js +17 -5
- package/dist/kotlin/translator.js +15 -39
- package/dist/kotlin/type-facts.js +3 -2
- package/dist/kotlin/types.js +6 -5
- package/dist/kotlin/untyped-values.js +7 -1
- package/dist/program/program.js +3 -3
- package/dist/semantics/apis/array.js +11 -0
- package/dist/semantics/classes.js +24 -0
- package/dist/semantics/config.js +2 -0
- package/dist/semantics/forms/by-name.js +30 -18
- package/dist/semantics/globals.js +8 -2
- package/dist/semantics/lang.js +4 -0
- package/dist/semantics/ledger.js +0 -24
- package/dist/semantics/platform-globals.js +0 -16
- package/dist/semantics/refusals.js +1 -1
- package/dist/semantics/runtime.js +2 -0
- package/dist/semantics/throws.js +7 -0
- package/dist/semantics/worker-state.js +41 -1
- package/dist/swift/assignment.js +3 -0
- package/dist/swift/builtins.js +20 -12
- package/dist/swift/class-methods.js +3 -1
- package/dist/swift/construction.js +5 -1
- package/dist/swift/conversion.js +1 -1
- package/dist/swift/expressions.js +2 -4
- package/dist/swift/from-any.js +5 -0
- package/dist/swift/global-calls.js +8 -1
- package/dist/swift/library.js +1 -1
- package/dist/swift/modules.js +2 -1
- package/dist/swift/object-classes.js +2 -1
- package/dist/swift/protocols.js +5 -16
- package/dist/swift/type-facts.js +2 -0
- package/dist/swift/types.js +7 -6
- package/dist/targets/android/build.js +9 -7
- package/dist/targets/ios/build.js +23 -8
- package/docs/cli/compile-ios.md +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/file_system_file_system_access.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/http_http_request_internal_index.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_properties_index.kt +6 -6
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_core_view_view_common.kt +1 -1
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_formatted_string.kt +2 -2
- package/kit-android/generated/kotlin/org/nativescript/kit/ui_text_base_text_base_common.kt +2 -2
- package/kit-android/gradlew.bat +2 -2
- package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Collections.kt +15 -6
- package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Iterators.kt +1 -0
- package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Promise.kt +5 -4
- package/kit-android/src/main/kotlin/org/nativescript/kit/runtime/Workers.kt +39 -11
- package/kit-apple/Overlays/xml-free/Core/ui.core.bindable.index.swift +13 -2
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity1.swift +0 -12
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity2.swift +0 -39
- package/kit-apple/Sources/NativeScriptKit/Core/FunctionCells.Arity3Plus.swift +0 -44
- package/kit-apple/Sources/NativeScriptKit/Core/application.application-common.swift +19 -2
- package/kit-apple/Sources/NativeScriptKit/Core/kit-index.json +87 -22
- package/kit-apple/Sources/NativeScriptKit/Core/text.text-common.swift +9 -1
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.bindable.index.swift +13 -2
- package/kit-apple/Sources/NativeScriptKit/Core/ui.core.view-base.index.swift +26 -2
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.liquid-glass-container.index.ios.swift +12 -2
- package/kit-apple/Sources/NativeScriptKit/Core/ui.layouts.root-layout.root-layout-common.swift +46 -6
- package/kit-apple/Sources/NativeScriptKit/Core/ui.list-view.index.ios.swift +37 -3
- package/kit-apple/Sources/NativeScriptKit/Core/ui.split-view.split-view-common.swift +12 -1
- package/kit-apple/Sources/NativeScriptKit/Core/ui.styling.css-selector.swift +50 -6
- package/kit-apple/Sources/NativeScriptKit/Core/ui.text-base.text-base-common.swift +13 -1
- package/kit-apple/Sources/NativeScriptKit/Runtime/Collections.swift +5 -1
- package/kit-apple/Sources/NativeScriptKit/Runtime/Dynamic.swift +13 -2
- package/kit-apple/Sources/NativeScriptKit/Runtime/Errors.swift +10 -2
- package/kit-apple/Sources/NativeScriptKit/Runtime/Functions.swift +57 -12
- package/kit-apple/Sources/NativeScriptKit/Runtime/Lowering.swift +12 -3
- package/kit-apple/Sources/NativeScriptKit/Runtime/Promise.swift +56 -29
- package/kit-apple/Sources/NativeScriptKit/Runtime/Realm.swift +92 -0
- package/kit-apple/Sources/NativeScriptKit/Runtime/Record.swift +25 -5
- package/kit-apple/Sources/NativeScriptKit/Runtime/RegExp.swift +13 -4
- package/kit-apple/Sources/NativeScriptKit/Runtime/RegExpEngine.swift +14 -5
- package/kit-apple/Sources/NativeScriptKit/Runtime/Symbol.swift +28 -6
- package/kit-apple/Sources/NativeScriptKit/Runtime/Threads.swift +2 -2
- package/kit-apple/Sources/NativeScriptKit/Runtime/Timers.swift +93 -47
- package/kit-apple/Sources/NativeScriptKit/Runtime/TypedArrays.swift +37 -9
- package/kit-apple/Sources/NativeScriptKit/Runtime/Values.swift +6 -4
- package/kit-apple/Sources/NativeScriptKit/Runtime/Views.swift +11 -2
- package/kit-apple/Sources/NativeScriptKit/Runtime/Workers.swift +680 -0
- package/package.json +1 -1
package/kit-android/gradlew.bat
CHANGED
|
@@ -70,11 +70,11 @@ goto fail
|
|
|
70
70
|
:execute
|
|
71
71
|
@rem Setup the command line
|
|
72
72
|
|
|
73
|
-
set CLASSPATH
|
|
73
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
@rem Execute Gradle
|
|
77
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%"
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
78
78
|
|
|
79
79
|
:end
|
|
80
80
|
@rem End local scope for the variables with windows NT shell
|
|
@@ -376,6 +376,8 @@ open class JSSet<T>() : Iterable<T>, JSReactiveConvertible {
|
|
|
376
376
|
* key order (integer-like keys ascending, then insertion order) and reference semantics.
|
|
377
377
|
*/
|
|
378
378
|
class JSRecord<V>(val obj: JSObject) : JSDynamic, JSReactiveConvertible {
|
|
379
|
+
internal var backing: JSDynamic? = null
|
|
380
|
+
|
|
379
381
|
constructor() : this(JSObject())
|
|
380
382
|
|
|
381
383
|
constructor(entries: List<Pair<String, V>>) : this() {
|
|
@@ -383,9 +385,12 @@ class JSRecord<V>(val obj: JSObject) : JSDynamic, JSReactiveConvertible {
|
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
@Suppress("UNCHECKED_CAST")
|
|
386
|
-
operator fun get(key: String): V? = obj[key] as V?
|
|
388
|
+
operator fun get(key: String): V? = if (obj.has(key)) obj[key] as V? else backing?.jsGet(key) as V?
|
|
387
389
|
|
|
388
|
-
operator fun set(key: String, value: V?) {
|
|
390
|
+
operator fun set(key: String, value: V?) {
|
|
391
|
+
obj[key] = value
|
|
392
|
+
backing?.jsSet(key, value)
|
|
393
|
+
}
|
|
389
394
|
|
|
390
395
|
fun delete(key: String): Boolean = obj.delete(key)
|
|
391
396
|
fun has(key: String): Boolean = obj.has(key)
|
|
@@ -396,8 +401,11 @@ class JSRecord<V>(val obj: JSObject) : JSDynamic, JSReactiveConvertible {
|
|
|
396
401
|
@Suppress("UNCHECKED_CAST")
|
|
397
402
|
val entries: JSArray<Pair<String, V>> get() = JSArray(obj.jsKeys.map { Pair(it, obj[it] as V) })
|
|
398
403
|
|
|
399
|
-
override fun jsGet(key: String): Any? = obj.jsGet(key)
|
|
400
|
-
override fun jsSet(key: String, value: Any?)
|
|
404
|
+
override fun jsGet(key: String): Any? = if (obj.has(key)) obj.jsGet(key) else backing?.jsGet(key)
|
|
405
|
+
override fun jsSet(key: String, value: Any?) {
|
|
406
|
+
obj.jsSet(key, value)
|
|
407
|
+
backing?.jsSet(key, value)
|
|
408
|
+
}
|
|
401
409
|
override val jsKeys: List<String> get() = obj.jsKeys
|
|
402
410
|
override val jsClassName: String? get() = null
|
|
403
411
|
|
|
@@ -408,14 +416,15 @@ class JSRecord<V>(val obj: JSObject) : JSDynamic, JSReactiveConvertible {
|
|
|
408
416
|
|
|
409
417
|
/**
|
|
410
418
|
* An untyped value read as a dictionary (`Record<string, V>`): a plain object is
|
|
411
|
-
* shared, so writes through either show in both; another object's own keys are copied
|
|
419
|
+
* shared, so writes through either show in both; another object's own keys are copied
|
|
420
|
+
* and its dynamic lookup (methods, getters) stays reachable as a fallback.
|
|
412
421
|
*/
|
|
413
422
|
@Suppress("UNCHECKED_CAST")
|
|
414
423
|
fun <V> jsRecordOrNull(value: Any?): JSRecord<V>? = when (value) {
|
|
415
424
|
null, JSNull -> null
|
|
416
425
|
is JSRecord<*> -> value as JSRecord<V>
|
|
417
426
|
is JSObject -> JSRecord(value)
|
|
418
|
-
is JSDynamic -> JSRecord<V>().also { r -> for (k in value.jsKeys) r.obj[k] = value.jsGet(k) }
|
|
427
|
+
is JSDynamic -> JSRecord<V>().also { r -> r.backing = value; for (k in value.jsKeys) r.obj[k] = value.jsGet(k) }
|
|
419
428
|
else -> throw JSException(JSTypeError("${jsTypeof(value)} is not an object"))
|
|
420
429
|
}
|
|
421
430
|
|
|
@@ -205,6 +205,7 @@ fun <T> jsAsyncIterable(value: JSAsyncIterableValue): JSAsyncIterable<T> = JSAsy
|
|
|
205
205
|
/** GetIterator for an untyped value. */
|
|
206
206
|
fun jsIteratorOf(value: Any?, message: String? = null): JSIterator<Any?> = when (val v = jsBox(value)) {
|
|
207
207
|
is JSIterableValue -> JSIteratorAdapter(v.jsAnyIterator())
|
|
208
|
+
is JSTypedArray<*, *> -> { val values = v.jsAnyValues.iterator(); JSIterator { if (values.hasNext()) values.next() else JSIterator.END } }
|
|
208
209
|
is JSArray<*> -> { var i = 0; JSIterator { if (i < v.storage.size) v.storage[i++] else JSIterator.END } }
|
|
209
210
|
is String -> JSIteratorAdapter(jsIterator(v))
|
|
210
211
|
is JSMatch -> jsIteratorOf(v.values)
|
|
@@ -259,14 +259,15 @@ class JSPromise<T> internal constructor() : JSThenable, JSDynamic {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
/** Resolving with a native promise: NewPromiseResolveThenableJob, then that promise's `then`. */
|
|
262
|
-
|
|
262
|
+
@Suppress("UNCHECKED_CAST")
|
|
263
|
+
internal fun adopt(other: JSPromise<*>) {
|
|
263
264
|
if (other === this) {
|
|
264
265
|
settleRejected(JSTypeError("Chaining cycle detected for promise #<Promise>"))
|
|
265
266
|
return
|
|
266
267
|
}
|
|
267
268
|
Microtasks.enqueue {
|
|
268
269
|
val resolvers = JSResolvers(this)
|
|
269
|
-
other.performThen({ resolvers.resolve(it) }, { resolvers.reject(it) })
|
|
270
|
+
other.performThen({ resolvers.resolve(it as T) }, { resolvers.reject(it) })
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
|
|
@@ -314,7 +315,7 @@ class JSPromise<T> internal constructor() : JSThenable, JSDynamic {
|
|
|
314
315
|
viewed?.let { source ->
|
|
315
316
|
val read = viewRead!!
|
|
316
317
|
source.performThen({ v ->
|
|
317
|
-
val typed = try { read(v) } catch (e: Throwable) { onRejected(jsCaught(e)); return@performThen }
|
|
318
|
+
val typed = try { read(jsBox(v)) } catch (e: Throwable) { onRejected(jsCaught(e)); return@performThen }
|
|
318
319
|
onFulfilled(typed)
|
|
319
320
|
}, onRejected)
|
|
320
321
|
return
|
|
@@ -629,7 +630,7 @@ class JSAsync<T> {
|
|
|
629
630
|
}
|
|
630
631
|
|
|
631
632
|
/** `return promise`: adopted through a NewPromiseResolveThenableJob, two ticks later than `return await`. */
|
|
632
|
-
fun returnPromise(other: JSPromise
|
|
633
|
+
fun returnPromise(other: JSPromise<*>) {
|
|
633
634
|
if (settled) return
|
|
634
635
|
settled = true
|
|
635
636
|
promise.adopt(other)
|
|
@@ -54,13 +54,13 @@ class JSErrorEvent(val message: String) : JSDynamic {
|
|
|
54
54
|
* runs in one live worker at a time; a new one of a script whose worker is stopping starts once
|
|
55
55
|
* that worker's thread has ended.
|
|
56
56
|
*/
|
|
57
|
-
class JSWorker(
|
|
57
|
+
class JSWorker private constructor(private val scope: JSObject?) : JSDynamic {
|
|
58
58
|
var onmessage: ((JSMessageEvent) -> Any?)? = null
|
|
59
59
|
var onerror: ((JSErrorEvent) -> Any?)? = null
|
|
60
60
|
|
|
61
61
|
private val owner = JSRealm.current()
|
|
62
62
|
private val realm = JSRealm()
|
|
63
|
-
private
|
|
63
|
+
private var key: String = ""
|
|
64
64
|
private val inbox = LinkedBlockingQueue<() -> Unit>()
|
|
65
65
|
/** `terminate()`: nothing more runs in the worker, and nothing more reaches the creator. */
|
|
66
66
|
@Volatile private var terminated = false
|
|
@@ -69,11 +69,11 @@ class JSWorker(scriptURL: Any?, script: String? = null) : JSDynamic {
|
|
|
69
69
|
/** When the worker's next timer is due, in `System.nanoTime()`; only its thread reads and writes it. */
|
|
70
70
|
private var wake: Long? = null
|
|
71
71
|
/** The worker's thread; it ends once the worker is terminated or closed and its running task returns. */
|
|
72
|
-
|
|
72
|
+
lateinit var thread: Thread
|
|
73
73
|
|
|
74
74
|
private val live: Boolean get() = !terminated && !closing
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
constructor(scriptURL: Any?, script: String? = null) : this(null) {
|
|
77
77
|
val entry = script?.let { scripts[it] }
|
|
78
78
|
?: throw JSException(JSError("Worker script ${jsToString(scriptURL)} was not compiled with the app"))
|
|
79
79
|
if (owner.post == null) throw JSException(JSError("Worker: the creating thread has no event loop to receive messages"))
|
|
@@ -144,6 +144,11 @@ class JSWorker(scriptURL: Any?, script: String? = null) : JSDynamic {
|
|
|
144
144
|
|
|
145
145
|
/** `worker.postMessage(message, transfer)`: the buffers listed move to the worker; a stopped worker drops it. */
|
|
146
146
|
fun postMessage(message: Any?, transfer: Any? = null) {
|
|
147
|
+
if (scope != null) {
|
|
148
|
+
if (transfer == null) jsCallMethod(scope, "postMessage", message)
|
|
149
|
+
else jsCallMethod(scope, "postMessage", message, transfer)
|
|
150
|
+
return
|
|
151
|
+
}
|
|
147
152
|
if (!live) return
|
|
148
153
|
val data = jsStructuredClone(message, jsTransferred(transfer))
|
|
149
154
|
inbox.put { jsGetOptional(realm.global, "onmessage")?.let { jsCall(it, JSMessageEvent(data)) } }
|
|
@@ -185,26 +190,42 @@ class JSWorker(scriptURL: Any?, script: String? = null) : JSDynamic {
|
|
|
185
190
|
|
|
186
191
|
/** `terminate()`: queued messages and timers are dropped; a blocking call in progress finishes first. */
|
|
187
192
|
fun terminate() {
|
|
193
|
+
if (scope != null) {
|
|
194
|
+
jsCallMethod(scope, "close")
|
|
195
|
+
return
|
|
196
|
+
}
|
|
188
197
|
if (terminated) return
|
|
189
198
|
terminated = true
|
|
190
199
|
inbox.put {}
|
|
191
200
|
}
|
|
192
201
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"onerror" -> onerror
|
|
198
|
-
else -> null
|
|
202
|
+
/** `close()`: on a worker global scope, stops the worker after the current task. */
|
|
203
|
+
fun close() {
|
|
204
|
+
if (scope != null) jsCallMethod(scope, "close")
|
|
205
|
+
else terminate()
|
|
199
206
|
}
|
|
207
|
+
|
|
208
|
+
override fun jsGet(key: String): Any? =
|
|
209
|
+
if (scope != null) scope.jsGet(key)
|
|
210
|
+
else when (key) {
|
|
211
|
+
"postMessage" -> JSMethod { _, a -> postMessage(a.getOrNull(0), a.getOrNull(1)); null }
|
|
212
|
+
"terminate" -> JSMethod { _, _ -> terminate(); null }
|
|
213
|
+
"onmessage" -> onmessage
|
|
214
|
+
"onerror" -> onerror
|
|
215
|
+
else -> null
|
|
216
|
+
}
|
|
200
217
|
override fun jsSet(key: String, value: Any?) {
|
|
218
|
+
if (scope != null) {
|
|
219
|
+
scope.jsSet(key, value)
|
|
220
|
+
return
|
|
221
|
+
}
|
|
201
222
|
val handler: ((Any?) -> Any?)? = if (jsIsFunction(value)) { event -> jsCall(value, event) } else null
|
|
202
223
|
when (key) {
|
|
203
224
|
"onmessage" -> onmessage = handler
|
|
204
225
|
"onerror" -> onerror = handler
|
|
205
226
|
}
|
|
206
227
|
}
|
|
207
|
-
override val jsKeys: List<String> get() = emptyList()
|
|
228
|
+
override val jsKeys: List<String> get() = scope?.jsKeys ?: emptyList()
|
|
208
229
|
override val jsClassName: String? get() = "Worker"
|
|
209
230
|
|
|
210
231
|
companion object {
|
|
@@ -213,6 +234,13 @@ class JSWorker(scriptURL: Any?, script: String? = null) : JSDynamic {
|
|
|
213
234
|
|
|
214
235
|
/** A worker script the app compiled, by its path in the app: its module's top level, run on the worker's thread. */
|
|
215
236
|
fun register(script: String, entry: () -> Unit) { scripts[script] = entry }
|
|
237
|
+
|
|
238
|
+
/** `globalThis as Worker` inside a worker script: wraps the worker realm's global object as a `JSWorker`. */
|
|
239
|
+
fun fromAny(value: Any?): JSWorker = when (value) {
|
|
240
|
+
is JSWorker -> value
|
|
241
|
+
is JSObject -> JSWorker(value)
|
|
242
|
+
else -> jsUnchecked(jsJavaArgument(value))
|
|
243
|
+
}
|
|
216
244
|
}
|
|
217
245
|
}
|
|
218
246
|
|
|
@@ -1202,8 +1202,19 @@ open class Binding: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
1202
1202
|
return FunctionCell_AnyOpt_JSArray_String_Opt_to_JSArray_AnyOpt_Opt.script(
|
|
1203
1203
|
"resolveObjectsAndProperties", 2, self.resolveObjectsAndProperties)
|
|
1204
1204
|
case "prepareContextForExpression":
|
|
1205
|
-
return
|
|
1206
|
-
|
|
1205
|
+
return { (__f: @escaping (Any?, Any?, String, JSArray<Any?>?) throws -> Bool) -> JSFunctionObject in
|
|
1206
|
+
jsBoxedFunction(FunctionCell_AnyOpt_AnyOpt_String_JSArray_AnyOpt_Opt_to_Bool(f: __f)) {
|
|
1207
|
+
jsFunction("prepareContextForExpression", 3) { (__a: [Any?]) throws -> Any? in
|
|
1208
|
+
if __a.count <= 3 {
|
|
1209
|
+
return try self.prepareContextForExpression(
|
|
1210
|
+
jsArg(__a, 0), jsArg(__a, 1), (try jsConvertedString(jsArg(__a, 2))))
|
|
1211
|
+
}
|
|
1212
|
+
return try __f(
|
|
1213
|
+
jsArg(__a, 0), jsArg(__a, 1), (try jsConvertedString(jsArg(__a, 2))),
|
|
1214
|
+
jsArrayOrNil(jsArg(__a, 3), as: JSArray<Any?>.self, { $0 }))
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}(self.prepareContextForExpression)
|
|
1207
1218
|
default: break
|
|
1208
1219
|
}
|
|
1209
1220
|
case 30:
|
|
@@ -1505,18 +1505,6 @@ public struct FunctionCell_String_to_JSUint8ArrayOpt {
|
|
|
1505
1505
|
guard let value else { throw jsNoObject() }
|
|
1506
1506
|
return value
|
|
1507
1507
|
}
|
|
1508
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (String) throws -> JSUint8Array?)
|
|
1509
|
-
-> JSFunctionObject
|
|
1510
|
-
{
|
|
1511
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
1512
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
1513
|
-
return try __f((try jsConvertedString(jsArg(__a, 0))))
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((String) throws -> JSUint8Array?)?)
|
|
1518
|
-
-> JSFunctionObject?
|
|
1519
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
1520
1508
|
}
|
|
1521
1509
|
|
|
1522
1510
|
public struct FunctionCell_NSData_to_Void {
|
|
@@ -2018,21 +2018,6 @@ public struct FunctionCell_AnyOpt_JSArray_SelectorCore_Opt_to_JSArray_SelectorCo
|
|
|
2018
2018
|
guard let value else { throw jsNoObject() }
|
|
2019
2019
|
return value
|
|
2020
2020
|
}
|
|
2021
|
-
public static func script(
|
|
2022
|
-
_ name: String, _ length: Int, _ __f: @escaping (Any?, JSArray<SelectorCore>?) throws -> JSArray<SelectorCore>?
|
|
2023
|
-
) -> JSFunctionObject {
|
|
2024
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
2025
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
2026
|
-
return try __f(
|
|
2027
|
-
jsArg(__a, 0),
|
|
2028
|
-
try jsArrayOrNil(
|
|
2029
|
-
jsArg(__a, 1), as: JSArray<SelectorCore>.self, { try (jsCastPresent($0) as SelectorCore) }))
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
public static func scriptOrNil(
|
|
2034
|
-
_ name: String, _ length: Int, _ __f: ((Any?, JSArray<SelectorCore>?) throws -> JSArray<SelectorCore>?)?
|
|
2035
|
-
) -> JSFunctionObject? { if let __f { return script(name, length, __f) } else { return nil } }
|
|
2036
2021
|
}
|
|
2037
2022
|
|
|
2038
2023
|
public struct FunctionCell_String_SelectorCoreOpt_to_Void {
|
|
@@ -3615,18 +3600,6 @@ public struct FunctionCell_ViewOpt_Bool_to_JSPromise_Void_Opt {
|
|
|
3615
3600
|
guard let value else { throw jsNoObject() }
|
|
3616
3601
|
return value
|
|
3617
3602
|
}
|
|
3618
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (View?, Bool) throws -> JSPromise<Void>?)
|
|
3619
|
-
-> JSFunctionObject
|
|
3620
|
-
{
|
|
3621
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
3622
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
3623
|
-
return try __f((try jsCast(jsArg(__a, 0), View.self)), (try jsConvertedBool(jsArg(__a, 1))))
|
|
3624
|
-
}
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3627
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((View?, Bool) throws -> JSPromise<Void>?)?)
|
|
3628
|
-
-> JSFunctionObject?
|
|
3629
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
3630
3603
|
}
|
|
3631
3604
|
|
|
3632
3605
|
public struct FunctionCell_ViewOpt_AnyOpt_to_AnimationOpt {
|
|
@@ -3808,18 +3781,6 @@ public struct FunctionCell_Double_Double_to_Double {
|
|
|
3808
3781
|
guard let value else { throw jsNoObject() }
|
|
3809
3782
|
return value
|
|
3810
3783
|
}
|
|
3811
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Double, Double) throws -> Double)
|
|
3812
|
-
-> JSFunctionObject
|
|
3813
|
-
{
|
|
3814
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
3815
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
3816
|
-
return try __f((try jsConvertedNumber(jsArg(__a, 0))), (try jsConvertedNumber(jsArg(__a, 1))))
|
|
3817
|
-
}
|
|
3818
|
-
}
|
|
3819
|
-
}
|
|
3820
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double, Double) throws -> Double)?)
|
|
3821
|
-
-> JSFunctionObject?
|
|
3822
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
3823
3784
|
}
|
|
3824
3785
|
|
|
3825
3786
|
public struct FunctionCell_ViewOpt_NSIndexPathOpt_to_Double {
|
|
@@ -362,20 +362,6 @@ public struct FunctionCell_AnyOpt_AnyOpt_String_JSArray_AnyOpt_Opt_to_Bool {
|
|
|
362
362
|
guard let value else { throw jsNoObject() }
|
|
363
363
|
return value
|
|
364
364
|
}
|
|
365
|
-
public static func script(
|
|
366
|
-
_ name: String, _ length: Int, _ __f: @escaping (Any?, Any?, String, JSArray<Any?>?) throws -> Bool
|
|
367
|
-
) -> JSFunctionObject {
|
|
368
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
369
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
370
|
-
return try __f(
|
|
371
|
-
jsArg(__a, 0), jsArg(__a, 1), (try jsConvertedString(jsArg(__a, 2))),
|
|
372
|
-
jsArrayOrNil(jsArg(__a, 3), as: JSArray<Any?>.self, { $0 }))
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
public static func scriptOrNil(
|
|
377
|
-
_ name: String, _ length: Int, _ __f: ((Any?, Any?, String, JSArray<Any?>?) throws -> Bool)?
|
|
378
|
-
) -> JSFunctionObject? { if let __f { return script(name, length, __f) } else { return nil } }
|
|
379
365
|
}
|
|
380
366
|
|
|
381
367
|
public struct FunctionCell_ViewBaseOpt_AnyOpt_AnyOpt_to_AnyOpt {
|
|
@@ -1058,21 +1044,6 @@ public struct FunctionCell_ViewOpt_JSArray_String_Opt_String_Bool_to_Void {
|
|
|
1058
1044
|
guard let value else { throw jsNoObject() }
|
|
1059
1045
|
return value
|
|
1060
1046
|
}
|
|
1061
|
-
public static func script(
|
|
1062
|
-
_ name: String, _ length: Int, _ __f: @escaping (View?, JSArray<String>?, String, Bool) throws -> Void
|
|
1063
|
-
) -> JSFunctionObject {
|
|
1064
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
1065
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
1066
|
-
try __f(
|
|
1067
|
-
(try jsCast(jsArg(__a, 0), View.self)), jsArrayOrNil(jsArg(__a, 1), { jsLenientString($0) }),
|
|
1068
|
-
(try jsConvertedString(jsArg(__a, 2))), (try jsConvertedBool(jsArg(__a, 3))))
|
|
1069
|
-
return nil
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
public static func scriptOrNil(
|
|
1074
|
-
_ name: String, _ length: Int, _ __f: ((View?, JSArray<String>?, String, Bool) throws -> Void)?
|
|
1075
|
-
) -> JSFunctionObject? { if let __f { return script(name, length, __f) } else { return nil } }
|
|
1076
1047
|
}
|
|
1077
1048
|
|
|
1078
1049
|
public struct FunctionCell_ViewOpt_JSArray_String_Opt_String_to_Void {
|
|
@@ -4395,21 +4366,6 @@ public struct FunctionCell_Double_Double_Double_to_Void {
|
|
|
4395
4366
|
guard let value else { throw jsNoObject() }
|
|
4396
4367
|
return value
|
|
4397
4368
|
}
|
|
4398
|
-
public static func script(_ name: String, _ length: Int, _ __f: @escaping (Double, Double, Double) throws -> Void)
|
|
4399
|
-
-> JSFunctionObject
|
|
4400
|
-
{
|
|
4401
|
-
jsBoxedFunction(Self(f: __f)) {
|
|
4402
|
-
jsFunction(name, length) { (__a: [Any?]) throws -> Any? in
|
|
4403
|
-
try __f(
|
|
4404
|
-
(try jsConvertedNumber(jsArg(__a, 0))), (try jsConvertedNumber(jsArg(__a, 1))),
|
|
4405
|
-
(try jsConvertedNumber(jsArg(__a, 2))))
|
|
4406
|
-
return nil
|
|
4407
|
-
}
|
|
4408
|
-
}
|
|
4409
|
-
}
|
|
4410
|
-
public static func scriptOrNil(_ name: String, _ length: Int, _ __f: ((Double, Double, Double) throws -> Void)?)
|
|
4411
|
-
-> JSFunctionObject?
|
|
4412
|
-
{ if let __f { return script(name, length, __f) } else { return nil } }
|
|
4413
4369
|
}
|
|
4414
4370
|
|
|
4415
4371
|
public struct FunctionCell_AnyOpt_Bool_AnyOpt_to_Void {
|
|
@@ -1504,8 +1504,25 @@ open class ApplicationCommon: JSDynamic, JSExpando, JSKeysMade, JSStaticKeyed {
|
|
|
1504
1504
|
case "_appCssLoaded": return self._appCssLoaded
|
|
1505
1505
|
case "_traitsWindow": return self._traitsWindow
|
|
1506
1506
|
case "applyCssClass":
|
|
1507
|
-
return
|
|
1508
|
-
|
|
1507
|
+
return {
|
|
1508
|
+
(__f: @escaping (View?, JSArray<String>?, String, Bool) throws -> Void) -> JSFunctionObject in
|
|
1509
|
+
jsBoxedFunction(FunctionCell_ViewOpt_JSArray_String_Opt_String_Bool_to_Void(f: __f)) {
|
|
1510
|
+
jsFunction("applyCssClass", 3) { (__a: [Any?]) throws -> Any? in
|
|
1511
|
+
if __a.count <= 3 {
|
|
1512
|
+
try self.applyCssClass(
|
|
1513
|
+
(try jsCast(jsArg(__a, 0), View.self)),
|
|
1514
|
+
jsArrayOrNil(jsArg(__a, 1), { jsLenientString($0) }),
|
|
1515
|
+
(try jsConvertedString(jsArg(__a, 2))))
|
|
1516
|
+
return nil
|
|
1517
|
+
}
|
|
1518
|
+
try __f(
|
|
1519
|
+
(try jsCast(jsArg(__a, 0), View.self)),
|
|
1520
|
+
jsArrayOrNil(jsArg(__a, 1), { jsLenientString($0) }),
|
|
1521
|
+
(try jsConvertedString(jsArg(__a, 2))), (try jsConvertedBool(jsArg(__a, 3))))
|
|
1522
|
+
return nil
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
}(self.applyCssClass)
|
|
1509
1526
|
case "getWindowById":
|
|
1510
1527
|
return FunctionCell_String_to_NativeWindowOpt.script("getWindowById", 1, self.getWindowById)
|
|
1511
1528
|
case "resetRootView": return FunctionCell_AnyOpt_to_Void.script("resetRootView", 1, self.resetRootView)
|