silentium-components 0.0.65 → 0.0.67

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 +15 -0
  2. package/dist/silentium-components.cjs +215 -215
  3. package/dist/silentium-components.cjs.map +1 -1
  4. package/dist/silentium-components.d.ts +47 -47
  5. package/dist/silentium-components.js +181 -181
  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 +181 -181
  11. package/dist/silentium-components.mjs.map +1 -1
  12. package/package.json +2 -2
  13. package/src/behaviors/Branch._main.test.ts +7 -7
  14. package/src/behaviors/Branch.branchesDontAffectResult.test.ts +7 -7
  15. package/src/behaviors/Branch.dontRespondAfterRespond.test.ts +7 -7
  16. package/src/behaviors/Branch.ts +9 -9
  17. package/src/behaviors/BranchLazy._main.test.ts +7 -7
  18. package/src/behaviors/BranchLazy.ts +9 -9
  19. package/src/behaviors/Const.test.ts +4 -4
  20. package/src/behaviors/Const.ts +5 -5
  21. package/src/behaviors/Deadline._main.test.ts +4 -4
  22. package/src/behaviors/Deadline._value.test.ts +4 -4
  23. package/src/behaviors/Deadline.ts +8 -8
  24. package/src/behaviors/Deferred.test.ts +6 -6
  25. package/src/behaviors/Deferred.ts +8 -8
  26. package/src/behaviors/Detached.test.ts +4 -4
  27. package/src/behaviors/Detached.ts +4 -4
  28. package/src/behaviors/Dirty.test.ts +4 -4
  29. package/src/behaviors/Dirty.ts +9 -9
  30. package/src/behaviors/Loading.test.ts +5 -5
  31. package/src/behaviors/Loading.ts +7 -7
  32. package/src/behaviors/Lock.test.ts +6 -6
  33. package/src/behaviors/Lock.ts +7 -7
  34. package/src/behaviors/Memo.test.ts +4 -4
  35. package/src/behaviors/Memo.ts +5 -5
  36. package/src/behaviors/OnlyChanged.test.ts +4 -4
  37. package/src/behaviors/OnlyChanged.ts +4 -4
  38. package/src/behaviors/Part.test.ts +5 -5
  39. package/src/behaviors/Part.ts +10 -14
  40. package/src/behaviors/Path._main.test.ts +3 -3
  41. package/src/behaviors/Path.index.test.ts +3 -3
  42. package/src/behaviors/Path.nested.test.ts +3 -3
  43. package/src/behaviors/Path.ts +8 -12
  44. package/src/behaviors/Polling.test.ts +4 -4
  45. package/src/behaviors/Polling.ts +5 -5
  46. package/src/behaviors/Shot._main.test.ts +5 -5
  47. package/src/behaviors/Shot._onlyChanged.test.ts +6 -6
  48. package/src/behaviors/Shot.ts +8 -8
  49. package/src/behaviors/Task.ts +7 -7
  50. package/src/behaviors/Tick.test.ts +5 -5
  51. package/src/behaviors/Tick.ts +5 -5
  52. package/src/boolean/And.test.ts +5 -5
  53. package/src/boolean/And.ts +7 -7
  54. package/src/boolean/Bool.test.ts +3 -3
  55. package/src/boolean/Bool.ts +6 -6
  56. package/src/boolean/Not.test.ts +4 -4
  57. package/src/boolean/Not.ts +4 -4
  58. package/src/boolean/Or.test.ts +5 -5
  59. package/src/boolean/Or.ts +7 -7
  60. package/src/formats/FromJson.test.ts +4 -4
  61. package/src/formats/FromJson.ts +5 -5
  62. package/src/formats/ToJson.test.ts +4 -4
  63. package/src/formats/ToJson.ts +5 -5
  64. package/src/lists/First.test.ts +3 -3
  65. package/src/lists/First.ts +7 -7
  66. package/src/navigation/Router._main.test.ts +9 -9
  67. package/src/navigation/Router._nested.test.ts +20 -20
  68. package/src/navigation/Router.ts +23 -23
  69. package/src/strings/Concatenated.test.ts +5 -5
  70. package/src/strings/Concatenated.ts +9 -9
  71. package/src/strings/Template._main.test.ts +11 -11
  72. package/src/strings/Template._place.test.ts +4 -4
  73. package/src/strings/Template.ts +19 -19
  74. package/src/structures/HashTable.test.ts +4 -4
  75. package/src/structures/HashTable.ts +5 -5
  76. package/src/structures/Record._main.test.ts +6 -6
  77. package/src/structures/Record.concatenated.test.ts +10 -10
  78. package/src/structures/Record.nested.test.ts +9 -9
  79. package/src/structures/RecordOf.ts +8 -8
  80. package/src/system/RegexpMatch._group.test.ts +5 -5
  81. package/src/system/RegexpMatch._main.test.ts +5 -5
  82. package/src/system/RegexpMatch.ts +9 -9
  83. package/src/system/RegexpMatched.test.ts +4 -4
  84. package/src/system/RegexpMatched.ts +8 -8
  85. package/src/system/RegexpReplaced.test.ts +4 -4
  86. package/src/system/RegexpReplaced.ts +8 -8
  87. package/src/system/Set.test.ts +4 -4
  88. package/src/system/Set.ts +7 -7
  89. package/docs/assets/js/components/linkDynamic.mjs +0 -14
  90. package/docs/assets/js/components/linkReloadable.mjs +0 -17
  91. package/docs/assets/js/components.mjs +0 -2
  92. package/docs/assets/js/index.mjs +0 -271
@@ -1,10 +1,10 @@
1
- import { late } from "silentium";
2
- import { not } from "../boolean/Not";
1
+ import { Late } from "silentium";
2
+ import { Not } from "../boolean/Not";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  test("Not.test", () => {
6
- const one = late<boolean>(false);
7
- const result = not(one.event);
6
+ const one = Late<boolean>(false);
7
+ const result = Not(one.event);
8
8
  const g = vi.fn();
9
9
  result(g);
10
10
  expect(g).toHaveBeenLastCalledWith(true);
@@ -3,10 +3,10 @@ import { EventType } from "silentium";
3
3
  /**
4
4
  * https://silentium-lab.github.io/silentium-components/#/boolean/not
5
5
  */
6
- export const not = (baseSrc: EventType<boolean>): EventType<boolean> => {
7
- return (u) => {
6
+ export function Not(baseSrc: EventType<boolean>): EventType<boolean> {
7
+ return (user) => {
8
8
  baseSrc((v) => {
9
- u(!v);
9
+ user(!v);
10
10
  });
11
11
  };
12
- };
12
+ }
@@ -1,11 +1,11 @@
1
- import { late } from "silentium";
2
- import { or } from "../boolean/Or";
1
+ import { Late } from "silentium";
2
+ import { Or } from "../boolean/Or";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  test("Or.test", () => {
6
- const one = late<boolean>(false);
7
- const two = late<boolean>(false);
8
- const result = or(one.event, two.event);
6
+ const one = Late<boolean>(false);
7
+ const two = Late<boolean>(false);
8
+ const result = Or(one.event, two.event);
9
9
  const g = vi.fn();
10
10
  result(g);
11
11
  expect(g).toHaveBeenLastCalledWith(false);
package/src/boolean/Or.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { all, EventType } from "silentium";
1
+ import { All, EventType } from "silentium";
2
2
 
3
3
  /**
4
4
  * https://silentium-lab.github.io/silentium-components/#/boolean/or
5
5
  */
6
- export const or = (
6
+ export function Or(
7
7
  oneSrc: EventType<boolean>,
8
8
  twoSrc: EventType<boolean>,
9
- ): EventType<boolean> => {
10
- return (u) => {
11
- all(
9
+ ): EventType<boolean> {
10
+ return (user) => {
11
+ All(
12
12
  oneSrc,
13
13
  twoSrc,
14
14
  )(([one, two]) => {
15
- u(one || two);
15
+ user(one || two);
16
16
  });
17
17
  };
18
- };
18
+ }
@@ -1,10 +1,10 @@
1
- import { of, primitive } from "silentium";
2
- import { fromJson } from "../formats/FromJson";
1
+ import { Of, Primitive } from "silentium";
2
+ import { FromJson } from "../formats/FromJson";
3
3
  import { expect, test } from "vitest";
4
4
 
5
5
  test("FromJson.test", () => {
6
- const one = of('{"hello": "world"}');
7
- const objectSync = primitive(fromJson<{ hello: string }>(one));
6
+ const one = Of('{"hello": "world"}');
7
+ const objectSync = Primitive(FromJson<{ hello: string }>(one));
8
8
 
9
9
  expect(objectSync.primitive()?.hello).toBe("world");
10
10
  });
@@ -3,17 +3,17 @@ import { EventType, EventUserType } from "silentium";
3
3
  /**
4
4
  * Represents object from json
5
5
  */
6
- export const fromJson = <T = Record<string, unknown>>(
6
+ export function FromJson<T = Record<string, unknown>>(
7
7
  jsonSrc: EventType<string>,
8
8
  errorOwner?: EventUserType,
9
- ): EventType<T> => {
10
- return (u) => {
9
+ ): EventType<T> {
10
+ return (user) => {
11
11
  jsonSrc((json) => {
12
12
  try {
13
- u(JSON.parse(json));
13
+ user(JSON.parse(json));
14
14
  } catch (error) {
15
15
  errorOwner?.(new Error(`Failed to parse JSON: ${error}`));
16
16
  }
17
17
  });
18
18
  };
19
- };
19
+ }
@@ -1,10 +1,10 @@
1
- import { of, primitive } from "silentium";
1
+ import { Of, Primitive } from "silentium";
2
2
  import { expect, test } from "vitest";
3
- import { toJson } from "../formats/ToJson";
3
+ import { ToJson } from "../formats/ToJson";
4
4
 
5
5
  test("ToJson.test", () => {
6
- const one = of({ hello: "world" });
7
- const objectSync = primitive(toJson(one));
6
+ const one = Of({ hello: "world" });
7
+ const objectSync = Primitive(ToJson(one));
8
8
 
9
9
  expect(objectSync.primitive()).toBe('{"hello":"world"}');
10
10
  });
@@ -3,17 +3,17 @@ import { EventType, EventUserType } from "silentium";
3
3
  /**
4
4
  * Represents json from object
5
5
  */
6
- export const toJson = (
6
+ export function ToJson(
7
7
  dataSrc: EventType,
8
8
  errorOwner?: EventUserType,
9
- ): EventType<string> => {
10
- return (u) => {
9
+ ): EventType<string> {
10
+ return (user) => {
11
11
  dataSrc((data: unknown) => {
12
12
  try {
13
- u(JSON.stringify(data));
13
+ user(JSON.stringify(data));
14
14
  } catch {
15
15
  errorOwner?.(new Error("Failed to convert to JSON"));
16
16
  }
17
17
  });
18
18
  };
19
- };
19
+ }
@@ -1,9 +1,9 @@
1
- import { of } from "silentium";
1
+ import { Of } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
- import { first } from "./First";
3
+ import { First } from "./First";
4
4
 
5
5
  test("first", () => {
6
- const f = first(of([1, 2, 3]));
6
+ const f = First(Of([1, 2, 3]));
7
7
  const g = vi.fn();
8
8
  f(g);
9
9
  expect(g).toHaveBeenCalledWith(1);
@@ -1,12 +1,12 @@
1
- import { applied, EventType } from "silentium";
1
+ import { Applied, EventType } from "silentium";
2
2
 
3
3
  /**
4
- * Represents the first element of an array.
4
+ * Represents the first element Of an array.
5
5
  */
6
- export const first = <T extends Array<unknown>>(
6
+ export function First<T extends Array<unknown>>(
7
7
  baseSrc: EventType<T>,
8
- ): EventType<T[0]> => {
9
- return (u) => {
10
- applied(baseSrc, (a) => a[0])(u);
8
+ ): EventType<T[0]> {
9
+ return (user) => {
10
+ Applied(baseSrc, (a) => a[0])(user);
11
11
  };
12
- };
12
+ }
@@ -1,5 +1,5 @@
1
- import { applied, late, of, shared } from "silentium";
2
- import { router } from "../navigation/Router";
1
+ import { Applied, Late, Of, Shared } from "silentium";
2
+ import { Router } from "../navigation/Router";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  const drop = (dropPart: string) => (value: string) => {
@@ -7,24 +7,24 @@ const drop = (dropPart: string) => (value: string) => {
7
7
  };
8
8
 
9
9
  test("Router._main.test", () => {
10
- const urlSrc = late<string>("http://domain.com/");
11
- const urlPathSrc = shared(applied(urlSrc.event, drop("http://domain.com")));
10
+ const urlSrc = Late<string>("http://domain.com/");
11
+ const urlPathSrc = Shared(Applied(urlSrc.event, drop("http://domain.com")));
12
12
  const g = vi.fn();
13
13
  urlPathSrc.event(g);
14
14
 
15
- const routerSrc = router(
15
+ const routerSrc = Router(
16
16
  urlPathSrc.event,
17
- of([
17
+ Of([
18
18
  {
19
19
  pattern: "^/$",
20
- template: () => of("page/home.html"),
20
+ template: () => Of("page/home.html"),
21
21
  },
22
22
  {
23
23
  pattern: "/some/contacts",
24
- template: () => of("page/contacts.html"),
24
+ template: () => Of("page/contacts.html"),
25
25
  },
26
26
  ]),
27
- () => of<string>("page/404.html"),
27
+ () => Of<string>("page/404.html"),
28
28
  );
29
29
  const g2 = vi.fn();
30
30
  routerSrc(g2);
@@ -1,55 +1,55 @@
1
- import { lateShared, of } from "silentium";
1
+ import { LateShared, Of } from "silentium";
2
2
  import { describe, expect, test } from "vitest";
3
- import { detached } from "../behaviors/Detached";
4
- import { router } from "../navigation/Router";
3
+ import { Detached } from "../behaviors/Detached";
4
+ import { Router } from "../navigation/Router";
5
5
 
6
6
  describe("Router._nested.test", () => {
7
7
  test("Вложенные роуты", () => {
8
- const urlSrc = lateShared("/");
9
- const routerSrc = router(
8
+ const urlSrc = LateShared("/");
9
+ const routerSrc = Router(
10
10
  urlSrc.event,
11
- of([
11
+ Of([
12
12
  {
13
13
  pattern: "^/$",
14
- template: () => of<string>("home"),
14
+ template: () => Of<string>("home"),
15
15
  },
16
16
  {
17
17
  pattern: "/admin.*",
18
18
  template: () => {
19
19
  return (user) => {
20
20
  // need to replace with detached component
21
- const localUrlSrc = detached(urlSrc.event);
21
+ const localUrlSrc = Detached(urlSrc.event);
22
22
 
23
- const r = router(
23
+ const r = Router(
24
24
  localUrlSrc,
25
- of([
25
+ Of([
26
26
  {
27
27
  pattern: "^/admin/articles$",
28
- template: () => of("articles list"),
28
+ template: () => Of("articles list"),
29
29
  },
30
30
  {
31
31
  pattern: "^/admin/articles/create$",
32
- template: () => of("articles create"),
32
+ template: () => Of("articles create"),
33
33
  },
34
34
  {
35
35
  pattern: "^/admin/articles/update$",
36
- template: () => of("articles update"),
36
+ template: () => Of("articles update"),
37
37
  },
38
38
  {
39
39
  pattern: "^/admin/nested/.*$",
40
40
  template: () => {
41
41
  return (user) => {
42
- const localUrlSrc = detached(urlSrc.event);
42
+ const localUrlSrc = Detached(urlSrc.event);
43
43
 
44
- const r = router(
44
+ const r = Router(
45
45
  localUrlSrc,
46
- of([
46
+ Of([
47
47
  {
48
48
  pattern: "^/admin/nested/list$",
49
- template: () => of("admin nested list"),
49
+ template: () => Of("admin nested list"),
50
50
  },
51
51
  ]),
52
- () => of<string>("admin nested not found"),
52
+ () => Of<string>("admin nested not found"),
53
53
  );
54
54
  const rDestructor = r(user);
55
55
 
@@ -60,7 +60,7 @@ describe("Router._nested.test", () => {
60
60
  },
61
61
  },
62
62
  ]),
63
- () => of<string>("admin not found"),
63
+ () => Of<string>("admin not found"),
64
64
  );
65
65
  const rDestructor = r(user);
66
66
 
@@ -71,7 +71,7 @@ describe("Router._nested.test", () => {
71
71
  },
72
72
  },
73
73
  ]),
74
- () => of("not found"),
74
+ () => Of("not found"),
75
75
  );
76
76
  const d: string[] = [];
77
77
  routerSrc((v) => {
@@ -1,14 +1,14 @@
1
1
  import {
2
- all,
3
- applied,
2
+ All,
3
+ Applied,
4
4
  EventType,
5
- destructor,
5
+ Destructor,
6
6
  DestructorType,
7
- of,
7
+ Of,
8
8
  ConstructorType,
9
9
  } from "silentium";
10
- import { regexpMatched } from "../system";
11
- import { branchLazy } from "../behaviors";
10
+ import { RegexpMatched } from "../system";
11
+ import { BranchLazy } from "../behaviors";
12
12
 
13
13
  export interface Route<T> {
14
14
  pattern: string;
@@ -16,51 +16,51 @@ export interface Route<T> {
16
16
  template: ConstructorType<[], EventType<T>>;
17
17
  }
18
18
 
19
- const emptySrc = () => of(false);
19
+ const emptySrc = () => Of(false);
20
20
 
21
21
  /**
22
22
  * Router component what will return template if url matches pattern
23
23
  * https://silentium-lab.github.io/silentium-components/#/navigation/router
24
24
  */
25
- export const router = <T = "string">(
25
+ export function Router<T = "string">(
26
26
  urlSrc: EventType<string>,
27
27
  routesSrc: EventType<Route<T>[]>,
28
28
  defaultSrc: ConstructorType<[], EventType<T>>,
29
- ): EventType<T> => {
30
- return (u) => {
29
+ ): EventType<T> {
30
+ return (user) => {
31
31
  const destructors: DestructorType[] = [];
32
32
  const destroyAllData = () => {
33
33
  destructors.forEach((d) => d());
34
34
  destructors.length = 0;
35
35
  };
36
- all(
36
+ All(
37
37
  routesSrc,
38
38
  urlSrc,
39
39
  )(([routes, url]) => {
40
40
  destroyAllData();
41
- const instance = all(
41
+ const instance = All(
42
42
  defaultSrc(),
43
- all(
43
+ All(
44
44
  ...routes.map(
45
45
  (r) =>
46
- destructor(
47
- branchLazy(
48
- regexpMatched(
49
- of(r.pattern),
50
- of(url),
51
- r.patternFlags ? of(r.patternFlags) : undefined,
46
+ Destructor(
47
+ BranchLazy(
48
+ RegexpMatched(
49
+ Of(r.pattern),
50
+ Of(url),
51
+ r.patternFlags ? Of(r.patternFlags) : undefined,
52
52
  ),
53
53
  r.template,
54
54
  emptySrc,
55
55
  ),
56
56
  (d: DestructorType) => destructors.push(d),
57
- ).value,
57
+ ).event,
58
58
  ),
59
59
  ),
60
60
  );
61
61
 
62
62
  // Return first not false or default
63
- applied(instance, (r) => {
63
+ Applied(instance, (r) => {
64
64
  const firstReal = r[1].find((r) => r !== false);
65
65
 
66
66
  if (firstReal) {
@@ -68,9 +68,9 @@ export const router = <T = "string">(
68
68
  }
69
69
 
70
70
  return r[0];
71
- })(u);
71
+ })(user);
72
72
  });
73
73
 
74
74
  return destroyAllData;
75
75
  };
76
- };
76
+ }
@@ -1,11 +1,11 @@
1
- import { of } from "silentium";
2
- import { concatenated } from "../strings/Concatenated";
1
+ import { Of } from "silentium";
2
+ import { Concatenated } from "../strings/Concatenated";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  test("Concatenated.test", () => {
6
- const concatenatedSrc = concatenated(
7
- [of("one"), of("two"), of("three")],
8
- of("-"),
6
+ const concatenatedSrc = Concatenated(
7
+ [Of("one"), Of("two"), Of("three")],
8
+ Of("-"),
9
9
  );
10
10
  const g = vi.fn();
11
11
  concatenatedSrc(g);
@@ -1,19 +1,19 @@
1
- import { all, EventType, of } from "silentium";
1
+ import { All, EventType, Of } from "silentium";
2
2
 
3
3
  /**
4
- * Join sources of strings to one source
4
+ * Join sources Of strings to one source
5
5
  * https://silentium-lab.github.io/silentium-components/#/string/concatenated
6
6
  */
7
- export const concatenated = (
7
+ export function Concatenated(
8
8
  sources: EventType<string>[],
9
- joinPartSrc: EventType<string> = of(""),
10
- ): EventType<string> => {
11
- return (u) => {
12
- all(
9
+ joinPartSrc: EventType<string> = Of(""),
10
+ ): EventType<string> {
11
+ return (user) => {
12
+ All(
13
13
  joinPartSrc,
14
14
  ...sources,
15
15
  )(([joinPart, ...strings]) => {
16
- u(strings.join(joinPart));
16
+ user(strings.join(joinPart));
17
17
  });
18
18
  };
19
- };
19
+ }
@@ -1,13 +1,13 @@
1
- import { of } from "silentium";
2
- import { template } from "../strings/Template";
3
- import { recordOf } from "../structures";
1
+ import { Of } from "silentium";
2
+ import { Template } from "../strings/Template";
3
+ import { RecordOf } from "../structures";
4
4
  import { expect, test, vi } from "vitest";
5
5
 
6
6
  test("Template._main.test", () => {
7
- const tpl = template(
8
- of("<h1>$1</h1>"),
9
- recordOf({
10
- $1: of("one value"),
7
+ const tpl = Template(
8
+ Of("<h1>$1</h1>"),
9
+ RecordOf({
10
+ $1: Of("one value"),
11
11
  }),
12
12
  );
13
13
  const g = vi.fn();
@@ -15,10 +15,10 @@ test("Template._main.test", () => {
15
15
 
16
16
  expect(g).toHaveBeenLastCalledWith("<h1>one value</h1>");
17
17
 
18
- const tpl2 = template(
19
- of("<h2>$1</h2>"),
20
- recordOf({
21
- $1: of("second value"),
18
+ const tpl2 = Template(
19
+ Of("<h2>$1</h2>"),
20
+ RecordOf({
21
+ $1: Of("second value"),
22
22
  }),
23
23
  );
24
24
  const g2 = vi.fn();
@@ -1,10 +1,10 @@
1
- import { of } from "silentium";
2
- import { template } from "../strings/Template";
1
+ import { Of } from "silentium";
2
+ import { Template } from "../strings/Template";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  test("Template._place.test", () => {
6
- const t = template();
7
- t.template(`<div class="greeting">Hello ${t.var(of("User"))}</div>`);
6
+ const t = Template();
7
+ t.template(`<div class="greeting">Hello ${t.var(Of("User"))}</div>`);
8
8
  const g = vi.fn();
9
9
  t.value(g);
10
10
 
@@ -1,26 +1,26 @@
1
1
  import {
2
- all,
3
- applied,
2
+ All,
3
+ Applied,
4
4
  EventType,
5
- destructor,
5
+ Destructor,
6
6
  DestructorType,
7
- of,
7
+ Of,
8
8
  } from "silentium";
9
- import { recordOf } from "../structures";
9
+ import { RecordOf } from "../structures";
10
10
 
11
- export const template = (
12
- theSrc: EventType<string> = of(""),
13
- placesSrc: EventType<Record<string, unknown>> = of({}),
14
- ) => {
11
+ export function Template(
12
+ theSrc: EventType<string> = Of(""),
13
+ placesSrc: EventType<Record<string, unknown>> = Of({}),
14
+ ) {
15
15
  let placesCounter = 0;
16
16
  const vars: Record<string, EventType> = {
17
- $TPL: of("$TPL"),
17
+ $TPL: Of("$TPL"),
18
18
  };
19
19
  const destructors: DestructorType[] = [];
20
20
  return {
21
- value: <EventType<string>>((u) => {
22
- const varsSrc = recordOf(vars);
23
- applied(all(theSrc, placesSrc, varsSrc), ([base, rules, vars]) => {
21
+ value: <EventType<string>>((user) => {
22
+ const varsSrc = RecordOf(vars);
23
+ Applied(All(theSrc, placesSrc, varsSrc), ([base, rules, vars]) => {
24
24
  Object.entries(rules).forEach(([ph, val]) => {
25
25
  base = base.replaceAll(ph, String(val));
26
26
  });
@@ -29,25 +29,25 @@ export const template = (
29
29
  });
30
30
 
31
31
  return base;
32
- })(u);
32
+ })(user);
33
33
  }),
34
34
  template: (value: string) => {
35
- theSrc = of(value);
35
+ theSrc = Of(value);
36
36
  },
37
37
  /**
38
38
  * Ability to register variable
39
- * in concrete place of template
39
+ * in concrete place Of template
40
40
  */
41
41
  var: (src: EventType<string>) => {
42
42
  const varName = `$var${placesCounter}`;
43
43
  placesCounter += 1;
44
- vars[varName] = destructor(src, (d: DestructorType) => {
44
+ vars[varName] = Destructor(src, (d: DestructorType) => {
45
45
  destructors.push(d);
46
- }).value;
46
+ }).event;
47
47
  return varName;
48
48
  },
49
49
  destroy() {
50
50
  destructors.forEach((d) => d());
51
51
  },
52
52
  };
53
- };
53
+ }
@@ -1,10 +1,10 @@
1
- import { late } from "silentium";
2
- import { hashTable } from "../structures/HashTable";
1
+ import { Late } from "silentium";
2
+ import { HashTable } from "../structures/HashTable";
3
3
  import { expect, test, vi } from "vitest";
4
4
 
5
5
  test("HashTable.test", () => {
6
- const entrySource = late<[string, string]>();
7
- const hashTableSrc = hashTable(entrySource.event);
6
+ const entrySource = Late<[string, string]>();
7
+ const hashTableSrc = HashTable(entrySource.event);
8
8
  const g = vi.fn();
9
9
  hashTableSrc(g);
10
10
  entrySource.use(["key-one", "value-one"]);
@@ -3,15 +3,15 @@ import { EventType } from "silentium";
3
3
  /**
4
4
  * https://silentium-lab.github.io/silentium-components/#/structures/hash-table
5
5
  */
6
- export const hashTable = <T>(
6
+ export function HashTable<T>(
7
7
  baseSrc: EventType<[string, unknown]>,
8
- ): EventType<T> => {
9
- return (u) => {
8
+ ): EventType<T> {
9
+ return (user) => {
10
10
  const record: Record<string, unknown> = {};
11
11
 
12
12
  baseSrc(([key, value]) => {
13
13
  record[key] = value;
14
- u(record as T);
14
+ user(record as T);
15
15
  });
16
16
  };
17
- };
17
+ }
@@ -1,12 +1,12 @@
1
- import { late, of } from "silentium";
1
+ import { Late, Of } from "silentium";
2
2
  import { expect, test, vi } from "vitest";
3
- import { recordOf } from "./RecordOf";
3
+ import { RecordOf } from "./RecordOf";
4
4
 
5
5
  test("Record._main.test", () => {
6
- const three = late<string>("three");
7
- const recordSrc = recordOf({
8
- one: of("one"),
9
- two: of(2),
6
+ const three = Late<string>("three");
7
+ const recordSrc = RecordOf({
8
+ one: Of("one"),
9
+ two: Of(2),
10
10
  three: three.event,
11
11
  });
12
12
  const g = vi.fn();