silentium-components 0.0.122 → 0.0.123

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/silentium-components.cjs +74 -54
  3. package/dist/silentium-components.cjs.map +1 -1
  4. package/dist/silentium-components.js +74 -54
  5. package/dist/silentium-components.js.map +1 -1
  6. package/dist/silentium-components.min.js +1 -1
  7. package/dist/silentium-components.min.mjs +1 -1
  8. package/dist/silentium-components.min.mjs.map +1 -1
  9. package/dist/silentium-components.mjs +74 -54
  10. package/dist/silentium-components.mjs.map +1 -1
  11. package/eslint.config.mjs +8 -3
  12. package/package.json +2 -1
  13. package/src/behaviors/Branch.ts +1 -1
  14. package/src/behaviors/BranchLazy.ts +1 -1
  15. package/src/behaviors/Const.ts +1 -1
  16. package/src/behaviors/Deadline.ts +2 -2
  17. package/src/behaviors/Deferred.ts +1 -1
  18. package/src/behaviors/Dirty.ts +1 -1
  19. package/src/behaviors/Loading.ts +6 -2
  20. package/src/behaviors/Lock.ts +4 -2
  21. package/src/behaviors/Memo.ts +1 -1
  22. package/src/behaviors/MergeAccumulation.ts +2 -6
  23. package/src/behaviors/OnlyChanged.ts +1 -1
  24. package/src/behaviors/Part.ts +3 -3
  25. package/src/behaviors/Polling.ts +1 -1
  26. package/src/behaviors/StateRecord.ts +6 -4
  27. package/src/behaviors/Switch.ts +6 -6
  28. package/src/behaviors/Tick.ts +2 -4
  29. package/src/behaviors/Transformed.ts +4 -5
  30. package/src/boolean/And.ts +1 -1
  31. package/src/boolean/Not.ts +1 -1
  32. package/src/boolean/Or.ts +1 -1
  33. package/src/formats/FromJson.ts +1 -1
  34. package/src/formats/ToJson.ts +1 -1
  35. package/src/navigation/Router.ts +9 -9
  36. package/src/strings/Concatenated.ts +4 -1
  37. package/src/structures/HashTable.ts +1 -2
  38. package/src/structures/Record.ts +3 -3
  39. package/src/system/RegexpMatch.ts +5 -1
  40. package/src/system/RegexpMatched.ts +5 -1
  41. package/src/system/Set.ts +1 -1
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.123](https://github.com/silentium-lab/silentium-components/compare/v0.0.122...v0.0.123) (2026-04-02)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **main:** istrue function type fix ([2ca9b3c](https://github.com/silentium-lab/silentium-components/commit/2ca9b3c40613d6d76e4db9888210771b7150aa14))
11
+
5
12
  ### [0.0.122](https://github.com/silentium-lab/silentium-components/compare/v0.0.121...v0.0.122) (2026-04-01)
6
13
 
7
14
 
@@ -12,7 +12,7 @@ function Branch(_condition, _left, _right) {
12
12
  if (_right !== void 0) {
13
13
  right = silentium.Primitive($right);
14
14
  }
15
- $condition.then((v) => {
15
+ $condition.then(function branchSub(v) {
16
16
  if (typeof v !== "boolean") {
17
17
  throw new Error("Branch received not boolean value");
18
18
  }
@@ -35,7 +35,7 @@ function BranchLazy($condition, $left, $right) {
35
35
  const destructor = () => {
36
36
  dc.destroy();
37
37
  };
38
- $condition.then((v) => {
38
+ $condition.then(function branchLazySub(v) {
39
39
  destructor();
40
40
  let instance;
41
41
  if (v) {
@@ -54,7 +54,7 @@ function BranchLazy($condition, $left, $right) {
54
54
 
55
55
  function Constant(permanent, $trigger) {
56
56
  return silentium.Message(function ConstantImpl(resolve, reject) {
57
- $trigger.catch(reject).then(() => {
57
+ $trigger.catch(reject).then(function constantSub() {
58
58
  resolve(permanent);
59
59
  resolve(silentium.ResetSilenceCache);
60
60
  });
@@ -66,7 +66,7 @@ function Deadline($base, _timeout) {
66
66
  return silentium.Message(function DeadlineImpl(resolve, reject) {
67
67
  let timer = 0;
68
68
  const base = silentium.Shared($base);
69
- $timeout.then((timeout) => {
69
+ $timeout.then(function deadlineTimeoutSub(timeout) {
70
70
  if (timer) {
71
71
  clearTimeout(timer);
72
72
  }
@@ -80,7 +80,7 @@ function Deadline($base, _timeout) {
80
80
  }, timeout);
81
81
  const f = silentium.Filtered(base, () => !timeoutReached);
82
82
  f.then(resolve);
83
- base.then(() => {
83
+ base.then(function deadlineBaseSub() {
84
84
  timeoutReached = true;
85
85
  });
86
86
  });
@@ -90,7 +90,7 @@ function Deadline($base, _timeout) {
90
90
  function Deferred($base, $trigger) {
91
91
  return silentium.Message(function DeferredImpl(r) {
92
92
  const base = silentium.Primitive($base);
93
- $trigger.then(() => {
93
+ $trigger.then(function deferredTriggerSub() {
94
94
  const value = base.primitive();
95
95
  if (silentium.isFilled(value)) {
96
96
  r(value);
@@ -116,7 +116,7 @@ function Dirty($base, keep = [], exclude = [], cloner) {
116
116
  return silentium.Source(
117
117
  function DirtyImpl(r) {
118
118
  const $comparingClone = silentium.Applied($comparing, cloner);
119
- silentium.All($comparingClone, $base).then(([comparing, base]) => {
119
+ silentium.All($comparingClone, $base).then(function dirtyAllSub([comparing, base]) {
120
120
  if (!comparing) {
121
121
  return;
122
122
  }
@@ -143,26 +143,32 @@ function Dirty($base, keep = [], exclude = [], cloner) {
143
143
 
144
144
  function Loading($start, $finish) {
145
145
  return silentium.Message(function LoadingImpl(r) {
146
- $start.then(() => r(true));
147
- $finish.then(() => r(false));
146
+ $start.then(function loadingStartSub() {
147
+ r(true);
148
+ });
149
+ $finish.then(function loadingFinishSub() {
150
+ r(false);
151
+ });
148
152
  });
149
153
  }
150
154
 
151
155
  function Lock($base, $lock) {
152
156
  return silentium.Message(function LockImpl(r) {
153
157
  let locked = false;
154
- $lock.then((newLock) => {
158
+ $lock.then(function lockLockSub(newLock) {
155
159
  locked = newLock;
156
160
  });
157
161
  const i = silentium.Filtered($base, () => !locked);
158
- i.then(r);
162
+ i.then(function lockBaseSub(v) {
163
+ r(v);
164
+ });
159
165
  });
160
166
  }
161
167
 
162
168
  function Memo($base) {
163
169
  return silentium.Message(function MemoImpl(r) {
164
170
  let last = null;
165
- $base.then((v) => {
171
+ $base.then(function memoBaseSub(v) {
166
172
  if (v !== last && silentium.isFilled(v)) {
167
173
  r(v);
168
174
  last = v;
@@ -174,7 +180,7 @@ function Memo($base) {
174
180
  function MergeAccumulation($base, $reset) {
175
181
  const accumulation = silentium.Late();
176
182
  const lastAccumulated = {};
177
- $base.then((nextValue) => {
183
+ $base.then(function mergeAccumulationBaseSub(nextValue) {
178
184
  accumulation.use(
179
185
  mergeWith(lastAccumulated, nextValue, (value1, value2) => {
180
186
  if (Array.isArray(value1)) {
@@ -184,7 +190,7 @@ function MergeAccumulation($base, $reset) {
184
190
  );
185
191
  });
186
192
  if ($reset) {
187
- $reset.then((resetValue) => {
193
+ $reset.then(function mergeAccumulationResetSub(resetValue) {
188
194
  accumulation.use(resetValue);
189
195
  });
190
196
  }
@@ -215,7 +221,7 @@ function isObject(value) {
215
221
  function OnlyChanged($base) {
216
222
  return silentium.Message(function OnlyChangedImpl(r) {
217
223
  let first = false;
218
- $base.then((v) => {
224
+ $base.then(function onlyChangedBaseSub(v) {
219
225
  if (first === false) {
220
226
  first = true;
221
227
  } else {
@@ -230,10 +236,10 @@ function Part($base, key, defaultValue) {
230
236
  const $keyedShared = silentium.Shared(silentium.Actual(key));
231
237
  return silentium.Source(
232
238
  function PartImpl(r) {
233
- silentium.All($baseShared, $keyedShared).then(([base, keyed]) => {
239
+ silentium.All($baseShared, $keyedShared).then(function partAllSub([base, keyed]) {
234
240
  const keys = keyed.split(".");
235
241
  let value = base;
236
- keys.forEach((key2) => {
242
+ keys.forEach(function partsAllKeysForEach(key2) {
237
243
  value = value[key2];
238
244
  });
239
245
  if (value !== void 0 && value !== base) {
@@ -243,7 +249,7 @@ function Part($base, key, defaultValue) {
243
249
  }
244
250
  });
245
251
  },
246
- (value) => {
252
+ function PartSourceImpl(value) {
247
253
  const key2 = silentium.Primitive($keyedShared);
248
254
  if (silentium.isFilled(key2)) {
249
255
  const base = silentium.Primitive($base);
@@ -278,7 +284,7 @@ function Path(_base, _keyed, def) {
278
284
  function Polling($base, $trigger) {
279
285
  return silentium.Message(function PollingImpl(resolve, reject) {
280
286
  const dc = silentium.DestroyContainer();
281
- $trigger.then(() => {
287
+ $trigger.then(function pollingTriggerSub() {
282
288
  dc.destroy();
283
289
  resolve(silentium.ResetSilenceCache);
284
290
  dc.add($base.then(resolve).catch(reject));
@@ -312,9 +318,9 @@ function StateRecord(state$, values$, sequence) {
312
318
  let latestState = null;
313
319
  let result = {};
314
320
  const sequence$ = silentium.Value(silentium.Actual(sequence));
315
- return silentium.Message((resolve, reject) => {
321
+ return silentium.Message(function StateRecordImpl(resolve, reject) {
316
322
  dc.add(
317
- state$.then((state) => {
323
+ state$.then(function stateRecordStateSub(state) {
318
324
  if (state === sequence$.value?.[stateIndex + 1]) {
319
325
  stateIndex += 1;
320
326
  latestState = state;
@@ -326,7 +332,7 @@ function StateRecord(state$, values$, sequence) {
326
332
  }).catch(reject)
327
333
  );
328
334
  dc.add(
329
- values$.then((value) => {
335
+ values$.then(function stateRecordValuesSub(value) {
330
336
  if (latestState !== null) {
331
337
  result[latestState] = value;
332
338
  }
@@ -338,19 +344,21 @@ function StateRecord(state$, values$, sequence) {
338
344
  }
339
345
  }).catch(reject)
340
346
  );
341
- return () => dc.destroy();
347
+ return function StateRecordDestroy() {
348
+ dc.destroy();
349
+ };
342
350
  });
343
351
  }
344
352
 
345
353
  function Switch(_base, options) {
346
354
  const $base = silentium.Actual(_base);
347
- return silentium.Message((resolve, reject) => {
355
+ return silentium.Message(function SwitchImpl(resolve, reject) {
348
356
  const dc = silentium.DestroyContainer();
349
357
  dc.add(
350
- $base.then((v) => {
351
- const msg = options.find(
352
- (entry) => Array.isArray(entry[0]) ? entry[0].includes(v) : entry[0] === v
353
- );
358
+ $base.then(function switchBaseSub(v) {
359
+ const msg = options.find(function switchBaseFind(entry) {
360
+ return Array.isArray(entry[0]) ? entry[0].includes(v) : entry[0] === v;
361
+ });
354
362
  if (msg) {
355
363
  dc.add(msg[1].then(resolve).catch(reject));
356
364
  }
@@ -383,7 +391,7 @@ function Tick($base) {
383
391
  let lastValue = null;
384
392
  const scheduleMicrotask = () => {
385
393
  microtaskScheduled = true;
386
- queueMicrotask(() => {
394
+ queueMicrotask(function tickQueueMicrotask() {
387
395
  microtaskScheduled = false;
388
396
  if (lastValue !== null) {
389
397
  r(lastValue);
@@ -391,7 +399,7 @@ function Tick($base) {
391
399
  }
392
400
  });
393
401
  };
394
- $base.then((v) => {
402
+ $base.then(function tickBaseSub(v) {
395
403
  lastValue = v;
396
404
  if (!microtaskScheduled) {
397
405
  scheduleMicrotask();
@@ -403,7 +411,7 @@ function Tick($base) {
403
411
  function HashTable($base) {
404
412
  return silentium.Message(function HashTableImpl(r) {
405
413
  const record = {};
406
- $base.then(([key, value]) => {
414
+ $base.then(function hashTableBaseSub([key, value]) {
407
415
  record[key] = value;
408
416
  r({ ...record });
409
417
  });
@@ -413,12 +421,12 @@ function HashTable($base) {
413
421
  function Record(record) {
414
422
  return silentium.Message(function RecordImpl(r) {
415
423
  const keys = Object.keys(record);
416
- keys.forEach((key) => {
424
+ keys.forEach(function recordKeys(key) {
417
425
  record[key] = silentium.Actual(record[key]);
418
426
  });
419
- silentium.All(...Object.values(record)).then((entries) => {
427
+ silentium.All(...Object.values(record)).then(function recordAllSub(entries) {
420
428
  const record2 = {};
421
- entries.forEach((entry, index) => {
429
+ entries.forEach(function recordAllForEach(entry, index) {
422
430
  record2[keys[index]] = entry;
423
431
  });
424
432
  r(record2);
@@ -428,11 +436,11 @@ function Record(record) {
428
436
 
429
437
  function Transformed(_base, transformRules) {
430
438
  const $base = silentium.Actual(_base);
431
- return silentium.Message((resolve) => {
432
- $base.then((v) => {
439
+ return silentium.Message(function TransformedImpl(resolve) {
440
+ $base.then(function transformedBaseSub(v) {
433
441
  const existedKeysMap = {};
434
442
  const sourceObject = Object.fromEntries(
435
- Object.entries(v).map((entry) => {
443
+ Object.entries(v).map(function transformedBaseEntries(entry) {
436
444
  if (transformRules[entry[0]]) {
437
445
  existedKeysMap[entry[0]] = 1;
438
446
  return [entry[0], transformRules[entry[0]](v)];
@@ -440,7 +448,7 @@ function Transformed(_base, transformRules) {
440
448
  return [entry[0], silentium.Of(entry[1])];
441
449
  })
442
450
  );
443
- Object.keys(transformRules).forEach((key) => {
451
+ Object.keys(transformRules).forEach(function transformedRulesKeys(key) {
444
452
  if (!existedKeysMap[key]) {
445
453
  sourceObject[key] = transformRules[key](v);
446
454
  }
@@ -457,7 +465,7 @@ function TransformedList(_base, transformRules) {
457
465
 
458
466
  function And($one, $two) {
459
467
  return silentium.Message(function AndImpl(r) {
460
- silentium.All($one, $two).then(([one, two]) => {
468
+ silentium.All($one, $two).then(function andAllSub([one, two]) {
461
469
  r(!!(one && two));
462
470
  });
463
471
  });
@@ -471,7 +479,7 @@ function Bool($base) {
471
479
 
472
480
  function Not($base) {
473
481
  return silentium.Message(function NotImpl(r) {
474
- $base.then((v) => {
482
+ $base.then(function notBaseSub(v) {
475
483
  r(!v);
476
484
  });
477
485
  });
@@ -479,7 +487,7 @@ function Not($base) {
479
487
 
480
488
  function Or($one, $two) {
481
489
  return silentium.Message(function OrImpl(r) {
482
- silentium.All($one, $two).then(([one, two]) => {
490
+ silentium.All($one, $two).then(function orAllSub([one, two]) {
483
491
  r(!!(one || two));
484
492
  });
485
493
  });
@@ -487,7 +495,7 @@ function Or($one, $two) {
487
495
 
488
496
  function FromJson($json) {
489
497
  return silentium.Message(function FromJsonImpl(resolve, reject) {
490
- $json.then((json) => {
498
+ $json.then(function fromJsonSub(json) {
491
499
  try {
492
500
  resolve(JSON.parse(json));
493
501
  } catch (e) {
@@ -499,7 +507,7 @@ function FromJson($json) {
499
507
 
500
508
  function ToJson($data) {
501
509
  return silentium.Message(function ToJsonImpl(resolve, reject) {
502
- $data.then((data) => {
510
+ $data.then(function toJsonSub(data) {
503
511
  try {
504
512
  resolve(JSON.stringify(data));
505
513
  } catch {
@@ -520,7 +528,11 @@ function RegexpMatch(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
520
528
  const $value = silentium.Actual(valueSrc);
521
529
  const $flags = silentium.Actual(flagsSrc);
522
530
  return silentium.Message(function RegexpMatchImpl(r) {
523
- silentium.All($pattern, $value, $flags).then(([pattern, value, flags]) => {
531
+ silentium.All($pattern, $value, $flags).then(function regexpMatchAllSub([
532
+ pattern,
533
+ value,
534
+ flags
535
+ ]) {
524
536
  const result = new RegExp(pattern, flags).exec(value);
525
537
  r(result ?? []);
526
538
  });
@@ -532,7 +544,11 @@ function RegexpMatched(patternSrc, valueSrc, flagsSrc = silentium.Of("")) {
532
544
  const $value = silentium.Actual(valueSrc);
533
545
  const $flags = silentium.Actual(flagsSrc);
534
546
  return silentium.Message(function RegexpMatchedImpl(r) {
535
- silentium.All($pattern, $value, $flags).then(([pattern, value, flags]) => {
547
+ silentium.All($pattern, $value, $flags).then(function regexpMatchedAllSub([
548
+ pattern,
549
+ value,
550
+ flags
551
+ ]) {
536
552
  r(new RegExp(pattern, flags).test(value));
537
553
  });
538
554
  });
@@ -556,13 +572,14 @@ function Set(baseSrc, keySrc, valueSrc) {
556
572
  const $key = silentium.Actual(keySrc);
557
573
  const $value = silentium.Actual(valueSrc);
558
574
  return silentium.Message(function SetImpl(r) {
559
- silentium.All($base, $key, $value).then(([base, key, value]) => {
575
+ silentium.All($base, $key, $value).then(function setAllSub([base, key, value]) {
560
576
  base[key] = value;
561
577
  r(base);
562
578
  });
563
579
  });
564
580
  }
565
581
 
582
+ const isTrue = (v) => v === true;
566
583
  function Router(_url, routes, $default) {
567
584
  const $routes = silentium.Actual(routes);
568
585
  const $url = silentium.Actual(_url);
@@ -571,19 +588,19 @@ function Router(_url, routes, $default) {
571
588
  const destructor = () => {
572
589
  dc.destroy();
573
590
  };
574
- silentium.All($routes, $url).then(([routes2, url]) => {
591
+ silentium.All($routes, $url).then(function routerAllSub([routes2, url]) {
575
592
  destructor();
576
593
  const $matches = silentium.All(
577
- ...routes2.map(
578
- (r2) => r2.pattern ? RegexpMatched(
594
+ ...routes2.map(function routerRoutesMap(r2) {
595
+ return r2.pattern ? RegexpMatched(
579
596
  silentium.Of(r2.pattern),
580
597
  silentium.Of(url),
581
598
  r2.patternFlags ? silentium.Of(r2.patternFlags) : void 0
582
- ) : r2?.condition?.(url)
583
- )
599
+ ) : r2?.condition?.(url);
600
+ })
584
601
  );
585
- $matches.then((matches) => {
586
- const index = matches.findIndex((v) => v === true);
602
+ $matches.then(function routerMatchesSub(matches) {
603
+ const index = matches.findIndex(isTrue);
587
604
  if (index === -1) {
588
605
  const instance = silentium.Actual($default());
589
606
  dc.add(instance);
@@ -602,7 +619,10 @@ function Router(_url, routes, $default) {
602
619
 
603
620
  function Concatenated(sources, joinPartSrc = silentium.Of("")) {
604
621
  return silentium.Message(function ConcatenatedImpl(r) {
605
- silentium.All(joinPartSrc, ...sources).then(([joinPart, ...strings]) => {
622
+ silentium.All(joinPartSrc, ...sources).then(function concatenatedAllSub([
623
+ joinPart,
624
+ ...strings
625
+ ]) {
606
626
  r(strings.join(joinPart));
607
627
  });
608
628
  });