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.
Files changed (92) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/silentium-components.cjs +130 -130
  3. package/dist/silentium-components.cjs.map +1 -1
  4. package/dist/silentium-components.d.ts +9 -9
  5. package/dist/silentium-components.js +131 -131
  6. package/dist/silentium-components.js.map +1 -1
  7. package/dist/silentium-components.min.js +1 -1
  8. package/dist/silentium-components.min.mjs +1 -1
  9. package/dist/silentium-components.min.mjs.map +1 -1
  10. package/dist/silentium-components.mjs +131 -131
  11. package/dist/silentium-components.mjs.map +1 -1
  12. package/package.json +2 -2
  13. package/src/behaviors/Branch._main.test.ts +2 -2
  14. package/src/behaviors/Branch._values.test.ts +2 -2
  15. package/src/behaviors/Branch.branchesDontAffectResult.test.ts +2 -2
  16. package/src/behaviors/Branch.dontRespondAfterRespond.test.ts +5 -5
  17. package/src/behaviors/Branch.ts +5 -5
  18. package/src/behaviors/BranchLazy._main.test.ts +4 -4
  19. package/src/behaviors/BranchLazy.ts +8 -8
  20. package/src/behaviors/Const.test.ts +3 -3
  21. package/src/behaviors/Const.ts +5 -5
  22. package/src/behaviors/Deadline._main.test.ts +2 -2
  23. package/src/behaviors/Deadline._value.test.ts +3 -3
  24. package/src/behaviors/Deadline.ts +9 -9
  25. package/src/behaviors/Deferred.test.ts +3 -3
  26. package/src/behaviors/Deferred.ts +5 -11
  27. package/src/behaviors/Detached.test.ts +3 -3
  28. package/src/behaviors/Detached.ts +2 -2
  29. package/src/behaviors/Dirty.test.ts +2 -2
  30. package/src/behaviors/Dirty.ts +5 -5
  31. package/src/behaviors/Loading.test.ts +2 -2
  32. package/src/behaviors/Loading.ts +6 -6
  33. package/src/behaviors/Lock.test.ts +2 -2
  34. package/src/behaviors/Lock.ts +5 -5
  35. package/src/behaviors/Memo.test.ts +4 -4
  36. package/src/behaviors/Memo.ts +5 -5
  37. package/src/behaviors/OnlyChanged.test.ts +3 -3
  38. package/src/behaviors/OnlyChanged.ts +5 -5
  39. package/src/behaviors/Part.test.ts +3 -3
  40. package/src/behaviors/Part.ts +5 -5
  41. package/src/behaviors/Path._keyRaw.test.ts +2 -2
  42. package/src/behaviors/Path._main.test.ts +2 -2
  43. package/src/behaviors/Path.index.test.ts +2 -2
  44. package/src/behaviors/Path.nested.test.ts +2 -2
  45. package/src/behaviors/Path.ts +5 -5
  46. package/src/behaviors/Polling.ts +5 -5
  47. package/src/behaviors/Shot._main.test.ts +3 -3
  48. package/src/behaviors/Shot._onlyChanged.test.ts +3 -3
  49. package/src/behaviors/Shot.ts +5 -11
  50. package/src/behaviors/Task.test.ts +5 -5
  51. package/src/behaviors/Task.ts +2 -2
  52. package/src/behaviors/Tick.test.ts +2 -2
  53. package/src/behaviors/Tick.ts +5 -5
  54. package/src/behaviors/Transaction.ts +6 -6
  55. package/src/boolean/And.test.ts +2 -2
  56. package/src/boolean/And.ts +5 -5
  57. package/src/boolean/Bool.test.ts +2 -2
  58. package/src/boolean/Bool.ts +2 -2
  59. package/src/boolean/Not.test.ts +2 -2
  60. package/src/boolean/Not.ts +5 -5
  61. package/src/boolean/Or.test.ts +2 -2
  62. package/src/boolean/Or.ts +5 -5
  63. package/src/formats/FromJson.ts +6 -6
  64. package/src/formats/ToJson.ts +6 -6
  65. package/src/lists/First.test.ts +2 -2
  66. package/src/lists/First.ts +2 -2
  67. package/src/navigation/Router._destroy.test.ts +7 -7
  68. package/src/navigation/Router._firstMatch.test.ts +7 -7
  69. package/src/navigation/Router._main.test.ts +7 -7
  70. package/src/navigation/Router._nested.test.ts +16 -16
  71. package/src/navigation/Router.ts +11 -11
  72. package/src/strings/Concatenated.test.ts +2 -2
  73. package/src/strings/Concatenated.ts +5 -5
  74. package/src/strings/Template._main.test.ts +3 -3
  75. package/src/strings/Template._place.test.ts +2 -2
  76. package/src/strings/Template.ts +3 -3
  77. package/src/structures/HashTable.test.ts +2 -2
  78. package/src/structures/HashTable.ts +5 -5
  79. package/src/structures/Record._main.test.ts +2 -2
  80. package/src/structures/Record._mixed.test.ts +2 -2
  81. package/src/structures/Record.concatenated.test.ts +4 -4
  82. package/src/structures/Record.nested.test.ts +2 -2
  83. package/src/structures/Record.ts +5 -5
  84. package/src/system/RegexpMatch._group.test.ts +2 -2
  85. package/src/system/RegexpMatch._main.test.ts +2 -2
  86. package/src/system/RegexpMatch.ts +5 -5
  87. package/src/system/RegexpMatched.test.ts +2 -2
  88. package/src/system/RegexpMatched.ts +5 -5
  89. package/src/system/RegexpReplaced.test.ts +2 -2
  90. package/src/system/RegexpReplaced.ts +5 -5
  91. package/src/system/Set.test.ts +2 -2
  92. package/src/system/Set.ts +5 -5
@@ -1,4 +1,4 @@
1
- import { Late, Transport } from "silentium";
1
+ import { Late, Tap } from "silentium";
2
2
  import { Or } from "../boolean/Or";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
@@ -7,7 +7,7 @@ test("Or.test", () => {
7
7
  const two = Late<boolean>(false);
8
8
  const result = Or(one, two);
9
9
  const g = vi.fn();
10
- result.to(Transport(g));
10
+ result.pipe(Tap(g));
11
11
  expect(g).toHaveBeenLastCalledWith(false);
12
12
 
13
13
  one.use(true);
package/src/boolean/Or.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { All, Message, MessageType, Transport } from "silentium";
1
+ import { All, Message, MessageType, Tap } from "silentium";
2
2
 
3
3
  /**
4
4
  * Logical OR over two messages
5
5
  * https://silentium-lab.github.io/silentium-components/#/boolean/or
6
6
  */
7
7
  export function Or($one: MessageType<boolean>, $two: MessageType<boolean>) {
8
- return Message<boolean>((transport) => {
9
- All($one, $two).to(
10
- Transport(([one, two]) => {
11
- transport.use(one || two);
8
+ return Message<boolean>(function () {
9
+ All($one, $two).pipe(
10
+ Tap(([one, two]) => {
11
+ this.use(!!(one || two));
12
12
  }),
13
13
  );
14
14
  });
@@ -1,17 +1,17 @@
1
- import { Message, MessageType, Transport, TransportType } from "silentium";
1
+ import { Message, MessageType, Tap, TapType } from "silentium";
2
2
 
3
3
  /**
4
4
  * Represents object from json
5
5
  */
6
6
  export function FromJson<T = Record<string, unknown>>(
7
7
  $json: MessageType<string>,
8
- error?: TransportType,
8
+ error?: TapType,
9
9
  ) {
10
- return Message<T>((transport) => {
11
- $json.to(
12
- Transport((json) => {
10
+ return Message<T>(function () {
11
+ $json.pipe(
12
+ Tap((json) => {
13
13
  try {
14
- transport.use(JSON.parse(json));
14
+ this.use(JSON.parse(json));
15
15
  } catch (e) {
16
16
  error?.use(new Error(`Failed to parse JSON: ${e}`));
17
17
  }
@@ -1,14 +1,14 @@
1
- import { Message, MessageType, Transport, TransportType } from "silentium";
1
+ import { Message, MessageType, Tap, TapType } from "silentium";
2
2
 
3
3
  /**
4
4
  * Represents json from object
5
5
  */
6
- export function ToJson($data: MessageType, error?: TransportType) {
7
- return Message<string>((transport) => {
8
- $data.to(
9
- Transport((data: unknown) => {
6
+ export function ToJson($data: MessageType, error?: TapType) {
7
+ return Message<string>(function () {
8
+ $data.pipe(
9
+ Tap((data: unknown) => {
10
10
  try {
11
- transport.use(JSON.stringify(data));
11
+ this.use(JSON.stringify(data));
12
12
  } catch {
13
13
  error?.use(new Error("Failed to convert to JSON"));
14
14
  }
@@ -1,10 +1,10 @@
1
- import { Of, Transport } from "silentium";
1
+ import { Of, Tap } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
3
  import { First } from "./First";
4
4
 
5
5
  test("first", () => {
6
6
  const f = First(Of([1, 2, 3]));
7
7
  const g = vi.fn();
8
- f.to(Transport(g));
8
+ f.pipe(Tap(g));
9
9
  expect(g).toHaveBeenCalledWith(1);
10
10
  });
@@ -4,7 +4,7 @@ import { Applied, Message, MessageType } from "silentium";
4
4
  * Represents the first element Of an array.
5
5
  */
6
6
  export function First<T extends Array<unknown>>($base: MessageType<T>) {
7
- return Message<T[0]>((transport) => {
8
- Applied($base, (a) => a[0]).to(transport);
7
+ return Message<T[0]>(function () {
8
+ Applied($base, (a) => a[0]).pipe(this);
9
9
  });
10
10
  }
@@ -4,8 +4,8 @@ import {
4
4
  Message,
5
5
  Of,
6
6
  Shared,
7
- Transport,
8
- TransportMessage,
7
+ Tap,
8
+ TapMessage,
9
9
  } from "silentium";
10
10
  import { Router } from "../navigation/Router";
11
11
  import { expect, test, vi } from "vitest";
@@ -18,28 +18,28 @@ test("Router destroys previous route messages when switching routes", () => {
18
18
  const $url = Late<string>("http://domain.com/");
19
19
  const $urlPath = Shared(Applied($url, drop("http://domain.com")));
20
20
  const g = vi.fn();
21
- $urlPath.to(Transport(g));
21
+ $urlPath.pipe(Tap(g));
22
22
 
23
23
  // Create mock destroyable messages for routes
24
24
  const firstRouteDestroy = vi.fn();
25
25
  const secondRouteDestroy = vi.fn();
26
26
  const defaultDestroy = vi.fn();
27
27
 
28
- const $firstRoute = TransportMessage(() =>
28
+ const $firstRoute = TapMessage(() =>
29
29
  Message<string>((transport) => {
30
30
  transport.use("first-route-response");
31
31
  return firstRouteDestroy;
32
32
  }),
33
33
  );
34
34
 
35
- const $secondRoute = TransportMessage(() =>
35
+ const $secondRoute = TapMessage(() =>
36
36
  Message<string>((transport) => {
37
37
  transport.use("second-route-response");
38
38
  return secondRouteDestroy;
39
39
  }),
40
40
  );
41
41
 
42
- const $default = TransportMessage(() =>
42
+ const $default = TapMessage(() =>
43
43
  Message<string>((transport) => {
44
44
  transport.use("default-response");
45
45
  return defaultDestroy;
@@ -62,7 +62,7 @@ test("Router destroys previous route messages when switching routes", () => {
62
62
  );
63
63
 
64
64
  const g2 = vi.fn();
65
- $router.to(Transport(g2));
65
+ $router.pipe(Tap(g2));
66
66
 
67
67
  // Initially no route matches, should use default
68
68
  expect(g2).toHaveBeenLastCalledWith("default-response");
@@ -3,8 +3,8 @@ import {
3
3
  Late,
4
4
  Of,
5
5
  Shared,
6
- Transport,
7
- TransportMessage,
6
+ Tap,
7
+ TapMessage,
8
8
  } from "silentium";
9
9
  import { expect, test, vi } from "vitest";
10
10
  import { Router } from "../navigation/Router";
@@ -17,7 +17,7 @@ test("Router first matching route responds, not subsequent matches", () => {
17
17
  const $url = Late<string>("http://domain.com/page/general");
18
18
  const $urlPath = Shared(Applied($url, drop("http://domain.com")));
19
19
  const g = vi.fn();
20
- $urlPath.to(Transport(g));
20
+ $urlPath.pipe(Tap(g));
21
21
 
22
22
  const firstRouteMock = vi.fn(() => Of("first-route-response"));
23
23
  const secondRouteMock = vi.fn(() => Of("second-route-response"));
@@ -27,17 +27,17 @@ test("Router first matching route responds, not subsequent matches", () => {
27
27
  Of([
28
28
  {
29
29
  pattern: "^/page/.*", // This matches /page/anything
30
- message: TransportMessage(firstRouteMock),
30
+ message: TapMessage(firstRouteMock),
31
31
  },
32
32
  {
33
33
  pattern: "^/page/specific$", // This also matches /page/specific
34
- message: TransportMessage(secondRouteMock),
34
+ message: TapMessage(secondRouteMock),
35
35
  },
36
36
  ]),
37
- TransportMessage(() => Of<string>("page/404.html")),
37
+ TapMessage(() => Of<string>("page/404.html")),
38
38
  );
39
39
  const g2 = vi.fn();
40
- $router.to(Transport(g2));
40
+ $router.pipe(Tap(g2));
41
41
 
42
42
  // Initial URL should match first route
43
43
  expect(g2).toHaveBeenLastCalledWith("first-route-response");
@@ -3,8 +3,8 @@ import {
3
3
  Late,
4
4
  Of,
5
5
  Shared,
6
- Transport,
7
- TransportMessage,
6
+ Tap,
7
+ TapMessage,
8
8
  } from "silentium";
9
9
  import { expect, test, vi } from "vitest";
10
10
  import { Router } from "../navigation/Router";
@@ -17,24 +17,24 @@ test("Router._main.test", () => {
17
17
  const $url = Late<string>("http://domain.com/");
18
18
  const $urlPath = Shared(Applied($url, drop("http://domain.com")));
19
19
  const g = vi.fn();
20
- $urlPath.to(Transport(g));
20
+ $urlPath.pipe(Tap(g));
21
21
 
22
22
  const $router = Router(
23
23
  $urlPath,
24
24
  Of([
25
25
  {
26
26
  pattern: "^/$",
27
- message: TransportMessage(() => Of("page/home.html")),
27
+ message: TapMessage(() => Of("page/home.html")),
28
28
  },
29
29
  {
30
30
  pattern: "/some/contacts",
31
- message: TransportMessage(() => Of("page/contacts.html")),
31
+ message: TapMessage(() => Of("page/contacts.html")),
32
32
  },
33
33
  ]),
34
- TransportMessage(() => Of<string>("page/404.html")),
34
+ TapMessage(() => Of<string>("page/404.html")),
35
35
  );
36
36
  const g2 = vi.fn();
37
- $router.to(Transport(g2));
37
+ $router.pipe(Tap(g2));
38
38
 
39
39
  expect(g2).toHaveBeenLastCalledWith("page/home.html");
40
40
 
@@ -2,8 +2,8 @@ import {
2
2
  LateShared,
3
3
  Message,
4
4
  Of,
5
- Transport,
6
- TransportMessage,
5
+ Tap,
6
+ TapMessage,
7
7
  } from "silentium";
8
8
  import { describe, expect, test } from "vitest";
9
9
  import { Detached } from "../behaviors/Detached";
@@ -17,11 +17,11 @@ describe("Router._nested.test", () => {
17
17
  Of([
18
18
  {
19
19
  pattern: "^/$",
20
- message: TransportMessage(() => Of<string>("home")),
20
+ message: TapMessage(() => Of<string>("home")),
21
21
  },
22
22
  {
23
23
  pattern: "/admin.*",
24
- message: TransportMessage(() => {
24
+ message: TapMessage(() => {
25
25
  return Message((transport) => {
26
26
  // need to replace with detached component
27
27
  const localUrlSrc = Detached($url);
@@ -31,19 +31,19 @@ describe("Router._nested.test", () => {
31
31
  Of([
32
32
  {
33
33
  pattern: "^/admin/articles$",
34
- message: TransportMessage(() => Of("articles list")),
34
+ message: TapMessage(() => Of("articles list")),
35
35
  },
36
36
  {
37
37
  pattern: "^/admin/articles/create$",
38
- message: TransportMessage(() => Of("articles create")),
38
+ message: TapMessage(() => Of("articles create")),
39
39
  },
40
40
  {
41
41
  pattern: "^/admin/articles/update$",
42
- message: TransportMessage(() => Of("articles update")),
42
+ message: TapMessage(() => Of("articles update")),
43
43
  },
44
44
  {
45
45
  pattern: "^/admin/nested/.*$",
46
- message: TransportMessage(() => {
46
+ message: TapMessage(() => {
47
47
  return Message((transport) => {
48
48
  const localUrlSrc = Detached($url);
49
49
 
@@ -52,17 +52,17 @@ describe("Router._nested.test", () => {
52
52
  Of([
53
53
  {
54
54
  pattern: "^/admin/nested/list$",
55
- message: TransportMessage(() =>
55
+ message: TapMessage(() =>
56
56
  Of("admin nested list"),
57
57
  ),
58
58
  },
59
59
  ]),
60
- TransportMessage(() =>
60
+ TapMessage(() =>
61
61
  Of<string>("admin nested not found"),
62
62
  ),
63
63
  );
64
64
 
65
- r.to(transport);
65
+ r.pipe(transport);
66
66
 
67
67
  return function AdminDestroy() {
68
68
  r.destroy();
@@ -71,10 +71,10 @@ describe("Router._nested.test", () => {
71
71
  }),
72
72
  },
73
73
  ]),
74
- TransportMessage(() => Of<string>("admin not found")),
74
+ TapMessage(() => Of<string>("admin not found")),
75
75
  );
76
76
 
77
- r.to(transport);
77
+ r.pipe(transport);
78
78
 
79
79
  return function AdminDestroy() {
80
80
  r.destroy();
@@ -83,11 +83,11 @@ describe("Router._nested.test", () => {
83
83
  }),
84
84
  },
85
85
  ]),
86
- TransportMessage(() => Of("not found")),
86
+ TapMessage(() => Of("not found")),
87
87
  );
88
88
  const d: string[] = [];
89
- $router.to(
90
- Transport((v) => {
89
+ $router.pipe(
90
+ Tap((v) => {
91
91
  d.push(v);
92
92
  }),
93
93
  );
@@ -5,15 +5,15 @@ import {
5
5
  Message,
6
6
  MessageType,
7
7
  Of,
8
- Transport,
9
- TransportType,
8
+ Tap,
9
+ TapType,
10
10
  } from "silentium";
11
11
  import { RegexpMatched } from "../system";
12
12
 
13
13
  export interface Route<T> {
14
14
  pattern: string;
15
15
  patternFlags?: string;
16
- message: TransportType<void, MessageType<T>>;
16
+ message: TapType<void, MessageType<T>>;
17
17
  }
18
18
 
19
19
  /**
@@ -23,15 +23,15 @@ export interface Route<T> {
23
23
  export function Router<T = "string">(
24
24
  $url: MessageType<string>,
25
25
  $routes: MessageType<Route<T>[]>,
26
- $default: TransportType<void, MessageType<T>>,
26
+ $default: TapType<void, MessageType<T>>,
27
27
  ): MessageType<T> & DestroyableType {
28
- return Message<T>((transport) => {
28
+ return Message<T>(function () {
29
29
  const dc = DestroyContainer();
30
30
  const destructor = () => {
31
31
  dc.destroy();
32
32
  };
33
- All($routes, $url).to(
34
- Transport(([routes, url]) => {
33
+ All($routes, $url).pipe(
34
+ Tap(([routes, url]) => {
35
35
  destructor();
36
36
  const $matches = All(
37
37
  ...routes.map((r) =>
@@ -42,20 +42,20 @@ export function Router<T = "string">(
42
42
  ),
43
43
  ),
44
44
  );
45
- $matches.to(
46
- Transport((matches) => {
45
+ $matches.pipe(
46
+ Tap((matches) => {
47
47
  const index = matches.findIndex((v) => v === true);
48
48
 
49
49
  if (index === -1) {
50
50
  const instance = $default.use();
51
51
  dc.add(instance);
52
- instance.to(transport);
52
+ instance.pipe(this);
53
53
  }
54
54
 
55
55
  if (index > -1) {
56
56
  const instance = routes[index].message.use();
57
57
  dc.add(instance);
58
- instance.to(transport);
58
+ instance.pipe(this);
59
59
  }
60
60
  }),
61
61
  );
@@ -1,4 +1,4 @@
1
- import { Of, Transport } from "silentium";
1
+ import { Of, Tap } from "silentium";
2
2
  import { Concatenated } from "../strings/Concatenated";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
@@ -8,7 +8,7 @@ test("Concatenated.test", () => {
8
8
  Of("-"),
9
9
  );
10
10
  const g = vi.fn();
11
- $concatenated.to(Transport(g));
11
+ $concatenated.pipe(Tap(g));
12
12
 
13
13
  expect(g).toHaveBeenLastCalledWith("one-two-three");
14
14
  });
@@ -1,4 +1,4 @@
1
- import { All, Message, MessageType, Of, Transport } from "silentium";
1
+ import { All, Message, MessageType, Of, Tap } from "silentium";
2
2
 
3
3
  /**
4
4
  * Join sources Of strings to one source
@@ -8,10 +8,10 @@ export function Concatenated(
8
8
  sources: MessageType<string>[],
9
9
  joinPartSrc: MessageType<string> = Of(""),
10
10
  ) {
11
- return Message<string>((transport) => {
12
- All(joinPartSrc, ...sources).to(
13
- Transport(([joinPart, ...strings]) => {
14
- transport.use(strings.join(joinPart));
11
+ return Message<string>(function () {
12
+ All(joinPartSrc, ...sources).pipe(
13
+ Tap(([joinPart, ...strings]) => {
14
+ this.use(strings.join(joinPart));
15
15
  }),
16
16
  );
17
17
  });
@@ -1,4 +1,4 @@
1
- import { Of, Transport } from "silentium";
1
+ import { Of, Tap } from "silentium";
2
2
  import { Template } from "../strings/Template";
3
3
  import { Record } from "../structures";
4
4
  import { expect, test, vi } from "vitest";
@@ -11,7 +11,7 @@ test("Template._main.test", () => {
11
11
  }),
12
12
  );
13
13
  const g = vi.fn();
14
- tpl.to(Transport(g));
14
+ tpl.pipe(Tap(g));
15
15
 
16
16
  expect(g).toHaveBeenLastCalledWith("<h1>one value</h1>");
17
17
 
@@ -22,7 +22,7 @@ test("Template._main.test", () => {
22
22
  }),
23
23
  );
24
24
  const g2 = vi.fn();
25
- tpl2.to(Transport(g2));
25
+ tpl2.pipe(Tap(g2));
26
26
 
27
27
  expect(g2).toHaveBeenLastCalledWith("<h2>second value</h2>");
28
28
  });
@@ -1,4 +1,4 @@
1
- import { Of, Transport } from "silentium";
1
+ import { Of, Tap } from "silentium";
2
2
  import { Template } from "../strings/Template";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
@@ -6,7 +6,7 @@ test("Template._place.test", () => {
6
6
  const t = Template();
7
7
  t.template(`<div class="greeting">Hello ${t.var(Of("User"))}</div>`);
8
8
  const g = vi.fn();
9
- t.to(Transport(g));
9
+ t.pipe(Tap(g));
10
10
 
11
11
  expect(g).toHaveBeenLastCalledWith('<div class="greeting">Hello User</div>');
12
12
  });
@@ -6,7 +6,7 @@ import {
6
6
  isDestroyable,
7
7
  MessageType,
8
8
  Of,
9
- TransportType,
9
+ TapType,
10
10
  } from "silentium";
11
11
  import { Record } from "../structures";
12
12
 
@@ -33,7 +33,7 @@ class TemplateImpl implements MessageType<string>, DestroyableType {
33
33
  private $places: MessageType<Record<string, unknown>> = Of({}),
34
34
  ) {}
35
35
 
36
- public to(transport: TransportType<string>): this {
36
+ public pipe(transport: TapType<string>): this {
37
37
  const $vars = Record(this.vars);
38
38
  Applied(All(this.$src, this.$places, $vars), ([base, rules, vars]) => {
39
39
  Object.entries(rules).forEach(([ph, val]) => {
@@ -44,7 +44,7 @@ class TemplateImpl implements MessageType<string>, DestroyableType {
44
44
  });
45
45
 
46
46
  return base;
47
- }).to(transport);
47
+ }).pipe(transport);
48
48
  return this;
49
49
  }
50
50
 
@@ -1,4 +1,4 @@
1
- import { Late, Transport } from "silentium";
1
+ import { Late, Tap } from "silentium";
2
2
  import { HashTable } from "../structures/HashTable";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
@@ -6,7 +6,7 @@ test("HashTable.test", () => {
6
6
  const $entry = Late<[string, string]>();
7
7
  const $hash = HashTable($entry);
8
8
  const g = vi.fn();
9
- $hash.to(Transport(g));
9
+ $hash.pipe(Tap(g));
10
10
  $entry.use(["key-one", "value-one"]);
11
11
  $entry.use(["key-two", "value-two"]);
12
12
 
@@ -1,4 +1,4 @@
1
- import { Message, MessageType, Transport } from "silentium";
1
+ import { Message, MessageType, Tap } from "silentium";
2
2
 
3
3
  /**
4
4
  * By receiving a message with a key and value, collects a table
@@ -6,13 +6,13 @@ import { Message, MessageType, Transport } from "silentium";
6
6
  * https://silentium-lab.github.io/silentium-components/#/structures/hash-table
7
7
  */
8
8
  export function HashTable<T>($base: MessageType<[string, unknown]>) {
9
- return Message<T>((transport) => {
9
+ return Message<T>(function () {
10
10
  const record: Record<string, unknown> = {};
11
11
 
12
- $base.to(
13
- Transport(([key, value]) => {
12
+ $base.pipe(
13
+ Tap(([key, value]) => {
14
14
  record[key] = value;
15
- transport.use(record as T);
15
+ this.use(record as T);
16
16
  }),
17
17
  );
18
18
  });
@@ -1,4 +1,4 @@
1
- import { Late, Of, Transport } from "silentium";
1
+ import { Late, Of, Tap } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
3
  import { Record } from "./Record";
4
4
 
@@ -10,7 +10,7 @@ test("Record._main.test", () => {
10
10
  three: $three,
11
11
  });
12
12
  const g = vi.fn();
13
- $record.to(Transport(g));
13
+ $record.pipe(Tap(g));
14
14
 
15
15
  expect(g).toHaveBeenLastCalledWith({
16
16
  one: "one",
@@ -1,4 +1,4 @@
1
- import { Late, Transport } from "silentium";
1
+ import { Late, Tap } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
3
  import { Record } from "./Record";
4
4
 
@@ -10,7 +10,7 @@ test("Record._mixed.test", () => {
10
10
  three: $three,
11
11
  });
12
12
  const g = vi.fn();
13
- $record.to(Transport(g));
13
+ $record.pipe(Tap(g));
14
14
 
15
15
  expect(g).toHaveBeenLastCalledWith({
16
16
  one: "one",
@@ -1,4 +1,4 @@
1
- import { Late, Of, Shared, Transport } from "silentium";
1
+ import { Late, Of, Shared, Tap } from "silentium";
2
2
  import { Concatenated } from "../strings";
3
3
  import { Record } from "./Record";
4
4
  import { expect, test, vi } from "vitest";
@@ -15,10 +15,10 @@ test("Record.concatenated.test", () => {
15
15
  }),
16
16
  );
17
17
  const g = vi.fn();
18
- r.to(Transport(g));
18
+ r.pipe(Tap(g));
19
19
  let counter = 0;
20
- r.to(
21
- Transport(() => {
20
+ r.pipe(
21
+ Tap(() => {
22
22
  counter += 1;
23
23
  }),
24
24
  );
@@ -1,4 +1,4 @@
1
- import { Of, Transport } from "silentium";
1
+ import { Of, Tap } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
3
  import { Record } from "./Record";
4
4
 
@@ -14,7 +14,7 @@ test("Record.nested.test", () => {
14
14
  }),
15
15
  });
16
16
  const g = vi.fn();
17
- $record.to(Transport(g));
17
+ $record.pipe(Tap(g));
18
18
 
19
19
  expect(g).toHaveBeenLastCalledWith({
20
20
  one: "one",
@@ -1,4 +1,4 @@
1
- import { All, isMessage, Message, MessageType, Of, Transport } from "silentium";
1
+ import { All, isMessage, Message, MessageType, Of, Tap } from "silentium";
2
2
 
3
3
  type UnWrap<T> = T extends MessageType<infer U> ? U : T;
4
4
 
@@ -7,20 +7,20 @@ type UnWrap<T> = T extends MessageType<infer U> ? U : T;
7
7
  * https://silentium-lab.github.io/silentium-components/#/structures/record
8
8
  */
9
9
  export function Record<T>(record: Record<string, T>) {
10
- return Message<Record<string, UnWrap<T>>>((transport) => {
10
+ return Message<Record<string, UnWrap<T>>>(function () {
11
11
  const keys = Object.keys(record);
12
12
  keys.forEach((key) => {
13
13
  if (!isMessage(record[key])) {
14
14
  record[key] = Of(record[key]) as any;
15
15
  }
16
16
  });
17
- All(...(Object.values(record) as any)).to(
18
- Transport((entries) => {
17
+ All(...(Object.values(record) as any)).pipe(
18
+ Tap((entries) => {
19
19
  const record: Record<string, any> = {};
20
20
  entries.forEach((entry, index) => {
21
21
  record[keys[index]] = entry;
22
22
  });
23
- transport.use(record);
23
+ this.use(record);
24
24
  }),
25
25
  );
26
26
  });
@@ -1,4 +1,4 @@
1
- import { Of, Transport } from "silentium";
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._group.test", () => {
7
7
  const $url = Of<string>("http://domain.com/some/url/");
8
8
  const $matched = Path(RegexpMatch(Of("/(s\\w+)/"), $url), Of("1"));
9
9
  const g = vi.fn();
10
- $matched.to(Transport(g));
10
+ $matched.pipe(Tap(g));
11
11
 
12
12
  expect(g).toHaveBeenLastCalledWith("some");
13
13
  });