silentium 0.0.2 → 0.0.3

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 (93) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/beforeRelease.sh +11 -0
  3. package/dist/silentium.cjs +39 -63
  4. package/dist/silentium.cjs.map +1 -1
  5. package/dist/silentium.d.ts +34 -53
  6. package/dist/silentium.js +40 -63
  7. package/dist/silentium.js.map +1 -1
  8. package/dist/silentium.min.js +1 -1
  9. package/dist/silentium.min.mjs +1 -1
  10. package/dist/silentium.min.mjs.map +1 -1
  11. package/dist/silentium.mjs +40 -63
  12. package/dist/silentium.mjs.map +1 -1
  13. package/docs/assets/css/base.css +15 -0
  14. package/docs/assets/css/custom.css +72 -0
  15. package/docs/assets/img/logo.svg +1522 -0
  16. package/docs/assets/js/components/linkDynamic.mjs +14 -0
  17. package/docs/assets/js/components/linkReloadable.mjs +17 -0
  18. package/docs/assets/js/components.mjs +2 -0
  19. package/docs/assets/js/index.mjs +74 -0
  20. package/docs/assets/js/lib/StyleFetched.mjs +19 -0
  21. package/docs/build.sh +7 -3
  22. package/docs/buildRoutes.sh +15 -0
  23. package/docs/favicon.ico +0 -0
  24. package/docs/index-dev.html +4 -80
  25. package/docs/index.html +6 -82
  26. package/docs/pages/compatibility/elegant-objects.html +4 -4
  27. package/docs/pages/examples/errors.html +2 -2
  28. package/docs/pages/examples.html +12 -14
  29. package/docs/pages/guest/guest-applied.html +9 -5
  30. package/docs/pages/guest/guest-cast.html +20 -26
  31. package/docs/pages/guest/guest-disposable.html +32 -42
  32. package/docs/pages/guest/guest-executor-applied.html +21 -17
  33. package/docs/pages/guest/guest-object.html +22 -26
  34. package/docs/pages/guest/guest-pool.html +17 -18
  35. package/docs/pages/guest/guest-sync.html +7 -2
  36. package/docs/pages/guest/index.html +18 -29
  37. package/docs/pages/guest.html +112 -18
  38. package/docs/pages/index.html +24 -52
  39. package/docs/pages/integrations/vue.html +5 -8
  40. package/docs/pages/patron/index.html +14 -20
  41. package/docs/pages/patron/patron-applied.html +2 -2
  42. package/docs/pages/patron/patron-executor-applied.html +2 -2
  43. package/docs/pages/patron/patron-once.html +12 -18
  44. package/docs/pages/patron/patron-pool.html +12 -18
  45. package/docs/pages/patron.html +137 -16
  46. package/docs/pages/philosofy.html +30 -49
  47. package/docs/pages/source/index.html +11 -14
  48. package/docs/pages/source/source-all.html +9 -12
  49. package/docs/pages/source/source-applied.html +2 -2
  50. package/docs/pages/source/source-dynamic.html +3 -3
  51. package/docs/pages/source/source-executor-applied.html +2 -2
  52. package/docs/pages/source/source-map.html +5 -5
  53. package/docs/pages/source/source-once.html +2 -2
  54. package/docs/pages/source/source-race.html +10 -10
  55. package/docs/pages/source/source-sequence.html +2 -2
  56. package/docs/pages/source/source-with-pool.html +8 -11
  57. package/docs/pages/source/source.html +11 -14
  58. package/docs/pages/source.html +162 -31
  59. package/docs/pages/terminology/source.html +5 -9
  60. package/docs/pages/terminology.html +12 -18
  61. package/docs/pages/utils.html +33 -21
  62. package/docs/routes.json +1 -0
  63. package/docs/template.html +4 -80
  64. package/eslint.config.mjs +3 -0
  65. package/package.json +2 -2
  66. package/src/Guest/Guest.ts +3 -3
  67. package/src/Guest/GuestApplied.ts +1 -1
  68. package/src/Guest/GuestCast.ts +1 -1
  69. package/src/Guest/GuestDisposable.ts +1 -1
  70. package/src/Guest/GuestExecutorApplied.ts +1 -1
  71. package/src/Guest/GuestObject.ts +1 -1
  72. package/src/Guest/GuestPool.ts +1 -1
  73. package/src/Guest/GuestSync.ts +1 -1
  74. package/src/Patron/Patron.ts +2 -2
  75. package/src/Patron/PatronApplied.ts +1 -1
  76. package/src/Patron/PatronExecutorApplied.ts +1 -1
  77. package/src/Patron/PatronOnce.ts +1 -1
  78. package/src/Patron/PatronPool.ts +4 -4
  79. package/src/Private/Private.ts +1 -1
  80. package/src/Source/Source.ts +4 -4
  81. package/src/Source/SourceAll.ts +1 -1
  82. package/src/Source/SourceApplied.ts +1 -1
  83. package/src/Source/SourceDynamic.ts +1 -1
  84. package/src/Source/SourceExecutorApplied.ts +1 -1
  85. package/src/Source/SourceMap.ts +1 -1
  86. package/src/Source/SourceOnce.ts +1 -1
  87. package/src/Source/SourceRace.ts +1 -1
  88. package/src/Source/SourceSequence.ts +1 -1
  89. package/src/Source/SourceWithPool.ts +1 -1
  90. package/src/index.ts +0 -1
  91. package/docs/pages/source/source-active.html +0 -120
  92. package/src/Source/SourceActive.test.ts +0 -13
  93. package/src/Source/SourceActive.ts +0 -41
@@ -0,0 +1,14 @@
1
+ window.customElements.define(
2
+ "link-dynamic",
3
+ class extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ const href = this.getAttribute("href");
7
+ const content = this.innerHTML;
8
+ this.innerHTML = `<a
9
+ class="inline-block whitespace-nowrap rounded-[0.27rem] bg-primary-100 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-white bg-slate-900 dynamic-navigation"
10
+ href="${href}"
11
+ >${content}</a>`;
12
+ }
13
+ },
14
+ );
@@ -0,0 +1,17 @@
1
+ window.customElements.define(
2
+ "link-reloadable",
3
+ class extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ const href = this.getAttribute("href");
7
+ const target =
8
+ this.getAttribute("target-blank") !== null ? 'target="_blank"' : "";
9
+ const content = this.innerHTML;
10
+ this.innerHTML = `<a
11
+ class="inline-block whitespace-nowrap rounded-[0.27rem] bg-primary-100 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-white bg-slate-900"
12
+ href="${href}"
13
+ ${target}
14
+ >${content}</a>`;
15
+ }
16
+ },
17
+ );
@@ -0,0 +1,2 @@
1
+ import "./components/linkDynamic.mjs";
2
+ import "./components/linkReloadable.mjs";
@@ -0,0 +1,74 @@
1
+ import { CurrentPage, Link, Page, Router } from "silentium-components";
2
+ import { Patron, PatronOnce, SourceWithPool, sourceOf } from "silentium";
3
+ import { StyleFetched } from "./lib/StyleFetched.mjs";
4
+ import { Fetched, Element, Attribute, StyleInstalled } from "silentium-web-api";
5
+ import "./components.mjs";
6
+
7
+ new StyleFetched(
8
+ "https://raw.githubusercontent.com/kosukhin/patorn-design-system/refs/heads/main/dist/assets/index.css",
9
+ ).install();
10
+
11
+ const routing = new Router(".loader", ".page-area", ".menu");
12
+
13
+ const [basePath] = window.location.href
14
+ .replace(window.location.origin, "")
15
+ .split("#");
16
+ const cleanBasePath = basePath.replace(/[^/]+\.html$/, "");
17
+ const currentPage = new CurrentPage();
18
+ const basePathSource = new SourceWithPool(
19
+ `${basePath}#`.replace("index.html", "").replace("//", "/"),
20
+ );
21
+
22
+ const link = new Link(currentPage, basePathSource);
23
+ link.watchClick(".global-body", "a.dynamic-navigation");
24
+
25
+ const dynamicPage = new Page("Dynamic page");
26
+
27
+ const errors = new SourceWithPool();
28
+ const routesTransport = new Fetched(errors);
29
+
30
+ routesTransport.do().give({
31
+ url: `${cleanBasePath}routes.json`,
32
+ asJson: true,
33
+ });
34
+
35
+ const styleLink = new Attribute(
36
+ new Element(sourceOf(".style-link")),
37
+ "data-style",
38
+ );
39
+ const styleTransport = new Fetched(errors);
40
+ styleLink.value((url) => {
41
+ styleTransport.do().give({ url });
42
+ });
43
+
44
+ styleTransport.result().value(new PatronOnce(new StyleInstalled()));
45
+
46
+ routesTransport.result().value(
47
+ new Patron((routes) => {
48
+ const dynamicRoutes = routes.map((route) => ({
49
+ url: "/" + route.replace("pages/", "").replace(".html", "").trim(),
50
+ template: route,
51
+ page: dynamicPage,
52
+ }));
53
+
54
+ routing.routes(
55
+ [
56
+ {
57
+ url: "/",
58
+ template: "pages/index.html",
59
+ aliases: [basePath, `${basePath}index.html`, ""],
60
+ page: new Page("Silentium"),
61
+ },
62
+ ...dynamicRoutes,
63
+ {
64
+ url: "",
65
+ template: "pages/404.html",
66
+ page: new Page("Страница не найдена"),
67
+ default: true,
68
+ },
69
+ ],
70
+ currentPage,
71
+ basePathSource,
72
+ );
73
+ }),
74
+ );
@@ -0,0 +1,19 @@
1
+ /* eslint-disable @typescript-eslint/explicit-member-accessibility */
2
+
3
+ export class StyleFetched {
4
+ constructor(styleUrl) {
5
+ this.styleUrl = styleUrl;
6
+ }
7
+
8
+ install() {
9
+ window
10
+ .fetch(this.styleUrl)
11
+ .then((r) => r.text())
12
+ .then((styleContent) => {
13
+ const styleEl = window.document.createElement("style");
14
+ styleEl.textContent = styleContent;
15
+ window.document.head.appendChild(styleEl);
16
+ window.document.body.classList.remove("body-loading");
17
+ });
18
+ }
19
+ }
package/docs/build.sh CHANGED
@@ -3,11 +3,11 @@
3
3
  echo "BEGIN"
4
4
  cd docs
5
5
  cp template.html index.html
6
- sed -i "s/TPL_SILENTIUM_OOP/https:\/\/cdn.jsdelivr.net\/npm\/patron-oop@1.46.0\/dist\/patron.min.mjs/g" "index.html"
6
+ sed -i "s/TPL_SILENTIUM_OOP/https:\/\/cdn.jsdelivr.net\/npm\/silentium@0.0.2\/dist\/silentium.min.mjs/g" "index.html"
7
7
 
8
- sed -i "s/TPL_SILENTIUM_WEB_API/https:\/\/cdn.jsdelivr.net\/npm\/patron-web-api@1.14.0\/dist\/patron-web-api.min.mjs/g" "index.html"
8
+ sed -i "s/TPL_SILENTIUM_WEB_API/https:\/\/cdn.jsdelivr.net\/npm\/silentium-web-api@0.0.1\/dist\/silentium-web-api.min.mjs/g" "index.html"
9
9
 
10
- sed -i "s/TPL_SILENTIUM_COMPONENTS/https:\/\/cdn.jsdelivr.net\/npm\/patron-oop-components@1.20.0\/dist\/patron-components.min.mjs/g" "index.html"
10
+ sed -i "s/TPL_SILENTIUM_COMPONENTS/https:\/\/cdn.jsdelivr.net\/npm\/silentium-components@0.0.1\/dist\/silentium-components.min.mjs/g" "index.html"
11
11
 
12
12
 
13
13
  cp template.html index-dev.html
@@ -17,4 +17,8 @@ sed -i "s/TPL_SILENTIUM_WEB_API/http:\/\/127.0.0.1:5501\/dist\/silentium-web-api
17
17
 
18
18
  sed -i "s/TPL_SILENTIUM_COMPONENTS/http:\/\/127.0.0.1:5500\/dist\/silentium-components.min.mjs/g" "index-dev.html"
19
19
 
20
+ sed -i "s/TPL_SILENTIUM_DESIGN/http:\/\/127.0.0.1:5502\/docs\/assets\/css\/custom.css/g" "index-dev.html"
21
+
20
22
  echo "DONE!"
23
+
24
+ ./buildRoutes.sh
@@ -0,0 +1,15 @@
1
+ #!/bin/bash
2
+
3
+ to_json_array() {
4
+ local dir="$1"
5
+ local output="$2"
6
+
7
+ # Используем mapfile для чтения списка файлов
8
+ mapfile -t files < <(find "$dir" -type f)
9
+
10
+ # Преобразуем массив в JSON с помощью jq
11
+ echo "$(echo ${files[@]} | jq -Rsc 'split(" ")')" > "$output"
12
+ }
13
+
14
+ # Вызываем функцию с аргументами: директорией и именем выходного файла
15
+ to_json_array "pages" "routes.json"
package/docs/favicon.ico CHANGED
Binary file
@@ -17,87 +17,11 @@
17
17
  />
18
18
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
19
19
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.9.0/highlightjs-line-numbers.min.js"></script>
20
- <link
21
- rel="apple-touch-icon"
22
- sizes="57x57"
23
- href="./assets/favicon/apple-icon-57x57.png"
24
- />
25
- <link
26
- rel="apple-touch-icon"
27
- sizes="60x60"
28
- href="./assets/favicon/apple-icon-60x60.png"
29
- />
30
- <link
31
- rel="apple-touch-icon"
32
- sizes="72x72"
33
- href="./assets/favicon/apple-icon-72x72.png"
34
- />
35
- <link
36
- rel="apple-touch-icon"
37
- sizes="76x76"
38
- href="./assets/favicon/apple-icon-76x76.png"
39
- />
40
- <link
41
- rel="apple-touch-icon"
42
- sizes="114x114"
43
- href="./assets/favicon/apple-icon-114x114.png"
44
- />
45
- <link
46
- rel="apple-touch-icon"
47
- sizes="120x120"
48
- href="./assets/favicon/apple-icon-120x120.png"
49
- />
50
- <link
51
- rel="apple-touch-icon"
52
- sizes="144x144"
53
- href="./assets/favicon/apple-icon-144x144.png"
54
- />
55
- <link
56
- rel="apple-touch-icon"
57
- sizes="152x152"
58
- href="./assets/favicon/apple-icon-152x152.png"
59
- />
60
- <link
61
- rel="apple-touch-icon"
62
- sizes="180x180"
63
- href="./assets/favicon/apple-icon-180x180.png"
64
- />
65
- <link
66
- rel="icon"
67
- type="image/png"
68
- sizes="192x192"
69
- href="./assets/favicon/android-icon-192x192.png"
70
- />
71
- <link
72
- rel="icon"
73
- type="image/png"
74
- sizes="32x32"
75
- href="./assets/favicon/favicon-32x32.png"
76
- />
77
- <link
78
- rel="icon"
79
- type="image/png"
80
- sizes="96x96"
81
- href="./assets/favicon/favicon-96x96.png"
82
- />
83
- <link
84
- rel="icon"
85
- type="image/png"
86
- sizes="16x16"
87
- href="./assets/favicon/favicon-16x16.png"
88
- />
89
- <link
90
- rel="manifest"
91
- href="./manifest.json"
92
- />
20
+ <link rel="icon" href="./favicon.ico" type="image/x-icon" />
93
21
  <meta
94
22
  name="msapplication-TileColor"
95
23
  content="#ffffff"
96
24
  />
97
- <meta
98
- name="msapplication-TileImage"
99
- content="./assets/favicon/ms-icon-144x144.png"
100
- />
101
25
  <meta
102
26
  name="theme-color"
103
27
  content="#ffffff"
@@ -109,7 +33,7 @@
109
33
  <script type="importmap">
110
34
  {
111
35
  "imports": {
112
- "silentium-oop": "http://127.0.0.1:5502/dist/silentium.min.mjs",
36
+ "silentium": "http://127.0.0.1:5502/dist/silentium.min.mjs",
113
37
  "silentium-web-api": "http://127.0.0.1:5501/dist/silentium-web-api.min.mjs",
114
38
  "silentium-components": "http://127.0.0.1:5500/dist/silentium-components.min.mjs"
115
39
  }
@@ -130,7 +54,7 @@
130
54
  class="ml-3 text-xl flex gap-2 items-center"
131
55
  >
132
56
  <img
133
- src="./assets/img/logo.jpg"
57
+ src="./assets/img/logo.svg"
134
58
  width="40"
135
59
  height="44"
136
60
  />
@@ -339,7 +263,7 @@
339
263
  </div>
340
264
  </footer>
341
265
  <script
342
- src="./assets/js/entrypoints/index.mjs"
266
+ src="./assets/js/index.mjs"
343
267
  type="module"
344
268
  ></script>
345
269
  </body>
package/docs/index.html CHANGED
@@ -17,87 +17,11 @@
17
17
  />
18
18
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
19
19
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.9.0/highlightjs-line-numbers.min.js"></script>
20
- <link
21
- rel="apple-touch-icon"
22
- sizes="57x57"
23
- href="./assets/favicon/apple-icon-57x57.png"
24
- />
25
- <link
26
- rel="apple-touch-icon"
27
- sizes="60x60"
28
- href="./assets/favicon/apple-icon-60x60.png"
29
- />
30
- <link
31
- rel="apple-touch-icon"
32
- sizes="72x72"
33
- href="./assets/favicon/apple-icon-72x72.png"
34
- />
35
- <link
36
- rel="apple-touch-icon"
37
- sizes="76x76"
38
- href="./assets/favicon/apple-icon-76x76.png"
39
- />
40
- <link
41
- rel="apple-touch-icon"
42
- sizes="114x114"
43
- href="./assets/favicon/apple-icon-114x114.png"
44
- />
45
- <link
46
- rel="apple-touch-icon"
47
- sizes="120x120"
48
- href="./assets/favicon/apple-icon-120x120.png"
49
- />
50
- <link
51
- rel="apple-touch-icon"
52
- sizes="144x144"
53
- href="./assets/favicon/apple-icon-144x144.png"
54
- />
55
- <link
56
- rel="apple-touch-icon"
57
- sizes="152x152"
58
- href="./assets/favicon/apple-icon-152x152.png"
59
- />
60
- <link
61
- rel="apple-touch-icon"
62
- sizes="180x180"
63
- href="./assets/favicon/apple-icon-180x180.png"
64
- />
65
- <link
66
- rel="icon"
67
- type="image/png"
68
- sizes="192x192"
69
- href="./assets/favicon/android-icon-192x192.png"
70
- />
71
- <link
72
- rel="icon"
73
- type="image/png"
74
- sizes="32x32"
75
- href="./assets/favicon/favicon-32x32.png"
76
- />
77
- <link
78
- rel="icon"
79
- type="image/png"
80
- sizes="96x96"
81
- href="./assets/favicon/favicon-96x96.png"
82
- />
83
- <link
84
- rel="icon"
85
- type="image/png"
86
- sizes="16x16"
87
- href="./assets/favicon/favicon-16x16.png"
88
- />
89
- <link
90
- rel="manifest"
91
- href="./manifest.json"
92
- />
20
+ <link rel="icon" href="./favicon.ico" type="image/x-icon" />
93
21
  <meta
94
22
  name="msapplication-TileColor"
95
23
  content="#ffffff"
96
24
  />
97
- <meta
98
- name="msapplication-TileImage"
99
- content="./assets/favicon/ms-icon-144x144.png"
100
- />
101
25
  <meta
102
26
  name="theme-color"
103
27
  content="#ffffff"
@@ -109,9 +33,9 @@
109
33
  <script type="importmap">
110
34
  {
111
35
  "imports": {
112
- "silentium-oop": "https://cdn.jsdelivr.net/npm/patron-oop@1.46.0/dist/patron.min.mjs",
113
- "silentium-web-api": "https://cdn.jsdelivr.net/npm/patron-web-api@1.14.0/dist/patron-web-api.min.mjs",
114
- "silentium-components": "https://cdn.jsdelivr.net/npm/patron-oop-components@1.20.0/dist/patron-components.min.mjs"
36
+ "silentium": "https://cdn.jsdelivr.net/npm/silentium@0.0.2/dist/silentium.min.mjs",
37
+ "silentium-web-api": "https://cdn.jsdelivr.net/npm/silentium-web-api@0.0.1/dist/silentium-web-api.min.mjs",
38
+ "silentium-components": "https://cdn.jsdelivr.net/npm/silentium-components@0.0.1/dist/silentium-components.min.mjs"
115
39
  }
116
40
  }
117
41
  </script>
@@ -130,7 +54,7 @@
130
54
  class="ml-3 text-xl flex gap-2 items-center"
131
55
  >
132
56
  <img
133
- src="./assets/img/logo.jpg"
57
+ src="./assets/img/logo.svg"
134
58
  width="40"
135
59
  height="44"
136
60
  />
@@ -339,7 +263,7 @@
339
263
  </div>
340
264
  </footer>
341
265
  <script
342
- src="./assets/js/entrypoints/index.mjs"
266
+ src="./assets/js/index.mjs"
343
267
  type="module"
344
268
  ></script>
345
269
  </body>
@@ -96,8 +96,8 @@
96
96
  SourceAll,
97
97
  GuestCast,
98
98
  GuestDisposable,
99
- } from "patron-oop";
100
- import { Text, Input } from "patron-components";
99
+ } from "silentium";
100
+ import { Text, Input } from "silentium-components";
101
101
 
102
102
  class NumberFromTimer {
103
103
  timerHead = null;
@@ -245,8 +245,8 @@
245
245
  SourceAll,
246
246
  GuestCast,
247
247
  GuestDisposable,
248
- } from "patron-oop";
249
- import { Text, Input } from "patron-components";
248
+ } from "silentium";
249
+ import { Text, Input } from "silentium-components";
250
250
 
251
251
  // Переместил клиентский код наверх,
252
252
  // чтобы не крутить до самой интересной части.
@@ -34,7 +34,7 @@
34
34
  <p class="text-gray-600 text-lg mb-0 font-bold">Пример 1.</p>
35
35
  <pre
36
36
  class="mb-4"
37
- ><code class="language-js">import { SourceActive, SourceEmpty, GuestCast, Patron } from "patron-oop";
37
+ ><code class="language-js">import { SourceActive, SourceEmpty, GuestCast, Patron } from "silentium";
38
38
 
39
39
  class Random {
40
40
  constructor(till) {
@@ -97,7 +97,7 @@
97
97
  </code></pre>
98
98
 
99
99
  <script type="module">
100
- import { SourceActive, SourceEmpty, GuestCast, Patron } from "patron-oop";
100
+ import { SourceActive, SourceEmpty, GuestCast, Patron } from "silentium";
101
101
 
102
102
  class Random {
103
103
  constructor(till) {
@@ -12,7 +12,7 @@
12
12
  <div class="w-12 h-1 bg-indigo-500 rounded mt-2 mb-4"></div>
13
13
  <ul class="text-gray-900">
14
14
  <li class="w-full border-b-2 border-neutral-100 py-4">
15
- <a href="/examples/errors"> Обработка ошибок </a>
15
+ <a class="dynamic-navigation" href="/examples/errors"> Обработка ошибок </a>
16
16
  </li>
17
17
  </ul>
18
18
  </div>
@@ -20,19 +20,17 @@
20
20
  <div
21
21
  class="w-full sm:w-2/3 sm:pl-8 sm:border-l border-gray-200 sm:border-t-0 border-t mt-4 sm:mt-0"
22
22
  >
23
- <div class="examples-loader">
24
- <div class="w-full flex justify-center">
25
- <div
26
- class="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-e-transparent align-[-0.125em] text-indigo-500 motion-reduce:animate-[spin_1.5s_linear_infinite]"
27
- role="status"
28
- >
29
- <span
30
- class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
31
- >Loading...</span
32
- >
33
- </div>
34
- </div>
35
- </div>
23
+ <h1 class="pb-3 text-xl font-semibold text-gray-600">
24
+ Примеры использования Patron
25
+ </h1>
26
+
27
+ <p class="text-gray-600 text-lg mb-4">
28
+ В этом разделе собраны примеры того, как можно использовать библиотеку Patron.
29
+ В других разделах этой документации также есть примеры, но этот раздел создан
30
+ для демонстрации более сложных вариантов не привязанных к конктретным
31
+ особенностями библиотеки.
32
+ </p>
33
+
36
34
  <div class="examples-page-area"></div>
37
35
  </div>
38
36
  </div>
@@ -1,3 +1,8 @@
1
+ <div class="breadcrumbs mb-4">
2
+ <link-dynamic href="/">Главная</link-dynamic>
3
+ <link-dynamic href="/guest">Guest</link-dynamic>
4
+ </div>
5
+
1
6
  <h1 class="pb-3 text-xl font-semibold text-gray-600">Класс GuestApplied</h1>
2
7
 
3
8
  <a href="https://github.com/kosukhin/patron/blob/main/src/Guest/GuestApplied.ts" target="_blank"
@@ -13,13 +18,13 @@
13
18
 
14
19
  <p class="text-gray-600 text-lg mb-4">
15
20
  В примере ниже, мы создаем гостя с примененной функцией удвоения значения.
16
- В результате до оригинального <link-dynamic href="/terminology/the-guest">гостя</link-dynamic> guest из источника доходит значение не 40 а 80.
21
+ В результате до оригинального <link-dynamic href="/terminology/guest">гостя</link-dynamic> guest из источника доходит значение не 40 а 80.
17
22
  </p>
18
23
 
19
24
  <p class="text-gray-600 text-lg mb-0 font-bold">Пример 1.</p>
20
25
  <pre
21
26
  class="mb-4 w-full"
22
- ><code class="language-js">import { Guest, GuestApplied, sourceOf } from "patron-oop";
27
+ ><code class="language-js">import { Guest, GuestApplied, sourceOf } from "silentium";
23
28
 
24
29
  const guest = new Guest((value) => {
25
30
  document.querySelector(
@@ -29,15 +34,14 @@ const guest = new Guest((value) => {
29
34
 
30
35
  sourceOf(40).value(
31
36
  new GuestApplied(guest, (x) => x * 2)
32
- );
33
- </code></pre>
37
+ );</code></pre>
34
38
 
35
39
  <p class="text-gray-600 text-lg mb-0 font-bold">Результат 1.</p>
36
40
  <div class="example mb-4">
37
41
  <span class="guest-result">Result here</span>
38
42
  </div>
39
43
  <script type="module">
40
- import { Guest, GuestApplied, sourceOf } from "patron-oop";
44
+ import { Guest, GuestApplied, sourceOf } from "silentium";
41
45
 
42
46
  const guest = new Guest((value) => {
43
47
  document.querySelector(
@@ -1,3 +1,8 @@
1
+ <div class="breadcrumbs mb-4">
2
+ <link-dynamic href="/">Главная</link-dynamic>
3
+ <link-dynamic href="/guest">Guest</link-dynamic>
4
+ </div>
5
+
1
6
  <h1 class="pb-3 text-xl font-semibold text-gray-600">Класс GuestCast</h1>
2
7
 
3
8
  <a
@@ -15,34 +20,23 @@
15
20
 
16
21
  <p class="text-gray-600 text-lg mb-4">
17
22
  Предназначен для наследования
18
- <span class="dynamic-navigation">
19
- <a
20
- class="inline-block whitespace-nowrap rounded-[0.27rem] bg-primary-100 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-white bg-slate-900"
21
- href="/terminology/introduction"
22
- >
23
- представления
24
- </a>
25
- </span>
23
+ <link-dynamic href="/terminology/introduction" >
24
+ представления
25
+ </link-dynamic>
26
26
  посетителя (introduction). Принимает 2 аргумента, если первый посетитель
27
27
  является -
28
- <span class="dynamic-navigation">
29
- <a
30
- class="inline-block whitespace-nowrap rounded-[0.27rem] bg-primary-100 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-white bg-slate-900"
31
- href="/terminology/the-guest"
32
- >
33
- гостем
34
- </a>
35
- </span>
28
+ <link-dynamic
29
+ href="/terminology/guest"
30
+ >
31
+ гостем
32
+ </link-dynamic>
36
33
  ('guest' или функция), то результирующий объект возьмет функциональность
37
34
  второго посетителя и будет тоже гостем. Если первый посетитель является
38
- <span class="dynamic-navigation">
39
- <a
40
- class="inline-block whitespace-nowrap rounded-[0.27rem] bg-primary-100 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-white bg-slate-900"
41
- href="/terminology/the-patron"
42
- >
43
- патроном
44
- </a>
45
- </span>
35
+ <link-dynamic
36
+ href="/terminology/patron"
37
+ >
38
+ патроном
39
+ </link-dynamic>
46
40
  , то результирующий объект возьмет функциональность второго посетителя, но
47
41
  будет так же патроном как и первый посетитель
48
42
  </p>
@@ -61,7 +55,7 @@
61
55
  GuestCast,
62
56
  removePatronFromPools,
63
57
  isPatronInPools,
64
- } from "patron-oop";
58
+ } from "silentium";
65
59
 
66
60
  class NumberOnceATime {
67
61
  constructor(number, delay) {
@@ -138,7 +132,7 @@
138
132
  GuestCast,
139
133
  removePatronFromPools,
140
134
  isPatronInPools,
141
- } from "patron-oop";
135
+ } from "silentium";
142
136
 
143
137
  class NumberOnceATime {
144
138
  constructor(number, delay) {