silentium-components 0.0.80 → 0.0.81
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/CHANGELOG.md +7 -0
- package/dist/silentium-components.cjs +94 -89
- package/dist/silentium-components.cjs.map +1 -1
- package/dist/silentium-components.d.ts +93 -49
- package/dist/silentium-components.js +95 -90
- package/dist/silentium-components.js.map +1 -1
- package/dist/silentium-components.min.js +1 -1
- package/dist/silentium-components.min.mjs +1 -1
- package/dist/silentium-components.min.mjs.map +1 -1
- package/dist/silentium-components.mjs +95 -90
- package/dist/silentium-components.mjs.map +1 -1
- package/package.json +2 -2
- package/src/behaviors/Branch._main.test.ts +1 -1
- package/src/behaviors/Branch.branchesDontAffectResult.test.ts +1 -1
- package/src/behaviors/Branch.dontRespondAfterRespond.test.ts +4 -4
- package/src/behaviors/Branch.ts +8 -7
- package/src/behaviors/BranchLazy._main.test.ts +5 -5
- package/src/behaviors/BranchLazy.ts +16 -10
- package/src/behaviors/Const.test.ts +1 -1
- package/src/behaviors/Const.ts +12 -4
- package/src/behaviors/Deadline._main.test.ts +1 -1
- package/src/behaviors/Deadline._value.test.ts +1 -1
- package/src/behaviors/Deadline.ts +15 -10
- package/src/behaviors/Deferred.test.ts +2 -2
- package/src/behaviors/Deferred.ts +12 -6
- package/src/behaviors/Detached.test.ts +2 -2
- package/src/behaviors/Detached.ts +8 -3
- package/src/behaviors/Dirty.test.ts +1 -1
- package/src/behaviors/Dirty.ts +5 -5
- package/src/behaviors/Loading.test.ts +1 -1
- package/src/behaviors/Loading.ts +9 -9
- package/src/behaviors/Lock.test.ts +1 -1
- package/src/behaviors/Lock.ts +7 -8
- package/src/behaviors/Memo.test.ts +2 -2
- package/src/behaviors/Memo.ts +4 -4
- package/src/behaviors/OnlyChanged.test.ts +2 -2
- package/src/behaviors/OnlyChanged.ts +4 -4
- package/src/behaviors/Part.test.ts +1 -1
- package/src/behaviors/Part.ts +8 -8
- package/src/behaviors/Path._main.test.ts +1 -1
- package/src/behaviors/Path.index.test.ts +1 -1
- package/src/behaviors/Path.nested.test.ts +1 -1
- package/src/behaviors/Path.ts +4 -4
- package/src/behaviors/Polling.test.ts +2 -2
- package/src/behaviors/Polling.ts +9 -8
- package/src/behaviors/Shot._main.test.ts +2 -2
- package/src/behaviors/Shot._onlyChanged.test.ts +1 -1
- package/src/behaviors/Shot.ts +10 -8
- package/src/behaviors/Task.test.ts +2 -2
- package/src/behaviors/Task.ts +9 -7
- package/src/behaviors/Tick.test.ts +1 -1
- package/src/behaviors/Tick.ts +4 -4
- package/src/behaviors/Transaction.ts +16 -16
- package/src/boolean/And.test.ts +1 -1
- package/src/boolean/And.ts +5 -7
- package/src/boolean/Bool.test.ts +1 -1
- package/src/boolean/Bool.ts +4 -4
- package/src/boolean/Not.test.ts +1 -1
- package/src/boolean/Not.ts +5 -4
- package/src/boolean/Or.test.ts +1 -1
- package/src/boolean/Or.ts +5 -7
- package/src/formats/FromJson.ts +5 -5
- package/src/formats/ToJson.ts +4 -7
- package/src/lists/First.test.ts +1 -1
- package/src/lists/First.ts +4 -6
- package/src/navigation/Router._destroy.test.ts +15 -15
- package/src/navigation/Router._firstMatch.test.ts +7 -7
- package/src/navigation/Router._main.test.ts +7 -7
- package/src/navigation/Router._nested.test.ts +23 -17
- package/src/navigation/Router.ts +13 -13
- package/src/strings/Concatenated.test.ts +1 -1
- package/src/strings/Concatenated.ts +6 -6
- package/src/strings/Template._main.test.ts +5 -5
- package/src/strings/Template._place.test.ts +1 -1
- package/src/strings/Template.ts +18 -13
- package/src/structures/HashTable.test.ts +1 -1
- package/src/structures/HashTable.ts +6 -6
- package/src/structures/Record._main.test.ts +3 -3
- package/src/structures/Record._mixed.test.ts +28 -0
- package/src/structures/Record.concatenated.test.ts +4 -4
- package/src/structures/Record.nested.test.ts +4 -4
- package/src/structures/Record.ts +27 -0
- package/src/structures/index.ts +1 -1
- package/src/system/RegexpMatch._group.test.ts +1 -1
- package/src/system/RegexpMatch._main.test.ts +1 -1
- package/src/system/RegexpMatch.ts +7 -7
- package/src/system/RegexpMatched.test.ts +1 -1
- package/src/system/RegexpMatched.ts +7 -7
- package/src/system/RegexpReplaced.test.ts +1 -1
- package/src/system/RegexpReplaced.ts +8 -8
- package/src/system/Set.test.ts +1 -1
- package/src/system/Set.ts +7 -7
- package/src/structures/RecordOf.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.81](https://github.com/silentium-lab/silentium-components/compare/v0.0.80...v0.0.81) (2025-11-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **main:** changed event to message ([dcec649](https://github.com/silentium-lab/silentium-components/commit/dcec649aa5558d385b2714f0f2e7bc589ef751e5))
|
|
11
|
+
|
|
5
12
|
### [0.0.80](https://github.com/silentium-lab/silentium-components/compare/v0.0.79...v0.0.80) (2025-11-10)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var silentium = require('silentium');
|
|
4
4
|
|
|
5
5
|
function Branch($condition, $left, $right) {
|
|
6
|
-
return silentium.
|
|
6
|
+
return silentium.Message((transport) => {
|
|
7
7
|
const left = silentium.Primitive($left);
|
|
8
8
|
let right;
|
|
9
9
|
if ($right !== void 0) {
|
|
10
10
|
right = silentium.Primitive($right);
|
|
11
11
|
}
|
|
12
|
-
$condition.
|
|
12
|
+
$condition.to(
|
|
13
13
|
silentium.Transport((v) => {
|
|
14
14
|
let result = null;
|
|
15
15
|
if (v) {
|
|
@@ -26,12 +26,12 @@ function Branch($condition, $left, $right) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function BranchLazy($condition, $left, $right) {
|
|
29
|
-
return silentium.
|
|
29
|
+
return silentium.Message((transport) => {
|
|
30
30
|
const dc = silentium.DestroyContainer();
|
|
31
31
|
const destructor = () => {
|
|
32
32
|
dc.destroy();
|
|
33
33
|
};
|
|
34
|
-
$condition.
|
|
34
|
+
$condition.to(
|
|
35
35
|
silentium.Transport((v) => {
|
|
36
36
|
destructor();
|
|
37
37
|
let instance;
|
|
@@ -41,7 +41,7 @@ function BranchLazy($condition, $left, $right) {
|
|
|
41
41
|
instance = $right.use();
|
|
42
42
|
}
|
|
43
43
|
if (instance !== void 0) {
|
|
44
|
-
instance.
|
|
44
|
+
instance.to(transport);
|
|
45
45
|
dc.add(instance);
|
|
46
46
|
}
|
|
47
47
|
})
|
|
@@ -51,8 +51,8 @@ function BranchLazy($condition, $left, $right) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function Constant(permanent, $trigger) {
|
|
54
|
-
return silentium.
|
|
55
|
-
$trigger.
|
|
54
|
+
return silentium.Message((transport) => {
|
|
55
|
+
$trigger.to(
|
|
56
56
|
silentium.Transport(() => {
|
|
57
57
|
transport.use(permanent);
|
|
58
58
|
})
|
|
@@ -61,10 +61,10 @@ function Constant(permanent, $trigger) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function Deadline(error, $base, $timeout) {
|
|
64
|
-
return silentium.
|
|
64
|
+
return silentium.Message((transport) => {
|
|
65
65
|
let timer = 0;
|
|
66
66
|
const base = silentium.Shared($base, true);
|
|
67
|
-
$timeout.
|
|
67
|
+
$timeout.to(
|
|
68
68
|
silentium.Transport((timeout) => {
|
|
69
69
|
if (timer) {
|
|
70
70
|
clearTimeout(timer);
|
|
@@ -78,8 +78,8 @@ function Deadline(error, $base, $timeout) {
|
|
|
78
78
|
error.use(new Error("Timeout reached in Deadline"));
|
|
79
79
|
}, timeout);
|
|
80
80
|
const f = silentium.Filtered(base, () => !timeoutReached);
|
|
81
|
-
f.
|
|
82
|
-
base.
|
|
81
|
+
f.to(transport);
|
|
82
|
+
base.to(
|
|
83
83
|
silentium.Transport(() => {
|
|
84
84
|
timeoutReached = true;
|
|
85
85
|
})
|
|
@@ -90,9 +90,9 @@ function Deadline(error, $base, $timeout) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
function Deferred($base, $trigger) {
|
|
93
|
-
return silentium.
|
|
93
|
+
return silentium.Message((transport) => {
|
|
94
94
|
const base = silentium.Primitive($base);
|
|
95
|
-
$trigger.
|
|
95
|
+
$trigger.to(
|
|
96
96
|
silentium.Transport(() => {
|
|
97
97
|
const value = base.primitive();
|
|
98
98
|
if (silentium.isFilled(value)) {
|
|
@@ -104,7 +104,7 @@ function Deferred($base, $trigger) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
function Detached($base) {
|
|
107
|
-
return silentium.
|
|
107
|
+
return silentium.Message((transport) => {
|
|
108
108
|
const v = silentium.Primitive($base).primitive();
|
|
109
109
|
if (silentium.isFilled(v)) {
|
|
110
110
|
transport.use(v);
|
|
@@ -131,9 +131,9 @@ class DirtySource {
|
|
|
131
131
|
this.cloner = cloner;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
to(transport) {
|
|
135
135
|
const $comparing = silentium.Applied(this.$comparing, this.cloner);
|
|
136
|
-
silentium.All($comparing, this.$base).
|
|
136
|
+
silentium.All($comparing, this.$base).to(
|
|
137
137
|
silentium.Transport(([comparing, base]) => {
|
|
138
138
|
if (!comparing) {
|
|
139
139
|
return;
|
|
@@ -162,29 +162,29 @@ class DirtySource {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
function Loading($loadingStart, $loadingFinish) {
|
|
165
|
-
return silentium.
|
|
166
|
-
$loadingStart.
|
|
167
|
-
$loadingFinish.
|
|
165
|
+
return silentium.Message((transport) => {
|
|
166
|
+
$loadingStart.to(silentium.Transport(() => transport.use(true)));
|
|
167
|
+
$loadingFinish.to(silentium.Transport(() => transport.use(false)));
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function Lock($base, $lock) {
|
|
172
|
-
return silentium.
|
|
172
|
+
return silentium.Message((transport) => {
|
|
173
173
|
let locked = false;
|
|
174
|
-
$lock.
|
|
174
|
+
$lock.to(
|
|
175
175
|
silentium.Transport((newLock) => {
|
|
176
176
|
locked = newLock;
|
|
177
177
|
})
|
|
178
178
|
);
|
|
179
179
|
const i = silentium.Filtered($base, () => !locked);
|
|
180
|
-
i.
|
|
180
|
+
i.to(transport);
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
function Memo($base) {
|
|
185
|
-
return silentium.
|
|
185
|
+
return silentium.Message((transport) => {
|
|
186
186
|
let last = null;
|
|
187
|
-
$base.
|
|
187
|
+
$base.to(
|
|
188
188
|
silentium.Transport((v) => {
|
|
189
189
|
if (v !== last && silentium.isFilled(v)) {
|
|
190
190
|
transport.use(v);
|
|
@@ -196,9 +196,9 @@ function Memo($base) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
function OnlyChanged($base) {
|
|
199
|
-
return silentium.
|
|
199
|
+
return silentium.Message((transport) => {
|
|
200
200
|
let first = false;
|
|
201
|
-
$base.
|
|
201
|
+
$base.to(
|
|
202
202
|
silentium.Transport((v) => {
|
|
203
203
|
if (first === false) {
|
|
204
204
|
first = true;
|
|
@@ -214,17 +214,17 @@ var __defProp$1 = Object.defineProperty;
|
|
|
214
214
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
215
215
|
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
216
216
|
function Part($base, $key) {
|
|
217
|
-
return new
|
|
217
|
+
return new PartImpl($base, $key);
|
|
218
218
|
}
|
|
219
|
-
class
|
|
219
|
+
class PartImpl {
|
|
220
220
|
constructor($base, $key) {
|
|
221
221
|
__publicField$1(this, "$base");
|
|
222
222
|
__publicField$1(this, "$keyed");
|
|
223
223
|
this.$base = silentium.SharedSource($base);
|
|
224
224
|
this.$keyed = silentium.Shared($key);
|
|
225
225
|
}
|
|
226
|
-
|
|
227
|
-
silentium.All(this.$base, this.$keyed).
|
|
226
|
+
to(transport) {
|
|
227
|
+
silentium.All(this.$base, this.$keyed).to(
|
|
228
228
|
silentium.Transport(([base, keyed]) => {
|
|
229
229
|
const keys = keyed.split(".");
|
|
230
230
|
let value = base;
|
|
@@ -252,8 +252,8 @@ class PartEvent {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
function Path($base, $keyed) {
|
|
255
|
-
return silentium.
|
|
256
|
-
silentium.All($base, $keyed).
|
|
255
|
+
return silentium.Message((transport) => {
|
|
256
|
+
silentium.All($base, $keyed).to(
|
|
257
257
|
silentium.Transport(([base, keyed]) => {
|
|
258
258
|
const keys = keyed.split(".");
|
|
259
259
|
let value = base;
|
|
@@ -269,20 +269,20 @@ function Path($base, $keyed) {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
function Polling($base, $trigger) {
|
|
272
|
-
return silentium.
|
|
273
|
-
$trigger.
|
|
272
|
+
return silentium.Message((transport) => {
|
|
273
|
+
$trigger.to(
|
|
274
274
|
silentium.Transport(() => {
|
|
275
|
-
$base.
|
|
275
|
+
$base.to(transport);
|
|
276
276
|
})
|
|
277
277
|
);
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
function Shot($target, $trigger) {
|
|
282
|
-
return silentium.
|
|
282
|
+
return silentium.Message((transport) => {
|
|
283
283
|
const targetSync = silentium.Primitive($target);
|
|
284
284
|
targetSync.primitive();
|
|
285
|
-
$trigger.
|
|
285
|
+
$trigger.to(
|
|
286
286
|
silentium.Transport(() => {
|
|
287
287
|
const value = targetSync.primitive();
|
|
288
288
|
if (silentium.isFilled(value)) {
|
|
@@ -294,7 +294,7 @@ function Shot($target, $trigger) {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
function Task(baseSrc, delay = 0) {
|
|
297
|
-
return silentium.
|
|
297
|
+
return silentium.Message((transport) => {
|
|
298
298
|
let prevTimer = null;
|
|
299
299
|
silentium.ExecutorApplied(baseSrc, (fn) => {
|
|
300
300
|
return (v) => {
|
|
@@ -305,12 +305,12 @@ function Task(baseSrc, delay = 0) {
|
|
|
305
305
|
fn(v);
|
|
306
306
|
}, delay);
|
|
307
307
|
};
|
|
308
|
-
}).
|
|
308
|
+
}).to(transport);
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
function Tick($base) {
|
|
313
|
-
return silentium.
|
|
313
|
+
return silentium.Message((transport) => {
|
|
314
314
|
let microtaskScheduled = false;
|
|
315
315
|
let lastValue = null;
|
|
316
316
|
const scheduleMicrotask = () => {
|
|
@@ -323,7 +323,7 @@ function Tick($base) {
|
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
325
|
};
|
|
326
|
-
$base.
|
|
326
|
+
$base.to(
|
|
327
327
|
silentium.Transport((v) => {
|
|
328
328
|
lastValue = v;
|
|
329
329
|
if (!microtaskScheduled) {
|
|
@@ -334,18 +334,18 @@ function Tick($base) {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
function Transaction($base,
|
|
338
|
-
return silentium.
|
|
337
|
+
function Transaction($base, builder, ...args) {
|
|
338
|
+
return silentium.Message((transport) => {
|
|
339
339
|
const $res = silentium.LateShared();
|
|
340
340
|
const destructors = [];
|
|
341
|
-
$base.
|
|
341
|
+
$base.to(
|
|
342
342
|
silentium.Transport((v) => {
|
|
343
|
-
const $
|
|
344
|
-
destructors.push($
|
|
345
|
-
$
|
|
343
|
+
const $msg = builder(silentium.Of(v), ...args.map((a) => Detached(a)));
|
|
344
|
+
destructors.push($msg);
|
|
345
|
+
$msg.to($res);
|
|
346
346
|
})
|
|
347
347
|
);
|
|
348
|
-
$res.
|
|
348
|
+
$res.to(transport);
|
|
349
349
|
return () => {
|
|
350
350
|
destructors.forEach((d) => d?.destroy());
|
|
351
351
|
destructors.length = 0;
|
|
@@ -354,9 +354,9 @@ function Transaction($base, eventBuilder, ...args) {
|
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
function HashTable($base) {
|
|
357
|
-
return silentium.
|
|
357
|
+
return silentium.Message((transport) => {
|
|
358
358
|
const record = {};
|
|
359
|
-
$base.
|
|
359
|
+
$base.to(
|
|
360
360
|
silentium.Transport(([key, value]) => {
|
|
361
361
|
record[key] = value;
|
|
362
362
|
transport.use(record);
|
|
@@ -365,10 +365,15 @@ function HashTable($base) {
|
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
function
|
|
369
|
-
return silentium.
|
|
368
|
+
function Record(record) {
|
|
369
|
+
return silentium.Message((transport) => {
|
|
370
370
|
const keys = Object.keys(record);
|
|
371
|
-
|
|
371
|
+
keys.forEach((key) => {
|
|
372
|
+
if (!silentium.isMessage(record[key])) {
|
|
373
|
+
record[key] = silentium.Of(record[key]);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
silentium.All(...Object.values(record)).to(
|
|
372
377
|
silentium.Transport((entries) => {
|
|
373
378
|
const record2 = {};
|
|
374
379
|
entries.forEach((entry, index) => {
|
|
@@ -381,8 +386,8 @@ function RecordOf(record) {
|
|
|
381
386
|
}
|
|
382
387
|
|
|
383
388
|
function Concatenated(sources, joinPartSrc = silentium.Of("")) {
|
|
384
|
-
return silentium.
|
|
385
|
-
silentium.All(joinPartSrc, ...sources).
|
|
389
|
+
return silentium.Message((transport) => {
|
|
390
|
+
silentium.All(joinPartSrc, ...sources).to(
|
|
386
391
|
silentium.Transport(([joinPart, ...strings]) => {
|
|
387
392
|
transport.use(strings.join(joinPart));
|
|
388
393
|
})
|
|
@@ -394,9 +399,9 @@ var __defProp = Object.defineProperty;
|
|
|
394
399
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
395
400
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
396
401
|
function Template($src = silentium.Of(""), $places = silentium.Of({})) {
|
|
397
|
-
return new
|
|
402
|
+
return new TemplateImpl($src, $places);
|
|
398
403
|
}
|
|
399
|
-
class
|
|
404
|
+
class TemplateImpl {
|
|
400
405
|
constructor($src = silentium.Of(""), $places = silentium.Of({})) {
|
|
401
406
|
this.$src = $src;
|
|
402
407
|
this.$places = $places;
|
|
@@ -405,8 +410,8 @@ class TemplateEvent {
|
|
|
405
410
|
$TPL: silentium.Of("$TPL")
|
|
406
411
|
});
|
|
407
412
|
}
|
|
408
|
-
|
|
409
|
-
const $vars =
|
|
413
|
+
to(transport) {
|
|
414
|
+
const $vars = Record(this.vars);
|
|
410
415
|
silentium.Applied(silentium.All(this.$src, this.$places, $vars), ([base, rules, vars]) => {
|
|
411
416
|
Object.entries(rules).forEach(([ph, val]) => {
|
|
412
417
|
base = base.replaceAll(ph, String(val));
|
|
@@ -415,7 +420,7 @@ class TemplateEvent {
|
|
|
415
420
|
base = base.replaceAll(ph, String(val));
|
|
416
421
|
});
|
|
417
422
|
return base;
|
|
418
|
-
}).
|
|
423
|
+
}).to(transport);
|
|
419
424
|
return this;
|
|
420
425
|
}
|
|
421
426
|
template(value) {
|
|
@@ -441,8 +446,8 @@ class TemplateEvent {
|
|
|
441
446
|
}
|
|
442
447
|
|
|
443
448
|
function RegexpMatched(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
|
|
444
|
-
return silentium.
|
|
445
|
-
silentium.All(patternSrc, valueSrc, flagsSrc).
|
|
449
|
+
return silentium.Message((transport) => {
|
|
450
|
+
silentium.All(patternSrc, valueSrc, flagsSrc).to(
|
|
446
451
|
silentium.Transport(([pattern, value, flags]) => {
|
|
447
452
|
transport.use(new RegExp(pattern, flags).test(value));
|
|
448
453
|
})
|
|
@@ -451,8 +456,8 @@ function RegexpMatched(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
|
|
|
451
456
|
}
|
|
452
457
|
|
|
453
458
|
function RegexpReplaced(valueSrc, patternSrc, replaceValueSrc, flagsSrc = silentium.Of("")) {
|
|
454
|
-
return silentium.
|
|
455
|
-
silentium.All(patternSrc, valueSrc, replaceValueSrc, flagsSrc).
|
|
459
|
+
return silentium.Message((transport) => {
|
|
460
|
+
silentium.All(patternSrc, valueSrc, replaceValueSrc, flagsSrc).to(
|
|
456
461
|
silentium.Transport(([pattern, value, replaceValue, flags]) => {
|
|
457
462
|
transport.use(
|
|
458
463
|
String(value).replace(new RegExp(pattern, flags), replaceValue)
|
|
@@ -463,8 +468,8 @@ function RegexpReplaced(valueSrc, patternSrc, replaceValueSrc, flagsSrc = silent
|
|
|
463
468
|
}
|
|
464
469
|
|
|
465
470
|
function RegexpMatch(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
|
|
466
|
-
return silentium.
|
|
467
|
-
silentium.All(patternSrc, valueSrc, flagsSrc).
|
|
471
|
+
return silentium.Message((transport) => {
|
|
472
|
+
silentium.All(patternSrc, valueSrc, flagsSrc).to(
|
|
468
473
|
silentium.Transport(([pattern, value, flags]) => {
|
|
469
474
|
const result = new RegExp(pattern, flags).exec(value);
|
|
470
475
|
transport.use(result ?? []);
|
|
@@ -474,8 +479,8 @@ function RegexpMatch(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
|
|
|
474
479
|
}
|
|
475
480
|
|
|
476
481
|
function Set(baseSrc, keySrc, valueSrc) {
|
|
477
|
-
return silentium.
|
|
478
|
-
silentium.All(baseSrc, keySrc, valueSrc).
|
|
482
|
+
return silentium.Message((transport) => {
|
|
483
|
+
silentium.All(baseSrc, keySrc, valueSrc).to(
|
|
479
484
|
silentium.Transport(([base, key, value]) => {
|
|
480
485
|
base[key] = value;
|
|
481
486
|
transport.use(base);
|
|
@@ -485,12 +490,12 @@ function Set(baseSrc, keySrc, valueSrc) {
|
|
|
485
490
|
}
|
|
486
491
|
|
|
487
492
|
function Router($url, $routes, $default) {
|
|
488
|
-
return silentium.
|
|
493
|
+
return silentium.Message((transport) => {
|
|
489
494
|
const dc = silentium.DestroyContainer();
|
|
490
495
|
const destructor = () => {
|
|
491
496
|
dc.destroy();
|
|
492
497
|
};
|
|
493
|
-
silentium.All($routes, $url).
|
|
498
|
+
silentium.All($routes, $url).to(
|
|
494
499
|
silentium.Transport(([routes, url]) => {
|
|
495
500
|
destructor();
|
|
496
501
|
const $matches = silentium.All(
|
|
@@ -502,18 +507,18 @@ function Router($url, $routes, $default) {
|
|
|
502
507
|
)
|
|
503
508
|
)
|
|
504
509
|
);
|
|
505
|
-
$matches.
|
|
510
|
+
$matches.to(
|
|
506
511
|
silentium.Transport((matches) => {
|
|
507
512
|
const index = matches.findIndex((v) => v === true);
|
|
508
513
|
if (index === -1) {
|
|
509
514
|
const instance = $default.use();
|
|
510
515
|
dc.add(instance);
|
|
511
|
-
instance.
|
|
516
|
+
instance.to(transport);
|
|
512
517
|
}
|
|
513
518
|
if (index > -1) {
|
|
514
|
-
const instance = routes[index].
|
|
519
|
+
const instance = routes[index].message.use();
|
|
515
520
|
dc.add(instance);
|
|
516
|
-
instance.
|
|
521
|
+
instance.to(transport);
|
|
517
522
|
}
|
|
518
523
|
})
|
|
519
524
|
);
|
|
@@ -524,8 +529,8 @@ function Router($url, $routes, $default) {
|
|
|
524
529
|
}
|
|
525
530
|
|
|
526
531
|
function And($one, $two) {
|
|
527
|
-
return silentium.
|
|
528
|
-
silentium.All($one, $two).
|
|
532
|
+
return silentium.Message((transport) => {
|
|
533
|
+
silentium.All($one, $two).to(
|
|
529
534
|
silentium.Transport(([one, two]) => {
|
|
530
535
|
transport.use(one && two);
|
|
531
536
|
})
|
|
@@ -534,8 +539,8 @@ function And($one, $two) {
|
|
|
534
539
|
}
|
|
535
540
|
|
|
536
541
|
function Or($one, $two) {
|
|
537
|
-
return silentium.
|
|
538
|
-
silentium.All($one, $two).
|
|
542
|
+
return silentium.Message((transport) => {
|
|
543
|
+
silentium.All($one, $two).to(
|
|
539
544
|
silentium.Transport(([one, two]) => {
|
|
540
545
|
transport.use(one || two);
|
|
541
546
|
})
|
|
@@ -544,8 +549,8 @@ function Or($one, $two) {
|
|
|
544
549
|
}
|
|
545
550
|
|
|
546
551
|
function Not($base) {
|
|
547
|
-
return silentium.
|
|
548
|
-
$base.
|
|
552
|
+
return silentium.Message((transport) => {
|
|
553
|
+
$base.to(
|
|
549
554
|
silentium.Transport((v) => {
|
|
550
555
|
transport.use(!v);
|
|
551
556
|
})
|
|
@@ -554,14 +559,14 @@ function Not($base) {
|
|
|
554
559
|
}
|
|
555
560
|
|
|
556
561
|
function Bool($base) {
|
|
557
|
-
return silentium.
|
|
558
|
-
silentium.Applied($base, Boolean).
|
|
562
|
+
return silentium.Message((transport) => {
|
|
563
|
+
silentium.Applied($base, Boolean).to(transport);
|
|
559
564
|
});
|
|
560
565
|
}
|
|
561
566
|
|
|
562
567
|
function FromJson($json, error) {
|
|
563
|
-
return silentium.
|
|
564
|
-
$json.
|
|
568
|
+
return silentium.Message((transport) => {
|
|
569
|
+
$json.to(
|
|
565
570
|
silentium.Transport((json) => {
|
|
566
571
|
try {
|
|
567
572
|
transport.use(JSON.parse(json));
|
|
@@ -574,8 +579,8 @@ function FromJson($json, error) {
|
|
|
574
579
|
}
|
|
575
580
|
|
|
576
581
|
function ToJson($data, error) {
|
|
577
|
-
return silentium.
|
|
578
|
-
$data.
|
|
582
|
+
return silentium.Message((transport) => {
|
|
583
|
+
$data.to(
|
|
579
584
|
silentium.Transport((data) => {
|
|
580
585
|
try {
|
|
581
586
|
transport.use(JSON.stringify(data));
|
|
@@ -588,8 +593,8 @@ function ToJson($data, error) {
|
|
|
588
593
|
}
|
|
589
594
|
|
|
590
595
|
function First($base) {
|
|
591
|
-
return silentium.
|
|
592
|
-
silentium.Applied($base, (a) => a[0]).
|
|
596
|
+
return silentium.Message((transport) => {
|
|
597
|
+
silentium.Applied($base, (a) => a[0]).to(transport);
|
|
593
598
|
});
|
|
594
599
|
}
|
|
595
600
|
|
|
@@ -615,7 +620,7 @@ exports.Or = Or;
|
|
|
615
620
|
exports.Part = Part;
|
|
616
621
|
exports.Path = Path;
|
|
617
622
|
exports.Polling = Polling;
|
|
618
|
-
exports.
|
|
623
|
+
exports.Record = Record;
|
|
619
624
|
exports.RegexpMatch = RegexpMatch;
|
|
620
625
|
exports.RegexpMatched = RegexpMatched;
|
|
621
626
|
exports.RegexpReplaced = RegexpReplaced;
|