silentium 0.0.2
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/.husky/pre-commit +1 -0
- package/.husky/pre-push +2 -0
- package/.vscode/settings.json +8 -0
- package/CHANGELOG.md +12 -0
- package/LICENSE.md +7 -0
- package/README.md +3 -0
- package/commitizen.cjs +50 -0
- package/dist/silentium.cjs +771 -0
- package/dist/silentium.cjs.map +1 -0
- package/dist/silentium.d.ts +365 -0
- package/dist/silentium.js +735 -0
- package/dist/silentium.js.map +1 -0
- package/dist/silentium.min.js +1 -0
- package/dist/silentium.min.mjs +2 -0
- package/dist/silentium.min.mjs.map +1 -0
- package/dist/silentium.mjs +735 -0
- package/dist/silentium.mjs.map +1 -0
- package/docs/README.md +3 -0
- package/docs/assets/css/base.css +42 -0
- package/docs/assets/favicon/android-icon-144x144.png +0 -0
- package/docs/assets/favicon/android-icon-192x192.png +0 -0
- package/docs/assets/favicon/android-icon-36x36.png +0 -0
- package/docs/assets/favicon/android-icon-48x48.png +0 -0
- package/docs/assets/favicon/android-icon-72x72.png +0 -0
- package/docs/assets/favicon/android-icon-96x96.png +0 -0
- package/docs/assets/favicon/apple-icon-114x114.png +0 -0
- package/docs/assets/favicon/apple-icon-120x120.png +0 -0
- package/docs/assets/favicon/apple-icon-144x144.png +0 -0
- package/docs/assets/favicon/apple-icon-152x152.png +0 -0
- package/docs/assets/favicon/apple-icon-180x180.png +0 -0
- package/docs/assets/favicon/apple-icon-57x57.png +0 -0
- package/docs/assets/favicon/apple-icon-60x60.png +0 -0
- package/docs/assets/favicon/apple-icon-72x72.png +0 -0
- package/docs/assets/favicon/apple-icon-76x76.png +0 -0
- package/docs/assets/favicon/apple-icon-precomposed.png +0 -0
- package/docs/assets/favicon/apple-icon.png +0 -0
- package/docs/assets/favicon/browserconfig.xml +2 -0
- package/docs/assets/favicon/favicon-16x16.png +0 -0
- package/docs/assets/favicon/favicon-32x32.png +0 -0
- package/docs/assets/favicon/favicon-96x96.png +0 -0
- package/docs/assets/favicon/favicon.ico +0 -0
- package/docs/assets/favicon/manifest.json +41 -0
- package/docs/assets/favicon/ms-icon-144x144.png +0 -0
- package/docs/assets/favicon/ms-icon-150x150.png +0 -0
- package/docs/assets/favicon/ms-icon-310x310.png +0 -0
- package/docs/assets/favicon/ms-icon-70x70.png +0 -0
- package/docs/assets/img/404.jpg +0 -0
- package/docs/assets/img/angular_16.jpg +0 -0
- package/docs/assets/img/angular_32.jpg +0 -0
- package/docs/assets/img/eo_16.jpg +0 -0
- package/docs/assets/img/eo_big.png +0 -0
- package/docs/assets/img/github_16.jpg +0 -0
- package/docs/assets/img/logo.jpg +0 -0
- package/docs/assets/img/philosofy/observable.jpg +0 -0
- package/docs/assets/img/philosofy/responsible.jpg +0 -0
- package/docs/assets/img/philosofy/result.jpg +0 -0
- package/docs/assets/img/philosofy/tell.jpg +0 -0
- package/docs/assets/img/react_16.jpg +0 -0
- package/docs/assets/img/react_32.jpg +0 -0
- package/docs/assets/img/vue_16.jpg +0 -0
- package/docs/assets/img/vue_32.jpg +0 -0
- package/docs/assets/schemes/dip.html +28 -0
- package/docs/build.sh +20 -0
- package/docs/favicon.ico +0 -0
- package/docs/index-dev.html +346 -0
- package/docs/index.html +346 -0
- package/docs/manifest.json +41 -0
- package/docs/pages/404.html +9 -0
- package/docs/pages/common/layout.html +17 -0
- package/docs/pages/compatibility/dip.html +82 -0
- package/docs/pages/compatibility/elegant-objects.html +373 -0
- package/docs/pages/compatibility/layout.html +17 -0
- package/docs/pages/examples/errors.html +167 -0
- package/docs/pages/examples/index.html +10 -0
- package/docs/pages/examples.html +41 -0
- package/docs/pages/factory/index.html +18 -0
- package/docs/pages/factory.html +36 -0
- package/docs/pages/guest/guest-applied.html +51 -0
- package/docs/pages/guest/guest-cast.html +219 -0
- package/docs/pages/guest/guest-disposable.html +147 -0
- package/docs/pages/guest/guest-executor-applied.html +65 -0
- package/docs/pages/guest/guest-object.html +101 -0
- package/docs/pages/guest/guest-pool.html +107 -0
- package/docs/pages/guest/guest-sync.html +66 -0
- package/docs/pages/guest/index.html +115 -0
- package/docs/pages/guest.html +59 -0
- package/docs/pages/index.html +72 -0
- package/docs/pages/integrations/angular.html +5 -0
- package/docs/pages/integrations/layout.html +17 -0
- package/docs/pages/integrations/react.html +7 -0
- package/docs/pages/integrations/vue.html +102 -0
- package/docs/pages/patron/index.html +140 -0
- package/docs/pages/patron/patron-applied.html +66 -0
- package/docs/pages/patron/patron-executor-applied.html +94 -0
- package/docs/pages/patron/patron-once.html +110 -0
- package/docs/pages/patron/patron-pool.html +99 -0
- package/docs/pages/patron.html +50 -0
- package/docs/pages/philosofy.html +210 -0
- package/docs/pages/source/index.html +167 -0
- package/docs/pages/source/source-active.html +120 -0
- package/docs/pages/source/source-all.html +129 -0
- package/docs/pages/source/source-applied.html +73 -0
- package/docs/pages/source/source-dynamic.html +93 -0
- package/docs/pages/source/source-executor-applied.html +64 -0
- package/docs/pages/source/source-map.html +192 -0
- package/docs/pages/source/source-once.html +73 -0
- package/docs/pages/source/source-race.html +171 -0
- package/docs/pages/source/source-sequence.html +160 -0
- package/docs/pages/source/source-with-pool.html +102 -0
- package/docs/pages/source/source.html +167 -0
- package/docs/pages/source.html +68 -0
- package/docs/pages/terminology/guest.html +14 -0
- package/docs/pages/terminology/index.html +6 -0
- package/docs/pages/terminology/introduction.html +25 -0
- package/docs/pages/terminology/patron.html +10 -0
- package/docs/pages/terminology/source.html +55 -0
- package/docs/pages/terminology/visitor.html +19 -0
- package/docs/pages/terminology.html +53 -0
- package/docs/pages/utils/give.html +47 -0
- package/docs/pages/utils/index.html +24 -0
- package/docs/pages/utils/is-guest-aware.html +22 -0
- package/docs/pages/utils/is-guest.html +21 -0
- package/docs/pages/utils/is-patron-in-pools.html +53 -0
- package/docs/pages/utils/is-source.html +21 -0
- package/docs/pages/utils/private.html +44 -0
- package/docs/pages/utils/remove-patron-from-pools.html +57 -0
- package/docs/pages/utils/source-of.html +20 -0
- package/docs/pages/utils/value.html +47 -0
- package/docs/pages/utils.html +64 -0
- package/docs/template.html +346 -0
- package/eslint.config.mjs +47 -0
- package/package.json +57 -0
- package/rollup.config.js +52 -0
- package/src/Guest/Guest.test.ts +15 -0
- package/src/Guest/Guest.ts +53 -0
- package/src/Guest/GuestApplied.test.ts +13 -0
- package/src/Guest/GuestApplied.ts +16 -0
- package/src/Guest/GuestCast.test.ts +30 -0
- package/src/Guest/GuestCast.ts +39 -0
- package/src/Guest/GuestDisposable.test.ts +26 -0
- package/src/Guest/GuestDisposable.ts +33 -0
- package/src/Guest/GuestExecutorApplied.test.ts +27 -0
- package/src/Guest/GuestExecutorApplied.ts +23 -0
- package/src/Guest/GuestObject.test.ts +11 -0
- package/src/Guest/GuestObject.ts +34 -0
- package/src/Guest/GuestPool.test.ts +30 -0
- package/src/Guest/GuestPool.ts +56 -0
- package/src/Guest/GuestSync.test.ts +12 -0
- package/src/Guest/GuestSync.ts +25 -0
- package/src/Patron/Patron.test.ts +16 -0
- package/src/Patron/Patron.ts +35 -0
- package/src/Patron/PatronApplied.ts +22 -0
- package/src/Patron/PatronExecutorApplied.ts +25 -0
- package/src/Patron/PatronOnce.sourceEmpty.test.ts +38 -0
- package/src/Patron/PatronOnce.test.ts +32 -0
- package/src/Patron/PatronOnce.ts +38 -0
- package/src/Patron/PatronPool.test.ts +22 -0
- package/src/Patron/PatronPool.ts +121 -0
- package/src/Private/Private.test.ts +12 -0
- package/src/Private/Private.ts +20 -0
- package/src/Private/PrivateClass.modules.test.ts +36 -0
- package/src/Private/PrivateClass.test.ts +13 -0
- package/src/Private/PrivateClass.ts +29 -0
- package/src/Source/Source.test.ts +14 -0
- package/src/Source/Source.ts +59 -0
- package/src/Source/SourceActive.test.ts +13 -0
- package/src/Source/SourceActive.ts +41 -0
- package/src/Source/SourceAll._asArray.test.ts +22 -0
- package/src/Source/SourceAll._twoValuesAfter.test.ts +19 -0
- package/src/Source/SourceAll._twoValuesBefore.test.ts +19 -0
- package/src/Source/SourceAll._withPatron.test.ts +25 -0
- package/src/Source/SourceAll.ts +86 -0
- package/src/Source/SourceApplied.test.ts +14 -0
- package/src/Source/SourceApplied.ts +23 -0
- package/src/Source/SourceDynamic.ofSource.test.ts +21 -0
- package/src/Source/SourceDynamic.test.ts +26 -0
- package/src/Source/SourceDynamic.ts +35 -0
- package/src/Source/SourceExecutorApplied.test.ts +30 -0
- package/src/Source/SourceExecutorApplied.ts +22 -0
- package/src/Source/SourceMap.defered.test.ts +46 -0
- package/src/Source/SourceMap.fn.test.ts +27 -0
- package/src/Source/SourceMap.test.ts +32 -0
- package/src/Source/SourceMap.ts +48 -0
- package/src/Source/SourceOnce.notcalled.test.ts +13 -0
- package/src/Source/SourceOnce.test.ts +10 -0
- package/src/Source/SourceOnce.ts +31 -0
- package/src/Source/SourceRace.test.ts +46 -0
- package/src/Source/SourceRace.ts +30 -0
- package/src/Source/SourceSequence.defered.test.ts +53 -0
- package/src/Source/SourceSequence.test.ts +30 -0
- package/src/Source/SourceSequence.ts +72 -0
- package/src/Source/SourceWithPool.empty.test.ts +14 -0
- package/src/Source/SourceWithPool.test.ts +10 -0
- package/src/Source/SourceWithPool.ts +58 -0
- package/src/index.ts +26 -0
- package/test-utils/debounce.ts +11 -0
- package/test-utils/id.ts +1 -0
- package/test-utils/wait.ts +6 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ru">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
|
|
8
|
+
/>
|
|
9
|
+
<meta
|
|
10
|
+
http-equiv="X-UA-Compatible"
|
|
11
|
+
content="ie=edge"
|
|
12
|
+
/>
|
|
13
|
+
<title>Идет загрузка...</title>
|
|
14
|
+
<link
|
|
15
|
+
rel="stylesheet"
|
|
16
|
+
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css"
|
|
17
|
+
/>
|
|
18
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
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
|
+
/>
|
|
93
|
+
<meta
|
|
94
|
+
name="msapplication-TileColor"
|
|
95
|
+
content="#ffffff"
|
|
96
|
+
/>
|
|
97
|
+
<meta
|
|
98
|
+
name="msapplication-TileImage"
|
|
99
|
+
content="./assets/favicon/ms-icon-144x144.png"
|
|
100
|
+
/>
|
|
101
|
+
<meta
|
|
102
|
+
name="theme-color"
|
|
103
|
+
content="#ffffff"
|
|
104
|
+
/>
|
|
105
|
+
<link
|
|
106
|
+
rel="stylesheet"
|
|
107
|
+
href="./assets/css/base.css"
|
|
108
|
+
/>
|
|
109
|
+
<script type="importmap">
|
|
110
|
+
{
|
|
111
|
+
"imports": {
|
|
112
|
+
"silentium-oop": "TPL_SILENTIUM_OOP",
|
|
113
|
+
"silentium-web-api": "TPL_SILENTIUM_WEB_API",
|
|
114
|
+
"silentium-components": "TPL_SILENTIUM_COMPONENTS"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
</head>
|
|
119
|
+
|
|
120
|
+
<body class="flex flex-col h-full global-body body-loading">
|
|
121
|
+
<header class="text-gray-600 body-font">
|
|
122
|
+
<div
|
|
123
|
+
class="container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center menu"
|
|
124
|
+
>
|
|
125
|
+
<div
|
|
126
|
+
class="flex title-font font-medium items-center text-gray-900 mb-4 md:mb-0"
|
|
127
|
+
>
|
|
128
|
+
<a
|
|
129
|
+
href="/"
|
|
130
|
+
class="ml-3 text-xl flex gap-2 items-center"
|
|
131
|
+
>
|
|
132
|
+
<img
|
|
133
|
+
src="./assets/img/logo.jpg"
|
|
134
|
+
width="40"
|
|
135
|
+
height="44"
|
|
136
|
+
/>
|
|
137
|
+
Silentium
|
|
138
|
+
</a>
|
|
139
|
+
</div>
|
|
140
|
+
<nav
|
|
141
|
+
class="md:mr-auto md:ml-4 md:py-1 md:pl-4 md:border-l md:border-gray-400 flex flex-wrap items-center text-base justify-center"
|
|
142
|
+
>
|
|
143
|
+
<a
|
|
144
|
+
class="mr-5 hover:text-gray-900"
|
|
145
|
+
href="/philosofy"
|
|
146
|
+
>Философия</a
|
|
147
|
+
>
|
|
148
|
+
<a
|
|
149
|
+
class="mr-5 hover:text-gray-900"
|
|
150
|
+
href="/guest"
|
|
151
|
+
>Guest</a
|
|
152
|
+
>
|
|
153
|
+
<a
|
|
154
|
+
class="mr-5 hover:text-gray-900"
|
|
155
|
+
href="/patron"
|
|
156
|
+
>Patron</a
|
|
157
|
+
>
|
|
158
|
+
<a
|
|
159
|
+
class="mr-5 hover:text-gray-900"
|
|
160
|
+
href="/source"
|
|
161
|
+
>Source</a
|
|
162
|
+
>
|
|
163
|
+
</nav>
|
|
164
|
+
<button
|
|
165
|
+
onclick="location.href='https://github.com/kosukhin/patron'"
|
|
166
|
+
class="inline-flex gap-1 items-center bg-gray-100 border-0 py-1 px-3 focus:outline-none hover:bg-gray-200 rounded text-base mt-4 md:mt-0"
|
|
167
|
+
>
|
|
168
|
+
<img
|
|
169
|
+
src="./assets/img/github_16.jpg"
|
|
170
|
+
width="16"
|
|
171
|
+
height="16"
|
|
172
|
+
/>
|
|
173
|
+
GitHub
|
|
174
|
+
<svg
|
|
175
|
+
fill="none"
|
|
176
|
+
stroke="currentColor"
|
|
177
|
+
stroke-linecap="round"
|
|
178
|
+
stroke-linejoin="round"
|
|
179
|
+
stroke-width="2"
|
|
180
|
+
class="w-4 h-4 ml-1"
|
|
181
|
+
viewBox="0 0 24 24"
|
|
182
|
+
>
|
|
183
|
+
<path d="M5 12h14M12 5l7 7-7 7"></path>
|
|
184
|
+
</svg>
|
|
185
|
+
</button>
|
|
186
|
+
</div>
|
|
187
|
+
</header>
|
|
188
|
+
<article class="container mx-auto p-5">
|
|
189
|
+
<div class="loader">
|
|
190
|
+
<div class="w-full flex justify-center">
|
|
191
|
+
<div
|
|
192
|
+
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]"
|
|
193
|
+
role="status"
|
|
194
|
+
>
|
|
195
|
+
<span
|
|
196
|
+
class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
|
|
197
|
+
>Loading...</span
|
|
198
|
+
>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="page-area"></div>
|
|
203
|
+
</article>
|
|
204
|
+
<footer class="text-gray-600 body-font mt-auto">
|
|
205
|
+
<div class="border-t border-gray-200">
|
|
206
|
+
<div class="container px-5 py-8 flex flex-wrap gap-6 mx-auto">
|
|
207
|
+
<div>
|
|
208
|
+
<h6
|
|
209
|
+
class="mb-4 flex flex-wrap justify-center font-semibold uppercase md:justify-start"
|
|
210
|
+
>
|
|
211
|
+
Интеграции
|
|
212
|
+
</h6>
|
|
213
|
+
<div class="flex flex-col gap-2 menu">
|
|
214
|
+
<a
|
|
215
|
+
class="flex gap-1 items-center"
|
|
216
|
+
href="/integrations/vue"
|
|
217
|
+
>
|
|
218
|
+
<img
|
|
219
|
+
src="./assets/img/vue_16.jpg"
|
|
220
|
+
width="16"
|
|
221
|
+
/>
|
|
222
|
+
Vue
|
|
223
|
+
</a>
|
|
224
|
+
<a
|
|
225
|
+
class="flex gap-1 items-center"
|
|
226
|
+
href="/integrations/react"
|
|
227
|
+
>
|
|
228
|
+
<img
|
|
229
|
+
src="./assets/img/react_16.jpg"
|
|
230
|
+
width="16"
|
|
231
|
+
/>
|
|
232
|
+
React
|
|
233
|
+
</a>
|
|
234
|
+
<a
|
|
235
|
+
class="flex gap-1 items-center"
|
|
236
|
+
href="/integrations/angular"
|
|
237
|
+
>
|
|
238
|
+
<img
|
|
239
|
+
src="./assets/img/angular_16.jpg"
|
|
240
|
+
width="16"
|
|
241
|
+
/>
|
|
242
|
+
Angular
|
|
243
|
+
</a>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
<div>
|
|
247
|
+
<h6
|
|
248
|
+
class="mb-4 flex justify-center font-semibold uppercase md:justify-start"
|
|
249
|
+
>
|
|
250
|
+
Совместимость
|
|
251
|
+
</h6>
|
|
252
|
+
<div class="flex flex-col gap-2 menu">
|
|
253
|
+
<a
|
|
254
|
+
href="/compatibility/elegant-objects"
|
|
255
|
+
class="flex gap-1 items-center"
|
|
256
|
+
>
|
|
257
|
+
<img
|
|
258
|
+
src="./assets/img/eo_16.jpg"
|
|
259
|
+
width="16"
|
|
260
|
+
/>
|
|
261
|
+
Elegant Objects
|
|
262
|
+
</a>
|
|
263
|
+
<a
|
|
264
|
+
href="/compatibility/dip"
|
|
265
|
+
class="flex gap-1 items-center"
|
|
266
|
+
>
|
|
267
|
+
DIP
|
|
268
|
+
</a>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
<div>
|
|
272
|
+
<h6
|
|
273
|
+
class="mb-4 flex justify-center font-semibold uppercase md:justify-start"
|
|
274
|
+
>
|
|
275
|
+
Дополнительно
|
|
276
|
+
</h6>
|
|
277
|
+
<div class="flex flex-col gap-2 menu">
|
|
278
|
+
<div class="flex gap-1 items-center">
|
|
279
|
+
<a href="/utils">Утилиты</a>
|
|
280
|
+
</div>
|
|
281
|
+
<div class="flex gap-1 items-center">
|
|
282
|
+
<a href="/terminology">Термины</a>
|
|
283
|
+
</div>
|
|
284
|
+
<div class="flex gap-1 items-center">
|
|
285
|
+
<a href="/examples">Примеры</a>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
</div>
|
|
289
|
+
<div>
|
|
290
|
+
<h6 class="mb-4 flex font-semibold uppercase md:justify-start">
|
|
291
|
+
Библиотеки
|
|
292
|
+
</h6>
|
|
293
|
+
<div class="flex flex-col gap-2 menu">
|
|
294
|
+
<div class="flex gap-1 items-center">
|
|
295
|
+
<a
|
|
296
|
+
href="https://kosukhin.github.io/patron-components/"
|
|
297
|
+
target="_blank"
|
|
298
|
+
>Silentium-Компоненты</a
|
|
299
|
+
>
|
|
300
|
+
</div>
|
|
301
|
+
<div class="flex gap-1 items-center">
|
|
302
|
+
<a
|
|
303
|
+
href="https://kosukhin.github.io/patron-web-api/#/"
|
|
304
|
+
target="_blank"
|
|
305
|
+
>Silentium-WEB-API</a
|
|
306
|
+
>
|
|
307
|
+
</div>
|
|
308
|
+
<div class="flex gap-1 items-center">
|
|
309
|
+
<a
|
|
310
|
+
href="https://kosukhin.github.io/patron-web-api.site/"
|
|
311
|
+
target="_blank"
|
|
312
|
+
>Silentium Редактор схем</a
|
|
313
|
+
>
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
<div class="bg-gray-100">
|
|
320
|
+
<div
|
|
321
|
+
class="container mx-auto py-4 px-5 flex flex-wrap flex-col sm:flex-row"
|
|
322
|
+
>
|
|
323
|
+
<p class="text-gray-500 text-sm">
|
|
324
|
+
© 2025 Silentium —
|
|
325
|
+
<a
|
|
326
|
+
href="https://github.com/kosukhin/patron"
|
|
327
|
+
class="text-gray-600 ml-1"
|
|
328
|
+
target="_blank"
|
|
329
|
+
rel="noopener noreferrer"
|
|
330
|
+
>@silentium</a
|
|
331
|
+
>
|
|
332
|
+
</p>
|
|
333
|
+
<span
|
|
334
|
+
class="sm:ml-auto sm:mt-0 mt-2 sm:w-auto w-full sm:text-left text-center text-gray-500 text-sm"
|
|
335
|
+
>
|
|
336
|
+
for responsible objects
|
|
337
|
+
</span>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
</footer>
|
|
341
|
+
<script
|
|
342
|
+
src="./assets/js/entrypoints/index.mjs"
|
|
343
|
+
type="module"
|
|
344
|
+
></script>
|
|
345
|
+
</body>
|
|
346
|
+
</html>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
2
|
+
import tsParser from "@typescript-eslint/parser";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import js from "@eslint/js";
|
|
6
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
|
7
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
const compat = new FlatCompat({
|
|
12
|
+
baseDirectory: __dirname,
|
|
13
|
+
recommendedConfig: js.configs.recommended,
|
|
14
|
+
allConfig: js.configs.all,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
{
|
|
19
|
+
ignores: ["**/node_modules", "**/dist"],
|
|
20
|
+
},
|
|
21
|
+
...compat.extends(
|
|
22
|
+
"eslint:recommended",
|
|
23
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
24
|
+
"plugin:@typescript-eslint/recommended",
|
|
25
|
+
),
|
|
26
|
+
{
|
|
27
|
+
rules: {
|
|
28
|
+
"@typescript-eslint/no-explicit-any": ["off"],
|
|
29
|
+
"prettier.bracketSpacing": ["off"],
|
|
30
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
31
|
+
"error",
|
|
32
|
+
{
|
|
33
|
+
accessibility: "explicit",
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
plugins: {
|
|
40
|
+
"@typescript-eslint": typescriptEslint,
|
|
41
|
+
},
|
|
42
|
+
languageOptions: {
|
|
43
|
+
parser: tsParser,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
eslintPluginPrettierRecommended,
|
|
47
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "silentium",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/silentium.js",
|
|
7
|
+
"module": "dist/silentium.mjs",
|
|
8
|
+
"typings": "dist/silentium.d.ts",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"oop",
|
|
11
|
+
"fp"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "rollup -c",
|
|
15
|
+
"build-doc": "./docs/build.sh",
|
|
16
|
+
"lint": "eslint src",
|
|
17
|
+
"lint-fix": "eslint src --fix",
|
|
18
|
+
"test": "vitest",
|
|
19
|
+
"cz": "git add . && git cz",
|
|
20
|
+
"push-head": "git push origin HEAD",
|
|
21
|
+
"test-debug": "env DEBUG=app:* vitest",
|
|
22
|
+
"release": "npm run build && standard-version --no-verify && git push --follow-tags && npm publish",
|
|
23
|
+
"prepare": "husky"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/silentium-lab/silentium.git"
|
|
28
|
+
},
|
|
29
|
+
"private": false,
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
32
|
+
"@eslint/js": "^9.12.0",
|
|
33
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
35
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
36
|
+
"cz-customizable": "^7.0.0",
|
|
37
|
+
"esbuild": "^0.25.0",
|
|
38
|
+
"eslint": "^9.12.0",
|
|
39
|
+
"eslint-config-prettier": "^9.1.0",
|
|
40
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
41
|
+
"husky": "^9.1.7",
|
|
42
|
+
"prettier": "3.3.3",
|
|
43
|
+
"rollup": "^4.24.0",
|
|
44
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
45
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
46
|
+
"standard-version": "^9.5.0",
|
|
47
|
+
"vitest": "^3.0.6"
|
|
48
|
+
},
|
|
49
|
+
"config": {
|
|
50
|
+
"commitizen": {
|
|
51
|
+
"path": "./node_modules/cz-customizable"
|
|
52
|
+
},
|
|
53
|
+
"cz-customizable": {
|
|
54
|
+
"config": "./commitizen.cjs"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import dts from "rollup-plugin-dts";
|
|
2
|
+
import esbuild from "rollup-plugin-esbuild";
|
|
3
|
+
import terser from "@rollup/plugin-terser";
|
|
4
|
+
|
|
5
|
+
const name = "dist/silentium";
|
|
6
|
+
|
|
7
|
+
const bundle = (config) => ({
|
|
8
|
+
...config,
|
|
9
|
+
input: "src/index.ts",
|
|
10
|
+
external: (id) => !/^[./]/.test(id),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default [
|
|
14
|
+
bundle({
|
|
15
|
+
plugins: [esbuild()],
|
|
16
|
+
output: [
|
|
17
|
+
{
|
|
18
|
+
file: `${name}.cjs`,
|
|
19
|
+
format: "cjs",
|
|
20
|
+
sourcemap: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
file: `${name}.js`,
|
|
24
|
+
format: "es",
|
|
25
|
+
sourcemap: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
file: `${name}.mjs`,
|
|
29
|
+
format: "es",
|
|
30
|
+
sourcemap: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
file: `${name}.min.mjs`,
|
|
34
|
+
format: "es",
|
|
35
|
+
plugins: [terser()],
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
file: `${name}.min.js`,
|
|
40
|
+
format: "iife",
|
|
41
|
+
plugins: [terser()],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}),
|
|
45
|
+
bundle({
|
|
46
|
+
plugins: [dts()],
|
|
47
|
+
output: {
|
|
48
|
+
file: `${name}.d.ts`,
|
|
49
|
+
format: "es",
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, test, vitest } from "vitest";
|
|
2
|
+
import { SourceWithPool } from "../Source/SourceWithPool";
|
|
3
|
+
import { Guest } from "../Guest/Guest";
|
|
4
|
+
|
|
5
|
+
test("Guest.test", () => {
|
|
6
|
+
const one = new SourceWithPool(1);
|
|
7
|
+
|
|
8
|
+
const guest1 = vitest.fn();
|
|
9
|
+
one.value(guest1);
|
|
10
|
+
expect(guest1).toBeCalledWith(1);
|
|
11
|
+
|
|
12
|
+
const guest2 = vitest.fn();
|
|
13
|
+
one.value(new Guest(guest2));
|
|
14
|
+
expect(guest2).toBeCalledWith(1);
|
|
15
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
type GuestIntroduction = "guest" | "patron";
|
|
2
|
+
|
|
3
|
+
export type GuestExecutorType<T = any, This = void> = (value: T) => This;
|
|
4
|
+
|
|
5
|
+
export interface GuestObjectType<T = any> {
|
|
6
|
+
give(value: T): this;
|
|
7
|
+
introduction?(): GuestIntroduction;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/give
|
|
14
|
+
*/
|
|
15
|
+
export function give<T>(data: T, guest: GuestType<T>) {
|
|
16
|
+
if (data === undefined) {
|
|
17
|
+
throw new Error("give didnt receive data argument");
|
|
18
|
+
}
|
|
19
|
+
if (guest === undefined) {
|
|
20
|
+
throw new Error("give didnt receive guest argument");
|
|
21
|
+
}
|
|
22
|
+
if (typeof guest === "function") {
|
|
23
|
+
guest(data);
|
|
24
|
+
} else {
|
|
25
|
+
guest.give(data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @url https://kosukhin.github.io/patron.site/#/utils/is-guest
|
|
31
|
+
*/
|
|
32
|
+
export function isGuest(mbGuest: any): mbGuest is GuestType {
|
|
33
|
+
if (mbGuest === undefined) {
|
|
34
|
+
throw new Error("isGuest didnt receive mbGuest argument");
|
|
35
|
+
}
|
|
36
|
+
return typeof mbGuest === "function" || typeof mbGuest?.give === "function";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @url https://kosukhin.github.io/patron.site/#/guest
|
|
41
|
+
*/
|
|
42
|
+
export class Guest<T> implements GuestObjectType<T> {
|
|
43
|
+
public constructor(private receiver: GuestExecutorType<T>) {
|
|
44
|
+
if (!receiver) {
|
|
45
|
+
throw new Error("reseiver function was not passed to Guest constructor");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public give(value: T) {
|
|
50
|
+
this.receiver(value);
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GuestApplied } from "../Guest/GuestApplied";
|
|
2
|
+
import { expect, test, vitest } from "vitest";
|
|
3
|
+
import { SourceWithPool } from "../Source/SourceWithPool";
|
|
4
|
+
|
|
5
|
+
test("GuestApplied.test", () => {
|
|
6
|
+
const one = new SourceWithPool(1);
|
|
7
|
+
const guest = vitest.fn();
|
|
8
|
+
|
|
9
|
+
one.value(new GuestApplied(guest, (v) => v * 2));
|
|
10
|
+
|
|
11
|
+
expect(guest).toBeCalled();
|
|
12
|
+
expect(guest).toBeCalledWith(2);
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { give, GuestObjectType, GuestType } from "../Guest/Guest";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-applied
|
|
5
|
+
*/
|
|
6
|
+
export class GuestApplied<T, R> implements GuestObjectType<T> {
|
|
7
|
+
public constructor(
|
|
8
|
+
private baseGuest: GuestType<R>,
|
|
9
|
+
private applier: (value: T) => R,
|
|
10
|
+
) {}
|
|
11
|
+
|
|
12
|
+
public give(value: T): this {
|
|
13
|
+
give(this.applier(value), this.baseGuest);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import { Patron } from "../Patron/Patron";
|
|
3
|
+
import { give, Guest } from "./Guest";
|
|
4
|
+
import { GuestCast } from "./GuestCast";
|
|
5
|
+
import { SourceWithPool } from "../Source/SourceWithPool";
|
|
6
|
+
|
|
7
|
+
test("GuestCast.test", () => {
|
|
8
|
+
const source = new SourceWithPool();
|
|
9
|
+
let acc = 0;
|
|
10
|
+
const mainGuest = new Patron(
|
|
11
|
+
new Guest((value: number) => {
|
|
12
|
+
acc += value;
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// Становится патроном тоже, тк наследует это сойство от mainGuest
|
|
17
|
+
const secondGuest = new GuestCast(
|
|
18
|
+
mainGuest,
|
|
19
|
+
new Guest((value: number) => {
|
|
20
|
+
acc += value;
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
source.value(mainGuest);
|
|
25
|
+
source.value(secondGuest);
|
|
26
|
+
|
|
27
|
+
give(2, source);
|
|
28
|
+
|
|
29
|
+
expect(acc).toBe(4);
|
|
30
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { give, GuestType } from "./Guest";
|
|
2
|
+
import { GuestDisposableType, MaybeDisposableType } from "./GuestDisposable";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @url https://kosukhin.github.io/patron.site/#/guest/guest-cast
|
|
6
|
+
*/
|
|
7
|
+
export class GuestCast<T> implements GuestDisposableType<T> {
|
|
8
|
+
public constructor(
|
|
9
|
+
private sourceGuest: GuestType<any>,
|
|
10
|
+
private targetGuest: GuestType<T>,
|
|
11
|
+
) {
|
|
12
|
+
if (sourceGuest === undefined) {
|
|
13
|
+
throw new Error("GuestCast didnt receive sourceGuest argument");
|
|
14
|
+
}
|
|
15
|
+
if (targetGuest === undefined) {
|
|
16
|
+
throw new Error("GuestCast didnt receive targetGuest argument");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public introduction() {
|
|
21
|
+
if (typeof this.sourceGuest === "function") {
|
|
22
|
+
return "guest";
|
|
23
|
+
}
|
|
24
|
+
if (!this.sourceGuest.introduction) {
|
|
25
|
+
return "guest";
|
|
26
|
+
}
|
|
27
|
+
return this.sourceGuest.introduction();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public give(value: T): this {
|
|
31
|
+
give(value, this.targetGuest);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public disposed(value: T | null): boolean {
|
|
36
|
+
const maybeDisposable = this.sourceGuest as MaybeDisposableType;
|
|
37
|
+
return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;
|
|
38
|
+
}
|
|
39
|
+
}
|