@jalvin/runtime 1.0.0
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/bibi.d.ts +56 -0
- package/dist/bibi.d.ts.map +1 -0
- package/dist/bibi.js +199 -0
- package/dist/bibi.js.map +1 -0
- package/dist/coroutines.d.ts +184 -0
- package/dist/coroutines.d.ts.map +1 -0
- package/dist/coroutines.js +560 -0
- package/dist/coroutines.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/stateflow.d.ts +42 -0
- package/dist/stateflow.d.ts.map +1 -0
- package/dist/stateflow.js +171 -0
- package/dist/stateflow.js.map +1 -0
- package/dist/ui.d.ts +49 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +162 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils.d.ts +375 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +1180 -0
- package/dist/utils.js.map +1 -0
- package/package.json +40 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @jalvin/runtime — public API
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ObservableDelegate = exports.LazyDelegate = exports.Delegates = exports.lazy = exports.delegate = exports.range = exports.safeCast = exports.NullPointerException = exports.notNull = exports.SideEffect = exports.DisposableEffect = exports.LaunchedEffect = exports.useViewModel = exports.collectAsState = exports.rememberMutableStateOf = exports.remember = exports.mutableStateOf = exports.clearAllViewModels = exports.clearViewModel = exports.viewModel = exports.ViewModel = exports.debounceFlow = exports.filterFlow = exports.mapFlow = exports.MutableStateFlow = exports.supervisorScope = exports.coroutineScope = exports.asFlow = exports.flowOf = exports.flow = exports.Flow = exports.ChannelClosedException = exports.Channel = exports.TimeoutCancellationException = exports.withTimeoutOrNull = exports.withTimeout = exports.yield_ = exports.runBlocking = exports.repeat = exports.withContext = exports.delay = exports.async = exports.launch = exports.CoroutineScope = exports.Deferred = exports.JobCancellationException = exports.Job = exports.BibiError = exports.BibiRequestBuilder = exports.Bibi = void 0;
|
|
5
|
+
exports.distinctBy = exports.distinct = exports.zip = exports.associate = exports.groupBy = exports.flatten = exports.flatMap = exports.findLast = exports.find = exports.lastOrNull = exports.last = exports.firstOrNull = exports.first = exports.count = exports.none = exports.all = exports.any = exports.sumOf = exports.reduce = exports.fold = exports.forEach = exports.filterNotNull = exports.filter = exports.map = exports.takeUnless = exports.takeIf = exports.with_ = exports.also = exports.apply = exports.run_ = exports.let_ = exports.NoSuchElementException = exports.IndexOutOfBoundsException = exports.UnsupportedOperationException = exports.IllegalStateException = exports.IllegalArgumentException = exports.error = exports.check = exports.requireCondition = exports.requireNotNull = exports.checkNotNull = exports.tripleOf = exports.pairOf = exports.mutableMapOf = exports.mapOf = exports.mutableSetOf = exports.setOf = exports.mutableListOf = exports.listOf = exports.println = void 0;
|
|
6
|
+
exports.abs = exports.charCodeOf = exports.toChar = exports.toDouble = exports.toFloat = exports.toLong = exports.toInt = exports.ifBlank = exports.ifEmpty = exports.lineSequence = exports.lines = exports.removeSuffix = exports.removePrefix = exports.substringAfterLast = exports.substringBeforeLast = exports.substringAfter = exports.substringBefore = exports.decapitalize = exports.capitalize = exports.padEnd = exports.padStart = exports.toBooleanOrNull = exports.toDoubleOrNull = exports.toIntOrNull = exports.isNullOrBlank = exports.isNotBlank = exports.isBlank = exports.repeatString = exports.trimIndent = exports.Long = exports.Int = exports.coerceIn = exports.coerceAtMost = exports.coerceAtLeast = exports.dropWhile = exports.drop = exports.takeWhile = exports.take = exports.joinToString = exports.maxOrNull = exports.minOrNull = exports.maxOf = exports.minOf = exports.withIndex = exports.partition = exports.windowed = exports.chunked = exports.reversed = exports.sortedByDescending = exports.sortedBy = void 0;
|
|
7
|
+
exports.Triple = exports.Pair = exports.jalvinEquals = exports.randomUUID = exports.DefaultRandom = exports.Random = exports.measureTimedValue = exports.measureTimeMillisAsync = exports.measureTimeMillis = exports.RegexResult = exports.Regex = exports.runCatchingAsync = exports.runCatching = exports.Result = exports.buildMap = exports.buildSet = exports.buildList = exports.buildString = exports.StringBuilder = exports.step = exports.downTo = exports.IntRange = exports.E = exports.PI = exports.truncDiv = exports.clamp = exports.truncate = exports.hypot = exports.sign = exports.atan2 = exports.atan = exports.acos = exports.asin = exports.tan = exports.cos = exports.sin = exports.log10 = exports.log2 = exports.ln = exports.exp = exports.pow = exports.sqrt = exports.round = exports.floor = exports.ceil = void 0;
|
|
8
|
+
// HTTP client
|
|
9
|
+
var bibi_js_1 = require("./bibi.js");
|
|
10
|
+
Object.defineProperty(exports, "Bibi", { enumerable: true, get: function () { return bibi_js_1.Bibi; } });
|
|
11
|
+
Object.defineProperty(exports, "BibiRequestBuilder", { enumerable: true, get: function () { return bibi_js_1.BibiRequestBuilder; } });
|
|
12
|
+
Object.defineProperty(exports, "BibiError", { enumerable: true, get: function () { return bibi_js_1.BibiError; } });
|
|
13
|
+
// Coroutines
|
|
14
|
+
var coroutines_js_1 = require("./coroutines.js");
|
|
15
|
+
Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return coroutines_js_1.Job; } });
|
|
16
|
+
Object.defineProperty(exports, "JobCancellationException", { enumerable: true, get: function () { return coroutines_js_1.JobCancellationException; } });
|
|
17
|
+
Object.defineProperty(exports, "Deferred", { enumerable: true, get: function () { return coroutines_js_1.Deferred; } });
|
|
18
|
+
Object.defineProperty(exports, "CoroutineScope", { enumerable: true, get: function () { return coroutines_js_1.CoroutineScope; } });
|
|
19
|
+
Object.defineProperty(exports, "launch", { enumerable: true, get: function () { return coroutines_js_1.launch; } });
|
|
20
|
+
Object.defineProperty(exports, "async", { enumerable: true, get: function () { return coroutines_js_1.async_; } });
|
|
21
|
+
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return coroutines_js_1.delay; } });
|
|
22
|
+
Object.defineProperty(exports, "withContext", { enumerable: true, get: function () { return coroutines_js_1.withContext; } });
|
|
23
|
+
Object.defineProperty(exports, "repeat", { enumerable: true, get: function () { return coroutines_js_1.repeat; } });
|
|
24
|
+
Object.defineProperty(exports, "runBlocking", { enumerable: true, get: function () { return coroutines_js_1.runBlocking; } });
|
|
25
|
+
Object.defineProperty(exports, "yield_", { enumerable: true, get: function () { return coroutines_js_1.yield_; } });
|
|
26
|
+
Object.defineProperty(exports, "withTimeout", { enumerable: true, get: function () { return coroutines_js_1.withTimeout; } });
|
|
27
|
+
Object.defineProperty(exports, "withTimeoutOrNull", { enumerable: true, get: function () { return coroutines_js_1.withTimeoutOrNull; } });
|
|
28
|
+
Object.defineProperty(exports, "TimeoutCancellationException", { enumerable: true, get: function () { return coroutines_js_1.TimeoutCancellationException; } });
|
|
29
|
+
Object.defineProperty(exports, "Channel", { enumerable: true, get: function () { return coroutines_js_1.Channel; } });
|
|
30
|
+
Object.defineProperty(exports, "ChannelClosedException", { enumerable: true, get: function () { return coroutines_js_1.ChannelClosedException; } });
|
|
31
|
+
Object.defineProperty(exports, "Flow", { enumerable: true, get: function () { return coroutines_js_1.Flow; } });
|
|
32
|
+
Object.defineProperty(exports, "flow", { enumerable: true, get: function () { return coroutines_js_1.flow; } });
|
|
33
|
+
Object.defineProperty(exports, "flowOf", { enumerable: true, get: function () { return coroutines_js_1.flowOf; } });
|
|
34
|
+
Object.defineProperty(exports, "asFlow", { enumerable: true, get: function () { return coroutines_js_1.asFlow; } });
|
|
35
|
+
Object.defineProperty(exports, "coroutineScope", { enumerable: true, get: function () { return coroutines_js_1.coroutineScope; } });
|
|
36
|
+
Object.defineProperty(exports, "supervisorScope", { enumerable: true, get: function () { return coroutines_js_1.supervisorScope; } });
|
|
37
|
+
// StateFlow / ViewModel
|
|
38
|
+
var stateflow_js_1 = require("./stateflow.js");
|
|
39
|
+
Object.defineProperty(exports, "MutableStateFlow", { enumerable: true, get: function () { return stateflow_js_1.MutableStateFlow; } });
|
|
40
|
+
Object.defineProperty(exports, "mapFlow", { enumerable: true, get: function () { return stateflow_js_1.mapFlow; } });
|
|
41
|
+
Object.defineProperty(exports, "filterFlow", { enumerable: true, get: function () { return stateflow_js_1.filterFlow; } });
|
|
42
|
+
Object.defineProperty(exports, "debounceFlow", { enumerable: true, get: function () { return stateflow_js_1.debounceFlow; } });
|
|
43
|
+
Object.defineProperty(exports, "ViewModel", { enumerable: true, get: function () { return stateflow_js_1.ViewModel; } });
|
|
44
|
+
Object.defineProperty(exports, "viewModel", { enumerable: true, get: function () { return stateflow_js_1.viewModel; } });
|
|
45
|
+
Object.defineProperty(exports, "clearViewModel", { enumerable: true, get: function () { return stateflow_js_1.clearViewModel; } });
|
|
46
|
+
Object.defineProperty(exports, "clearAllViewModels", { enumerable: true, get: function () { return stateflow_js_1.clearAllViewModels; } });
|
|
47
|
+
// UI hooks (React)
|
|
48
|
+
var ui_js_1 = require("./ui.js");
|
|
49
|
+
Object.defineProperty(exports, "mutableStateOf", { enumerable: true, get: function () { return ui_js_1.mutableStateOf; } });
|
|
50
|
+
Object.defineProperty(exports, "remember", { enumerable: true, get: function () { return ui_js_1.remember; } });
|
|
51
|
+
Object.defineProperty(exports, "rememberMutableStateOf", { enumerable: true, get: function () { return ui_js_1.rememberMutableStateOf; } });
|
|
52
|
+
Object.defineProperty(exports, "collectAsState", { enumerable: true, get: function () { return ui_js_1.collectAsState; } });
|
|
53
|
+
Object.defineProperty(exports, "useViewModel", { enumerable: true, get: function () { return ui_js_1.useViewModel; } });
|
|
54
|
+
Object.defineProperty(exports, "LaunchedEffect", { enumerable: true, get: function () { return ui_js_1.LaunchedEffect; } });
|
|
55
|
+
Object.defineProperty(exports, "DisposableEffect", { enumerable: true, get: function () { return ui_js_1.DisposableEffect; } });
|
|
56
|
+
Object.defineProperty(exports, "SideEffect", { enumerable: true, get: function () { return ui_js_1.SideEffect; } });
|
|
57
|
+
// Utilities / stdlib shims
|
|
58
|
+
var utils_js_1 = require("./utils.js");
|
|
59
|
+
Object.defineProperty(exports, "notNull", { enumerable: true, get: function () { return utils_js_1.notNull; } });
|
|
60
|
+
Object.defineProperty(exports, "NullPointerException", { enumerable: true, get: function () { return utils_js_1.NullPointerException; } });
|
|
61
|
+
Object.defineProperty(exports, "safeCast", { enumerable: true, get: function () { return utils_js_1.safeCast; } });
|
|
62
|
+
Object.defineProperty(exports, "range", { enumerable: true, get: function () { return utils_js_1.range; } });
|
|
63
|
+
Object.defineProperty(exports, "delegate", { enumerable: true, get: function () { return utils_js_1.delegate; } });
|
|
64
|
+
Object.defineProperty(exports, "lazy", { enumerable: true, get: function () { return utils_js_1.lazy; } });
|
|
65
|
+
Object.defineProperty(exports, "Delegates", { enumerable: true, get: function () { return utils_js_1.Delegates; } });
|
|
66
|
+
Object.defineProperty(exports, "LazyDelegate", { enumerable: true, get: function () { return utils_js_1.LazyDelegate; } });
|
|
67
|
+
Object.defineProperty(exports, "ObservableDelegate", { enumerable: true, get: function () { return utils_js_1.ObservableDelegate; } });
|
|
68
|
+
Object.defineProperty(exports, "println", { enumerable: true, get: function () { return utils_js_1.println; } });
|
|
69
|
+
Object.defineProperty(exports, "print", { enumerable: true, get: function () { return utils_js_1.print; } });
|
|
70
|
+
Object.defineProperty(exports, "listOf", { enumerable: true, get: function () { return utils_js_1.listOf; } });
|
|
71
|
+
Object.defineProperty(exports, "mutableListOf", { enumerable: true, get: function () { return utils_js_1.mutableListOf; } });
|
|
72
|
+
Object.defineProperty(exports, "setOf", { enumerable: true, get: function () { return utils_js_1.setOf; } });
|
|
73
|
+
Object.defineProperty(exports, "mutableSetOf", { enumerable: true, get: function () { return utils_js_1.mutableSetOf; } });
|
|
74
|
+
Object.defineProperty(exports, "mapOf", { enumerable: true, get: function () { return utils_js_1.mapOf; } });
|
|
75
|
+
Object.defineProperty(exports, "mutableMapOf", { enumerable: true, get: function () { return utils_js_1.mutableMapOf; } });
|
|
76
|
+
Object.defineProperty(exports, "pairOf", { enumerable: true, get: function () { return utils_js_1.pairOf; } });
|
|
77
|
+
Object.defineProperty(exports, "tripleOf", { enumerable: true, get: function () { return utils_js_1.tripleOf; } });
|
|
78
|
+
Object.defineProperty(exports, "checkNotNull", { enumerable: true, get: function () { return utils_js_1.checkNotNull; } });
|
|
79
|
+
Object.defineProperty(exports, "requireNotNull", { enumerable: true, get: function () { return utils_js_1.requireNotNull; } });
|
|
80
|
+
Object.defineProperty(exports, "requireCondition", { enumerable: true, get: function () { return utils_js_1.requireCondition; } });
|
|
81
|
+
Object.defineProperty(exports, "check", { enumerable: true, get: function () { return utils_js_1.check; } });
|
|
82
|
+
Object.defineProperty(exports, "error", { enumerable: true, get: function () { return utils_js_1.error; } });
|
|
83
|
+
Object.defineProperty(exports, "IllegalArgumentException", { enumerable: true, get: function () { return utils_js_1.IllegalArgumentException; } });
|
|
84
|
+
Object.defineProperty(exports, "IllegalStateException", { enumerable: true, get: function () { return utils_js_1.IllegalStateException; } });
|
|
85
|
+
Object.defineProperty(exports, "UnsupportedOperationException", { enumerable: true, get: function () { return utils_js_1.UnsupportedOperationException; } });
|
|
86
|
+
Object.defineProperty(exports, "IndexOutOfBoundsException", { enumerable: true, get: function () { return utils_js_1.IndexOutOfBoundsException; } });
|
|
87
|
+
Object.defineProperty(exports, "NoSuchElementException", { enumerable: true, get: function () { return utils_js_1.NoSuchElementException; } });
|
|
88
|
+
// Scope functions
|
|
89
|
+
Object.defineProperty(exports, "let_", { enumerable: true, get: function () { return utils_js_1.let_; } });
|
|
90
|
+
Object.defineProperty(exports, "run_", { enumerable: true, get: function () { return utils_js_1.run_; } });
|
|
91
|
+
Object.defineProperty(exports, "apply", { enumerable: true, get: function () { return utils_js_1.apply; } });
|
|
92
|
+
Object.defineProperty(exports, "also", { enumerable: true, get: function () { return utils_js_1.also; } });
|
|
93
|
+
Object.defineProperty(exports, "with_", { enumerable: true, get: function () { return utils_js_1.with_; } });
|
|
94
|
+
Object.defineProperty(exports, "takeIf", { enumerable: true, get: function () { return utils_js_1.takeIf; } });
|
|
95
|
+
Object.defineProperty(exports, "takeUnless", { enumerable: true, get: function () { return utils_js_1.takeUnless; } });
|
|
96
|
+
// Collection operators
|
|
97
|
+
Object.defineProperty(exports, "map", { enumerable: true, get: function () { return utils_js_1.map; } });
|
|
98
|
+
Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return utils_js_1.filter; } });
|
|
99
|
+
Object.defineProperty(exports, "filterNotNull", { enumerable: true, get: function () { return utils_js_1.filterNotNull; } });
|
|
100
|
+
Object.defineProperty(exports, "forEach", { enumerable: true, get: function () { return utils_js_1.forEach; } });
|
|
101
|
+
Object.defineProperty(exports, "fold", { enumerable: true, get: function () { return utils_js_1.fold; } });
|
|
102
|
+
Object.defineProperty(exports, "reduce", { enumerable: true, get: function () { return utils_js_1.reduce; } });
|
|
103
|
+
Object.defineProperty(exports, "sumOf", { enumerable: true, get: function () { return utils_js_1.sumOf; } });
|
|
104
|
+
Object.defineProperty(exports, "any", { enumerable: true, get: function () { return utils_js_1.any; } });
|
|
105
|
+
Object.defineProperty(exports, "all", { enumerable: true, get: function () { return utils_js_1.all; } });
|
|
106
|
+
Object.defineProperty(exports, "none", { enumerable: true, get: function () { return utils_js_1.none; } });
|
|
107
|
+
Object.defineProperty(exports, "count", { enumerable: true, get: function () { return utils_js_1.count; } });
|
|
108
|
+
Object.defineProperty(exports, "first", { enumerable: true, get: function () { return utils_js_1.first; } });
|
|
109
|
+
Object.defineProperty(exports, "firstOrNull", { enumerable: true, get: function () { return utils_js_1.firstOrNull; } });
|
|
110
|
+
Object.defineProperty(exports, "last", { enumerable: true, get: function () { return utils_js_1.last; } });
|
|
111
|
+
Object.defineProperty(exports, "lastOrNull", { enumerable: true, get: function () { return utils_js_1.lastOrNull; } });
|
|
112
|
+
Object.defineProperty(exports, "find", { enumerable: true, get: function () { return utils_js_1.find; } });
|
|
113
|
+
Object.defineProperty(exports, "findLast", { enumerable: true, get: function () { return utils_js_1.findLast; } });
|
|
114
|
+
Object.defineProperty(exports, "flatMap", { enumerable: true, get: function () { return utils_js_1.flatMap; } });
|
|
115
|
+
Object.defineProperty(exports, "flatten", { enumerable: true, get: function () { return utils_js_1.flatten; } });
|
|
116
|
+
Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return utils_js_1.groupBy; } });
|
|
117
|
+
Object.defineProperty(exports, "associate", { enumerable: true, get: function () { return utils_js_1.associate; } });
|
|
118
|
+
Object.defineProperty(exports, "zip", { enumerable: true, get: function () { return utils_js_1.zip; } });
|
|
119
|
+
Object.defineProperty(exports, "distinct", { enumerable: true, get: function () { return utils_js_1.distinct; } });
|
|
120
|
+
Object.defineProperty(exports, "distinctBy", { enumerable: true, get: function () { return utils_js_1.distinctBy; } });
|
|
121
|
+
Object.defineProperty(exports, "sortedBy", { enumerable: true, get: function () { return utils_js_1.sortedBy; } });
|
|
122
|
+
Object.defineProperty(exports, "sortedByDescending", { enumerable: true, get: function () { return utils_js_1.sortedByDescending; } });
|
|
123
|
+
Object.defineProperty(exports, "reversed", { enumerable: true, get: function () { return utils_js_1.reversed; } });
|
|
124
|
+
Object.defineProperty(exports, "chunked", { enumerable: true, get: function () { return utils_js_1.chunked; } });
|
|
125
|
+
Object.defineProperty(exports, "windowed", { enumerable: true, get: function () { return utils_js_1.windowed; } });
|
|
126
|
+
Object.defineProperty(exports, "partition", { enumerable: true, get: function () { return utils_js_1.partition; } });
|
|
127
|
+
Object.defineProperty(exports, "withIndex", { enumerable: true, get: function () { return utils_js_1.withIndex; } });
|
|
128
|
+
Object.defineProperty(exports, "minOf", { enumerable: true, get: function () { return utils_js_1.minOf; } });
|
|
129
|
+
Object.defineProperty(exports, "maxOf", { enumerable: true, get: function () { return utils_js_1.maxOf; } });
|
|
130
|
+
Object.defineProperty(exports, "minOrNull", { enumerable: true, get: function () { return utils_js_1.minOrNull; } });
|
|
131
|
+
Object.defineProperty(exports, "maxOrNull", { enumerable: true, get: function () { return utils_js_1.maxOrNull; } });
|
|
132
|
+
Object.defineProperty(exports, "joinToString", { enumerable: true, get: function () { return utils_js_1.joinToString; } });
|
|
133
|
+
Object.defineProperty(exports, "take", { enumerable: true, get: function () { return utils_js_1.take; } });
|
|
134
|
+
Object.defineProperty(exports, "takeWhile", { enumerable: true, get: function () { return utils_js_1.takeWhile; } });
|
|
135
|
+
Object.defineProperty(exports, "drop", { enumerable: true, get: function () { return utils_js_1.drop; } });
|
|
136
|
+
Object.defineProperty(exports, "dropWhile", { enumerable: true, get: function () { return utils_js_1.dropWhile; } });
|
|
137
|
+
// Numeric helpers
|
|
138
|
+
Object.defineProperty(exports, "coerceAtLeast", { enumerable: true, get: function () { return utils_js_1.coerceAtLeast; } });
|
|
139
|
+
Object.defineProperty(exports, "coerceAtMost", { enumerable: true, get: function () { return utils_js_1.coerceAtMost; } });
|
|
140
|
+
Object.defineProperty(exports, "coerceIn", { enumerable: true, get: function () { return utils_js_1.coerceIn; } });
|
|
141
|
+
Object.defineProperty(exports, "Int", { enumerable: true, get: function () { return utils_js_1.Int; } });
|
|
142
|
+
Object.defineProperty(exports, "Long", { enumerable: true, get: function () { return utils_js_1.Long; } });
|
|
143
|
+
// String helpers
|
|
144
|
+
Object.defineProperty(exports, "trimIndent", { enumerable: true, get: function () { return utils_js_1.trimIndent; } });
|
|
145
|
+
Object.defineProperty(exports, "repeatString", { enumerable: true, get: function () { return utils_js_1.repeat_; } });
|
|
146
|
+
Object.defineProperty(exports, "isBlank", { enumerable: true, get: function () { return utils_js_1.isBlank; } });
|
|
147
|
+
Object.defineProperty(exports, "isNotBlank", { enumerable: true, get: function () { return utils_js_1.isNotBlank; } });
|
|
148
|
+
Object.defineProperty(exports, "isNullOrBlank", { enumerable: true, get: function () { return utils_js_1.isNullOrBlank; } });
|
|
149
|
+
Object.defineProperty(exports, "toIntOrNull", { enumerable: true, get: function () { return utils_js_1.toIntOrNull; } });
|
|
150
|
+
Object.defineProperty(exports, "toDoubleOrNull", { enumerable: true, get: function () { return utils_js_1.toDoubleOrNull; } });
|
|
151
|
+
Object.defineProperty(exports, "toBooleanOrNull", { enumerable: true, get: function () { return utils_js_1.toBooleanOrNull; } });
|
|
152
|
+
Object.defineProperty(exports, "padStart", { enumerable: true, get: function () { return utils_js_1.padStart; } });
|
|
153
|
+
Object.defineProperty(exports, "padEnd", { enumerable: true, get: function () { return utils_js_1.padEnd; } });
|
|
154
|
+
// Extended string utilities
|
|
155
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return utils_js_1.capitalize; } });
|
|
156
|
+
Object.defineProperty(exports, "decapitalize", { enumerable: true, get: function () { return utils_js_1.decapitalize; } });
|
|
157
|
+
Object.defineProperty(exports, "substringBefore", { enumerable: true, get: function () { return utils_js_1.substringBefore; } });
|
|
158
|
+
Object.defineProperty(exports, "substringAfter", { enumerable: true, get: function () { return utils_js_1.substringAfter; } });
|
|
159
|
+
Object.defineProperty(exports, "substringBeforeLast", { enumerable: true, get: function () { return utils_js_1.substringBeforeLast; } });
|
|
160
|
+
Object.defineProperty(exports, "substringAfterLast", { enumerable: true, get: function () { return utils_js_1.substringAfterLast; } });
|
|
161
|
+
Object.defineProperty(exports, "removePrefix", { enumerable: true, get: function () { return utils_js_1.removePrefix; } });
|
|
162
|
+
Object.defineProperty(exports, "removeSuffix", { enumerable: true, get: function () { return utils_js_1.removeSuffix; } });
|
|
163
|
+
Object.defineProperty(exports, "lines", { enumerable: true, get: function () { return utils_js_1.lines; } });
|
|
164
|
+
Object.defineProperty(exports, "lineSequence", { enumerable: true, get: function () { return utils_js_1.lineSequence; } });
|
|
165
|
+
Object.defineProperty(exports, "ifEmpty", { enumerable: true, get: function () { return utils_js_1.ifEmpty; } });
|
|
166
|
+
Object.defineProperty(exports, "ifBlank", { enumerable: true, get: function () { return utils_js_1.ifBlank; } });
|
|
167
|
+
// Type conversions
|
|
168
|
+
Object.defineProperty(exports, "toInt", { enumerable: true, get: function () { return utils_js_1.toInt; } });
|
|
169
|
+
Object.defineProperty(exports, "toLong", { enumerable: true, get: function () { return utils_js_1.toLong; } });
|
|
170
|
+
Object.defineProperty(exports, "toFloat", { enumerable: true, get: function () { return utils_js_1.toFloat; } });
|
|
171
|
+
Object.defineProperty(exports, "toDouble", { enumerable: true, get: function () { return utils_js_1.toDouble; } });
|
|
172
|
+
Object.defineProperty(exports, "toChar", { enumerable: true, get: function () { return utils_js_1.toChar; } });
|
|
173
|
+
Object.defineProperty(exports, "charCodeOf", { enumerable: true, get: function () { return utils_js_1.charCodeOf; } });
|
|
174
|
+
Object.defineProperty(exports, "toString", { enumerable: true, get: function () { return utils_js_1.toString; } });
|
|
175
|
+
// Math functions
|
|
176
|
+
Object.defineProperty(exports, "abs", { enumerable: true, get: function () { return utils_js_1.abs; } });
|
|
177
|
+
Object.defineProperty(exports, "ceil", { enumerable: true, get: function () { return utils_js_1.ceil; } });
|
|
178
|
+
Object.defineProperty(exports, "floor", { enumerable: true, get: function () { return utils_js_1.floor; } });
|
|
179
|
+
Object.defineProperty(exports, "round", { enumerable: true, get: function () { return utils_js_1.round; } });
|
|
180
|
+
Object.defineProperty(exports, "sqrt", { enumerable: true, get: function () { return utils_js_1.sqrt; } });
|
|
181
|
+
Object.defineProperty(exports, "pow", { enumerable: true, get: function () { return utils_js_1.pow; } });
|
|
182
|
+
Object.defineProperty(exports, "exp", { enumerable: true, get: function () { return utils_js_1.exp; } });
|
|
183
|
+
Object.defineProperty(exports, "ln", { enumerable: true, get: function () { return utils_js_1.ln; } });
|
|
184
|
+
Object.defineProperty(exports, "log2", { enumerable: true, get: function () { return utils_js_1.log2; } });
|
|
185
|
+
Object.defineProperty(exports, "log10", { enumerable: true, get: function () { return utils_js_1.log10; } });
|
|
186
|
+
Object.defineProperty(exports, "sin", { enumerable: true, get: function () { return utils_js_1.sin; } });
|
|
187
|
+
Object.defineProperty(exports, "cos", { enumerable: true, get: function () { return utils_js_1.cos; } });
|
|
188
|
+
Object.defineProperty(exports, "tan", { enumerable: true, get: function () { return utils_js_1.tan; } });
|
|
189
|
+
Object.defineProperty(exports, "asin", { enumerable: true, get: function () { return utils_js_1.asin; } });
|
|
190
|
+
Object.defineProperty(exports, "acos", { enumerable: true, get: function () { return utils_js_1.acos; } });
|
|
191
|
+
Object.defineProperty(exports, "atan", { enumerable: true, get: function () { return utils_js_1.atan; } });
|
|
192
|
+
Object.defineProperty(exports, "atan2", { enumerable: true, get: function () { return utils_js_1.atan2; } });
|
|
193
|
+
Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return utils_js_1.sign; } });
|
|
194
|
+
Object.defineProperty(exports, "hypot", { enumerable: true, get: function () { return utils_js_1.hypot; } });
|
|
195
|
+
Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return utils_js_1.truncate; } });
|
|
196
|
+
Object.defineProperty(exports, "clamp", { enumerable: true, get: function () { return utils_js_1.clamp; } });
|
|
197
|
+
Object.defineProperty(exports, "truncDiv", { enumerable: true, get: function () { return utils_js_1.truncDiv; } });
|
|
198
|
+
Object.defineProperty(exports, "PI", { enumerable: true, get: function () { return utils_js_1.PI; } });
|
|
199
|
+
Object.defineProperty(exports, "E", { enumerable: true, get: function () { return utils_js_1.E; } });
|
|
200
|
+
// IntRange + range operators
|
|
201
|
+
Object.defineProperty(exports, "IntRange", { enumerable: true, get: function () { return utils_js_1.IntRange; } });
|
|
202
|
+
Object.defineProperty(exports, "downTo", { enumerable: true, get: function () { return utils_js_1.downTo; } });
|
|
203
|
+
Object.defineProperty(exports, "step", { enumerable: true, get: function () { return utils_js_1.step; } });
|
|
204
|
+
// Collection builders
|
|
205
|
+
Object.defineProperty(exports, "StringBuilder", { enumerable: true, get: function () { return utils_js_1.StringBuilder; } });
|
|
206
|
+
Object.defineProperty(exports, "buildString", { enumerable: true, get: function () { return utils_js_1.buildString; } });
|
|
207
|
+
Object.defineProperty(exports, "buildList", { enumerable: true, get: function () { return utils_js_1.buildList; } });
|
|
208
|
+
Object.defineProperty(exports, "buildSet", { enumerable: true, get: function () { return utils_js_1.buildSet; } });
|
|
209
|
+
Object.defineProperty(exports, "buildMap", { enumerable: true, get: function () { return utils_js_1.buildMap; } });
|
|
210
|
+
// Result<T>
|
|
211
|
+
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return utils_js_1.Result; } });
|
|
212
|
+
Object.defineProperty(exports, "runCatching", { enumerable: true, get: function () { return utils_js_1.runCatching; } });
|
|
213
|
+
Object.defineProperty(exports, "runCatchingAsync", { enumerable: true, get: function () { return utils_js_1.runCatchingAsync; } });
|
|
214
|
+
// Regex
|
|
215
|
+
Object.defineProperty(exports, "Regex", { enumerable: true, get: function () { return utils_js_1.Regex; } });
|
|
216
|
+
Object.defineProperty(exports, "RegexResult", { enumerable: true, get: function () { return utils_js_1.RegexResult; } });
|
|
217
|
+
// Timing
|
|
218
|
+
Object.defineProperty(exports, "measureTimeMillis", { enumerable: true, get: function () { return utils_js_1.measureTimeMillis; } });
|
|
219
|
+
Object.defineProperty(exports, "measureTimeMillisAsync", { enumerable: true, get: function () { return utils_js_1.measureTimeMillisAsync; } });
|
|
220
|
+
Object.defineProperty(exports, "measureTimedValue", { enumerable: true, get: function () { return utils_js_1.measureTimedValue; } });
|
|
221
|
+
// Random
|
|
222
|
+
Object.defineProperty(exports, "Random", { enumerable: true, get: function () { return utils_js_1.Random; } });
|
|
223
|
+
Object.defineProperty(exports, "DefaultRandom", { enumerable: true, get: function () { return utils_js_1.Default; } });
|
|
224
|
+
Object.defineProperty(exports, "randomUUID", { enumerable: true, get: function () { return utils_js_1.randomUUID; } });
|
|
225
|
+
// Structural equality (backs the == operator)
|
|
226
|
+
Object.defineProperty(exports, "jalvinEquals", { enumerable: true, get: function () { return utils_js_1.jalvinEquals; } });
|
|
227
|
+
// Pair / Triple as classes
|
|
228
|
+
Object.defineProperty(exports, "Pair", { enumerable: true, get: function () { return utils_js_1.Pair; } });
|
|
229
|
+
Object.defineProperty(exports, "Triple", { enumerable: true, get: function () { return utils_js_1.Triple; } });
|
|
230
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],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AAA,WAAW,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,oGAAA,QAAQ,OAAA;AACzD,YAAY;AACZ,kGAAA,MAAM,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AACrC,QAAQ;AACR,iGAAA,KAAK,OAAA;AAAE,uGAAA,WAAW,OAAA;AAClB,SAAS;AACT,6GAAA,iBAAiB,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAC5D,SAAS;AACT,kGAAA,MAAM,OAAA;AAAE,yGAAA,OAAO,OAAiB;AAAE,sGAAA,UAAU,OAAA;AAC5C,8CAA8C;AAC9C,wGAAA,YAAY,OAAA;AACZ,2BAA2B;AAC3B,gGAAA,IAAI,OAAA;AAAE,kGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Subscriber<T> = (value: T) => void;
|
|
2
|
+
export type Unsubscribe = () => void;
|
|
3
|
+
export interface StateFlow<T> {
|
|
4
|
+
/** Current value (always up-to-date) */
|
|
5
|
+
readonly value: T;
|
|
6
|
+
/** Subscribe to changes. Returns an unsubscribe function. */
|
|
7
|
+
collect(subscriber: Subscriber<T>): Unsubscribe;
|
|
8
|
+
/** Convert to an AsyncIterable for use in for-await loops */
|
|
9
|
+
asFlow(): AsyncIterable<T>;
|
|
10
|
+
}
|
|
11
|
+
export declare class MutableStateFlow<T> implements StateFlow<T> {
|
|
12
|
+
private _value;
|
|
13
|
+
private readonly _subscribers;
|
|
14
|
+
constructor(initialValue: T);
|
|
15
|
+
get value(): T;
|
|
16
|
+
set value(newValue: T);
|
|
17
|
+
/** Atomically update the value using a transform function */
|
|
18
|
+
update(transform: (current: T) => T): void;
|
|
19
|
+
collect(subscriber: Subscriber<T>): Unsubscribe;
|
|
20
|
+
asFlow(): AsyncIterable<T>;
|
|
21
|
+
private _emit;
|
|
22
|
+
emit(value: T): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function mapFlow<T, R>(source: StateFlow<T>, transform: (v: T) => R): StateFlow<R>;
|
|
25
|
+
export declare function filterFlow<T>(source: StateFlow<T>, predicate: (v: T) => boolean): StateFlow<T | undefined>;
|
|
26
|
+
export declare function debounceFlow<T>(source: StateFlow<T>, delayMs: number): StateFlow<T>;
|
|
27
|
+
export declare abstract class ViewModel {
|
|
28
|
+
private readonly _onClearCallbacks;
|
|
29
|
+
private _cleared;
|
|
30
|
+
/** Called when this ViewModel is no longer needed. Do not override — use onCleared(). */
|
|
31
|
+
clear(): void;
|
|
32
|
+
/** Override this to release resources when the ViewModel is cleared */
|
|
33
|
+
protected onCleared(): void;
|
|
34
|
+
/** Register a callback to run when this ViewModel is cleared */
|
|
35
|
+
protected addOnClearedCallback(cb: () => void): void;
|
|
36
|
+
/** Convenience: create a MutableStateFlow tied to this ViewModel's lifecycle */
|
|
37
|
+
protected stateOf<T>(initial: T): MutableStateFlow<T>;
|
|
38
|
+
}
|
|
39
|
+
export declare function viewModel<T extends ViewModel>(key: string, factory: () => T): T;
|
|
40
|
+
export declare function clearViewModel(key: string): void;
|
|
41
|
+
export declare function clearAllViewModels(): void;
|
|
42
|
+
//# sourceMappingURL=stateflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateflow.d.ts","sourceRoot":"","sources":["../src/stateflow.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAC/C,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAMrC,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,6DAA6D;IAC7D,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC;IAChD,6DAA6D;IAC7D,MAAM,IAA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SAAS,CAAC,SAAS,IAAI,IAAI;IAE3B,gEAAgE;IAChE,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IAIpD,gFAAgF;IAChF,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;CAGtD;AAQD,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAC3C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,CAAC,GACf,CAAC,CAKH;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// StateFlow / MutableStateFlow / ViewModel
|
|
4
|
+
//
|
|
5
|
+
// Implemented as reactive observable containers backed by a subscriber set.
|
|
6
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ViewModel = exports.MutableStateFlow = void 0;
|
|
9
|
+
exports.mapFlow = mapFlow;
|
|
10
|
+
exports.filterFlow = filterFlow;
|
|
11
|
+
exports.debounceFlow = debounceFlow;
|
|
12
|
+
exports.viewModel = viewModel;
|
|
13
|
+
exports.clearViewModel = clearViewModel;
|
|
14
|
+
exports.clearAllViewModels = clearAllViewModels;
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// MutableStateFlow<T> — read-write reactive state holder
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
class MutableStateFlow {
|
|
19
|
+
_value;
|
|
20
|
+
_subscribers = new Set();
|
|
21
|
+
constructor(initialValue) {
|
|
22
|
+
this._value = initialValue;
|
|
23
|
+
}
|
|
24
|
+
get value() {
|
|
25
|
+
return this._value;
|
|
26
|
+
}
|
|
27
|
+
set value(newValue) {
|
|
28
|
+
if (Object.is(this._value, newValue))
|
|
29
|
+
return; // structural equality shortcut
|
|
30
|
+
this._value = newValue;
|
|
31
|
+
this._emit(newValue);
|
|
32
|
+
}
|
|
33
|
+
/** Atomically update the value using a transform function */
|
|
34
|
+
update(transform) {
|
|
35
|
+
this.value = transform(this._value);
|
|
36
|
+
}
|
|
37
|
+
collect(subscriber) {
|
|
38
|
+
this._subscribers.add(subscriber);
|
|
39
|
+
subscriber(this._value); // immediate delivery of current value
|
|
40
|
+
return () => this._subscribers.delete(subscriber);
|
|
41
|
+
}
|
|
42
|
+
asFlow() {
|
|
43
|
+
const self = this;
|
|
44
|
+
return {
|
|
45
|
+
[Symbol.asyncIterator]() {
|
|
46
|
+
let resolve = null;
|
|
47
|
+
const queue = [self._value];
|
|
48
|
+
let done = false;
|
|
49
|
+
const unsub = self.collect((v) => {
|
|
50
|
+
if (done)
|
|
51
|
+
return;
|
|
52
|
+
if (resolve) {
|
|
53
|
+
const r = resolve;
|
|
54
|
+
resolve = null;
|
|
55
|
+
r({ value: v, done: false });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
queue.push(v);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
next() {
|
|
63
|
+
if (queue.length > 0) {
|
|
64
|
+
return Promise.resolve({ value: queue.shift(), done: false });
|
|
65
|
+
}
|
|
66
|
+
if (done) {
|
|
67
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
68
|
+
}
|
|
69
|
+
return new Promise((res) => { resolve = res; });
|
|
70
|
+
},
|
|
71
|
+
return() {
|
|
72
|
+
done = true;
|
|
73
|
+
unsub();
|
|
74
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
_emit(value) {
|
|
81
|
+
for (const sub of this._subscribers) {
|
|
82
|
+
try {
|
|
83
|
+
sub(value);
|
|
84
|
+
}
|
|
85
|
+
catch { /* subscriber errors must not break others */ }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Useful alias for `emit(value)` inside coroutines
|
|
89
|
+
emit(value) {
|
|
90
|
+
this.value = value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.MutableStateFlow = MutableStateFlow;
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Flow operators — map, filter, take, debounce
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
function mapFlow(source, transform) {
|
|
98
|
+
const derived = new MutableStateFlow(transform(source.value));
|
|
99
|
+
source.collect((v) => { derived.value = transform(v); });
|
|
100
|
+
return derived;
|
|
101
|
+
}
|
|
102
|
+
function filterFlow(source, predicate) {
|
|
103
|
+
const initial = predicate(source.value) ? source.value : undefined;
|
|
104
|
+
const derived = new MutableStateFlow(initial);
|
|
105
|
+
source.collect((v) => { if (predicate(v))
|
|
106
|
+
derived.value = v; });
|
|
107
|
+
return derived;
|
|
108
|
+
}
|
|
109
|
+
function debounceFlow(source, delayMs) {
|
|
110
|
+
const derived = new MutableStateFlow(source.value);
|
|
111
|
+
let timer = null;
|
|
112
|
+
source.collect((v) => {
|
|
113
|
+
if (timer)
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
timer = setTimeout(() => { derived.value = v; }, delayMs);
|
|
116
|
+
});
|
|
117
|
+
return derived;
|
|
118
|
+
}
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// ViewModel base class
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
class ViewModel {
|
|
123
|
+
_onClearCallbacks = [];
|
|
124
|
+
_cleared = false;
|
|
125
|
+
/** Called when this ViewModel is no longer needed. Do not override — use onCleared(). */
|
|
126
|
+
clear() {
|
|
127
|
+
if (this._cleared)
|
|
128
|
+
return;
|
|
129
|
+
this._cleared = true;
|
|
130
|
+
for (const cb of this._onClearCallbacks) {
|
|
131
|
+
try {
|
|
132
|
+
cb();
|
|
133
|
+
}
|
|
134
|
+
catch { /* ignore */ }
|
|
135
|
+
}
|
|
136
|
+
this.onCleared();
|
|
137
|
+
}
|
|
138
|
+
/** Override this to release resources when the ViewModel is cleared */
|
|
139
|
+
onCleared() { }
|
|
140
|
+
/** Register a callback to run when this ViewModel is cleared */
|
|
141
|
+
addOnClearedCallback(cb) {
|
|
142
|
+
this._onClearCallbacks.push(cb);
|
|
143
|
+
}
|
|
144
|
+
/** Convenience: create a MutableStateFlow tied to this ViewModel's lifecycle */
|
|
145
|
+
stateOf(initial) {
|
|
146
|
+
return new MutableStateFlow(initial);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.ViewModel = ViewModel;
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// viewModel() — lookup / create singleton ViewModel by type in a registry
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
const _vmRegistry = new Map();
|
|
154
|
+
function viewModel(key, factory) {
|
|
155
|
+
if (!_vmRegistry.has(key)) {
|
|
156
|
+
_vmRegistry.set(key, factory());
|
|
157
|
+
}
|
|
158
|
+
return _vmRegistry.get(key);
|
|
159
|
+
}
|
|
160
|
+
function clearViewModel(key) {
|
|
161
|
+
const vm = _vmRegistry.get(key);
|
|
162
|
+
if (vm) {
|
|
163
|
+
vm.clear();
|
|
164
|
+
_vmRegistry.delete(key);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function clearAllViewModels() {
|
|
168
|
+
for (const [key] of _vmRegistry)
|
|
169
|
+
clearViewModel(key);
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=stateflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateflow.js","sourceRoot":"","sources":["../src/stateflow.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,2CAA2C;AAC3C,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;;;AA0GhF,0BAI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AM,CAAC;AACnC,CAAC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,EAAE,EAAE,CAAC;QACP,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB;IAChC,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,WAAW;QAAE,cAAc,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { StateFlow } from "./stateflow.js";
|
|
2
|
+
import { ViewModel } from "./stateflow.js";
|
|
3
|
+
export interface MutableState<T> {
|
|
4
|
+
value: T;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hoisted `mutableStateOf(initial)` inside a `component fun`.
|
|
8
|
+
* Returns a mutable object whose `.value` setter triggers a re-render.
|
|
9
|
+
*
|
|
10
|
+
* Compiled output:
|
|
11
|
+
* val count = mutableStateOf(0)
|
|
12
|
+
* → const count = mutableStateOf(0);
|
|
13
|
+
* // count.value to read; count.value = x to update
|
|
14
|
+
*/
|
|
15
|
+
export declare function mutableStateOf<T>(initial: T): MutableState<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Compute an expensive value once and remember it, like Compose's `remember`.
|
|
18
|
+
*
|
|
19
|
+
* val scope = remember { CoroutineScope() }
|
|
20
|
+
*/
|
|
21
|
+
export declare function remember<T>(compute: () => T, deps?: readonly unknown[]): T;
|
|
22
|
+
/**
|
|
23
|
+
* `remember { mutableStateOf(0) }` — convenience wrapper.
|
|
24
|
+
*/
|
|
25
|
+
export declare function rememberMutableStateOf<T>(initial: T): MutableState<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Collects a StateFlow into React state. The component re-renders when
|
|
28
|
+
* the flow emits a new value.
|
|
29
|
+
*
|
|
30
|
+
* val currentName by viewModel.name.collectAsState()
|
|
31
|
+
*/
|
|
32
|
+
export declare function collectAsState<T>(flow: StateFlow<T>): T;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a shared ViewModel instance for the given key.
|
|
35
|
+
*
|
|
36
|
+
* val vm = useViewModel("CounterVm") { CounterViewModel() }
|
|
37
|
+
*/
|
|
38
|
+
export declare function useViewModel<T extends ViewModel>(key: string, factory: () => T): T;
|
|
39
|
+
/**
|
|
40
|
+
* Runs a suspend block when deps change. Cancels on unmount.
|
|
41
|
+
*
|
|
42
|
+
* LaunchedEffect(Unit) {
|
|
43
|
+
* repeat(10) { delay(1_000) }
|
|
44
|
+
* }
|
|
45
|
+
*/
|
|
46
|
+
export declare function LaunchedEffect(deps: readonly unknown[], fn: () => Promise<void>): void;
|
|
47
|
+
export declare function DisposableEffect(deps: readonly unknown[], fn: () => (() => void)): void;
|
|
48
|
+
export declare function SideEffect(fn: () => void): void;
|
|
49
|
+
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAyC,MAAM,gBAAgB,CAAC;AAMlF,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAoB7D;AAMD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAE,SAAS,OAAO,EAAO,GAAG,CAAC,CAG9E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,C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