Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
typealias ByteArrayAllocator = () -> ByteArray

A function type that allocates and returns a ByteArray.

Link copied to clipboard

Serializer for ByteArrayAllocator. Serializes the result of invoking the allocator.

Link copied to clipboard
external class ClipboardItem(data: dynamic)
Link copied to clipboard
object DateTimeSerializer : KSerializer<DateTime>

Serializes DateTime as its raw DateTime.unixMillis and deserializes in the same way

Link copied to clipboard
@Serializable
data class Diff<T>(val removed: List<@Serializable(with = IndexedValueSerializer::class) IndexedValue<T>>, val replaced: List<Pair<@Serializable(with = IndexedValueSerializer::class) IndexedValue<T>, @Serializable(with = IndexedValueSerializer::class) IndexedValue<T>>>, val added: List<@Serializable(with = IndexedValueSerializer::class) IndexedValue<T>>)

Diff object which contains information about differences between two Iterables

Link copied to clipboard
@Serializable(with = EitherSerializer::class)
sealed interface Either<T1, T2>

Realization of this interface will contains at least one not null - optionalT1 or optionalT2

Link copied to clipboard
@Serializable
data class EitherFirst<T1, T2>(val t1: T1) : Either<T1, T2>

This type Either will always have not nullable optionalT1

Link copied to clipboard
@Serializable
data class EitherSecond<T1, T2>(val t2: T2) : Either<T1, T2>

This type Either will always have not nullable optionalT2

Link copied to clipboard
class EitherSerializer<T1, T2>(t1Serializer: KSerializer<T1>, t2Serializer: KSerializer<T2>) : KSerializer<Either<T1, T2>>
Link copied to clipboard
@Serializable
value class FileName(val string: String)
Link copied to clipboard
object Gone : Visibility
Link copied to clipboard
class IndexedValueSerializer<T>(subSerializer: KSerializer<T>) : KSerializer<IndexedValue<T>>
Link copied to clipboard

This is just an implementation from this commentary of Kotlin JS issue related to the absence of Intersection Observer API

Link copied to clipboard
external interface IntersectionObserverEntry
Link copied to clipboard
external interface IntersectionObserverOptions
Link copied to clipboard
Link copied to clipboard
data class MapDiff<K, V>(val removed: Map<K, V>, val changed: Map<K, Pair<V, V>>, val added: Map<K, V>)

Contains diff based on the comparison of objects with the same K.

Link copied to clipboard
expect class MPPFile
Link copied to clipboard
@Serializable
data class Optional<T>

This type represents T as not only potentially nullable data, but also as a data which can not be presented. This type will be useful in cases when T is nullable and null as valuable data too in time of data absence should be presented by some third type.

Link copied to clipboard
@Serializable
value class Percentage

Contains of1 as main value, where 100% of percentage is when of1 == 1

Link copied to clipboard
annotation class PreviewFeature(val message: String = "It is possible, that behaviour of this thing will be changed or removed in future releases")
Link copied to clipboard
typealias Progress = Percentage
Link copied to clipboard
Link copied to clipboard
external interface ResizeObserverEntry
Link copied to clipboard
external interface ResizeObserverSize
Link copied to clipboard
interface SimpleMapper<T1, T2>

A bidirectional mapper that can convert between two types T1 and T2.

Link copied to clipboard
class SimpleMapperImpl<T1, T2>(t1: (T2) -> T1, t2: (T1) -> T2) : SimpleMapper<T1, T2>

Implementation of SimpleMapper that uses lambda functions for conversion.

Link copied to clipboard

A bidirectional mapper that can convert between two types T1 and T2 using suspending functions.

Link copied to clipboard
class SimpleSuspendableMapperImpl<T1, T2>(t1: suspend (T2) -> T1, t2: suspend (T1) -> T2) : SimpleSuspendableMapper<T1, T2>

Implementation of SimpleSuspendableMapper that uses suspending lambda functions for conversion.

Link copied to clipboard
typealias SuspendByteArrayAllocator = suspend () -> ByteArray

A suspending function type that allocates and returns a ByteArray.

Link copied to clipboard
sealed class Visibility
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard

Converts this ByteArray to a ByteArrayAllocator that returns this array.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect val MPPFile.filesize: Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun Boolean.alsoIfFalse(block: () -> Unit): Boolean

Executes the given block if this Boolean is false and returns this Boolean. Similar to also, but only executes the block when the Boolean is false.

Link copied to clipboard
inline fun Boolean.alsoIfTrue(block: () -> Unit): Boolean

Executes the given block if this Boolean is true and returns this Boolean. Similar to also, but only executes the block when the Boolean is true.

Link copied to clipboard
fun <T> MutableList<T>.applyDiff(diff: Diff<T>)

Applies diff to this

fun <K, V> MutableMap<K, V>.applyDiff(mapDiff: MapDiff<K, V>)

Will apply mapDiff to this

fun <T> MutableList<T>.applyDiff(source: Iterable<T>, strictComparison: Boolean = false): Diff<T>

This method call calculateDiff with strict mode strictComparison and then apply differences to this mutable list

fun <T> MutableList<T>.applyDiff(source: Iterable<T>, comparisonFun: (T?, T?) -> Boolean): Diff<T>

This method call calculateDiff and then apply differences to this mutable list

fun <K, V> MutableMap<K, V>.applyDiff(from: Map<K, V>, strictComparison: Boolean = false): MapDiff<K, V>
fun <K, V> MutableMap<K, V>.applyDiff(from: Map<K, V>, compareFun: (K, V, V) -> Boolean): MapDiff<K, V>

Will apply changes with from map into this one

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Converts this SuspendByteArrayAllocator to a ByteArrayAllocator by invoking it and wrapping the result in a non-suspending allocator.

Link copied to clipboard
suspend fun <T> Promise<T>.await(): T
Link copied to clipboard
fun <T> List<T>.breakAsPairs(): List<Pair<T, T>>

Breaks this list into a list of consecutive pairs. Each element is paired with the next element in the list. For a list of size n, the result will contain n-1 pairs.

Link copied to clipboard
suspend fun MPPFile.bytes(): ByteArray
Link copied to clipboard
Link copied to clipboard
fun <T> Iterable<T>.calculateDiff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>
fun <T> Iterable<T>.calculateDiff(other: Iterable<T>, comparisonFun: (T?, T?) -> Boolean): Diff<T>

Calculating Diff object

Link copied to clipboard
inline fun <T> Iterable<T>.calculateStrictDiff(other: Iterable<T>): Diff<T>

This method call calculateDiff with strict mode enabled

Link copied to clipboard
fun View.changeVisibility(show: Boolean = !isShown, goneOnHide: Boolean = true)
Link copied to clipboard
fun View.collapse(duration: Long = 500)
Link copied to clipboard
fun View.collapseHorizontally(duration: Long = 500)
Link copied to clipboard
operator fun Percentage.compareTo(other: Percentage): Int
Link copied to clipboard
@JvmName(name = "convertFromT2")
fun <T1, T2> SimpleMapper<T1, T2>.convert(from: T2): T1

Converts from of type T2 to type T1 using this mapper.

@JvmName(name = "convertFromT1")
fun <T1, T2> SimpleMapper<T1, T2>.convert(from: T1): T2

Converts from of type T1 to type T2 using this mapper.

@JvmName(name = "convertFromT2")
suspend fun <T1, T2> SimpleSuspendableMapper<T1, T2>.convert(from: T2): T1

Converts from of type T2 to type T1 using this suspending mapper.

@JvmName(name = "convertFromT1")
suspend fun <T1, T2> SimpleSuspendableMapper<T1, T2>.convert(from: T1): T2

Converts from of type T1 to type T2 using this suspending mapper.

Link copied to clipboard
Link copied to clipboard
suspend fun copyImageURLToClipboard(imageUrl: String): Boolean
Link copied to clipboard
Link copied to clipboard

Creates simple Comparator which will use compareTo of T for both objects

Link copied to clipboard
inline fun <T> Optional<T>.dataOrElse(block: () -> T): T

Returns Optional.data if Optional.dataPresented of this is true, or call block and returns the result of it

Link copied to clipboard
fun <T> Optional<T>.dataOrNull(): T?

Returns Optional.data if Optional.dataPresented of this is true, or null otherwise

Link copied to clipboard
fun <T> Optional<T>.dataOrThrow(throwable: Throwable): T

Returns Optional.data if Optional.dataPresented of this is true, or throw throwable otherwise

Link copied to clipboard
inline fun <T> Diff(old: Iterable<T>, new: Iterable<T>): Diff<T>
Link copied to clipboard
inline fun <T> Iterable<T>.diff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>
inline fun <T> Iterable<T>.diff(other: Iterable<T>, noinline comparisonFun: (T?, T?) -> Boolean): Diff<T>

fun <K, V> Map<K, V>.diff(other: Map<K, V>, strictComparison: Boolean = false): MapDiff<K, V>
fun <K, V> Map<K, V>.diff(other: Map<K, V>, compareFun: (K, V, V) -> Boolean): MapDiff<K, V>

Compare this with the other one in principle when other is newer than this

Link copied to clipboard
Link copied to clipboard
operator fun Percentage.div(i: Byte): Percentage
operator fun Percentage.div(i: Double): Percentage
operator fun Percentage.div(i: Float): Percentage
operator fun Percentage.div(i: Int): Percentage
operator fun Percentage.div(i: Long): Percentage
operator fun Percentage.div(i: Short): Percentage
Link copied to clipboard
fun InputStream.downloadToTempFile(fileName: String = UUID.randomUUID().toString(), fileExtension: String? = ".temp", folder: File? = null): File?
Link copied to clipboard
inline fun <T1, T2> Any.either(): Nothing
Link copied to clipboard
fun <T> emptyDiff(): Diff<T>
Link copied to clipboard
fun View.enable()
Link copied to clipboard

Will return this if Percentage.of1 in 0 .. 1 range

Link copied to clipboard

Will return this if Percentage.of1 in 0 .. 1 range. Otherwise, will throw error IllegalArgumentException due to require failure

Link copied to clipboard
fun View.expand(duration: Long = 500, targetWidth: Int = ViewGroup.LayoutParams.MATCH_PARENT, targetHeight: Int = ViewGroup.LayoutParams.WRAP_CONTENT)
Link copied to clipboard
fun View.expandHorizontally(duration: Long = 500, targetWidth: Int = ViewGroup.LayoutParams.MATCH_PARENT, targetHeight: Int = ViewGroup.LayoutParams.WRAP_CONTENT)
Link copied to clipboard
fun findViewsByTag(view: View, tag: Any?): List<View>
fun findViewsByTag(viewGroup: ViewGroup, tag: Any?): List<View>
fun findViewsByTag(view: View, key: Int, tag: Any?): List<View>
fun findViewsByTag(viewGroup: ViewGroup, key: Int, tag: Any?): List<View>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T1, T2> Either.Companion.first(t1: T1): Either<T1, T2>
Link copied to clipboard
fun <T> Iterable<T?>.firstNotNull(): T & Any

Returns the first non-null element in this iterable.

Link copied to clipboard
expect fun Double.fixed(signs: Int): Double
expect fun Float.fixed(signs: Int): Float
actual fun Double.fixed(signs: Int): Double
actual fun Float.fixed(signs: Int): Float
actual fun Double.fixed(signs: Int): Double
actual fun Float.fixed(signs: Int): Float
Link copied to clipboard
inline fun Resources.getDp(resId: Int): Float
Link copied to clipboard
inline fun Resources.getSp(resId: Int): Float
Link copied to clipboard
inline fun View.gone()
Link copied to clipboard
inline fun View.hide()
Link copied to clipboard
inline fun <T> Boolean.ifFalse(block: () -> T): T?

Alias for letIfFalse. Executes the given block and returns its result if this Boolean is false.

Link copied to clipboard
inline fun <T> Boolean.ifTrue(block: () -> T): T?

Alias for letIfTrue. Executes the given block and returns its result if this Boolean is true.

Link copied to clipboard

Computes the intersection of this range with other. Returns a pair representing the intersecting range, or null if the ranges don't overlap.

Computes the intersection of this IntRange with other. Returns the intersecting range, or null if the ranges don't overlap.

Computes the intersection of this LongRange with other. Returns the intersecting range, or null if the ranges don't overlap.

Link copied to clipboard
inline fun <I> Iterable<I>.joinTo(separator: I? = null, prefix: I? = null, postfix: I? = null): List<I>

Joins elements of this iterable into a list with a constant separator between elements. Optional prefix and postfix can be added to the result. Null separators are skipped.

inline fun <I> Iterable<I>.joinTo(separatorFun: (I) -> I?, prefix: I? = null, postfix: I? = null): List<I>

Joins elements of this iterable into a list with separators between elements. Separators are generated using separatorFun. Optional prefix and postfix can be added to the result. Null values from separator function are skipped.

inline fun <I, R> Array<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>

Joins elements of this array into an array with a constant separator between elements. Each element is transformed using transform. Optional prefix and postfix can be added to the result. Null values from transformations or separators are skipped.

inline fun <I, R> Array<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>

Joins elements of this array into an array with separators between elements. Each element is transformed using transform, and separators are generated using separatorFun. Optional prefix and postfix can be added to the result. Null values from transformations or separator function are skipped.

inline fun <I, R> Iterable<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>

Joins elements of this iterable into a list with a constant separator between elements. Each element is transformed using transform. Optional prefix and postfix can be added to the result. Null values from transformations or separators are skipped.

inline fun <I, R> Iterable<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>

Joins elements of this iterable into a list with separators between elements. Each element is transformed using transform, and separators are generated using separatorFun. Optional prefix and postfix can be added to the result. Null values from transformations or separator function are skipped.

Link copied to clipboard
inline fun <T> Boolean.letIfFalse(block: () -> T): T?

Executes the given block and returns its result if this Boolean is false, otherwise returns null.

Link copied to clipboard
inline fun <T> Boolean.letIfTrue(block: () -> T): T?

Executes the given block and returns its result if this Boolean is true, otherwise returns null.

Link copied to clipboard
inline fun <T, R> Array<T>.mapNotNullA(mapper: (T) -> R?): List<R>
inline fun <T, R> Iterable<T>.mapNotNullA(transform: (T) -> R?): List<R>
Link copied to clipboard
inline fun <T, R> Optional<T>.mapOnAbsent(block: () -> R): R?

Will call block when data presented (Optional.dataPresented == true)

Link copied to clipboard
inline fun <T1, R> Either<T1, *>.mapOnFirst(block: (T1) -> R): R?
Link copied to clipboard
inline fun <T, R> Optional<T>.mapOnPresented(block: (T) -> R): R?

Will call block when data presented (Optional.dataPresented == true)

Link copied to clipboard
inline fun <T2, R> Either<*, T2>.mapOnSecond(block: (T2) -> R): R?
Link copied to clipboard
operator fun Percentage.minus(other: Percentage): Percentage
operator fun Percentage.minus(i: Byte): Percentage
operator fun Percentage.minus(i: Double): Percentage
operator fun Percentage.minus(i: Float): Percentage
operator fun Percentage.minus(i: Int): Percentage
operator fun Percentage.minus(i: Long): Percentage
operator fun Percentage.minus(i: Short): Percentage
Link copied to clipboard
Link copied to clipboard
inline fun <T> Optional<T>.onAbsent(block: () -> Unit): Optional<T>

Will call block when data absent (Optional.dataPresented == false)

Link copied to clipboard
fun Element.onActionOutside(type: String, options: dynamic = null, callback: (Event) -> Unit): EventListener
Link copied to clipboard
fun Element.onClickOutside(options: dynamic = null, callback: (Event) -> Unit): EventListener
Link copied to clipboard
inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(block: (T1) -> Unit): E

Will call block in case when this is EitherFirst

Link copied to clipboard
Link copied to clipboard
inline fun <T> Optional<T>.onPresented(block: (T) -> Unit): Optional<T>

Will call block when data presented (Optional.dataPresented == true)

Link copied to clipboard
fun Node.onRemoved(block: () -> Unit): MutationObserver
Link copied to clipboard
inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(block: (T2) -> Unit): E

Will call block in case when this is EitherSecond

Link copied to clipboard
Link copied to clipboard
fun openLink(link: String, target: String = "_blank", features: String = "")
Link copied to clipboard
inline fun <T> List<T>.padEnd(size: Int, o: T): List<T>

Pads this list at the end to the specified size using the given element o.

inline fun <T> List<T>.padEnd(size: Int, padBlock: (Int) -> T): List<T>

Pads this list at the end to the specified size. New elements are generated using padBlock, which receives the current size as a parameter.

inline fun <T> Sequence<T>.padEnd(size: Int, o: T): Sequence<T>

Pads this sequence at the end to the specified size using the given element o.

inline fun <T> Sequence<T>.padEnd(size: Int, padBlock: (Int) -> T): Sequence<T>

Pads this sequence at the end to the specified size. New elements are generated using padBlock, which receives the current size as a parameter.

Link copied to clipboard
inline fun <T> List<T>.padStart(size: Int, o: T): List<T>

Pads this list at the start to the specified size using the given element o.

inline fun <T> List<T>.padStart(size: Int, padBlock: (Int) -> T): List<T>

Pads this list at the start to the specified size. New elements are generated using padBlock, which receives the current size as a parameter.

inline fun <T> Sequence<T>.padStart(size: Int, o: T): Sequence<T>

Pads this sequence at the start to the specified size using the given element o.

inline fun <T> Sequence<T>.padStart(size: Int, padBlock: (Int) -> T): Sequence<T>

Pads this sequence at the start to the specified size. New elements are generated using padBlock, which receives the current size as a parameter.

Link copied to clipboard
inline fun <T> List<T>.padWith(size: Int, inserter: (List<T>) -> List<T>): List<T>

Pads this list to the specified size using a custom inserter function. The inserter is repeatedly called until the list reaches the desired size.

inline fun <T> Sequence<T>.padWith(size: Int, inserter: (Sequence<T>) -> Sequence<T>): Sequence<T>

Pads this sequence to the specified size using a custom inserter function. The inserter is repeatedly called until the sequence reaches the desired size.

Link copied to clipboard
operator fun Percentage.plus(other: Percentage): Percentage
operator fun Percentage.plus(i: Byte): Percentage
operator fun Percentage.plus(i: Double): Percentage
operator fun Percentage.plus(i: Float): Percentage
operator fun Percentage.plus(i: Int): Percentage
operator fun Percentage.plus(i: Long): Percentage
operator fun Percentage.plus(i: Short): Percentage
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun Percentage.rem(i: Byte): Percentage
operator fun Percentage.rem(i: Double): Percentage
operator fun Percentage.rem(i: Float): Percentage
operator fun Percentage.rem(i: Int): Percentage
operator fun Percentage.rem(i: Long): Percentage
operator fun Percentage.rem(i: Short): Percentage
Link copied to clipboard
inline fun <R> repeatOnFailure(onFailure: (Throwable) -> Boolean, action: () -> R): Result<R>

Executes the given action until getting of successful result specified number of times.

inline fun <R> repeatOnFailure(times: Int, onEachFailure: (Throwable) -> Unit = {}, action: (Int) -> R): Optional<R>

Executes the given action until getting of successful result specified number of times.

Link copied to clipboard
inline fun <T> retryOnFailure(count: Int, action: () -> T): T

Will try to execute action and, if any exception will happen, execution will be retried. This process will happen at most count times. There is no any limits on count value, but action will run at least once and retryOnFailure will return its result if it is successful

Link copied to clipboard
fun <T> Diff<T>.reversed(): Diff<T>

Reverse this. Result will contain Diff.added on Diff.removed (and vice-verse), all the Diff.replaced values will be reversed too

fun <K, V> MapDiff<K, V>.reversed(): MapDiff<K, V>

Reverse this. Result will contain MapDiff.added on MapDiff.removed (and vice-verse), all the MapDiff.changed values will be reversed too

Link copied to clipboard
inline fun <T1, T2> Either.Companion.second(t2: T2): Either<T1, T2>
Link copied to clipboard
fun selectFile(inputSetup: (HTMLInputElement) -> Unit = {}, onFailure: (Throwable) -> Unit = {}, onFile: (MPPFile) -> Unit)
Link copied to clipboard
inline fun View.show()
Link copied to clipboard
inline fun <T1, T2> simpleMapper(noinline t1: (T2) -> T1, noinline t2: (T1) -> T2): SimpleMapperImpl<T1, T2>

Creates a SimpleMapper using the provided conversion functions.

Link copied to clipboard
inline fun <T1, T2> simpleSuspendableMapper(noinline t1: suspend (T2) -> T1, noinline t2: suspend (T1) -> T2): SimpleSuspendableMapperImpl<T1, T2>

Creates a SimpleSuspendableMapper using the provided suspending conversion functions.

Link copied to clipboard
inline fun <T> StrictDiff(old: Iterable<T>, new: Iterable<T>): Diff<T>
Link copied to clipboard
operator fun Percentage.times(i: Byte): Percentage
operator fun Percentage.times(i: Double): Percentage
operator fun Percentage.times(i: Float): Percentage
operator fun Percentage.times(i: Int): Percentage
operator fun Percentage.times(i: Long): Percentage
operator fun Percentage.times(i: Short): Percentage
Link copied to clipboard
fun ByteArray.toArrayBuffer(): ArrayBuffer
Link copied to clipboard
fun ArrayBuffer.toByteArray(): ByteArray
fun DataView.toByteArray(): ByteArray
Link copied to clipboard

Convert this to Byte with bounds of Byte.MIN_VALUE and Byte.MAX_VALUE

Convert this to Byte with bounds of Byte.MIN_VALUE and Byte.MAX_VALUE

Convert this to Byte with bounds of Byte.MIN_VALUE and Byte.MAX_VALUE

Link copied to clipboard

Convert this to Int with bounds of Int.MIN_VALUE and Int.MAX_VALUE

Link copied to clipboard

Convert this to Short with bounds of Short.MIN_VALUE and Short.MAX_VALUE

Convert this to Short with bounds of Short.MIN_VALUE and Short.MAX_VALUE

Link copied to clipboard
fun ByteArray.toDataView(): DataView
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun View.toggleExpandState(duration: Long = 500): Boolean
Link copied to clipboard
fun View.toggleVisibility(goneOnHide: Boolean = true)
Link copied to clipboard
fun triggerDownloadFile(filename: String, fileLink: String)
Link copied to clipboard
fun <T> Iterable<T>.withReplaced(t: T, block: (T) -> T): List<T>

Returns a new list with the first occurrence of element t replaced by applying block to it. All other elements remain unchanged.

Link copied to clipboard
fun <T> Iterable<T>.withReplacedAt(i: Int, block: (T) -> T): List<T>

Returns a new list with the element at index i replaced by applying block to it. All other elements remain unchanged.