silentium-components 0.0.26 → 0.0.28
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 +34 -0
- package/dist/silentium-components.cjs +570 -342
- package/dist/silentium-components.cjs.map +1 -1
- package/dist/silentium-components.d.ts +169 -30
- package/dist/silentium-components.js +546 -319
- 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 +546 -319
- package/dist/silentium-components.mjs.map +1 -1
- package/package.json +2 -2
- package/src/behaviors/Branch._main.test.ts +22 -0
- package/src/behaviors/Branch.branchesDontAffectResult.test.ts +11 -11
- package/src/behaviors/Branch.dontRespondAfterRespond.test.ts +15 -17
- package/src/behaviors/Branch.ts +28 -21
- package/src/behaviors/{Deadline.test.ts → Deadline._main.test.ts} +5 -5
- package/src/behaviors/Deadline._value.test.ts +6 -6
- package/src/behaviors/Deadline.ts +45 -41
- package/src/behaviors/Deferred.test.ts +14 -14
- package/src/behaviors/Deferred.ts +21 -15
- package/src/behaviors/Dirty.test.ts +8 -8
- package/src/behaviors/Dirty.ts +43 -35
- package/src/behaviors/Loading.test.ts +8 -8
- package/src/behaviors/Loading.ts +24 -14
- package/src/behaviors/Lock.test.ts +14 -14
- package/src/behaviors/Lock.ts +21 -14
- package/src/behaviors/Memo.test.ts +16 -14
- package/src/behaviors/Memo.ts +20 -12
- package/src/behaviors/OnlyChanged.test.ts +7 -7
- package/src/behaviors/OnlyChanged.ts +22 -15
- package/src/behaviors/Path._main.test.ts +14 -0
- package/src/behaviors/Path.index.test.ts +4 -4
- package/src/behaviors/Path.nested.test.ts +4 -4
- package/src/behaviors/Path.ts +27 -22
- package/src/behaviors/Shot._main.test.ts +29 -0
- package/src/behaviors/Shot._onlyChanged.test.ts +15 -13
- package/src/behaviors/Shot.ts +24 -15
- package/src/behaviors/Sync.test.ts +10 -0
- package/src/behaviors/Sync.ts +38 -15
- package/src/behaviors/Tick.test.ts +8 -8
- package/src/behaviors/Tick.ts +20 -12
- package/src/boolean/And.test.ts +12 -12
- package/src/boolean/And.ts +18 -14
- package/src/boolean/Bool.ts +11 -2
- package/src/boolean/Not.test.ts +6 -6
- package/src/boolean/Not.ts +15 -10
- package/src/boolean/Or.test.ts +12 -12
- package/src/boolean/Or.ts +18 -14
- package/src/boolean/index.ts +1 -0
- package/src/formats/FromJson.test.ts +11 -0
- package/src/formats/FromJson.ts +22 -15
- package/src/formats/ToJson.test.ts +11 -0
- package/src/formats/ToJson.ts +23 -16
- package/src/lists/First.test.ts +4 -4
- package/src/lists/First.ts +11 -6
- package/src/navigation/Router.test.ts +13 -13
- package/src/navigation/Router.ts +36 -29
- package/src/strings/Concatenated.test.ts +6 -6
- package/src/strings/Concatenated.ts +18 -14
- package/src/structures/HashTable.test.ts +7 -7
- package/src/structures/HashTable.ts +17 -11
- package/src/structures/Record._main.test.ts +28 -0
- package/src/structures/Record.concatenated.test.ts +17 -15
- package/src/structures/Record.nested.test.ts +10 -10
- package/src/structures/RecordOf.ts +29 -0
- package/src/structures/index.ts +1 -1
- package/src/system/RegexpMatch._group.test.ts +9 -6
- package/src/system/RegexpMatch._main.test.ts +16 -0
- package/src/system/RegexpMatch.ts +20 -17
- package/src/system/RegexpMatched.test.ts +6 -6
- package/src/system/RegexpMatched.ts +19 -16
- package/src/system/RegexpReplaced.test.ts +10 -6
- package/src/system/RegexpReplaced.ts +25 -18
- package/src/system/Set.test.ts +6 -6
- package/src/system/Set.ts +20 -17
- package/src/behaviors/Branch.test.ts +0 -22
- package/src/behaviors/Path.test.ts +0 -14
- package/src/behaviors/Shot.test.ts +0 -29
- package/src/structures/Record.test.ts +0 -28
- package/src/structures/Record.ts +0 -22
- package/src/system/RegexpMatch.test.ts +0 -13
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { i, of } from "silentium";
|
|
2
|
-
import { expect, test, vi } from "vitest";
|
|
3
|
-
import { record } from "../structures/Record";
|
|
4
|
-
|
|
5
|
-
test("Record.test", () => {
|
|
6
|
-
const [three, o] = of<string>("three");
|
|
7
|
-
const recordSrc = record({
|
|
8
|
-
one: i("one"),
|
|
9
|
-
two: i(2),
|
|
10
|
-
three,
|
|
11
|
-
});
|
|
12
|
-
const g = vi.fn();
|
|
13
|
-
recordSrc(g);
|
|
14
|
-
|
|
15
|
-
expect(g).toHaveBeenLastCalledWith({
|
|
16
|
-
one: "one",
|
|
17
|
-
two: 2,
|
|
18
|
-
three: "three",
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
o("three-changed");
|
|
22
|
-
|
|
23
|
-
expect(g).toHaveBeenLastCalledWith({
|
|
24
|
-
one: "one",
|
|
25
|
-
two: 2,
|
|
26
|
-
three: "three-changed",
|
|
27
|
-
});
|
|
28
|
-
});
|
package/src/structures/Record.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { all, InformationType } from "silentium";
|
|
2
|
-
|
|
3
|
-
type UnInformation<T> = T extends InformationType<infer U> ? U : never;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns record of data from record of sources
|
|
7
|
-
* https://silentium-lab.github.io/silentium-components/#/structures/record
|
|
8
|
-
*/
|
|
9
|
-
export const record = <T extends InformationType>(
|
|
10
|
-
recordSrc: Record<string, T>,
|
|
11
|
-
): InformationType<Record<string, UnInformation<T>>> => {
|
|
12
|
-
return (o) => {
|
|
13
|
-
const keys = Object.keys(recordSrc);
|
|
14
|
-
all(...Object.values(recordSrc))((entries) => {
|
|
15
|
-
const record: Record<string, any> = {};
|
|
16
|
-
entries.forEach((entry, index) => {
|
|
17
|
-
record[keys[index]] = entry;
|
|
18
|
-
});
|
|
19
|
-
o(record);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { i } from "silentium";
|
|
2
|
-
import { expect, test, vi } from "vitest";
|
|
3
|
-
import { path } from "../behaviors";
|
|
4
|
-
import { regexpMatch } from "../system/RegexpMatch";
|
|
5
|
-
|
|
6
|
-
test("RegexpMatch.test", () => {
|
|
7
|
-
const urlSrc = i<string>("http://domain.com/some/url/");
|
|
8
|
-
const matchedSrc = path(regexpMatch(i("/(s\\w+)/"), urlSrc), i("0"));
|
|
9
|
-
const g = vi.fn();
|
|
10
|
-
matchedSrc(g);
|
|
11
|
-
|
|
12
|
-
expect(g).toHaveBeenLastCalledWith("/some/");
|
|
13
|
-
});
|