@dooboostore/simple-web-component 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -3406
- package/dist/cjs/decorators/addEventListener.js +1 -1
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +148 -0
- package/dist/cjs/decorators/applyAttribute.js.map +7 -0
- package/dist/cjs/decorators/applyClass.js +164 -0
- package/dist/cjs/decorators/applyClass.js.map +7 -0
- package/dist/cjs/decorators/applyNode.js +87 -194
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/{style.js → applyStyle.js} +50 -60
- package/dist/cjs/decorators/applyStyle.js.map +7 -0
- package/dist/cjs/decorators/attribute.js +10 -16
- package/dist/cjs/decorators/attribute.js.map +2 -2
- package/dist/cjs/decorators/changedAttributeHost.js +1 -1
- package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +14 -23
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js +5 -2
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +3 -3
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +9 -9
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/query.js +1 -1
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +1 -1
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/elements/SwcAppEngine.js +19 -4
- package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +2 -0
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/utils/Utils.js +1 -1
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +1 -1
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +129 -0
- package/dist/esm/decorators/applyAttribute.js.map +7 -0
- package/dist/esm/decorators/applyClass.js +145 -0
- package/dist/esm/decorators/applyClass.js.map +7 -0
- package/dist/esm/decorators/applyNode.js +87 -194
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/{style.js → applyStyle.js} +47 -57
- package/dist/esm/decorators/applyStyle.js.map +7 -0
- package/dist/esm/decorators/attribute.js +10 -16
- package/dist/esm/decorators/attribute.js.map +2 -2
- package/dist/esm/decorators/changedAttributeHost.js +1 -1
- package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +14 -23
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +5 -2
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +3 -3
- package/dist/esm/decorators/index.js.map +1 -1
- package/dist/esm/decorators/lifecycles.js +9 -9
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/query.js +1 -1
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +1 -1
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/elements/SwcAppEngine.js +19 -4
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +2 -0
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/utils/Utils.js +1 -1
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2884 -586
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +22 -0
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -0
- package/dist/types/decorators/applyClass.d.ts +65 -0
- package/dist/types/decorators/applyClass.d.ts.map +1 -0
- package/dist/types/decorators/applyNode.d.ts +15 -123
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +21 -0
- package/dist/types/decorators/applyStyle.d.ts.map +1 -0
- package/dist/types/decorators/attribute.d.ts +10 -19
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +3 -3
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/elements/SwcAppEngine.d.ts +7 -0
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2884 -586
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/decorators/addEventListener.ts +1 -1
- package/src/decorators/applyAttribute.ts +147 -0
- package/src/decorators/applyClass.ts +158 -0
- package/src/decorators/applyNode.ts +112 -330
- package/src/decorators/applyStyle.ts +128 -0
- package/src/decorators/attribute.ts +21 -55
- package/src/decorators/changedAttributeHost.ts +1 -1
- package/src/decorators/elementDefine.ts +18 -39
- package/src/decorators/emitCustomEvent.ts +6 -3
- package/src/decorators/index.ts +3 -3
- package/src/decorators/lifecycles.ts +9 -11
- package/src/decorators/query.ts +1 -1
- package/src/decorators/queryAll.ts +1 -1
- package/src/elements/SwcAppEngine.ts +32 -4
- package/src/elements/SwcAppMixin.ts +2 -0
- package/src/utils/Utils.ts +2 -1
- package/dist/cjs/decorators/classList.js +0 -177
- package/dist/cjs/decorators/classList.js.map +0 -7
- package/dist/cjs/decorators/setAttribute.js +0 -111
- package/dist/cjs/decorators/setAttribute.js.map +0 -7
- package/dist/cjs/decorators/style.js.map +0 -7
- package/dist/esm/decorators/classList.js +0 -158
- package/dist/esm/decorators/classList.js.map +0 -7
- package/dist/esm/decorators/setAttribute.js +0 -92
- package/dist/esm/decorators/setAttribute.js.map +0 -7
- package/dist/esm/decorators/style.js.map +0 -7
- package/dist/types/decorators/classList.d.ts +0 -71
- package/dist/types/decorators/classList.d.ts.map +0 -1
- package/dist/types/decorators/setAttribute.d.ts +0 -23
- package/dist/types/decorators/setAttribute.d.ts.map +0 -1
- package/dist/types/decorators/style.d.ts +0 -58
- package/dist/types/decorators/style.d.ts.map +0 -1
- package/src/decorators/classList.ts +0 -234
- package/src/decorators/setAttribute.ts +0 -114
- package/src/decorators/style.ts +0 -185
|
@@ -297,8 +297,8 @@ var require_Reflect = __commonJS({
|
|
|
297
297
|
keys.push(key);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
for (var
|
|
301
|
-
var key = parentKeys_1[
|
|
300
|
+
for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
|
|
301
|
+
var key = parentKeys_1[_a4];
|
|
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
|
|
1113
|
+
var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
|
|
1114
1114
|
|
|
1115
1115
|
// src/index.ts
|
|
1116
|
-
var
|
|
1116
|
+
var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
|
|
1117
1117
|
|
|
1118
1118
|
// ../core/dist/esm/valid/ValidUtils.js
|
|
1119
1119
|
var ValidUtils;
|
|
@@ -4789,6 +4789,107 @@ 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
|
+
|
|
4792
4893
|
// ../core/dist/esm/message/AutoCloseSubscription.js
|
|
4793
4894
|
var AutoCloseSubscription = class extends Subscription {
|
|
4794
4895
|
constructor(userUnsubscribe) {
|
|
@@ -5123,6 +5224,284 @@ var Promises;
|
|
|
5123
5224
|
})(Result = Promises2.Result || (Promises2.Result = {}));
|
|
5124
5225
|
})(Promises || (Promises = {}));
|
|
5125
5226
|
|
|
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
|
+
|
|
5126
5505
|
// ../core/dist/esm/entity/object/obj/RenderDrawObj.js
|
|
5127
5506
|
var RenderDrawObj = class extends Obj {
|
|
5128
5507
|
render(draw, config) {
|
|
@@ -5399,7 +5778,7 @@ _RenderTransactionDrawObj.DEFAULT_BEZIER = { p1x: 0.61, p1y: 1, p2x: 0.88, p2y:
|
|
|
5399
5778
|
// ../core/dist/esm/schedule/Schedule.js
|
|
5400
5779
|
var Schedule;
|
|
5401
5780
|
((Schedule2) => {
|
|
5402
|
-
Schedule2.SYMBOL = Symbol("
|
|
5781
|
+
Schedule2.SYMBOL = Symbol.for("core:schedule-token");
|
|
5403
5782
|
})(Schedule || (Schedule = {}));
|
|
5404
5783
|
|
|
5405
5784
|
// ../core/dist/esm/url/UrlUtils.js
|
|
@@ -5553,6 +5932,17 @@ var ReflectUtils;
|
|
|
5553
5932
|
Reflect.defineMetadata(metadataKey, value, target);
|
|
5554
5933
|
}
|
|
5555
5934
|
};
|
|
5935
|
+
ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
|
|
5936
|
+
const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
|
|
5937
|
+
for (const key of keys) {
|
|
5938
|
+
const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
|
|
5939
|
+
if (propertyKey) {
|
|
5940
|
+
Reflect.defineMetadata(key, data, to, propertyKey);
|
|
5941
|
+
} else {
|
|
5942
|
+
Reflect.defineMetadata(key, data, to);
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
};
|
|
5556
5946
|
})(ReflectUtils || (ReflectUtils = {}));
|
|
5557
5947
|
|
|
5558
5948
|
// ../core/dist/esm/function/FunctionUtils.js
|
|
@@ -5716,7 +6106,7 @@ var Expression;
|
|
|
5716
6106
|
})(Expression || (Expression = {}));
|
|
5717
6107
|
|
|
5718
6108
|
// src/decorators/addEventListener.ts
|
|
5719
|
-
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
|
|
6109
|
+
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
5720
6110
|
function addEventListener(selectorOrTarget, type, options = {}) {
|
|
5721
6111
|
return (targetObj, propertyKey, descriptor) => {
|
|
5722
6112
|
const constructor = targetObj.constructor;
|
|
@@ -5737,15 +6127,15 @@ function addEventListenerHost(type, options) {
|
|
|
5737
6127
|
}
|
|
5738
6128
|
|
|
5739
6129
|
// src/decorators/lifecycles.ts
|
|
5740
|
-
var ON_CONSTRUCTOR_METADATA_KEY = Symbol("simple-web-component:on-constructor");
|
|
5741
|
-
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-connected");
|
|
5742
|
-
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-connected");
|
|
5743
|
-
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-disconnected");
|
|
5744
|
-
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-disconnected");
|
|
5745
|
-
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
|
|
5746
|
-
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
|
|
5747
|
-
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
|
|
5748
|
-
var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
|
|
6130
|
+
var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
6131
|
+
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
6132
|
+
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
6133
|
+
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
6134
|
+
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
6135
|
+
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
6136
|
+
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
6137
|
+
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
6138
|
+
var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
|
|
5749
6139
|
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
5750
6140
|
function createLifecycleDecorator(metadataKey) {
|
|
5751
6141
|
return (target, propertyKey) => {
|
|
@@ -5796,7 +6186,7 @@ var getOnConnectedInnerHtmlMetadata = (target) => {
|
|
|
5796
6186
|
};
|
|
5797
6187
|
|
|
5798
6188
|
// src/decorators/attribute.ts
|
|
5799
|
-
var
|
|
6189
|
+
var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
|
|
5800
6190
|
var convertValue = (val, type) => {
|
|
5801
6191
|
if (val === null || val === void 0) return val;
|
|
5802
6192
|
if (type === Number) return Number(val);
|
|
@@ -5854,15 +6244,14 @@ function attribute(selector, options = {}) {
|
|
|
5854
6244
|
const constructor = target.constructor;
|
|
5855
6245
|
const privateKey = Symbol(String(propertyKey));
|
|
5856
6246
|
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
5857
|
-
let metaList = ReflectUtils.getOwnMetadata(
|
|
6247
|
+
let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
|
|
5858
6248
|
if (!metaList) {
|
|
5859
6249
|
metaList = [];
|
|
5860
|
-
ReflectUtils.defineMetadata(
|
|
6250
|
+
ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
|
|
5861
6251
|
}
|
|
5862
6252
|
metaList.push({ propertyKey, selector, options, privateKey });
|
|
5863
6253
|
const applySetAttribute = (inst, targets, attrName, nv) => {
|
|
5864
6254
|
targets.forEach((it) => {
|
|
5865
|
-
console.log("----->", it);
|
|
5866
6255
|
if (it && typeof it.setAttribute === "function") {
|
|
5867
6256
|
if (nv === null) {
|
|
5868
6257
|
it.removeAttribute(attrName);
|
|
@@ -5880,7 +6269,6 @@ function attribute(selector, options = {}) {
|
|
|
5880
6269
|
const conf = getElementConfig(this);
|
|
5881
6270
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
5882
6271
|
const targetType = options.type || designType;
|
|
5883
|
-
console.log("type-->", propertyKey, targetType);
|
|
5884
6272
|
if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
|
|
5885
6273
|
return convertValue(this[privateKey], targetType);
|
|
5886
6274
|
}
|
|
@@ -5896,7 +6284,6 @@ function attribute(selector, options = {}) {
|
|
|
5896
6284
|
return convertValue(this[privateKey], targetType);
|
|
5897
6285
|
},
|
|
5898
6286
|
set(nv) {
|
|
5899
|
-
const targetType = options.type || designType;
|
|
5900
6287
|
const attrName = options.name || String(propertyKey);
|
|
5901
6288
|
const conf = getElementConfig(this);
|
|
5902
6289
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
@@ -5921,13 +6308,9 @@ function attribute(selector, options = {}) {
|
|
|
5921
6308
|
});
|
|
5922
6309
|
};
|
|
5923
6310
|
}
|
|
5924
|
-
var findAllAttributeMetadata = (target) => {
|
|
5925
|
-
return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
|
|
5926
|
-
};
|
|
5927
6311
|
function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
5928
6312
|
if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
5929
|
-
|
|
5930
|
-
return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
|
|
6313
|
+
return attribute(":host", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
|
|
5931
6314
|
}
|
|
5932
6315
|
if (typeof targetOrAttrOrOptions === "string") {
|
|
5933
6316
|
const attrName = targetOrAttrOrOptions;
|
|
@@ -5936,19 +6319,20 @@ function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
|
5936
6319
|
} else if (typeof targetOrAttrOrOptions === "object") {
|
|
5937
6320
|
const options = targetOrAttrOrOptions;
|
|
5938
6321
|
return (target, propertyKey) => {
|
|
5939
|
-
|
|
5940
|
-
return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
|
|
6322
|
+
return attribute(":host", { ...options, name: String(propertyKey) })(target, propertyKey);
|
|
5941
6323
|
};
|
|
5942
6324
|
} else {
|
|
5943
6325
|
return (target, propertyKey) => {
|
|
5944
|
-
|
|
5945
|
-
return attribute(":host", { name: fieldName })(target, propertyKey);
|
|
6326
|
+
return attribute(":host", { name: String(propertyKey) })(target, propertyKey);
|
|
5946
6327
|
};
|
|
5947
6328
|
}
|
|
5948
6329
|
}
|
|
6330
|
+
var findAllAttributeMetadata = (target) => {
|
|
6331
|
+
return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
|
|
6332
|
+
};
|
|
5949
6333
|
|
|
5950
6334
|
// src/decorators/changedAttributeHost.ts
|
|
5951
|
-
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol("simple-web-component:on-attribute-changed");
|
|
6335
|
+
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
|
|
5952
6336
|
function changedAttributeHost(attributeName) {
|
|
5953
6337
|
return (target, propertyKey) => {
|
|
5954
6338
|
const constructor = target.constructor;
|
|
@@ -5974,102 +6358,43 @@ var findAllAttributeChangedMetadata = (target) => {
|
|
|
5974
6358
|
return ReflectUtils.findAllMapMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, target);
|
|
5975
6359
|
};
|
|
5976
6360
|
|
|
5977
|
-
// src/decorators/setAttribute.ts
|
|
5978
|
-
var SET_ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:set-attribute");
|
|
5979
|
-
function setAttribute(selector, name, options = {}) {
|
|
5980
|
-
return (target, propertyKey, descriptor) => {
|
|
5981
|
-
const constructor = target.constructor;
|
|
5982
|
-
let metaList = ReflectUtils.getOwnMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
|
|
5983
|
-
if (!metaList) {
|
|
5984
|
-
metaList = /* @__PURE__ */ new Map();
|
|
5985
|
-
ReflectUtils.defineMetadata(SET_ATTRIBUTE_METADATA_KEY, metaList, constructor);
|
|
5986
|
-
}
|
|
5987
|
-
metaList.set(propertyKey, { propertyKey, selector, name, options });
|
|
5988
|
-
const original = descriptor.value;
|
|
5989
|
-
descriptor.value = async function(...args) {
|
|
5990
|
-
ensureInit2(this);
|
|
5991
|
-
const res = await original.apply(this, args);
|
|
5992
|
-
if (res !== void 0) {
|
|
5993
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
5994
|
-
const conf = getElementConfig(this);
|
|
5995
|
-
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
5996
|
-
const targetEls = [];
|
|
5997
|
-
const r = options.root || "auto";
|
|
5998
|
-
const applyRoot = (t) => {
|
|
5999
|
-
if (!t) return;
|
|
6000
|
-
if (r === "auto") {
|
|
6001
|
-
targetEls.push(t);
|
|
6002
|
-
} else {
|
|
6003
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
6004
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
6005
|
-
}
|
|
6006
|
-
};
|
|
6007
|
-
if (selector === ":window") targetEls.push(currentWin);
|
|
6008
|
-
else if (selector === ":document") targetEls.push(currentWin.document);
|
|
6009
|
-
else if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6010
|
-
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6011
|
-
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6012
|
-
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6013
|
-
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6014
|
-
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6015
|
-
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6016
|
-
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6017
|
-
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6018
|
-
else {
|
|
6019
|
-
const roots = [];
|
|
6020
|
-
if (r === "shadow") {
|
|
6021
|
-
if (this.shadowRoot) roots.push(this.shadowRoot);
|
|
6022
|
-
} else if (r === "light") {
|
|
6023
|
-
roots.push(this);
|
|
6024
|
-
} else if (r === "all") {
|
|
6025
|
-
roots.push(this);
|
|
6026
|
-
if (this.shadowRoot) roots.push(this.shadowRoot);
|
|
6027
|
-
} else {
|
|
6028
|
-
roots.push(this.shadowRoot || this);
|
|
6029
|
-
}
|
|
6030
|
-
roots.forEach((root) => targetEls.push(...root.querySelectorAll(selector)));
|
|
6031
|
-
}
|
|
6032
|
-
targetEls.forEach((targetEl) => {
|
|
6033
|
-
if (!targetEl || typeof targetEl.setAttribute !== "function") return;
|
|
6034
|
-
if (res === null) targetEl.removeAttribute(name);
|
|
6035
|
-
else targetEl.setAttribute(name, String(res));
|
|
6036
|
-
});
|
|
6037
|
-
}
|
|
6038
|
-
return res;
|
|
6039
|
-
};
|
|
6040
|
-
};
|
|
6041
|
-
}
|
|
6042
|
-
var getSetAttributeMetadata = (target) => {
|
|
6043
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
6044
|
-
return ReflectUtils.getMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
|
|
6045
|
-
};
|
|
6046
|
-
var findAllSetAttributeMetadata = (target) => {
|
|
6047
|
-
const result = /* @__PURE__ */ new Map();
|
|
6048
|
-
const maps = ReflectUtils.findAllMetadata(SET_ATTRIBUTE_METADATA_KEY, target);
|
|
6049
|
-
maps.forEach((map) => {
|
|
6050
|
-
if (map instanceof Map) {
|
|
6051
|
-
map.forEach((v, k) => result.set(k, v));
|
|
6052
|
-
}
|
|
6053
|
-
});
|
|
6054
|
-
return result;
|
|
6055
|
-
};
|
|
6056
|
-
function setAttributeHost(name, options) {
|
|
6057
|
-
return setAttribute(":host", name, options);
|
|
6058
|
-
}
|
|
6059
|
-
|
|
6060
6361
|
// src/decorators/applyNode.ts
|
|
6061
|
-
var APPLY_NODE_METADATA_KEY = Symbol("simple-web-component:apply-node");
|
|
6362
|
+
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
6062
6363
|
var normalizeNodes = (res, doc) => {
|
|
6063
6364
|
const items = Array.isArray(res) ? res : [res];
|
|
6064
6365
|
return items.map((it) => {
|
|
6065
|
-
if (it instanceof Node)
|
|
6066
|
-
return it;
|
|
6366
|
+
if (it instanceof Node) return it;
|
|
6067
6367
|
return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
|
|
6068
6368
|
});
|
|
6069
6369
|
};
|
|
6370
|
+
var applyToDom = (targetEl, res, pos, doc) => {
|
|
6371
|
+
if (!targetEl) return;
|
|
6372
|
+
if (pos === "innerHtml") {
|
|
6373
|
+
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
6374
|
+
return;
|
|
6375
|
+
}
|
|
6376
|
+
if (pos === "innerText") {
|
|
6377
|
+
if (targetEl.innerText !== void 0) {
|
|
6378
|
+
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
6379
|
+
}
|
|
6380
|
+
return;
|
|
6381
|
+
}
|
|
6382
|
+
const isShadowRoot = targetEl instanceof ShadowRoot;
|
|
6383
|
+
const nodes = normalizeNodes(res, doc);
|
|
6384
|
+
if (pos === "replace") {
|
|
6385
|
+
if (!isShadowRoot) targetEl.replaceWith(...nodes);
|
|
6386
|
+
} else if (pos === "replaceChildren") {
|
|
6387
|
+
targetEl.replaceChildren(...nodes);
|
|
6388
|
+
} else {
|
|
6389
|
+
if (pos === "beforeEnd") targetEl.append(...nodes);
|
|
6390
|
+
else if (pos === "afterBegin") targetEl.prepend(...nodes);
|
|
6391
|
+
else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
|
|
6392
|
+
else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
|
|
6393
|
+
}
|
|
6394
|
+
};
|
|
6070
6395
|
function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
6071
|
-
return (
|
|
6072
|
-
const constructor =
|
|
6396
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
6397
|
+
const constructor = targetObj.constructor;
|
|
6073
6398
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
|
|
6074
6399
|
if (!metaList) {
|
|
6075
6400
|
metaList = /* @__PURE__ */ new Map();
|
|
@@ -6077,94 +6402,58 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
|
6077
6402
|
}
|
|
6078
6403
|
metaList.set(propertyKey, { propertyKey, selector, options });
|
|
6079
6404
|
const original = descriptor.value;
|
|
6080
|
-
descriptor.value =
|
|
6405
|
+
descriptor.value = function(...args) {
|
|
6081
6406
|
ensureInit2(this);
|
|
6082
|
-
const
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
const pos = options.position || "beforeEnd";
|
|
6407
|
+
const conf = getElementConfig(this);
|
|
6408
|
+
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6409
|
+
const currentDoc = currentWin.document;
|
|
6410
|
+
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
6411
|
+
const getTarget = () => {
|
|
6088
6412
|
const r = options.root || "auto";
|
|
6089
6413
|
const applyRoot = (t) => {
|
|
6090
|
-
if (!t
|
|
6091
|
-
|
|
6092
|
-
if (r === "
|
|
6093
|
-
|
|
6094
|
-
if (r === "
|
|
6095
|
-
return t.shadowRoot;
|
|
6096
|
-
if (r === "light")
|
|
6097
|
-
return t;
|
|
6098
|
-
if (r === "all")
|
|
6099
|
-
return t.shadowRoot || t;
|
|
6414
|
+
if (!t) return t;
|
|
6415
|
+
if (r === "auto") return t.shadowRoot || t;
|
|
6416
|
+
if (r === "shadow") return t.shadowRoot;
|
|
6417
|
+
if (r === "light") return t;
|
|
6418
|
+
if (r === "all") return t.shadowRoot || t;
|
|
6100
6419
|
return t;
|
|
6101
6420
|
};
|
|
6102
|
-
|
|
6103
|
-
if (
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
}
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
} else if (selector === ":parentHost") {
|
|
6124
|
-
targetEl = applyRoot(hostSet.$parentHost);
|
|
6125
|
-
} else if (selector === ":appHost") {
|
|
6126
|
-
targetEl = applyRoot(hostSet.$appHost);
|
|
6127
|
-
} else if (selector === ":firstHost") {
|
|
6128
|
-
targetEl = applyRoot(hostSet.$firstHost);
|
|
6129
|
-
} else if (selector === ":lastHost") {
|
|
6130
|
-
targetEl = applyRoot(hostSet.$lastHost);
|
|
6131
|
-
} else if (selector === ":firstAppHost") {
|
|
6132
|
-
targetEl = applyRoot(hostSet.$firstHost);
|
|
6133
|
-
} else if (selector === ":lastAppHost") {
|
|
6134
|
-
targetEl = applyRoot(hostSet.$lastAppHost);
|
|
6135
|
-
} else {
|
|
6136
|
-
const targetRoot = applyRoot(this);
|
|
6137
|
-
targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6138
|
-
}
|
|
6139
|
-
if (targetEl) {
|
|
6140
|
-
const isShadowRoot = targetEl instanceof ShadowRoot;
|
|
6141
|
-
const nodes = normalizeNodes(res, currentDoc);
|
|
6142
|
-
if (pos === "replace") {
|
|
6143
|
-
if (!isShadowRoot) {
|
|
6144
|
-
targetEl.replaceWith(...nodes);
|
|
6145
|
-
}
|
|
6146
|
-
} else if (pos === "replaceChildren") {
|
|
6147
|
-
targetEl.replaceChildren(...nodes);
|
|
6148
|
-
} else if (pos === "innerHtml") {
|
|
6149
|
-
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
6150
|
-
} else if (pos === "innerText") {
|
|
6151
|
-
if (targetEl.innerText !== void 0) {
|
|
6152
|
-
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
6153
|
-
}
|
|
6154
|
-
} else {
|
|
6155
|
-
if (pos === "beforeEnd")
|
|
6156
|
-
targetEl.append(...nodes);
|
|
6157
|
-
else if (pos === "afterBegin")
|
|
6158
|
-
targetEl.prepend(...nodes);
|
|
6159
|
-
else if (pos === "beforeBegin" && !isShadowRoot)
|
|
6160
|
-
targetEl.before(...nodes);
|
|
6161
|
-
else if (pos === "afterEnd" && !isShadowRoot)
|
|
6162
|
-
targetEl.after(...nodes);
|
|
6163
|
-
}
|
|
6164
|
-
}
|
|
6421
|
+
if (selector === ":host") return applyRoot(this);
|
|
6422
|
+
if (selector === ":parentHost") return applyRoot(hostSet.$parentHost);
|
|
6423
|
+
if (selector === ":appHost") return applyRoot(hostSet.$appHost);
|
|
6424
|
+
if (selector === ":firstHost") return applyRoot(hostSet.$firstHost);
|
|
6425
|
+
if (selector === ":lastHost") return applyRoot(hostSet.$lastHost);
|
|
6426
|
+
const targetRoot = applyRoot(this);
|
|
6427
|
+
return targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6428
|
+
};
|
|
6429
|
+
const targetEl = getTarget();
|
|
6430
|
+
const res = original.apply(this, args);
|
|
6431
|
+
const runApply = (target, val) => {
|
|
6432
|
+
const pos = options.position || "beforeEnd";
|
|
6433
|
+
const defaultFilter = (t, v) => {
|
|
6434
|
+
if (v instanceof Node) return !t.contains(v);
|
|
6435
|
+
if (pos === "innerHtml" && typeof v === "string") return t.innerHTML !== v;
|
|
6436
|
+
if (pos === "replaceChildren" && v instanceof Node) return !t.contains(v);
|
|
6437
|
+
return true;
|
|
6438
|
+
};
|
|
6439
|
+
const activeFilter = options.filter || defaultFilter;
|
|
6440
|
+
if (activeFilter(target, val, hostSet)) {
|
|
6441
|
+
applyToDom(target, val, pos, currentDoc);
|
|
6165
6442
|
}
|
|
6443
|
+
};
|
|
6444
|
+
if (res instanceof Promise) {
|
|
6445
|
+
if (targetEl && options.loading) {
|
|
6446
|
+
const loadingRes = options.loading.call(this, hostSet);
|
|
6447
|
+
applyToDom(targetEl, loadingRes, options.position || "beforeEnd", currentDoc);
|
|
6448
|
+
}
|
|
6449
|
+
return res.then((finalRes) => {
|
|
6450
|
+
if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
|
|
6451
|
+
return finalRes;
|
|
6452
|
+
});
|
|
6453
|
+
} else {
|
|
6454
|
+
if (res !== void 0 && targetEl) runApply(targetEl, res);
|
|
6455
|
+
return res;
|
|
6166
6456
|
}
|
|
6167
|
-
return res;
|
|
6168
6457
|
};
|
|
6169
6458
|
};
|
|
6170
6459
|
}
|
|
@@ -6179,110 +6468,29 @@ var findAllApplyNodeMetadata = (target) => {
|
|
|
6179
6468
|
return result;
|
|
6180
6469
|
};
|
|
6181
6470
|
function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
}
|
|
6186
|
-
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6187
|
-
const options = targetOrOptions;
|
|
6188
|
-
return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
|
|
6189
|
-
} else {
|
|
6190
|
-
return applyNode(":host", { position: "beforeEnd" });
|
|
6191
|
-
}
|
|
6192
|
-
}
|
|
6193
|
-
function applyBeforeBeginNode(selector, options) {
|
|
6194
|
-
return applyNode(selector, { ...options, position: "beforeBegin" });
|
|
6195
|
-
}
|
|
6196
|
-
function applyAfterBeginNode(selector, options) {
|
|
6197
|
-
return applyNode(selector, { ...options, position: "afterBegin" });
|
|
6471
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
|
|
6472
|
+
const opt = targetOrOptions || {};
|
|
6473
|
+
return applyNode(":host", { position: "beforeEnd", ...opt });
|
|
6198
6474
|
}
|
|
6199
|
-
function
|
|
6200
|
-
return applyNode(
|
|
6475
|
+
function applyReplaceChildrenNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6476
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
|
|
6477
|
+
const opt = targetOrOptions || {};
|
|
6478
|
+
return applyNode(":host", { position: "replaceChildren", ...opt });
|
|
6201
6479
|
}
|
|
6202
|
-
function
|
|
6203
|
-
return applyNode(
|
|
6480
|
+
function applyInnerHtmlNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6481
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
|
|
6482
|
+
const opt = targetOrOptions || {};
|
|
6483
|
+
return applyNode(":host", { position: "innerHtml", ...opt });
|
|
6204
6484
|
}
|
|
6205
|
-
function
|
|
6206
|
-
return applyNode(selector, { ...options, position: "replace" });
|
|
6207
|
-
}
|
|
6208
|
-
function applyReplaceChildrenNode(selector, options) {
|
|
6485
|
+
function applyReplaceChildrenNode(selector, options = {}) {
|
|
6209
6486
|
return applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6210
6487
|
}
|
|
6211
|
-
function applyInnerHtmlNode(selector, options) {
|
|
6488
|
+
function applyInnerHtmlNode(selector, options = {}) {
|
|
6212
6489
|
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
6213
6490
|
}
|
|
6214
|
-
function applyInnerTextNode(selector, options) {
|
|
6215
|
-
return applyNode(selector, { ...options, position: "innerText" });
|
|
6216
|
-
}
|
|
6217
|
-
function applyRemoveNode(selector, options) {
|
|
6218
|
-
return applyNode(selector, { ...options, position: "remove" });
|
|
6219
|
-
}
|
|
6220
|
-
function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6221
|
-
if (propertyKey !== void 0) {
|
|
6222
|
-
const decorator = applyNode(":host", { position: "beforeBegin" });
|
|
6223
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6224
|
-
}
|
|
6225
|
-
return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
|
|
6226
|
-
}
|
|
6227
|
-
function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6228
|
-
if (propertyKey !== void 0) {
|
|
6229
|
-
const decorator = applyNode(":host", { position: "afterBegin" });
|
|
6230
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6231
|
-
}
|
|
6232
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
|
|
6233
|
-
}
|
|
6234
|
-
function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6235
|
-
if (propertyKey !== void 0) {
|
|
6236
|
-
const decorator = applyNode(":host", { position: "beforeEnd" });
|
|
6237
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6238
|
-
}
|
|
6239
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
|
|
6240
|
-
}
|
|
6241
|
-
function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6242
|
-
if (propertyKey !== void 0) {
|
|
6243
|
-
const decorator = applyNode(":host", { position: "afterEnd" });
|
|
6244
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6245
|
-
}
|
|
6246
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
|
|
6247
|
-
}
|
|
6248
|
-
function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6249
|
-
if (propertyKey !== void 0) {
|
|
6250
|
-
const decorator = applyNode(":host", { position: "replace" });
|
|
6251
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6252
|
-
}
|
|
6253
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
|
|
6254
|
-
}
|
|
6255
|
-
function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6256
|
-
if (propertyKey !== void 0) {
|
|
6257
|
-
const decorator = applyNode(":host", { position: "replaceChildren" });
|
|
6258
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6259
|
-
}
|
|
6260
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
|
|
6261
|
-
}
|
|
6262
|
-
function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6263
|
-
if (propertyKey !== void 0) {
|
|
6264
|
-
const decorator = applyNode(":host", { position: "innerHtml" });
|
|
6265
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6266
|
-
}
|
|
6267
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
|
|
6268
|
-
}
|
|
6269
|
-
function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6270
|
-
if (propertyKey !== void 0) {
|
|
6271
|
-
const decorator = applyNode(":host", { position: "innerText" });
|
|
6272
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6273
|
-
}
|
|
6274
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
|
|
6275
|
-
}
|
|
6276
|
-
function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6277
|
-
if (propertyKey !== void 0) {
|
|
6278
|
-
const decorator = applyNode(":host", { position: "remove" });
|
|
6279
|
-
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6280
|
-
}
|
|
6281
|
-
return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
|
|
6282
|
-
}
|
|
6283
6491
|
|
|
6284
6492
|
// src/decorators/query.ts
|
|
6285
|
-
var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
|
|
6493
|
+
var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
6286
6494
|
function query(selectorOrTarget, options = {}) {
|
|
6287
6495
|
return (targetObj, propertyKey, descriptor) => {
|
|
6288
6496
|
if (descriptor !== void 0) {
|
|
@@ -6453,7 +6661,7 @@ function lastAppHost(targetOrOptions, propertyKey) {
|
|
|
6453
6661
|
}
|
|
6454
6662
|
|
|
6455
6663
|
// src/decorators/queryAll.ts
|
|
6456
|
-
var QUERY_ALL_METADATA_KEY = Symbol("simple-web-component:query-all");
|
|
6664
|
+
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
6457
6665
|
function queryAll(selectorOrTarget, options = {}) {
|
|
6458
6666
|
return (targetObj, propertyKey, descriptor) => {
|
|
6459
6667
|
if (descriptor !== void 0) {
|
|
@@ -6620,35 +6828,38 @@ function allLastAppHost(targetOrOptions, propertyKey) {
|
|
|
6620
6828
|
}
|
|
6621
6829
|
}
|
|
6622
6830
|
|
|
6623
|
-
// src/decorators/
|
|
6624
|
-
var
|
|
6625
|
-
function
|
|
6626
|
-
return (selector, options = {}) => {
|
|
6831
|
+
// src/decorators/applyClass.ts
|
|
6832
|
+
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
6833
|
+
function createClassDecorator(action) {
|
|
6834
|
+
return (selector, classMapOrOptions, options = {}) => {
|
|
6627
6835
|
return (target, propertyKey, descriptor) => {
|
|
6628
6836
|
const constructor = target.constructor;
|
|
6629
|
-
let metaList = ReflectUtils.getOwnMetadata(
|
|
6837
|
+
let metaList = ReflectUtils.getOwnMetadata(CLASS_METADATA_KEY, constructor);
|
|
6630
6838
|
if (!metaList) {
|
|
6631
6839
|
metaList = /* @__PURE__ */ new Map();
|
|
6632
|
-
ReflectUtils.defineMetadata(
|
|
6840
|
+
ReflectUtils.defineMetadata(CLASS_METADATA_KEY, metaList, constructor);
|
|
6633
6841
|
}
|
|
6634
|
-
|
|
6842
|
+
let classMap = void 0;
|
|
6843
|
+
let finalOptions = options;
|
|
6844
|
+
if (typeof classMapOrOptions === "string" || typeof classMapOrOptions === "object" && classMapOrOptions !== null && !("root" in classMapOrOptions)) {
|
|
6845
|
+
classMap = classMapOrOptions;
|
|
6846
|
+
} else if (typeof classMapOrOptions === "object" && classMapOrOptions !== null && "root" in classMapOrOptions) {
|
|
6847
|
+
finalOptions = classMapOrOptions;
|
|
6848
|
+
}
|
|
6849
|
+
metaList.set(propertyKey, { propertyKey, selector, action, options: finalOptions });
|
|
6635
6850
|
const original = descriptor.value;
|
|
6636
6851
|
descriptor.value = async function(...args) {
|
|
6637
6852
|
ensureInit2(this);
|
|
6638
6853
|
const res = await original.apply(this, args);
|
|
6639
6854
|
if (res !== void 0) {
|
|
6640
|
-
const
|
|
6641
|
-
const
|
|
6855
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
6856
|
+
const host2 = this;
|
|
6857
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
6858
|
+
const r = finalOptions.root || "auto";
|
|
6642
6859
|
const targetEls = [];
|
|
6643
6860
|
const applyRoot = (t) => {
|
|
6644
|
-
if (!t || !(t instanceof HTMLElement)) return;
|
|
6645
|
-
|
|
6646
|
-
targetEls.push(t);
|
|
6647
|
-
} else {
|
|
6648
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
6649
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6650
|
-
}
|
|
6651
|
-
}
|
|
6861
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
6862
|
+
targetEls.push(t);
|
|
6652
6863
|
};
|
|
6653
6864
|
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6654
6865
|
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
@@ -6658,102 +6869,84 @@ function createClassListDecorator(action) {
|
|
|
6658
6869
|
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6659
6870
|
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6660
6871
|
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6661
|
-
else if (selector === ":host" || !selector) applyRoot(
|
|
6872
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
6662
6873
|
else {
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
} else if (r === "light") {
|
|
6667
|
-
const found = this.querySelectorAll(selector);
|
|
6668
|
-
if (found) targetEls.push(...Array.from(found));
|
|
6669
|
-
} else if (r === "all") {
|
|
6670
|
-
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6671
|
-
const lFound = this.querySelectorAll(selector);
|
|
6672
|
-
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6673
|
-
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6674
|
-
} else {
|
|
6675
|
-
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6874
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
6875
|
+
if (targetRoot) {
|
|
6876
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
6676
6877
|
if (found) targetEls.push(...Array.from(found));
|
|
6677
6878
|
}
|
|
6678
6879
|
}
|
|
6679
6880
|
targetEls.forEach((targetEl) => {
|
|
6881
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
6680
6882
|
if (action === "set") {
|
|
6681
6883
|
let classes = "";
|
|
6682
|
-
if (typeof
|
|
6683
|
-
classes =
|
|
6884
|
+
if (classMap && typeof classMap === "string") {
|
|
6885
|
+
classes = resolvedRes ? classMap : "";
|
|
6886
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
6887
|
+
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
|
|
6684
6888
|
} else {
|
|
6685
|
-
classes = Array.isArray(
|
|
6889
|
+
classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
|
|
6686
6890
|
}
|
|
6687
6891
|
targetEl.className = classes;
|
|
6688
|
-
} else if (action === "update") {
|
|
6689
|
-
if (typeof
|
|
6690
|
-
|
|
6691
|
-
|
|
6892
|
+
} else if (action === "update" || action === "toggle") {
|
|
6893
|
+
if (classMap && typeof classMap === "string") {
|
|
6894
|
+
targetEl.classList.toggle(classMap, !!resolvedRes);
|
|
6895
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
6896
|
+
Object.entries(resolvedRes).forEach(([cls, force]) => {
|
|
6897
|
+
const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
6898
|
+
targetEl.classList.toggle(cls, isActive);
|
|
6692
6899
|
});
|
|
6693
|
-
} else
|
|
6694
|
-
const classes = Array.isArray(
|
|
6695
|
-
targetEl.classList.add(...classes);
|
|
6900
|
+
} else {
|
|
6901
|
+
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
6902
|
+
if (action === "update") targetEl.classList.add(...classes);
|
|
6903
|
+
else classes.forEach((c) => targetEl.classList.toggle(c));
|
|
6696
6904
|
}
|
|
6697
|
-
} else if (action === "add") {
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6905
|
+
} else if (action === "add" || action === "remove") {
|
|
6906
|
+
if (classMap && typeof classMap === "string" && !!resolvedRes) {
|
|
6907
|
+
if (action === "add") targetEl.classList.add(classMap);
|
|
6908
|
+
else targetEl.classList.remove(classMap);
|
|
6909
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
6910
|
+
Object.entries(resolvedRes).forEach(([cls, force]) => {
|
|
6911
|
+
const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
6912
|
+
if (shouldExecute) {
|
|
6913
|
+
if (action === "add") targetEl.classList.add(cls);
|
|
6914
|
+
else targetEl.classList.remove(cls);
|
|
6915
|
+
}
|
|
6916
|
+
});
|
|
6917
|
+
} else {
|
|
6918
|
+
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
6919
|
+
if (action === "add") targetEl.classList.add(...classes);
|
|
6920
|
+
else targetEl.classList.remove(...classes);
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
});
|
|
6708
6924
|
}
|
|
6709
6925
|
return res;
|
|
6710
6926
|
};
|
|
6927
|
+
return descriptor;
|
|
6711
6928
|
};
|
|
6712
6929
|
};
|
|
6713
6930
|
}
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
|
|
6717
|
-
var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
|
|
6718
|
-
var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
|
|
6719
|
-
function setClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6720
|
-
if (propertyKey !== void 0) {
|
|
6721
|
-
const decorator = createClassListDecorator("set")(":host", {});
|
|
6722
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6723
|
-
}
|
|
6724
|
-
return createClassListDecorator("set")(":host", targetOrOptions || {});
|
|
6725
|
-
}
|
|
6726
|
-
function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6727
|
-
if (propertyKey !== void 0) {
|
|
6728
|
-
const decorator = createClassListDecorator("update")(":host", {});
|
|
6729
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6730
|
-
}
|
|
6731
|
-
return createClassListDecorator("update")(":host", targetOrOptions || {});
|
|
6732
|
-
}
|
|
6733
|
-
function addClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6734
|
-
if (propertyKey !== void 0) {
|
|
6735
|
-
const decorator = createClassListDecorator("add")(":host", {});
|
|
6736
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6737
|
-
}
|
|
6738
|
-
return createClassListDecorator("add")(":host", targetOrOptions || {});
|
|
6739
|
-
}
|
|
6740
|
-
function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6741
|
-
if (propertyKey !== void 0) {
|
|
6742
|
-
const decorator = createClassListDecorator("remove")(":host", {});
|
|
6743
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6744
|
-
}
|
|
6745
|
-
return createClassListDecorator("remove")(":host", targetOrOptions || {});
|
|
6931
|
+
function applyClass(selector, action = "update", options = {}) {
|
|
6932
|
+
return createClassDecorator(action)(selector, options);
|
|
6746
6933
|
}
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6934
|
+
var setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
|
|
6935
|
+
var updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
|
|
6936
|
+
var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
|
|
6937
|
+
var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
|
|
6938
|
+
var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
|
|
6939
|
+
function applyClassHost(action = "update", options = {}) {
|
|
6940
|
+
return createClassDecorator(action)(":host", options);
|
|
6753
6941
|
}
|
|
6754
|
-
var
|
|
6942
|
+
var setClassHost = (classMapOrOptions, options = {}) => createClassDecorator("set")(":host", classMapOrOptions, options);
|
|
6943
|
+
var updateClassHost = (classMapOrOptions, options = {}) => createClassDecorator("update")(":host", classMapOrOptions, options);
|
|
6944
|
+
var addClassHost = (classMapOrOptions, options = {}) => createClassDecorator("add")(":host", classMapOrOptions, options);
|
|
6945
|
+
var removeClassHost = (classMapOrOptions, options = {}) => createClassDecorator("remove")(":host", classMapOrOptions, options);
|
|
6946
|
+
var toggleClassHost = (classMapOrOptions, options = {}) => createClassDecorator("toggle")(":host", classMapOrOptions, options);
|
|
6947
|
+
var findAllClassMetadata = (target) => {
|
|
6755
6948
|
const result = /* @__PURE__ */ new Map();
|
|
6756
|
-
const maps = ReflectUtils.findAllMetadata(
|
|
6949
|
+
const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
|
|
6757
6950
|
maps.forEach((map) => {
|
|
6758
6951
|
if (map instanceof Map) {
|
|
6759
6952
|
map.forEach((v, k) => result.set(k, v));
|
|
@@ -6762,8 +6955,8 @@ var findAllClassListMetadata = (target) => {
|
|
|
6762
6955
|
return result;
|
|
6763
6956
|
};
|
|
6764
6957
|
|
|
6765
|
-
// src/decorators/
|
|
6766
|
-
var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
|
|
6958
|
+
// src/decorators/applyStyle.ts
|
|
6959
|
+
var STYLE_METADATA_KEY = Symbol.for("simple-web-component:style");
|
|
6767
6960
|
function createStyleDecorator(action) {
|
|
6768
6961
|
return (selector, options = {}) => {
|
|
6769
6962
|
return (target, propertyKey, descriptor) => {
|
|
@@ -6779,18 +6972,14 @@ function createStyleDecorator(action) {
|
|
|
6779
6972
|
ensureInit2(this);
|
|
6780
6973
|
const res = await original.apply(this, args);
|
|
6781
6974
|
if (res !== void 0) {
|
|
6975
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
6976
|
+
const host2 = this;
|
|
6977
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
6782
6978
|
const r = options.root || "auto";
|
|
6783
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
6784
6979
|
const targetEls = [];
|
|
6785
6980
|
const applyRoot = (t) => {
|
|
6786
|
-
if (!t || !(t instanceof HTMLElement)) return;
|
|
6787
|
-
|
|
6788
|
-
targetEls.push(t);
|
|
6789
|
-
} else {
|
|
6790
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
6791
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6792
|
-
}
|
|
6793
|
-
}
|
|
6981
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
6982
|
+
targetEls.push(t);
|
|
6794
6983
|
};
|
|
6795
6984
|
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6796
6985
|
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
@@ -6800,71 +6989,63 @@ function createStyleDecorator(action) {
|
|
|
6800
6989
|
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6801
6990
|
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6802
6991
|
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6803
|
-
else if (selector === ":host" || !selector) applyRoot(
|
|
6992
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
6804
6993
|
else {
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
} else if (r === "light") {
|
|
6809
|
-
const found = this.querySelectorAll(selector);
|
|
6810
|
-
if (found) targetEls.push(...Array.from(found));
|
|
6811
|
-
} else if (r === "all") {
|
|
6812
|
-
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6813
|
-
const lFound = this.querySelectorAll(selector);
|
|
6814
|
-
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6815
|
-
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6816
|
-
} else {
|
|
6817
|
-
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6994
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
6995
|
+
if (targetRoot) {
|
|
6996
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
6818
6997
|
if (found) targetEls.push(...Array.from(found));
|
|
6819
6998
|
}
|
|
6820
6999
|
}
|
|
6821
7000
|
targetEls.forEach((targetEl) => {
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
if (
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
7001
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
7002
|
+
if (action === "set" || action === "update") {
|
|
7003
|
+
if (action === "set") targetEl.style.cssText = "";
|
|
7004
|
+
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7005
|
+
Object.entries(resolvedRes).forEach(([prop, val]) => {
|
|
7006
|
+
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
7007
|
+
if (finalVal === null || finalVal === void 0) {
|
|
7008
|
+
targetEl.style.removeProperty(prop);
|
|
7009
|
+
} else {
|
|
7010
|
+
targetEl.style[prop] = String(finalVal);
|
|
7011
|
+
}
|
|
7012
|
+
});
|
|
7013
|
+
} else if (typeof resolvedRes === "string") {
|
|
7014
|
+
targetEl.style.cssText = resolvedRes;
|
|
6832
7015
|
}
|
|
6833
7016
|
} else if (action === "remove") {
|
|
6834
|
-
|
|
6835
|
-
|
|
7017
|
+
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7018
|
+
Object.entries(resolvedRes).forEach(([prop, val]) => {
|
|
7019
|
+
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
7020
|
+
if (shouldRemove) {
|
|
7021
|
+
targetEl.style.removeProperty(prop);
|
|
7022
|
+
}
|
|
7023
|
+
});
|
|
7024
|
+
} else {
|
|
7025
|
+
const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
|
|
7026
|
+
props.forEach((p) => targetEl.style.removeProperty(String(p)));
|
|
7027
|
+
}
|
|
6836
7028
|
}
|
|
6837
7029
|
});
|
|
6838
7030
|
}
|
|
6839
7031
|
return res;
|
|
6840
7032
|
};
|
|
7033
|
+
return descriptor;
|
|
6841
7034
|
};
|
|
6842
7035
|
};
|
|
6843
7036
|
}
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
if (propertyKey !== void 0) {
|
|
6847
|
-
const decorator = createStyleDecorator("set")(":host", {});
|
|
6848
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6849
|
-
}
|
|
6850
|
-
return createStyleDecorator("set")(":host", targetOrOptions || {});
|
|
7037
|
+
function applyStyle(selector, action = "update", options = {}) {
|
|
7038
|
+
return createStyleDecorator(action)(selector, options);
|
|
6851
7039
|
}
|
|
7040
|
+
var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
|
|
6852
7041
|
var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
|
|
6853
|
-
function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6854
|
-
if (propertyKey !== void 0) {
|
|
6855
|
-
const decorator = createStyleDecorator("update")(":host", {});
|
|
6856
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6857
|
-
}
|
|
6858
|
-
return createStyleDecorator("update")(":host", targetOrOptions || {});
|
|
6859
|
-
}
|
|
6860
7042
|
var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
|
|
6861
|
-
function
|
|
6862
|
-
|
|
6863
|
-
const decorator = createStyleDecorator("remove")(":host", {});
|
|
6864
|
-
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6865
|
-
}
|
|
6866
|
-
return createStyleDecorator("remove")(":host", targetOrOptions || {});
|
|
7043
|
+
function applyStyleHost(action = "update", options = {}) {
|
|
7044
|
+
return createStyleDecorator(action)(":host", options);
|
|
6867
7045
|
}
|
|
7046
|
+
var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
|
|
7047
|
+
var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
|
|
7048
|
+
var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
|
|
6868
7049
|
var findAllStyleMetadata = (target) => {
|
|
6869
7050
|
const result = /* @__PURE__ */ new Map();
|
|
6870
7051
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -6876,8 +7057,123 @@ var findAllStyleMetadata = (target) => {
|
|
|
6876
7057
|
return result;
|
|
6877
7058
|
};
|
|
6878
7059
|
|
|
7060
|
+
// src/decorators/applyAttribute.ts
|
|
7061
|
+
var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
|
|
7062
|
+
function createAttributeDecorator(action) {
|
|
7063
|
+
return (selector, nameOrOptions, options = {}) => {
|
|
7064
|
+
return (target, propertyKey, descriptor) => {
|
|
7065
|
+
const constructor = target.constructor;
|
|
7066
|
+
let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
|
|
7067
|
+
if (!metaList) {
|
|
7068
|
+
metaList = /* @__PURE__ */ new Map();
|
|
7069
|
+
ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
|
|
7070
|
+
}
|
|
7071
|
+
let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
|
|
7072
|
+
let finalOptions = options;
|
|
7073
|
+
if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
|
|
7074
|
+
finalOptions = nameOrOptions;
|
|
7075
|
+
}
|
|
7076
|
+
metaList.set(propertyKey, {
|
|
7077
|
+
propertyKey,
|
|
7078
|
+
selector,
|
|
7079
|
+
action,
|
|
7080
|
+
options: { ...finalOptions, name: attributeName }
|
|
7081
|
+
});
|
|
7082
|
+
const original = descriptor.value;
|
|
7083
|
+
descriptor.value = async function(...args) {
|
|
7084
|
+
ensureInit2(this);
|
|
7085
|
+
const res = await original.apply(this, args);
|
|
7086
|
+
if (res !== void 0) {
|
|
7087
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
7088
|
+
const host2 = this;
|
|
7089
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
7090
|
+
const r = finalOptions.root || "auto";
|
|
7091
|
+
const targetEls = [];
|
|
7092
|
+
const applyRoot = (t) => {
|
|
7093
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
7094
|
+
targetEls.push(t);
|
|
7095
|
+
};
|
|
7096
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
7097
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
7098
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
7099
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
7100
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
7101
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
7102
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
7103
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
7104
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
7105
|
+
else {
|
|
7106
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
7107
|
+
if (targetRoot) {
|
|
7108
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
7109
|
+
if (found) targetEls.push(...Array.from(found));
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
targetEls.forEach((targetEl) => {
|
|
7113
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
7114
|
+
if (action === "set" || action === "update") {
|
|
7115
|
+
if (attributeName) {
|
|
7116
|
+
if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
|
|
7117
|
+
targetEl.removeAttribute(attributeName);
|
|
7118
|
+
} else {
|
|
7119
|
+
targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
|
|
7120
|
+
}
|
|
7121
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7122
|
+
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
7123
|
+
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
7124
|
+
if (finalVal === null || finalVal === void 0 || finalVal === false) {
|
|
7125
|
+
targetEl.removeAttribute(attr);
|
|
7126
|
+
} else {
|
|
7127
|
+
targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
|
|
7128
|
+
}
|
|
7129
|
+
});
|
|
7130
|
+
}
|
|
7131
|
+
} else if (action === "remove") {
|
|
7132
|
+
if (attributeName) {
|
|
7133
|
+
targetEl.removeAttribute(attributeName);
|
|
7134
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7135
|
+
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
7136
|
+
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
7137
|
+
if (shouldRemove) targetEl.removeAttribute(attr);
|
|
7138
|
+
});
|
|
7139
|
+
} else {
|
|
7140
|
+
const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
|
|
7141
|
+
attrs.forEach((a) => targetEl.removeAttribute(String(a)));
|
|
7142
|
+
}
|
|
7143
|
+
}
|
|
7144
|
+
});
|
|
7145
|
+
}
|
|
7146
|
+
return res;
|
|
7147
|
+
};
|
|
7148
|
+
return descriptor;
|
|
7149
|
+
};
|
|
7150
|
+
};
|
|
7151
|
+
}
|
|
7152
|
+
function applyAttribute(selector, action = "update", options = {}) {
|
|
7153
|
+
return createAttributeDecorator(action)(selector, options);
|
|
7154
|
+
}
|
|
7155
|
+
var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
|
|
7156
|
+
var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
|
|
7157
|
+
var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
|
|
7158
|
+
function applyAttributeHost(action = "update", options = {}) {
|
|
7159
|
+
return createAttributeDecorator(action)(":host", options);
|
|
7160
|
+
}
|
|
7161
|
+
var setAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("set")(":host", nameOrOptions, options);
|
|
7162
|
+
var updateAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("update")(":host", nameOrOptions, options);
|
|
7163
|
+
var removeAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("remove")(":host", nameOrOptions, options);
|
|
7164
|
+
var findAllAttributeApplyMetadata = (target) => {
|
|
7165
|
+
const result = /* @__PURE__ */ new Map();
|
|
7166
|
+
const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
|
|
7167
|
+
maps.forEach((map) => {
|
|
7168
|
+
if (map instanceof Map) {
|
|
7169
|
+
map.forEach((v, k) => result.set(k, v));
|
|
7170
|
+
}
|
|
7171
|
+
});
|
|
7172
|
+
return result;
|
|
7173
|
+
};
|
|
7174
|
+
|
|
6879
7175
|
// src/utils/Utils.ts
|
|
6880
|
-
var SWC_NOT_FOUND = Symbol("
|
|
7176
|
+
var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
|
|
6881
7177
|
var htmlFragment = (html, doc) => {
|
|
6882
7178
|
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
6883
7179
|
if (!d) throw new Error("Document is not available");
|
|
@@ -7114,7 +7410,7 @@ var SwcUtils;
|
|
|
7114
7410
|
})(SwcUtils || (SwcUtils = {}));
|
|
7115
7411
|
|
|
7116
7412
|
// src/decorators/emitCustomEvent.ts
|
|
7117
|
-
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol("simple-web-component:emit-custom-event");
|
|
7413
|
+
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
|
|
7118
7414
|
function emitCustomEvent(selectorOrTarget, type, options = {}) {
|
|
7119
7415
|
return (targetObj, propertyKey, descriptor) => {
|
|
7120
7416
|
const constructor = targetObj.constructor;
|
|
@@ -7183,7 +7479,10 @@ var getEmitCustomEventMetadataList = (target) => {
|
|
|
7183
7479
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
7184
7480
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
7185
7481
|
};
|
|
7186
|
-
function emitCustomEventHost(type, options) {
|
|
7482
|
+
function emitCustomEventHost(type, options = {}) {
|
|
7483
|
+
if (!options.attributeName) {
|
|
7484
|
+
options.attributeName = `on-emit-${type}`;
|
|
7485
|
+
}
|
|
7187
7486
|
return emitCustomEvent(":host", type, options);
|
|
7188
7487
|
}
|
|
7189
7488
|
|
|
@@ -7275,7 +7574,46 @@ var SituationTypeContainers = class {
|
|
|
7275
7574
|
return this.containers.find(predicate);
|
|
7276
7575
|
}
|
|
7277
7576
|
};
|
|
7278
|
-
var
|
|
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
|
+
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
|
+
};
|
|
7279
7617
|
|
|
7280
7618
|
// src/types.ts
|
|
7281
7619
|
var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
@@ -7293,7 +7631,7 @@ var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
|
7293
7631
|
})(InjectSituationType || {});
|
|
7294
7632
|
|
|
7295
7633
|
// src/decorators/elementDefine.ts
|
|
7296
|
-
var ELEMENT_CONFIG_KEY = Symbol("simple-web-component:element-config");
|
|
7634
|
+
var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
|
|
7297
7635
|
var getElementConfig = (target) => {
|
|
7298
7636
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
7299
7637
|
return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
|
|
@@ -7408,7 +7746,6 @@ var setupPrototype = (proto) => {
|
|
|
7408
7746
|
const oldHandler = handlers.get(attrName);
|
|
7409
7747
|
if (oldHandler) el.removeEventListener(eventName, oldHandler);
|
|
7410
7748
|
const handler = async (event) => {
|
|
7411
|
-
console.log("execute handler", event);
|
|
7412
7749
|
const parent = SwcUtils.findNearestSwcHost(el);
|
|
7413
7750
|
const hostSet = SwcUtils.getHostSet(parent || el);
|
|
7414
7751
|
const conf = getElementConfig(this);
|
|
@@ -7429,7 +7766,6 @@ var setupPrototype = (proto) => {
|
|
|
7429
7766
|
};
|
|
7430
7767
|
proto.__swc_executeAttributeEvent = async function(el, attrName, script, event) {
|
|
7431
7768
|
ensureInit2(this);
|
|
7432
|
-
console.log("execute handler2", event);
|
|
7433
7769
|
const parent = SwcUtils.findNearestSwcHost(el);
|
|
7434
7770
|
const hostSet = SwcUtils.getHostSet(parent || el);
|
|
7435
7771
|
const conf = getElementConfig(this);
|
|
@@ -7469,12 +7805,22 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7469
7805
|
const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
|
|
7470
7806
|
const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === ":host" || meta.selector === "");
|
|
7471
7807
|
const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
|
|
7472
|
-
const addHostEventListenerList = addEventListenerList.filter((meta) => meta.selector === ":host" || meta.selector === "");
|
|
7473
7808
|
const attrChangeMap = findAllAttributeChangedMetadata(constructor);
|
|
7474
7809
|
const attributeList = findAllAttributeMetadata(constructor);
|
|
7810
|
+
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
7475
7811
|
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"];
|
|
7476
7812
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
7477
|
-
const
|
|
7813
|
+
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));
|
|
7815
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
|
|
7816
|
+
...metadata.observedAttributes ?? [],
|
|
7817
|
+
...attrChangeMap.keys(),
|
|
7818
|
+
...attributeApplyNames,
|
|
7819
|
+
...attributeListNames,
|
|
7820
|
+
...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
|
|
7821
|
+
...swcLifecycleAttributes,
|
|
7822
|
+
...swcOnEvents
|
|
7823
|
+
])];
|
|
7478
7824
|
const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
|
|
7479
7825
|
const proto = constructor.prototype;
|
|
7480
7826
|
setupPrototype(proto);
|
|
@@ -7493,7 +7839,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7493
7839
|
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
7494
7840
|
}
|
|
7495
7841
|
attributeList.forEach((meta) => {
|
|
7496
|
-
const attrName = meta.options.name || String(meta.propertyKey);
|
|
7497
7842
|
if (meta.options.connectedInitialize === true) {
|
|
7498
7843
|
this.__swc_syncing_init = true;
|
|
7499
7844
|
try {
|
|
@@ -7633,22 +7978,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7633
7978
|
}
|
|
7634
7979
|
});
|
|
7635
7980
|
});
|
|
7636
|
-
addHostEventListenerList.forEach((meta) => {
|
|
7637
|
-
const { type, options } = meta;
|
|
7638
|
-
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
7639
|
-
const handler = async (event) => {
|
|
7640
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
7641
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
7642
|
-
if (options.preventDefault) event.preventDefault();
|
|
7643
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
7644
|
-
const args = { event, ...currentHostSet, $el: this, $root: this.getRootNode() };
|
|
7645
|
-
await this[meta.propertyKey](event, currentHostSet, args);
|
|
7646
|
-
};
|
|
7647
|
-
this.addEventListener(type, handler, opts);
|
|
7648
|
-
if (options.removeOnDisconnected === true) {
|
|
7649
|
-
this._boundListeners.push({ target: this, type, handler, options: opts });
|
|
7650
|
-
}
|
|
7651
|
-
});
|
|
7652
7981
|
if (originalConnected) originalConnected.apply(this);
|
|
7653
7982
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
|
|
7654
7983
|
if (aMethods) {
|
|
@@ -7726,104 +8055,1692 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7726
8055
|
return constructor;
|
|
7727
8056
|
};
|
|
7728
8057
|
|
|
7729
|
-
// ../simple-boot/dist/esm/
|
|
7730
|
-
var
|
|
7731
|
-
|
|
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
|
+
};
|
|
7732
8066
|
|
|
7733
|
-
// ../simple-boot/dist/esm/
|
|
7734
|
-
var
|
|
7735
|
-
|
|
7736
|
-
|
|
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
|
+
};
|
|
7737
8073
|
|
|
7738
|
-
// ../simple-boot/dist/esm/decorators/
|
|
7739
|
-
var
|
|
8074
|
+
// ../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
|
+
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
|
+
var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
|
|
8136
|
+
var getPostConstructs = (target) => {
|
|
8137
|
+
return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
|
|
8138
|
+
};
|
|
7740
8139
|
|
|
7741
|
-
// ../simple-boot/dist/esm/
|
|
7742
|
-
var
|
|
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
|
+
};
|
|
7743
8168
|
|
|
7744
|
-
// ../simple-boot/dist/esm/
|
|
7745
|
-
var
|
|
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
|
+
};
|
|
7746
8189
|
|
|
7747
|
-
// ../simple-boot/dist/esm/decorators/
|
|
7748
|
-
var
|
|
7749
|
-
|
|
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
|
+
};
|
|
7750
8207
|
|
|
7751
|
-
// ../simple-boot/dist/esm/
|
|
7752
|
-
var
|
|
7753
|
-
(
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
}
|
|
8208
|
+
// ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
|
|
8209
|
+
var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
|
|
8210
|
+
var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
|
|
8211
|
+
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
|
+
};
|
|
7764
8230
|
|
|
7765
|
-
// ../
|
|
7766
|
-
var
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
const
|
|
7784
|
-
const
|
|
7785
|
-
|
|
7786
|
-
|
|
8231
|
+
// ../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
|
+
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];
|
|
7787
8284
|
}
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
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);
|
|
7801
8308
|
} else {
|
|
7802
|
-
|
|
8309
|
+
throw e;
|
|
7803
8310
|
}
|
|
7804
|
-
iteration++;
|
|
7805
8311
|
}
|
|
7806
|
-
return
|
|
7807
|
-
}
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
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
|
+
}
|
|
7823
8345
|
}
|
|
7824
8346
|
}
|
|
7825
|
-
|
|
7826
|
-
|
|
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
|
+
|
|
8403
|
+
// ../simple-boot/dist/esm/decorators/SimNoProxy.js
|
|
8404
|
+
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
|
+
|
|
9084
|
+
// ../simple-boot/dist/esm/decorators/inject/Injection.js
|
|
9085
|
+
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
|
+
|
|
9098
|
+
// ../simple-boot/dist/esm/decorators/route/Router.js
|
|
9099
|
+
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
|
+
var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
|
|
9110
|
+
|
|
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
|
+
// ../simple-boot/dist/esm/route/RouterAction.js
|
|
9240
|
+
var RouterAction;
|
|
9241
|
+
((RouterAction2) => {
|
|
9242
|
+
RouterAction2.isCanActivate = (obj) => {
|
|
9243
|
+
return typeof obj?.canActivate === "function";
|
|
9244
|
+
};
|
|
9245
|
+
RouterAction2.isOnRouting = (obj) => {
|
|
9246
|
+
return typeof obj?.onRouting === "function";
|
|
9247
|
+
};
|
|
9248
|
+
RouterAction2.isHasActivate = (obj) => {
|
|
9249
|
+
return typeof obj?.hasActivate === "function";
|
|
9250
|
+
};
|
|
9251
|
+
})(RouterAction || (RouterAction = {}));
|
|
9252
|
+
|
|
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
|
+
// ../core-web/dist/esm/element/CanvasUtils.js
|
|
9683
|
+
var CanvasUtils;
|
|
9684
|
+
((CanvasUtils2) => {
|
|
9685
|
+
let Context2D;
|
|
9686
|
+
((Context2D2) => {
|
|
9687
|
+
Context2D2.resetTransform = (context) => {
|
|
9688
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
9689
|
+
};
|
|
9690
|
+
})(Context2D = CanvasUtils2.Context2D || (CanvasUtils2.Context2D = {}));
|
|
9691
|
+
CanvasUtils2.fontSize = (ctx, config) => {
|
|
9692
|
+
const { text, maxWidth, maxHeight, fontOption } = config;
|
|
9693
|
+
if (!text || maxWidth <= 0 || maxHeight <= 0) {
|
|
9694
|
+
return 0;
|
|
9695
|
+
}
|
|
9696
|
+
const lines = text.split("\n").filter((line) => line.trim().length > 0);
|
|
9697
|
+
if (lines.length === 0) {
|
|
9698
|
+
return 0;
|
|
9699
|
+
}
|
|
9700
|
+
const lineHeightMultiplier = 1.2;
|
|
9701
|
+
const maxFontSizeByHeight = Math.floor(maxHeight / (lines.length * lineHeightMultiplier));
|
|
9702
|
+
if (maxFontSizeByHeight <= 0) {
|
|
9703
|
+
return 0;
|
|
9704
|
+
}
|
|
9705
|
+
let minSizeForWidth = 1;
|
|
9706
|
+
let maxSizeForWidth = maxFontSizeByHeight;
|
|
9707
|
+
let bestSizeForWidth = 0;
|
|
9708
|
+
const maxIterations = 100;
|
|
9709
|
+
let iteration = 0;
|
|
9710
|
+
while (minSizeForWidth <= maxSizeForWidth && iteration < maxIterations) {
|
|
9711
|
+
const midSize = Math.floor((minSizeForWidth + maxSizeForWidth) / 2);
|
|
9712
|
+
if (midSize === 0) break;
|
|
9713
|
+
ctx.font = `${fontOption?.fontWeight || "normal"} ${midSize}px ${fontOption?.fontFamily || "sans-serif"}`;
|
|
9714
|
+
const maxLineWidth = Math.max(...lines.map((line) => ctx.measureText(line).width));
|
|
9715
|
+
if (maxLineWidth <= maxWidth) {
|
|
9716
|
+
bestSizeForWidth = midSize;
|
|
9717
|
+
minSizeForWidth = midSize + 1;
|
|
9718
|
+
} else {
|
|
9719
|
+
maxSizeForWidth = midSize - 1;
|
|
9720
|
+
}
|
|
9721
|
+
iteration++;
|
|
9722
|
+
}
|
|
9723
|
+
return Math.min(bestSizeForWidth, maxFontSizeByHeight);
|
|
9724
|
+
};
|
|
9725
|
+
CanvasUtils2.textMetrics = (context, text) => {
|
|
9726
|
+
return context.measureText(text);
|
|
9727
|
+
};
|
|
9728
|
+
})(CanvasUtils || (CanvasUtils = {}));
|
|
9729
|
+
|
|
9730
|
+
// ../core-web/dist/esm/element/ElementUtils.js
|
|
9731
|
+
var ElementUtils;
|
|
9732
|
+
((ElementUtils2) => {
|
|
9733
|
+
function removeAllChildren(el, els) {
|
|
9734
|
+
if (!els) {
|
|
9735
|
+
el.replaceChildren();
|
|
9736
|
+
} else if (Array.isArray(els)) {
|
|
9737
|
+
el.replaceChildren(...els);
|
|
9738
|
+
} else {
|
|
9739
|
+
el.replaceChildren(els);
|
|
9740
|
+
}
|
|
9741
|
+
}
|
|
9742
|
+
ElementUtils2.removeAllChildren = removeAllChildren;
|
|
9743
|
+
function loadImage(src, callback) {
|
|
7827
9744
|
let targetCallback;
|
|
7828
9745
|
let promise = void 0;
|
|
7829
9746
|
if (callback) {
|
|
@@ -8522,13 +10439,400 @@ var ValidUtils2;
|
|
|
8522
10439
|
return /Mobi/i.test(targetWindow.navigator.userAgent);
|
|
8523
10440
|
};
|
|
8524
10441
|
})(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);
|
|
8525
10828
|
export {
|
|
8526
10829
|
ADD_EVENT_LISTENER_METADATA_KEY,
|
|
8527
10830
|
APPLY_NODE_METADATA_KEY,
|
|
10831
|
+
ATTRIBUTE_APPLY_METADATA_KEY,
|
|
8528
10832
|
ATTRIBUTE_CHANGED_WILDCARD,
|
|
8529
|
-
|
|
10833
|
+
ATTRIBUTE_FIELD_METADATA_KEY,
|
|
8530
10834
|
BROWSER_GLOBALS,
|
|
8531
|
-
|
|
10835
|
+
CLASS_METADATA_KEY,
|
|
8532
10836
|
DOM_EVENT_NAMES,
|
|
8533
10837
|
ELEMENT_CONFIG_KEY,
|
|
8534
10838
|
EMIT_CUSTOM_EVENT_METADATA_KEY,
|
|
@@ -8546,12 +10850,11 @@ export {
|
|
|
8546
10850
|
ON_CONSTRUCTOR_METADATA_KEY,
|
|
8547
10851
|
QUERY_ALL_METADATA_KEY,
|
|
8548
10852
|
QUERY_METADATA_KEY,
|
|
8549
|
-
SET_ATTRIBUTE_METADATA_KEY,
|
|
8550
10853
|
STYLE_METADATA_KEY,
|
|
8551
10854
|
SWC_NOT_FOUND,
|
|
8552
10855
|
SwcUtils,
|
|
8553
|
-
|
|
8554
|
-
|
|
10856
|
+
addClass,
|
|
10857
|
+
addClassHost,
|
|
8555
10858
|
addEventListener,
|
|
8556
10859
|
addEventListenerHost,
|
|
8557
10860
|
allAppHost,
|
|
@@ -8562,26 +10865,18 @@ export {
|
|
|
8562
10865
|
allLastHost,
|
|
8563
10866
|
allParentHost,
|
|
8564
10867
|
appHost,
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
applyBeforeBeginNode,
|
|
8570
|
-
applyBeforeBeginNodeHost,
|
|
8571
|
-
applyBeforeEndNode,
|
|
8572
|
-
applyBeforeEndNodeHost,
|
|
10868
|
+
applyAttribute,
|
|
10869
|
+
applyAttributeHost,
|
|
10870
|
+
applyClass,
|
|
10871
|
+
applyClassHost,
|
|
8573
10872
|
applyInnerHtmlNode,
|
|
8574
10873
|
applyInnerHtmlNodeHost,
|
|
8575
|
-
applyInnerTextNode,
|
|
8576
|
-
applyInnerTextNodeHost,
|
|
8577
10874
|
applyNode,
|
|
8578
10875
|
applyNodeHost,
|
|
8579
|
-
applyRemoveNode,
|
|
8580
|
-
applyRemoveNodeHost,
|
|
8581
10876
|
applyReplaceChildrenNode,
|
|
8582
10877
|
applyReplaceChildrenNodeHost,
|
|
8583
|
-
|
|
8584
|
-
|
|
10878
|
+
applyStyle,
|
|
10879
|
+
applyStyleHost,
|
|
8585
10880
|
attribute,
|
|
8586
10881
|
attributeHost,
|
|
8587
10882
|
changedAttributeHost,
|
|
@@ -8592,11 +10887,11 @@ export {
|
|
|
8592
10887
|
emitCustomEventHost,
|
|
8593
10888
|
ensureInit2 as ensureInit,
|
|
8594
10889
|
findAllApplyNodeMetadata,
|
|
10890
|
+
findAllAttributeApplyMetadata,
|
|
8595
10891
|
findAllAttributeChangedMetadata,
|
|
8596
10892
|
findAllAttributeMetadata,
|
|
8597
|
-
|
|
10893
|
+
findAllClassMetadata,
|
|
8598
10894
|
findAllLifecycleMetadata,
|
|
8599
|
-
findAllSetAttributeMetadata,
|
|
8600
10895
|
findAllStyleMetadata,
|
|
8601
10896
|
firstAppHost,
|
|
8602
10897
|
firstHost,
|
|
@@ -8607,7 +10902,6 @@ export {
|
|
|
8607
10902
|
getOnConnectedInnerHtmlMetadata,
|
|
8608
10903
|
getQueryAllMetadata,
|
|
8609
10904
|
getQueryMetadata,
|
|
8610
|
-
getSetAttributeMetadata,
|
|
8611
10905
|
host,
|
|
8612
10906
|
htmlAElement,
|
|
8613
10907
|
htmlArticleElement,
|
|
@@ -8639,22 +10933,26 @@ export {
|
|
|
8639
10933
|
queryAll,
|
|
8640
10934
|
queryAllHost,
|
|
8641
10935
|
queryHost,
|
|
8642
|
-
|
|
8643
|
-
|
|
10936
|
+
removeAttribute,
|
|
10937
|
+
removeAttributeHost,
|
|
10938
|
+
removeClass,
|
|
10939
|
+
removeClassHost,
|
|
8644
10940
|
removeStyle,
|
|
8645
10941
|
removeStyleHost,
|
|
8646
10942
|
resolveTargetEls,
|
|
8647
10943
|
setAttribute,
|
|
8648
10944
|
setAttributeHost,
|
|
8649
|
-
|
|
8650
|
-
|
|
10945
|
+
setClass,
|
|
10946
|
+
setClassHost,
|
|
8651
10947
|
setStyle,
|
|
8652
10948
|
setStyleHost,
|
|
8653
10949
|
textNode,
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
10950
|
+
toggleClass,
|
|
10951
|
+
toggleClassHost,
|
|
10952
|
+
updateAttribute,
|
|
10953
|
+
updateAttributeHost,
|
|
10954
|
+
updateClass,
|
|
10955
|
+
updateClassHost,
|
|
8658
10956
|
updateStyle,
|
|
8659
10957
|
updateStyleHost
|
|
8660
10958
|
};
|