@chocbite/ts-lib-state 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/index.d.ts +1430 -0
- package/dist/index.js +3698 -0
- package/package.json +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1430 @@
|
|
|
1
|
+
import * as _chocbite_ts_lib_result from '@chocbite/ts-lib-result';
|
|
2
|
+
import { Option, Result, ResultOk, OptionSome, OptionNone } from '@chocbite/ts-lib-result';
|
|
3
|
+
import * as _chocbite_ts_lib_svg from '@chocbite/ts-lib-svg';
|
|
4
|
+
import { SVGFunc } from '@chocbite/ts-lib-svg';
|
|
5
|
+
|
|
6
|
+
type StateArrayWrite<TYPE> = {
|
|
7
|
+
type: "write";
|
|
8
|
+
items: readonly TYPE[];
|
|
9
|
+
} | {
|
|
10
|
+
type: "change";
|
|
11
|
+
index: number;
|
|
12
|
+
item: TYPE;
|
|
13
|
+
} | {
|
|
14
|
+
type: "push";
|
|
15
|
+
items: readonly TYPE[];
|
|
16
|
+
} | {
|
|
17
|
+
type: "unshift";
|
|
18
|
+
items: readonly TYPE[];
|
|
19
|
+
} | {
|
|
20
|
+
type: "pop";
|
|
21
|
+
} | {
|
|
22
|
+
type: "shift";
|
|
23
|
+
} | {
|
|
24
|
+
type: "delete";
|
|
25
|
+
item: TYPE;
|
|
26
|
+
} | {
|
|
27
|
+
type: "splice";
|
|
28
|
+
index: number;
|
|
29
|
+
delete_count: number;
|
|
30
|
+
items?: readonly TYPE[];
|
|
31
|
+
};
|
|
32
|
+
declare const StateArrayReadType: {
|
|
33
|
+
readonly added: "added";
|
|
34
|
+
readonly removed: "removed";
|
|
35
|
+
readonly changed: "changed";
|
|
36
|
+
readonly fresh: "fresh";
|
|
37
|
+
};
|
|
38
|
+
type StateArrayReadType = (typeof StateArrayReadType)[keyof typeof StateArrayReadType];
|
|
39
|
+
interface StateArrayRead<TYPE> {
|
|
40
|
+
array: readonly TYPE[];
|
|
41
|
+
type: StateArrayReadType;
|
|
42
|
+
index: number;
|
|
43
|
+
items: readonly TYPE[];
|
|
44
|
+
}
|
|
45
|
+
type SAR<AT> = StateArrayRead<AT>;
|
|
46
|
+
type SAW<AT> = StateArrayWrite<AT>;
|
|
47
|
+
type ArraySetter<AT, RRT extends Result<SAR<AT>, string>, REL extends Option<StateRelated>> = (value: SAW<AT>, state: OwnerWS$7<AT, RRT, REL>, old?: RRT) => Result<void, string>;
|
|
48
|
+
interface Owner$d<AT, RRT extends Result<SAR<AT>, string>, REL extends Option<StateRelated>> {
|
|
49
|
+
set(value: ResultOk<AT[]>): void;
|
|
50
|
+
set_ok(value: AT[]): void;
|
|
51
|
+
setter?: ArraySetter<AT, RRT, REL>;
|
|
52
|
+
get array(): readonly AT[];
|
|
53
|
+
readonly length: number;
|
|
54
|
+
readonly length_state: StateROS<number>;
|
|
55
|
+
at(index: number): AT | undefined;
|
|
56
|
+
set_index(index: number, value: AT): void;
|
|
57
|
+
push(...items: AT[]): number;
|
|
58
|
+
pop(): AT | undefined;
|
|
59
|
+
shift(): AT | undefined;
|
|
60
|
+
unshift(...items: AT[]): number;
|
|
61
|
+
splice(start: number, deleteCount?: number, ...items: AT[]): AT[];
|
|
62
|
+
delete(val: AT): void;
|
|
63
|
+
apply_read<B>(result: ResultOk<SAR<B>>, transform: (val: readonly B[], type: StateArrayReadType) => AT[]): void;
|
|
64
|
+
}
|
|
65
|
+
interface OwnerWS$7<AT, RRT extends Result<SAR<AT>, string>, REL extends Option<StateRelated>> extends Owner$d<AT, RRT, REL> {
|
|
66
|
+
setter: ArraySetter<AT, RRT, REL>;
|
|
67
|
+
}
|
|
68
|
+
type StateArraySyncROS<AT, REL extends Option<StateRelated> = Option<{}>> = StateROS<SAR<AT>, REL, SAW<AT>> & Owner$d<AT, ResultOk<SAR<AT>>, REL> & {
|
|
69
|
+
readonly state: StateArray<AT, REL>;
|
|
70
|
+
readonly read_only: StateArrayROS<AT, REL>;
|
|
71
|
+
readonly read_write?: StateArrayROSWS<AT, REL>;
|
|
72
|
+
};
|
|
73
|
+
type StateArraySyncROSWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateROSWS<SAR<AT>, SAW<AT>, REL> & OwnerWS$7<AT, ResultOk<SAR<AT>>, REL> & {
|
|
74
|
+
readonly state: StateArray<AT, REL>;
|
|
75
|
+
readonly read_only: StateArrayROS<AT, REL>;
|
|
76
|
+
readonly read_write: StateArrayROSWS<AT, REL>;
|
|
77
|
+
};
|
|
78
|
+
type StateArraySyncRES<AT, REL extends Option<StateRelated> = Option<{}>> = StateRES<SAR<AT>, REL, SAW<AT>> & Owner$d<AT, ResultOk<SAR<AT>>, REL> & {
|
|
79
|
+
set_err(error: string): void;
|
|
80
|
+
readonly state: StateArray<AT, REL>;
|
|
81
|
+
readonly read_only: StateArrayRES<AT, REL>;
|
|
82
|
+
readonly read_write?: StateArrayRESWS<AT, REL>;
|
|
83
|
+
};
|
|
84
|
+
type StateArraySyncRESWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateRESWS<SAR<AT>, SAW<AT>, REL> & OwnerWS$7<AT, ResultOk<SAR<AT>>, REL> & {
|
|
85
|
+
set_err(error: string): void;
|
|
86
|
+
readonly state: StateArray<AT, REL>;
|
|
87
|
+
readonly read_only: StateArrayRES<AT, REL>;
|
|
88
|
+
readonly read_write: StateArrayRESWS<AT, REL>;
|
|
89
|
+
};
|
|
90
|
+
declare function apply_read<AT>(array: AT[], read: StateArrayRead<AT>): AT[];
|
|
91
|
+
declare function apply_read<AT, TAT = AT>(array: AT[], read: StateArrayRead<TAT>, transform: (value: TAT, index: number, array: readonly TAT[]) => AT): AT[];
|
|
92
|
+
|
|
93
|
+
/**Function used to subscribe to state changes
|
|
94
|
+
* @template RT - The type of the state’s value when read.*/
|
|
95
|
+
type StateSub<RRT extends Result<any, string>> = (value: RRT) => void;
|
|
96
|
+
type StateInferResult<S extends State<any>> = S extends StateROA<infer RT> ? ResultOk<RT> : S extends StateREA<infer RT> ? Result<RT, string> : never;
|
|
97
|
+
type StateInferType<S extends State<any>> = S extends State<infer RT> ? RT : never;
|
|
98
|
+
type StateInferSub<S extends State<any>> = StateSub<StateInferResult<S>>;
|
|
99
|
+
/**Map of values or states related to a state */
|
|
100
|
+
type StateRelated = {
|
|
101
|
+
[key: string | symbol | number]: any;
|
|
102
|
+
};
|
|
103
|
+
interface StateHelper<WT, REL extends Option<StateRelated>> {
|
|
104
|
+
related?: () => REL;
|
|
105
|
+
limit?: (value: WT) => Result<WT, string>;
|
|
106
|
+
check?: (value: WT) => Result<WT, string>;
|
|
107
|
+
}
|
|
108
|
+
type StateSetREXWS<RT, S, WT = RT> = (value: WT, state: S, old?: Result<RT, string>) => Result<void, string>;
|
|
109
|
+
declare const STATE_KEY: unique symbol;
|
|
110
|
+
interface StateBase$1<RT, WT, REL extends Option<StateRelated>, RRT extends Result<RT, string>> {
|
|
111
|
+
[STATE_KEY]: true;
|
|
112
|
+
/**Is state guarenteed sync*/
|
|
113
|
+
readonly rsync: boolean;
|
|
114
|
+
/**Is state guarenteed OK*/
|
|
115
|
+
readonly rok: boolean;
|
|
116
|
+
/**Allows getting value of the state*/
|
|
117
|
+
then<T = RRT>(func: (value: RRT) => T | PromiseLike<T>): PromiseLike<T>;
|
|
118
|
+
/**Gets the current value of the state if state is sync*/
|
|
119
|
+
get?(): RRT;
|
|
120
|
+
/**Gets the value of the state without result, only works when state is OK */
|
|
121
|
+
ok?(): RT;
|
|
122
|
+
/**This adds a function as a subscriber to changes to the state
|
|
123
|
+
* @param update set true to update subscriber immediatly*/
|
|
124
|
+
sub<T = StateSub<RRT>>(func: StateSub<RRT>, update?: boolean): T;
|
|
125
|
+
/**This removes a function as a subscriber to the state*/
|
|
126
|
+
unsub<T = StateSub<RRT>>(func: T): T;
|
|
127
|
+
/**This returns related states if any*/
|
|
128
|
+
related(): REL;
|
|
129
|
+
/**Returns if the state is being used */
|
|
130
|
+
in_use(): this | undefined;
|
|
131
|
+
/**Returns if the state has a subscriber */
|
|
132
|
+
has(subscriber: StateSub<RRT>): this | undefined;
|
|
133
|
+
/**Returns if the state has a subscriber */
|
|
134
|
+
amount(): number;
|
|
135
|
+
/**Is state guarenteed writable*/
|
|
136
|
+
readonly writable: boolean;
|
|
137
|
+
/**Is state guarenteed sync for writes*/
|
|
138
|
+
readonly wsync?: boolean;
|
|
139
|
+
/** This attempts a write to the state, write is not guaranteed to succeed
|
|
140
|
+
* @returns promise of result with error for the write*/
|
|
141
|
+
write?(value: WT): Promise<Result<void, string>>;
|
|
142
|
+
/** This attempts a write to the state, write is not guaranteed to succeed, this sync method is available on sync states
|
|
143
|
+
* @returns result with error for the write*/
|
|
144
|
+
write_sync?(value: WT): Result<void, string>;
|
|
145
|
+
/**Limits given value to valid range if possible returns None if not possible */
|
|
146
|
+
limit?(value: WT): Result<WT, string>;
|
|
147
|
+
/**Checks if the value is valid and returns reason for invalidity */
|
|
148
|
+
check?(value: WT): Result<WT, string>;
|
|
149
|
+
}
|
|
150
|
+
interface REA$1<RT, REL extends Option<StateRelated>, WT> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
151
|
+
readonly rsync: false;
|
|
152
|
+
readonly rok: false;
|
|
153
|
+
readonly writable: false;
|
|
154
|
+
readonly wsync: false;
|
|
155
|
+
}
|
|
156
|
+
interface ROA$1<RT, REL extends Option<StateRelated>, WT> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
157
|
+
readonly rsync: false;
|
|
158
|
+
readonly rok: true;
|
|
159
|
+
readonly writable: false;
|
|
160
|
+
readonly wsync: false;
|
|
161
|
+
}
|
|
162
|
+
interface RES$1<RT, REL extends Option<StateRelated>, WT> extends StateBase$1<RT, WT, REL, Result<RT, string>> {
|
|
163
|
+
readonly rsync: true;
|
|
164
|
+
readonly rok: false;
|
|
165
|
+
get(): Result<RT, string>;
|
|
166
|
+
readonly writable: false;
|
|
167
|
+
readonly wsync: false;
|
|
168
|
+
}
|
|
169
|
+
interface ROS$1<RT, REL extends Option<StateRelated>, WT> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
170
|
+
readonly rsync: true;
|
|
171
|
+
readonly rok: true;
|
|
172
|
+
get(): ResultOk<RT>;
|
|
173
|
+
ok(): RT;
|
|
174
|
+
readonly writable: false;
|
|
175
|
+
readonly wsync: false;
|
|
176
|
+
}
|
|
177
|
+
interface REAWA<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
178
|
+
readonly rsync: false;
|
|
179
|
+
readonly rok: false;
|
|
180
|
+
readonly writable: true;
|
|
181
|
+
readonly wsync: false;
|
|
182
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
183
|
+
limit(value: WT): Result<WT, string>;
|
|
184
|
+
check(value: WT): Result<WT, string>;
|
|
185
|
+
}
|
|
186
|
+
interface REAWS<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
187
|
+
readonly rsync: false;
|
|
188
|
+
readonly rok: false;
|
|
189
|
+
readonly writable: true;
|
|
190
|
+
readonly wsync: true;
|
|
191
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
192
|
+
limit(value: WT): Result<WT, string>;
|
|
193
|
+
check(value: WT): Result<WT, string>;
|
|
194
|
+
write_sync(value: WT): Result<void, string>;
|
|
195
|
+
}
|
|
196
|
+
interface ROAWA<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
197
|
+
readonly rsync: false;
|
|
198
|
+
readonly rok: true;
|
|
199
|
+
readonly writable: true;
|
|
200
|
+
readonly wsync: false;
|
|
201
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
202
|
+
limit(value: WT): Result<WT, string>;
|
|
203
|
+
check(value: WT): Result<WT, string>;
|
|
204
|
+
}
|
|
205
|
+
interface ROAWS<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
206
|
+
readonly rsync: false;
|
|
207
|
+
readonly rok: true;
|
|
208
|
+
readonly writable: true;
|
|
209
|
+
readonly wsync: true;
|
|
210
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
211
|
+
limit(value: WT): Result<WT, string>;
|
|
212
|
+
check(value: WT): Result<WT, string>;
|
|
213
|
+
write_sync(value: WT): Result<void, string>;
|
|
214
|
+
}
|
|
215
|
+
interface RESWA<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, Result<RT, string>> {
|
|
216
|
+
readonly rsync: true;
|
|
217
|
+
readonly rok: false;
|
|
218
|
+
get(): Result<RT, string>;
|
|
219
|
+
readonly writable: true;
|
|
220
|
+
readonly wsync: false;
|
|
221
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
222
|
+
limit(value: WT): Result<WT, string>;
|
|
223
|
+
check(value: WT): Result<WT, string>;
|
|
224
|
+
}
|
|
225
|
+
interface RESWS<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, Result<RT, string>> {
|
|
226
|
+
readonly rsync: true;
|
|
227
|
+
readonly rok: false;
|
|
228
|
+
get(): Result<RT, string>;
|
|
229
|
+
readonly writable: true;
|
|
230
|
+
readonly wsync: true;
|
|
231
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
232
|
+
limit(value: WT): Result<WT, string>;
|
|
233
|
+
check(value: WT): Result<WT, string>;
|
|
234
|
+
write_sync(value: WT): Result<void, string>;
|
|
235
|
+
}
|
|
236
|
+
interface ROSWA<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
237
|
+
readonly rsync: true;
|
|
238
|
+
readonly rok: true;
|
|
239
|
+
get(): ResultOk<RT>;
|
|
240
|
+
ok(): RT;
|
|
241
|
+
readonly writable: true;
|
|
242
|
+
readonly wsync: false;
|
|
243
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
244
|
+
limit(value: WT): Result<WT, string>;
|
|
245
|
+
check(value: WT): Result<WT, string>;
|
|
246
|
+
}
|
|
247
|
+
interface ROSWS<RT, WT, REL extends Option<StateRelated>> extends StateBase$1<RT, WT, REL, ResultOk<RT>> {
|
|
248
|
+
readonly rsync: true;
|
|
249
|
+
readonly rok: true;
|
|
250
|
+
get(): ResultOk<RT>;
|
|
251
|
+
ok(): RT;
|
|
252
|
+
readonly writable: true;
|
|
253
|
+
readonly wsync: true;
|
|
254
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
255
|
+
limit(value: WT): Result<WT, string>;
|
|
256
|
+
check(value: WT): Result<WT, string>;
|
|
257
|
+
write_sync(value: WT): Result<void, string>;
|
|
258
|
+
}
|
|
259
|
+
type State<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateREA<RT, REL, WT> | StateROA<RT, REL, WT> | StateRES<RT, REL, WT> | StateROS<RT, REL, WT> | StateREAWA<RT, WT, REL> | StateREAWS<RT, WT, REL> | StateROAWA<RT, WT, REL> | StateROAWS<RT, WT, REL> | StateRESWA<RT, WT, REL> | StateRESWS<RT, WT, REL> | StateROSWA<RT, WT, REL> | StateROSWS<RT, WT, REL>;
|
|
260
|
+
type StateREA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = REA$1<RT, REL, WT> | StateREAWA<RT, WT, REL> | StateREAWS<RT, WT, REL> | StateROA<RT, REL, WT> | StateROS<RT, REL, WT> | StateRES<RT, REL, WT>;
|
|
261
|
+
type StateROA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = ROA$1<RT, REL, WT> | StateROAWA<RT, WT, REL> | StateROAWS<RT, WT, REL> | StateROS<RT, REL, WT>;
|
|
262
|
+
type StateRES<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = RES$1<RT, REL, WT> | StateRESWA<RT, WT, REL> | StateRESWS<RT, WT, REL> | StateROS<RT, REL, WT>;
|
|
263
|
+
type StateROS<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = ROS$1<RT, REL, WT> | StateROSWA<RT, WT, REL> | StateROSWS<RT, WT, REL>;
|
|
264
|
+
type StateREAWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = REAWA<RT, WT, REL> | StateREAWS<RT, WT, REL> | StateROAWA<RT, WT, REL> | StateROSWA<RT, WT, REL> | StateRESWA<RT, WT, REL>;
|
|
265
|
+
type StateREAWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = REAWS<RT, WT, REL> | StateROAWS<RT, WT, REL> | StateROSWS<RT, WT, REL> | StateRESWS<RT, WT, REL>;
|
|
266
|
+
type StateROAWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = ROAWA<RT, WT, REL> | StateROAWS<RT, WT, REL> | StateROSWA<RT, WT, REL>;
|
|
267
|
+
type StateROAWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = ROAWS<RT, WT, REL> | StateROSWS<RT, WT, REL>;
|
|
268
|
+
type StateRESWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = RESWA<RT, WT, REL> | StateRESWS<RT, WT, REL> | StateROSWA<RT, WT, REL>;
|
|
269
|
+
type StateRESWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = RESWS<RT, WT, REL> | StateROSWS<RT, WT, REL>;
|
|
270
|
+
type StateROSWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = ROSWA<RT, WT, REL> | StateROSWS<RT, WT, REL>;
|
|
271
|
+
type StateROSWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = ROSWS<RT, WT, REL>;
|
|
272
|
+
type StateArray<AT, REL extends Option<StateRelated> = Option<{}>> = State<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
273
|
+
type StateArrayREA<AT, REL extends Option<StateRelated> = Option<{}>> = StateREA<StateArrayRead<AT>, REL, StateArrayWrite<AT>>;
|
|
274
|
+
type StateArrayROA<AT, REL extends Option<StateRelated> = Option<{}>> = StateROA<StateArrayRead<AT>, REL, StateArrayWrite<AT>>;
|
|
275
|
+
type StateArrayRES<AT, REL extends Option<StateRelated> = Option<{}>> = StateRES<StateArrayRead<AT>, REL, StateArrayWrite<AT>>;
|
|
276
|
+
type StateArrayROS<AT, REL extends Option<StateRelated> = Option<{}>> = StateROS<StateArrayRead<AT>, REL, StateArrayWrite<AT>>;
|
|
277
|
+
type StateArrayREAWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateREAWS<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
278
|
+
type StateArrayREAWA<AT, REL extends Option<StateRelated> = Option<{}>> = StateREAWA<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
279
|
+
type StateArrayROAWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateROAWS<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
280
|
+
type StateArrayROAWA<AT, REL extends Option<StateRelated> = Option<{}>> = StateROAWA<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
281
|
+
type StateArrayRESWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateRESWS<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
282
|
+
type StateArrayRESWA<AT, REL extends Option<StateRelated> = Option<{}>> = StateRESWA<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
283
|
+
type StateArrayROSWS<AT, REL extends Option<StateRelated> = Option<{}>> = StateROSWS<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
284
|
+
type StateArrayROSWA<AT, REL extends Option<StateRelated> = Option<{}>> = StateROSWA<StateArrayRead<AT>, StateArrayWrite<AT>, REL>;
|
|
285
|
+
|
|
286
|
+
type SyncSetter<RT, RRT extends Result<RT, string>, REL extends Option<StateRelated>, WT = RT> = (value: WT, state: OwnerWS$6<RT, RRT, WT, REL>, old?: RRT) => Result<void, string>;
|
|
287
|
+
interface Owner$c<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> {
|
|
288
|
+
set(value: RRT): void;
|
|
289
|
+
set_ok(value: RT): void;
|
|
290
|
+
setter?: SyncSetter<RT, RRT, REL, WT>;
|
|
291
|
+
readonly state: State<RT, WT, REL>;
|
|
292
|
+
}
|
|
293
|
+
interface OwnerWS$6<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> extends Owner$c<RT, RRT, WT, REL> {
|
|
294
|
+
setter: SyncSetter<RT, RRT, REL, WT>;
|
|
295
|
+
}
|
|
296
|
+
type StateSyncROS<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateROS<RT, REL, WT> & Owner$c<RT, ResultOk<RT>, WT, REL> & {
|
|
297
|
+
readonly read_only: StateROS<RT, REL, WT>;
|
|
298
|
+
readonly read_write?: StateROSWS<RT, WT, REL>;
|
|
299
|
+
};
|
|
300
|
+
type StateSyncROSWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateROSWS<RT, WT, REL> & OwnerWS$6<RT, ResultOk<RT>, WT, REL> & {
|
|
301
|
+
readonly read_only: StateROS<RT, REL, WT>;
|
|
302
|
+
readonly read_write: StateROSWS<RT, WT, REL>;
|
|
303
|
+
};
|
|
304
|
+
type StateSyncRES<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateRES<RT, REL, WT> & Owner$c<RT, Result<RT, string>, WT, REL> & {
|
|
305
|
+
set_err(error: string): void;
|
|
306
|
+
readonly read_only: StateRES<RT, REL, WT>;
|
|
307
|
+
readonly read_write?: StateRESWS<RT, WT, REL>;
|
|
308
|
+
};
|
|
309
|
+
type StateSyncRESWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateRESWS<RT, WT, REL> & OwnerWS$6<RT, Result<RT, string>, WT, REL> & {
|
|
310
|
+
set_err(error: string): void;
|
|
311
|
+
readonly read_only: StateRES<RT, REL, WT>;
|
|
312
|
+
readonly read_write: StateRESWS<RT, WT, REL>;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
declare abstract class StateBase<RT, WT, REL extends Option<StateRelated>, RRT extends Result<RT, string>> implements StateBase$1<RT, WT, REL, RRT> {
|
|
316
|
+
#private;
|
|
317
|
+
get [STATE_KEY](): true;
|
|
318
|
+
abstract readonly rsync: boolean;
|
|
319
|
+
abstract readonly rok: boolean;
|
|
320
|
+
abstract then<T = RRT>(func: (value: RRT) => T | PromiseLike<T>): PromiseLike<T>;
|
|
321
|
+
get?(): RRT;
|
|
322
|
+
ok?(): RT;
|
|
323
|
+
sub<T = StateSub<RRT>>(func: StateSub<RRT>, update?: boolean): T;
|
|
324
|
+
unsub<T = StateSub<RRT>>(func: T): T;
|
|
325
|
+
abstract related(): REL;
|
|
326
|
+
in_use(): this | undefined;
|
|
327
|
+
has(subscriber: StateSub<RRT>): this | undefined;
|
|
328
|
+
amount(): number;
|
|
329
|
+
abstract readonly wsync: boolean;
|
|
330
|
+
abstract readonly writable: boolean;
|
|
331
|
+
write?(value: WT): Promise<Result<void, string>>;
|
|
332
|
+
limit?(value: WT): Result<WT, string>;
|
|
333
|
+
check?(value: WT): Result<WT, string>;
|
|
334
|
+
write_sync?(value: WT): Result<void, string>;
|
|
335
|
+
/**Called when subscriber is added*/
|
|
336
|
+
protected on_subscribe(): void;
|
|
337
|
+
/**Called when subscriber is removed*/
|
|
338
|
+
protected on_unsubscribe(): void;
|
|
339
|
+
/**Updates all subscribers with a value */
|
|
340
|
+
protected update_subs(value: RRT): void;
|
|
341
|
+
/**Creates a promise which can be fulfilled later with fulRProm */
|
|
342
|
+
protected append_r_prom<T = Result<RT, string>, TResult1 = Result<RT, string>>(func: (value: T) => TResult1 | PromiseLike<TResult1>): Promise<TResult1>;
|
|
343
|
+
/**Fulfills all read promises with given value */
|
|
344
|
+
protected ful_r_prom(value: RRT): RRT;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**State Resource
|
|
348
|
+
* state for representing a remote resource
|
|
349
|
+
*
|
|
350
|
+
* Debounce and Timout
|
|
351
|
+
* example if the debounce is set to 50 and timeout to 200
|
|
352
|
+
* singleGet will not be called until 50 ms after the first await of the state
|
|
353
|
+
* when singleGet returns a Result, it is returned to all awaiters then buffered for the period of the timeout
|
|
354
|
+
* any awaiters within the timeout will get the buffer, after that it starts over
|
|
355
|
+
*
|
|
356
|
+
* Debounce and Retention
|
|
357
|
+
* When a subscriber is added the debounce delay is added before setupConnection is called
|
|
358
|
+
* likevise when the last subscriber unsubscribes the retention delay is added before teardownConnection is called
|
|
359
|
+
* this can prevent unneeded calls if the user is switching around quickly between things referencing states
|
|
360
|
+
* @template RT - The type of the state’s value when read.
|
|
361
|
+
* @template REL - The type of related states, defaults to an empty object.*/
|
|
362
|
+
interface StateResourceOwnerREA<RT, WT, REL extends Option<StateRelated>> {
|
|
363
|
+
update_single(value: Result<RT, string>, update?: boolean): void;
|
|
364
|
+
update_resource(value: Result<RT, string>): void;
|
|
365
|
+
get buffer(): Result<RT, string> | undefined;
|
|
366
|
+
get state(): State<RT, WT, REL>;
|
|
367
|
+
get read_only(): StateREA<RT, REL, WT>;
|
|
368
|
+
}
|
|
369
|
+
declare abstract class StateResourceREA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> extends StateBase<RT, WT, REL, Result<RT, string>> implements StateResourceOwnerREA<RT, WT, REL> {
|
|
370
|
+
#private;
|
|
371
|
+
/**Timeout before giving generic error, if update_resource is not called*/
|
|
372
|
+
abstract get timeout(): number;
|
|
373
|
+
/**Debounce delaying one time value retrival*/
|
|
374
|
+
abstract get debounce(): number;
|
|
375
|
+
/**Timeout for validity of last buffered value*/
|
|
376
|
+
abstract get validity(): number | true;
|
|
377
|
+
/**Retention delay before resource performs teardown of connection is performed*/
|
|
378
|
+
abstract get retention(): number;
|
|
379
|
+
protected on_subscribe(): void;
|
|
380
|
+
protected on_unsubscribe(): void;
|
|
381
|
+
/**Called if the state is awaited, returns the value once*/
|
|
382
|
+
protected abstract single_get(state: StateResourceOwnerREA<RT, WT, REL>): void;
|
|
383
|
+
/**Called when state is subscribed to to setup connection to remote resource*/
|
|
384
|
+
protected abstract setup_connection(state: StateResourceOwnerREA<RT, WT, REL>): void;
|
|
385
|
+
/**Called when state is no longer subscribed to to cleanup connection to remote resource*/
|
|
386
|
+
protected abstract teardown_connection(state: StateResourceOwnerREA<RT, WT, REL>): void;
|
|
387
|
+
update_single(value: Result<RT, string>, update?: boolean): void;
|
|
388
|
+
update_resource(value: Result<RT, string>): void;
|
|
389
|
+
get buffer(): Result<RT, string> | undefined;
|
|
390
|
+
get state(): State<RT, WT, REL>;
|
|
391
|
+
get read_only(): StateREA<RT, REL, WT>;
|
|
392
|
+
get rok(): false;
|
|
393
|
+
get rsync(): false;
|
|
394
|
+
then<T = Result<RT, string>>(func: (value: Result<RT, string>) => T | PromiseLike<T>): Promise<T>;
|
|
395
|
+
get writable(): boolean;
|
|
396
|
+
get wsync(): boolean;
|
|
397
|
+
}
|
|
398
|
+
interface Owner$b<RT, WT, REL extends Option<StateRelated>> extends StateResourceOwnerREA<RT, WT, REL> {
|
|
399
|
+
}
|
|
400
|
+
type StateResourceFuncREA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateREA<RT, REL, WT> & Owner$b<RT, WT, REL>;
|
|
401
|
+
/**State Resource
|
|
402
|
+
* state for representing a remote resource
|
|
403
|
+
*
|
|
404
|
+
* Debounce and Timout
|
|
405
|
+
* example if the debounce is set to 50 and timeout to 200
|
|
406
|
+
* singleGet will not be called until 50 ms after the first await of the state
|
|
407
|
+
* when singleGet returns a Result, it is returned to all awaiters then buffered for the period of the timeout
|
|
408
|
+
* any awaiters within the timeout will get the buffer, after that it starts over
|
|
409
|
+
*
|
|
410
|
+
* Debounce and Retention
|
|
411
|
+
* When a subscriber is added the debounce delay is added before setupConnection is called
|
|
412
|
+
* likevise when the last subscriber unsubscribes the retention delay is added before teardownConnection is called
|
|
413
|
+
* this can prevent unneeded calls if the user is switching around quickly between things referencing states
|
|
414
|
+
* @template RT - The type of the state’s value when read.
|
|
415
|
+
* @template WT - The type which can be written to the state.
|
|
416
|
+
* @template REL - The type of related states, defaults to an empty object.*/
|
|
417
|
+
interface StateResourceOwnerREAWA<RT, WT, REL extends Option<StateRelated>> {
|
|
418
|
+
update_single(value: Result<RT, string>, update?: boolean): void;
|
|
419
|
+
update_resource(value: Result<RT, string>): void;
|
|
420
|
+
get buffer(): Result<RT, string> | undefined;
|
|
421
|
+
get state(): State<RT, WT, REL>;
|
|
422
|
+
get read_only(): StateREA<RT, REL, WT>;
|
|
423
|
+
get read_write(): StateREAWA<RT, WT, REL>;
|
|
424
|
+
}
|
|
425
|
+
declare abstract class StateResourceREAWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> extends StateBase<RT, WT, REL, Result<RT, string>> implements StateResourceOwnerREAWA<RT, WT, REL> {
|
|
426
|
+
#private;
|
|
427
|
+
/**Timeout before giving generic error, if update_resource is not called*/
|
|
428
|
+
abstract get timeout(): number;
|
|
429
|
+
/**Debounce delaying one time value retrival*/
|
|
430
|
+
abstract get debounce(): number;
|
|
431
|
+
/**Timeout for validity of last buffered value*/
|
|
432
|
+
abstract get validity(): number | true;
|
|
433
|
+
/**Retention delay before resource performs teardown of connection is performed*/
|
|
434
|
+
abstract get retention(): number;
|
|
435
|
+
/**How long to debounce write calls, before the last write call is used*/
|
|
436
|
+
abstract get write_debounce(): number;
|
|
437
|
+
protected on_subscribe(): void;
|
|
438
|
+
protected on_unsubscribe(): void;
|
|
439
|
+
/**Called if the state is awaited, returns the value once*/
|
|
440
|
+
protected abstract single_get(state: StateResourceOwnerREAWA<RT, WT, REL>): void;
|
|
441
|
+
/**Called when state is subscribed to to setup connection to remote resource*/
|
|
442
|
+
protected abstract setup_connection(state: StateResourceOwnerREAWA<RT, WT, REL>): void;
|
|
443
|
+
/**Called when state is no longer subscribed to to cleanup connection to remote resource*/
|
|
444
|
+
protected abstract teardown_connection(state: StateResourceOwnerREAWA<RT, WT, REL>): void;
|
|
445
|
+
/**Called after write debounce finished with the last written value*/
|
|
446
|
+
protected abstract write_action(value: WT, state: StateResourceOwnerREAWA<RT, WT, REL>): Promise<Result<void, string>>;
|
|
447
|
+
update_single(value: Result<RT, string>, update?: boolean): void;
|
|
448
|
+
update_resource(value: Result<RT, string>): void;
|
|
449
|
+
get buffer(): Result<RT, string> | undefined;
|
|
450
|
+
get state(): State<RT, WT, REL>;
|
|
451
|
+
get read_only(): StateREA<RT, REL, WT>;
|
|
452
|
+
get read_write(): StateREAWA<RT, WT, REL>;
|
|
453
|
+
get rok(): false;
|
|
454
|
+
get rsync(): false;
|
|
455
|
+
then<T = Result<RT, string>>(func: (value: Result<RT, string>) => T | PromiseLike<T>): Promise<T>;
|
|
456
|
+
get writable(): true;
|
|
457
|
+
get wsync(): false;
|
|
458
|
+
write(value: WT): Promise<Result<void, string>>;
|
|
459
|
+
abstract limit(value: WT): Result<WT, string>;
|
|
460
|
+
abstract check(value: WT): Result<WT, string>;
|
|
461
|
+
}
|
|
462
|
+
interface OwnerWA$5<RT, WT, REL extends Option<StateRelated>> extends StateResourceOwnerREAWA<RT, WT, REL> {
|
|
463
|
+
}
|
|
464
|
+
type StateResourceFuncREAWA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateREAWA<RT, WT, REL> & OwnerWA$5<RT, WT, REL>;
|
|
465
|
+
|
|
466
|
+
/**State Resource
|
|
467
|
+
* state for representing a remote resource
|
|
468
|
+
*
|
|
469
|
+
* Debounce and Timout
|
|
470
|
+
* example if the debounce is set to 50 and timeout to 200
|
|
471
|
+
* singleGet will not be called until 50 ms after the first await of the state
|
|
472
|
+
* when singleGet returns a Result, it is returned to all awaiters then buffered for the period of the timeout
|
|
473
|
+
* any awaiters within the timeout will get the buffer, after that it starts over
|
|
474
|
+
*
|
|
475
|
+
* Debounce and Retention
|
|
476
|
+
* When a subscriber is added the debounce delay is added before setupConnection is called
|
|
477
|
+
* likevise when the last subscriber unsubscribes the retention delay is added before teardownConnection is called
|
|
478
|
+
* this can prevent unneeded calls if the user is switching around quickly between things referencing states
|
|
479
|
+
* @template RT - The type of the state’s value when read.
|
|
480
|
+
* @template REL - The type of related states, defaults to an empty object.*/
|
|
481
|
+
interface StateResourceOwnerROA<RT, WT, REL extends Option<StateRelated>> {
|
|
482
|
+
update_single(value: ResultOk<RT>, update?: boolean): void;
|
|
483
|
+
update_resource(value: ResultOk<RT>): void;
|
|
484
|
+
get buffer(): ResultOk<RT> | undefined;
|
|
485
|
+
get state(): State<RT, WT, REL>;
|
|
486
|
+
get read_only(): StateROA<RT, REL, WT>;
|
|
487
|
+
}
|
|
488
|
+
declare abstract class StateResourceROA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> extends StateBase<RT, WT, REL, ResultOk<RT>> implements StateResourceOwnerROA<RT, WT, REL> {
|
|
489
|
+
#private;
|
|
490
|
+
/**Timeout before giving generic error, if update_resource is not called*/
|
|
491
|
+
abstract get timeout(): number;
|
|
492
|
+
/**Debounce delaying one time value retrival*/
|
|
493
|
+
abstract get debounce(): number;
|
|
494
|
+
/**Timeout for validity of last buffered value*/
|
|
495
|
+
abstract get validity(): number | true;
|
|
496
|
+
/**Retention delay before resource performs teardown of connection is performed*/
|
|
497
|
+
abstract get retention(): number;
|
|
498
|
+
protected on_subscribe(): void;
|
|
499
|
+
protected on_unsubscribe(): void;
|
|
500
|
+
/**Called if the state is awaited, returns the value once*/
|
|
501
|
+
protected abstract single_get(state: StateResourceOwnerROA<RT, WT, REL>): void;
|
|
502
|
+
/**Called when state is subscribed to to setup connection to remote resource*/
|
|
503
|
+
protected abstract setup_connection(state: StateResourceOwnerROA<RT, WT, REL>): void;
|
|
504
|
+
/**Called when state is no longer subscribed to to cleanup connection to remote resource*/
|
|
505
|
+
protected abstract teardown_connection(state: StateResourceOwnerROA<RT, WT, REL>): void;
|
|
506
|
+
update_single(value: ResultOk<RT>, update?: boolean): void;
|
|
507
|
+
update_resource(value: ResultOk<RT>): void;
|
|
508
|
+
get buffer(): ResultOk<RT> | undefined;
|
|
509
|
+
get state(): State<RT, WT, REL>;
|
|
510
|
+
get read_only(): StateROA<RT, REL, WT>;
|
|
511
|
+
get rok(): true;
|
|
512
|
+
get rsync(): false;
|
|
513
|
+
then<T = ResultOk<RT>>(func: (value: ResultOk<RT>) => T | PromiseLike<T>): Promise<T>;
|
|
514
|
+
get writable(): boolean;
|
|
515
|
+
get wsync(): boolean;
|
|
516
|
+
}
|
|
517
|
+
interface Owner$a<RT, WT, REL extends Option<StateRelated>> extends StateResourceOwnerROA<RT, WT, REL> {
|
|
518
|
+
}
|
|
519
|
+
type StateResourceFuncROA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateROA<RT, REL, WT> & Owner$a<RT, WT, REL>;
|
|
520
|
+
|
|
521
|
+
type LazySetter<RT, RRT extends Result<RT, string>, REL extends Option<StateRelated>, WT = RT> = (value: WT, state: OwnerWS$5<RT, RRT, WT, REL>, old?: RRT) => Result<void, string>;
|
|
522
|
+
interface Owner$9<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> {
|
|
523
|
+
set(value: RRT): void;
|
|
524
|
+
set_ok(value: RT): void;
|
|
525
|
+
setter?: LazySetter<RT, RRT, REL, WT>;
|
|
526
|
+
readonly state: State<RT, WT, REL>;
|
|
527
|
+
}
|
|
528
|
+
interface OwnerWS$5<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> extends Owner$9<RT, RRT, WT, REL> {
|
|
529
|
+
setter: LazySetter<RT, RRT, REL, WT>;
|
|
530
|
+
}
|
|
531
|
+
type StateLazyROS<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateROS<RT, REL, WT> & Owner$9<RT, ResultOk<RT>, WT, REL> & {
|
|
532
|
+
readonly read_only: StateROS<RT, REL, WT>;
|
|
533
|
+
readonly read_write?: StateROSWS<RT, WT, REL>;
|
|
534
|
+
};
|
|
535
|
+
type StateLazyROSWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateROSWS<RT, WT, REL> & OwnerWS$5<RT, ResultOk<RT>, WT, REL> & {
|
|
536
|
+
readonly read_only: StateROS<RT, REL, WT>;
|
|
537
|
+
readonly read_write: StateROSWS<RT, WT, REL>;
|
|
538
|
+
};
|
|
539
|
+
type StateLazyRES<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateRES<RT, REL, WT> & Owner$9<RT, Result<RT, string>, WT, REL> & {
|
|
540
|
+
set_err(error: string): void;
|
|
541
|
+
readonly read_only: StateRES<RT, REL, WT>;
|
|
542
|
+
readonly read_write?: StateRESWS<RT, WT, REL>;
|
|
543
|
+
};
|
|
544
|
+
type StateLazyRESWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateRESWS<RT, WT, REL> & OwnerWS$5<RT, Result<RT, string>, WT, REL> & {
|
|
545
|
+
set_err(error: string): void;
|
|
546
|
+
readonly read_only: StateRES<RT, REL, WT>;
|
|
547
|
+
readonly read_write: StateRESWS<RT, WT, REL>;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
interface StateNumberRelated extends StateRelated {
|
|
551
|
+
min?: number;
|
|
552
|
+
max?: number;
|
|
553
|
+
unit?: string;
|
|
554
|
+
decimals?: number;
|
|
555
|
+
}
|
|
556
|
+
declare class StateNumberHelper implements StateNumberRelated, StateHelper<number, OptionSome<StateNumberRelated>> {
|
|
557
|
+
min: number | undefined;
|
|
558
|
+
max: number | undefined;
|
|
559
|
+
unit: string | undefined;
|
|
560
|
+
decimals: number | undefined;
|
|
561
|
+
step: number | undefined;
|
|
562
|
+
start: number | undefined;
|
|
563
|
+
constructor(min?: number, max?: number, unit?: string, decimals?: number, step?: number, start?: number);
|
|
564
|
+
limit(value: number): Result<number, string>;
|
|
565
|
+
check(value: number): Result<number, string>;
|
|
566
|
+
related(): OptionSome<StateNumberRelated>;
|
|
567
|
+
}
|
|
568
|
+
interface StateStringRelated extends StateRelated {
|
|
569
|
+
max_length?: number;
|
|
570
|
+
max_length_bytes?: number;
|
|
571
|
+
}
|
|
572
|
+
declare class StateStringHelper implements StateStringRelated, StateHelper<string, OptionSome<StateStringRelated>> {
|
|
573
|
+
max_length: number | undefined;
|
|
574
|
+
max_length_bytes: number | undefined;
|
|
575
|
+
constructor(max_length?: number, max_length_bytes?: number);
|
|
576
|
+
limit(value: string): Result<string, string>;
|
|
577
|
+
check(value: string): Result<string, string>;
|
|
578
|
+
related(): OptionSome<StateStringRelated>;
|
|
579
|
+
}
|
|
580
|
+
type EnumHelperEntry = {
|
|
581
|
+
name: string;
|
|
582
|
+
description?: string;
|
|
583
|
+
icon?: SVGFunc;
|
|
584
|
+
};
|
|
585
|
+
type StateEnumHelperList<K extends PropertyKey> = {
|
|
586
|
+
[P in K]: EnumHelperEntry;
|
|
587
|
+
};
|
|
588
|
+
interface StateEnumRelated<L extends StateEnumHelperList<any>> extends StateRelated {
|
|
589
|
+
list: L;
|
|
590
|
+
map<K extends keyof L, R>(func: (key: K, val: EnumHelperEntry) => R): R[];
|
|
591
|
+
}
|
|
592
|
+
declare class StateEnumHelper<L extends StateEnumHelperList<any>, K extends PropertyKey = keyof L, R extends StateRelated = StateEnumRelated<L>> implements StateHelper<K, OptionSome<R>>, StateEnumRelated<L> {
|
|
593
|
+
list: L;
|
|
594
|
+
constructor(list: L);
|
|
595
|
+
map<K extends keyof L, R>(func: (key: K, val: EnumHelperEntry) => R): R[];
|
|
596
|
+
limit(value: K): Result<K, string>;
|
|
597
|
+
check(value: K): Result<K, string>;
|
|
598
|
+
related(): OptionSome<R>;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
type DelayedSetterWS<RT, RRT extends Result<RT, string>, REL extends Option<StateRelated>, WT = RT> = (value: WT, state: OwnerWS$4<RT, RRT, WT, REL>, old?: RRT) => Result<void, string>;
|
|
602
|
+
type DelayedSetterWA<RT, RRT extends Result<RT, string>, REL extends Option<StateRelated>, WT = RT> = (value: WT, state: OwnerWA$4<RT, RRT, WT, REL>, old?: RRT) => Promise<Result<void, string>>;
|
|
603
|
+
interface Owner$8<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> {
|
|
604
|
+
set(value: RRT): void;
|
|
605
|
+
set_ok(value: RT): void;
|
|
606
|
+
setter_sync?: DelayedSetterWS<RT, RRT, REL, WT>;
|
|
607
|
+
setter_async?: DelayedSetterWA<RT, RRT, REL, WT>;
|
|
608
|
+
readonly state: State<RT, WT, REL>;
|
|
609
|
+
}
|
|
610
|
+
interface OwnerWS$4<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> extends Owner$8<RT, RRT, WT, REL> {
|
|
611
|
+
setter_sync: DelayedSetterWS<RT, RRT, REL, WT>;
|
|
612
|
+
}
|
|
613
|
+
interface OwnerWA$4<RT, RRT extends Result<RT, string>, WT, REL extends Option<StateRelated>> extends Owner$8<RT, RRT, WT, REL> {
|
|
614
|
+
setter_async: DelayedSetterWA<RT, RRT, REL, WT>;
|
|
615
|
+
}
|
|
616
|
+
type StateDelayedROA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateROA<RT, REL, WT> & Owner$8<RT, ResultOk<RT>, WT, REL> & {
|
|
617
|
+
readonly read_only: StateROA<RT, REL, WT>;
|
|
618
|
+
readonly read_write_sync?: StateROAWS<RT, WT, REL>;
|
|
619
|
+
readonly read_write_async?: StateROAWA<RT, WT, REL>;
|
|
620
|
+
};
|
|
621
|
+
type StateDelayedROAWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateROAWS<RT, WT, REL> & OwnerWS$4<RT, ResultOk<RT>, WT, REL> & {
|
|
622
|
+
readonly read_only: StateROA<RT, REL, WT>;
|
|
623
|
+
readonly read_write_sync: StateROAWS<RT, WT, REL>;
|
|
624
|
+
readonly read_write_async?: StateROAWA<RT, WT, REL>;
|
|
625
|
+
};
|
|
626
|
+
type StateDelayedROAWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateROAWA<RT, WT, REL> & OwnerWA$4<RT, ResultOk<RT>, WT, REL> & {
|
|
627
|
+
readonly read_only: StateROA<RT, REL, WT>;
|
|
628
|
+
readonly read_write_sync?: StateROAWS<RT, WT, REL>;
|
|
629
|
+
readonly read_write_async: StateROAWA<RT, WT, REL>;
|
|
630
|
+
};
|
|
631
|
+
type StateDelayedREA<RT, REL extends Option<StateRelated> = Option<{}>, WT = any> = StateREA<RT, REL, WT> & Owner$8<RT, Result<RT, string>, WT, REL> & {
|
|
632
|
+
set_err(error: string): void;
|
|
633
|
+
readonly read_only: StateREA<RT, REL, WT>;
|
|
634
|
+
readonly read_write_sync?: StateREAWS<RT, WT, REL>;
|
|
635
|
+
readonly read_write_async?: StateREAWA<RT, WT, REL>;
|
|
636
|
+
};
|
|
637
|
+
type StateDelayedREAWS<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateREAWS<RT, WT, REL> & OwnerWS$4<RT, Result<RT, string>, WT, REL> & {
|
|
638
|
+
set_err(error: string): void;
|
|
639
|
+
readonly read_only: StateREA<RT, REL, WT>;
|
|
640
|
+
readonly read_write_sync: StateREAWS<RT, WT, REL>;
|
|
641
|
+
readonly read_write_async?: StateREAWA<RT, WT, REL>;
|
|
642
|
+
};
|
|
643
|
+
type StateDelayedREAWA<RT, WT = RT, REL extends Option<StateRelated> = Option<{}>> = StateREAWA<RT, WT, REL> & OwnerWA$4<RT, Result<RT, string>, WT, REL> & {
|
|
644
|
+
set_err(error: string): void;
|
|
645
|
+
readonly read_only: StateREA<RT, REL, WT>;
|
|
646
|
+
readonly read_write_sync?: StateREAWS<RT, WT, REL>;
|
|
647
|
+
readonly read_write_async: StateREAWA<RT, WT, REL>;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
type StateCollectedTransVal<IN extends State<any>[]> = {
|
|
651
|
+
[I in keyof IN]: StateInferResult<IN[I]>;
|
|
652
|
+
};
|
|
653
|
+
type StateCollectedStates<IN extends State<any>[]> = {
|
|
654
|
+
[I in keyof IN]: IN[I] extends StateROA<infer RT> ? StateROA<RT> : IN[I] extends StateREA<infer RT> ? StateREA<RT> : never;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
interface Owner$7<RT, IN extends [StateRES<any>, ...StateRES<any>[]], WT> {
|
|
658
|
+
/**The `setStates` method is used to update the states used by the `StateDerived` class.
|
|
659
|
+
* @param states - The new states. This function should accept an array of states and return the derived state.*/
|
|
660
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
661
|
+
/**The `setGetter` method is used to update the getter function used by the `StateDerived` class.
|
|
662
|
+
* This function is used to compute the derived state based on the current states.
|
|
663
|
+
* @param getter - The new getter function. This function should accept an array of states and return the derived state.*/
|
|
664
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => ResultOk<RT>): void;
|
|
665
|
+
get state(): State<RT, WT, any>;
|
|
666
|
+
get read_only(): StateROS<RT, any, WT>;
|
|
667
|
+
}
|
|
668
|
+
type StateCollectedROS<RT, IN extends [StateRES<any>, ...StateRES<any>[]], WT = any> = StateROS<RT, OptionNone, WT> & Owner$7<RT, IN, WT>;
|
|
669
|
+
declare class ROS<RT, IN extends [StateRES<any>, ...StateRES<any>[]], WT> extends StateBase<RT, WT, OptionNone, ResultOk<RT>> implements Owner$7<RT, IN, WT> {
|
|
670
|
+
#private;
|
|
671
|
+
constructor(transform: ((values: StateCollectedTransVal<IN>) => ResultOk<RT>) | false, ...states: IN);
|
|
672
|
+
protected getter(values: StateCollectedTransVal<IN>): ResultOk<RT>;
|
|
673
|
+
/**Called when subscriber is added*/
|
|
674
|
+
protected on_subscribe(): void;
|
|
675
|
+
/**Called when subscriber is removed*/
|
|
676
|
+
protected on_unsubscribe(): void;
|
|
677
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
678
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => ResultOk<RT>): void;
|
|
679
|
+
get state(): State<RT, WT, any>;
|
|
680
|
+
get read_only(): StateROS<RT, any, WT>;
|
|
681
|
+
get rok(): true;
|
|
682
|
+
get rsync(): true;
|
|
683
|
+
then<T = ResultOk<RT>>(func: (value: ResultOk<RT>) => T | PromiseLike<T>): Promise<T>;
|
|
684
|
+
get(): ResultOk<RT>;
|
|
685
|
+
ok(): RT;
|
|
686
|
+
related(): OptionNone;
|
|
687
|
+
get writable(): boolean;
|
|
688
|
+
get wsync(): boolean;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
interface Owner$6<RT, IN extends [State<any>, ...State<any>[]], WT> {
|
|
692
|
+
/**The `setStates` method is used to update the states used by the `StateDerived` class.
|
|
693
|
+
* @param states - The new states. This function should accept an array of states and return the derived state.*/
|
|
694
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
695
|
+
/**The `setGetter` method is used to update the getter function used by the `StateDerived` class.
|
|
696
|
+
* This function is used to compute the derived state based on the current states.
|
|
697
|
+
* @param getter - The new getter function. This function should accept an array of states and return the derived state.*/
|
|
698
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => ResultOk<RT>): void;
|
|
699
|
+
get state(): State<RT, WT, any>;
|
|
700
|
+
get read_only(): StateROA<RT, any, WT>;
|
|
701
|
+
}
|
|
702
|
+
type StateCollectedROA<RT, IN extends [State<any>, ...State<any>[]], WT = any> = StateROA<RT, OptionNone, WT> & Owner$6<RT, IN, WT>;
|
|
703
|
+
declare class ROA<RT, IN extends [State<any>, ...State<any>[]], WT> extends StateBase<RT, WT, OptionNone, ResultOk<RT>> implements Owner$6<RT, IN, WT> {
|
|
704
|
+
#private;
|
|
705
|
+
/**Creates a state which is derived from other states. The derived state will update when any of the other states update.
|
|
706
|
+
* @param transform - Function to translate value of state or states to something else, false means first states values is used.
|
|
707
|
+
* @param states - The other states to be used in the derived state.*/
|
|
708
|
+
constructor(transform: ((values: StateCollectedTransVal<IN>) => ResultOk<RT>) | false, ...states: IN);
|
|
709
|
+
protected getter(values: StateCollectedTransVal<IN>): ResultOk<RT>;
|
|
710
|
+
/**Called when subscriber is added*/
|
|
711
|
+
protected on_subscribe(): void;
|
|
712
|
+
/**Called when subscriber is removed*/
|
|
713
|
+
protected on_unsubscribe(): void;
|
|
714
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
715
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => ResultOk<RT>): void;
|
|
716
|
+
get state(): State<RT, WT, any>;
|
|
717
|
+
get read_only(): StateROA<RT, any, WT>;
|
|
718
|
+
get rok(): true;
|
|
719
|
+
get rsync(): false;
|
|
720
|
+
then<T = ResultOk<RT>>(func: (value: ResultOk<RT>) => T | PromiseLike<T>): Promise<T>;
|
|
721
|
+
related(): OptionNone;
|
|
722
|
+
get writable(): boolean;
|
|
723
|
+
get wsync(): boolean;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
interface Owner$5<RT, IN extends StateRES<any>[], WT> {
|
|
727
|
+
/**The `setStates` method is used to update the states used by the `StateDerived` class.
|
|
728
|
+
* @param states - The new states. This function should accept an array of states and return the derived state.*/
|
|
729
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
730
|
+
/**The `setGetter` method is used to update the getter function used by the `StateDerived` class.
|
|
731
|
+
* This function is used to compute the derived state based on the current states.
|
|
732
|
+
* @param getter - The new getter function. This function should accept an array of states and return the derived state.*/
|
|
733
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => Result<RT, string>): void;
|
|
734
|
+
get state(): State<RT, WT, any>;
|
|
735
|
+
get read_only(): StateRES<RT, any, WT>;
|
|
736
|
+
}
|
|
737
|
+
type StateCollectedRES<RT, IN extends StateRES<any>[], WT = any> = StateRES<RT, OptionNone, WT> & Owner$5<RT, IN, WT>;
|
|
738
|
+
declare class RES<RT, IN extends StateRES<any>[], WT> extends StateBase<RT, WT, OptionNone, Result<RT, string>> implements Owner$5<RT, IN, WT> {
|
|
739
|
+
#private;
|
|
740
|
+
/**Creates a state which is derived from other states. The derived state will update when any of the other states update.
|
|
741
|
+
* @param transform - Function to translate value of state or states to something else, false means first states values is used.
|
|
742
|
+
* @param states - The other states to be used in the derived state.*/
|
|
743
|
+
constructor(transform: ((values: StateCollectedTransVal<IN>) => Result<RT, string>) | false, ...states: IN);
|
|
744
|
+
protected getter(values: StateCollectedTransVal<IN>): Result<RT, string>;
|
|
745
|
+
/**Called when subscriber is added*/
|
|
746
|
+
protected on_subscribe(): void;
|
|
747
|
+
/**Called when subscriber is removed*/
|
|
748
|
+
protected on_unsubscribe(): void;
|
|
749
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
750
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => Result<RT, string>): void;
|
|
751
|
+
get state(): State<RT, WT, any>;
|
|
752
|
+
get read_only(): StateRES<RT, any, WT>;
|
|
753
|
+
get rok(): false;
|
|
754
|
+
get rsync(): true;
|
|
755
|
+
then<T = Result<RT, string>>(func: (value: Result<RT, string>) => T | PromiseLike<T>): Promise<T>;
|
|
756
|
+
get(): Result<RT, string>;
|
|
757
|
+
related(): OptionNone;
|
|
758
|
+
get writable(): boolean;
|
|
759
|
+
get wsync(): boolean;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
interface Owner$4<RT, IN extends State<any>[], WT> {
|
|
763
|
+
/**The `setStates` method is used to update the states used by the `StateDerived` class.
|
|
764
|
+
* @param states - The new states. This function should accept an array of states and return the derived state.*/
|
|
765
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
766
|
+
/**The `setGetter` method is used to update the getter function used by the `StateDerived` class.
|
|
767
|
+
* This function is used to compute the derived state based on the current states.
|
|
768
|
+
* @param getter - The new getter function. This function should accept an array of states and return the derived state.*/
|
|
769
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => Result<RT, string>): void;
|
|
770
|
+
get state(): State<RT, WT, any>;
|
|
771
|
+
get read_only(): StateREA<RT, any, WT>;
|
|
772
|
+
}
|
|
773
|
+
type StateCollectedREA<RT, IN extends State<any>[], WT = any> = StateREA<RT, OptionNone, WT> & Owner$4<RT, IN, WT>;
|
|
774
|
+
declare class REA<RT, IN extends State<any>[], WT> extends StateBase<RT, WT, OptionNone, Result<RT, string>> implements Owner$4<RT, IN, WT> {
|
|
775
|
+
#private;
|
|
776
|
+
constructor(transform: ((values: StateCollectedTransVal<IN>) => Result<RT, string>) | false, ...states: IN);
|
|
777
|
+
protected getter(values: StateCollectedTransVal<IN>): Result<RT, string>;
|
|
778
|
+
/**Called when subscriber is added*/
|
|
779
|
+
protected on_subscribe(): void;
|
|
780
|
+
/**Called when subscriber is removed*/
|
|
781
|
+
protected on_unsubscribe(): void;
|
|
782
|
+
set_states(...states: StateCollectedStates<IN>): void;
|
|
783
|
+
set_getter(getter: (values: StateCollectedTransVal<IN>) => Result<RT, string>): void;
|
|
784
|
+
get state(): State<RT, WT, any>;
|
|
785
|
+
get read_only(): StateREA<RT, any, WT>;
|
|
786
|
+
get rok(): false;
|
|
787
|
+
get rsync(): false;
|
|
788
|
+
then<T = Result<RT, string>>(func: (value: Result<RT, string>) => T | PromiseLike<T>): Promise<T>;
|
|
789
|
+
related(): OptionNone;
|
|
790
|
+
get writable(): boolean;
|
|
791
|
+
get wsync(): boolean;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
interface Owner$3<S, RIN, ROUT, WIN, WOUT> {
|
|
795
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
796
|
+
set_state(state: S): void;
|
|
797
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
798
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
799
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
800
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
801
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
802
|
+
get read_only(): StateREA<ROUT, OptionNone, WOUT>;
|
|
803
|
+
}
|
|
804
|
+
type StateProxyREA<S extends State<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer WT> ? WT : any, WOUT = WIN> = StateREA<ROUT, OptionNone, WOUT> & Owner$3<S, RIN, ROUT, WIN, WOUT>;
|
|
805
|
+
interface OwnerWS$3<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
806
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
807
|
+
set_state(state: S): void;
|
|
808
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
809
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
810
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
811
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
812
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
813
|
+
get read_only(): StateREA<ROUT, OptionNone, WOUT>;
|
|
814
|
+
get read_write(): StateREAWS<ROUT, WOUT, OptionNone>;
|
|
815
|
+
}
|
|
816
|
+
type StateProxyREAWS<S extends StateREAWS<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateREAWS<ROUT, WOUT, OptionNone> & OwnerWS$3<S, RIN, WIN, ROUT, WOUT>;
|
|
817
|
+
interface OwnerWA$3<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
818
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
819
|
+
set_state(state: S): void;
|
|
820
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
821
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
822
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
823
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
824
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
825
|
+
get read_only(): StateREA<ROUT, OptionNone, WOUT>;
|
|
826
|
+
get read_write(): StateREAWA<ROUT, WOUT, OptionNone>;
|
|
827
|
+
}
|
|
828
|
+
type StateProxyREAWA<S extends StateREAWA<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateREAWA<ROUT, WOUT, OptionNone> & OwnerWA$3<S, RIN, WIN, ROUT, WOUT>;
|
|
829
|
+
|
|
830
|
+
interface Owner$2<S, RIN, ROUT, WIN, WOUT> {
|
|
831
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
832
|
+
set_state(state: S): void;
|
|
833
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
834
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
835
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
836
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
837
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
838
|
+
get read_only(): StateRES<ROUT, OptionNone, WOUT>;
|
|
839
|
+
}
|
|
840
|
+
type StateProxyRES<S extends StateRES<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer WT> ? WT : any, WOUT = WIN> = StateRES<ROUT, OptionNone, WOUT> & Owner$2<S, RIN, ROUT, WIN, WOUT>;
|
|
841
|
+
interface OwnerWS$2<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
842
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
843
|
+
set_state(state: S): void;
|
|
844
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
845
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
846
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
847
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
848
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
849
|
+
get read_only(): StateRES<ROUT, OptionNone, WOUT>;
|
|
850
|
+
get read_write(): StateRESWS<ROUT, WOUT, OptionNone>;
|
|
851
|
+
}
|
|
852
|
+
type StateProxyRESWS<S extends StateRESWS<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateRESWS<ROUT, WOUT, OptionNone> & OwnerWS$2<S, RIN, WIN, ROUT, WOUT>;
|
|
853
|
+
interface OwnerWA$2<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
854
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
855
|
+
set_state(state: S): void;
|
|
856
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
857
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
858
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
859
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
860
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
861
|
+
get read_only(): StateRES<ROUT, OptionNone, WOUT>;
|
|
862
|
+
get read_write(): StateRESWA<ROUT, WOUT, OptionNone>;
|
|
863
|
+
}
|
|
864
|
+
type StateProxyRESWA<S extends StateRESWA<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateRESWA<ROUT, WOUT, OptionNone> & OwnerWA$2<S, RIN, WIN, ROUT, WOUT>;
|
|
865
|
+
|
|
866
|
+
interface Owner$1<S extends State<any, any>, RIN, ROUT, WIN, WOUT> {
|
|
867
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
868
|
+
set_state(state: S): void;
|
|
869
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
870
|
+
set_transform_read(transform: ROATransform<S, RIN, ROUT>): void;
|
|
871
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
872
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
873
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
874
|
+
get read_only(): StateROA<ROUT, OptionNone, WOUT>;
|
|
875
|
+
}
|
|
876
|
+
type ROATransform<S extends State<any, any>, IN, OUT> = (value: S extends StateROA<any> ? ResultOk<IN> : IN extends StateREA<any> ? Result<IN, string> : never) => ResultOk<OUT>;
|
|
877
|
+
type StateProxyROA<S extends State<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer WT> ? WT : any, WOUT = WIN> = StateROA<ROUT, OptionNone, WOUT> & Owner$1<S, RIN, ROUT, WIN, WOUT>;
|
|
878
|
+
interface OwnerWS$1<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
879
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
880
|
+
set_state(state: S): void;
|
|
881
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
882
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
883
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
884
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
885
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
886
|
+
get read_only(): StateROA<ROUT, OptionNone, WOUT>;
|
|
887
|
+
get read_write(): StateROAWS<ROUT, WOUT, OptionNone>;
|
|
888
|
+
}
|
|
889
|
+
type StateProxyROAWS<S extends StateREAWS<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateROAWS<ROUT, WOUT, OptionNone> & OwnerWS$1<S, RIN, WIN, ROUT, WOUT>;
|
|
890
|
+
interface OwnerWA$1<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
891
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
892
|
+
set_state(state: S): void;
|
|
893
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
894
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
895
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
896
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
897
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
898
|
+
get read_only(): StateROA<ROUT, OptionNone, WOUT>;
|
|
899
|
+
get read_write(): StateROAWA<ROUT, WOUT, OptionNone>;
|
|
900
|
+
}
|
|
901
|
+
type StateProxyROAWA<S extends StateREAWA<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateROAWA<ROUT, WOUT, OptionNone> & OwnerWA$1<S, RIN, WIN, ROUT, WOUT>;
|
|
902
|
+
|
|
903
|
+
interface Owner<S extends State<any, any>, RIN, ROUT, WIN, WOUT> {
|
|
904
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
905
|
+
set_state(state: S): void;
|
|
906
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
907
|
+
set_transform_read(transform: ROSTransform<S, RIN, ROUT>): void;
|
|
908
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
909
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
910
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
911
|
+
get read_only(): StateROS<ROUT, OptionNone, WOUT>;
|
|
912
|
+
}
|
|
913
|
+
type ROSTransform<S extends State<any, any>, RIN, ROUT> = (value: S extends StateROS<any> ? ResultOk<RIN> : RIN extends StateRES<any> ? Result<RIN, string> : never) => ResultOk<ROUT>;
|
|
914
|
+
type StateProxyROS<S extends StateRES<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer WT> ? WT : any, WOUT = WIN> = StateROS<ROUT, OptionNone, WOUT> & Owner<S, RIN, ROUT, WIN, WOUT>;
|
|
915
|
+
interface OwnerWS<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
916
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
917
|
+
set_state(state: S): void;
|
|
918
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
919
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
920
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
921
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
922
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
923
|
+
get read_only(): StateROS<ROUT, OptionNone, WOUT>;
|
|
924
|
+
get read_write(): StateROSWS<ROUT, WOUT, OptionNone>;
|
|
925
|
+
}
|
|
926
|
+
type StateProxyROSWS<S extends StateRESWS<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateROSWS<ROUT, WOUT, OptionNone> & OwnerWS<S, RIN, WIN, ROUT, WOUT>;
|
|
927
|
+
interface OwnerWA<S, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> {
|
|
928
|
+
/**Sets the state that is being proxied, and updates subscribers with new value*/
|
|
929
|
+
set_state(state: S): void;
|
|
930
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
931
|
+
set_transform_read(transform: (val: Result<RIN, string>) => Result<ROUT, string>): void;
|
|
932
|
+
/**Changes the transform function of the proxy, and updates subscribers with new value*/
|
|
933
|
+
set_transform_write(transform: (val: WOUT) => WIN): void;
|
|
934
|
+
get state(): State<ROUT, WOUT, OptionNone>;
|
|
935
|
+
get read_only(): StateROS<ROUT, OptionNone, WOUT>;
|
|
936
|
+
get read_write(): StateROSWA<ROUT, WOUT, OptionNone>;
|
|
937
|
+
}
|
|
938
|
+
type StateProxyROSWA<S extends StateRESWA<RIN, WIN>, RIN = S extends State<infer RT> ? RT : never, WIN = S extends State<any, infer WT> ? WT : never, ROUT = RIN, WOUT = WIN> = StateROSWA<ROUT, WOUT, OptionNone> & OwnerWA<S, RIN, WIN, ROUT, WOUT>;
|
|
939
|
+
|
|
940
|
+
declare const state: {
|
|
941
|
+
/**The state key is a symbol used to identify state objects
|
|
942
|
+
* To implement a custom state, set this key to true on the object */
|
|
943
|
+
STATE_KEY: symbol;
|
|
944
|
+
a: {
|
|
945
|
+
STATE_ARRAY_KEY: symbol;
|
|
946
|
+
apply_read: typeof apply_read;
|
|
947
|
+
ros: {
|
|
948
|
+
ok<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: AT[], helper?: StateHelper<{
|
|
949
|
+
type: "pop";
|
|
950
|
+
} | {
|
|
951
|
+
type: "shift";
|
|
952
|
+
} | {
|
|
953
|
+
type: "write";
|
|
954
|
+
items: readonly AT[];
|
|
955
|
+
} | {
|
|
956
|
+
type: "change";
|
|
957
|
+
index: number;
|
|
958
|
+
item: AT;
|
|
959
|
+
} | {
|
|
960
|
+
type: "push";
|
|
961
|
+
items: readonly AT[];
|
|
962
|
+
} | {
|
|
963
|
+
type: "unshift";
|
|
964
|
+
items: readonly AT[];
|
|
965
|
+
} | {
|
|
966
|
+
type: "delete";
|
|
967
|
+
item: AT;
|
|
968
|
+
} | {
|
|
969
|
+
type: "splice";
|
|
970
|
+
index: number;
|
|
971
|
+
delete_count: number;
|
|
972
|
+
items?: readonly AT[] | undefined;
|
|
973
|
+
}, REL>): StateArraySyncROS<AT, REL>;
|
|
974
|
+
};
|
|
975
|
+
ros_ws: {
|
|
976
|
+
ok<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: AT[] | undefined, setter: StateSetREXWS<StateArrayRead<AT>, OwnerWS$7<AT, _chocbite_ts_lib_result.ResultOk<StateArrayRead<AT>>, REL>, {
|
|
977
|
+
type: "pop";
|
|
978
|
+
} | {
|
|
979
|
+
type: "shift";
|
|
980
|
+
} | {
|
|
981
|
+
type: "write";
|
|
982
|
+
items: readonly AT[];
|
|
983
|
+
} | {
|
|
984
|
+
type: "change";
|
|
985
|
+
index: number;
|
|
986
|
+
item: AT;
|
|
987
|
+
} | {
|
|
988
|
+
type: "push";
|
|
989
|
+
items: readonly AT[];
|
|
990
|
+
} | {
|
|
991
|
+
type: "unshift";
|
|
992
|
+
items: readonly AT[];
|
|
993
|
+
} | {
|
|
994
|
+
type: "delete";
|
|
995
|
+
item: AT;
|
|
996
|
+
} | {
|
|
997
|
+
type: "splice";
|
|
998
|
+
index: number;
|
|
999
|
+
delete_count: number;
|
|
1000
|
+
items?: readonly AT[] | undefined;
|
|
1001
|
+
}> | true, helper?: StateHelper<{
|
|
1002
|
+
type: "pop";
|
|
1003
|
+
} | {
|
|
1004
|
+
type: "shift";
|
|
1005
|
+
} | {
|
|
1006
|
+
type: "write";
|
|
1007
|
+
items: readonly AT[];
|
|
1008
|
+
} | {
|
|
1009
|
+
type: "change";
|
|
1010
|
+
index: number;
|
|
1011
|
+
item: AT;
|
|
1012
|
+
} | {
|
|
1013
|
+
type: "push";
|
|
1014
|
+
items: readonly AT[];
|
|
1015
|
+
} | {
|
|
1016
|
+
type: "unshift";
|
|
1017
|
+
items: readonly AT[];
|
|
1018
|
+
} | {
|
|
1019
|
+
type: "delete";
|
|
1020
|
+
item: AT;
|
|
1021
|
+
} | {
|
|
1022
|
+
type: "splice";
|
|
1023
|
+
index: number;
|
|
1024
|
+
delete_count: number;
|
|
1025
|
+
items?: readonly AT[] | undefined;
|
|
1026
|
+
}, REL>): StateArraySyncROSWS<AT, REL>;
|
|
1027
|
+
};
|
|
1028
|
+
res: {
|
|
1029
|
+
ok<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: AT[], helper?: StateHelper<{
|
|
1030
|
+
type: "pop";
|
|
1031
|
+
} | {
|
|
1032
|
+
type: "shift";
|
|
1033
|
+
} | {
|
|
1034
|
+
type: "write";
|
|
1035
|
+
items: readonly AT[];
|
|
1036
|
+
} | {
|
|
1037
|
+
type: "change";
|
|
1038
|
+
index: number;
|
|
1039
|
+
item: AT;
|
|
1040
|
+
} | {
|
|
1041
|
+
type: "push";
|
|
1042
|
+
items: readonly AT[];
|
|
1043
|
+
} | {
|
|
1044
|
+
type: "unshift";
|
|
1045
|
+
items: readonly AT[];
|
|
1046
|
+
} | {
|
|
1047
|
+
type: "delete";
|
|
1048
|
+
item: AT;
|
|
1049
|
+
} | {
|
|
1050
|
+
type: "splice";
|
|
1051
|
+
index: number;
|
|
1052
|
+
delete_count: number;
|
|
1053
|
+
items?: readonly AT[] | undefined;
|
|
1054
|
+
}, REL>): StateArraySyncRES<AT, REL>;
|
|
1055
|
+
err<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(error: string, helper?: StateHelper<{
|
|
1056
|
+
type: "pop";
|
|
1057
|
+
} | {
|
|
1058
|
+
type: "shift";
|
|
1059
|
+
} | {
|
|
1060
|
+
type: "write";
|
|
1061
|
+
items: readonly AT[];
|
|
1062
|
+
} | {
|
|
1063
|
+
type: "change";
|
|
1064
|
+
index: number;
|
|
1065
|
+
item: AT;
|
|
1066
|
+
} | {
|
|
1067
|
+
type: "push";
|
|
1068
|
+
items: readonly AT[];
|
|
1069
|
+
} | {
|
|
1070
|
+
type: "unshift";
|
|
1071
|
+
items: readonly AT[];
|
|
1072
|
+
} | {
|
|
1073
|
+
type: "delete";
|
|
1074
|
+
item: AT;
|
|
1075
|
+
} | {
|
|
1076
|
+
type: "splice";
|
|
1077
|
+
index: number;
|
|
1078
|
+
delete_count: number;
|
|
1079
|
+
items?: readonly AT[] | undefined;
|
|
1080
|
+
}, REL>): StateArraySyncRES<AT, REL>;
|
|
1081
|
+
};
|
|
1082
|
+
res_ws: {
|
|
1083
|
+
ok<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: AT[] | undefined, setter: StateSetREXWS<StateArrayRead<AT>, OwnerWS$7<AT, _chocbite_ts_lib_result.Result<StateArrayRead<AT>, string>, REL>, {
|
|
1084
|
+
type: "pop";
|
|
1085
|
+
} | {
|
|
1086
|
+
type: "shift";
|
|
1087
|
+
} | {
|
|
1088
|
+
type: "write";
|
|
1089
|
+
items: readonly AT[];
|
|
1090
|
+
} | {
|
|
1091
|
+
type: "change";
|
|
1092
|
+
index: number;
|
|
1093
|
+
item: AT;
|
|
1094
|
+
} | {
|
|
1095
|
+
type: "push";
|
|
1096
|
+
items: readonly AT[];
|
|
1097
|
+
} | {
|
|
1098
|
+
type: "unshift";
|
|
1099
|
+
items: readonly AT[];
|
|
1100
|
+
} | {
|
|
1101
|
+
type: "delete";
|
|
1102
|
+
item: AT;
|
|
1103
|
+
} | {
|
|
1104
|
+
type: "splice";
|
|
1105
|
+
index: number;
|
|
1106
|
+
delete_count: number;
|
|
1107
|
+
items?: readonly AT[] | undefined;
|
|
1108
|
+
}> | true, helper?: StateHelper<{
|
|
1109
|
+
type: "pop";
|
|
1110
|
+
} | {
|
|
1111
|
+
type: "shift";
|
|
1112
|
+
} | {
|
|
1113
|
+
type: "write";
|
|
1114
|
+
items: readonly AT[];
|
|
1115
|
+
} | {
|
|
1116
|
+
type: "change";
|
|
1117
|
+
index: number;
|
|
1118
|
+
item: AT;
|
|
1119
|
+
} | {
|
|
1120
|
+
type: "push";
|
|
1121
|
+
items: readonly AT[];
|
|
1122
|
+
} | {
|
|
1123
|
+
type: "unshift";
|
|
1124
|
+
items: readonly AT[];
|
|
1125
|
+
} | {
|
|
1126
|
+
type: "delete";
|
|
1127
|
+
item: AT;
|
|
1128
|
+
} | {
|
|
1129
|
+
type: "splice";
|
|
1130
|
+
index: number;
|
|
1131
|
+
delete_count: number;
|
|
1132
|
+
items?: readonly AT[] | undefined;
|
|
1133
|
+
}, REL>): StateArraySyncRESWS<AT, REL>;
|
|
1134
|
+
err<AT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(error: string, setter: StateSetREXWS<StateArrayRead<AT>, OwnerWS$7<AT, _chocbite_ts_lib_result.Result<StateArrayRead<AT>, string>, REL>, {
|
|
1135
|
+
type: "pop";
|
|
1136
|
+
} | {
|
|
1137
|
+
type: "shift";
|
|
1138
|
+
} | {
|
|
1139
|
+
type: "write";
|
|
1140
|
+
items: readonly AT[];
|
|
1141
|
+
} | {
|
|
1142
|
+
type: "change";
|
|
1143
|
+
index: number;
|
|
1144
|
+
item: AT;
|
|
1145
|
+
} | {
|
|
1146
|
+
type: "push";
|
|
1147
|
+
items: readonly AT[];
|
|
1148
|
+
} | {
|
|
1149
|
+
type: "unshift";
|
|
1150
|
+
items: readonly AT[];
|
|
1151
|
+
} | {
|
|
1152
|
+
type: "delete";
|
|
1153
|
+
item: AT;
|
|
1154
|
+
} | {
|
|
1155
|
+
type: "splice";
|
|
1156
|
+
index: number;
|
|
1157
|
+
delete_count: number;
|
|
1158
|
+
items?: readonly AT[] | undefined;
|
|
1159
|
+
}> | true, helper?: StateHelper<{
|
|
1160
|
+
type: "pop";
|
|
1161
|
+
} | {
|
|
1162
|
+
type: "shift";
|
|
1163
|
+
} | {
|
|
1164
|
+
type: "write";
|
|
1165
|
+
items: readonly AT[];
|
|
1166
|
+
} | {
|
|
1167
|
+
type: "change";
|
|
1168
|
+
index: number;
|
|
1169
|
+
item: AT;
|
|
1170
|
+
} | {
|
|
1171
|
+
type: "push";
|
|
1172
|
+
items: readonly AT[];
|
|
1173
|
+
} | {
|
|
1174
|
+
type: "unshift";
|
|
1175
|
+
items: readonly AT[];
|
|
1176
|
+
} | {
|
|
1177
|
+
type: "delete";
|
|
1178
|
+
item: AT;
|
|
1179
|
+
} | {
|
|
1180
|
+
type: "splice";
|
|
1181
|
+
index: number;
|
|
1182
|
+
delete_count: number;
|
|
1183
|
+
items?: readonly AT[] | undefined;
|
|
1184
|
+
}, REL>): StateArraySyncRESWS<AT, REL>;
|
|
1185
|
+
};
|
|
1186
|
+
is(s: unknown): s is StateArray<any, any>;
|
|
1187
|
+
write<T>(items: T[]): StateArrayWrite<T>;
|
|
1188
|
+
index<T>(index: number, value: T): StateArrayWrite<T>;
|
|
1189
|
+
push<T>(...items: T[]): StateArrayWrite<T>;
|
|
1190
|
+
pop<T>(): StateArrayWrite<T>;
|
|
1191
|
+
shift<T>(): StateArrayWrite<T>;
|
|
1192
|
+
unshift<T>(...items: T[]): StateArrayWrite<T>;
|
|
1193
|
+
splice<T>(start: number, delete_count?: number, ...items: T[]): StateArrayWrite<T>;
|
|
1194
|
+
pluck<T>(index: number): StateArrayWrite<T>;
|
|
1195
|
+
insert<T>(index: number, ...items: T[]): StateArrayWrite<T>;
|
|
1196
|
+
};
|
|
1197
|
+
/**Collected states, collects values from multiple states and reduces it to one */
|
|
1198
|
+
c: {
|
|
1199
|
+
rea: {
|
|
1200
|
+
from<RT, IN extends State<any>[], WT = any>(transform: ((values: StateCollectedTransVal<IN>) => _chocbite_ts_lib_result.Result<RT, string>) | false, ...states: IN): StateCollectedREA<RT, IN, WT>;
|
|
1201
|
+
class: typeof REA;
|
|
1202
|
+
};
|
|
1203
|
+
res: {
|
|
1204
|
+
from<RT, IN extends StateRES<any>[], WT = any>(transform: ((values: StateCollectedTransVal<IN>) => _chocbite_ts_lib_result.Result<RT, string>) | false, ...states: IN): StateCollectedRES<RT, IN, WT>;
|
|
1205
|
+
class: typeof RES;
|
|
1206
|
+
};
|
|
1207
|
+
roa: {
|
|
1208
|
+
from<RT, IN extends [State<any>, ...State<any>[]], WT = any>(transform: ((values: StateCollectedTransVal<IN>) => _chocbite_ts_lib_result.ResultOk<RT>) | false, ...states: IN): StateCollectedROA<RT, IN, WT>;
|
|
1209
|
+
class: typeof ROA;
|
|
1210
|
+
};
|
|
1211
|
+
ros: {
|
|
1212
|
+
from<RT, IN extends [StateRES<any>, ...StateRES<any>[]], WT = any>(transform: ((values: StateCollectedTransVal<IN>) => _chocbite_ts_lib_result.ResultOk<RT>) | false, ...states: IN): StateCollectedROS<RT, IN, WT>;
|
|
1213
|
+
class: typeof ROS;
|
|
1214
|
+
};
|
|
1215
|
+
num: {
|
|
1216
|
+
sum: {
|
|
1217
|
+
rea<S extends State<number>[]>(...states: S): StateCollectedREA<number, S>;
|
|
1218
|
+
roa<S extends [StateROA<number>, ...StateROA<number>[]]>(...states: S): StateCollectedROA<number, S>;
|
|
1219
|
+
res<S extends StateRES<number>[]>(...states: S): StateCollectedRES<number, S>;
|
|
1220
|
+
ros<S extends [StateROS<number>, ...StateROS<number>[]]>(...states: S): StateCollectedROS<number, S>;
|
|
1221
|
+
};
|
|
1222
|
+
percentage: {
|
|
1223
|
+
rea<S extends State<number>, T extends State<number>>(st1: S, st2: T): StateCollectedREA<number, [S, T]>;
|
|
1224
|
+
roa<S extends StateROA<number>, T extends StateROA<number>>(st1: S, st2: T): StateCollectedROA<number, [S, T]>;
|
|
1225
|
+
res<S extends StateRES<number>, T extends StateRES<number>>(st1: S, st2: T): StateCollectedRES<number, [S, T]>;
|
|
1226
|
+
ros<S extends StateROS<number>, T extends StateROS<number>>(st1: S, st2: T): StateCollectedROS<number, [S, T]>;
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
};
|
|
1230
|
+
d: {
|
|
1231
|
+
roa: {
|
|
1232
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init?: () => PromiseLike<RT>, helper?: StateHelper<WT, REL>): StateDelayedROA<RT, REL, WT>;
|
|
1233
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init?: () => PromiseLike<_chocbite_ts_lib_result.ResultOk<RT>>, helper?: StateHelper<WT, REL>): StateDelayedROA<RT, REL, WT>;
|
|
1234
|
+
};
|
|
1235
|
+
roa_ws: {
|
|
1236
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<RT>, setter?: ((value: WT, state: OwnerWS$4<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateDelayedROAWS<RT, WT, REL>;
|
|
1237
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<_chocbite_ts_lib_result.ResultOk<RT>>, setter?: ((value: WT, state: OwnerWS$4<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateDelayedROAWS<RT, WT, REL>;
|
|
1238
|
+
};
|
|
1239
|
+
roa_wa: {
|
|
1240
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<RT>, setter?: ((value: WT, state: OwnerWA$4<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => Promise<_chocbite_ts_lib_result.Result<void, string>>) | true, helper?: StateHelper<WT, REL>): StateDelayedROAWA<RT, WT, REL>;
|
|
1241
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<_chocbite_ts_lib_result.ResultOk<RT>>, setter?: ((value: WT, state: OwnerWA$4<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => Promise<_chocbite_ts_lib_result.Result<void, string>>) | true, helper?: StateHelper<WT, REL>): StateDelayedROAWA<RT, WT, REL>;
|
|
1242
|
+
};
|
|
1243
|
+
rea: {
|
|
1244
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init?: () => PromiseLike<RT>, helper?: StateHelper<WT, REL>): StateDelayedREA<RT, REL, WT>;
|
|
1245
|
+
err<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init?: () => PromiseLike<string>, helper?: StateHelper<WT, REL>): StateDelayedREA<RT, REL, WT>;
|
|
1246
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init?: () => PromiseLike<_chocbite_ts_lib_result.Result<RT, string>>, helper?: StateHelper<WT, REL>): StateDelayedREA<RT, REL, WT>;
|
|
1247
|
+
};
|
|
1248
|
+
rea_ws: {
|
|
1249
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<RT>, setter?: ((value: WT, state: OwnerWS$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWS<RT, WT, REL>;
|
|
1250
|
+
err<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<string>, setter?: ((value: WT, state: OwnerWS$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWS<RT, WT, REL>;
|
|
1251
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<_chocbite_ts_lib_result.Result<RT, string>>, setter?: ((value: WT, state: OwnerWS$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWS<RT, WT, REL>;
|
|
1252
|
+
};
|
|
1253
|
+
rea_wa: {
|
|
1254
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<RT>, setter?: ((value: WT, state: OwnerWA$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => Promise<_chocbite_ts_lib_result.Result<void, string>>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWA<RT, WT, REL>;
|
|
1255
|
+
err<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<string>, setter?: ((value: WT, state: OwnerWA$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => Promise<_chocbite_ts_lib_result.Result<void, string>>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWA<RT, WT, REL>;
|
|
1256
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init?: () => PromiseLike<_chocbite_ts_lib_result.Result<RT, string>>, setter?: ((value: WT, state: OwnerWA$4<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => Promise<_chocbite_ts_lib_result.Result<void, string>>) | true, helper?: StateHelper<WT, REL>): StateDelayedREAWA<RT, WT, REL>;
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
h: {
|
|
1260
|
+
is: {
|
|
1261
|
+
rea(s: any): s is StateREA<any>;
|
|
1262
|
+
roa(s: any): s is StateROA<any>;
|
|
1263
|
+
res(s: any): s is StateRES<any>;
|
|
1264
|
+
ros(s: any): s is StateROS<any>;
|
|
1265
|
+
rea_wa(s: any): s is StateREAWA<any>;
|
|
1266
|
+
rea_ws(s: any): s is StateREAWS<any>;
|
|
1267
|
+
roa_wa(s: any): s is StateROAWA<any>;
|
|
1268
|
+
roa_ws(s: any): s is StateROAWS<any>;
|
|
1269
|
+
res_wa(s: any): s is StateRESWA<any>;
|
|
1270
|
+
res_ws(s: any): s is StateRESWS<any>;
|
|
1271
|
+
ros_wa(s: any): s is StateROSWA<any>;
|
|
1272
|
+
ros_ws(s: any): s is StateROSWS<any>;
|
|
1273
|
+
};
|
|
1274
|
+
nums: {
|
|
1275
|
+
helper(min?: number, max?: number, unit?: string, decimals?: number, step?: number, start?: number): StateNumberHelper;
|
|
1276
|
+
};
|
|
1277
|
+
strings: {
|
|
1278
|
+
helper(max_length?: number, max_length_bytes?: number): StateStringHelper;
|
|
1279
|
+
};
|
|
1280
|
+
enums: {
|
|
1281
|
+
helper<L extends {
|
|
1282
|
+
[x: string]: {
|
|
1283
|
+
name: string;
|
|
1284
|
+
description?: string;
|
|
1285
|
+
icon?: _chocbite_ts_lib_svg.SVGFunc;
|
|
1286
|
+
};
|
|
1287
|
+
}, K extends PropertyKey = keyof L, R extends StateRelated = StateEnumRelated<L>>(list: L): StateEnumHelper<L, K, R>;
|
|
1288
|
+
list<K extends PropertyKey>(list: { [P in K]: {
|
|
1289
|
+
name: string;
|
|
1290
|
+
description?: string;
|
|
1291
|
+
icon?: _chocbite_ts_lib_svg.SVGFunc;
|
|
1292
|
+
}; }): typeof list;
|
|
1293
|
+
};
|
|
1294
|
+
await_value: <T>(value: T, state: State<T>, timeout?: number) => Promise<boolean>;
|
|
1295
|
+
compare: (state1: State<any>, state2: State<any>) => Promise<boolean>;
|
|
1296
|
+
compare_sync: (state1: StateRES<any>, state2: StateRES<any>) => boolean;
|
|
1297
|
+
};
|
|
1298
|
+
l: {
|
|
1299
|
+
ros: {
|
|
1300
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: () => RT, helper?: StateHelper<WT, REL>): StateLazyROS<RT, REL, WT>;
|
|
1301
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: () => _chocbite_ts_lib_result.ResultOk<RT>, helper?: StateHelper<WT, REL>): StateLazyROS<RT, REL, WT>;
|
|
1302
|
+
};
|
|
1303
|
+
ros_ws: {
|
|
1304
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: () => RT, setter?: ((value: WT, state: OwnerWS$5<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateLazyROSWS<RT, WT, REL>;
|
|
1305
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: () => _chocbite_ts_lib_result.ResultOk<RT>, setter?: ((value: WT, state: OwnerWS$5<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateLazyROSWS<RT, WT, REL>;
|
|
1306
|
+
};
|
|
1307
|
+
res: {
|
|
1308
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: () => RT, helper?: StateHelper<WT, REL>): StateLazyRES<RT, REL, WT>;
|
|
1309
|
+
err<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: () => string, helper?: StateHelper<WT, REL>): StateLazyRES<RT, REL, WT>;
|
|
1310
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: () => _chocbite_ts_lib_result.Result<RT, string>, helper?: StateHelper<WT, REL>): StateLazyRES<RT, REL, WT>;
|
|
1311
|
+
};
|
|
1312
|
+
res_ws: {
|
|
1313
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: () => RT, setter?: ((value: WT, state: OwnerWS$5<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateLazyRESWS<RT, WT, REL>;
|
|
1314
|
+
err<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: () => string, setter?: ((value: WT, state: OwnerWS$5<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateLazyRESWS<RT, WT, REL>;
|
|
1315
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: () => _chocbite_ts_lib_result.Result<RT, string>, setter?: ((value: WT, state: OwnerWS$5<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateLazyRESWS<RT, WT, REL>;
|
|
1316
|
+
};
|
|
1317
|
+
};
|
|
1318
|
+
p: {
|
|
1319
|
+
ros: {
|
|
1320
|
+
<S extends StateROS<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateROS<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>): StateProxyROS<S, RIN, ROUT, WIN, WOUT>;
|
|
1321
|
+
<S extends StateRES<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateRES<RIN, any, WIN>, transform: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>): StateProxyROS<S, RIN, ROUT, WIN, WOUT>;
|
|
1322
|
+
};
|
|
1323
|
+
ros_ws: {
|
|
1324
|
+
<S extends StateROSWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROSWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROSWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1325
|
+
<S extends StateRESWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateRESWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROSWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1326
|
+
};
|
|
1327
|
+
ros_wa: {
|
|
1328
|
+
<S extends StateROSWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROSWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROSWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1329
|
+
<S extends StateRESWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateRESWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROSWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1330
|
+
};
|
|
1331
|
+
roa: {
|
|
1332
|
+
<S extends StateROA<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateROA<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>): StateProxyROA<S, RIN, ROUT, WIN, WOUT>;
|
|
1333
|
+
<S extends StateREA<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateREA<RIN, any, WIN>, transform: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>): StateProxyROA<S, RIN, ROUT, WIN, WOUT>;
|
|
1334
|
+
};
|
|
1335
|
+
roa_ws: {
|
|
1336
|
+
<S extends StateROAWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROAWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROAWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1337
|
+
<S extends StateREAWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateREAWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROAWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1338
|
+
};
|
|
1339
|
+
roa_wa: {
|
|
1340
|
+
<S extends StateROAWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROAWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROAWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1341
|
+
<S extends StateREAWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateREAWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.ResultOk<ROUT>, transform_write?: (value: WOUT) => WIN): StateProxyROAWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1342
|
+
};
|
|
1343
|
+
res: {
|
|
1344
|
+
<S extends StateROS<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer WT> ? WT : any, WOUT = WIN>(state: StateROS<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>): StateProxyRES<S, RIN, ROUT, WIN, WOUT>;
|
|
1345
|
+
<S extends StateRES<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateRES<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>): StateProxyRES<S, RIN, ROUT, WIN, WOUT>;
|
|
1346
|
+
};
|
|
1347
|
+
res_ws: {
|
|
1348
|
+
<S extends StateROSWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROSWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyRESWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1349
|
+
<S extends StateRESWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateRESWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyRESWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1350
|
+
};
|
|
1351
|
+
res_wa: {
|
|
1352
|
+
<S extends StateROSWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROSWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyRESWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1353
|
+
<S extends StateRESWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateRESWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyRESWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1354
|
+
};
|
|
1355
|
+
rea: {
|
|
1356
|
+
<S extends StateROA<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateROA<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>): StateProxyREA<S, RIN, ROUT, WIN, WOUT>;
|
|
1357
|
+
<S extends StateREA<RIN, any, WIN>, RIN = S extends State<infer RT> ? RT : never, ROUT = RIN, WIN = S extends State<any, infer RT_1> ? RT_1 : any, WOUT = WIN>(state: StateREA<RIN, any, WIN>, transform?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>): StateProxyREA<S, RIN, ROUT, WIN, WOUT>;
|
|
1358
|
+
};
|
|
1359
|
+
rea_ws: {
|
|
1360
|
+
<S extends StateROAWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROAWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyREAWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1361
|
+
<S extends StateREAWS<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateREAWS<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyREAWS<S, RIN, WIN, ROUT, WOUT>;
|
|
1362
|
+
};
|
|
1363
|
+
rea_wa: {
|
|
1364
|
+
<S extends StateROAWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateROAWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.ResultOk<RIN>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyREAWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1365
|
+
<S extends StateREAWA<RIN, WIN>, RIN, WIN, ROUT = RIN, WOUT = WIN>(state: StateREAWA<RIN, WIN>, transform_read?: (value: _chocbite_ts_lib_result.Result<RIN, string>) => _chocbite_ts_lib_result.Result<ROUT, string>, transform_write?: (value: WOUT) => WIN): StateProxyREAWA<S, RIN, WIN, ROUT, WOUT>;
|
|
1366
|
+
};
|
|
1367
|
+
};
|
|
1368
|
+
r: {
|
|
1369
|
+
roa: {
|
|
1370
|
+
from<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(once: (state: Owner$a<RT, WT, REL>) => void, setup: (state: Owner$a<RT, WT, REL>) => void, teardown: (state: Owner$a<RT, WT, REL>) => void, times?: {
|
|
1371
|
+
timeout?: number;
|
|
1372
|
+
debounce?: number;
|
|
1373
|
+
validity?: number | true;
|
|
1374
|
+
retention?: number;
|
|
1375
|
+
}, helper?: StateHelper<WT, REL>): StateResourceFuncROA<RT, REL, WT>;
|
|
1376
|
+
class: typeof StateResourceROA;
|
|
1377
|
+
};
|
|
1378
|
+
rea: {
|
|
1379
|
+
from<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(once: (state: Owner$b<RT, WT, REL>) => void, setup: (state: Owner$b<RT, WT, REL>) => void, teardown: (state: Owner$b<RT, WT, REL>) => void, times?: {
|
|
1380
|
+
timeout?: number;
|
|
1381
|
+
debounce?: number;
|
|
1382
|
+
validity?: number | true;
|
|
1383
|
+
retention?: number;
|
|
1384
|
+
}, helper?: StateHelper<WT, REL>): StateResourceFuncREA<RT, REL, WT>;
|
|
1385
|
+
class: typeof StateResourceREA;
|
|
1386
|
+
};
|
|
1387
|
+
rea_wa: {
|
|
1388
|
+
from<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = RT>(once: (state: OwnerWA$5<RT, WT, REL>) => void, setup: (state: OwnerWA$5<RT, WT, REL>) => void, teardown: () => void, write_action?: (value: WT, state: OwnerWA$5<RT, WT, REL>) => Promise<_chocbite_ts_lib_result.Result<void, string>>, times?: {
|
|
1389
|
+
timeout?: number;
|
|
1390
|
+
debounce?: number;
|
|
1391
|
+
validity?: number | true;
|
|
1392
|
+
retention?: number;
|
|
1393
|
+
write_debounce?: number;
|
|
1394
|
+
}, helper?: StateHelper<WT, REL>): StateResourceFuncREAWA<RT, REL, WT>;
|
|
1395
|
+
class: typeof StateResourceREAWA;
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1398
|
+
s: {
|
|
1399
|
+
ros: {
|
|
1400
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: RT, helper?: StateHelper<WT, REL>): StateSyncROS<RT, REL, WT>;
|
|
1401
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: _chocbite_ts_lib_result.ResultOk<RT>, helper?: StateHelper<WT, REL>): StateSyncROS<RT, REL, WT>;
|
|
1402
|
+
};
|
|
1403
|
+
ros_ws: {
|
|
1404
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: RT, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateSyncROSWS<RT, WT, REL>;
|
|
1405
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: _chocbite_ts_lib_result.ResultOk<RT>, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateSyncROSWS<RT, WT, REL>;
|
|
1406
|
+
};
|
|
1407
|
+
res: {
|
|
1408
|
+
ok<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: RT, helper?: StateHelper<WT, REL>): StateSyncRES<RT, REL, WT>;
|
|
1409
|
+
err<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: string, helper?: StateHelper<WT, REL>): StateSyncRES<RT, REL, WT>;
|
|
1410
|
+
result<RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(init: _chocbite_ts_lib_result.Result<RT, string>, helper?: StateHelper<WT, REL>): StateSyncRES<RT, REL, WT>;
|
|
1411
|
+
};
|
|
1412
|
+
res_ws: {
|
|
1413
|
+
ok<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: RT, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateSyncRESWS<RT, WT, REL>;
|
|
1414
|
+
err<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: string, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateSyncRESWS<RT, WT, REL>;
|
|
1415
|
+
result<RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(init: _chocbite_ts_lib_result.Result<RT, string>, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>): StateSyncRESWS<RT, WT, REL>;
|
|
1416
|
+
};
|
|
1417
|
+
};
|
|
1418
|
+
/**Returns true if the given object promises to be a state */
|
|
1419
|
+
is(s: unknown): s is State<any, any>;
|
|
1420
|
+
/**Utility base class for state, with basic state functionality */
|
|
1421
|
+
class: typeof StateBase;
|
|
1422
|
+
ok: <RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: RT, helper?: StateHelper<WT, REL>) => StateSyncROS<RT, REL, WT>;
|
|
1423
|
+
err: <RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: string, helper?: StateHelper<WT, REL>) => StateSyncRES<RT, REL, WT>;
|
|
1424
|
+
from: <RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>, WT = any>(this: void, init: RT, helper?: StateHelper<WT, REL>) => StateSyncRES<RT, REL, WT>;
|
|
1425
|
+
ok_ws: <RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: RT, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.ResultOk<RT>, WT, REL>, old?: _chocbite_ts_lib_result.ResultOk<RT> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>) => StateSyncROSWS<RT, WT, REL>;
|
|
1426
|
+
err_ws: <RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: string, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>) => StateSyncRESWS<RT, WT, REL>;
|
|
1427
|
+
from_ws: <RT, WT = RT, REL extends _chocbite_ts_lib_result.Option<StateRelated> = _chocbite_ts_lib_result.Option<{}>>(this: void, init: RT, setter?: ((value: WT, state: OwnerWS$6<RT, _chocbite_ts_lib_result.Result<RT, string>, WT, REL>, old?: _chocbite_ts_lib_result.Result<RT, string> | undefined) => _chocbite_ts_lib_result.Result<void, string>) | true, helper?: StateHelper<WT, REL>) => StateSyncRESWS<RT, WT, REL>;
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
export { type State, type StateArray, type StateArrayREA, type StateArrayREAWA, type StateArrayREAWS, type StateArrayRES, type StateArrayRESWA, type StateArrayRESWS, type StateArrayROA, type StateArrayROAWA, type StateArrayROAWS, type StateArrayROS, type StateArrayROSWA, type StateArrayROSWS, type StateArrayRead, StateArrayReadType, type StateArraySyncRES, type StateArraySyncRESWS, type StateArraySyncROS, type StateArraySyncROSWS, type StateArrayWrite, type StateCollectedREA, type StateCollectedRES, type StateCollectedROA, type StateCollectedROS, type StateDelayedREA, type StateDelayedREAWA, type StateDelayedREAWS, type StateDelayedROA, type StateDelayedROAWA, type StateDelayedROAWS, StateEnumHelper, type StateEnumRelated, type StateInferResult, type StateInferSub, type StateInferType, type StateLazyRES, type StateLazyRESWS, type StateLazyROS, type StateLazyROSWS, StateNumberHelper, type StateNumberRelated, type StateProxyREA, type StateProxyREAWA, type StateProxyREAWS, type StateProxyRES, type StateProxyRESWA, type StateProxyRESWS, type StateProxyROA, type StateProxyROAWA, type StateProxyROAWS, type StateProxyROS, type StateProxyROSWA, type StateProxyROSWS, type StateREA, type StateREAWA, type StateREAWS, type StateRES, type StateRESWA, type StateRESWS, type StateROA, type StateROAWA, type StateROAWS, type StateROS, type StateROSWA, type StateROSWS, type StateResourceFuncREA, type StateResourceFuncREAWA, type StateResourceFuncROA, StateResourceREA, StateResourceREAWA, StateResourceROA, StateStringHelper, type StateStringRelated, type StateSub, type StateSyncRES, type StateSyncRESWS, type StateSyncROS, type StateSyncROSWS, state };
|