patron-oop 1.44.1 → 1.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/patron.cjs +359 -268
- package/dist/patron.cjs.map +1 -1
- package/dist/patron.d.ts +215 -150
- package/dist/patron.js +343 -261
- package/dist/patron.js.map +1 -1
- package/dist/patron.min.js +1 -1
- package/dist/patron.min.mjs +1 -1
- package/dist/patron.min.mjs.map +1 -1
- package/dist/patron.mjs +343 -261
- package/dist/patron.mjs.map +1 -1
- 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/js/components/linkDynamic.mjs +11 -0
- package/docs/assets/js/components/linkReloadable.mjs +13 -0
- package/docs/assets/js/entrypoints/compatibility.mjs +31 -0
- package/docs/assets/js/entrypoints/components.mjs +2 -0
- package/docs/assets/js/entrypoints/examples.mjs +25 -0
- package/docs/assets/js/entrypoints/factory.mjs +20 -0
- package/docs/assets/js/entrypoints/guest.mjs +61 -0
- package/docs/assets/js/entrypoints/index.mjs +110 -0
- package/docs/assets/js/entrypoints/integrations.mjs +36 -0
- package/docs/assets/js/entrypoints/patron.mjs +46 -0
- package/docs/assets/js/entrypoints/source.mjs +76 -0
- package/docs/assets/js/entrypoints/terminology.mjs +51 -0
- package/docs/assets/js/entrypoints/utils.mjs +61 -0
- package/docs/assets/js/lib/StyleFetched.mjs +14 -0
- package/docs/assets/js/routing.mjs +110 -0
- package/docs/assets/schemes/dip.html +28 -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 +113 -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/private.html +44 -0
- package/docs/pages/utils/remove-patron-from-pools.html +57 -0
- package/docs/pages/utils/value.html +47 -0
- package/docs/pages/utils.html +61 -0
- package/eslint.config.mjs +6 -0
- package/package.json +1 -1
- package/src/Guest/Guest.test.ts +11 -6
- package/src/Guest/Guest.ts +7 -14
- package/src/Guest/GuestApplied.test.ts +13 -0
- package/src/Guest/GuestApplied.ts +16 -0
- package/src/Guest/GuestCast.test.ts +4 -5
- package/src/Guest/GuestCast.ts +3 -10
- package/src/Guest/GuestDisposable.test.ts +13 -17
- package/src/Guest/GuestDisposable.ts +3 -3
- package/src/Guest/GuestExecutorApplied.test.ts +27 -0
- package/src/Guest/GuestExecutorApplied.ts +23 -0
- package/src/Guest/GuestObject.test.ts +6 -6
- package/src/Guest/GuestObject.ts +3 -3
- package/src/Guest/GuestPool.test.ts +5 -22
- package/src/Guest/GuestPool.ts +7 -8
- package/src/Guest/GuestSync.test.ts +2 -2
- package/src/Patron/Patron.test.ts +4 -5
- package/src/Patron/Patron.ts +11 -3
- package/src/Patron/PatronApplied.ts +22 -0
- package/src/Patron/PatronExecutorApplied.ts +25 -0
- package/src/Patron/PatronOnce.sourceEmpty.test.ts +2 -2
- package/src/Patron/PatronOnce.test.ts +2 -2
- package/src/Patron/PatronOnce.ts +3 -9
- package/src/Patron/PatronPool.test.ts +2 -1
- package/src/Patron/PatronPool.ts +22 -27
- package/src/Private/PrivateClass.modules.test.ts +11 -8
- package/src/Private/PrivateClass.test.ts +7 -6
- package/src/Source/Source.test.ts +9 -5
- package/src/Source/Source.ts +46 -30
- 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/{Guest/GuestAwareAll.ts → Source/SourceAll.ts} +11 -11
- package/src/Source/SourceApplied.test.ts +14 -0
- package/src/Source/SourceApplied.ts +23 -0
- package/src/Source/SourceDynamic.ofSource.test.ts +12 -12
- package/src/Source/SourceDynamic.test.ts +9 -9
- package/src/Source/SourceDynamic.ts +7 -7
- 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 +4 -4
- package/src/Source/SourceOnce.test.ts +4 -5
- package/src/Source/SourceOnce.ts +7 -13
- 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/{Guest/GuestAwareSequence.ts → Source/SourceSequence.ts} +14 -19
- 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 +13 -7
- package/test-utils/debounce.ts +11 -0
- package/test-utils/id.ts +1 -0
- package/test-utils/wait.ts +6 -3
- package/src/Guest/GuestAware.test.ts +0 -13
- package/src/Guest/GuestAware.ts +0 -59
- package/src/Guest/GuestAwareActive.test.ts +0 -12
- package/src/Guest/GuestAwareActive.ts +0 -42
- package/src/Guest/GuestAwareAll._asArray.test.ts +0 -19
- package/src/Guest/GuestAwareAll._twoValuesAfter.test.ts +0 -16
- package/src/Guest/GuestAwareAll._twoValuesBefore.test.ts +0 -16
- package/src/Guest/GuestAwareAll._withPatron.test.ts +0 -22
- package/src/Guest/GuestAwareMap.defered.test.ts +0 -46
- package/src/Guest/GuestAwareMap.fn.test.ts +0 -27
- package/src/Guest/GuestAwareMap.test.ts +0 -29
- package/src/Guest/GuestAwareMap.ts +0 -48
- package/src/Guest/GuestAwareRace.test.ts +0 -46
- package/src/Guest/GuestAwareRace.ts +0 -33
- package/src/Guest/GuestAwareSequence.defered.test.ts +0 -58
- package/src/Guest/GuestAwareSequence.test.ts +0 -30
- package/src/Source/SourceEmpty.test.ts +0 -20
- package/src/Source/SourceEmpty.ts +0 -31
package/dist/patron.js
CHANGED
@@ -1,36 +1,4 @@
|
|
1
|
-
function
|
2
|
-
if (guestAware === void 0) {
|
3
|
-
throw new Error("value didnt receive guestAware argument");
|
4
|
-
}
|
5
|
-
if (guest === void 0) {
|
6
|
-
throw new Error("value didnt receive guest argument");
|
7
|
-
}
|
8
|
-
if (typeof guestAware === "function") {
|
9
|
-
return guestAware(guest);
|
10
|
-
} else {
|
11
|
-
return guestAware.value(guest);
|
12
|
-
}
|
13
|
-
}
|
14
|
-
function isGuestAware(mbGuestAware) {
|
15
|
-
if (mbGuestAware === void 0) {
|
16
|
-
throw new Error("isGuestAware didnt receive mbGuestAware argument");
|
17
|
-
}
|
18
|
-
return typeof mbGuestAware === "function" || typeof mbGuestAware?.value === "function";
|
19
|
-
}
|
20
|
-
class GuestAware {
|
21
|
-
constructor(guestAware) {
|
22
|
-
this.guestAware = guestAware;
|
23
|
-
if (guestAware === void 0) {
|
24
|
-
throw new Error("GuestAware constructor didnt receive executor function");
|
25
|
-
}
|
26
|
-
}
|
27
|
-
value(guest) {
|
28
|
-
value(this.guestAware, guest);
|
29
|
-
return guest;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
function give(data, guest, options) {
|
1
|
+
function give(data, guest) {
|
34
2
|
if (data === void 0) {
|
35
3
|
throw new Error("give didnt receive data argument");
|
36
4
|
}
|
@@ -38,9 +6,9 @@ function give(data, guest, options) {
|
|
38
6
|
throw new Error("give didnt receive guest argument");
|
39
7
|
}
|
40
8
|
if (typeof guest === "function") {
|
41
|
-
guest(data
|
9
|
+
guest(data);
|
42
10
|
} else {
|
43
|
-
guest.give(data
|
11
|
+
guest.give(data);
|
44
12
|
}
|
45
13
|
}
|
46
14
|
function isGuest(mbGuest) {
|
@@ -56,40 +24,10 @@ class Guest {
|
|
56
24
|
throw new Error("reseiver function was not passed to Guest constructor");
|
57
25
|
}
|
58
26
|
}
|
59
|
-
give(value
|
60
|
-
this.receiver(value
|
61
|
-
return this;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
var __defProp$6 = Object.defineProperty;
|
66
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
67
|
-
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
68
|
-
class PatronOnce {
|
69
|
-
constructor(baseGuest) {
|
70
|
-
this.baseGuest = baseGuest;
|
71
|
-
__publicField$6(this, "received", false);
|
72
|
-
if (baseGuest === void 0) {
|
73
|
-
throw new Error("PatronOnce didnt receive baseGuest argument");
|
74
|
-
}
|
75
|
-
}
|
76
|
-
introduction() {
|
77
|
-
return "patron";
|
78
|
-
}
|
79
|
-
give(value, options) {
|
80
|
-
if (!this.received) {
|
81
|
-
this.received = true;
|
82
|
-
give(value, this.baseGuest, options);
|
83
|
-
}
|
27
|
+
give(value) {
|
28
|
+
this.receiver(value);
|
84
29
|
return this;
|
85
30
|
}
|
86
|
-
disposed(value) {
|
87
|
-
if (this.received) {
|
88
|
-
return true;
|
89
|
-
}
|
90
|
-
const maybeDisposable = this.baseGuest;
|
91
|
-
return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;
|
92
|
-
}
|
93
31
|
}
|
94
32
|
|
95
33
|
class GuestCast {
|
@@ -112,14 +50,8 @@ class GuestCast {
|
|
112
50
|
}
|
113
51
|
return this.sourceGuest.introduction();
|
114
52
|
}
|
115
|
-
give(value
|
116
|
-
give(value, this.targetGuest
|
117
|
-
...options,
|
118
|
-
data: {
|
119
|
-
...options?.data ?? {},
|
120
|
-
castedGuest: options?.data?.castedGuest ?? this
|
121
|
-
}
|
122
|
-
});
|
53
|
+
give(value) {
|
54
|
+
give(value, this.targetGuest);
|
123
55
|
return this;
|
124
56
|
}
|
125
57
|
disposed(value) {
|
@@ -128,10 +60,19 @@ class GuestCast {
|
|
128
60
|
}
|
129
61
|
}
|
130
62
|
|
131
|
-
var __defProp$
|
132
|
-
var __defNormalProp$
|
133
|
-
var __publicField$
|
63
|
+
var __defProp$a = Object.defineProperty;
|
64
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
65
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
134
66
|
const poolSets = /* @__PURE__ */ new Map();
|
67
|
+
const patronPools = (patron) => {
|
68
|
+
const pools = [];
|
69
|
+
poolSets.forEach((pool, poolInstance) => {
|
70
|
+
if (pool.has(patron)) {
|
71
|
+
pools.push(poolInstance);
|
72
|
+
}
|
73
|
+
});
|
74
|
+
return pools;
|
75
|
+
};
|
135
76
|
const removePatronFromPools = (patron) => {
|
136
77
|
if (patron === void 0) {
|
137
78
|
throw new Error("removePatronFromPools didnt receive patron argument");
|
@@ -155,24 +96,17 @@ const isPatronInPools = (patron) => {
|
|
155
96
|
class PatronPool {
|
156
97
|
constructor(initiator) {
|
157
98
|
this.initiator = initiator;
|
158
|
-
__publicField$
|
159
|
-
__publicField$
|
99
|
+
__publicField$a(this, "patrons");
|
100
|
+
__publicField$a(this, "give");
|
160
101
|
this.patrons = /* @__PURE__ */ new Set();
|
161
102
|
poolSets.set(this, this.patrons);
|
162
|
-
|
163
|
-
const doReceive = (value, options) => {
|
103
|
+
const doReceive = (value) => {
|
164
104
|
this.patrons.forEach((target) => {
|
165
|
-
this.sendValueToGuest(value, target
|
105
|
+
this.sendValueToGuest(value, target);
|
166
106
|
});
|
167
107
|
};
|
168
|
-
this.give = (value
|
169
|
-
|
170
|
-
if (currentMicroTask === lastMicrotask) {
|
171
|
-
doReceive(value, options);
|
172
|
-
}
|
173
|
-
};
|
174
|
-
lastMicrotask = currentMicroTask;
|
175
|
-
queueMicrotask(currentMicroTask);
|
108
|
+
this.give = (value) => {
|
109
|
+
doReceive(value);
|
176
110
|
return this;
|
177
111
|
};
|
178
112
|
}
|
@@ -194,20 +128,13 @@ class PatronPool {
|
|
194
128
|
}
|
195
129
|
distribute(receiving, possiblePatron) {
|
196
130
|
this.add(possiblePatron);
|
197
|
-
this.sendValueToGuest(receiving, possiblePatron
|
131
|
+
this.sendValueToGuest(receiving, possiblePatron);
|
198
132
|
return this;
|
199
133
|
}
|
200
|
-
sendValueToGuest(value, guest
|
134
|
+
sendValueToGuest(value, guest) {
|
201
135
|
const isDisposed = this.guestDisposed(value, guest);
|
202
136
|
if (!isDisposed) {
|
203
|
-
give(value, guest
|
204
|
-
...options,
|
205
|
-
data: {
|
206
|
-
...options?.data ?? {},
|
207
|
-
initiator: this.initiator,
|
208
|
-
pool: this
|
209
|
-
}
|
210
|
-
});
|
137
|
+
give(value, guest);
|
211
138
|
}
|
212
139
|
}
|
213
140
|
guestDisposed(value, guest) {
|
@@ -219,58 +146,61 @@ class PatronPool {
|
|
219
146
|
}
|
220
147
|
}
|
221
148
|
|
222
|
-
var __defProp$
|
223
|
-
var __defNormalProp$
|
224
|
-
var __publicField$
|
225
|
-
class
|
226
|
-
constructor(
|
227
|
-
this
|
228
|
-
__publicField$
|
229
|
-
|
230
|
-
throw new Error("Source didnt receive sourceDocument argument");
|
231
|
-
}
|
232
|
-
}
|
233
|
-
pool() {
|
234
|
-
return this.thePool;
|
149
|
+
var __defProp$9 = Object.defineProperty;
|
150
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
151
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
152
|
+
class GuestPool {
|
153
|
+
constructor(initiator) {
|
154
|
+
__publicField$9(this, "guests", /* @__PURE__ */ new Set());
|
155
|
+
__publicField$9(this, "patronPool");
|
156
|
+
this.patronPool = new PatronPool(initiator);
|
235
157
|
}
|
236
158
|
give(value) {
|
237
|
-
this.
|
238
|
-
this.
|
159
|
+
this.deliverToGuests(value);
|
160
|
+
this.patronPool.give(value);
|
239
161
|
return this;
|
240
162
|
}
|
241
|
-
|
242
|
-
if (typeof guest === "function") {
|
243
|
-
this.
|
244
|
-
} else {
|
245
|
-
this.thePool.distribute(this.sourceDocument, guest);
|
163
|
+
add(guest) {
|
164
|
+
if (typeof guest === "function" || !guest.introduction || guest.introduction() === "guest") {
|
165
|
+
this.guests.add(guest);
|
246
166
|
}
|
167
|
+
this.patronPool.add(guest);
|
247
168
|
return this;
|
248
169
|
}
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
|
254
|
-
class SourceEmpty {
|
255
|
-
constructor() {
|
256
|
-
__publicField$3(this, "baseSource", new Source(null));
|
170
|
+
remove(patron) {
|
171
|
+
this.guests.delete(patron);
|
172
|
+
this.patronPool.remove(patron);
|
173
|
+
return this;
|
257
174
|
}
|
258
|
-
|
259
|
-
this.
|
260
|
-
|
261
|
-
if (value !== null) {
|
262
|
-
give(value, guest, options);
|
263
|
-
}
|
264
|
-
})
|
265
|
-
);
|
175
|
+
distribute(receiving, possiblePatron) {
|
176
|
+
this.add(possiblePatron);
|
177
|
+
this.give(receiving);
|
266
178
|
return this;
|
267
179
|
}
|
180
|
+
size() {
|
181
|
+
return this.patronPool.size() + this.guests.size;
|
182
|
+
}
|
183
|
+
deliverToGuests(value) {
|
184
|
+
this.guests.forEach((target) => {
|
185
|
+
give(value, target);
|
186
|
+
});
|
187
|
+
this.guests.clear();
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
class GuestSync {
|
192
|
+
constructor(theValue) {
|
193
|
+
this.theValue = theValue;
|
194
|
+
if (theValue === void 0) {
|
195
|
+
throw new Error("GuestSync didnt receive theValue argument");
|
196
|
+
}
|
197
|
+
}
|
268
198
|
give(value) {
|
269
|
-
this.
|
199
|
+
this.theValue = value;
|
270
200
|
return this;
|
271
201
|
}
|
272
|
-
|
273
|
-
return this.
|
202
|
+
value() {
|
203
|
+
return this.theValue;
|
274
204
|
}
|
275
205
|
}
|
276
206
|
|
@@ -281,12 +211,12 @@ class GuestObject {
|
|
281
211
|
throw new Error("GuestObject didnt receive baseGuest argument");
|
282
212
|
}
|
283
213
|
}
|
284
|
-
give(value
|
214
|
+
give(value) {
|
285
215
|
let guest = this.baseGuest;
|
286
216
|
if (typeof guest === "function") {
|
287
217
|
guest = new Guest(guest);
|
288
218
|
}
|
289
|
-
guest.give(value
|
219
|
+
guest.give(value);
|
290
220
|
return this;
|
291
221
|
}
|
292
222
|
introduction() {
|
@@ -301,58 +231,182 @@ class GuestObject {
|
|
301
231
|
}
|
302
232
|
}
|
303
233
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
234
|
+
class GuestDisposable {
|
235
|
+
constructor(guest, disposeCheck) {
|
236
|
+
this.guest = guest;
|
237
|
+
this.disposeCheck = disposeCheck;
|
238
|
+
if (guest === void 0) {
|
239
|
+
throw new Error("GuestDisposable didnt receive guest argument");
|
240
|
+
}
|
241
|
+
if (disposeCheck === void 0) {
|
242
|
+
throw new Error("GuestDisposable didnt receive disposeCheck argument");
|
243
|
+
}
|
312
244
|
}
|
313
|
-
|
314
|
-
this.
|
315
|
-
|
245
|
+
disposed(value) {
|
246
|
+
return this.disposeCheck(value);
|
247
|
+
}
|
248
|
+
give(value) {
|
249
|
+
give(value, this.guest);
|
316
250
|
return this;
|
317
251
|
}
|
318
|
-
|
319
|
-
|
320
|
-
|
252
|
+
}
|
253
|
+
|
254
|
+
class GuestApplied {
|
255
|
+
constructor(baseGuest, applier) {
|
256
|
+
this.baseGuest = baseGuest;
|
257
|
+
this.applier = applier;
|
258
|
+
}
|
259
|
+
give(value) {
|
260
|
+
give(this.applier(value), this.baseGuest);
|
261
|
+
return this;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
var __defProp$8 = Object.defineProperty;
|
266
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
267
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
268
|
+
class GuestExecutorApplied {
|
269
|
+
constructor(baseGuest, applier) {
|
270
|
+
__publicField$8(this, "give");
|
271
|
+
this.give = applier((v) => give(v, baseGuest));
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
class Patron {
|
276
|
+
constructor(willBePatron) {
|
277
|
+
this.willBePatron = willBePatron;
|
278
|
+
if (willBePatron === void 0) {
|
279
|
+
throw new Error("Patron didnt receive willBePatron argument");
|
321
280
|
}
|
322
|
-
|
281
|
+
}
|
282
|
+
introduction() {
|
283
|
+
return "patron";
|
284
|
+
}
|
285
|
+
give(value) {
|
286
|
+
give(value, this.willBePatron);
|
323
287
|
return this;
|
324
288
|
}
|
325
|
-
|
326
|
-
this.
|
327
|
-
|
289
|
+
disposed(value) {
|
290
|
+
const maybeDisposable = this.willBePatron;
|
291
|
+
return maybeDisposable?.disposed?.(value) || false;
|
292
|
+
}
|
293
|
+
}
|
294
|
+
const isPatron = (guest) => typeof guest === "object" && guest !== null && guest?.introduction?.() === "patron";
|
295
|
+
|
296
|
+
var __defProp$7 = Object.defineProperty;
|
297
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
298
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
|
299
|
+
class PatronOnce {
|
300
|
+
constructor(baseGuest) {
|
301
|
+
this.baseGuest = baseGuest;
|
302
|
+
__publicField$7(this, "received", false);
|
303
|
+
if (baseGuest === void 0) {
|
304
|
+
throw new Error("PatronOnce didnt receive baseGuest argument");
|
305
|
+
}
|
306
|
+
}
|
307
|
+
introduction() {
|
308
|
+
return "patron";
|
309
|
+
}
|
310
|
+
give(value) {
|
311
|
+
if (!this.received) {
|
312
|
+
this.received = true;
|
313
|
+
give(value, this.baseGuest);
|
314
|
+
}
|
328
315
|
return this;
|
329
316
|
}
|
330
|
-
|
331
|
-
this.
|
332
|
-
|
317
|
+
disposed(value) {
|
318
|
+
if (this.received) {
|
319
|
+
return true;
|
320
|
+
}
|
321
|
+
const maybeDisposable = this.baseGuest;
|
322
|
+
return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
|
326
|
+
var __defProp$6 = Object.defineProperty;
|
327
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
328
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
329
|
+
class PatronApplied {
|
330
|
+
constructor(baseGuest, applier) {
|
331
|
+
__publicField$6(this, "guestApplied");
|
332
|
+
this.guestApplied = new GuestApplied(baseGuest, applier);
|
333
|
+
}
|
334
|
+
give(value) {
|
335
|
+
this.guestApplied.give(value);
|
333
336
|
return this;
|
334
337
|
}
|
335
|
-
|
336
|
-
return
|
338
|
+
introduction() {
|
339
|
+
return "patron";
|
337
340
|
}
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
341
|
+
}
|
342
|
+
|
343
|
+
var __defProp$5 = Object.defineProperty;
|
344
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
345
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
|
346
|
+
class PatronExecutorApplied {
|
347
|
+
constructor(baseGuest, applier) {
|
348
|
+
__publicField$5(this, "guestApplied");
|
349
|
+
this.guestApplied = new GuestExecutorApplied(baseGuest, applier);
|
350
|
+
}
|
351
|
+
give(value) {
|
352
|
+
this.guestApplied.give(value);
|
353
|
+
return this;
|
354
|
+
}
|
355
|
+
introduction() {
|
356
|
+
return "patron";
|
343
357
|
}
|
344
358
|
}
|
345
359
|
|
346
|
-
var __defProp$
|
347
|
-
var __defNormalProp$
|
348
|
-
var __publicField$
|
349
|
-
class
|
360
|
+
var __defProp$4 = Object.defineProperty;
|
361
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
362
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
363
|
+
class SourceWithPool {
|
364
|
+
constructor(sourceDocument) {
|
365
|
+
this.sourceDocument = sourceDocument;
|
366
|
+
__publicField$4(this, "thePool", new PatronPool(this));
|
367
|
+
__publicField$4(this, "theEmptyPool", new PatronPool(this));
|
368
|
+
__publicField$4(this, "isEmpty");
|
369
|
+
this.isEmpty = sourceDocument === void 0;
|
370
|
+
}
|
371
|
+
pool() {
|
372
|
+
return this.thePool;
|
373
|
+
}
|
374
|
+
give(value) {
|
375
|
+
this.isEmpty = false;
|
376
|
+
this.sourceDocument = value;
|
377
|
+
this.thePool.give(this.sourceDocument);
|
378
|
+
this.theEmptyPool.give(this.sourceDocument);
|
379
|
+
return this;
|
380
|
+
}
|
381
|
+
value(guest) {
|
382
|
+
if (this.isEmpty) {
|
383
|
+
if (isPatron(guest)) {
|
384
|
+
this.theEmptyPool.add(guest);
|
385
|
+
}
|
386
|
+
return this;
|
387
|
+
}
|
388
|
+
if (typeof guest === "function") {
|
389
|
+
this.thePool.distribute(this.sourceDocument, new Guest(guest));
|
390
|
+
} else {
|
391
|
+
this.thePool.distribute(this.sourceDocument, guest);
|
392
|
+
}
|
393
|
+
return this;
|
394
|
+
}
|
395
|
+
filled() {
|
396
|
+
return !this.isEmpty;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
var __defProp$3 = Object.defineProperty;
|
401
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
402
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
403
|
+
class SourceAll {
|
350
404
|
constructor(initialKnownKeys = []) {
|
351
|
-
__publicField$
|
352
|
-
__publicField$
|
353
|
-
__publicField$
|
354
|
-
__publicField$
|
355
|
-
this.theAll = new
|
405
|
+
__publicField$3(this, "theAll");
|
406
|
+
__publicField$3(this, "keysKnown");
|
407
|
+
__publicField$3(this, "keysFilled", /* @__PURE__ */ new Set());
|
408
|
+
__publicField$3(this, "filledAllPool", new GuestPool(this));
|
409
|
+
this.theAll = new SourceWithPool({});
|
356
410
|
this.keysKnown = new Set(initialKnownKeys);
|
357
411
|
}
|
358
412
|
valueArray(guest) {
|
@@ -408,20 +462,53 @@ class GuestAwareAll {
|
|
408
462
|
}
|
409
463
|
}
|
410
464
|
|
411
|
-
|
465
|
+
function value(source, guest) {
|
466
|
+
if (source === void 0) {
|
467
|
+
throw new Error("value didnt receive source argument");
|
468
|
+
}
|
469
|
+
if (guest === void 0) {
|
470
|
+
throw new Error("value didnt receive guest argument");
|
471
|
+
}
|
472
|
+
if (typeof source === "function") {
|
473
|
+
return source(guest);
|
474
|
+
} else {
|
475
|
+
return source.value(guest);
|
476
|
+
}
|
477
|
+
}
|
478
|
+
function isSource(mbSource) {
|
479
|
+
if (mbSource === void 0) {
|
480
|
+
throw new Error("isSource didnt receive mbSource argument");
|
481
|
+
}
|
482
|
+
return typeof mbSource === "function" || typeof mbSource?.value === "function";
|
483
|
+
}
|
484
|
+
class Source {
|
485
|
+
constructor(source) {
|
486
|
+
this.source = source;
|
487
|
+
if (source === void 0) {
|
488
|
+
throw new Error("Source constructor didnt receive executor function");
|
489
|
+
}
|
490
|
+
}
|
491
|
+
value(guest) {
|
492
|
+
value(this.source, guest);
|
493
|
+
return guest;
|
494
|
+
}
|
495
|
+
}
|
496
|
+
const sourceOf = (value2) => new Source((g) => give(value2, g));
|
497
|
+
|
498
|
+
class SourceSequence {
|
412
499
|
constructor(baseSource, targetSource) {
|
413
500
|
this.baseSource = baseSource;
|
414
501
|
this.targetSource = targetSource;
|
415
502
|
if (baseSource === void 0) {
|
416
|
-
throw new Error("
|
503
|
+
throw new Error("SourceSequence didnt receive baseSource argument");
|
417
504
|
}
|
418
505
|
if (targetSource === void 0) {
|
419
|
-
throw new Error("
|
506
|
+
throw new Error("SourceSequence didnt receive targetSource argument");
|
420
507
|
}
|
421
508
|
}
|
422
509
|
value(guest) {
|
423
|
-
const all = new
|
424
|
-
const sequenceSource = new
|
510
|
+
const all = new SourceAll();
|
511
|
+
const sequenceSource = new SourceWithPool();
|
425
512
|
const targetSource = this.targetSource.get(sequenceSource);
|
426
513
|
value(
|
427
514
|
this.baseSource,
|
@@ -438,7 +525,7 @@ class GuestAwareSequence {
|
|
438
525
|
function handle() {
|
439
526
|
sequenceSource.give(null);
|
440
527
|
const nextValue = theValue[index];
|
441
|
-
if (
|
528
|
+
if (isSource(nextValue)) {
|
442
529
|
value(
|
443
530
|
nextValue,
|
444
531
|
new PatronOnce((theNextValue) => {
|
@@ -464,24 +551,24 @@ class GuestAwareSequence {
|
|
464
551
|
}
|
465
552
|
}
|
466
553
|
|
467
|
-
class
|
554
|
+
class SourceMap {
|
468
555
|
constructor(baseSource, targetSource) {
|
469
556
|
this.baseSource = baseSource;
|
470
557
|
this.targetSource = targetSource;
|
471
558
|
if (baseSource === void 0) {
|
472
|
-
throw new Error("
|
559
|
+
throw new Error("SourceMap didnt receive baseSource argument");
|
473
560
|
}
|
474
561
|
if (targetSource === void 0) {
|
475
|
-
throw new Error("
|
562
|
+
throw new Error("SourceMap didnt receive targetSource argument");
|
476
563
|
}
|
477
564
|
}
|
478
565
|
value(guest) {
|
479
|
-
const all = new
|
566
|
+
const all = new SourceAll();
|
480
567
|
value(
|
481
568
|
this.baseSource,
|
482
569
|
new GuestCast(guest, (theValue) => {
|
483
570
|
theValue.forEach((val, index) => {
|
484
|
-
const valueSource =
|
571
|
+
const valueSource = isSource(val) ? val : new Source((innerGuest) => {
|
485
572
|
give(val, innerGuest);
|
486
573
|
});
|
487
574
|
const targetSource = this.targetSource.get(valueSource);
|
@@ -494,22 +581,22 @@ class GuestAwareMap {
|
|
494
581
|
}
|
495
582
|
}
|
496
583
|
|
497
|
-
class
|
498
|
-
constructor(
|
499
|
-
this.
|
500
|
-
if (
|
501
|
-
throw new Error("
|
584
|
+
class SourceRace {
|
585
|
+
constructor(sources) {
|
586
|
+
this.sources = sources;
|
587
|
+
if (sources === void 0) {
|
588
|
+
throw new Error("SourceRace didnt receive sources argument");
|
502
589
|
}
|
503
590
|
}
|
504
591
|
value(guest) {
|
505
|
-
let
|
506
|
-
this.
|
592
|
+
let connectedWithSource = null;
|
593
|
+
this.sources.forEach((source) => {
|
507
594
|
value(
|
508
|
-
|
595
|
+
source,
|
509
596
|
new GuestCast(guest, (value2) => {
|
510
|
-
if (!
|
597
|
+
if (!connectedWithSource || connectedWithSource === source) {
|
511
598
|
give(value2, guest);
|
512
|
-
|
599
|
+
connectedWithSource = source;
|
513
600
|
}
|
514
601
|
})
|
515
602
|
);
|
@@ -518,16 +605,16 @@ class GuestAwareRace {
|
|
518
605
|
}
|
519
606
|
}
|
520
607
|
|
521
|
-
var __defProp = Object.defineProperty;
|
522
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
523
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
524
|
-
class
|
608
|
+
var __defProp$2 = Object.defineProperty;
|
609
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
610
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
|
611
|
+
class SourceActive {
|
525
612
|
constructor(configExecutor) {
|
526
613
|
this.configExecutor = configExecutor;
|
527
|
-
__publicField(this, "source", new
|
614
|
+
__publicField$2(this, "source", new SourceWithPool());
|
528
615
|
if (configExecutor === void 0) {
|
529
616
|
throw new Error(
|
530
|
-
"
|
617
|
+
"SourceActive constructor didnt receive executor function"
|
531
618
|
);
|
532
619
|
}
|
533
620
|
}
|
@@ -541,83 +628,78 @@ class GuestAwareActive {
|
|
541
628
|
}
|
542
629
|
}
|
543
630
|
|
544
|
-
class
|
545
|
-
constructor(
|
546
|
-
this.
|
547
|
-
|
548
|
-
|
631
|
+
class SourceDynamic {
|
632
|
+
constructor(baseGuest, baseSource) {
|
633
|
+
this.baseGuest = baseGuest;
|
634
|
+
this.baseSource = baseSource;
|
635
|
+
if (baseGuest === void 0) {
|
636
|
+
throw new Error("SourceDynamic didnt receive baseGuest argument");
|
637
|
+
}
|
638
|
+
if (baseSource === void 0) {
|
639
|
+
throw new Error("SourceDynamic didnt receive baseSource argument");
|
549
640
|
}
|
550
641
|
}
|
551
|
-
|
552
|
-
this.
|
642
|
+
value(guest) {
|
643
|
+
value(this.baseSource, guest);
|
553
644
|
return this;
|
554
645
|
}
|
555
|
-
|
556
|
-
|
646
|
+
give(value2) {
|
647
|
+
give(value2, this.baseGuest);
|
648
|
+
return this;
|
649
|
+
}
|
650
|
+
pool() {
|
651
|
+
throw Error("No pool in SourceDynamic");
|
557
652
|
}
|
558
653
|
}
|
559
654
|
|
560
|
-
class
|
561
|
-
constructor(
|
562
|
-
this.
|
563
|
-
this.
|
564
|
-
if (guest === void 0) {
|
565
|
-
throw new Error("GuestDisposable didnt receive guest argument");
|
566
|
-
}
|
567
|
-
if (disposeCheck === void 0) {
|
568
|
-
throw new Error("GuestDisposable didnt receive disposeCheck argument");
|
569
|
-
}
|
570
|
-
}
|
571
|
-
disposed(value) {
|
572
|
-
return this.disposeCheck(value);
|
655
|
+
class SourceApplied {
|
656
|
+
constructor(baseSource, applier) {
|
657
|
+
this.baseSource = baseSource;
|
658
|
+
this.applier = applier;
|
573
659
|
}
|
574
|
-
|
575
|
-
|
660
|
+
value(g) {
|
661
|
+
value(
|
662
|
+
this.baseSource,
|
663
|
+
new GuestCast(g, (v) => {
|
664
|
+
give(this.applier(v), g);
|
665
|
+
})
|
666
|
+
);
|
576
667
|
return this;
|
577
668
|
}
|
578
669
|
}
|
579
670
|
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
}
|
590
|
-
give(value, options) {
|
591
|
-
give(value, this.willBePatron, options);
|
592
|
-
return this;
|
593
|
-
}
|
594
|
-
disposed(value) {
|
595
|
-
const maybeDisposable = this.willBePatron;
|
596
|
-
return maybeDisposable?.disposed?.(value) || false;
|
671
|
+
var __defProp$1 = Object.defineProperty;
|
672
|
+
var __defNormalProp$1 = (obj, key, value2) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
|
673
|
+
var __publicField$1 = (obj, key, value2) => __defNormalProp$1(obj, key + "" , value2);
|
674
|
+
class SourceExecutorApplied {
|
675
|
+
constructor(source, applier) {
|
676
|
+
__publicField$1(this, "value");
|
677
|
+
this.value = applier((g) => {
|
678
|
+
value(source, g);
|
679
|
+
});
|
597
680
|
}
|
598
681
|
}
|
599
682
|
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
if (baseGuestAware === void 0) {
|
608
|
-
throw new Error("SourceDynamic didnt receive baseGuestAware argument");
|
609
|
-
}
|
683
|
+
var __defProp = Object.defineProperty;
|
684
|
+
var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
|
685
|
+
var __publicField = (obj, key, value2) => __defNormalProp(obj, key + "" , value2);
|
686
|
+
class SourceOnce {
|
687
|
+
constructor(initialValue) {
|
688
|
+
__publicField(this, "source");
|
689
|
+
this.source = new SourceWithPool(initialValue);
|
610
690
|
}
|
611
691
|
value(guest) {
|
612
|
-
value(this.
|
692
|
+
value(this.source, guest);
|
613
693
|
return this;
|
614
694
|
}
|
615
695
|
give(value2) {
|
616
|
-
|
696
|
+
if (!this.source.filled()) {
|
697
|
+
this.source.give(value2);
|
698
|
+
}
|
617
699
|
return this;
|
618
700
|
}
|
619
701
|
pool() {
|
620
|
-
|
702
|
+
return this.source.pool();
|
621
703
|
}
|
622
704
|
}
|
623
705
|
|
@@ -649,5 +731,5 @@ class Private {
|
|
649
731
|
}
|
650
732
|
}
|
651
733
|
|
652
|
-
export { Guest,
|
734
|
+
export { Guest, GuestApplied, GuestCast, GuestDisposable, GuestExecutorApplied, GuestObject, GuestPool, GuestSync, Patron, PatronApplied, PatronExecutorApplied, PatronOnce, PatronPool, Private, PrivateClass, Source, SourceActive, SourceAll, SourceApplied, SourceDynamic, SourceExecutorApplied, SourceMap, SourceOnce, SourceRace, SourceSequence, SourceWithPool, give, isGuest, isPatron, isPatronInPools, isSource, patronPools, removePatronFromPools, sourceOf, value };
|
653
735
|
//# sourceMappingURL=patron.js.map
|