silentium-components 0.0.82 → 0.0.83
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 +130 -130
- package/dist/silentium-components.cjs.map +1 -1
- package/dist/silentium-components.d.ts +9 -9
- package/dist/silentium-components.js +131 -131
- 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 +131 -131
- package/dist/silentium-components.mjs.map +1 -1
- package/package.json +2 -2
- package/src/behaviors/Branch._main.test.ts +2 -2
- package/src/behaviors/Branch._values.test.ts +2 -2
- package/src/behaviors/Branch.branchesDontAffectResult.test.ts +2 -2
- package/src/behaviors/Branch.dontRespondAfterRespond.test.ts +5 -5
- package/src/behaviors/Branch.ts +5 -5
- package/src/behaviors/BranchLazy._main.test.ts +4 -4
- package/src/behaviors/BranchLazy.ts +8 -8
- package/src/behaviors/Const.test.ts +3 -3
- package/src/behaviors/Const.ts +5 -5
- package/src/behaviors/Deadline._main.test.ts +2 -2
- package/src/behaviors/Deadline._value.test.ts +3 -3
- package/src/behaviors/Deadline.ts +9 -9
- package/src/behaviors/Deferred.test.ts +3 -3
- package/src/behaviors/Deferred.ts +5 -11
- package/src/behaviors/Detached.test.ts +3 -3
- package/src/behaviors/Detached.ts +2 -2
- package/src/behaviors/Dirty.test.ts +2 -2
- package/src/behaviors/Dirty.ts +5 -5
- package/src/behaviors/Loading.test.ts +2 -2
- package/src/behaviors/Loading.ts +6 -6
- package/src/behaviors/Lock.test.ts +2 -2
- package/src/behaviors/Lock.ts +5 -5
- package/src/behaviors/Memo.test.ts +4 -4
- package/src/behaviors/Memo.ts +5 -5
- package/src/behaviors/OnlyChanged.test.ts +3 -3
- package/src/behaviors/OnlyChanged.ts +5 -5
- package/src/behaviors/Part.test.ts +3 -3
- package/src/behaviors/Part.ts +5 -5
- package/src/behaviors/Path._keyRaw.test.ts +2 -2
- package/src/behaviors/Path._main.test.ts +2 -2
- package/src/behaviors/Path.index.test.ts +2 -2
- package/src/behaviors/Path.nested.test.ts +2 -2
- package/src/behaviors/Path.ts +5 -5
- package/src/behaviors/Polling.ts +5 -5
- package/src/behaviors/Shot._main.test.ts +3 -3
- package/src/behaviors/Shot._onlyChanged.test.ts +3 -3
- package/src/behaviors/Shot.ts +5 -11
- package/src/behaviors/Task.test.ts +5 -5
- package/src/behaviors/Task.ts +2 -2
- package/src/behaviors/Tick.test.ts +2 -2
- package/src/behaviors/Tick.ts +5 -5
- package/src/behaviors/Transaction.ts +6 -6
- package/src/boolean/And.test.ts +2 -2
- package/src/boolean/And.ts +5 -5
- package/src/boolean/Bool.test.ts +2 -2
- package/src/boolean/Bool.ts +2 -2
- package/src/boolean/Not.test.ts +2 -2
- package/src/boolean/Not.ts +5 -5
- package/src/boolean/Or.test.ts +2 -2
- package/src/boolean/Or.ts +5 -5
- package/src/formats/FromJson.ts +6 -6
- package/src/formats/ToJson.ts +6 -6
- package/src/lists/First.test.ts +2 -2
- package/src/lists/First.ts +2 -2
- package/src/navigation/Router._destroy.test.ts +7 -7
- 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 +16 -16
- package/src/navigation/Router.ts +11 -11
- package/src/strings/Concatenated.test.ts +2 -2
- package/src/strings/Concatenated.ts +5 -5
- package/src/strings/Template._main.test.ts +3 -3
- package/src/strings/Template._place.test.ts +2 -2
- package/src/strings/Template.ts +3 -3
- package/src/structures/HashTable.test.ts +2 -2
- package/src/structures/HashTable.ts +5 -5
- package/src/structures/Record._main.test.ts +2 -2
- package/src/structures/Record._mixed.test.ts +2 -2
- package/src/structures/Record.concatenated.test.ts +4 -4
- package/src/structures/Record.nested.test.ts +2 -2
- package/src/structures/Record.ts +5 -5
- package/src/system/RegexpMatch._group.test.ts +2 -2
- package/src/system/RegexpMatch._main.test.ts +2 -2
- package/src/system/RegexpMatch.ts +5 -5
- package/src/system/RegexpMatched.test.ts +2 -2
- package/src/system/RegexpMatched.ts +5 -5
- package/src/system/RegexpReplaced.test.ts +2 -2
- package/src/system/RegexpReplaced.ts +5 -5
- package/src/system/Set.test.ts +2 -2
- package/src/system/Set.ts +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Of,
|
|
1
|
+
import { Of, Tap } from "silentium";
|
|
2
2
|
import { expect, test, vi } from "vitest";
|
|
3
3
|
import { Path } from "../behaviors";
|
|
4
4
|
import { RegexpMatch } from "./RegexpMatch";
|
|
@@ -7,7 +7,7 @@ test("RegexpMatch._main.test", () => {
|
|
|
7
7
|
const $url = Of<string>("http://domain.com/some/url/");
|
|
8
8
|
const $matched = Path(RegexpMatch(Of("/(s\\w+)/"), $url), Of("0"));
|
|
9
9
|
const g = vi.fn();
|
|
10
|
-
$matched.
|
|
10
|
+
$matched.pipe(Tap(g));
|
|
11
11
|
|
|
12
12
|
expect(g).toHaveBeenLastCalledWith("/some/");
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { All, Message, MessageType, Of,
|
|
1
|
+
import { All, Message, MessageType, Of, Tap } from "silentium";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* First match Of regexp
|
|
@@ -9,11 +9,11 @@ export function RegexpMatch(
|
|
|
9
9
|
valueSrc: MessageType<string>,
|
|
10
10
|
flagsSrc: MessageType<string> = Of(""),
|
|
11
11
|
) {
|
|
12
|
-
return Message<string[]>((
|
|
13
|
-
All(patternSrc, valueSrc, flagsSrc).
|
|
14
|
-
|
|
12
|
+
return Message<string[]>(function () {
|
|
13
|
+
All(patternSrc, valueSrc, flagsSrc).pipe(
|
|
14
|
+
Tap(([pattern, value, flags]) => {
|
|
15
15
|
const result = new RegExp(pattern, flags).exec(value);
|
|
16
|
-
|
|
16
|
+
this.use(result ?? []);
|
|
17
17
|
}),
|
|
18
18
|
);
|
|
19
19
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Late, Of,
|
|
1
|
+
import { Late, Of, Tap } from "silentium";
|
|
2
2
|
import { RegexpMatched } from "../system/RegexpMatched";
|
|
3
3
|
import { expect, test, vi } from "vitest";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ test("RegexpMatched.test", () => {
|
|
|
6
6
|
const $url = Late<string>("http://domain.com/some/url/");
|
|
7
7
|
const $matched = RegexpMatched(Of("/some/url"), $url);
|
|
8
8
|
const g = vi.fn();
|
|
9
|
-
$matched.
|
|
9
|
+
$matched.pipe(Tap(g));
|
|
10
10
|
|
|
11
11
|
expect(g).toHaveBeenLastCalledWith(true);
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { All, Message, MessageType, Of,
|
|
1
|
+
import { All, Message, MessageType, Of, Tap } from "silentium";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Boolean source what checks what string matches pattern
|
|
@@ -9,10 +9,10 @@ export function RegexpMatched(
|
|
|
9
9
|
valueSrc: MessageType<string>,
|
|
10
10
|
flagsSrc: MessageType<string> = Of(""),
|
|
11
11
|
) {
|
|
12
|
-
return Message<boolean>((
|
|
13
|
-
All(patternSrc, valueSrc, flagsSrc).
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
return Message<boolean>(function () {
|
|
13
|
+
All(patternSrc, valueSrc, flagsSrc).pipe(
|
|
14
|
+
Tap(([pattern, value, flags]) => {
|
|
15
|
+
this.use(new RegExp(pattern, flags).test(value));
|
|
16
16
|
}),
|
|
17
17
|
);
|
|
18
18
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Late, Of,
|
|
1
|
+
import { Late, Of, Tap } from "silentium";
|
|
2
2
|
import { RegexpReplaced } from "../system/RegexpReplaced";
|
|
3
3
|
import { expect, test, vi } from "vitest";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ test("RegexpReplaced.test", () => {
|
|
|
6
6
|
const $url = Late<string>("http://domain.com/some/url/");
|
|
7
7
|
const $matched = RegexpReplaced($url, Of("some/url/"), Of(""));
|
|
8
8
|
const g = vi.fn();
|
|
9
|
-
$matched.
|
|
9
|
+
$matched.pipe(Tap(g));
|
|
10
10
|
|
|
11
11
|
expect(g).toHaveBeenLastCalledWith("http://domain.com/");
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { All, Message, MessageType, Of,
|
|
1
|
+
import { All, Message, MessageType, Of, Tap } from "silentium";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns string replaced by regular expression pattern
|
|
@@ -10,10 +10,10 @@ export function RegexpReplaced(
|
|
|
10
10
|
replaceValueSrc: MessageType<string>,
|
|
11
11
|
flagsSrc: MessageType<string> = Of(""),
|
|
12
12
|
) {
|
|
13
|
-
return Message<string>((
|
|
14
|
-
All(patternSrc, valueSrc, replaceValueSrc, flagsSrc).
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
return Message<string>(function () {
|
|
14
|
+
All(patternSrc, valueSrc, replaceValueSrc, flagsSrc).pipe(
|
|
15
|
+
Tap(([pattern, value, replaceValue, flags]) => {
|
|
16
|
+
this.use(
|
|
17
17
|
String(value).replace(new RegExp(pattern, flags), replaceValue),
|
|
18
18
|
);
|
|
19
19
|
}),
|
package/src/system/Set.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Late, Of,
|
|
1
|
+
import { Late, Of, Tap } from "silentium";
|
|
2
2
|
import { Set } from "../system/Set";
|
|
3
3
|
import { expect, test, vi } from "vitest";
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ test("Set.test", () => {
|
|
|
9
9
|
};
|
|
10
10
|
const obj = Set(Of(object), Of("value"), $value);
|
|
11
11
|
const g = vi.fn();
|
|
12
|
-
obj.
|
|
12
|
+
obj.pipe(Tap(g));
|
|
13
13
|
|
|
14
14
|
expect(object.value).toBe("hello");
|
|
15
15
|
|
package/src/system/Set.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { All, Message, MessageType,
|
|
1
|
+
import { All, Message, MessageType, Tap } from "silentium";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Ability to mutate some object, helpful when integrate to procedure systems
|
|
@@ -9,11 +9,11 @@ export function Set<T extends Record<string, unknown>>(
|
|
|
9
9
|
keySrc: MessageType<string>,
|
|
10
10
|
valueSrc: MessageType<unknown>,
|
|
11
11
|
) {
|
|
12
|
-
return Message<T>((
|
|
13
|
-
All(baseSrc, keySrc, valueSrc).
|
|
14
|
-
|
|
12
|
+
return Message<T>(function () {
|
|
13
|
+
All(baseSrc, keySrc, valueSrc).pipe(
|
|
14
|
+
Tap(([base, key, value]) => {
|
|
15
15
|
(base as Record<string, unknown>)[key] = value;
|
|
16
|
-
|
|
16
|
+
this.use(base);
|
|
17
17
|
}),
|
|
18
18
|
);
|
|
19
19
|
});
|