@dooboostore/simple-web-component 1.0.25 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +284 -68
  2. package/dist/cjs/decorators/attribute.js +32 -43
  3. package/dist/cjs/decorators/attribute.js.map +3 -3
  4. package/dist/cjs/decorators/elementDefine.js +33 -19
  5. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  6. package/dist/cjs/decorators/index.js +1 -0
  7. package/dist/cjs/decorators/index.js.map +2 -2
  8. package/dist/cjs/decorators/lifecycles.js +5 -5
  9. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  10. package/dist/cjs/decorators/query.js +4 -4
  11. package/dist/cjs/decorators/query.js.map +2 -2
  12. package/dist/cjs/decorators/queryAll.js +4 -4
  13. package/dist/cjs/decorators/queryAll.js.map +2 -2
  14. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js +59 -0
  15. package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  16. package/dist/cjs/elements/SwcAppEngine.js +18 -63
  17. package/dist/cjs/elements/SwcAppEngine.js.map +3 -3
  18. package/dist/cjs/elements/SwcAppMixin.js +103 -24
  19. package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
  20. package/dist/cjs/elements/register.js +0 -1
  21. package/dist/cjs/elements/register.js.map +2 -2
  22. package/dist/cjs/utils/Utils.js +18 -0
  23. package/dist/cjs/utils/Utils.js.map +3 -3
  24. package/dist/esm/decorators/attribute.js +32 -43
  25. package/dist/esm/decorators/attribute.js.map +3 -3
  26. package/dist/esm/decorators/elementDefine.js +34 -20
  27. package/dist/esm/decorators/elementDefine.js.map +2 -2
  28. package/dist/esm/decorators/index.js +1 -0
  29. package/dist/esm/decorators/index.js.map +2 -2
  30. package/dist/esm/decorators/lifecycles.js +5 -5
  31. package/dist/esm/decorators/lifecycles.js.map +2 -2
  32. package/dist/esm/decorators/query.js +4 -4
  33. package/dist/esm/decorators/query.js.map +2 -2
  34. package/dist/esm/decorators/queryAll.js +4 -4
  35. package/dist/esm/decorators/queryAll.js.map +2 -2
  36. package/dist/esm/decorators/subscribeSwcAppRouteChange.js +40 -0
  37. package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
  38. package/dist/esm/elements/SwcAppEngine.js +18 -63
  39. package/dist/esm/elements/SwcAppEngine.js.map +2 -2
  40. package/dist/esm/elements/SwcAppMixin.js +103 -24
  41. package/dist/esm/elements/SwcAppMixin.js.map +2 -2
  42. package/dist/esm/elements/register.js +0 -1
  43. package/dist/esm/elements/register.js.map +2 -2
  44. package/dist/esm/utils/Utils.js +18 -0
  45. package/dist/esm/utils/Utils.js.map +3 -3
  46. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +135 -2470
  47. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  48. package/dist/types/decorators/attribute.d.ts +0 -1
  49. package/dist/types/decorators/attribute.d.ts.map +1 -1
  50. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  51. package/dist/types/decorators/index.d.ts +1 -0
  52. package/dist/types/decorators/index.d.ts.map +1 -1
  53. package/dist/types/decorators/lifecycles.d.ts +2 -2
  54. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  55. package/dist/types/decorators/query.d.ts +1 -1
  56. package/dist/types/decorators/query.d.ts.map +1 -1
  57. package/dist/types/decorators/queryAll.d.ts +1 -1
  58. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  59. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +18 -0
  60. package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
  61. package/dist/types/elements/SwcAppEngine.d.ts +3 -5
  62. package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
  63. package/dist/types/elements/SwcAppMixin.d.ts +9 -0
  64. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
  65. package/dist/types/elements/register.d.ts +1 -1
  66. package/dist/types/elements/register.d.ts.map +1 -1
  67. package/dist/types/utils/Utils.d.ts +3 -0
  68. package/dist/types/utils/Utils.d.ts.map +1 -1
  69. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +135 -2470
  70. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  71. package/package.json +3 -3
  72. package/src/decorators/attribute.ts +62 -53
  73. package/src/decorators/elementDefine.ts +79 -30
  74. package/src/decorators/index.ts +1 -0
  75. package/src/decorators/lifecycles.ts +2 -2
  76. package/src/decorators/query.ts +5 -5
  77. package/src/decorators/queryAll.ts +8 -7
  78. package/src/decorators/subscribeSwcAppRouteChange.ts +71 -0
  79. package/src/elements/SwcAppEngine.ts +25 -81
  80. package/src/elements/SwcAppMixin.ts +143 -28
  81. package/src/elements/register.ts +0 -2
  82. package/src/utils/Utils.ts +33 -0
@@ -297,8 +297,8 @@ var require_Reflect = __commonJS({
297
297
  keys.push(key);
298
298
  }
299
299
  }
300
- for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
301
- var key = parentKeys_1[_a4];
300
+ for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
301
+ var key = parentKeys_1[_a];
302
302
  var hasKey = set.has(key);
303
303
  if (!hasKey) {
304
304
  set.add(key);
@@ -1110,10 +1110,10 @@ var require_Reflect = __commonJS({
1110
1110
  });
1111
1111
 
1112
1112
  // src/bundle-entry.ts
1113
- var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
1113
+ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1114
1114
 
1115
1115
  // src/index.ts
1116
- var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
1116
+ var import_reflect_metadata = __toESM(require_Reflect(), 1);
1117
1117
 
1118
1118
  // ../core/dist/esm/valid/ValidUtils.js
1119
1119
  var ValidUtils;
@@ -4789,107 +4789,6 @@ var Observable = class {
4789
4789
  }
4790
4790
  };
4791
4791
 
4792
- // ../core/dist/esm/message/Subject.js
4793
- var Subject = class extends Observable {
4794
- constructor() {
4795
- super((subscriber) => {
4796
- return this._subscribeToSubject(subscriber);
4797
- });
4798
- this._observers = /* @__PURE__ */ new Set();
4799
- this._isStopped = false;
4800
- this._hasError = false;
4801
- }
4802
- _subscribeToSubject(subscriber) {
4803
- const partialObserver = {
4804
- next: subscriber.next.bind(subscriber),
4805
- error: subscriber.error.bind(subscriber),
4806
- complete: subscriber.complete.bind(subscriber)
4807
- };
4808
- if (this._isStopped) {
4809
- if (this._hasError) {
4810
- partialObserver.error?.(this._error);
4811
- } else {
4812
- partialObserver.complete?.();
4813
- }
4814
- return Subscription.EMPTY;
4815
- }
4816
- this._observers.add(partialObserver);
4817
- return new Subscription(() => {
4818
- this._observers.delete(partialObserver);
4819
- });
4820
- }
4821
- next(data) {
4822
- if (this._isStopped) {
4823
- return;
4824
- }
4825
- this._observers.forEach((observer) => {
4826
- observer.next?.(data);
4827
- });
4828
- }
4829
- error(err) {
4830
- if (this._isStopped) {
4831
- return;
4832
- }
4833
- this._hasError = true;
4834
- this._error = err;
4835
- this._isStopped = true;
4836
- this._observers.forEach((observer) => observer.error?.(err));
4837
- this._observers.clear();
4838
- }
4839
- complete() {
4840
- if (this._isStopped) {
4841
- return;
4842
- }
4843
- this._isStopped = true;
4844
- this._observers.forEach((observer) => observer.complete?.());
4845
- this._observers.clear();
4846
- }
4847
- asObservable() {
4848
- return new Observable((subscriber) => {
4849
- return this._subscribeToSubject(subscriber);
4850
- });
4851
- }
4852
- };
4853
-
4854
- // ../core/dist/esm/message/ReplaySubject.js
4855
- var ReplaySubject = class extends Subject {
4856
- // Removed: private _error: E | undefined;
4857
- // Removed: private _isStopped = false;
4858
- constructor(bufferSize = Infinity) {
4859
- super();
4860
- this.bufferSize = bufferSize;
4861
- this._buffer = [];
4862
- }
4863
- next(data) {
4864
- if (this._isStopped) {
4865
- return;
4866
- }
4867
- this._buffer.push(data);
4868
- if (this._buffer.length > this.bufferSize) {
4869
- this._buffer.shift();
4870
- }
4871
- super.next(data);
4872
- }
4873
- error(err) {
4874
- super.error(err);
4875
- }
4876
- complete() {
4877
- super.complete();
4878
- }
4879
- _subscribeToSubject(subscriber) {
4880
- this._buffer.forEach((value) => subscriber.next(value));
4881
- if (this._isStopped) {
4882
- if (this._hasError) {
4883
- subscriber.error(this._error);
4884
- } else {
4885
- subscriber.complete();
4886
- }
4887
- return Subscription.EMPTY;
4888
- }
4889
- return super._subscribeToSubject(subscriber);
4890
- }
4891
- };
4892
-
4893
4792
  // ../core/dist/esm/message/AutoCloseSubscription.js
4894
4793
  var AutoCloseSubscription = class extends Subscription {
4895
4794
  constructor(userUnsubscribe) {
@@ -5224,284 +5123,6 @@ var Promises;
5224
5123
  })(Result = Promises2.Result || (Promises2.Result = {}));
5225
5124
  })(Promises || (Promises = {}));
5226
5125
 
5227
- // ../core/dist/esm/fetch/Fetcher.js
5228
- var Fetcher = class {
5229
- createPipe(config) {
5230
- return {};
5231
- }
5232
- fetch(config) {
5233
- return new Promise((resolve, reject) => {
5234
- const pipe = this.createPipe(config);
5235
- Promise.resolve().then(() => {
5236
- this.before(config, pipe);
5237
- config?.before?.();
5238
- }).then(() => {
5239
- return this.execute(config);
5240
- }).then((data) => {
5241
- const hasError = config.config?.hasErrorChecker?.(data);
5242
- if (hasError) {
5243
- throw hasError;
5244
- }
5245
- pipe.responseData = data;
5246
- this.afterSuccess(config, pipe);
5247
- config?.afterSuccess?.();
5248
- const gdata = config?.transform ? config.transform(data) : data;
5249
- this.afterSuccessTransform(config, pipe);
5250
- resolve(gdata);
5251
- }).catch(async (e) => {
5252
- this.error(config, pipe, e);
5253
- config?.error?.();
5254
- if (config?.errorTransform) {
5255
- e = await config.errorTransform(e);
5256
- }
5257
- e = await this.errorTransform(e);
5258
- reject(e);
5259
- }).finally(() => {
5260
- this.finally(config, pipe);
5261
- config?.finally?.();
5262
- });
5263
- });
5264
- }
5265
- };
5266
-
5267
- // ../core/dist/esm/fetch/HttpFetcher.js
5268
- var HttpResponseError = class extends Error {
5269
- };
5270
- var HttpFetcher = class extends Fetcher {
5271
- get(config) {
5272
- config.config ?? (config.config = {});
5273
- config.config.fetch = config.config?.fetch ?? {};
5274
- config.config.fetch.method = "GET";
5275
- return this.fetch(config);
5276
- }
5277
- post(config) {
5278
- config.config ?? (config.config = {});
5279
- config.config.fetch = config.config?.fetch ?? {};
5280
- config.config.fetch.method = "POST";
5281
- return this.fetch(config);
5282
- }
5283
- patch(config) {
5284
- config.config ?? (config.config = {});
5285
- config.config.fetch = config.config?.fetch ?? {};
5286
- config.config.fetch.method = "PATCH";
5287
- return this.fetch(config);
5288
- }
5289
- put(config) {
5290
- config.config ?? (config.config = {});
5291
- config.config.fetch = config.config?.fetch ?? {};
5292
- config.config.fetch.method = "PUT";
5293
- return this.fetch(config);
5294
- }
5295
- head(config) {
5296
- config.config ?? (config.config = {});
5297
- config.config.fetch = config.config?.fetch ?? {};
5298
- config.config.fetch.method = "HEAD";
5299
- return this.fetch(config);
5300
- }
5301
- delete(config) {
5302
- config.config ?? (config.config = {});
5303
- config.config.fetch = config.config?.fetch ?? {};
5304
- config.config.fetch.method = "DELETE";
5305
- return this.fetch(config);
5306
- }
5307
- async beforeProxyFetch(config) {
5308
- return config;
5309
- }
5310
- async afterProxyFetch(config) {
5311
- return config.response;
5312
- }
5313
- afterSuccess(config, pipe) {
5314
- }
5315
- afterSuccessTransform(config, pipe) {
5316
- }
5317
- before(config, pipe) {
5318
- }
5319
- error(config, pipe, e) {
5320
- }
5321
- finally(config, pipe) {
5322
- }
5323
- beforeFetch(fetch2) {
5324
- }
5325
- afterFetch(fetch2, response) {
5326
- }
5327
- // protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
5328
- async errorTransform(e) {
5329
- const httpResponseError = new HttpResponseError();
5330
- httpResponseError.error = e;
5331
- if (e instanceof Response) {
5332
- httpResponseError.response = e;
5333
- try {
5334
- httpResponseError.body = await e.clone().text();
5335
- httpResponseError.message = e.statusText;
5336
- } catch (e2) {
5337
- httpResponseError.body = e2;
5338
- httpResponseError.message = e2.message;
5339
- }
5340
- } else {
5341
- httpResponseError.body = e;
5342
- httpResponseError.message = e.message;
5343
- }
5344
- return httpResponseError;
5345
- }
5346
- async execute(fetcherRequest) {
5347
- let target = fetcherRequest.target;
5348
- let config = fetcherRequest.config;
5349
- if (!(target instanceof URL) && typeof target !== "string") {
5350
- const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5351
- try {
5352
- const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5353
- searchParams.forEach((value, key) => {
5354
- url.searchParams.append(key, value);
5355
- });
5356
- target = url;
5357
- } catch (e) {
5358
- if (typeof target.url === "string") {
5359
- const searchParamString = searchParams.toString();
5360
- target = target.url + (searchParamString ? "?" + searchParamString : "");
5361
- } else {
5362
- target = "";
5363
- }
5364
- }
5365
- }
5366
- const beforeProxyData = { requestInfo: target, init: config?.fetch };
5367
- let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5368
- beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5369
- target = beforeData.requestInfo;
5370
- if (beforeData.init) {
5371
- config ?? (config = {});
5372
- config.fetch = beforeData.init;
5373
- }
5374
- let abortedTimeout;
5375
- if (config?.fetch && "timeout" in config.fetch) {
5376
- const abortController = new AbortController();
5377
- abortedTimeout = setTimeout(() => {
5378
- if (config?.fetch?.signal) {
5379
- const inputSignal = config.fetch.signal;
5380
- const listener = () => {
5381
- if (!abortController.signal.aborted) {
5382
- abortController.abort();
5383
- }
5384
- inputSignal.removeEventListener("abort", listener);
5385
- };
5386
- inputSignal.addEventListener("abort", listener);
5387
- }
5388
- if (!abortController.signal.aborted) {
5389
- abortController.abort();
5390
- }
5391
- }, config.fetch.timeout);
5392
- config.fetch.signal = abortController.signal;
5393
- }
5394
- this.beforeFetch({ target, requestInit: config?.fetch });
5395
- return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5396
- this.afterFetch({ target, requestInit: config?.fetch }, it);
5397
- const afterProxyData = {
5398
- fetch: { target, requestInit: config.fetch },
5399
- config: beforeData,
5400
- response: it
5401
- };
5402
- it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5403
- it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5404
- config?.fetchResponseAfterCallBack?.(it, config);
5405
- if (!config?.allowedResponseNotOk && !it.ok) {
5406
- throw it;
5407
- }
5408
- const data = config?.hasResponseErrorChecker?.(it, config);
5409
- if (data) {
5410
- throw data;
5411
- }
5412
- return it;
5413
- }).finally(() => {
5414
- if (abortedTimeout) {
5415
- clearTimeout(abortedTimeout);
5416
- }
5417
- });
5418
- }
5419
- };
5420
-
5421
- // ../core/dist/esm/fetch/HttpJsonFetcher.js
5422
- var HttpJsonFetcher = class extends HttpFetcher {
5423
- updateJsonFetchConfigAndData(config) {
5424
- var _a4, _b2;
5425
- const headers = {
5426
- "Content-Type": "application/json",
5427
- Accept: "application/json, text/plain, */*"
5428
- };
5429
- config.config ?? (config.config = {});
5430
- (_a4 = config.config).fetch ?? (_a4.fetch = {});
5431
- (_b2 = config.config.fetch).headers ?? (_b2.headers = {});
5432
- config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5433
- if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5434
- config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5435
- }
5436
- return config;
5437
- }
5438
- get(config) {
5439
- return super.get(config);
5440
- }
5441
- delete(config) {
5442
- return super.delete(config);
5443
- }
5444
- post(config) {
5445
- return super.post(config);
5446
- }
5447
- patch(config) {
5448
- return super.patch(config);
5449
- }
5450
- put(config) {
5451
- return super.put(config);
5452
- }
5453
- head(config) {
5454
- return super.head(config);
5455
- }
5456
- postJson(config) {
5457
- return super.post(this.updateJsonFetchConfigAndData(config));
5458
- }
5459
- patchJson(config) {
5460
- return super.patch(this.updateJsonFetchConfigAndData(config));
5461
- }
5462
- putJson(config) {
5463
- return super.put(this.updateJsonFetchConfigAndData(config));
5464
- }
5465
- async errorTransform(e) {
5466
- const httpResponseError = new HttpResponseError();
5467
- httpResponseError.error = e;
5468
- if (e instanceof Response) {
5469
- httpResponseError.response = e;
5470
- try {
5471
- httpResponseError.body = await e.clone().json();
5472
- httpResponseError.message = e.statusText;
5473
- } catch (parseError) {
5474
- httpResponseError.body = parseError;
5475
- httpResponseError.message = parseError.message;
5476
- }
5477
- } else {
5478
- httpResponseError.body = e;
5479
- httpResponseError.message = e.message;
5480
- }
5481
- return httpResponseError;
5482
- }
5483
- // protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
5484
- execute(fetcherRequest) {
5485
- return super.execute(fetcherRequest).then((response) => {
5486
- const config = fetcherRequest.config;
5487
- const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
5488
- if (transform === "response") {
5489
- return response;
5490
- } else if (transform === "text") {
5491
- return response?.text();
5492
- } else if (typeof transform === "function") {
5493
- return transform(response);
5494
- } else {
5495
- return response?.text().then((it) => {
5496
- if ((it ?? "").length > 0) {
5497
- return JSON.parse(it);
5498
- }
5499
- });
5500
- }
5501
- });
5502
- }
5503
- };
5504
-
5505
5126
  // ../core/dist/esm/entity/object/obj/RenderDrawObj.js
5506
5127
  var RenderDrawObj = class extends Obj {
5507
5128
  render(draw, config) {
@@ -6127,7 +5748,7 @@ function addEventListenerHost(type, options) {
6127
5748
  }
6128
5749
 
6129
5750
  // src/decorators/lifecycles.ts
6130
- var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
5751
+ var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
6131
5752
  var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
6132
5753
  var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
6133
5754
  var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
@@ -6148,7 +5769,7 @@ function createLifecycleDecorator(metadataKey) {
6148
5769
  list.push(propertyKey);
6149
5770
  };
6150
5771
  }
6151
- var onConstructor = createLifecycleDecorator(ON_CONSTRUCTOR_METADATA_KEY);
5772
+ var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
6152
5773
  var onBeforeConnected = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
6153
5774
  var onAfterConnected = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
6154
5775
  var onConnected = onAfterConnected;
@@ -6263,49 +5884,37 @@ function attribute(selector, options = {}) {
6263
5884
  }
6264
5885
  });
6265
5886
  };
6266
- Object.defineProperty(target, propertyKey, {
6267
- get() {
6268
- const attrName = options.name || String(propertyKey);
6269
- const conf = getElementConfig(this);
6270
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6271
- const targetType = options.type || designType;
6272
- if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
6273
- return convertValue(this[privateKey], targetType);
6274
- }
6275
- const targets = resolveTargetEls(this, selector, options, currentWin);
6276
- const primaryTarget = targets[0];
6277
- if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
6278
- if (primaryTarget.hasAttribute(attrName)) {
6279
- const domVal = primaryTarget.getAttribute(attrName);
6280
- return convertValue(domVal, targetType);
6281
- }
6282
- return null;
6283
- }
6284
- return convertValue(this[privateKey], targetType);
6285
- },
6286
- set(nv) {
6287
- const attrName = options.name || String(propertyKey);
6288
- const conf = getElementConfig(this);
6289
- const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
6290
- if (this.__swc_syncing_init) {
6291
- if (options.connectedInitialize === true) {
6292
- const targets2 = resolveTargetEls(this, selector, options, currentWin);
6293
- applySetAttribute(this, targets2, attrName, nv);
6294
- } else {
6295
- this[privateKey] = nv;
5887
+ try {
5888
+ Object.defineProperty(target, propertyKey, {
5889
+ get() {
5890
+ const attrName = options.name || String(propertyKey);
5891
+ const conf = getElementConfig(this);
5892
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
5893
+ const targetType = options.type || designType;
5894
+ const targets = resolveTargetEls(this, selector, options, currentWin);
5895
+ const primaryTarget = targets[0];
5896
+ if (primaryTarget && typeof primaryTarget.hasAttribute === "function") {
5897
+ if (primaryTarget.hasAttribute(attrName)) {
5898
+ const domVal = primaryTarget.getAttribute(attrName);
5899
+ return convertValue(domVal, targetType);
5900
+ }
5901
+ return null;
6296
5902
  }
6297
- return;
6298
- }
6299
- if (!this.__swc_connected) {
6300
- this[privateKey] = nv;
6301
- return;
6302
- }
6303
- const targets = resolveTargetEls(this, selector, options, currentWin);
6304
- applySetAttribute(this, targets, attrName, nv);
6305
- },
6306
- enumerable: true,
6307
- configurable: true
6308
- });
5903
+ return convertValue(this[privateKey], targetType);
5904
+ },
5905
+ set(nv) {
5906
+ const attrName = options.name || String(propertyKey);
5907
+ const conf = getElementConfig(this);
5908
+ const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
5909
+ const targets = resolveTargetEls(this, selector, options, currentWin);
5910
+ applySetAttribute(this, targets, attrName, nv);
5911
+ },
5912
+ enumerable: true,
5913
+ configurable: true
5914
+ });
5915
+ } catch (err) {
5916
+ console.error("[SWC] defineProperty error:", err);
5917
+ }
6309
5918
  };
6310
5919
  }
6311
5920
  function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
@@ -6328,7 +5937,8 @@ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
6328
5937
  }
6329
5938
  }
6330
5939
  var findAllAttributeMetadata = (target) => {
6331
- return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
5940
+ const actualTarget = target instanceof Function ? target : target.constructor;
5941
+ return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, actualTarget).flat();
6332
5942
  };
6333
5943
 
6334
5944
  // src/decorators/changedAttributeHost.ts
@@ -6584,10 +6194,6 @@ function query(selectorOrTarget, options = {}) {
6584
6194
  });
6585
6195
  };
6586
6196
  }
6587
- var getQueryMetadata = (target) => {
6588
- const constructor = target instanceof Function ? target : target.constructor;
6589
- return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6590
- };
6591
6197
  function queryHost(targetOrOptions, propertyKey) {
6592
6198
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6593
6199
  return query(":host", {})(targetOrOptions, propertyKey);
@@ -6659,6 +6265,10 @@ function lastAppHost(targetOrOptions, propertyKey) {
6659
6265
  return query(":lastAppHost", {});
6660
6266
  }
6661
6267
  }
6268
+ var getQueryMetadata = (target) => {
6269
+ const constructor = target instanceof Function ? target : target.constructor;
6270
+ return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
6271
+ };
6662
6272
 
6663
6273
  // src/decorators/queryAll.ts
6664
6274
  var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
@@ -6752,10 +6362,6 @@ function queryAll(selectorOrTarget, options = {}) {
6752
6362
  });
6753
6363
  };
6754
6364
  }
6755
- var getQueryAllMetadata = (target) => {
6756
- const constructor = target instanceof Function ? target : target.constructor;
6757
- return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6758
- };
6759
6365
  function queryAllHost(targetOrOptions, propertyKey) {
6760
6366
  if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6761
6367
  return queryAll(":host", {})(targetOrOptions, propertyKey);
@@ -6827,6 +6433,10 @@ function allLastAppHost(targetOrOptions, propertyKey) {
6827
6433
  return queryAll(":lastAppHost", {});
6828
6434
  }
6829
6435
  }
6436
+ var getQueryAllMetadata = (target) => {
6437
+ const constructor = target instanceof Function ? target : target.constructor;
6438
+ return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
6439
+ };
6830
6440
 
6831
6441
  // src/decorators/applyClass.ts
6832
6442
  var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
@@ -7172,6 +6782,41 @@ var findAllAttributeApplyMetadata = (target) => {
7172
6782
  return result;
7173
6783
  };
7174
6784
 
6785
+ // src/decorators/subscribeSwcAppRouteChange.ts
6786
+ var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change");
6787
+ function createSwcAppRouteChangeSubscriber(options) {
6788
+ return (target, propertyKey, descriptor) => {
6789
+ const pathPattern = options?.path;
6790
+ const filter = options?.filter;
6791
+ const constructor = target.constructor;
6792
+ let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6793
+ if (!list) {
6794
+ list = [];
6795
+ ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, list, constructor);
6796
+ }
6797
+ list.push({ propertyKey, pathPattern, filter });
6798
+ return descriptor;
6799
+ };
6800
+ }
6801
+ function subscribeSwcAppRouteChange(targetOrOptions, propertyKey, descriptor) {
6802
+ if (propertyKey && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
6803
+ return createSwcAppRouteChangeSubscriber({})(targetOrOptions, propertyKey, descriptor);
6804
+ }
6805
+ let options = {};
6806
+ if (Array.isArray(targetOrOptions)) {
6807
+ options.path = targetOrOptions;
6808
+ } else if (typeof targetOrOptions === "string") {
6809
+ options.path = targetOrOptions;
6810
+ } else if (targetOrOptions && typeof targetOrOptions === "object") {
6811
+ options = targetOrOptions;
6812
+ }
6813
+ return createSwcAppRouteChangeSubscriber(options);
6814
+ }
6815
+ var getSubscribeSwcAppRouteChangeMetadata = (target) => {
6816
+ const constructor = target instanceof Function ? target : target.constructor;
6817
+ return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY, constructor);
6818
+ };
6819
+
7175
6820
  // src/utils/Utils.ts
7176
6821
  var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
7177
6822
  var htmlFragment = (html, doc) => {
@@ -7407,6 +7052,24 @@ var SwcUtils;
7407
7052
  ...loopContext
7408
7053
  };
7409
7054
  };
7055
+ SwcUtils2.parsePathPattern = (pattern, currentPath) => {
7056
+ if (pattern === null || pattern === void 0) return {};
7057
+ const trimmedPattern = pattern.trim();
7058
+ if (trimmedPattern === "" && pattern !== "") return {};
7059
+ const paramNames = [];
7060
+ const regexPattern = trimmedPattern.replace(/{(\w+)(?::(.+?))?}/g, (match2, paramName, customRegex) => {
7061
+ paramNames.push(paramName);
7062
+ return `(${customRegex || "[^/]+"})`;
7063
+ });
7064
+ const regex = new RegExp(`^${regexPattern}$`);
7065
+ const match = currentPath.match(regex);
7066
+ if (!match) return null;
7067
+ const result = {};
7068
+ paramNames.forEach((name, index) => {
7069
+ result[name] = match[index + 1];
7070
+ });
7071
+ return result;
7072
+ };
7410
7073
  })(SwcUtils || (SwcUtils = {}));
7411
7074
 
7412
7075
  // src/decorators/emitCustomEvent.ts
@@ -7574,46 +7237,7 @@ var SituationTypeContainers = class {
7574
7237
  return this.containers.find(predicate);
7575
7238
  }
7576
7239
  };
7577
- var isTargetSymbol = (config) => {
7578
- return "symbol" in config && config.symbol !== void 0;
7579
- };
7580
- var isTargetType = (config) => {
7581
- return "type" in config && config.type !== void 0;
7582
- };
7583
- var isTargetScheme = (config) => {
7584
- return "scheme" in config && config.scheme !== void 0;
7585
- };
7586
- var isTargetFactory = (config) => {
7587
- return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
7588
- };
7589
7240
  var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
7590
- var injectProcess = (config, target, propertyKey, parameterIndex) => {
7591
- if (propertyKey && typeof target === "object") {
7592
- const otarget = target;
7593
- target = target.constructor;
7594
- const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
7595
- const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
7596
- saves.push({ index: parameterIndex, config, propertyKey, type });
7597
- ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
7598
- } else if (!propertyKey || typeof target === "function") {
7599
- const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
7600
- const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
7601
- existingInjectdParameters.push({ index: parameterIndex, config, type });
7602
- ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
7603
- }
7604
- };
7605
- function Inject(configOrTarget, propertyKey, parameterIndex) {
7606
- if (propertyKey && parameterIndex !== void 0) {
7607
- injectProcess({}, configOrTarget, propertyKey, parameterIndex);
7608
- } else {
7609
- return (target, propertyKey2, parameterIndex2) => {
7610
- injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
7611
- };
7612
- }
7613
- }
7614
- var getInject = (target, propertyKey) => {
7615
- return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
7616
- };
7617
7241
 
7618
7242
  // src/types.ts
7619
7243
  var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
@@ -7642,9 +7266,26 @@ var ensureInit2 = (inst) => {
7642
7266
  inst._emitHandlers = /* @__PURE__ */ new Map();
7643
7267
  inst._boundListeners = [];
7644
7268
  inst.__swc_initialized = true;
7269
+ const target = inst instanceof Function ? inst : inst.constructor;
7270
+ const attributeList = findAllAttributeMetadata(target);
7271
+ attributeList.forEach((meta) => {
7272
+ delete inst[meta.propertyKey];
7273
+ });
7274
+ const queryList = getQueryMetadata(target);
7275
+ if (queryList) {
7276
+ queryList.forEach((meta) => {
7277
+ delete inst[meta.propertyKey];
7278
+ });
7279
+ }
7280
+ const queryAllList = getQueryAllMetadata(target);
7281
+ if (queryAllList) {
7282
+ queryAllList.forEach((meta) => {
7283
+ delete inst[meta.propertyKey];
7284
+ });
7285
+ }
7645
7286
  const hostSet = SwcUtils.getHostSet(inst);
7646
7287
  inst._executeSwcScript?.("swc-on-constructor", hostSet);
7647
- const cMethods = findAllLifecycleMetadata(inst, ON_CONSTRUCTOR_METADATA_KEY);
7288
+ const cMethods = findAllLifecycleMetadata(inst, ON_INITIALIZE_METADATA_KEY);
7648
7289
  if (cMethods) {
7649
7290
  for (const m of cMethods) inst._invokeLifecycleMethod(m, hostSet);
7650
7291
  }
@@ -7811,12 +7452,12 @@ var elementDefine = (name, config = {}) => (constructor) => {
7811
7452
  const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
7812
7453
  const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
7813
7454
  const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
7814
- const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
7455
+ const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
7815
7456
  const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
7816
7457
  ...metadata.observedAttributes ?? [],
7817
7458
  ...attrChangeMap.keys(),
7818
7459
  ...attributeApplyNames,
7819
- ...attributeListNames,
7460
+ ...hostAttributes,
7820
7461
  ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
7821
7462
  ...swcLifecycleAttributes,
7822
7463
  ...swcOnEvents
@@ -7827,30 +7468,18 @@ var elementDefine = (name, config = {}) => (constructor) => {
7827
7468
  const originalConnected = proto.connectedCallback;
7828
7469
  proto.connectedCallback = function() {
7829
7470
  ensureInit2(this);
7471
+ const hostSet = SwcUtils.getHostSet(this);
7472
+ const appHost2 = hostSet.$appHost;
7473
+ const conf = getElementConfig(this);
7474
+ const currentWin = this._resolveWindow(conf);
7830
7475
  if (connectedInnerHtmlList.some((it) => it.options.useShadow === true) && !this.shadowRoot) {
7831
7476
  this.attachShadow({ mode: "open" });
7832
7477
  }
7833
- const conf = getElementConfig(this);
7834
- const currentWin = this._resolveWindow(conf);
7835
- const hostSet = SwcUtils.getHostSet(this);
7836
7478
  this._executeSwcScript("swc-on-before-connected", hostSet);
7837
7479
  const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
7838
7480
  if (bMethods) {
7839
7481
  for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
7840
7482
  }
7841
- attributeList.forEach((meta) => {
7842
- if (meta.options.connectedInitialize === true) {
7843
- this.__swc_syncing_init = true;
7844
- try {
7845
- const memoryVal = this[meta.privateKey];
7846
- if (memoryVal !== void 0) {
7847
- this[meta.propertyKey] = memoryVal;
7848
- }
7849
- } finally {
7850
- this.__swc_syncing_init = false;
7851
- }
7852
- }
7853
- });
7854
7483
  if (connectedInnerHtmlList.length > 0) {
7855
7484
  let sContent = "", lContent = "";
7856
7485
  for (const meta of connectedInnerHtmlList) {
@@ -7986,6 +7615,9 @@ var elementDefine = (name, config = {}) => (constructor) => {
7986
7615
  this._executeSwcScript("swc-on-connected", hostSet);
7987
7616
  this._executeSwcScript("swc-on-after-connected", hostSet);
7988
7617
  this.__swc_connected = true;
7618
+ if (appHost2 && typeof appHost2._connected === "function") {
7619
+ appHost2._connected(this);
7620
+ }
7989
7621
  };
7990
7622
  const originalDisconnected = proto.disconnectedCallback;
7991
7623
  proto.disconnectedCallback = function() {
@@ -8007,6 +7639,10 @@ var elementDefine = (name, config = {}) => (constructor) => {
8007
7639
  this._executeSwcScript("swc-on-disconnected", hostSet);
8008
7640
  this._executeSwcScript("swc-on-after-disconnected", hostSet);
8009
7641
  this.__swc_connected = false;
7642
+ const appHost2 = hostSet.$appHost;
7643
+ if (appHost2 && typeof appHost2._disconnected === "function") {
7644
+ appHost2._disconnected(this);
7645
+ }
8010
7646
  };
8011
7647
  const originalAdopted = proto.adoptedCallback;
8012
7648
  proto.adoptedCallback = function() {
@@ -8055,1187 +7691,28 @@ var elementDefine = (name, config = {}) => (constructor) => {
8055
7691
  return constructor;
8056
7692
  };
8057
7693
 
8058
- // ../simple-boot/dist/esm/throwable/SimError.js
8059
- var SimError = class {
8060
- constructor(message, name, stack) {
8061
- this.message = message;
8062
- this.name = name;
8063
- this.stack = stack;
8064
- }
8065
- };
8066
-
8067
- // ../simple-boot/dist/esm/throwable/SimNoSuch.js
8068
- var SimNoSuch = class extends SimError {
8069
- constructor(message, name, stack) {
8070
- super(message, name, stack);
8071
- }
8072
- };
8073
-
8074
7694
  // ../simple-boot/dist/esm/decorators/SimDecorator.js
8075
- var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
8076
- Lifecycle2["Singleton"] = "Singleton";
8077
- Lifecycle2["Transient"] = "Transient";
8078
- return Lifecycle2;
8079
- })(Lifecycle || {});
8080
- var sims = /* @__PURE__ */ new Map();
8081
- var containers = /* @__PURE__ */ new Set();
8082
7695
  var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
8083
- var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
8084
- var simProcess = (config, inputTarget) => {
8085
- const target = (() => {
8086
- if (typeof inputTarget === "object") {
8087
- return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
8088
- }
8089
- if (ValidUtils.isArrowFunction(inputTarget)) {
8090
- return () => inputTarget();
8091
- }
8092
- return inputTarget;
8093
- })();
8094
- let targetType;
8095
- if (isNotNullObjetInstance(target)) {
8096
- targetType = target.constructor;
8097
- } else {
8098
- targetType = target;
8099
- }
8100
- config.scope = config?.scope ?? "Singleton";
8101
- ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
8102
- const adding = (targetKey, target2 = targetKey) => {
8103
- const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
8104
- items.add(target2);
8105
- sims.set(targetKey, items);
8106
- };
8107
- if (Array.isArray(config?.type)) {
8108
- config?.type.forEach((it) => {
8109
- adding(it, target);
8110
- });
8111
- } else if (config.type) {
8112
- adding(config?.type, target);
8113
- } else {
8114
- adding(target);
8115
- }
8116
- };
8117
- function Sim(configOrTarget) {
8118
- if (typeof configOrTarget === "function") {
8119
- simProcess({}, configOrTarget);
8120
- } else {
8121
- return (target) => {
8122
- simProcess(configOrTarget, target);
8123
- };
8124
- }
8125
- }
8126
- var getSim = (target) => {
8127
- if (target != null && target !== void 0 && typeof target === "object") {
8128
- target = Object.getPrototypeOf(target).constructor;
8129
- }
8130
- try {
8131
- return ReflectUtils.getMetadata(SimMetadataKey, target);
8132
- } catch (e) {
8133
- }
8134
- };
8135
7696
  var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
8136
- var getPostConstructs = (target) => {
8137
- return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
8138
- };
8139
-
8140
- // ../simple-boot/dist/esm/simstance/SimAtomic.js
8141
- var SimAtomic = class {
8142
- constructor(type, simstanceManager, config) {
8143
- this.type = type;
8144
- this.simstanceManager = simstanceManager;
8145
- this.config = config;
8146
- this.value = type.value;
8147
- }
8148
- getConfig(key = SimMetadataKey) {
8149
- return ReflectUtils.getMetadata(key, this.type.originalType);
8150
- }
8151
- getConfigs() {
8152
- return ReflectUtils.getMetadatas(this.type.originalType);
8153
- }
8154
- getValue(config) {
8155
- if (config?.refresh) {
8156
- this.value = void 0;
8157
- }
8158
- if (!this.value) {
8159
- if (typeof this.type.targetKeyType === "symbol") {
8160
- this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
8161
- } else {
8162
- this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
8163
- }
8164
- }
8165
- return this.value;
8166
- }
8167
- };
8168
-
8169
- // ../simple-boot/dist/esm/SimOption.js
8170
- var SimOption = class {
8171
- constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
8172
- this.rootRouter = rootRouter;
8173
- this.container = container;
8174
- this.advice = advice;
8175
- this.excludeProxys = excludeProxys;
8176
- this.proxy = proxy;
8177
- this.using = using;
8178
- this.cache = cache;
8179
- }
8180
- addAdvicce(advice) {
8181
- this.advice ?? (this.advice = []);
8182
- this.advice.push(advice);
8183
- }
8184
- setAdvice(...advice) {
8185
- this.advice = advice;
8186
- return this;
8187
- }
8188
- };
8189
-
8190
- // ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
8191
- var MetaDataAtomic = class {
8192
- constructor(target, metaData) {
8193
- this.target = target;
8194
- this.metaData = metaData;
8195
- }
8196
- };
8197
- var MetaDataPropertyAtomic = class extends MetaDataAtomic {
8198
- constructor(target, metaData, property, parameter) {
8199
- super(target, metaData);
8200
- this.property = property;
8201
- this.parameter = parameter;
8202
- }
8203
- call(...parameter) {
8204
- return this.target[this.property](...parameter);
8205
- }
8206
- };
8207
7697
 
8208
7698
  // ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
8209
7699
  var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
8210
7700
  var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
8211
7701
  var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
8212
- var getAfter = (target, propertyKey) => {
8213
- return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
8214
- };
8215
- var getAfters = (target) => {
8216
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8217
- };
8218
- var getProtoAfters = (target, propertyKey, type) => {
8219
- return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8220
- };
8221
- var getBefore = (target, propertyKey) => {
8222
- return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
8223
- };
8224
- var getBefores = (target) => {
8225
- return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
8226
- };
8227
- var getProtoBefores = (target, propertyKey, type) => {
8228
- return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
8229
- };
8230
7702
 
8231
7703
  // ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
8232
- var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
8233
- ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
8234
- ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
8235
- return ExceptionHandlerSituationType2;
8236
- })(ExceptionHandlerSituationType || {});
8237
7704
  var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
8238
- var getExceptionHandlers = (target) => {
8239
- if (target !== null && void 0 !== target && typeof target === "object") {
8240
- target = target.constructor;
8241
- }
8242
- return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
8243
- };
8244
- var targetExceptionHandlers = (target, error) => {
8245
- const exceptionHandlers = getExceptionHandlers(target);
8246
- const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
8247
- const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
8248
- const targetSorts = targets?.sort((a, b) => {
8249
- const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
8250
- const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
8251
- return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
8252
- });
8253
- return (targetSorts ?? []).concat(...emptyTargets ?? []);
8254
- };
8255
- var targetExceptionHandler = (target, error, excludeMethods = []) => {
8256
- let exceptionHandlers = targetExceptionHandlers(target, error);
8257
- exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
8258
- if (exceptionHandlers && exceptionHandlers.length > 0) {
8259
- return exceptionHandlers[0];
8260
- } else {
8261
- return void 0;
8262
- }
8263
- };
8264
-
8265
- // ../simple-boot/dist/esm/proxy/SimProxyHandler.js
8266
- var SimProxyHandler = class {
8267
- constructor(simpleApplication, simstanceManager, simOption) {
8268
- this.simpleApplication = simpleApplication;
8269
- this.simstanceManager = simstanceManager;
8270
- this.simOption = simOption;
8271
- }
8272
- // 잘받게 해놨네 ㅋㅋ simstanceManager
8273
- get(target, name) {
8274
- if (name === "_SimpleBoot_application") {
8275
- return this.simpleApplication;
8276
- } else if (name === "_SimpleBoot_simstanceManager") {
8277
- return this.simstanceManager;
8278
- } else if (name === "_SimpleBoot_simOption") {
8279
- return this.simOption;
8280
- } else if (name === "_SimpleBoot_origin") {
8281
- return target;
8282
- } else {
8283
- return target[name];
8284
- }
8285
- }
8286
- set(obj, prop, value, receiver) {
8287
- value = this.simstanceManager?.proxy(value);
8288
- obj[prop] = value;
8289
- return true;
8290
- }
8291
- apply(target, thisArg, argumentsList) {
8292
- let r;
8293
- try {
8294
- this.aopBefore(thisArg, target);
8295
- try {
8296
- r = Reflect.apply(target, thisArg, argumentsList);
8297
- } catch (e) {
8298
- throw e;
8299
- } finally {
8300
- this.aopAfter(thisArg, target);
8301
- }
8302
- } catch (e) {
8303
- console.error(e);
8304
- const inHandlers = this.getExceptionHandler(e, thisArg, target);
8305
- if (inHandlers.length > 0 && inHandlers[0]) {
8306
- const inHandler = inHandlers[0];
8307
- this.executeExceptionHandler(e, inHandler, argumentsList);
8308
- } else {
8309
- throw e;
8310
- }
8311
- }
8312
- return r;
8313
- }
8314
- executeExceptionHandler(e, inHandler, argumentsList) {
8315
- const otherStorage = /* @__PURE__ */ new Map();
8316
- otherStorage.set(e.constructor, e);
8317
- const situationErrorTypeContainer = new SituationTypeContainer({
8318
- situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
8319
- data: e
8320
- });
8321
- const situationParameterTypeContainer = new SituationTypeContainer({
8322
- situationType: ExceptionHandlerSituationType.PARAMETER,
8323
- data: argumentsList
8324
- });
8325
- otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
8326
- argumentsList?.forEach((it) => {
8327
- otherStorage.set(it.constructor, it);
8328
- });
8329
- try {
8330
- this.simstanceManager.executeBindParameterSim(
8331
- {
8332
- target: inHandler.thisArg,
8333
- targetKey: inHandler.config.propertyKey
8334
- },
8335
- otherStorage
8336
- );
8337
- } catch (es) {
8338
- e = es;
8339
- }
8340
- if (inHandler.config.config.throw) {
8341
- const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
8342
- if ((exceptionHandler?.length ?? 0) > 0) {
8343
- this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
8344
- }
8345
- }
8346
- }
8347
- getExceptionHandler(e, thisArg, target) {
8348
- const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
8349
- return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
8350
- }) ?? [];
8351
- const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
8352
- const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
8353
- return inHandlers;
8354
- }
8355
- aopBefore(obj, protoType) {
8356
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8357
- if (propertyName && obj) {
8358
- getProtoBefores(obj, propertyName).forEach((it) => {
8359
- it.call(obj, protoType, propertyName);
8360
- });
8361
- for (let i = 0; i < this.simOption.advice.length; i++) {
8362
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8363
- const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
8364
- protoBefores.forEach((it) => {
8365
- it.call(obj, protoType, propertyName);
8366
- });
8367
- }
8368
- }
8369
- }
8370
- aopAfter(obj, protoType) {
8371
- const propertyName = ObjectUtils.prototypeName(obj, protoType);
8372
- if (propertyName) {
8373
- getProtoAfters(obj, propertyName).forEach((it) => {
8374
- it.call(obj, protoType, propertyName);
8375
- });
8376
- for (let i = 0; i < this.simOption.advice.length; i++) {
8377
- const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
8378
- const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
8379
- protoBefores.forEach((it) => {
8380
- it.call(obj, protoType, propertyName);
8381
- });
8382
- }
8383
- }
8384
- }
8385
- has(target, key) {
8386
- if (key === "_SimpleBoot_isProxy") {
8387
- return true;
8388
- }
8389
- return key in target;
8390
- }
8391
- };
8392
-
8393
- // ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
8394
- var isOnSimCreate = (obj) => {
8395
- return typeof obj?.onSimCreate === "function";
8396
- };
8397
-
8398
- // ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
8399
- var isOnSimCreateProxyCompleted = (obj) => {
8400
- return typeof obj?.onSimCreateProxyCompleted === "function";
8401
- };
8402
7705
 
8403
7706
  // ../simple-boot/dist/esm/decorators/SimNoProxy.js
8404
7707
  var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
8405
- var getSimNoProxy = (target, propertyKey) => {
8406
- try {
8407
- if (propertyKey === void 0) {
8408
- return Reflect.getMetadata(SimNoProxyKey, target);
8409
- }
8410
- return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
8411
- } catch (e) {
8412
- return void 0;
8413
- }
8414
- };
8415
- var isSimNoProxy = (target, propertyKey) => {
8416
- if (target === null || target === void 0) {
8417
- return false;
8418
- }
8419
- return getSimNoProxy(target, propertyKey) === true;
8420
- };
8421
-
8422
- // ../simple-boot/dist/esm/simstance/SimstanceManager.js
8423
- var SimstanceManager = class _SimstanceManager {
8424
- // private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
8425
- constructor(simpleApplication, option) {
8426
- this.simpleApplication = simpleApplication;
8427
- this.option = option;
8428
- this._storage = /* @__PURE__ */ new Map();
8429
- this.name = "simstanceManager-" + RandomUtils.uuid4();
8430
- this.setStoreSet(SimpleApplication, this.simpleApplication);
8431
- this.setStoreSet(_SimstanceManager, this);
8432
- this.setStoreSet(option.constructor, option);
8433
- this.setStoreSet(SimOption, option);
8434
- this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
8435
- }
8436
- get storage() {
8437
- return this._storage;
8438
- }
8439
- getSimAtomics() {
8440
- const r = [];
8441
- Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
8442
- r.push(
8443
- ...Array.from(Array.from(targetMap.keys())).map(
8444
- (sit) => new SimAtomic(
8445
- {
8446
- targetKeyType,
8447
- originalType: sit
8448
- },
8449
- this
8450
- )
8451
- )
8452
- );
8453
- });
8454
- return r;
8455
- }
8456
- getSimConfig(schemeOrSymbol) {
8457
- const newVar = this.getSimAtomics().filter((it) => {
8458
- const config = it?.getConfig();
8459
- const symbols = ConvertUtils.flatArray(config?.symbol);
8460
- const schemes = ConvertUtils.flatArray(config?.scheme);
8461
- if (typeof schemeOrSymbol === "symbol") {
8462
- return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
8463
- } else if (typeof schemeOrSymbol === "string") {
8464
- return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
8465
- } else {
8466
- return false;
8467
- }
8468
- }) || [];
8469
- return newVar;
8470
- }
8471
- findSims(data) {
8472
- let r = [];
8473
- if (data) {
8474
- const simAtomics = this.getSimAtomics();
8475
- r = simAtomics.filter((it) => {
8476
- let b = false;
8477
- const config = it.getConfig();
8478
- const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
8479
- const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
8480
- if (typeof data === "symbol") {
8481
- b = symbols.includes(data);
8482
- } else {
8483
- const { scheme, type } = data;
8484
- b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
8485
- }
8486
- return b;
8487
- });
8488
- }
8489
- return r;
8490
- }
8491
- findFirstSim(data) {
8492
- if (typeof data === "symbol") {
8493
- return this.findSims(data)[0];
8494
- } else {
8495
- return this.findSims(data)[0];
8496
- }
8497
- }
8498
- findLastSim(data) {
8499
- if (typeof data === "symbol") {
8500
- return this.findSims(data).reverse()[0];
8501
- } else {
8502
- return this.findSims(data).reverse()[0];
8503
- }
8504
- }
8505
- flatStoreSets() {
8506
- return new Map(
8507
- Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
8508
- );
8509
- }
8510
- getStoreSets(targetKey) {
8511
- const map = this.storage.get(targetKey);
8512
- const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
8513
- return datas.map((it) => ({ type: it[0], instance: it[1] }));
8514
- }
8515
- getStoreSet(targetKey, target) {
8516
- const sets = this.getStoreSets(targetKey);
8517
- let find = sets.find((it) => it.type === target);
8518
- if (!find && (!target || target === targetKey)) {
8519
- find = sets.find((it) => it.instance);
8520
- }
8521
- if (!find?.instance) {
8522
- const type = target ?? targetKey;
8523
- if (typeof type === "object") {
8524
- const find2 = this.storage.get(type);
8525
- if (find2) {
8526
- return { type, instance: type };
8527
- }
8528
- }
8529
- const flatStoreSets = this.flatStoreSets();
8530
- const data = flatStoreSets.get(type);
8531
- if (data) {
8532
- this.setStoreSet(targetKey, data, type);
8533
- }
8534
- return { type, instance: data };
8535
- } else {
8536
- return find;
8537
- }
8538
- }
8539
- getStoreInstance(targetKey, target) {
8540
- return this.getStoreSet(targetKey, target)?.instance;
8541
- }
8542
- getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
8543
- if (target) {
8544
- const registed = this.getStoreSet(target, originTypeTarget);
8545
- if (registed?.type && !registed?.instance) {
8546
- return this.resolve({
8547
- targetKey: target,
8548
- target: originTypeTarget,
8549
- newInstanceCarrier
8550
- });
8551
- }
8552
- return registed?.instance;
8553
- }
8554
- }
8555
- setStoreSet(targetKey, obj, target = targetKey) {
8556
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8557
- itemMap.set(target, obj);
8558
- this.storage.set(targetKey, itemMap);
8559
- }
8560
- registerStore(targetKey, regTyps) {
8561
- const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
8562
- regTyps.forEach((it) => {
8563
- const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
8564
- if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
8565
- itemMap.set(type, value);
8566
- }
8567
- });
8568
- this.storage.set(targetKey, itemMap);
8569
- }
8570
- // 진입점
8571
- resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
8572
- const registed = this.getStoreSet(targetKey, target);
8573
- if (registed?.instance) {
8574
- return registed.instance;
8575
- }
8576
- if (this.storage.has(targetKey) && void 0 === registed?.instance) {
8577
- newInstanceCarrier.depth++;
8578
- const newSim = this.newSim({
8579
- target: registed?.type ?? targetKey,
8580
- newInstanceCarrier,
8581
- simCreateAfter: (data) => {
8582
- if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
8583
- this.setStoreSet(targetKey, data, target);
8584
- }
8585
- }
8586
- });
8587
- newInstanceCarrier.depth--;
8588
- if (newInstanceCarrier.depth === 0) {
8589
- newInstanceCarrier.newInstances.forEach((it) => {
8590
- this.callBindPostConstruct(it);
8591
- });
8592
- }
8593
- if (isOnSimCreate(newSim)) {
8594
- newSim.onSimCreate();
8595
- }
8596
- return newSim;
8597
- }
8598
- const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
8599
- console.error(simNoSuch);
8600
- throw simNoSuch;
8601
- }
8602
- newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
8603
- const parameters = this.getParameterSim({
8604
- target,
8605
- otherStorage,
8606
- newInstanceCarrier
8607
- });
8608
- const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
8609
- let p = this.proxy(r);
8610
- const config = getSim(target);
8611
- if (config?.proxy) {
8612
- const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
8613
- proxys.forEach((it) => {
8614
- if (typeof it === "object") {
8615
- p = new Proxy(p, it);
8616
- } else {
8617
- const simConfig = getSim(it);
8618
- p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
8619
- }
8620
- });
8621
- }
8622
- newInstanceCarrier?.newInstances.push(p);
8623
- simCreateAfter?.(p);
8624
- if (isOnSimCreateProxyCompleted(p)) {
8625
- p.onSimCreateProxyCompleted(p);
8626
- }
8627
- return p;
8628
- }
8629
- callBindPostConstruct(obj) {
8630
- const postConstruct = getPostConstructs(obj);
8631
- postConstruct.forEach((it) => {
8632
- obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
8633
- });
8634
- }
8635
- async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8636
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8637
- if (typeof target === "object" && targetKey) {
8638
- const targetMethod = target[targetKey];
8639
- return targetMethod?.bind(target)?.(...binds);
8640
- } else if (typeof target === "function" && !targetKey) {
8641
- return new target(...binds);
8642
- }
8643
- }
8644
- executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
8645
- const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
8646
- if (typeof target === "object" && targetKey) {
8647
- const targetMethod = target[targetKey];
8648
- return targetMethod?.bind(target)?.(...binds);
8649
- } else if (typeof target === "function" && !targetKey) {
8650
- return new target(...binds);
8651
- }
8652
- }
8653
- getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
8654
- const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
8655
- let injections = [];
8656
- const injects = getInject(target, targetKey);
8657
- const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
8658
- const loopArray = new Array(loopCount).fill(void 0);
8659
- injections = loopArray.map((_, idx) => {
8660
- const token = paramTypes[idx];
8661
- const saveInject = injects?.find((it) => it.index === idx);
8662
- for (const f of firstCheckMaker ?? []) {
8663
- const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
8664
- if (void 0 !== firstCheckObj) {
8665
- return firstCheckObj;
8666
- }
8667
- }
8668
- if (saveInject) {
8669
- const inject = saveInject.config;
8670
- let obj = otherStorage?.get(token);
8671
- if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
8672
- const p = [];
8673
- if (isTargetType(inject) && inject.type) {
8674
- p.push(
8675
- ...this.getStoreSets(inject.type).map(
8676
- (it) => this.resolve({
8677
- targetKey: inject.type,
8678
- target: it.type,
8679
- newInstanceCarrier
8680
- })
8681
- ).reverse()
8682
- );
8683
- }
8684
- if (isTargetSymbol(inject)) {
8685
- p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
8686
- }
8687
- if (isTargetScheme(inject)) {
8688
- p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
8689
- }
8690
- return p;
8691
- }
8692
- if (inject.situationType && otherStorage) {
8693
- const situations = otherStorage.get(SituationTypeContainers);
8694
- const situation = otherStorage.get(SituationTypeContainer);
8695
- if (inject.situationType === situation?.situationType) {
8696
- obj = situation.data;
8697
- } else if (situations && situations.length > 0) {
8698
- const find = situations.find((a) => {
8699
- if (a.index !== void 0) {
8700
- return a.situationType === inject.situationType && a.index === idx;
8701
- } else {
8702
- return a.situationType === inject.situationType;
8703
- }
8704
- });
8705
- if (find) {
8706
- obj = find.data;
8707
- }
8708
- }
8709
- }
8710
- if (!obj) {
8711
- const currentInstance = typeof target === "object" ? target : void 0;
8712
- if (isTargetFactory(inject)) {
8713
- obj = inject.factory({
8714
- instance: currentInstance,
8715
- methodName: String(targetKey),
8716
- parameter: inputParameters,
8717
- application: this.simpleApplication
8718
- });
8719
- } else {
8720
- let findLastSim;
8721
- if (isTargetSymbol(inject)) {
8722
- findLastSim = this.findLastSim(inject.symbol);
8723
- } else if (isTargetType(inject) || isTargetScheme(inject)) {
8724
- findLastSim = this.findLastSim(inject);
8725
- }
8726
- try {
8727
- obj = findLastSim ? this.resolve({
8728
- targetKey: findLastSim?.type.targetKeyType ?? token,
8729
- newInstanceCarrier
8730
- }) : this.resolve({
8731
- targetKey: token,
8732
- newInstanceCarrier
8733
- });
8734
- if (inject.factory && obj) {
8735
- if (typeof inject.factory === "function") {
8736
- obj = inject.factory({
8737
- instance: currentInstance,
8738
- methodName: String(targetKey),
8739
- parameter: inputParameters,
8740
- application: this.simpleApplication,
8741
- injectInstance: obj
8742
- });
8743
- }
8744
- }
8745
- } catch (e) {
8746
- if (inject.optional) {
8747
- return void 0;
8748
- } else {
8749
- throw e;
8750
- }
8751
- }
8752
- }
8753
- }
8754
- if (inject.proxy && obj) {
8755
- if (ValidUtils.isConstructor(inject.proxy)) {
8756
- const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
8757
- if (handler) {
8758
- obj = new Proxy(obj, handler);
8759
- }
8760
- } else if (typeof inject.proxy === "function") {
8761
- const handler = inject.proxy({
8762
- application: this.simpleApplication,
8763
- instance: obj
8764
- });
8765
- if (handler) {
8766
- obj = new Proxy(obj, handler);
8767
- }
8768
- }
8769
- }
8770
- return obj;
8771
- } else {
8772
- return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
8773
- }
8774
- });
8775
- return injections;
8776
- }
8777
- proxy(target) {
8778
- try {
8779
- const noProxy = isSimNoProxy(target);
8780
- const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
8781
- if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
8782
- for (const key in target) {
8783
- if (!isSimNoProxy(target, key)) {
8784
- target[key] = this.proxy(target[key]);
8785
- }
8786
- }
8787
- const protoTypeName = ObjectUtils.ownPropertyNames(target);
8788
- protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
8789
- target[it] = new Proxy(target[it], this.simProxyHandler);
8790
- });
8791
- if (this.simProxyHandler) {
8792
- target = new Proxy(target, this.simProxyHandler);
8793
- }
8794
- }
8795
- if (this.option.proxy) {
8796
- target = this.option.proxy.onAfterProxy(target);
8797
- }
8798
- return target;
8799
- } catch (e) {
8800
- console.log("sim proxy error");
8801
- throw e;
8802
- }
8803
- }
8804
- run(otherInstanceSim = /* @__PURE__ */ new Map()) {
8805
- for (const [k, v] of Array.from(otherInstanceSim.entries())) {
8806
- const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
8807
- this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
8808
- if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
8809
- this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
8810
- }
8811
- }
8812
- const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
8813
- if (!myContainers.includes(this.simpleApplication)) {
8814
- myContainers.push(this.simpleApplication);
8815
- }
8816
- Array.from(sims.entries()).forEach(([type, implementations]) => {
8817
- const filteredSet = /* @__PURE__ */ new Set();
8818
- implementations.forEach((impl) => {
8819
- const config = getSim(impl);
8820
- const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
8821
- let isInclude = false;
8822
- if (targetContainers.length <= 0) {
8823
- isInclude = true;
8824
- } else {
8825
- isInclude = myContainers.some((it) => targetContainers.includes(it));
8826
- }
8827
- if (isInclude) {
8828
- filteredSet.add(impl);
8829
- }
8830
- });
8831
- if (filteredSet.size > 0) {
8832
- this.registerStore(type, filteredSet);
8833
- }
8834
- });
8835
- this.callBindPostConstruct(this);
8836
- this.getSimAtomics().forEach((it) => {
8837
- if (it.getConfig()?.autoCreate) {
8838
- it.getValue();
8839
- }
8840
- });
8841
- }
8842
- };
8843
-
8844
- // ../simple-boot/dist/esm/intent/Intent.js
8845
- var Intent = class {
8846
- constructor(uri, data, event) {
8847
- this.uri = uri;
8848
- this.data = data;
8849
- this.event = event;
8850
- this.sessionData = /* @__PURE__ */ new Map();
8851
- if (typeof uri === "string") {
8852
- const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
8853
- if (match) {
8854
- const symbol = Symbol.for(match[1]);
8855
- this.uri = {
8856
- symbol,
8857
- uri: match[2]
8858
- };
8859
- }
8860
- }
8861
- }
8862
- get symbols() {
8863
- if (typeof this.uri === "object") {
8864
- return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
8865
- }
8866
- return void 0;
8867
- }
8868
- get scheme() {
8869
- if (typeof this.uri === "string") {
8870
- const parts = this.uri.split("://");
8871
- if (parts.length > 1) {
8872
- return parts[0];
8873
- }
8874
- return void 0;
8875
- } else {
8876
- return void 0;
8877
- }
8878
- }
8879
- get paths() {
8880
- return this.pathname.split("/") ?? [];
8881
- }
8882
- get fullPath() {
8883
- const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
8884
- const paths = uri.split("://");
8885
- return paths[paths.length >= 2 ? 1 : 0] ?? "";
8886
- }
8887
- get pathname() {
8888
- const paths = this.fullPath.split("?");
8889
- return paths[0];
8890
- }
8891
- get query() {
8892
- const paths = this.fullPath.split("?");
8893
- return paths[1] ?? "";
8894
- }
8895
- getQueryParamDecodeURI(key) {
8896
- const p = this.queryParamsDecodeURI;
8897
- if (key) {
8898
- return p[key];
8899
- } else {
8900
- return p;
8901
- }
8902
- }
8903
- getQueryParamDecodeURIFirst(key) {
8904
- const param = this.getQueryParamDecodeURI(key);
8905
- if (Array.isArray(param)) {
8906
- return param[0];
8907
- } else {
8908
- return param;
8909
- }
8910
- }
8911
- getQueryParam(key) {
8912
- const p = this.queryParams;
8913
- if (key) {
8914
- return p[key];
8915
- } else {
8916
- return p;
8917
- }
8918
- }
8919
- getQueryParamFirst(key) {
8920
- const param = this.getQueryParam(key);
8921
- if (Array.isArray(param)) {
8922
- return param[0];
8923
- } else {
8924
- return param;
8925
- }
8926
- }
8927
- get queryParams() {
8928
- const param = {};
8929
- this.query.split("&")?.forEach((it) => {
8930
- const a = it.split("=");
8931
- if (param[a[0]]) {
8932
- if (Array.isArray(param[a[0]])) {
8933
- param[a[0]].push(a[1]);
8934
- } else {
8935
- param[a[0]] = [param[a[0]], a[1]];
8936
- }
8937
- } else {
8938
- param[a[0]] = a[1];
8939
- }
8940
- });
8941
- return param;
8942
- }
8943
- get queryParamsDecodeURI() {
8944
- const params = this.queryParams;
8945
- for (const key in params) {
8946
- if (params.hasOwnProperty(key)) {
8947
- const param = params[key];
8948
- if (Array.isArray(param)) {
8949
- params[key] = param.map((p) => decodeURIComponent(p));
8950
- } else {
8951
- params[key] = decodeURIComponent(param);
8952
- }
8953
- }
8954
- }
8955
- return params;
8956
- }
8957
- getPathnameData(urlExpression) {
8958
- return Expression.Path.pathNameData(this.pathname, urlExpression);
8959
- }
8960
- get isSymbolScheme() {
8961
- return this.symbols !== void 0;
8962
- }
8963
- };
8964
-
8965
- // ../simple-boot/dist/esm/intent/IntentSubscribe.js
8966
- var isIntentSubscribe = (obj) => {
8967
- return !!obj && typeof obj.intentSubscribe === "function";
8968
- };
8969
-
8970
- // ../simple-boot/dist/esm/intent/IntentManager.js
8971
- var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
8972
- var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
8973
- var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
8974
- var IntentManager = class {
8975
- constructor(simpleApplication, simstanceManager, routerManager, simOption) {
8976
- this.simpleApplication = simpleApplication;
8977
- this.simstanceManager = simstanceManager;
8978
- this.routerManager = routerManager;
8979
- this.simOption = simOption;
8980
- this.subject = new Subject();
8981
- }
8982
- get observable() {
8983
- return this.subject.asObservable();
8984
- }
8985
- async makeIntentData(it, data) {
8986
- const target = [];
8987
- const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
8988
- if (isRouterPublishType(it)) {
8989
- it = it.router;
8990
- }
8991
- const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
8992
- if (routerMatch && typeof it === "string") {
8993
- const routerBasePath = routerMatch[1];
8994
- const actualPath = routerMatch[2];
8995
- const routerModule = await this.routerManager.routing(routerBasePath, {
8996
- router: rootRouter
8997
- });
8998
- const instance = routerModule.getModuleInstance();
8999
- if (instance) {
9000
- target.push(instance);
9001
- }
9002
- it = new Intent(actualPath, data);
9003
- } else if (isSymbolPublishType(it)) {
9004
- it = new Intent({ symbol: it.symbol, uri: it.path }, data);
9005
- } else if (isSchemePublishType(it)) {
9006
- it = new Intent(`${it.scheme}://${it.path}`, data);
9007
- } else if (typeof it === "string") {
9008
- it = new Intent(it, data);
9009
- }
9010
- const intent = it;
9011
- if (!routerMatch) {
9012
- if (intent.symbols) {
9013
- target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
9014
- } else if (intent.scheme) {
9015
- target.push(...this.simstanceManager.getSimConfig(intent.scheme));
9016
- } else {
9017
- target.push(...this.simstanceManager.getSimAtomics());
9018
- }
9019
- }
9020
- return { intent, target };
9021
- }
9022
- async publishMeta(it, data) {
9023
- const { intent, target } = await this.makeIntentData(it, data);
9024
- const r = [];
9025
- const targetInstances = target.map((it2) => {
9026
- if (it2 instanceof SimAtomic) {
9027
- return it2.getValue();
9028
- } else {
9029
- return it2;
9030
- }
9031
- });
9032
- this.subject.next(intent);
9033
- for (let data2 of targetInstances) {
9034
- let orNewSim = data2;
9035
- if (orNewSim) {
9036
- const filteredPaths = intent.paths.filter((i) => i);
9037
- if (filteredPaths.length > 0) {
9038
- let callthis = orNewSim;
9039
- let lastProp = "";
9040
- filteredPaths.forEach((i) => {
9041
- callthis = orNewSim;
9042
- orNewSim = orNewSim?.[i];
9043
- lastProp = i;
9044
- });
9045
- if (orNewSim && typeof orNewSim === "function") {
9046
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9047
- const result = await this.simstanceManager.executeBindParameterSimPromise({
9048
- target: callthis,
9049
- targetKey: lastProp,
9050
- parameterCount: intentData.length,
9051
- inputParameters: intentData,
9052
- firstCheckMaker: [
9053
- (obj, token, idx) => {
9054
- if (idx < intentData.length) {
9055
- return intentData[idx];
9056
- }
9057
- if (token === Intent && idx === 0) {
9058
- return intent;
9059
- }
9060
- }
9061
- ]
9062
- });
9063
- r.push(result);
9064
- } else if (orNewSim) {
9065
- callthis[lastProp] = intent.data;
9066
- r.push(callthis[lastProp]);
9067
- }
9068
- } else {
9069
- const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
9070
- if (isIntentSubscribe(orNewSim)) {
9071
- r.push(orNewSim.intentSubscribe(...intentData));
9072
- }
9073
- }
9074
- }
9075
- }
9076
- return { return: r, target };
9077
- }
9078
- async publish(it, data) {
9079
- const rdata = await this.publishMeta(it, data);
9080
- return rdata.return;
9081
- }
9082
- };
9083
7708
 
9084
7709
  // ../simple-boot/dist/esm/decorators/inject/Injection.js
9085
7710
  var InjectionMetadataKey = Symbol("Injection");
9086
- var getInjection = (target, propertyKey) => {
9087
- return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
9088
- };
9089
-
9090
- // ../simple-boot/dist/esm/throwable/MethodNoSuch.js
9091
- var MethodNoSuch = class extends SimError {
9092
- constructor(message, name, propertyKeys, stack) {
9093
- super(message, name, stack);
9094
- this.propertyKeys = propertyKeys;
9095
- }
9096
- };
9097
7711
 
9098
7712
  // ../simple-boot/dist/esm/decorators/route/Router.js
9099
7713
  var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
9100
- var getRouter = (target) => {
9101
- if (target != null && typeof target === "object") {
9102
- target = target.constructor;
9103
- }
9104
- try {
9105
- return ReflectUtils.getMetadata(RouterMetadataKey, target);
9106
- } catch (e) {
9107
- }
9108
- };
9109
7714
  var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
9110
7715
 
9111
- // ../simple-boot/dist/esm/route/RouterModule.js
9112
- var RouterModule = class {
9113
- constructor(simstanceManager, router, module, routerChains = []) {
9114
- this.simstanceManager = simstanceManager;
9115
- this.router = router;
9116
- this.module = module;
9117
- this.routerChains = routerChains;
9118
- }
9119
- get path() {
9120
- return this._path;
9121
- }
9122
- set path(value) {
9123
- this._path = value;
9124
- }
9125
- get data() {
9126
- return this._data;
9127
- }
9128
- set data(value) {
9129
- this._data = value;
9130
- }
9131
- get intent() {
9132
- return this._intent;
9133
- }
9134
- set intent(value) {
9135
- this._intent = value;
9136
- }
9137
- get propertyKeys() {
9138
- return this._propertyKeys;
9139
- }
9140
- set propertyKeys(value) {
9141
- this._propertyKeys = value;
9142
- }
9143
- get pathData() {
9144
- return this._pathData;
9145
- }
9146
- getPathData() {
9147
- return this._pathData;
9148
- }
9149
- set pathData(value) {
9150
- this._pathData = value;
9151
- }
9152
- getRouterPath(join = "") {
9153
- return this.getRouterPaths().map((it) => it ?? "").join(join);
9154
- }
9155
- getRouterPaths() {
9156
- return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
9157
- }
9158
- getRouterPathData(pathName) {
9159
- return Expression.Path.pathNameData(pathName, this.getRouterPath());
9160
- }
9161
- getModuleInstance(propertyKey, instanceBind = true) {
9162
- const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
9163
- if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
9164
- let instanceElement = instance[propertyKey];
9165
- if (instanceBind && typeof instanceBind === "boolean") {
9166
- instanceElement = instanceElement.bind(instance);
9167
- } else if (instanceBind && typeof instanceBind === "object") {
9168
- instanceElement = instanceElement.bind(instanceBind);
9169
- }
9170
- return instanceElement;
9171
- } else {
9172
- return instance;
9173
- }
9174
- }
9175
- executeModuleProperty(propertyKey, ...param) {
9176
- const target = this.getModuleInstance();
9177
- if (propertyKey) {
9178
- const config = getInjection(target, propertyKey);
9179
- if (config) {
9180
- const other = /* @__PURE__ */ new Map();
9181
- param.forEach((it) => other.set(it.constructor, it));
9182
- return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
9183
- } else {
9184
- if (target[propertyKey]) {
9185
- return target[propertyKey]?.(...param);
9186
- } else {
9187
- throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
9188
- }
9189
- }
9190
- }
9191
- }
9192
- get firstRouteChain() {
9193
- return this.routerChains[0];
9194
- }
9195
- get firstRouteChainValue() {
9196
- return this.firstRouteChain?.getValue();
9197
- }
9198
- get lastRouteChain() {
9199
- return this.routerChains[this.routerChains.length - 1];
9200
- }
9201
- get lastRouteChainValue() {
9202
- return this.lastRouteChain?.getValue();
9203
- }
9204
- hasActivateInLastRoute(obj) {
9205
- return this.lastRouteChainValue?.hasActivate(obj) === true;
9206
- }
9207
- getQueryParamDecodeURI(key) {
9208
- if (this.intent) {
9209
- return this.intent.getQueryParamDecodeURI(key);
9210
- }
9211
- }
9212
- getQueryParamDecodeURIFirst(key) {
9213
- if (this.intent) {
9214
- return this.intent.getQueryParamDecodeURIFirst(key);
9215
- }
9216
- }
9217
- getQueryParam(key) {
9218
- if (this.intent) {
9219
- return this.intent.getQueryParam(key);
9220
- }
9221
- }
9222
- getQueryParamFirst(key) {
9223
- if (this.intent) {
9224
- return this.intent.getQueryParamFirst(key);
9225
- }
9226
- }
9227
- get queryParams() {
9228
- if (this.intent) {
9229
- return this.intent.queryParams;
9230
- }
9231
- }
9232
- get queryParamsAfterDecodeURI() {
9233
- if (this.intent) {
9234
- return this.intent.queryParamsDecodeURI;
9235
- }
9236
- }
9237
- };
9238
-
9239
7716
  // ../simple-boot/dist/esm/route/RouterAction.js
9240
7717
  var RouterAction;
9241
7718
  ((RouterAction2) => {
@@ -9250,435 +7727,6 @@ var RouterAction;
9250
7727
  };
9251
7728
  })(RouterAction || (RouterAction = {}));
9252
7729
 
9253
- // ../simple-boot/dist/esm/route/RouterManager.js
9254
- var RouterManager = class {
9255
- constructor(simpleApplication, simstanceManager, simOption) {
9256
- this.simpleApplication = simpleApplication;
9257
- this.simstanceManager = simstanceManager;
9258
- this.simOption = simOption;
9259
- this.subject = new Subject();
9260
- }
9261
- // @SimNoProxy
9262
- get observable() {
9263
- return this.subject.asObservable();
9264
- }
9265
- routingMap(option) {
9266
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9267
- if (!targetRouter) {
9268
- throw new Error("no router");
9269
- }
9270
- const map = {};
9271
- if (targetRouter) {
9272
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9273
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9274
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9275
- const routerData = routerAtomic.getConfig(RouterMetadataKey);
9276
- if (routerData) {
9277
- const currentPrefix = (option?.prefix ?? "") + routerData.path;
9278
- if (routerData.route && routerData.route[""]) {
9279
- map[currentPrefix] = routerData.route[""];
9280
- }
9281
- if (routerData.route) {
9282
- Object.entries(routerData.route).forEach(([key, value]) => {
9283
- map[currentPrefix + key] = value;
9284
- });
9285
- }
9286
- routerData.routers?.forEach((it) => {
9287
- Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
9288
- });
9289
- }
9290
- }
9291
- return map;
9292
- }
9293
- /** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
9294
- * @deprecated
9295
- */
9296
- async routings(intent, option) {
9297
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9298
- if (!targetRouter) {
9299
- throw new Error("no router");
9300
- }
9301
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9302
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9303
- const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9304
- const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
9305
- const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
9306
- if (exactModuleMatches.length > 0) {
9307
- exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9308
- return exactModuleMatches;
9309
- }
9310
- const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
9311
- if (exactPathMatches.length > 0) {
9312
- exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
9313
- return exactPathMatches;
9314
- }
9315
- return [];
9316
- }
9317
- async routing(intent, option) {
9318
- if (typeof intent === "string") {
9319
- intent = new Intent(intent);
9320
- }
9321
- const targetRouter = option?.router ?? this.simOption.rootRouter;
9322
- const callCheckOnRouting = option?.noOnRouting !== true;
9323
- if (!targetRouter) {
9324
- debugger;
9325
- throw new Error("no router");
9326
- }
9327
- const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
9328
- const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
9329
- const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
9330
- const rootRouter = routerAtomic.getValue();
9331
- const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
9332
- if (executeModuleResult) {
9333
- const [executeModule, routerChains] = executeModuleResult;
9334
- executeModule.routerChains = routerChains;
9335
- this.activeRouterModule = executeModule;
9336
- const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
9337
- if (routerChains.length > 0) {
9338
- for (let i = 0; i < routerChains.length; i++) {
9339
- const current = routerChains[i];
9340
- const next = routerChains[i + 1];
9341
- const value = current.getValue();
9342
- if (RouterAction.isCanActivate(value) && next) {
9343
- await value.canActivate(routingDataSet, next.getValue());
9344
- }
9345
- if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
9346
- await value.onRouting(routingDataSet);
9347
- }
9348
- }
9349
- }
9350
- this.activeRouterModule = executeModule;
9351
- const moduleInstance = executeModule.getModuleInstance();
9352
- if (!executeModule?.module) {
9353
- const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
9354
- const value = routerChain?.getValue();
9355
- if (RouterAction.isCanActivate(value)) {
9356
- await value.canActivate(routingDataSet, moduleInstance);
9357
- }
9358
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9359
- await value.onRouting(routingDataSet);
9360
- }
9361
- } else {
9362
- const value = executeModule.router?.getValue();
9363
- if (RouterAction.isCanActivate(value)) {
9364
- await value.canActivate(routingDataSet, moduleInstance);
9365
- }
9366
- if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
9367
- await value.onRouting(routingDataSet);
9368
- }
9369
- if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
9370
- await moduleInstance.onRouting(routingDataSet);
9371
- }
9372
- }
9373
- const find = this.activeRouterModule;
9374
- this.subject.next({ intent, routerModule: find, routerManager: this });
9375
- return find;
9376
- } else {
9377
- const empty = await this._handleNotFoundRouting(rootRouter, intent);
9378
- this.subject.next({ intent, routerModule: empty, routerManager: this });
9379
- return empty;
9380
- }
9381
- }
9382
- /**
9383
- * URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
9384
- * "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
9385
- * 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
9386
- * @param rootRouter 앱의 최상위 라우터 인스턴스
9387
- * @param intent 확인에 실패한 원본 Intent 객체
9388
- * @private
9389
- */
9390
- async _handleNotFoundRouting(rootRouter, intent) {
9391
- const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
9392
- const routingDataSet = { intent, routerModule, routerManager: this };
9393
- const value = rootRouter;
9394
- if (RouterAction.isCanActivate(value)) {
9395
- await value.canActivate(routingDataSet, null);
9396
- }
9397
- if (RouterAction.isOnRouting(value)) {
9398
- await value.onRouting(routingDataSet);
9399
- }
9400
- this.activeRouterModule = routerModule;
9401
- return this.activeRouterModule;
9402
- }
9403
- getExecuteModule(router, intent, parentRouters, option) {
9404
- const path = intent.pathname;
9405
- const routerConfig = router.getConfig(RouterMetadataKey);
9406
- if (routerConfig) {
9407
- const filters = [];
9408
- if (Array.isArray(routerConfig.filters)) {
9409
- filters.push(...routerConfig.filters);
9410
- } else if (routerConfig.filters) {
9411
- filters.push(routerConfig.filters);
9412
- }
9413
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9414
- if (noAccept) {
9415
- return;
9416
- }
9417
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9418
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9419
- if (isRoot) {
9420
- const currentParentRouters = [...parentRouters, router];
9421
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9422
- let bestMatchModule = void 0;
9423
- let bestMatchLength = -1;
9424
- for (const child of routerConfig.routers) {
9425
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9426
- if (!routerAtomic) {
9427
- continue;
9428
- }
9429
- const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
9430
- if (executeModule) {
9431
- const [rm, chains] = executeModule;
9432
- const currentMatchLength = rm.path?.length || 0;
9433
- if (currentMatchLength > bestMatchLength) {
9434
- bestMatchLength = currentMatchLength;
9435
- bestMatchModule = executeModule;
9436
- } else if (currentMatchLength === bestMatchLength) {
9437
- if (option?.find?.router === "last") {
9438
- bestMatchModule = executeModule;
9439
- }
9440
- }
9441
- }
9442
- }
9443
- if (bestMatchModule) {
9444
- return bestMatchModule;
9445
- }
9446
- }
9447
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9448
- if (module) {
9449
- return [module, currentParentRouters];
9450
- }
9451
- }
9452
- }
9453
- }
9454
- // path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
9455
- isRootUrl(path, parentRoots, url) {
9456
- const searchString = parentRoots.join("") + (path || "");
9457
- if (searchString === "/") {
9458
- return true;
9459
- }
9460
- const searchs = searchString.split("/");
9461
- const urls = url.split("/");
9462
- const trimmedUrls = urls.slice(0, searchs.length).join("/");
9463
- return !!Expression.Path.pathNameData(trimmedUrls, searchString);
9464
- }
9465
- _collectAllMatchingModules(router, intent, parentRouters) {
9466
- const matches = [];
9467
- const path = intent.pathname;
9468
- const routerConfig = router.getConfig(RouterMetadataKey);
9469
- if (routerConfig) {
9470
- const filters = [];
9471
- if (Array.isArray(routerConfig.filters)) {
9472
- filters.push(...routerConfig.filters);
9473
- } else if (routerConfig.filters) {
9474
- filters.push(routerConfig.filters);
9475
- }
9476
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9477
- if (noAccept) {
9478
- return matches;
9479
- }
9480
- const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
9481
- const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
9482
- if (isRoot) {
9483
- const currentParentRouters = [...parentRouters, router];
9484
- if (routerConfig.routers && routerConfig.routers.length > 0) {
9485
- for (const child of routerConfig.routers) {
9486
- const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
9487
- if (!routerAtomic) {
9488
- continue;
9489
- }
9490
- matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
9491
- }
9492
- }
9493
- const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
9494
- if (module) {
9495
- module.routerChains = currentParentRouters;
9496
- matches.push(module);
9497
- }
9498
- }
9499
- }
9500
- return matches;
9501
- }
9502
- findRouterOrModule(router, routerData, parentRoots, intent) {
9503
- const module = this.findRouting(router, routerData, parentRoots, intent);
9504
- if (module?.module) {
9505
- module.intent = intent;
9506
- return module;
9507
- }
9508
- const urlRoot = parentRoots.join("") + (routerData.path || "");
9509
- if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
9510
- const rm = new RouterModule(this.simstanceManager, router);
9511
- rm.intent = intent;
9512
- rm.path = urlRoot;
9513
- rm.pathData = intent.getPathnameData(urlRoot);
9514
- return rm;
9515
- }
9516
- return void 0;
9517
- }
9518
- findRouting(router, routerData, parentRoots, intent) {
9519
- const urlRoot = parentRoots.join("") + routerData.path;
9520
- if (routerData.route) {
9521
- for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
9522
- const path = urlRoot + it;
9523
- const pathnameData = intent.getPathnameData(path);
9524
- if (pathnameData) {
9525
- try {
9526
- const dataSet = this.findRouteProperty(routerData.route, it, intent);
9527
- const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
9528
- rm.data = dataSet.data;
9529
- rm.path = path;
9530
- rm.pathData = pathnameData;
9531
- rm.propertyKeys = dataSet.propertyKeys;
9532
- return rm;
9533
- } catch (e) {
9534
- }
9535
- }
9536
- }
9537
- }
9538
- }
9539
- findRouteProperty(route, propertyName, intent) {
9540
- let child;
9541
- let data;
9542
- let propertyKeys;
9543
- const routeElement = route[propertyName];
9544
- if (typeof routeElement === "function") {
9545
- child = { targetKeyType: routeElement, originalType: routeElement };
9546
- } else if (typeof routeElement === "symbol") {
9547
- const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
9548
- if (findSimType?.originalType) {
9549
- child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
9550
- }
9551
- } else if (typeof routeElement === "string") {
9552
- return this.findRouteProperty(route, routeElement, intent);
9553
- } else if (Array.isArray(routeElement)) {
9554
- const r = routeElement?.[0];
9555
- if (typeof r === "object" && "filters" in r && "target" in r) {
9556
- const filters = [];
9557
- if (Array.isArray(r.filters)) {
9558
- filters.push(...r.filters);
9559
- } else if (r.filters) {
9560
- filters.push(r.filters);
9561
- }
9562
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9563
- if (!noAccept) {
9564
- child = { targetKeyType: r.target, originalType: r.target };
9565
- }
9566
- } else {
9567
- child = { targetKeyType: r, originalType: r };
9568
- }
9569
- data = routeElement?.[1];
9570
- } else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
9571
- const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9572
- if (!noAccept) {
9573
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9574
- propertyKeys = routeElement.propertyKeys;
9575
- }
9576
- } else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
9577
- const filters = [];
9578
- if (Array.isArray(routeElement.filters)) {
9579
- filters.push(...routeElement.filters);
9580
- } else if (routeElement.filters) {
9581
- filters.push(routeElement.filters);
9582
- }
9583
- const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
9584
- if (!noAccept) {
9585
- child = { targetKeyType: routeElement.target, originalType: routeElement.target };
9586
- }
9587
- }
9588
- return {
9589
- child,
9590
- data,
9591
- propertyKeys
9592
- };
9593
- }
9594
- };
9595
-
9596
- // ../simple-boot/dist/esm/SimpleApplication.js
9597
- var SimpleApplication = class _SimpleApplication {
9598
- // public rootRouter?: ConstructorType<any>;
9599
- // constructor();
9600
- // constructor(option: SimOption);
9601
- // constructor(rootRouter?: ConstructorType<Object> | Function);
9602
- // constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
9603
- // constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
9604
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
9605
- constructor(option = new SimOption()) {
9606
- this.option = option;
9607
- this.simstanceManager = new SimstanceManager(this, option);
9608
- this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
9609
- this.routerManager = new RouterManager(this, this.simstanceManager, option);
9610
- this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
9611
- this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
9612
- this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
9613
- containers.add(this);
9614
- }
9615
- getSimstanceManager() {
9616
- return this.simstanceManager;
9617
- }
9618
- getIntentManager() {
9619
- return this.intentManager;
9620
- }
9621
- getRouterManager() {
9622
- return this.routerManager;
9623
- }
9624
- run(otherInstanceSim) {
9625
- otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
9626
- otherInstanceSim.set(_SimpleApplication, this);
9627
- this.simstanceManager.run(otherInstanceSim);
9628
- return this;
9629
- }
9630
- simAtomic(type) {
9631
- if (typeof type === "symbol") {
9632
- return this.simstanceManager.findFirstSim(type);
9633
- } else if (typeof type === "function") {
9634
- return this.simstanceManager.findFirstSim({ type });
9635
- }
9636
- }
9637
- simAtomics(type) {
9638
- if (typeof type === "symbol") {
9639
- return this.simstanceManager.findSims(type) ?? [];
9640
- } else if (typeof type === "function") {
9641
- return this.simstanceManager.findSims({ type }) ?? [];
9642
- } else {
9643
- return [];
9644
- }
9645
- }
9646
- getInstance(type) {
9647
- const i = this.sim(type);
9648
- if (i) {
9649
- return i;
9650
- } else {
9651
- throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
9652
- }
9653
- }
9654
- sim(type) {
9655
- return this.simAtomic(type)?.getValue();
9656
- }
9657
- sims(type) {
9658
- return this.simAtomics(type).map((it) => it.getValue());
9659
- }
9660
- addSim(configOrTarget, target) {
9661
- const r = Sim(configOrTarget);
9662
- if (typeof r === "function" && target) {
9663
- r(target);
9664
- }
9665
- }
9666
- publishIntent(i, data) {
9667
- return this.intentManager.publish(i, data);
9668
- }
9669
- routing(i, option) {
9670
- if (i instanceof Intent) {
9671
- return this.routerManager.routing(i, option);
9672
- } else if (typeof i === "string") {
9673
- const intent = new Intent(i);
9674
- return this.routerManager.routing(intent, option);
9675
- } else {
9676
- const intent = new Intent(i.path, i.data);
9677
- return this.routerManager.routing(intent, option);
9678
- }
9679
- }
9680
- };
9681
-
9682
7730
  // ../core-web/dist/esm/element/CanvasUtils.js
9683
7731
  var CanvasUtils;
9684
7732
  ((CanvasUtils2) => {
@@ -10439,392 +8487,6 @@ var ValidUtils2;
10439
8487
  return /Mobi/i.test(targetWindow.navigator.userAgent);
10440
8488
  };
10441
8489
  })(ValidUtils2 || (ValidUtils2 = {}));
10442
-
10443
- // ../simple-boot/dist/esm/index.js
10444
- var import_reflect_metadata = __toESM(require_Reflect(), 1);
10445
-
10446
- // ../simple-boot/dist/esm/alert/AlertAction.js
10447
- var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
10448
- AlertAction2["ACTIVE"] = "ACTIVE";
10449
- AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
10450
- return AlertAction2;
10451
- })(AlertAction || {});
10452
-
10453
- // ../simple-boot/dist/esm/alert/Alert.js
10454
- var Alert = class {
10455
- constructor(alertService, config) {
10456
- this.alertService = alertService;
10457
- this.config = config;
10458
- this.isActive = false;
10459
- this.activateBefore = [];
10460
- this.activateAfter = [];
10461
- this.deActivateBefore = [];
10462
- this.deActivateAfter = [];
10463
- this.data = /* @__PURE__ */ new Map();
10464
- if (config?.uuid) {
10465
- this.uuid = config.uuid;
10466
- } else {
10467
- this.uuid = RandomUtils.uuid();
10468
- }
10469
- }
10470
- addOpenBefore(fn) {
10471
- this.activateBefore.push(fn);
10472
- }
10473
- addOpenAfter(fn) {
10474
- this.activateAfter.push(fn);
10475
- }
10476
- addCloseBefore(fn) {
10477
- this.deActivateBefore.push(fn);
10478
- }
10479
- addCloseAfter(fn) {
10480
- this.deActivateAfter.push(fn);
10481
- }
10482
- setData(key, value) {
10483
- this.data.set(key, value);
10484
- }
10485
- getData(key) {
10486
- return this.data.get(key);
10487
- }
10488
- async activate() {
10489
- try {
10490
- await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
10491
- this.result = this.make();
10492
- this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
10493
- this.isActive = true;
10494
- if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
10495
- setTimeout(() => {
10496
- this.deActivate();
10497
- }, this.config.closeTime);
10498
- }
10499
- this.config?.activate?.(this.result, this);
10500
- });
10501
- } catch (e) {
10502
- } finally {
10503
- await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
10504
- });
10505
- }
10506
- }
10507
- async deActivate() {
10508
- try {
10509
- await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
10510
- this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
10511
- this.isActive = false;
10512
- this.config?.deActivate?.(this.result, this);
10513
- });
10514
- } catch (e) {
10515
- } finally {
10516
- await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
10517
- });
10518
- }
10519
- }
10520
- };
10521
-
10522
- // ../simple-boot/dist/esm/alert/AlertFactory.js
10523
- var __decorate = function(decorators, target, key, desc) {
10524
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10525
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10526
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10527
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10528
- };
10529
- var AlertFactory;
10530
- (function(AlertFactory2) {
10531
- AlertFactory2.SYMBOL = Symbol.for("simple-boot:alert-factory-token");
10532
- })(AlertFactory || (AlertFactory = {}));
10533
- var DefaultAlertFactory = class DefaultAlertFactory2 {
10534
- create(data) {
10535
- return void 0;
10536
- }
10537
- };
10538
- DefaultAlertFactory = __decorate([
10539
- Sim({ symbol: AlertFactory.SYMBOL })
10540
- ], DefaultAlertFactory);
10541
-
10542
- // ../simple-boot/dist/esm/alert/AlertType.js
10543
- var AlertType = /* @__PURE__ */ ((AlertType2) => {
10544
- AlertType2["DANGER"] = "DANGER";
10545
- AlertType2["NORMAL"] = "NORMAL";
10546
- AlertType2["PROGRESS"] = "PROGRESS";
10547
- AlertType2["SUCCESS"] = "SUCCESS";
10548
- AlertType2["ERROR"] = "ERROR";
10549
- AlertType2["INFO"] = "INFO";
10550
- AlertType2["WARNING"] = "WARNING";
10551
- AlertType2["CONSOLE"] = "CONSOLE";
10552
- AlertType2["ETC"] = "ETC";
10553
- return AlertType2;
10554
- })(AlertType || {});
10555
-
10556
- // ../simple-boot/dist/esm/alert/AlertService.js
10557
- var __decorate2 = function(decorators, target, key, desc) {
10558
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10559
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10560
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10561
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10562
- };
10563
- var __metadata = function(k, v) {
10564
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10565
- };
10566
- var __param = function(paramIndex, decorator) {
10567
- return function(target, key) {
10568
- decorator(target, key, paramIndex);
10569
- };
10570
- };
10571
- var _a;
10572
- var AlertService = class AlertService2 {
10573
- constructor(alertFactory) {
10574
- this.name = (/* @__PURE__ */ new Date()).toUTCString();
10575
- this.subject = new ReplaySubject();
10576
- this.alertFactory = alertFactory;
10577
- }
10578
- // @PostConstruct
10579
- // postConstruct(
10580
- // ) {
10581
- // this.alertFactory = alertFactory;
10582
- // }
10583
- get observable() {
10584
- return this.subject.asObservable();
10585
- }
10586
- publish(data) {
10587
- this.subject.next(data);
10588
- }
10589
- create(factory, config) {
10590
- return new class extends Alert {
10591
- make() {
10592
- return factory(this);
10593
- }
10594
- }(this, config);
10595
- }
10596
- createFromFactory(type, config) {
10597
- return this.alertFactory?.create({ caller: this, type, config });
10598
- }
10599
- danger(config) {
10600
- return this.createFromFactory(AlertType.DANGER, config);
10601
- }
10602
- progress(config) {
10603
- config = config ?? {};
10604
- return this.createFromFactory(AlertType.PROGRESS, config);
10605
- }
10606
- success(config) {
10607
- return this.createFromFactory(AlertType.SUCCESS, config);
10608
- }
10609
- info(config) {
10610
- return this.createFromFactory(AlertType.INFO, config);
10611
- }
10612
- error(config) {
10613
- return this.createFromFactory(AlertType.ERROR, config);
10614
- }
10615
- warning(config) {
10616
- return this.createFromFactory(AlertType.WARNING, config);
10617
- }
10618
- };
10619
- AlertService = __decorate2([
10620
- Sim,
10621
- __param(0, Inject({ symbol: AlertFactory.SYMBOL })),
10622
- __metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
10623
- ], AlertService);
10624
-
10625
- // ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
10626
- var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
10627
- var getCacheSet = (simpleApplication) => {
10628
- return simpleApplicationCache.get(simpleApplication);
10629
- };
10630
- var findCacheByKey = (simpleApplication, key) => {
10631
- const storage = simpleApplicationCache.get(simpleApplication);
10632
- if (storage) {
10633
- return Array.from(storage.config.entries()).find(([k, v]) => k === key);
10634
- }
10635
- };
10636
- var findCacheByKeyStartWith = (simpleApplication, key) => {
10637
- const storage = simpleApplicationCache.get(simpleApplication);
10638
- if (storage) {
10639
- return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
10640
- } else {
10641
- return [];
10642
- }
10643
- };
10644
- var deleteCacheByKey = (simpleApplication, key) => {
10645
- const storage = simpleApplicationCache.get(simpleApplication);
10646
- if (storage) {
10647
- storage.storage.delete(key);
10648
- findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
10649
- const data = storage.config.get(k);
10650
- if (data?.expireTimeout) {
10651
- clearTimeout(data.expireTimeout);
10652
- }
10653
- storage.config.delete(k);
10654
- storage.storage.delete(k);
10655
- });
10656
- }
10657
- };
10658
- var deleteCacheByKeyStartWith = (simpleApplication, key) => {
10659
- findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
10660
- };
10661
- var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
10662
-
10663
- // ../simple-boot/dist/esm/cache/CacheManager.js
10664
- var __decorate3 = function(decorators, target, key, desc) {
10665
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10666
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10667
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10668
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10669
- };
10670
- var __metadata2 = function(k, v) {
10671
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10672
- };
10673
- var _a2;
10674
- var CacheManager = class CacheManager2 {
10675
- constructor(simpleApplication) {
10676
- this.simpleApplication = simpleApplication;
10677
- }
10678
- findCacheByKey(key) {
10679
- return findCacheByKey(this.simpleApplication, key);
10680
- }
10681
- findCacheByKeyStartWith(key) {
10682
- return findCacheByKeyStartWith(this.simpleApplication, key);
10683
- }
10684
- deleteCacheByKey(key) {
10685
- return deleteCacheByKey(this.simpleApplication, key);
10686
- }
10687
- deleteCacheByKeyStartWith(key) {
10688
- return deleteCacheByKeyStartWith(this.simpleApplication, key);
10689
- }
10690
- getCacheSet() {
10691
- return getCacheSet(this.simpleApplication);
10692
- }
10693
- };
10694
- CacheManager = __decorate3([
10695
- Sim,
10696
- __metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
10697
- ], CacheManager);
10698
-
10699
- // ../simple-boot/dist/esm/decorators/event/EventListener.js
10700
- var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
10701
-
10702
- // ../simple-boot/dist/esm/decorators/validate/Validation.js
10703
- var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
10704
- var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
10705
-
10706
- // ../simple-boot/dist/esm/fetch/ApiService.js
10707
- var __decorate4 = function(decorators, target, key, desc) {
10708
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10709
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10710
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10711
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10712
- };
10713
- var __metadata3 = function(k, v) {
10714
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10715
- };
10716
- var _a3;
10717
- var _b;
10718
- var ApiServiceInterceptor;
10719
- (function(ApiServiceInterceptor2) {
10720
- ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
10721
- ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
10722
- try {
10723
- return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
10724
- } catch (e) {
10725
- return [];
10726
- }
10727
- };
10728
- })(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
10729
- var ApiService = class ApiService2 extends HttpJsonFetcher {
10730
- constructor(simstanceManager, alertService) {
10731
- super();
10732
- this.simstanceManager = simstanceManager;
10733
- this.subject = new Subject();
10734
- this.alertService = alertService;
10735
- }
10736
- // @PostConstruct
10737
- // postConstruct(alertService: AlertService<any>) {
10738
- // this.alertService = alertService;
10739
- // }
10740
- get observable() {
10741
- return this.subject.asObservable();
10742
- }
10743
- createPipe(config) {
10744
- return {};
10745
- }
10746
- async beforeProxyFetch(config) {
10747
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10748
- for (const interceptor of interceptors) {
10749
- if (interceptor.beforeProxyFetch) {
10750
- config = await interceptor.beforeProxyFetch(config);
10751
- }
10752
- }
10753
- this.subject.next({ type: "beforeFetchData", config });
10754
- return config;
10755
- }
10756
- async afterProxyFetch(config) {
10757
- let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
10758
- let r = config.response;
10759
- for (const interceptor of interceptors) {
10760
- if (interceptor.afterProxyFetch) {
10761
- r = await interceptor.afterProxyFetch(config);
10762
- }
10763
- }
10764
- this.subject.next({ type: "afterFetchData", response: r });
10765
- return r;
10766
- }
10767
- beforeFetch(fetch2) {
10768
- this.subject.next({ type: "beforeFetch", fetch: fetch2 });
10769
- }
10770
- afterFetch(fetch2, response) {
10771
- this.subject.next({ type: "afterFetch", fetch: fetch2, response });
10772
- }
10773
- before(config, pipe) {
10774
- this.subject.next({ type: "progress", config, pipe });
10775
- config.config?.config?.callBackProgress?.(config, pipe);
10776
- if (config.config?.config?.alertProgress) {
10777
- const alert = this.alertService?.progress({ title: config.config.config.title });
10778
- if (alert) {
10779
- pipe.progress = alert;
10780
- alert.activate();
10781
- }
10782
- }
10783
- }
10784
- afterSuccess(config, pipe) {
10785
- this.subject.next({ type: "success", config, pipe });
10786
- config.config?.config?.callBackSuccess?.(config, pipe);
10787
- if (config.config?.config?.alertSuccessMsg) {
10788
- this.alertService?.success({ title: config.config.config.title })?.activate();
10789
- }
10790
- }
10791
- afterSuccessTransform(config, pipe) {
10792
- }
10793
- finally(config, pipe) {
10794
- this.subject.next({ type: "final", config, pipe });
10795
- config.config?.config?.callBackFinal?.(config, pipe);
10796
- pipe.progress?.deActivate();
10797
- }
10798
- error(config, pipe, e) {
10799
- console.log("error", e);
10800
- this.subject.next({ type: "error", config, pipe, e });
10801
- config.config?.config?.callBackError?.(config, pipe, e);
10802
- if (config.config?.config?.alertErrorMsg) {
10803
- this.alertService?.danger({
10804
- title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
10805
- })?.activate();
10806
- }
10807
- if (config.config?.config?.enableErrorConsole) {
10808
- console.error(`apiService Error ${config?.config?.config?.title}`, e);
10809
- }
10810
- }
10811
- async execute(fetcherRequest) {
10812
- const target = fetcherRequest.target;
10813
- const config = fetcherRequest.config;
10814
- let r = { target, config };
10815
- const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
10816
- for (const apiServiceInterceptor of interceptor) {
10817
- if (apiServiceInterceptor.beforeProxyExecute) {
10818
- r = await apiServiceInterceptor.beforeProxyExecute?.(r);
10819
- }
10820
- }
10821
- return super.execute(r);
10822
- }
10823
- };
10824
- ApiService = __decorate4([
10825
- Sim,
10826
- __metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
10827
- ], ApiService);
10828
8490
  export {
10829
8491
  ADD_EVENT_LISTENER_METADATA_KEY,
10830
8492
  APPLY_NODE_METADATA_KEY,
@@ -10847,10 +8509,11 @@ export {
10847
8509
  ON_BEFORE_ADOPTED_METADATA_KEY,
10848
8510
  ON_BEFORE_CONNECTED_METADATA_KEY,
10849
8511
  ON_BEFORE_DISCONNECTED_METADATA_KEY,
10850
- ON_CONSTRUCTOR_METADATA_KEY,
8512
+ ON_INITIALIZE_METADATA_KEY,
10851
8513
  QUERY_ALL_METADATA_KEY,
10852
8514
  QUERY_METADATA_KEY,
10853
8515
  STYLE_METADATA_KEY,
8516
+ SUBSCRIBE_SWC_APP_ROUTE_CHANGE_METADATA_KEY,
10854
8517
  SWC_NOT_FOUND,
10855
8518
  SwcUtils,
10856
8519
  addClass,
@@ -10902,6 +8565,7 @@ export {
10902
8565
  getOnConnectedInnerHtmlMetadata,
10903
8566
  getQueryAllMetadata,
10904
8567
  getQueryMetadata,
8568
+ getSubscribeSwcAppRouteChangeMetadata,
10905
8569
  host,
10906
8570
  htmlAElement,
10907
8571
  htmlArticleElement,
@@ -10926,8 +8590,8 @@ export {
10926
8590
  onBeforeDisconnected,
10927
8591
  onConnected,
10928
8592
  onConnectedInnerHtml,
10929
- onConstructor,
10930
8593
  onDisconnected,
8594
+ onInitialize,
10931
8595
  parentHost,
10932
8596
  query,
10933
8597
  queryAll,
@@ -10946,6 +8610,7 @@ export {
10946
8610
  setClassHost,
10947
8611
  setStyle,
10948
8612
  setStyleHost,
8613
+ subscribeSwcAppRouteChange,
10949
8614
  textNode,
10950
8615
  toggleClass,
10951
8616
  toggleClassHost,