@kithinji/orca 1.0.26 → 1.0.29
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/dist/browser/index.iife.js +429 -714
- package/dist/browser/index.iife.js.map +4 -4
- package/dist/browser/index.mjs +1272 -750
- package/dist/browser/index.mjs.map +4 -4
- package/dist/node/index.cjs +563 -676
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.mjs +543 -647
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/browser/factory.d.ts +1 -1
- package/dist/types/browser/factory.d.ts.map +1 -1
- package/dist/types/browser/modules/router_module/navigate.d.ts +13 -5
- package/dist/types/browser/modules/router_module/navigate.d.ts.map +1 -1
- package/dist/types/browser/modules/router_module/outlet.d.ts +3 -2
- package/dist/types/browser/modules/router_module/outlet.d.ts.map +1 -1
- package/dist/types/index.browser.d.ts +0 -2
- package/dist/types/index.browser.d.ts.map +1 -1
- package/dist/types/index.node.d.ts +0 -2
- package/dist/types/index.node.d.ts.map +1 -1
- package/dist/types/node/factory.d.ts +1 -0
- package/dist/types/node/factory.d.ts.map +1 -1
- package/dist/types/shared/decorators.d.ts +13 -1
- package/dist/types/shared/decorators.d.ts.map +1 -1
- package/dist/types/shared/dom/osc.d.ts.map +1 -1
- package/dist/types/shared/index.d.ts +0 -2
- package/dist/types/shared/index.d.ts.map +1 -1
- package/dist/types/shared/jsx/types.d.ts +3 -0
- package/dist/types/shared/jsx/types.d.ts.map +1 -1
- package/dist/types/shared/module/compiler.d.ts +3 -0
- package/dist/types/shared/module/compiler.d.ts.map +1 -1
- package/dist/types/shared/module/injector.d.ts +8 -1
- package/dist/types/shared/module/injector.d.ts.map +1 -1
- package/dist/types/shared/module_libs/http_client/module.d.ts +1 -1
- package/dist/types/shared/module_libs/http_client/module.d.ts.map +1 -1
- package/dist/types/shared/signal/index.d.ts +1 -0
- package/dist/types/shared/signal/index.d.ts.map +1 -1
- package/dist/types/shared/signal/utils.d.ts +4 -0
- package/dist/types/shared/signal/utils.d.ts.map +1 -0
- package/dist/types/shared/symbols.d.ts +3 -0
- package/dist/types/shared/symbols.d.ts.map +1 -1
- package/dist/types/shared/types.d.ts +40 -4
- package/dist/types/shared/types.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/types/shared/macros/index.d.ts +0 -2
- package/dist/types/shared/macros/index.d.ts.map +0 -1
- package/dist/types/shared/observable/bsubject.d.ts +0 -11
- package/dist/types/shared/observable/bsubject.d.ts.map +0 -1
- package/dist/types/shared/observable/index.d.ts +0 -4
- package/dist/types/shared/observable/index.d.ts.map +0 -1
- package/dist/types/shared/observable/observable.d.ts +0 -39
- package/dist/types/shared/observable/observable.d.ts.map +0 -1
- package/dist/types/shared/observable/subject.d.ts +0 -15
- package/dist/types/shared/observable/subject.d.ts.map +0 -1
|
@@ -14,11 +14,11 @@ var kithinjiorca = (() => {
|
|
|
14
14
|
for (var name in all)
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
|
-
var __copyProps = (to,
|
|
18
|
-
if (
|
|
19
|
-
for (let key of __getOwnPropNames(
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
20
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
-
__defProp(to, key, { get: () =>
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
22
|
}
|
|
23
23
|
return to;
|
|
24
24
|
};
|
|
@@ -31,7 +31,6 @@ var kithinjiorca = (() => {
|
|
|
31
31
|
ActorModule: () => ActorModule,
|
|
32
32
|
BOOTSTRAP: () => BOOTSTRAP,
|
|
33
33
|
BOOTSTRAP_VNODE: () => BOOTSTRAP_VNODE,
|
|
34
|
-
BehaviorSubject: () => BehaviorSubject,
|
|
35
34
|
Body: () => Body,
|
|
36
35
|
BrowserFactory: () => BrowserFactory,
|
|
37
36
|
COMPONENT: () => COMPONENT,
|
|
@@ -51,6 +50,7 @@ var kithinjiorca = (() => {
|
|
|
51
50
|
EXPORTS_KEY: () => EXPORTS_KEY,
|
|
52
51
|
EXPRESS_ADAPTER_HOST: () => EXPRESS_ADAPTER_HOST,
|
|
53
52
|
Fragment: () => Fragment,
|
|
53
|
+
GUARDS_KEY: () => GUARDS_KEY,
|
|
54
54
|
Get: () => Get,
|
|
55
55
|
HTTP_METHOD_KEY: () => HTTP_METHOD_KEY,
|
|
56
56
|
HandlerParamType: () => HandlerParamType,
|
|
@@ -60,6 +60,7 @@ var kithinjiorca = (() => {
|
|
|
60
60
|
IMPORTS_KEY: () => IMPORTS_KEY,
|
|
61
61
|
INJECTABLE: () => INJECTABLE,
|
|
62
62
|
INJECT_TOKENS_KEY: () => INJECT_TOKENS_KEY,
|
|
63
|
+
INTERCEPTORS_KEY: () => INTERCEPTORS_KEY,
|
|
63
64
|
Inject: () => Inject,
|
|
64
65
|
Injectable: () => Injectable,
|
|
65
66
|
Injector: () => Injector,
|
|
@@ -71,7 +72,6 @@ var kithinjiorca = (() => {
|
|
|
71
72
|
ORCA_ELEMENT_TYPE: () => ORCA_ELEMENT_TYPE,
|
|
72
73
|
ORCA_FRAGMENT_TYPE: () => ORCA_FRAGMENT_TYPE,
|
|
73
74
|
OSC: () => OSC,
|
|
74
|
-
Observable: () => Observable,
|
|
75
75
|
OrcaComponent: () => OrcaComponent,
|
|
76
76
|
PARAMS_META_KEY: () => PARAMS_META_KEY,
|
|
77
77
|
PATH_KEY: () => PATH_KEY,
|
|
@@ -81,60 +81,51 @@ var kithinjiorca = (() => {
|
|
|
81
81
|
Post: () => Post,
|
|
82
82
|
ProviderNormalizer: () => ProviderNormalizer,
|
|
83
83
|
Query: () => Query,
|
|
84
|
+
REQUEST_CONTEXT: () => REQUEST_CONTEXT,
|
|
85
|
+
Req: () => Req,
|
|
86
|
+
Res: () => Res,
|
|
84
87
|
RouterModule: () => RouterModule,
|
|
85
88
|
RouterOutlet: () => RouterOutlet,
|
|
86
89
|
SIGNATURE_METADATA_KEY: () => SIGNATURE_METADATA_KEY,
|
|
87
90
|
SSE_ROUTE: () => SSE_ROUTE,
|
|
91
|
+
SetMetadata: () => SetMetadata,
|
|
92
|
+
Shared: () => Shared,
|
|
88
93
|
Signature: () => Signature,
|
|
89
94
|
Sse: () => Sse,
|
|
90
|
-
Subject: () => Subject,
|
|
91
95
|
Subscribe: () => Subscribe,
|
|
92
|
-
|
|
96
|
+
UploadedFile: () => UploadedFile,
|
|
97
|
+
UploadedFiles: () => UploadedFiles,
|
|
98
|
+
UseGuards: () => UseGuards,
|
|
99
|
+
UseInterceptors: () => UseInterceptors,
|
|
100
|
+
applyDecorators: () => applyDecorators,
|
|
93
101
|
batch: () => batch,
|
|
94
102
|
browser: () => browser_exports,
|
|
95
|
-
catchError: () => catchError,
|
|
96
103
|
collectAllProvidersFromNode: () => collectAllProvidersFromNode,
|
|
97
104
|
computed: () => computed,
|
|
98
|
-
concatMap: () => concatMap,
|
|
99
105
|
createComponent: () => createComponent,
|
|
100
106
|
createRoot: () => createRoot,
|
|
101
|
-
debounceTime: () => debounceTime,
|
|
102
|
-
distinctUntilChanged: () => distinctUntilChanged,
|
|
103
107
|
effect: () => effect,
|
|
104
|
-
filter: () => filter,
|
|
105
|
-
from: () => from,
|
|
106
108
|
getCurrentInjector: () => getCurrentInjector,
|
|
109
|
+
getGuards: () => getGuards,
|
|
110
|
+
getInterceptors: () => getInterceptors,
|
|
107
111
|
getSignatureMetadata: () => getSignatureMetadata,
|
|
108
112
|
hasSignature: () => hasSignature,
|
|
109
113
|
insert: () => insert,
|
|
110
|
-
interval: () => interval,
|
|
111
114
|
isClassComponent: () => isClassComponent,
|
|
112
115
|
isFragment: () => isFragment,
|
|
113
116
|
isIntrinsicElement: () => isIntrinsicElement,
|
|
114
|
-
isObservable: () => isObservable,
|
|
115
117
|
isSignal: () => isSignal,
|
|
116
118
|
jsx: () => jsx,
|
|
117
119
|
jsxs: () => jsxs,
|
|
118
|
-
|
|
119
|
-
mergeMap: () => mergeMap,
|
|
120
|
-
observable: () => observable,
|
|
121
|
-
of: () => of,
|
|
120
|
+
mixin: () => mixin,
|
|
122
121
|
parseSignatureSchemas: () => parseSignatureSchemas,
|
|
123
|
-
reduce: () => reduce,
|
|
124
|
-
scan: () => scan,
|
|
125
122
|
setCurrentInjector: () => setCurrentInjector,
|
|
126
123
|
shared: () => shared_exports,
|
|
127
124
|
signal: () => signal,
|
|
128
|
-
skip: () => skip,
|
|
129
125
|
spread: () => spread,
|
|
130
|
-
startWith: () => startWith,
|
|
131
126
|
style: () => style,
|
|
132
|
-
switchMap: () => switchMap,
|
|
133
127
|
symbolValueReplacer: () => symbolValueReplacer,
|
|
134
128
|
symbolValueReviver: () => symbolValueReviver,
|
|
135
|
-
take: () => take,
|
|
136
|
-
tap: () => tap,
|
|
137
|
-
throttleTime: () => throttleTime,
|
|
138
129
|
toSignal: () => toSignal,
|
|
139
130
|
untracked: () => untracked
|
|
140
131
|
});
|
|
@@ -146,7 +137,6 @@ var kithinjiorca = (() => {
|
|
|
146
137
|
BOOTSTRAP: () => BOOTSTRAP,
|
|
147
138
|
BOOTSTRAP_VNODE: () => BOOTSTRAP_VNODE,
|
|
148
139
|
BaseActor: () => BaseActor,
|
|
149
|
-
BehaviorSubject: () => BehaviorSubject,
|
|
150
140
|
Body: () => Body,
|
|
151
141
|
COMPONENT: () => COMPONENT,
|
|
152
142
|
COMPONENT_DEPS: () => COMPONENT_DEPS,
|
|
@@ -165,6 +155,7 @@ var kithinjiorca = (() => {
|
|
|
165
155
|
EXPORTS_KEY: () => EXPORTS_KEY,
|
|
166
156
|
EXPRESS_ADAPTER_HOST: () => EXPRESS_ADAPTER_HOST,
|
|
167
157
|
Fragment: () => Fragment,
|
|
158
|
+
GUARDS_KEY: () => GUARDS_KEY,
|
|
168
159
|
Get: () => Get,
|
|
169
160
|
HTTP_METHOD_KEY: () => HTTP_METHOD_KEY,
|
|
170
161
|
HandlerParamType: () => HandlerParamType,
|
|
@@ -174,6 +165,7 @@ var kithinjiorca = (() => {
|
|
|
174
165
|
IMPORTS_KEY: () => IMPORTS_KEY,
|
|
175
166
|
INJECTABLE: () => INJECTABLE,
|
|
176
167
|
INJECT_TOKENS_KEY: () => INJECT_TOKENS_KEY,
|
|
168
|
+
INTERCEPTORS_KEY: () => INTERCEPTORS_KEY,
|
|
177
169
|
Inject: () => Inject,
|
|
178
170
|
Injectable: () => Injectable,
|
|
179
171
|
Injector: () => Injector,
|
|
@@ -184,7 +176,6 @@ var kithinjiorca = (() => {
|
|
|
184
176
|
ORCA_ELEMENT_TYPE: () => ORCA_ELEMENT_TYPE,
|
|
185
177
|
ORCA_FRAGMENT_TYPE: () => ORCA_FRAGMENT_TYPE,
|
|
186
178
|
OSC: () => OSC,
|
|
187
|
-
Observable: () => Observable,
|
|
188
179
|
OrcaComponent: () => OrcaComponent,
|
|
189
180
|
PARAMS_META_KEY: () => PARAMS_META_KEY,
|
|
190
181
|
PATH_KEY: () => PATH_KEY,
|
|
@@ -194,60 +185,54 @@ var kithinjiorca = (() => {
|
|
|
194
185
|
Post: () => Post,
|
|
195
186
|
ProviderNormalizer: () => ProviderNormalizer,
|
|
196
187
|
Query: () => Query,
|
|
188
|
+
REQUEST_CONTEXT: () => REQUEST_CONTEXT,
|
|
189
|
+
Req: () => Req,
|
|
190
|
+
Res: () => Res,
|
|
197
191
|
SIGNATURE_METADATA_KEY: () => SIGNATURE_METADATA_KEY,
|
|
198
192
|
SSE_ROUTE: () => SSE_ROUTE,
|
|
193
|
+
SetMetadata: () => SetMetadata,
|
|
194
|
+
Shared: () => Shared,
|
|
199
195
|
Signature: () => Signature,
|
|
200
196
|
Sse: () => Sse,
|
|
201
197
|
StreamRenderer: () => StreamRenderer,
|
|
202
198
|
StringRenderer: () => StringRenderer,
|
|
203
|
-
Subject: () => Subject,
|
|
204
199
|
Subscribe: () => Subscribe,
|
|
200
|
+
UploadedFile: () => UploadedFile,
|
|
201
|
+
UploadedFiles: () => UploadedFiles,
|
|
202
|
+
UseGuards: () => UseGuards,
|
|
203
|
+
UseInterceptors: () => UseInterceptors,
|
|
205
204
|
VNode: () => VNode,
|
|
206
|
-
|
|
205
|
+
applyDecorators: () => applyDecorators,
|
|
207
206
|
batch: () => batch,
|
|
208
|
-
catchError: () => catchError,
|
|
209
207
|
collectAllProvidersFromNode: () => collectAllProvidersFromNode,
|
|
210
208
|
computed: () => computed,
|
|
211
|
-
concatMap: () => concatMap,
|
|
212
209
|
createRoot: () => createRoot,
|
|
213
|
-
debounceTime: () => debounceTime,
|
|
214
|
-
distinctUntilChanged: () => distinctUntilChanged,
|
|
215
210
|
effect: () => effect,
|
|
216
|
-
filter: () => filter,
|
|
217
|
-
from: () => from,
|
|
218
211
|
getCurrentInjector: () => getCurrentInjector,
|
|
212
|
+
getGuards: () => getGuards,
|
|
213
|
+
getInterceptors: () => getInterceptors,
|
|
219
214
|
getSignatureMetadata: () => getSignatureMetadata,
|
|
220
215
|
hasSignature: () => hasSignature,
|
|
221
|
-
interval: () => interval,
|
|
222
216
|
isClassComponent: () => isClassComponent,
|
|
223
217
|
isFragment: () => isFragment,
|
|
224
218
|
isIntrinsicElement: () => isIntrinsicElement,
|
|
225
|
-
isObservable: () => isObservable,
|
|
226
219
|
isSignal: () => isSignal,
|
|
227
220
|
jsx: () => jsx,
|
|
228
221
|
jsxs: () => jsxs,
|
|
229
|
-
|
|
230
|
-
mergeMap: () => mergeMap,
|
|
231
|
-
observable: () => observable,
|
|
232
|
-
of: () => of,
|
|
222
|
+
mixin: () => mixin,
|
|
233
223
|
parseSignatureSchemas: () => parseSignatureSchemas,
|
|
234
|
-
reduce: () => reduce,
|
|
235
|
-
scan: () => scan,
|
|
236
224
|
setCurrentInjector: () => setCurrentInjector,
|
|
237
225
|
signal: () => signal,
|
|
238
|
-
skip: () => skip,
|
|
239
|
-
startWith: () => startWith,
|
|
240
226
|
store: () => store,
|
|
241
|
-
switchMap: () => switchMap,
|
|
242
227
|
symbolValueReplacer: () => symbolValueReplacer,
|
|
243
228
|
symbolValueReviver: () => symbolValueReviver,
|
|
244
|
-
take: () => take,
|
|
245
|
-
tap: () => tap,
|
|
246
|
-
throttleTime: () => throttleTime,
|
|
247
229
|
toSignal: () => toSignal,
|
|
248
230
|
untracked: () => untracked
|
|
249
231
|
});
|
|
250
232
|
|
|
233
|
+
// src/shared/decorators.ts
|
|
234
|
+
var import_uid = __require("uid");
|
|
235
|
+
|
|
251
236
|
// src/shared/store.ts
|
|
252
237
|
var Store = class {
|
|
253
238
|
constructor() {
|
|
@@ -292,6 +277,9 @@ var kithinjiorca = (() => {
|
|
|
292
277
|
var SIGNATURE_METADATA_KEY = /* @__PURE__ */ Symbol("orca:signature:schemas");
|
|
293
278
|
var SSE_ROUTE = /* @__PURE__ */ Symbol("orca:sse:route");
|
|
294
279
|
var EVENT_HANDLER = /* @__PURE__ */ Symbol("orca:event:handler");
|
|
280
|
+
var INTERCEPTORS_KEY = /* @__PURE__ */ Symbol("interceptors");
|
|
281
|
+
var GUARDS_KEY = /* @__PURE__ */ Symbol("guards");
|
|
282
|
+
var REQUEST_CONTEXT = /* @__PURE__ */ Symbol("orca:request");
|
|
295
283
|
var ERROR_ELEMENT = /* @__PURE__ */ Symbol.for("orca:error");
|
|
296
284
|
var ORCA_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("orca:element");
|
|
297
285
|
var ORCA_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("orca:fragment");
|
|
@@ -306,6 +294,8 @@ var kithinjiorca = (() => {
|
|
|
306
294
|
HandlerParamType2["HEADERS"] = "HEADERS";
|
|
307
295
|
HandlerParamType2["REQUEST"] = "REQUEST";
|
|
308
296
|
HandlerParamType2["RESPONSE"] = "RESPONSE";
|
|
297
|
+
HandlerParamType2["FILE"] = "FILE";
|
|
298
|
+
HandlerParamType2["FILES"] = "FILES";
|
|
309
299
|
return HandlerParamType2;
|
|
310
300
|
})(HandlerParamType || {});
|
|
311
301
|
var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
|
|
@@ -331,6 +321,13 @@ var kithinjiorca = (() => {
|
|
|
331
321
|
return target;
|
|
332
322
|
};
|
|
333
323
|
}
|
|
324
|
+
function mixin(mixinClass) {
|
|
325
|
+
Object.defineProperty(mixinClass, "name", {
|
|
326
|
+
value: (0, import_uid.uid)(21)
|
|
327
|
+
});
|
|
328
|
+
Injectable()(mixinClass);
|
|
329
|
+
return mixinClass;
|
|
330
|
+
}
|
|
334
331
|
function Component(params = {}) {
|
|
335
332
|
return function(target) {
|
|
336
333
|
store.update("components", (current) => {
|
|
@@ -347,7 +344,7 @@ var kithinjiorca = (() => {
|
|
|
347
344
|
}
|
|
348
345
|
Reflect.defineMetadata(COMPONENT, true, target);
|
|
349
346
|
Reflect.defineMetadata(COMPONENT_PROVIDERS, params.providers || [], target);
|
|
350
|
-
Reflect.defineMetadata(COMPONENT_DEPS, params.
|
|
347
|
+
Reflect.defineMetadata(COMPONENT_DEPS, params.inject || [], target);
|
|
351
348
|
return target;
|
|
352
349
|
};
|
|
353
350
|
}
|
|
@@ -391,6 +388,18 @@ var kithinjiorca = (() => {
|
|
|
391
388
|
function Query(key) {
|
|
392
389
|
return getHandlerParamDecorator("QUERY" /* QUERY */, key);
|
|
393
390
|
}
|
|
391
|
+
function UploadedFile() {
|
|
392
|
+
return getHandlerParamDecorator("FILE" /* FILE */);
|
|
393
|
+
}
|
|
394
|
+
function UploadedFiles() {
|
|
395
|
+
return getHandlerParamDecorator("FILES" /* FILES */);
|
|
396
|
+
}
|
|
397
|
+
function Req() {
|
|
398
|
+
return getHandlerParamDecorator("REQUEST" /* REQUEST */);
|
|
399
|
+
}
|
|
400
|
+
function Res() {
|
|
401
|
+
return getHandlerParamDecorator("RESPONSE" /* RESPONSE */);
|
|
402
|
+
}
|
|
394
403
|
function getRouteDecorator(httpMethod, path) {
|
|
395
404
|
return function(target, key, descriptor) {
|
|
396
405
|
Reflect.defineMetadata(HTTP_METHOD_KEY, httpMethod, target, key);
|
|
@@ -410,6 +419,10 @@ var kithinjiorca = (() => {
|
|
|
410
419
|
Reflect.defineMetadata(HTTP_METHOD_KEY, "get" /* GET */, target, propertyKey);
|
|
411
420
|
};
|
|
412
421
|
}
|
|
422
|
+
function Shared() {
|
|
423
|
+
return function(target, _propertyKey, parameterIndex) {
|
|
424
|
+
};
|
|
425
|
+
}
|
|
413
426
|
function Subscribe(pattern) {
|
|
414
427
|
return function(target, propertyKey, descriptor) {
|
|
415
428
|
Reflect.defineMetadata(EVENT_HANDLER, pattern, target, propertyKey);
|
|
@@ -448,6 +461,61 @@ var kithinjiorca = (() => {
|
|
|
448
461
|
}
|
|
449
462
|
return { paramSchemas, returnSchema };
|
|
450
463
|
}
|
|
464
|
+
function UseInterceptors(...interceptors) {
|
|
465
|
+
return function(target, propertyKey, descriptor) {
|
|
466
|
+
if (propertyKey && descriptor) {
|
|
467
|
+
const existing = Reflect.getMetadata(INTERCEPTORS_KEY, target, propertyKey) || [];
|
|
468
|
+
Reflect.defineMetadata(INTERCEPTORS_KEY, [...existing, ...interceptors], target, propertyKey);
|
|
469
|
+
} else {
|
|
470
|
+
const existing = Reflect.getMetadata(INTERCEPTORS_KEY, target) || [];
|
|
471
|
+
Reflect.defineMetadata(INTERCEPTORS_KEY, [...existing, ...interceptors], target);
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function getInterceptors(target, propertyKey) {
|
|
476
|
+
const classInterceptors = Reflect.getMetadata(INTERCEPTORS_KEY, target.constructor) || [];
|
|
477
|
+
const methodInterceptors = Reflect.getMetadata(INTERCEPTORS_KEY, target, propertyKey) || [];
|
|
478
|
+
return [...classInterceptors, ...methodInterceptors];
|
|
479
|
+
}
|
|
480
|
+
function UseGuards(...guards) {
|
|
481
|
+
return function(target, propertyKey, descriptor) {
|
|
482
|
+
if (propertyKey && descriptor) {
|
|
483
|
+
const existing = Reflect.getMetadata(GUARDS_KEY, target, propertyKey) || [];
|
|
484
|
+
Reflect.defineMetadata(GUARDS_KEY, [...existing, ...guards], target, propertyKey);
|
|
485
|
+
} else {
|
|
486
|
+
const existing = Reflect.getMetadata(GUARDS_KEY, target) || [];
|
|
487
|
+
Reflect.defineMetadata(GUARDS_KEY, [...existing, ...guards], target);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function getGuards(target, propertyKey) {
|
|
492
|
+
const classGuards = Reflect.getMetadata(GUARDS_KEY, target.constructor) || [];
|
|
493
|
+
const methodGuards = Reflect.getMetadata(GUARDS_KEY, target, propertyKey) || [];
|
|
494
|
+
return [...classGuards, ...methodGuards];
|
|
495
|
+
}
|
|
496
|
+
var SetMetadata = (metadataKey, metadataValue) => {
|
|
497
|
+
const decoratorFactory = (target, key, descriptor) => {
|
|
498
|
+
if (descriptor) {
|
|
499
|
+
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
|
|
500
|
+
return descriptor;
|
|
501
|
+
}
|
|
502
|
+
Reflect.defineMetadata(metadataKey, metadataValue, target);
|
|
503
|
+
return target;
|
|
504
|
+
};
|
|
505
|
+
decoratorFactory.KEY = metadataKey;
|
|
506
|
+
return decoratorFactory;
|
|
507
|
+
};
|
|
508
|
+
function applyDecorators(...decorators) {
|
|
509
|
+
return (target, propertyKey, descriptor) => {
|
|
510
|
+
for (const decorator of decorators) {
|
|
511
|
+
if (target instanceof Function && !descriptor) {
|
|
512
|
+
decorator(target);
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
decorator(target, propertyKey, descriptor);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
}
|
|
451
519
|
|
|
452
520
|
// src/shared/module/node.ts
|
|
453
521
|
var ProviderNormalizer = class {
|
|
@@ -509,10 +577,11 @@ var kithinjiorca = (() => {
|
|
|
509
577
|
}
|
|
510
578
|
createNode(moduleOrDynamic) {
|
|
511
579
|
const target = this.isDynamicModule(moduleOrDynamic) ? moduleOrDynamic.module : moduleOrDynamic;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
580
|
+
const nodeKey = this.getNodeKey(moduleOrDynamic, target);
|
|
581
|
+
if (this.nodes.has(nodeKey))
|
|
582
|
+
return this.nodes.get(nodeKey);
|
|
583
|
+
const node = new Node2(nodeKey);
|
|
584
|
+
this.nodes.set(nodeKey, node);
|
|
516
585
|
const imports = this.getImports(moduleOrDynamic);
|
|
517
586
|
node.setChildren(imports.map((imp) => this.createNode(imp)));
|
|
518
587
|
const providers = this.getProviders(moduleOrDynamic);
|
|
@@ -551,6 +620,38 @@ var kithinjiorca = (() => {
|
|
|
551
620
|
this.getExports(moduleOrDynamic).forEach((exp) => node.addExport(exp));
|
|
552
621
|
return node;
|
|
553
622
|
}
|
|
623
|
+
getNodeKey(moduleOrDynamic, target) {
|
|
624
|
+
if (this.isDynamicModule(moduleOrDynamic)) {
|
|
625
|
+
if (moduleOrDynamic.__uniqueId) {
|
|
626
|
+
return `${target.name}:${moduleOrDynamic.__uniqueId}`;
|
|
627
|
+
}
|
|
628
|
+
const autoId = this.generateAutoId(moduleOrDynamic);
|
|
629
|
+
if (autoId) {
|
|
630
|
+
return `${target.name}:${autoId}`;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return target.name;
|
|
634
|
+
}
|
|
635
|
+
generateAutoId(dynamicModule) {
|
|
636
|
+
const parts = [];
|
|
637
|
+
if (dynamicModule.providers && dynamicModule.providers.length > 0) {
|
|
638
|
+
const providerTokens = dynamicModule.providers.map((p) => this.getProviderToken(p)).map((t) => typeof t === "function" ? t.name : String(t)).sort().join(",");
|
|
639
|
+
parts.push(`p:${providerTokens}`);
|
|
640
|
+
}
|
|
641
|
+
if (dynamicModule.exports && dynamicModule.exports.length > 0) {
|
|
642
|
+
const exportTokens = dynamicModule.exports.map((t) => typeof t === "function" ? t.name : String(t)).sort().join(",");
|
|
643
|
+
parts.push(`e:${exportTokens}`);
|
|
644
|
+
}
|
|
645
|
+
if (dynamicModule.controllers && dynamicModule.controllers.length > 0) {
|
|
646
|
+
const controllerNames = dynamicModule.controllers.map((c) => c.name).sort().join(",");
|
|
647
|
+
parts.push(`c:${controllerNames}`);
|
|
648
|
+
}
|
|
649
|
+
if (dynamicModule.declarations && dynamicModule.declarations.length > 0) {
|
|
650
|
+
const declarationNames = dynamicModule.declarations.map((d) => d.name).sort().join(",");
|
|
651
|
+
parts.push(`d:${declarationNames}`);
|
|
652
|
+
}
|
|
653
|
+
return parts.length > 0 ? parts.join("|") : null;
|
|
654
|
+
}
|
|
554
655
|
validate(rootNode) {
|
|
555
656
|
const errors = [];
|
|
556
657
|
const allNodes = /* @__PURE__ */ new Map();
|
|
@@ -647,14 +748,23 @@ var kithinjiorca = (() => {
|
|
|
647
748
|
return typeof provider === "function" ? provider : provider.provide;
|
|
648
749
|
}
|
|
649
750
|
extractDependencies(item) {
|
|
650
|
-
if (typeof item === "object" && "
|
|
651
|
-
return item.
|
|
751
|
+
if (typeof item === "object" && "inject" in item && item.inject) {
|
|
752
|
+
return item.inject.filter((dep) => {
|
|
753
|
+
if (this.isOptionalDependency(dep)) {
|
|
754
|
+
return !dep.optional;
|
|
755
|
+
}
|
|
756
|
+
return true;
|
|
757
|
+
}).map((dep) => this.isOptionalDependency(dep) ? dep.token : dep);
|
|
758
|
+
}
|
|
652
759
|
if (typeof item === "object" && item.useClass)
|
|
653
760
|
return this.getConstructorDependencies(item.useClass);
|
|
654
761
|
if (typeof item === "function")
|
|
655
762
|
return this.getConstructorDependencies(item);
|
|
656
763
|
return [];
|
|
657
764
|
}
|
|
765
|
+
isOptionalDependency(dep) {
|
|
766
|
+
return typeof dep === "object" && "token" in dep && "optional" in dep;
|
|
767
|
+
}
|
|
658
768
|
getConstructorDependencies(constructor) {
|
|
659
769
|
const injectTokens = Reflect.getOwnMetadata(INJECT_TOKENS_KEY, constructor) || /* @__PURE__ */ new Map();
|
|
660
770
|
const paramTypes = Reflect.getMetadata(DESIGN_PARAMTYPES, constructor) || [];
|
|
@@ -729,9 +839,10 @@ var kithinjiorca = (() => {
|
|
|
729
839
|
};
|
|
730
840
|
|
|
731
841
|
// src/shared/module/injector.ts
|
|
732
|
-
var Injector = class {
|
|
842
|
+
var Injector = class _Injector {
|
|
733
843
|
constructor(providers, parent) {
|
|
734
844
|
this.instanceCache = /* @__PURE__ */ new Map();
|
|
845
|
+
this.promiseCache = /* @__PURE__ */ new Map();
|
|
735
846
|
this.providerMap = /* @__PURE__ */ new Map();
|
|
736
847
|
this.parent = parent;
|
|
737
848
|
providers.forEach((p) => {
|
|
@@ -739,14 +850,20 @@ var kithinjiorca = (() => {
|
|
|
739
850
|
this.providerMap.set(normalized.provide, normalized);
|
|
740
851
|
});
|
|
741
852
|
}
|
|
853
|
+
createChild(providers) {
|
|
854
|
+
return new _Injector(providers, this);
|
|
855
|
+
}
|
|
742
856
|
addProvider(provider) {
|
|
743
857
|
const normalized = ProviderNormalizer.normalize(provider);
|
|
744
858
|
this.providerMap.set(normalized.provide, normalized);
|
|
745
859
|
}
|
|
746
|
-
resolve(token) {
|
|
860
|
+
async resolve(token) {
|
|
747
861
|
if (this.instanceCache.has(token)) {
|
|
748
862
|
return this.instanceCache.get(token);
|
|
749
863
|
}
|
|
864
|
+
if (this.promiseCache.has(token)) {
|
|
865
|
+
return this.promiseCache.get(token);
|
|
866
|
+
}
|
|
750
867
|
const provider = this.providerMap.get(token);
|
|
751
868
|
if (!provider) {
|
|
752
869
|
if (this.parent) {
|
|
@@ -756,23 +873,101 @@ var kithinjiorca = (() => {
|
|
|
756
873
|
`No provider for token: ${typeof token === "function" ? token.name : String(token)}`
|
|
757
874
|
);
|
|
758
875
|
}
|
|
759
|
-
const
|
|
876
|
+
const instancePromise = this.createInstance(provider);
|
|
877
|
+
this.promiseCache.set(token, instancePromise);
|
|
878
|
+
try {
|
|
879
|
+
const instance = await instancePromise;
|
|
880
|
+
if (provider.scope !== "transient") {
|
|
881
|
+
this.instanceCache.set(token, instance);
|
|
882
|
+
}
|
|
883
|
+
return instance;
|
|
884
|
+
} finally {
|
|
885
|
+
this.promiseCache.delete(token);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
resolveSync(token) {
|
|
889
|
+
if (this.instanceCache.has(token)) {
|
|
890
|
+
return this.instanceCache.get(token);
|
|
891
|
+
}
|
|
892
|
+
const provider = this.providerMap.get(token);
|
|
893
|
+
if (!provider) {
|
|
894
|
+
if (this.parent) {
|
|
895
|
+
return this.parent.resolveSync(token);
|
|
896
|
+
}
|
|
897
|
+
throw new Error(
|
|
898
|
+
`No provider for token: ${typeof token === "function" ? token.name : String(token)}`
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
const instance = this.createInstanceSync(provider);
|
|
760
902
|
if (provider.scope !== "transient") {
|
|
761
903
|
this.instanceCache.set(token, instance);
|
|
762
904
|
}
|
|
763
905
|
return instance;
|
|
764
906
|
}
|
|
765
|
-
createInstance(provider) {
|
|
766
|
-
if ("useValue" in provider
|
|
767
|
-
return provider.useValue;
|
|
907
|
+
async createInstance(provider) {
|
|
908
|
+
if ("useValue" in provider) return provider.useValue;
|
|
768
909
|
if (provider.useExisting) return this.resolve(provider.useExisting);
|
|
769
910
|
if (provider.useFactory) {
|
|
770
|
-
const deps2 =
|
|
911
|
+
const deps2 = await Promise.all(
|
|
912
|
+
(provider.inject || []).map((d) => this.resolveDependency(d))
|
|
913
|
+
);
|
|
771
914
|
return provider.useFactory(...deps2);
|
|
772
915
|
}
|
|
773
916
|
const Ctor = provider.useClass || provider.provide;
|
|
774
|
-
const deps = provider.
|
|
775
|
-
|
|
917
|
+
const deps = provider.inject || this.getConstructorDeps(Ctor);
|
|
918
|
+
const resolvedDeps = await Promise.all(
|
|
919
|
+
deps.map((d) => this.resolveDependency(d))
|
|
920
|
+
);
|
|
921
|
+
return new Ctor(...resolvedDeps);
|
|
922
|
+
}
|
|
923
|
+
createInstanceSync(provider) {
|
|
924
|
+
if ("useValue" in provider && provider.useValue !== void 0)
|
|
925
|
+
return provider.useValue;
|
|
926
|
+
if (provider.useExisting) return this.resolveSync(provider.useExisting);
|
|
927
|
+
if (provider.useFactory) {
|
|
928
|
+
const deps2 = (provider.inject || []).map(
|
|
929
|
+
(d) => this.resolveDependencySync(d)
|
|
930
|
+
);
|
|
931
|
+
const result = provider.useFactory(...deps2);
|
|
932
|
+
if (result instanceof Promise) {
|
|
933
|
+
throw new Error(
|
|
934
|
+
`Async factory detected but resolveSync() was called. Use resolve() instead.`
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
return result;
|
|
938
|
+
}
|
|
939
|
+
const Ctor = provider.useClass || provider.provide;
|
|
940
|
+
const deps = provider.inject || this.getConstructorDeps(Ctor);
|
|
941
|
+
return new Ctor(...deps.map((d) => this.resolveDependencySync(d)));
|
|
942
|
+
}
|
|
943
|
+
async resolveDependency(dep) {
|
|
944
|
+
if (this.isOptionalDependency(dep)) {
|
|
945
|
+
try {
|
|
946
|
+
return await this.resolve(dep.token);
|
|
947
|
+
} catch (error) {
|
|
948
|
+
if (dep.optional) {
|
|
949
|
+
return void 0;
|
|
950
|
+
}
|
|
951
|
+
throw error;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
return this.resolve(dep);
|
|
955
|
+
}
|
|
956
|
+
resolveDependencySync(dep) {
|
|
957
|
+
if (this.isOptionalDependency(dep)) {
|
|
958
|
+
try {
|
|
959
|
+
return this.resolveSync(dep.token);
|
|
960
|
+
} catch (error) {
|
|
961
|
+
if (dep.optional) {
|
|
962
|
+
return void 0;
|
|
963
|
+
}
|
|
964
|
+
throw error;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return this.resolveSync(dep);
|
|
968
|
+
}
|
|
969
|
+
isOptionalDependency(dep) {
|
|
970
|
+
return typeof dep === "object" && dep !== null && "token" in dep && "optional" in dep;
|
|
776
971
|
}
|
|
777
972
|
getConstructorDeps(ctor) {
|
|
778
973
|
const injectTokens = Reflect.getOwnMetadata(INJECT_TOKENS_KEY, ctor) || /* @__PURE__ */ new Map();
|
|
@@ -944,14 +1139,14 @@ var kithinjiorca = (() => {
|
|
|
944
1139
|
return "";
|
|
945
1140
|
}
|
|
946
1141
|
escapeHtml(text) {
|
|
947
|
-
const
|
|
1142
|
+
const map = {
|
|
948
1143
|
"&": "&",
|
|
949
1144
|
"<": "<",
|
|
950
1145
|
">": ">",
|
|
951
1146
|
'"': """,
|
|
952
1147
|
"'": "'"
|
|
953
1148
|
};
|
|
954
|
-
return text.replace(/[&<>"']/g, (m) =>
|
|
1149
|
+
return text.replace(/[&<>"']/g, (m) => map[m]);
|
|
955
1150
|
}
|
|
956
1151
|
};
|
|
957
1152
|
|
|
@@ -1065,7 +1260,7 @@ var kithinjiorca = (() => {
|
|
|
1065
1260
|
);
|
|
1066
1261
|
}
|
|
1067
1262
|
}
|
|
1068
|
-
const instance = componentInjector.
|
|
1263
|
+
const instance = componentInjector.resolveSync(ComponentClass);
|
|
1069
1264
|
const mergedProps = Object.create(
|
|
1070
1265
|
Object.getPrototypeOf(instance.props || {})
|
|
1071
1266
|
);
|
|
@@ -1433,86 +1628,7 @@ var kithinjiorca = (() => {
|
|
|
1433
1628
|
}
|
|
1434
1629
|
}
|
|
1435
1630
|
|
|
1436
|
-
// src/shared/
|
|
1437
|
-
var Observable = class {
|
|
1438
|
-
constructor(producer) {
|
|
1439
|
-
this.producer = producer;
|
|
1440
|
-
this.__isObservable = true;
|
|
1441
|
-
}
|
|
1442
|
-
subscribe(observerOrNext, error, complete) {
|
|
1443
|
-
const observer = typeof observerOrNext === "function" ? { next: observerOrNext, error, complete } : observerOrNext;
|
|
1444
|
-
let cleanup;
|
|
1445
|
-
let isUnsubscribed = false;
|
|
1446
|
-
if (this.producer) {
|
|
1447
|
-
try {
|
|
1448
|
-
cleanup = this.producer(observer);
|
|
1449
|
-
} catch (err) {
|
|
1450
|
-
if (observer.error) {
|
|
1451
|
-
try {
|
|
1452
|
-
observer.error(err);
|
|
1453
|
-
} catch (e) {
|
|
1454
|
-
console.error("Error in error handler during subscription:", e);
|
|
1455
|
-
}
|
|
1456
|
-
} else {
|
|
1457
|
-
throw err;
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
return {
|
|
1462
|
-
unsubscribe: () => {
|
|
1463
|
-
if (isUnsubscribed) return;
|
|
1464
|
-
isUnsubscribed = true;
|
|
1465
|
-
if (cleanup) {
|
|
1466
|
-
try {
|
|
1467
|
-
cleanup();
|
|
1468
|
-
} catch (err) {
|
|
1469
|
-
console.error("Error during cleanup:", err);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
pipe(...operations) {
|
|
1476
|
-
if (operations.length === 0) {
|
|
1477
|
-
return this;
|
|
1478
|
-
}
|
|
1479
|
-
return operations.reduce((prev, fn) => fn(prev), this);
|
|
1480
|
-
}
|
|
1481
|
-
};
|
|
1482
|
-
function from(iterable) {
|
|
1483
|
-
return new Observable((observer) => {
|
|
1484
|
-
try {
|
|
1485
|
-
for (const value of iterable) {
|
|
1486
|
-
observer.next(value);
|
|
1487
|
-
}
|
|
1488
|
-
observer.complete?.();
|
|
1489
|
-
} catch (err) {
|
|
1490
|
-
observer.error?.(err);
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
function interval(ms) {
|
|
1495
|
-
return new Observable((observer) => {
|
|
1496
|
-
let count = 0;
|
|
1497
|
-
const id = setInterval(() => {
|
|
1498
|
-
observer.next(count++);
|
|
1499
|
-
}, ms);
|
|
1500
|
-
return () => clearInterval(id);
|
|
1501
|
-
});
|
|
1502
|
-
}
|
|
1503
|
-
function of(...values) {
|
|
1504
|
-
return new Observable((observer) => {
|
|
1505
|
-
try {
|
|
1506
|
-
values.forEach((value) => observer.next(value));
|
|
1507
|
-
observer.complete?.();
|
|
1508
|
-
} catch (err) {
|
|
1509
|
-
observer.error?.(err);
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
function observable(producer) {
|
|
1514
|
-
return new Observable(producer);
|
|
1515
|
-
}
|
|
1631
|
+
// src/shared/signal/utils.ts
|
|
1516
1632
|
function toSignal(obs, instance) {
|
|
1517
1633
|
const sig = signal(void 0);
|
|
1518
1634
|
const subst = obs.subscribe((val) => {
|
|
@@ -1524,480 +1640,6 @@ var kithinjiorca = (() => {
|
|
|
1524
1640
|
];
|
|
1525
1641
|
return sig;
|
|
1526
1642
|
}
|
|
1527
|
-
function isObservable(value) {
|
|
1528
|
-
return value && value.__isObservable === true;
|
|
1529
|
-
}
|
|
1530
|
-
function map(fn) {
|
|
1531
|
-
return (source) => {
|
|
1532
|
-
return new Observable((observer) => {
|
|
1533
|
-
const subscription = source.subscribe(
|
|
1534
|
-
(value) => {
|
|
1535
|
-
try {
|
|
1536
|
-
observer.next(fn(value));
|
|
1537
|
-
} catch (err) {
|
|
1538
|
-
observer.error?.(err);
|
|
1539
|
-
}
|
|
1540
|
-
},
|
|
1541
|
-
(err) => observer.error?.(err),
|
|
1542
|
-
() => observer.complete?.()
|
|
1543
|
-
);
|
|
1544
|
-
return () => subscription.unsubscribe();
|
|
1545
|
-
});
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
function filter(predicate) {
|
|
1549
|
-
return (source) => {
|
|
1550
|
-
return new Observable((observer) => {
|
|
1551
|
-
const subscription = source.subscribe(
|
|
1552
|
-
(value) => {
|
|
1553
|
-
try {
|
|
1554
|
-
if (predicate(value)) {
|
|
1555
|
-
observer.next(value);
|
|
1556
|
-
}
|
|
1557
|
-
} catch (err) {
|
|
1558
|
-
observer.error?.(err);
|
|
1559
|
-
}
|
|
1560
|
-
},
|
|
1561
|
-
(err) => observer.error?.(err),
|
|
1562
|
-
() => observer.complete?.()
|
|
1563
|
-
);
|
|
1564
|
-
return () => subscription.unsubscribe();
|
|
1565
|
-
});
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
function tap(fn) {
|
|
1569
|
-
return (source) => {
|
|
1570
|
-
return new Observable((observer) => {
|
|
1571
|
-
const subscription = source.subscribe(
|
|
1572
|
-
(value) => {
|
|
1573
|
-
try {
|
|
1574
|
-
fn(value);
|
|
1575
|
-
observer.next(value);
|
|
1576
|
-
} catch (err) {
|
|
1577
|
-
observer.error?.(err);
|
|
1578
|
-
}
|
|
1579
|
-
},
|
|
1580
|
-
(err) => observer.error?.(err),
|
|
1581
|
-
() => observer.complete?.()
|
|
1582
|
-
);
|
|
1583
|
-
return () => subscription.unsubscribe();
|
|
1584
|
-
});
|
|
1585
|
-
};
|
|
1586
|
-
}
|
|
1587
|
-
function take(count) {
|
|
1588
|
-
return (source) => {
|
|
1589
|
-
return new Observable((observer) => {
|
|
1590
|
-
let taken = 0;
|
|
1591
|
-
const subscription = source.subscribe(
|
|
1592
|
-
(value) => {
|
|
1593
|
-
if (taken < count) {
|
|
1594
|
-
observer.next(value);
|
|
1595
|
-
taken++;
|
|
1596
|
-
if (taken === count) {
|
|
1597
|
-
observer.complete?.();
|
|
1598
|
-
subscription.unsubscribe();
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
(err) => observer.error?.(err),
|
|
1603
|
-
() => observer.complete?.()
|
|
1604
|
-
);
|
|
1605
|
-
return () => subscription.unsubscribe();
|
|
1606
|
-
});
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
function skip(count) {
|
|
1610
|
-
return (source) => {
|
|
1611
|
-
return new Observable((observer) => {
|
|
1612
|
-
let skipped = 0;
|
|
1613
|
-
const subscription = source.subscribe(
|
|
1614
|
-
(value) => {
|
|
1615
|
-
if (skipped < count) {
|
|
1616
|
-
skipped++;
|
|
1617
|
-
} else {
|
|
1618
|
-
observer.next(value);
|
|
1619
|
-
}
|
|
1620
|
-
},
|
|
1621
|
-
(err) => observer.error?.(err),
|
|
1622
|
-
() => observer.complete?.()
|
|
1623
|
-
);
|
|
1624
|
-
return () => subscription.unsubscribe();
|
|
1625
|
-
});
|
|
1626
|
-
};
|
|
1627
|
-
}
|
|
1628
|
-
function debounceTime(ms) {
|
|
1629
|
-
return (source) => {
|
|
1630
|
-
return new Observable((observer) => {
|
|
1631
|
-
let timeoutId;
|
|
1632
|
-
const subscription = source.subscribe(
|
|
1633
|
-
(value) => {
|
|
1634
|
-
clearTimeout(timeoutId);
|
|
1635
|
-
timeoutId = setTimeout(() => {
|
|
1636
|
-
observer.next(value);
|
|
1637
|
-
}, ms);
|
|
1638
|
-
},
|
|
1639
|
-
(err) => observer.error?.(err),
|
|
1640
|
-
() => observer.complete?.()
|
|
1641
|
-
);
|
|
1642
|
-
return () => {
|
|
1643
|
-
clearTimeout(timeoutId);
|
|
1644
|
-
subscription.unsubscribe();
|
|
1645
|
-
};
|
|
1646
|
-
});
|
|
1647
|
-
};
|
|
1648
|
-
}
|
|
1649
|
-
function throttleTime(ms) {
|
|
1650
|
-
return (source) => {
|
|
1651
|
-
return new Observable((observer) => {
|
|
1652
|
-
let lastEmit = 0;
|
|
1653
|
-
const subscription = source.subscribe(
|
|
1654
|
-
(value) => {
|
|
1655
|
-
const now = Date.now();
|
|
1656
|
-
if (now - lastEmit >= ms) {
|
|
1657
|
-
lastEmit = now;
|
|
1658
|
-
observer.next(value);
|
|
1659
|
-
}
|
|
1660
|
-
},
|
|
1661
|
-
(err) => observer.error?.(err),
|
|
1662
|
-
() => observer.complete?.()
|
|
1663
|
-
);
|
|
1664
|
-
return () => subscription.unsubscribe();
|
|
1665
|
-
});
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
function distinctUntilChanged(compare) {
|
|
1669
|
-
return (source) => {
|
|
1670
|
-
return new Observable((observer) => {
|
|
1671
|
-
let hasLast = false;
|
|
1672
|
-
let last;
|
|
1673
|
-
const subscription = source.subscribe(
|
|
1674
|
-
(value) => {
|
|
1675
|
-
const isDistinct = !hasLast || (compare ? !compare(last, value) : last !== value);
|
|
1676
|
-
if (isDistinct) {
|
|
1677
|
-
hasLast = true;
|
|
1678
|
-
last = value;
|
|
1679
|
-
observer.next(value);
|
|
1680
|
-
}
|
|
1681
|
-
},
|
|
1682
|
-
(err) => observer.error?.(err),
|
|
1683
|
-
() => observer.complete?.()
|
|
1684
|
-
);
|
|
1685
|
-
return () => subscription.unsubscribe();
|
|
1686
|
-
});
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
function switchMap(fn) {
|
|
1690
|
-
return (source) => {
|
|
1691
|
-
return new Observable((observer) => {
|
|
1692
|
-
let innerSubscription = null;
|
|
1693
|
-
const outerSubscription = source.subscribe(
|
|
1694
|
-
(value) => {
|
|
1695
|
-
if (innerSubscription) {
|
|
1696
|
-
innerSubscription.unsubscribe();
|
|
1697
|
-
}
|
|
1698
|
-
try {
|
|
1699
|
-
const innerObservable = fn(value);
|
|
1700
|
-
innerSubscription = innerObservable.subscribe(
|
|
1701
|
-
(innerValue) => observer.next(innerValue),
|
|
1702
|
-
(err) => observer.error?.(err)
|
|
1703
|
-
);
|
|
1704
|
-
} catch (err) {
|
|
1705
|
-
observer.error?.(err);
|
|
1706
|
-
}
|
|
1707
|
-
},
|
|
1708
|
-
(err) => observer.error?.(err),
|
|
1709
|
-
() => observer.complete?.()
|
|
1710
|
-
);
|
|
1711
|
-
return () => {
|
|
1712
|
-
if (innerSubscription) {
|
|
1713
|
-
innerSubscription.unsubscribe();
|
|
1714
|
-
}
|
|
1715
|
-
outerSubscription.unsubscribe();
|
|
1716
|
-
};
|
|
1717
|
-
});
|
|
1718
|
-
};
|
|
1719
|
-
}
|
|
1720
|
-
function mergeMap(fn) {
|
|
1721
|
-
return (source) => {
|
|
1722
|
-
return new Observable((observer) => {
|
|
1723
|
-
const innerSubscriptions = [];
|
|
1724
|
-
let outerComplete = false;
|
|
1725
|
-
let activeCount = 0;
|
|
1726
|
-
const checkComplete = () => {
|
|
1727
|
-
if (outerComplete && activeCount === 0) {
|
|
1728
|
-
observer.complete?.();
|
|
1729
|
-
}
|
|
1730
|
-
};
|
|
1731
|
-
const outerSubscription = source.subscribe(
|
|
1732
|
-
(value) => {
|
|
1733
|
-
try {
|
|
1734
|
-
const innerObservable = fn(value);
|
|
1735
|
-
activeCount++;
|
|
1736
|
-
const innerSub = innerObservable.subscribe(
|
|
1737
|
-
(innerValue) => observer.next(innerValue),
|
|
1738
|
-
(err) => observer.error?.(err),
|
|
1739
|
-
() => {
|
|
1740
|
-
activeCount--;
|
|
1741
|
-
checkComplete();
|
|
1742
|
-
}
|
|
1743
|
-
);
|
|
1744
|
-
innerSubscriptions.push(innerSub);
|
|
1745
|
-
} catch (err) {
|
|
1746
|
-
observer.error?.(err);
|
|
1747
|
-
}
|
|
1748
|
-
},
|
|
1749
|
-
(err) => observer.error?.(err),
|
|
1750
|
-
() => {
|
|
1751
|
-
outerComplete = true;
|
|
1752
|
-
checkComplete();
|
|
1753
|
-
}
|
|
1754
|
-
);
|
|
1755
|
-
return () => {
|
|
1756
|
-
innerSubscriptions.forEach((sub) => sub.unsubscribe());
|
|
1757
|
-
outerSubscription.unsubscribe();
|
|
1758
|
-
};
|
|
1759
|
-
});
|
|
1760
|
-
};
|
|
1761
|
-
}
|
|
1762
|
-
function concatMap(fn) {
|
|
1763
|
-
return (source) => {
|
|
1764
|
-
return new Observable((observer) => {
|
|
1765
|
-
const queue = [];
|
|
1766
|
-
let innerSubscription = null;
|
|
1767
|
-
let outerComplete = false;
|
|
1768
|
-
let isProcessing = false;
|
|
1769
|
-
const processNext = () => {
|
|
1770
|
-
if (isProcessing || queue.length === 0) {
|
|
1771
|
-
if (outerComplete && queue.length === 0) {
|
|
1772
|
-
observer.complete?.();
|
|
1773
|
-
}
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
isProcessing = true;
|
|
1777
|
-
const value = queue.shift();
|
|
1778
|
-
try {
|
|
1779
|
-
const innerObservable = fn(value);
|
|
1780
|
-
innerSubscription = innerObservable.subscribe(
|
|
1781
|
-
(innerValue) => observer.next(innerValue),
|
|
1782
|
-
(err) => observer.error?.(err),
|
|
1783
|
-
() => {
|
|
1784
|
-
isProcessing = false;
|
|
1785
|
-
processNext();
|
|
1786
|
-
}
|
|
1787
|
-
);
|
|
1788
|
-
} catch (err) {
|
|
1789
|
-
observer.error?.(err);
|
|
1790
|
-
}
|
|
1791
|
-
};
|
|
1792
|
-
const outerSubscription = source.subscribe(
|
|
1793
|
-
(value) => {
|
|
1794
|
-
queue.push(value);
|
|
1795
|
-
processNext();
|
|
1796
|
-
},
|
|
1797
|
-
(err) => observer.error?.(err),
|
|
1798
|
-
() => {
|
|
1799
|
-
outerComplete = true;
|
|
1800
|
-
if (queue.length === 0 && !isProcessing) {
|
|
1801
|
-
observer.complete?.();
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
);
|
|
1805
|
-
return () => {
|
|
1806
|
-
if (innerSubscription) {
|
|
1807
|
-
innerSubscription.unsubscribe();
|
|
1808
|
-
}
|
|
1809
|
-
outerSubscription.unsubscribe();
|
|
1810
|
-
};
|
|
1811
|
-
});
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
function catchError(handler) {
|
|
1815
|
-
return (source) => {
|
|
1816
|
-
return new Observable((observer) => {
|
|
1817
|
-
const subscription = source.subscribe(
|
|
1818
|
-
(value) => observer.next(value),
|
|
1819
|
-
(err) => {
|
|
1820
|
-
try {
|
|
1821
|
-
const fallback = handler(err);
|
|
1822
|
-
const fallbackSub = fallback.subscribe(
|
|
1823
|
-
(value) => observer.next(value),
|
|
1824
|
-
(e) => observer.error?.(e),
|
|
1825
|
-
() => observer.complete?.()
|
|
1826
|
-
);
|
|
1827
|
-
subscription.__fallback = fallbackSub;
|
|
1828
|
-
} catch (e) {
|
|
1829
|
-
observer.error?.(e);
|
|
1830
|
-
}
|
|
1831
|
-
},
|
|
1832
|
-
() => observer.complete?.()
|
|
1833
|
-
);
|
|
1834
|
-
return () => {
|
|
1835
|
-
if (subscription.__fallback) {
|
|
1836
|
-
subscription.__fallback.unsubscribe();
|
|
1837
|
-
}
|
|
1838
|
-
subscription.unsubscribe();
|
|
1839
|
-
};
|
|
1840
|
-
});
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
function startWith(...values) {
|
|
1844
|
-
return (source) => {
|
|
1845
|
-
return new Observable((observer) => {
|
|
1846
|
-
values.forEach((value) => observer.next(value));
|
|
1847
|
-
const subscription = source.subscribe(
|
|
1848
|
-
(value) => observer.next(value),
|
|
1849
|
-
(err) => observer.error?.(err),
|
|
1850
|
-
() => observer.complete?.()
|
|
1851
|
-
);
|
|
1852
|
-
return () => subscription.unsubscribe();
|
|
1853
|
-
});
|
|
1854
|
-
};
|
|
1855
|
-
}
|
|
1856
|
-
function scan(accumulator, seed) {
|
|
1857
|
-
return (source) => {
|
|
1858
|
-
return new Observable((observer) => {
|
|
1859
|
-
let acc = seed;
|
|
1860
|
-
const subscription = source.subscribe(
|
|
1861
|
-
(value) => {
|
|
1862
|
-
try {
|
|
1863
|
-
acc = accumulator(acc, value);
|
|
1864
|
-
observer.next(acc);
|
|
1865
|
-
} catch (err) {
|
|
1866
|
-
observer.error?.(err);
|
|
1867
|
-
}
|
|
1868
|
-
},
|
|
1869
|
-
(err) => observer.error?.(err),
|
|
1870
|
-
() => observer.complete?.()
|
|
1871
|
-
);
|
|
1872
|
-
return () => subscription.unsubscribe();
|
|
1873
|
-
});
|
|
1874
|
-
};
|
|
1875
|
-
}
|
|
1876
|
-
function reduce(accumulator, seed) {
|
|
1877
|
-
return (source) => {
|
|
1878
|
-
return new Observable((observer) => {
|
|
1879
|
-
let acc = seed;
|
|
1880
|
-
const subscription = source.subscribe(
|
|
1881
|
-
(value) => {
|
|
1882
|
-
try {
|
|
1883
|
-
acc = accumulator(acc, value);
|
|
1884
|
-
} catch (err) {
|
|
1885
|
-
observer.error?.(err);
|
|
1886
|
-
}
|
|
1887
|
-
},
|
|
1888
|
-
(err) => observer.error?.(err),
|
|
1889
|
-
() => {
|
|
1890
|
-
observer.next(acc);
|
|
1891
|
-
observer.complete?.();
|
|
1892
|
-
}
|
|
1893
|
-
);
|
|
1894
|
-
return () => subscription.unsubscribe();
|
|
1895
|
-
});
|
|
1896
|
-
};
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
// src/shared/observable/subject.ts
|
|
1900
|
-
var Subject = class extends Observable {
|
|
1901
|
-
constructor() {
|
|
1902
|
-
super();
|
|
1903
|
-
this.subscribers = /* @__PURE__ */ new Set();
|
|
1904
|
-
this._isCompleted = false;
|
|
1905
|
-
this._hasError = false;
|
|
1906
|
-
this._thrownError = null;
|
|
1907
|
-
}
|
|
1908
|
-
asObservable() {
|
|
1909
|
-
return new Observable((observer) => {
|
|
1910
|
-
const subscription = this.subscribe(observer);
|
|
1911
|
-
return () => subscription.unsubscribe();
|
|
1912
|
-
});
|
|
1913
|
-
}
|
|
1914
|
-
subscribe(observerOrNext, error, complete) {
|
|
1915
|
-
if (this._isCompleted) {
|
|
1916
|
-
const obs = typeof observerOrNext === "function" ? { complete } : observerOrNext;
|
|
1917
|
-
obs.complete?.();
|
|
1918
|
-
return { unsubscribe: () => {
|
|
1919
|
-
} };
|
|
1920
|
-
}
|
|
1921
|
-
if (this._hasError) {
|
|
1922
|
-
return { unsubscribe: () => {
|
|
1923
|
-
} };
|
|
1924
|
-
}
|
|
1925
|
-
const observer = typeof observerOrNext === "function" ? { next: observerOrNext, error, complete } : observerOrNext;
|
|
1926
|
-
this.subscribers.add(observer);
|
|
1927
|
-
return {
|
|
1928
|
-
unsubscribe: () => {
|
|
1929
|
-
this.subscribers.delete(observer);
|
|
1930
|
-
}
|
|
1931
|
-
};
|
|
1932
|
-
}
|
|
1933
|
-
next(value) {
|
|
1934
|
-
if (this._isCompleted || this._hasError) return;
|
|
1935
|
-
const currentSubscribers = Array.from(this.subscribers);
|
|
1936
|
-
currentSubscribers.forEach((observer) => {
|
|
1937
|
-
if (this.subscribers.has(observer)) {
|
|
1938
|
-
try {
|
|
1939
|
-
observer.next(value);
|
|
1940
|
-
} catch (err) {
|
|
1941
|
-
console.error("Error in observer:", err);
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
error(err) {
|
|
1947
|
-
if (this._isCompleted || this._hasError) return;
|
|
1948
|
-
this._hasError = true;
|
|
1949
|
-
this._thrownError = err;
|
|
1950
|
-
for (const observer of this.subscribers) {
|
|
1951
|
-
observer.error?.(err);
|
|
1952
|
-
}
|
|
1953
|
-
this.subscribers.clear();
|
|
1954
|
-
}
|
|
1955
|
-
complete() {
|
|
1956
|
-
if (this._isCompleted || this._hasError) return;
|
|
1957
|
-
this._isCompleted = true;
|
|
1958
|
-
const currentSubscribers = Array.from(this.subscribers);
|
|
1959
|
-
currentSubscribers.forEach((observer) => {
|
|
1960
|
-
if (observer.complete) {
|
|
1961
|
-
try {
|
|
1962
|
-
observer.complete();
|
|
1963
|
-
} catch (err) {
|
|
1964
|
-
console.error("Error in complete handler:", err);
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
});
|
|
1968
|
-
this.subscribers.clear();
|
|
1969
|
-
}
|
|
1970
|
-
};
|
|
1971
|
-
|
|
1972
|
-
// src/shared/observable/bsubject.ts
|
|
1973
|
-
var BehaviorSubject = class extends Subject {
|
|
1974
|
-
constructor(initialValue) {
|
|
1975
|
-
super();
|
|
1976
|
-
this._value = initialValue;
|
|
1977
|
-
}
|
|
1978
|
-
get $value() {
|
|
1979
|
-
return this._value;
|
|
1980
|
-
}
|
|
1981
|
-
next(value) {
|
|
1982
|
-
this._value = value;
|
|
1983
|
-
super.next(value);
|
|
1984
|
-
}
|
|
1985
|
-
subscribe(observerOrNext, error, complete) {
|
|
1986
|
-
const observer = typeof observerOrNext === "function" ? { next: observerOrNext, error, complete } : observerOrNext;
|
|
1987
|
-
if (this._hasError) {
|
|
1988
|
-
observer.error?.(this._thrownError);
|
|
1989
|
-
return { unsubscribe: () => {
|
|
1990
|
-
} };
|
|
1991
|
-
}
|
|
1992
|
-
if (this._isCompleted) {
|
|
1993
|
-
observer.complete?.();
|
|
1994
|
-
return { unsubscribe: () => {
|
|
1995
|
-
} };
|
|
1996
|
-
}
|
|
1997
|
-
observer.next(this._value);
|
|
1998
|
-
return super.subscribe(observer);
|
|
1999
|
-
}
|
|
2000
|
-
};
|
|
2001
1643
|
|
|
2002
1644
|
// src/shared/component.ts
|
|
2003
1645
|
var OrcaComponent = class {
|
|
@@ -2015,6 +1657,7 @@ var kithinjiorca = (() => {
|
|
|
2015
1657
|
};
|
|
2016
1658
|
|
|
2017
1659
|
// src/shared/module_libs/http_client/module.ts
|
|
1660
|
+
var import_rxjs = __require("rxjs");
|
|
2018
1661
|
var __decorate = function(decorators, target, key, desc) {
|
|
2019
1662
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2020
1663
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2023,7 +1666,7 @@ var kithinjiorca = (() => {
|
|
|
2023
1666
|
};
|
|
2024
1667
|
var HttpClient = class HttpClient2 {
|
|
2025
1668
|
get(url, { stream = "json", reviver, init } = {}) {
|
|
2026
|
-
return new Observable((subscriber) => {
|
|
1669
|
+
return new import_rxjs.Observable((subscriber) => {
|
|
2027
1670
|
const controller = new AbortController();
|
|
2028
1671
|
fetch(url, {
|
|
2029
1672
|
method: "GET",
|
|
@@ -2462,9 +2105,21 @@ var kithinjiorca = (() => {
|
|
|
2462
2105
|
register2(ComponentClass, injector);
|
|
2463
2106
|
const cleanProps = { ...props };
|
|
2464
2107
|
delete cleanProps.__clientComponent;
|
|
2465
|
-
const instance = injector.resolve(ComponentClass);
|
|
2108
|
+
const instance = await injector.resolve(ComponentClass);
|
|
2466
2109
|
instance.__injector = injector;
|
|
2467
|
-
|
|
2110
|
+
const mergedProps = Object.create(
|
|
2111
|
+
Object.getPrototypeOf(instance.props || {})
|
|
2112
|
+
);
|
|
2113
|
+
Object.defineProperties(
|
|
2114
|
+
mergedProps,
|
|
2115
|
+
Object.getOwnPropertyDescriptors(instance.props || {})
|
|
2116
|
+
);
|
|
2117
|
+
Object.defineProperties(
|
|
2118
|
+
mergedProps,
|
|
2119
|
+
Object.getOwnPropertyDescriptors(cleanProps || {})
|
|
2120
|
+
);
|
|
2121
|
+
instance.props = mergedProps;
|
|
2122
|
+
instance.onInit?.();
|
|
2468
2123
|
if (typeof instance.build !== "function") {
|
|
2469
2124
|
throw new Error(`Component ${name} does not implement build()`);
|
|
2470
2125
|
}
|
|
@@ -2478,11 +2133,6 @@ var kithinjiorca = (() => {
|
|
|
2478
2133
|
}
|
|
2479
2134
|
};
|
|
2480
2135
|
|
|
2481
|
-
// src/shared/macros/index.ts
|
|
2482
|
-
function assert$(context) {
|
|
2483
|
-
return context?.factory.createStringLiteral("assert");
|
|
2484
|
-
}
|
|
2485
|
-
|
|
2486
2136
|
// src/shared/providers/actor.ts
|
|
2487
2137
|
var BaseActor = class {
|
|
2488
2138
|
constructor() {
|
|
@@ -2606,6 +2256,7 @@ var kithinjiorca = (() => {
|
|
|
2606
2256
|
};
|
|
2607
2257
|
|
|
2608
2258
|
// src/browser/modules/router_module/navigate.ts
|
|
2259
|
+
var import_rxjs2 = __require("rxjs");
|
|
2609
2260
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
2610
2261
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2611
2262
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2627,30 +2278,39 @@ var kithinjiorca = (() => {
|
|
|
2627
2278
|
this.STORAGE_KEY = "navigate_stack";
|
|
2628
2279
|
const savedState = this.loadFromStorage();
|
|
2629
2280
|
const historyCursor = history.state?.cursor;
|
|
2630
|
-
if (savedState && historyCursor !== void 0) {
|
|
2281
|
+
if (savedState && historyCursor !== void 0 && savedState.routes[historyCursor]) {
|
|
2631
2282
|
this.cursor = historyCursor;
|
|
2632
|
-
const restoredPages = savedState.routes.map(() =>
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2283
|
+
const restoredPages = savedState.routes.map((routeData, idx) => ({
|
|
2284
|
+
content: idx === this.cursor ? this.createStreamForRoute(routeData.path) : null,
|
|
2285
|
+
isOverlay: routeData.isOverlay,
|
|
2286
|
+
route: routeData.path
|
|
2287
|
+
}));
|
|
2288
|
+
this.pages = new import_rxjs2.BehaviorSubject(restoredPages);
|
|
2637
2289
|
} else {
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2290
|
+
const initialPath = window.location.pathname + window.location.search;
|
|
2291
|
+
const initialStream = this.createStreamForRoute(initialPath);
|
|
2640
2292
|
this.cursor = 0;
|
|
2641
|
-
|
|
2293
|
+
this.pages = new import_rxjs2.BehaviorSubject([
|
|
2294
|
+
{
|
|
2295
|
+
content: initialStream,
|
|
2296
|
+
isOverlay: false,
|
|
2297
|
+
route: initialPath
|
|
2298
|
+
}
|
|
2299
|
+
]);
|
|
2300
|
+
history.replaceState({ cursor: 0 }, "", initialPath);
|
|
2642
2301
|
this.saveToStorage();
|
|
2643
2302
|
}
|
|
2303
|
+
this.initListeners();
|
|
2304
|
+
}
|
|
2305
|
+
initListeners() {
|
|
2644
2306
|
window.addEventListener("popstate", (e) => {
|
|
2645
2307
|
const newCursor = e.state?.cursor ?? 0;
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
const route = savedState2?.routes[newCursor] || window.location.pathname + window.location.search;
|
|
2651
|
-
const stream = this.createStreamForRoute(route);
|
|
2652
|
-
currentPages[newCursor] = stream;
|
|
2308
|
+
const currentPages = [...this.pages.value];
|
|
2309
|
+
if (currentPages[newCursor] && !currentPages[newCursor].content) {
|
|
2310
|
+
const route = currentPages[newCursor].route || window.location.pathname + window.location.search;
|
|
2311
|
+
currentPages[newCursor].content = this.createStreamForRoute(route);
|
|
2653
2312
|
}
|
|
2313
|
+
this.cursor = newCursor;
|
|
2654
2314
|
this.pages.next(currentPages);
|
|
2655
2315
|
});
|
|
2656
2316
|
}
|
|
@@ -2664,75 +2324,77 @@ var kithinjiorca = (() => {
|
|
|
2664
2324
|
}
|
|
2665
2325
|
saveToStorage() {
|
|
2666
2326
|
try {
|
|
2667
|
-
const currentPages = this.pages.$value || [];
|
|
2668
|
-
const routes = currentPages.map((page, index) => {
|
|
2669
|
-
if (page && typeof page === "object" && "__route" in page) {
|
|
2670
|
-
return page.__route;
|
|
2671
|
-
}
|
|
2672
|
-
const savedState = this.loadFromStorage();
|
|
2673
|
-
return savedState?.routes[index] || "";
|
|
2674
|
-
});
|
|
2675
2327
|
const state = {
|
|
2676
|
-
routes
|
|
2328
|
+
routes: this.pages.value.map((p) => ({
|
|
2329
|
+
path: p.route || "",
|
|
2330
|
+
isOverlay: p.isOverlay
|
|
2331
|
+
})),
|
|
2677
2332
|
cursor: this.cursor
|
|
2678
2333
|
};
|
|
2679
2334
|
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(state));
|
|
2680
|
-
} catch {
|
|
2335
|
+
} catch (e) {
|
|
2336
|
+
console.error("Navigation persistence failed", e);
|
|
2681
2337
|
}
|
|
2682
2338
|
}
|
|
2683
2339
|
createStreamForRoute(route) {
|
|
2684
2340
|
const http = new HttpClient();
|
|
2685
2341
|
let url = this.oscUrl;
|
|
2686
2342
|
if (route && route !== "/") {
|
|
2687
|
-
|
|
2343
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
2344
|
+
url = `${url}${separator}c=${encodeURIComponent(route)}`;
|
|
2688
2345
|
}
|
|
2689
2346
|
return http.post(url, {
|
|
2690
2347
|
stream: "ndjson",
|
|
2691
2348
|
reviver: symbolValueReviver
|
|
2692
2349
|
});
|
|
2693
2350
|
}
|
|
2694
|
-
createStreamForCurrentUrl() {
|
|
2695
|
-
const path = window.location.pathname;
|
|
2696
|
-
const search = window.location.search;
|
|
2697
|
-
const fullPath = search ? `${path}${search}` : path;
|
|
2698
|
-
return this.createStreamForRoute(fullPath);
|
|
2699
|
-
}
|
|
2700
2351
|
go(path) {
|
|
2701
2352
|
const stream = this.createStreamForRoute(path);
|
|
2702
2353
|
stream.__route = path;
|
|
2703
|
-
this.push(stream);
|
|
2354
|
+
this.push(stream, false);
|
|
2704
2355
|
}
|
|
2705
|
-
push(item) {
|
|
2706
|
-
const currentPages = this.pages
|
|
2356
|
+
push(item, isOverlay = false) {
|
|
2357
|
+
const currentPages = this.pages.value || [];
|
|
2707
2358
|
const newPages = currentPages.slice(0, this.cursor + 1);
|
|
2708
2359
|
let route = "";
|
|
2709
2360
|
if (item && typeof item === "object" && "__route" in item) {
|
|
2710
2361
|
route = item.__route;
|
|
2711
2362
|
}
|
|
2712
2363
|
this.cursor++;
|
|
2713
|
-
newPages.push(
|
|
2714
|
-
|
|
2364
|
+
newPages.push({
|
|
2365
|
+
content: item,
|
|
2366
|
+
isOverlay,
|
|
2367
|
+
route
|
|
2368
|
+
});
|
|
2369
|
+
history.pushState({ cursor: this.cursor }, "", route || void 0);
|
|
2715
2370
|
this.pages.next(newPages);
|
|
2716
2371
|
this.saveToStorage();
|
|
2717
2372
|
}
|
|
2373
|
+
pushOverlay(item) {
|
|
2374
|
+
this.push(item, true);
|
|
2375
|
+
}
|
|
2376
|
+
pop() {
|
|
2377
|
+
if (this.canGoBack()) {
|
|
2378
|
+
history.back();
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2718
2381
|
replace(item) {
|
|
2719
|
-
const currentPages = [...this.pages
|
|
2720
|
-
currentPages[this.cursor]
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2382
|
+
const currentPages = [...this.pages.value || []];
|
|
2383
|
+
if (currentPages[this.cursor]) {
|
|
2384
|
+
currentPages[this.cursor].content = item;
|
|
2385
|
+
this.pages.next(currentPages);
|
|
2386
|
+
this.saveToStorage();
|
|
2387
|
+
}
|
|
2724
2388
|
}
|
|
2725
2389
|
resolveStream(index, element) {
|
|
2726
|
-
const currentPages = [...this.pages
|
|
2390
|
+
const currentPages = [...this.pages.value || []];
|
|
2727
2391
|
if (index >= 0 && index < currentPages.length) {
|
|
2728
|
-
currentPages[index] = element;
|
|
2392
|
+
currentPages[index].content = element;
|
|
2729
2393
|
this.pages.next(currentPages);
|
|
2730
2394
|
}
|
|
2731
2395
|
}
|
|
2732
2396
|
goBack() {
|
|
2733
|
-
|
|
2734
|
-
history.back();
|
|
2735
|
-
}
|
|
2397
|
+
this.pop();
|
|
2736
2398
|
}
|
|
2737
2399
|
goForward() {
|
|
2738
2400
|
if (this.canGoForward()) {
|
|
@@ -2743,17 +2405,22 @@ var kithinjiorca = (() => {
|
|
|
2743
2405
|
return this.cursor > 0;
|
|
2744
2406
|
}
|
|
2745
2407
|
canGoForward() {
|
|
2746
|
-
|
|
2747
|
-
return this.cursor < currentPages.length - 1;
|
|
2408
|
+
return this.cursor < (this.pages.value?.length || 0) - 1;
|
|
2748
2409
|
}
|
|
2749
2410
|
getCurrentPage() {
|
|
2750
|
-
|
|
2751
|
-
return currentPages[this.cursor];
|
|
2411
|
+
return this.pages.value[this.cursor];
|
|
2752
2412
|
}
|
|
2753
2413
|
clear() {
|
|
2754
2414
|
this.cursor = 0;
|
|
2755
|
-
const
|
|
2756
|
-
this.
|
|
2415
|
+
const initialPath = window.location.pathname + window.location.search;
|
|
2416
|
+
const initialStream = this.createStreamForRoute(initialPath);
|
|
2417
|
+
this.pages.next([
|
|
2418
|
+
{
|
|
2419
|
+
content: initialStream,
|
|
2420
|
+
isOverlay: false,
|
|
2421
|
+
route: initialPath
|
|
2422
|
+
}
|
|
2423
|
+
]);
|
|
2757
2424
|
history.replaceState({ cursor: 0 }, "");
|
|
2758
2425
|
this.saveToStorage();
|
|
2759
2426
|
}
|
|
@@ -2778,42 +2445,87 @@ var kithinjiorca = (() => {
|
|
|
2778
2445
|
constructor(navigate) {
|
|
2779
2446
|
super();
|
|
2780
2447
|
this.navigate = navigate;
|
|
2781
|
-
this.
|
|
2448
|
+
this.activeStreamSubscriptions = /* @__PURE__ */ new Map();
|
|
2782
2449
|
}
|
|
2783
2450
|
build() {
|
|
2784
2451
|
const anchor = document.createElement("div");
|
|
2452
|
+
anchor.style.position = "relative";
|
|
2453
|
+
anchor.style.width = "100%";
|
|
2454
|
+
anchor.style.height = "100%";
|
|
2785
2455
|
const subscription = this.navigate.pages.subscribe((pages) => {
|
|
2786
|
-
this.
|
|
2456
|
+
this.renderPages(anchor, pages);
|
|
2787
2457
|
});
|
|
2788
2458
|
this.pushDrop(() => subscription.unsubscribe());
|
|
2789
2459
|
this.pushDrop(() => {
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
}
|
|
2460
|
+
this.activeStreamSubscriptions.forEach((info) => {
|
|
2461
|
+
info.subscription.unsubscribe();
|
|
2462
|
+
});
|
|
2463
|
+
this.activeStreamSubscriptions.clear();
|
|
2793
2464
|
});
|
|
2794
2465
|
return anchor;
|
|
2795
2466
|
}
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2467
|
+
renderPages(anchor, pages) {
|
|
2468
|
+
let baseIndex = this.navigate.cursor;
|
|
2469
|
+
while (baseIndex > 0 && pages[baseIndex]?.isOverlay) {
|
|
2470
|
+
baseIndex--;
|
|
2471
|
+
}
|
|
2472
|
+
anchor.replaceChildren();
|
|
2473
|
+
if (pages[baseIndex]) {
|
|
2474
|
+
const baseContainer = document.createElement("div");
|
|
2475
|
+
baseContainer.className = "base-page";
|
|
2476
|
+
baseContainer.style.width = "100%";
|
|
2477
|
+
baseContainer.style.height = "100%";
|
|
2478
|
+
this.renderPage(baseContainer, pages[baseIndex].content, baseIndex);
|
|
2479
|
+
anchor.appendChild(baseContainer);
|
|
2480
|
+
}
|
|
2481
|
+
for (let i = baseIndex + 1; i <= this.navigate.cursor; i++) {
|
|
2482
|
+
if (pages[i] && pages[i].isOverlay) {
|
|
2483
|
+
const overlayContainer = document.createElement("div");
|
|
2484
|
+
overlayContainer.className = "overlay";
|
|
2485
|
+
overlayContainer.style.position = "fixed";
|
|
2486
|
+
overlayContainer.style.inset = "0";
|
|
2487
|
+
overlayContainer.style.zIndex = String(1e3 + (i - baseIndex));
|
|
2488
|
+
this.renderPage(overlayContainer, pages[i].content, i);
|
|
2489
|
+
anchor.appendChild(overlayContainer);
|
|
2490
|
+
}
|
|
2801
2491
|
}
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2492
|
+
const visibleIndices = /* @__PURE__ */ new Set();
|
|
2493
|
+
visibleIndices.add(baseIndex);
|
|
2494
|
+
for (let i = baseIndex + 1; i <= this.navigate.cursor; i++) {
|
|
2495
|
+
if (pages[i]?.isOverlay) {
|
|
2496
|
+
visibleIndices.add(i);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
this.activeStreamSubscriptions.forEach((info, index) => {
|
|
2500
|
+
if (!visibleIndices.has(index)) {
|
|
2501
|
+
info.subscription.unsubscribe();
|
|
2502
|
+
this.activeStreamSubscriptions.delete(index);
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
renderPage(container, content, index) {
|
|
2507
|
+
const existing = this.activeStreamSubscriptions.get(index);
|
|
2508
|
+
if (existing) {
|
|
2509
|
+
existing.subscription.unsubscribe();
|
|
2510
|
+
this.activeStreamSubscriptions.delete(index);
|
|
2511
|
+
}
|
|
2512
|
+
if (!content) {
|
|
2513
|
+
container.replaceChildren();
|
|
2514
|
+
return;
|
|
2805
2515
|
}
|
|
2806
|
-
if (this.isObservable(
|
|
2807
|
-
this.renderStream(
|
|
2516
|
+
if (this.isObservable(content)) {
|
|
2517
|
+
this.renderStream(container, content, index);
|
|
2808
2518
|
} else {
|
|
2809
|
-
|
|
2519
|
+
container.replaceChildren(content);
|
|
2810
2520
|
}
|
|
2811
2521
|
}
|
|
2812
|
-
renderStream(
|
|
2522
|
+
renderStream(container, stream, index) {
|
|
2813
2523
|
const root = document.createElement("div");
|
|
2814
|
-
|
|
2524
|
+
root.style.width = "100%";
|
|
2525
|
+
root.style.height = "100%";
|
|
2526
|
+
container.replaceChildren(root);
|
|
2815
2527
|
const osc = new OSC(root);
|
|
2816
|
-
|
|
2528
|
+
const subscription = stream.subscribe((jsx2) => {
|
|
2817
2529
|
const action = jsx2.action || "insert";
|
|
2818
2530
|
if (action === "insert") {
|
|
2819
2531
|
osc.handleInsert(jsx2);
|
|
@@ -2824,11 +2536,14 @@ var kithinjiorca = (() => {
|
|
|
2824
2536
|
}
|
|
2825
2537
|
}, (error) => {
|
|
2826
2538
|
console.error("Stream error:", error);
|
|
2539
|
+
container.innerHTML = `<div>Error loading page: ${error.message}</div>`;
|
|
2540
|
+
this.activeStreamSubscriptions.delete(index);
|
|
2827
2541
|
}, () => {
|
|
2828
2542
|
const resolvedElement = osc.tree.dom;
|
|
2829
|
-
this.navigate.resolveStream(
|
|
2830
|
-
this.
|
|
2543
|
+
this.navigate.resolveStream(index, resolvedElement);
|
|
2544
|
+
this.activeStreamSubscriptions.delete(index);
|
|
2831
2545
|
});
|
|
2546
|
+
this.activeStreamSubscriptions.set(index, { subscription, index });
|
|
2832
2547
|
}
|
|
2833
2548
|
isObservable(obj) {
|
|
2834
2549
|
return obj && typeof obj.subscribe === "function";
|
|
@@ -2888,7 +2603,7 @@ var kithinjiorca = (() => {
|
|
|
2888
2603
|
static instantiateEagerProviders(appNode, injector) {
|
|
2889
2604
|
appNode.traverse((node) => {
|
|
2890
2605
|
const providers = [...node.getProviders().values()];
|
|
2891
|
-
providers.filter((provider) => provider.eager).forEach((p) => injector.resolve(p.provide));
|
|
2606
|
+
providers.filter((provider) => provider.eager).forEach(async (p) => await injector.resolve(p.provide));
|
|
2892
2607
|
});
|
|
2893
2608
|
}
|
|
2894
2609
|
};
|
|
@@ -2900,8 +2615,8 @@ var kithinjiorca = (() => {
|
|
|
2900
2615
|
}
|
|
2901
2616
|
return bootstrap;
|
|
2902
2617
|
}
|
|
2903
|
-
static renderBootstrap(bootstrap, injector, rootElement) {
|
|
2904
|
-
const instance = injector.resolve(bootstrap);
|
|
2618
|
+
static async renderBootstrap(bootstrap, injector, rootElement) {
|
|
2619
|
+
const instance = await injector.resolve(bootstrap);
|
|
2905
2620
|
instance.__injector = injector;
|
|
2906
2621
|
const childDom = instance.build();
|
|
2907
2622
|
rootElement.appendChild(childDom);
|
|
@@ -2915,14 +2630,14 @@ var kithinjiorca = (() => {
|
|
|
2915
2630
|
* @param rootElement - The DOM element to mount the application to
|
|
2916
2631
|
* @throws {Error} If validation fails or bootstrap component is not found
|
|
2917
2632
|
*/
|
|
2918
|
-
static create(rootModule, rootElement) {
|
|
2633
|
+
static async create(rootModule, rootElement) {
|
|
2919
2634
|
const compilationService = new CompilationService();
|
|
2920
2635
|
const appNode = compilationService.compileAndValidate(rootModule);
|
|
2921
2636
|
const rootInjector = InjectorConfigurationService.createRootInjector(appNode);
|
|
2922
2637
|
setCurrentInjector(rootInjector);
|
|
2923
2638
|
InjectorConfigurationService.instantiateEagerProviders(appNode, rootInjector);
|
|
2924
2639
|
const bootstrap = BootstrapService.getBootstrapComponent(rootModule);
|
|
2925
|
-
BootstrapService.renderBootstrap(bootstrap, rootInjector, rootElement);
|
|
2640
|
+
await BootstrapService.renderBootstrap(bootstrap, rootInjector, rootElement);
|
|
2926
2641
|
}
|
|
2927
2642
|
};
|
|
2928
2643
|
|
|
@@ -3054,7 +2769,7 @@ var kithinjiorca = (() => {
|
|
|
3054
2769
|
}
|
|
3055
2770
|
let instance;
|
|
3056
2771
|
try {
|
|
3057
|
-
instance = injector.
|
|
2772
|
+
instance = injector.resolveSync(ComponentClass);
|
|
3058
2773
|
} catch (e) {
|
|
3059
2774
|
console.log(e);
|
|
3060
2775
|
throw new Error(`Failed to resolve component ${ComponentClass.name}: ${e.message}`);
|