@dooboostore/simple-web-component 1.0.23 → 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 -3212
- 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 +97 -109
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +135 -0
- package/dist/cjs/decorators/applyStyle.js.map +7 -0
- package/dist/cjs/decorators/attribute.js +24 -11
- 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 +78 -3
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +78 -3
- 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/index.js +4 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils/Utils.js +141 -2
- 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 +97 -109
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +116 -0
- package/dist/esm/decorators/applyStyle.js.map +7 -0
- package/dist/esm/decorators/attribute.js +24 -11
- 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 +78 -3
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +78 -3
- 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/index.js +4 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/utils/Utils.js +141 -2
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3191 -506
- 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 +18 -104
- 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 +12 -14
- 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 +68 -4
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +70 -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/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +49 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3191 -506
- 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 +126 -225
- package/src/decorators/applyStyle.ts +128 -0
- package/src/decorators/attribute.ts +42 -43
- package/src/decorators/changedAttributeHost.ts +2 -2
- 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 +148 -6
- package/src/decorators/queryAll.ts +149 -3
- package/src/elements/SwcAppEngine.ts +32 -4
- package/src/elements/SwcAppMixin.ts +2 -0
- package/src/index.ts +6 -6
- package/src/utils/Utils.ts +146 -1
- package/dist/cjs/decorators/classList.js +0 -134
- 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 +0 -114
- package/dist/cjs/decorators/style.js.map +0 -7
- package/dist/cjs/utils/TemplateUtils.js +0 -109
- package/dist/cjs/utils/TemplateUtils.js.map +0 -7
- package/dist/esm/decorators/classList.js +0 -115
- 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 +0 -95
- package/dist/esm/decorators/style.js.map +0 -7
- package/dist/esm/utils/TemplateUtils.js +0 -90
- package/dist/esm/utils/TemplateUtils.js.map +0 -7
- package/dist/types/decorators/classList.d.ts +0 -61
- 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 -49
- package/dist/types/decorators/style.d.ts.map +0 -1
- package/dist/types/utils/TemplateUtils.d.ts +0 -59
- package/dist/types/utils/TemplateUtils.d.ts.map +0 -1
- package/src/decorators/classList.ts +0 -172
- package/src/decorators/setAttribute.ts +0 -113
- package/src/decorators/style.ts +0 -140
- package/src/utils/TemplateUtils.ts +0 -92
|
@@ -303,8 +303,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
303
303
|
keys.push(key);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
for (var
|
|
307
|
-
var key = parentKeys_1[
|
|
306
|
+
for (var _a4 = 0, parentKeys_1 = parentKeys; _a4 < parentKeys_1.length; _a4++) {
|
|
307
|
+
var key = parentKeys_1[_a4];
|
|
308
308
|
var hasKey = set.has(key);
|
|
309
309
|
if (!hasKey) {
|
|
310
310
|
set.add(key);
|
|
@@ -1120,10 +1120,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1120
1120
|
__export(bundle_entry_exports, {
|
|
1121
1121
|
ADD_EVENT_LISTENER_METADATA_KEY: () => ADD_EVENT_LISTENER_METADATA_KEY,
|
|
1122
1122
|
APPLY_NODE_METADATA_KEY: () => APPLY_NODE_METADATA_KEY,
|
|
1123
|
+
ATTRIBUTE_APPLY_METADATA_KEY: () => ATTRIBUTE_APPLY_METADATA_KEY,
|
|
1123
1124
|
ATTRIBUTE_CHANGED_WILDCARD: () => ATTRIBUTE_CHANGED_WILDCARD,
|
|
1124
|
-
|
|
1125
|
+
ATTRIBUTE_FIELD_METADATA_KEY: () => ATTRIBUTE_FIELD_METADATA_KEY,
|
|
1125
1126
|
BROWSER_GLOBALS: () => BROWSER_GLOBALS,
|
|
1126
|
-
|
|
1127
|
+
CLASS_METADATA_KEY: () => CLASS_METADATA_KEY,
|
|
1127
1128
|
DOM_EVENT_NAMES: () => DOM_EVENT_NAMES,
|
|
1128
1129
|
ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
|
|
1129
1130
|
EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
|
|
@@ -1141,35 +1142,33 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1141
1142
|
ON_CONSTRUCTOR_METADATA_KEY: () => ON_CONSTRUCTOR_METADATA_KEY,
|
|
1142
1143
|
QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
|
|
1143
1144
|
QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
|
|
1144
|
-
SET_ATTRIBUTE_METADATA_KEY: () => SET_ATTRIBUTE_METADATA_KEY,
|
|
1145
1145
|
STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
|
|
1146
1146
|
SWC_NOT_FOUND: () => SWC_NOT_FOUND,
|
|
1147
1147
|
SwcUtils: () => SwcUtils,
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
addClassListHost: () => addClassListHost,
|
|
1148
|
+
addClass: () => addClass,
|
|
1149
|
+
addClassHost: () => addClassHost,
|
|
1151
1150
|
addEventListener: () => addEventListener,
|
|
1152
1151
|
addEventListenerHost: () => addEventListenerHost,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1152
|
+
allAppHost: () => allAppHost,
|
|
1153
|
+
allFirstAppHost: () => allFirstAppHost,
|
|
1154
|
+
allFirstHost: () => allFirstHost,
|
|
1155
|
+
allHost: () => allHost,
|
|
1156
|
+
allLastAppHost: () => allLastAppHost,
|
|
1157
|
+
allLastHost: () => allLastHost,
|
|
1158
|
+
allParentHost: () => allParentHost,
|
|
1159
|
+
appHost: () => appHost,
|
|
1160
|
+
applyAttribute: () => applyAttribute,
|
|
1161
|
+
applyAttributeHost: () => applyAttributeHost,
|
|
1162
|
+
applyClass: () => applyClass,
|
|
1163
|
+
applyClassHost: () => applyClassHost,
|
|
1161
1164
|
applyInnerHtmlNode: () => applyInnerHtmlNode,
|
|
1162
1165
|
applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
|
|
1163
|
-
applyInnerTextNode: () => applyInnerTextNode,
|
|
1164
|
-
applyInnerTextNodeHost: () => applyInnerTextNodeHost,
|
|
1165
1166
|
applyNode: () => applyNode,
|
|
1166
1167
|
applyNodeHost: () => applyNodeHost,
|
|
1167
|
-
applyRemoveNode: () => applyRemoveNode,
|
|
1168
|
-
applyRemoveNodeHost: () => applyRemoveNodeHost,
|
|
1169
1168
|
applyReplaceChildrenNode: () => applyReplaceChildrenNode,
|
|
1170
1169
|
applyReplaceChildrenNodeHost: () => applyReplaceChildrenNodeHost,
|
|
1171
|
-
|
|
1172
|
-
|
|
1170
|
+
applyStyle: () => applyStyle,
|
|
1171
|
+
applyStyleHost: () => applyStyleHost,
|
|
1173
1172
|
attribute: () => attribute,
|
|
1174
1173
|
attributeHost: () => attributeHost,
|
|
1175
1174
|
changedAttributeHost: () => changedAttributeHost,
|
|
@@ -1180,12 +1179,14 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1180
1179
|
emitCustomEventHost: () => emitCustomEventHost,
|
|
1181
1180
|
ensureInit: () => ensureInit2,
|
|
1182
1181
|
findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
|
|
1182
|
+
findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
|
|
1183
1183
|
findAllAttributeChangedMetadata: () => findAllAttributeChangedMetadata,
|
|
1184
1184
|
findAllAttributeMetadata: () => findAllAttributeMetadata,
|
|
1185
|
-
|
|
1185
|
+
findAllClassMetadata: () => findAllClassMetadata,
|
|
1186
1186
|
findAllLifecycleMetadata: () => findAllLifecycleMetadata,
|
|
1187
|
-
findAllSetAttributeMetadata: () => findAllSetAttributeMetadata,
|
|
1188
1187
|
findAllStyleMetadata: () => findAllStyleMetadata,
|
|
1188
|
+
firstAppHost: () => firstAppHost,
|
|
1189
|
+
firstHost: () => firstHost,
|
|
1189
1190
|
getAddEventListenerMetadata: () => getAddEventListenerMetadata,
|
|
1190
1191
|
getChangedAttributeMetadata: () => getChangedAttributeMetadata,
|
|
1191
1192
|
getElementConfig: () => getElementConfig,
|
|
@@ -1193,24 +1194,20 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1193
1194
|
getOnConnectedInnerHtmlMetadata: () => getOnConnectedInnerHtmlMetadata,
|
|
1194
1195
|
getQueryAllMetadata: () => getQueryAllMetadata,
|
|
1195
1196
|
getQueryMetadata: () => getQueryMetadata,
|
|
1196
|
-
|
|
1197
|
+
host: () => host,
|
|
1197
1198
|
htmlAElement: () => htmlAElement,
|
|
1198
1199
|
htmlArticleElement: () => htmlArticleElement,
|
|
1199
1200
|
htmlButtonElement: () => htmlButtonElement,
|
|
1200
1201
|
htmlDivElement: () => htmlDivElement,
|
|
1201
1202
|
htmlFragment: () => htmlFragment,
|
|
1202
|
-
|
|
1203
|
-
htmlH2Element: () => htmlH2Element,
|
|
1204
|
-
htmlH3Element: () => htmlH3Element,
|
|
1205
|
-
htmlH4Element: () => htmlH4Element,
|
|
1206
|
-
htmlH5Element: () => htmlH5Element,
|
|
1207
|
-
htmlH6Element: () => htmlH6Element,
|
|
1208
|
-
htmlInputElement: () => htmlInputElement,
|
|
1203
|
+
htmlHeadingElement: () => htmlHeadingElement,
|
|
1209
1204
|
htmlLiElement: () => htmlLiElement,
|
|
1210
1205
|
htmlPElement: () => htmlPElement,
|
|
1211
1206
|
htmlSectionElement: () => htmlSectionElement,
|
|
1212
1207
|
htmlSpanElement: () => htmlSpanElement,
|
|
1213
1208
|
htmlUlElement: () => htmlUlElement,
|
|
1209
|
+
lastAppHost: () => lastAppHost,
|
|
1210
|
+
lastHost: () => lastHost,
|
|
1214
1211
|
onAddEventListener: () => onAddEventListener,
|
|
1215
1212
|
onAdopted: () => onAdopted,
|
|
1216
1213
|
onAfterAdopted: () => onAfterAdopted,
|
|
@@ -1223,33 +1220,38 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1223
1220
|
onConnectedInnerHtml: () => onConnectedInnerHtml,
|
|
1224
1221
|
onConstructor: () => onConstructor,
|
|
1225
1222
|
onDisconnected: () => onDisconnected,
|
|
1223
|
+
parentHost: () => parentHost,
|
|
1226
1224
|
query: () => query,
|
|
1227
1225
|
queryAll: () => queryAll,
|
|
1228
1226
|
queryAllHost: () => queryAllHost,
|
|
1229
1227
|
queryHost: () => queryHost,
|
|
1230
|
-
|
|
1231
|
-
|
|
1228
|
+
removeAttribute: () => removeAttribute,
|
|
1229
|
+
removeAttributeHost: () => removeAttributeHost,
|
|
1230
|
+
removeClass: () => removeClass,
|
|
1231
|
+
removeClassHost: () => removeClassHost,
|
|
1232
1232
|
removeStyle: () => removeStyle,
|
|
1233
1233
|
removeStyleHost: () => removeStyleHost,
|
|
1234
1234
|
resolveTargetEls: () => resolveTargetEls,
|
|
1235
1235
|
setAttribute: () => setAttribute,
|
|
1236
1236
|
setAttributeHost: () => setAttributeHost,
|
|
1237
|
-
|
|
1238
|
-
|
|
1237
|
+
setClass: () => setClass,
|
|
1238
|
+
setClassHost: () => setClassHost,
|
|
1239
1239
|
setStyle: () => setStyle,
|
|
1240
1240
|
setStyleHost: () => setStyleHost,
|
|
1241
1241
|
textNode: () => textNode,
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1242
|
+
toggleClass: () => toggleClass,
|
|
1243
|
+
toggleClassHost: () => toggleClassHost,
|
|
1244
|
+
updateAttribute: () => updateAttribute,
|
|
1245
|
+
updateAttributeHost: () => updateAttributeHost,
|
|
1246
|
+
updateClass: () => updateClass,
|
|
1247
|
+
updateClassHost: () => updateClassHost,
|
|
1246
1248
|
updateStyle: () => updateStyle,
|
|
1247
1249
|
updateStyleHost: () => updateStyleHost
|
|
1248
1250
|
});
|
|
1249
|
-
var
|
|
1251
|
+
var import_reflect_metadata3 = __toESM(require_Reflect(), 1);
|
|
1250
1252
|
|
|
1251
1253
|
// src/index.ts
|
|
1252
|
-
var
|
|
1254
|
+
var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
|
|
1253
1255
|
|
|
1254
1256
|
// ../core/dist/esm/valid/ValidUtils.js
|
|
1255
1257
|
var ValidUtils;
|
|
@@ -4925,6 +4927,107 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
4925
4927
|
}
|
|
4926
4928
|
};
|
|
4927
4929
|
|
|
4930
|
+
// ../core/dist/esm/message/Subject.js
|
|
4931
|
+
var Subject = class extends Observable {
|
|
4932
|
+
constructor() {
|
|
4933
|
+
super((subscriber) => {
|
|
4934
|
+
return this._subscribeToSubject(subscriber);
|
|
4935
|
+
});
|
|
4936
|
+
this._observers = /* @__PURE__ */ new Set();
|
|
4937
|
+
this._isStopped = false;
|
|
4938
|
+
this._hasError = false;
|
|
4939
|
+
}
|
|
4940
|
+
_subscribeToSubject(subscriber) {
|
|
4941
|
+
const partialObserver = {
|
|
4942
|
+
next: subscriber.next.bind(subscriber),
|
|
4943
|
+
error: subscriber.error.bind(subscriber),
|
|
4944
|
+
complete: subscriber.complete.bind(subscriber)
|
|
4945
|
+
};
|
|
4946
|
+
if (this._isStopped) {
|
|
4947
|
+
if (this._hasError) {
|
|
4948
|
+
partialObserver.error?.(this._error);
|
|
4949
|
+
} else {
|
|
4950
|
+
partialObserver.complete?.();
|
|
4951
|
+
}
|
|
4952
|
+
return Subscription.EMPTY;
|
|
4953
|
+
}
|
|
4954
|
+
this._observers.add(partialObserver);
|
|
4955
|
+
return new Subscription(() => {
|
|
4956
|
+
this._observers.delete(partialObserver);
|
|
4957
|
+
});
|
|
4958
|
+
}
|
|
4959
|
+
next(data) {
|
|
4960
|
+
if (this._isStopped) {
|
|
4961
|
+
return;
|
|
4962
|
+
}
|
|
4963
|
+
this._observers.forEach((observer) => {
|
|
4964
|
+
observer.next?.(data);
|
|
4965
|
+
});
|
|
4966
|
+
}
|
|
4967
|
+
error(err) {
|
|
4968
|
+
if (this._isStopped) {
|
|
4969
|
+
return;
|
|
4970
|
+
}
|
|
4971
|
+
this._hasError = true;
|
|
4972
|
+
this._error = err;
|
|
4973
|
+
this._isStopped = true;
|
|
4974
|
+
this._observers.forEach((observer) => observer.error?.(err));
|
|
4975
|
+
this._observers.clear();
|
|
4976
|
+
}
|
|
4977
|
+
complete() {
|
|
4978
|
+
if (this._isStopped) {
|
|
4979
|
+
return;
|
|
4980
|
+
}
|
|
4981
|
+
this._isStopped = true;
|
|
4982
|
+
this._observers.forEach((observer) => observer.complete?.());
|
|
4983
|
+
this._observers.clear();
|
|
4984
|
+
}
|
|
4985
|
+
asObservable() {
|
|
4986
|
+
return new Observable((subscriber) => {
|
|
4987
|
+
return this._subscribeToSubject(subscriber);
|
|
4988
|
+
});
|
|
4989
|
+
}
|
|
4990
|
+
};
|
|
4991
|
+
|
|
4992
|
+
// ../core/dist/esm/message/ReplaySubject.js
|
|
4993
|
+
var ReplaySubject = class extends Subject {
|
|
4994
|
+
// Removed: private _error: E | undefined;
|
|
4995
|
+
// Removed: private _isStopped = false;
|
|
4996
|
+
constructor(bufferSize = Infinity) {
|
|
4997
|
+
super();
|
|
4998
|
+
this.bufferSize = bufferSize;
|
|
4999
|
+
this._buffer = [];
|
|
5000
|
+
}
|
|
5001
|
+
next(data) {
|
|
5002
|
+
if (this._isStopped) {
|
|
5003
|
+
return;
|
|
5004
|
+
}
|
|
5005
|
+
this._buffer.push(data);
|
|
5006
|
+
if (this._buffer.length > this.bufferSize) {
|
|
5007
|
+
this._buffer.shift();
|
|
5008
|
+
}
|
|
5009
|
+
super.next(data);
|
|
5010
|
+
}
|
|
5011
|
+
error(err) {
|
|
5012
|
+
super.error(err);
|
|
5013
|
+
}
|
|
5014
|
+
complete() {
|
|
5015
|
+
super.complete();
|
|
5016
|
+
}
|
|
5017
|
+
_subscribeToSubject(subscriber) {
|
|
5018
|
+
this._buffer.forEach((value) => subscriber.next(value));
|
|
5019
|
+
if (this._isStopped) {
|
|
5020
|
+
if (this._hasError) {
|
|
5021
|
+
subscriber.error(this._error);
|
|
5022
|
+
} else {
|
|
5023
|
+
subscriber.complete();
|
|
5024
|
+
}
|
|
5025
|
+
return Subscription.EMPTY;
|
|
5026
|
+
}
|
|
5027
|
+
return super._subscribeToSubject(subscriber);
|
|
5028
|
+
}
|
|
5029
|
+
};
|
|
5030
|
+
|
|
4928
5031
|
// ../core/dist/esm/message/AutoCloseSubscription.js
|
|
4929
5032
|
var AutoCloseSubscription = class extends Subscription {
|
|
4930
5033
|
constructor(userUnsubscribe) {
|
|
@@ -5259,6 +5362,284 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5259
5362
|
})(Result = Promises2.Result || (Promises2.Result = {}));
|
|
5260
5363
|
})(Promises || (Promises = {}));
|
|
5261
5364
|
|
|
5365
|
+
// ../core/dist/esm/fetch/Fetcher.js
|
|
5366
|
+
var Fetcher = class {
|
|
5367
|
+
createPipe(config) {
|
|
5368
|
+
return {};
|
|
5369
|
+
}
|
|
5370
|
+
fetch(config) {
|
|
5371
|
+
return new Promise((resolve, reject) => {
|
|
5372
|
+
const pipe = this.createPipe(config);
|
|
5373
|
+
Promise.resolve().then(() => {
|
|
5374
|
+
this.before(config, pipe);
|
|
5375
|
+
config?.before?.();
|
|
5376
|
+
}).then(() => {
|
|
5377
|
+
return this.execute(config);
|
|
5378
|
+
}).then((data) => {
|
|
5379
|
+
const hasError = config.config?.hasErrorChecker?.(data);
|
|
5380
|
+
if (hasError) {
|
|
5381
|
+
throw hasError;
|
|
5382
|
+
}
|
|
5383
|
+
pipe.responseData = data;
|
|
5384
|
+
this.afterSuccess(config, pipe);
|
|
5385
|
+
config?.afterSuccess?.();
|
|
5386
|
+
const gdata = config?.transform ? config.transform(data) : data;
|
|
5387
|
+
this.afterSuccessTransform(config, pipe);
|
|
5388
|
+
resolve(gdata);
|
|
5389
|
+
}).catch(async (e) => {
|
|
5390
|
+
this.error(config, pipe, e);
|
|
5391
|
+
config?.error?.();
|
|
5392
|
+
if (config?.errorTransform) {
|
|
5393
|
+
e = await config.errorTransform(e);
|
|
5394
|
+
}
|
|
5395
|
+
e = await this.errorTransform(e);
|
|
5396
|
+
reject(e);
|
|
5397
|
+
}).finally(() => {
|
|
5398
|
+
this.finally(config, pipe);
|
|
5399
|
+
config?.finally?.();
|
|
5400
|
+
});
|
|
5401
|
+
});
|
|
5402
|
+
}
|
|
5403
|
+
};
|
|
5404
|
+
|
|
5405
|
+
// ../core/dist/esm/fetch/HttpFetcher.js
|
|
5406
|
+
var HttpResponseError = class extends Error {
|
|
5407
|
+
};
|
|
5408
|
+
var HttpFetcher = class extends Fetcher {
|
|
5409
|
+
get(config) {
|
|
5410
|
+
config.config ?? (config.config = {});
|
|
5411
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5412
|
+
config.config.fetch.method = "GET";
|
|
5413
|
+
return this.fetch(config);
|
|
5414
|
+
}
|
|
5415
|
+
post(config) {
|
|
5416
|
+
config.config ?? (config.config = {});
|
|
5417
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5418
|
+
config.config.fetch.method = "POST";
|
|
5419
|
+
return this.fetch(config);
|
|
5420
|
+
}
|
|
5421
|
+
patch(config) {
|
|
5422
|
+
config.config ?? (config.config = {});
|
|
5423
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5424
|
+
config.config.fetch.method = "PATCH";
|
|
5425
|
+
return this.fetch(config);
|
|
5426
|
+
}
|
|
5427
|
+
put(config) {
|
|
5428
|
+
config.config ?? (config.config = {});
|
|
5429
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5430
|
+
config.config.fetch.method = "PUT";
|
|
5431
|
+
return this.fetch(config);
|
|
5432
|
+
}
|
|
5433
|
+
head(config) {
|
|
5434
|
+
config.config ?? (config.config = {});
|
|
5435
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5436
|
+
config.config.fetch.method = "HEAD";
|
|
5437
|
+
return this.fetch(config);
|
|
5438
|
+
}
|
|
5439
|
+
delete(config) {
|
|
5440
|
+
config.config ?? (config.config = {});
|
|
5441
|
+
config.config.fetch = config.config?.fetch ?? {};
|
|
5442
|
+
config.config.fetch.method = "DELETE";
|
|
5443
|
+
return this.fetch(config);
|
|
5444
|
+
}
|
|
5445
|
+
async beforeProxyFetch(config) {
|
|
5446
|
+
return config;
|
|
5447
|
+
}
|
|
5448
|
+
async afterProxyFetch(config) {
|
|
5449
|
+
return config.response;
|
|
5450
|
+
}
|
|
5451
|
+
afterSuccess(config, pipe) {
|
|
5452
|
+
}
|
|
5453
|
+
afterSuccessTransform(config, pipe) {
|
|
5454
|
+
}
|
|
5455
|
+
before(config, pipe) {
|
|
5456
|
+
}
|
|
5457
|
+
error(config, pipe, e) {
|
|
5458
|
+
}
|
|
5459
|
+
finally(config, pipe) {
|
|
5460
|
+
}
|
|
5461
|
+
beforeFetch(fetch2) {
|
|
5462
|
+
}
|
|
5463
|
+
afterFetch(fetch2, response) {
|
|
5464
|
+
}
|
|
5465
|
+
// protected async errorTransform(e: any): Promise<HttpResponseError<any>> {
|
|
5466
|
+
async errorTransform(e) {
|
|
5467
|
+
const httpResponseError = new HttpResponseError();
|
|
5468
|
+
httpResponseError.error = e;
|
|
5469
|
+
if (e instanceof Response) {
|
|
5470
|
+
httpResponseError.response = e;
|
|
5471
|
+
try {
|
|
5472
|
+
httpResponseError.body = await e.clone().text();
|
|
5473
|
+
httpResponseError.message = e.statusText;
|
|
5474
|
+
} catch (e2) {
|
|
5475
|
+
httpResponseError.body = e2;
|
|
5476
|
+
httpResponseError.message = e2.message;
|
|
5477
|
+
}
|
|
5478
|
+
} else {
|
|
5479
|
+
httpResponseError.body = e;
|
|
5480
|
+
httpResponseError.message = e.message;
|
|
5481
|
+
}
|
|
5482
|
+
return httpResponseError;
|
|
5483
|
+
}
|
|
5484
|
+
async execute(fetcherRequest) {
|
|
5485
|
+
let target = fetcherRequest.target;
|
|
5486
|
+
let config = fetcherRequest.config;
|
|
5487
|
+
if (!(target instanceof URL) && typeof target !== "string") {
|
|
5488
|
+
const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
|
|
5489
|
+
try {
|
|
5490
|
+
const url = typeof target.url === "string" ? new URL(target.url) : target.url;
|
|
5491
|
+
searchParams.forEach((value, key) => {
|
|
5492
|
+
url.searchParams.append(key, value);
|
|
5493
|
+
});
|
|
5494
|
+
target = url;
|
|
5495
|
+
} catch (e) {
|
|
5496
|
+
if (typeof target.url === "string") {
|
|
5497
|
+
const searchParamString = searchParams.toString();
|
|
5498
|
+
target = target.url + (searchParamString ? "?" + searchParamString : "");
|
|
5499
|
+
} else {
|
|
5500
|
+
target = "";
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
const beforeProxyData = { requestInfo: target, init: config?.fetch };
|
|
5505
|
+
let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
|
|
5506
|
+
beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
|
|
5507
|
+
target = beforeData.requestInfo;
|
|
5508
|
+
if (beforeData.init) {
|
|
5509
|
+
config ?? (config = {});
|
|
5510
|
+
config.fetch = beforeData.init;
|
|
5511
|
+
}
|
|
5512
|
+
let abortedTimeout;
|
|
5513
|
+
if (config?.fetch && "timeout" in config.fetch) {
|
|
5514
|
+
const abortController = new AbortController();
|
|
5515
|
+
abortedTimeout = setTimeout(() => {
|
|
5516
|
+
if (config?.fetch?.signal) {
|
|
5517
|
+
const inputSignal = config.fetch.signal;
|
|
5518
|
+
const listener = () => {
|
|
5519
|
+
if (!abortController.signal.aborted) {
|
|
5520
|
+
abortController.abort();
|
|
5521
|
+
}
|
|
5522
|
+
inputSignal.removeEventListener("abort", listener);
|
|
5523
|
+
};
|
|
5524
|
+
inputSignal.addEventListener("abort", listener);
|
|
5525
|
+
}
|
|
5526
|
+
if (!abortController.signal.aborted) {
|
|
5527
|
+
abortController.abort();
|
|
5528
|
+
}
|
|
5529
|
+
}, config.fetch.timeout);
|
|
5530
|
+
config.fetch.signal = abortController.signal;
|
|
5531
|
+
}
|
|
5532
|
+
this.beforeFetch({ target, requestInit: config?.fetch });
|
|
5533
|
+
return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
|
|
5534
|
+
this.afterFetch({ target, requestInit: config?.fetch }, it);
|
|
5535
|
+
const afterProxyData = {
|
|
5536
|
+
fetch: { target, requestInit: config.fetch },
|
|
5537
|
+
config: beforeData,
|
|
5538
|
+
response: it
|
|
5539
|
+
};
|
|
5540
|
+
it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
|
|
5541
|
+
it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
|
|
5542
|
+
config?.fetchResponseAfterCallBack?.(it, config);
|
|
5543
|
+
if (!config?.allowedResponseNotOk && !it.ok) {
|
|
5544
|
+
throw it;
|
|
5545
|
+
}
|
|
5546
|
+
const data = config?.hasResponseErrorChecker?.(it, config);
|
|
5547
|
+
if (data) {
|
|
5548
|
+
throw data;
|
|
5549
|
+
}
|
|
5550
|
+
return it;
|
|
5551
|
+
}).finally(() => {
|
|
5552
|
+
if (abortedTimeout) {
|
|
5553
|
+
clearTimeout(abortedTimeout);
|
|
5554
|
+
}
|
|
5555
|
+
});
|
|
5556
|
+
}
|
|
5557
|
+
};
|
|
5558
|
+
|
|
5559
|
+
// ../core/dist/esm/fetch/HttpJsonFetcher.js
|
|
5560
|
+
var HttpJsonFetcher = class extends HttpFetcher {
|
|
5561
|
+
updateJsonFetchConfigAndData(config) {
|
|
5562
|
+
var _a4, _b2;
|
|
5563
|
+
const headers = {
|
|
5564
|
+
"Content-Type": "application/json",
|
|
5565
|
+
Accept: "application/json, text/plain, */*"
|
|
5566
|
+
};
|
|
5567
|
+
config.config ?? (config.config = {});
|
|
5568
|
+
(_a4 = config.config).fetch ?? (_a4.fetch = {});
|
|
5569
|
+
(_b2 = config.config.fetch).headers ?? (_b2.headers = {});
|
|
5570
|
+
config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
|
|
5571
|
+
if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
|
|
5572
|
+
config.config.fetch.body = JSON.stringify(config.config.fetch.body);
|
|
5573
|
+
}
|
|
5574
|
+
return config;
|
|
5575
|
+
}
|
|
5576
|
+
get(config) {
|
|
5577
|
+
return super.get(config);
|
|
5578
|
+
}
|
|
5579
|
+
delete(config) {
|
|
5580
|
+
return super.delete(config);
|
|
5581
|
+
}
|
|
5582
|
+
post(config) {
|
|
5583
|
+
return super.post(config);
|
|
5584
|
+
}
|
|
5585
|
+
patch(config) {
|
|
5586
|
+
return super.patch(config);
|
|
5587
|
+
}
|
|
5588
|
+
put(config) {
|
|
5589
|
+
return super.put(config);
|
|
5590
|
+
}
|
|
5591
|
+
head(config) {
|
|
5592
|
+
return super.head(config);
|
|
5593
|
+
}
|
|
5594
|
+
postJson(config) {
|
|
5595
|
+
return super.post(this.updateJsonFetchConfigAndData(config));
|
|
5596
|
+
}
|
|
5597
|
+
patchJson(config) {
|
|
5598
|
+
return super.patch(this.updateJsonFetchConfigAndData(config));
|
|
5599
|
+
}
|
|
5600
|
+
putJson(config) {
|
|
5601
|
+
return super.put(this.updateJsonFetchConfigAndData(config));
|
|
5602
|
+
}
|
|
5603
|
+
async errorTransform(e) {
|
|
5604
|
+
const httpResponseError = new HttpResponseError();
|
|
5605
|
+
httpResponseError.error = e;
|
|
5606
|
+
if (e instanceof Response) {
|
|
5607
|
+
httpResponseError.response = e;
|
|
5608
|
+
try {
|
|
5609
|
+
httpResponseError.body = await e.clone().json();
|
|
5610
|
+
httpResponseError.message = e.statusText;
|
|
5611
|
+
} catch (parseError) {
|
|
5612
|
+
httpResponseError.body = parseError;
|
|
5613
|
+
httpResponseError.message = parseError.message;
|
|
5614
|
+
}
|
|
5615
|
+
} else {
|
|
5616
|
+
httpResponseError.body = e;
|
|
5617
|
+
httpResponseError.message = e.message;
|
|
5618
|
+
}
|
|
5619
|
+
return httpResponseError;
|
|
5620
|
+
}
|
|
5621
|
+
// protected execute(target: HttpFetcherTarget, config?: HttpJsonFetcherConfig<C, any>): Promise<any> {
|
|
5622
|
+
execute(fetcherRequest) {
|
|
5623
|
+
return super.execute(fetcherRequest).then((response) => {
|
|
5624
|
+
const config = fetcherRequest.config;
|
|
5625
|
+
const transform = config?.responseTransform ?? (config?.bypassTransform ? "response" : config?.transformText ? "text" : void 0);
|
|
5626
|
+
if (transform === "response") {
|
|
5627
|
+
return response;
|
|
5628
|
+
} else if (transform === "text") {
|
|
5629
|
+
return response?.text();
|
|
5630
|
+
} else if (typeof transform === "function") {
|
|
5631
|
+
return transform(response);
|
|
5632
|
+
} else {
|
|
5633
|
+
return response?.text().then((it) => {
|
|
5634
|
+
if ((it ?? "").length > 0) {
|
|
5635
|
+
return JSON.parse(it);
|
|
5636
|
+
}
|
|
5637
|
+
});
|
|
5638
|
+
}
|
|
5639
|
+
});
|
|
5640
|
+
}
|
|
5641
|
+
};
|
|
5642
|
+
|
|
5262
5643
|
// ../core/dist/esm/entity/object/obj/RenderDrawObj.js
|
|
5263
5644
|
var RenderDrawObj = class extends Obj {
|
|
5264
5645
|
render(draw, config) {
|
|
@@ -5535,7 +5916,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5535
5916
|
// ../core/dist/esm/schedule/Schedule.js
|
|
5536
5917
|
var Schedule;
|
|
5537
5918
|
((Schedule2) => {
|
|
5538
|
-
Schedule2.SYMBOL = Symbol("
|
|
5919
|
+
Schedule2.SYMBOL = Symbol.for("core:schedule-token");
|
|
5539
5920
|
})(Schedule || (Schedule = {}));
|
|
5540
5921
|
|
|
5541
5922
|
// ../core/dist/esm/url/UrlUtils.js
|
|
@@ -5689,6 +6070,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5689
6070
|
Reflect.defineMetadata(metadataKey, value, target);
|
|
5690
6071
|
}
|
|
5691
6072
|
};
|
|
6073
|
+
ReflectUtils2.copyMetadata = (from, to, propertyKey) => {
|
|
6074
|
+
const keys = propertyKey ? Reflect.getOwnMetadataKeys(from, propertyKey) : Reflect.getOwnMetadataKeys(from);
|
|
6075
|
+
for (const key of keys) {
|
|
6076
|
+
const data = propertyKey ? Reflect.getOwnMetadata(key, from, propertyKey) : Reflect.getOwnMetadata(key, from);
|
|
6077
|
+
if (propertyKey) {
|
|
6078
|
+
Reflect.defineMetadata(key, data, to, propertyKey);
|
|
6079
|
+
} else {
|
|
6080
|
+
Reflect.defineMetadata(key, data, to);
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
};
|
|
5692
6084
|
})(ReflectUtils || (ReflectUtils = {}));
|
|
5693
6085
|
|
|
5694
6086
|
// ../core/dist/esm/function/FunctionUtils.js
|
|
@@ -5852,7 +6244,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5852
6244
|
})(Expression || (Expression = {}));
|
|
5853
6245
|
|
|
5854
6246
|
// src/decorators/addEventListener.ts
|
|
5855
|
-
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
|
|
6247
|
+
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
5856
6248
|
function addEventListener(selectorOrTarget, type, options = {}) {
|
|
5857
6249
|
return (targetObj, propertyKey, descriptor) => {
|
|
5858
6250
|
const constructor = targetObj.constructor;
|
|
@@ -5873,15 +6265,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5873
6265
|
}
|
|
5874
6266
|
|
|
5875
6267
|
// src/decorators/lifecycles.ts
|
|
5876
|
-
var ON_CONSTRUCTOR_METADATA_KEY = Symbol("simple-web-component:on-constructor");
|
|
5877
|
-
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-connected");
|
|
5878
|
-
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-connected");
|
|
5879
|
-
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-before-disconnected");
|
|
5880
|
-
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol("simple-web-component:on-after-disconnected");
|
|
5881
|
-
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
|
|
5882
|
-
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
|
|
5883
|
-
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
|
|
5884
|
-
var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
|
|
6268
|
+
var ON_CONSTRUCTOR_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
6269
|
+
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
6270
|
+
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
6271
|
+
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
6272
|
+
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
6273
|
+
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
6274
|
+
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
6275
|
+
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
6276
|
+
var INNER_HTML_METADATA_KEY = Symbol.for("simple-web-component:inner-html");
|
|
5885
6277
|
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
5886
6278
|
function createLifecycleDecorator(metadataKey) {
|
|
5887
6279
|
return (target, propertyKey) => {
|
|
@@ -5932,7 +6324,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5932
6324
|
};
|
|
5933
6325
|
|
|
5934
6326
|
// src/decorators/attribute.ts
|
|
5935
|
-
var
|
|
6327
|
+
var ATTRIBUTE_FIELD_METADATA_KEY = Symbol.for("simple-web-component:attribute-field");
|
|
5936
6328
|
var convertValue = (val, type) => {
|
|
5937
6329
|
if (val === null || val === void 0) return val;
|
|
5938
6330
|
if (type === Number) return Number(val);
|
|
@@ -5990,15 +6382,14 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5990
6382
|
const constructor = target.constructor;
|
|
5991
6383
|
const privateKey = Symbol(String(propertyKey));
|
|
5992
6384
|
const designType = Reflect.getMetadata("design:type", target, propertyKey);
|
|
5993
|
-
let metaList = ReflectUtils.getOwnMetadata(
|
|
6385
|
+
let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_FIELD_METADATA_KEY, constructor);
|
|
5994
6386
|
if (!metaList) {
|
|
5995
6387
|
metaList = [];
|
|
5996
|
-
ReflectUtils.defineMetadata(
|
|
6388
|
+
ReflectUtils.defineMetadata(ATTRIBUTE_FIELD_METADATA_KEY, metaList, constructor);
|
|
5997
6389
|
}
|
|
5998
6390
|
metaList.push({ propertyKey, selector, options, privateKey });
|
|
5999
6391
|
const applySetAttribute = (inst, targets, attrName, nv) => {
|
|
6000
6392
|
targets.forEach((it) => {
|
|
6001
|
-
console.log("----->", it);
|
|
6002
6393
|
if (it && typeof it.setAttribute === "function") {
|
|
6003
6394
|
if (nv === null) {
|
|
6004
6395
|
it.removeAttribute(attrName);
|
|
@@ -6016,7 +6407,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6016
6407
|
const conf = getElementConfig(this);
|
|
6017
6408
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6018
6409
|
const targetType = options.type || designType;
|
|
6019
|
-
console.log("type-->", propertyKey, targetType);
|
|
6020
6410
|
if (this.__swc_syncing_init || options.connectedInitialize && !this.__swc_connected) {
|
|
6021
6411
|
return convertValue(this[privateKey], targetType);
|
|
6022
6412
|
}
|
|
@@ -6032,7 +6422,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6032
6422
|
return convertValue(this[privateKey], targetType);
|
|
6033
6423
|
},
|
|
6034
6424
|
set(nv) {
|
|
6035
|
-
const targetType = options.type || designType;
|
|
6036
6425
|
const attrName = options.name || String(propertyKey);
|
|
6037
6426
|
const conf = getElementConfig(this);
|
|
6038
6427
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
@@ -6057,15 +6446,31 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6057
6446
|
});
|
|
6058
6447
|
};
|
|
6059
6448
|
}
|
|
6449
|
+
function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
6450
|
+
if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
6451
|
+
return attribute(":host", { name: String(propertyKeyOrOptions) })(targetOrAttrOrOptions, propertyKeyOrOptions);
|
|
6452
|
+
}
|
|
6453
|
+
if (typeof targetOrAttrOrOptions === "string") {
|
|
6454
|
+
const attrName = targetOrAttrOrOptions;
|
|
6455
|
+
const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
|
|
6456
|
+
return attribute(":host", { ...options, name: attrName });
|
|
6457
|
+
} else if (typeof targetOrAttrOrOptions === "object") {
|
|
6458
|
+
const options = targetOrAttrOrOptions;
|
|
6459
|
+
return (target, propertyKey) => {
|
|
6460
|
+
return attribute(":host", { ...options, name: String(propertyKey) })(target, propertyKey);
|
|
6461
|
+
};
|
|
6462
|
+
} else {
|
|
6463
|
+
return (target, propertyKey) => {
|
|
6464
|
+
return attribute(":host", { name: String(propertyKey) })(target, propertyKey);
|
|
6465
|
+
};
|
|
6466
|
+
}
|
|
6467
|
+
}
|
|
6060
6468
|
var findAllAttributeMetadata = (target) => {
|
|
6061
|
-
return ReflectUtils.findAllMetadata(
|
|
6469
|
+
return ReflectUtils.findAllMetadata(ATTRIBUTE_FIELD_METADATA_KEY, target).flat();
|
|
6062
6470
|
};
|
|
6063
|
-
function attributeHost(attrName, options = {}) {
|
|
6064
|
-
return attribute(":host", { ...options, name: attrName });
|
|
6065
|
-
}
|
|
6066
6471
|
|
|
6067
6472
|
// src/decorators/changedAttributeHost.ts
|
|
6068
|
-
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol("simple-web-component:on-attribute-changed");
|
|
6473
|
+
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
|
|
6069
6474
|
function changedAttributeHost(attributeName) {
|
|
6070
6475
|
return (target, propertyKey) => {
|
|
6071
6476
|
const constructor = target.constructor;
|
|
@@ -6091,102 +6496,43 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6091
6496
|
return ReflectUtils.findAllMapMetadata(ON_ATTRIBUTE_CHANGED_METADATA_KEY, target);
|
|
6092
6497
|
};
|
|
6093
6498
|
|
|
6094
|
-
// src/decorators/setAttribute.ts
|
|
6095
|
-
var SET_ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:set-attribute");
|
|
6096
|
-
function setAttribute(selector, name, options = {}) {
|
|
6097
|
-
return (target, propertyKey, descriptor) => {
|
|
6098
|
-
const constructor = target.constructor;
|
|
6099
|
-
let metaList = ReflectUtils.getOwnMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
|
|
6100
|
-
if (!metaList) {
|
|
6101
|
-
metaList = /* @__PURE__ */ new Map();
|
|
6102
|
-
ReflectUtils.defineMetadata(SET_ATTRIBUTE_METADATA_KEY, metaList, constructor);
|
|
6103
|
-
}
|
|
6104
|
-
metaList.set(propertyKey, { propertyKey, selector, name, options });
|
|
6105
|
-
const original = descriptor.value;
|
|
6106
|
-
descriptor.value = async function(...args) {
|
|
6107
|
-
ensureInit2(this);
|
|
6108
|
-
const res = await original.apply(this, args);
|
|
6109
|
-
if (res !== void 0) {
|
|
6110
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
6111
|
-
const conf = getElementConfig(this);
|
|
6112
|
-
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6113
|
-
const targetEls = [];
|
|
6114
|
-
const r = options.root || "auto";
|
|
6115
|
-
const applyRoot = (t) => {
|
|
6116
|
-
if (!t) return;
|
|
6117
|
-
if (r === "auto") {
|
|
6118
|
-
targetEls.push(t.shadowRoot || t);
|
|
6119
|
-
return;
|
|
6120
|
-
}
|
|
6121
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
6122
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
6123
|
-
};
|
|
6124
|
-
if (selector === ":window") targetEls.push(currentWin);
|
|
6125
|
-
else if (selector === ":document") targetEls.push(currentWin.document);
|
|
6126
|
-
else if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6127
|
-
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6128
|
-
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6129
|
-
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6130
|
-
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6131
|
-
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6132
|
-
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6133
|
-
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6134
|
-
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6135
|
-
else {
|
|
6136
|
-
const roots = [];
|
|
6137
|
-
if (r === "shadow") {
|
|
6138
|
-
if (this.shadowRoot) roots.push(this.shadowRoot);
|
|
6139
|
-
} else if (r === "light") {
|
|
6140
|
-
roots.push(this);
|
|
6141
|
-
} else if (r === "all") {
|
|
6142
|
-
roots.push(this);
|
|
6143
|
-
if (this.shadowRoot) roots.push(this.shadowRoot);
|
|
6144
|
-
} else {
|
|
6145
|
-
roots.push(this.shadowRoot || this);
|
|
6146
|
-
}
|
|
6147
|
-
roots.forEach((root) => targetEls.push(...root.querySelectorAll(selector)));
|
|
6148
|
-
}
|
|
6149
|
-
targetEls.forEach((targetEl) => {
|
|
6150
|
-
if (!targetEl || typeof targetEl.setAttribute !== "function") return;
|
|
6151
|
-
if (res === null) targetEl.removeAttribute(name);
|
|
6152
|
-
else targetEl.setAttribute(name, String(res));
|
|
6153
|
-
});
|
|
6154
|
-
}
|
|
6155
|
-
return res;
|
|
6156
|
-
};
|
|
6157
|
-
};
|
|
6158
|
-
}
|
|
6159
|
-
var getSetAttributeMetadata = (target) => {
|
|
6160
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
6161
|
-
return ReflectUtils.getMetadata(SET_ATTRIBUTE_METADATA_KEY, constructor);
|
|
6162
|
-
};
|
|
6163
|
-
var findAllSetAttributeMetadata = (target) => {
|
|
6164
|
-
const result = /* @__PURE__ */ new Map();
|
|
6165
|
-
const maps = ReflectUtils.findAllMetadata(SET_ATTRIBUTE_METADATA_KEY, target);
|
|
6166
|
-
maps.forEach((map) => {
|
|
6167
|
-
if (map instanceof Map) {
|
|
6168
|
-
map.forEach((v, k) => result.set(k, v));
|
|
6169
|
-
}
|
|
6170
|
-
});
|
|
6171
|
-
return result;
|
|
6172
|
-
};
|
|
6173
|
-
function setAttributeHost(name, options) {
|
|
6174
|
-
return setAttribute(":host", name, options);
|
|
6175
|
-
}
|
|
6176
|
-
|
|
6177
6499
|
// src/decorators/applyNode.ts
|
|
6178
|
-
var APPLY_NODE_METADATA_KEY = Symbol("simple-web-component:apply-node");
|
|
6500
|
+
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
6179
6501
|
var normalizeNodes = (res, doc) => {
|
|
6180
6502
|
const items = Array.isArray(res) ? res : [res];
|
|
6181
6503
|
return items.map((it) => {
|
|
6182
|
-
if (it instanceof Node)
|
|
6183
|
-
return it;
|
|
6504
|
+
if (it instanceof Node) return it;
|
|
6184
6505
|
return doc.createTextNode(it !== void 0 && it !== null ? String(it) : "");
|
|
6185
6506
|
});
|
|
6186
6507
|
};
|
|
6508
|
+
var applyToDom = (targetEl, res, pos, doc) => {
|
|
6509
|
+
if (!targetEl) return;
|
|
6510
|
+
if (pos === "innerHtml") {
|
|
6511
|
+
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
6512
|
+
return;
|
|
6513
|
+
}
|
|
6514
|
+
if (pos === "innerText") {
|
|
6515
|
+
if (targetEl.innerText !== void 0) {
|
|
6516
|
+
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
6517
|
+
}
|
|
6518
|
+
return;
|
|
6519
|
+
}
|
|
6520
|
+
const isShadowRoot = targetEl instanceof ShadowRoot;
|
|
6521
|
+
const nodes = normalizeNodes(res, doc);
|
|
6522
|
+
if (pos === "replace") {
|
|
6523
|
+
if (!isShadowRoot) targetEl.replaceWith(...nodes);
|
|
6524
|
+
} else if (pos === "replaceChildren") {
|
|
6525
|
+
targetEl.replaceChildren(...nodes);
|
|
6526
|
+
} else {
|
|
6527
|
+
if (pos === "beforeEnd") targetEl.append(...nodes);
|
|
6528
|
+
else if (pos === "afterBegin") targetEl.prepend(...nodes);
|
|
6529
|
+
else if (pos === "beforeBegin" && !isShadowRoot) targetEl.before(...nodes);
|
|
6530
|
+
else if (pos === "afterEnd" && !isShadowRoot) targetEl.after(...nodes);
|
|
6531
|
+
}
|
|
6532
|
+
};
|
|
6187
6533
|
function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
6188
|
-
return (
|
|
6189
|
-
const constructor =
|
|
6534
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
6535
|
+
const constructor = targetObj.constructor;
|
|
6190
6536
|
let metaList = ReflectUtils.getOwnMetadata(APPLY_NODE_METADATA_KEY, constructor);
|
|
6191
6537
|
if (!metaList) {
|
|
6192
6538
|
metaList = /* @__PURE__ */ new Map();
|
|
@@ -6194,81 +6540,58 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6194
6540
|
}
|
|
6195
6541
|
metaList.set(propertyKey, { propertyKey, selector, options });
|
|
6196
6542
|
const original = descriptor.value;
|
|
6197
|
-
descriptor.value =
|
|
6543
|
+
descriptor.value = function(...args) {
|
|
6198
6544
|
ensureInit2(this);
|
|
6199
|
-
const
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
const pos = options.position || "beforeEnd";
|
|
6545
|
+
const conf = getElementConfig(this);
|
|
6546
|
+
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6547
|
+
const currentDoc = currentWin.document;
|
|
6548
|
+
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
6549
|
+
const getTarget = () => {
|
|
6205
6550
|
const r = options.root || "auto";
|
|
6206
|
-
const
|
|
6207
|
-
if (
|
|
6208
|
-
|
|
6209
|
-
if (r === "
|
|
6210
|
-
|
|
6211
|
-
if (r === "all")
|
|
6212
|
-
|
|
6213
|
-
return this.shadowRoot || this;
|
|
6551
|
+
const applyRoot = (t) => {
|
|
6552
|
+
if (!t) return t;
|
|
6553
|
+
if (r === "auto") return t.shadowRoot || t;
|
|
6554
|
+
if (r === "shadow") return t.shadowRoot;
|
|
6555
|
+
if (r === "light") return t;
|
|
6556
|
+
if (r === "all") return t.shadowRoot || t;
|
|
6557
|
+
return t;
|
|
6214
6558
|
};
|
|
6215
|
-
if (
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
} else {
|
|
6237
|
-
targetEl = this;
|
|
6238
|
-
}
|
|
6239
|
-
} else {
|
|
6240
|
-
const targetRoot = getTargetRoot();
|
|
6241
|
-
targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6242
|
-
}
|
|
6243
|
-
if (targetEl) {
|
|
6244
|
-
const isShadowRoot = targetEl instanceof ShadowRoot;
|
|
6245
|
-
const nodes = normalizeNodes(res, currentDoc);
|
|
6246
|
-
if (pos === "replace") {
|
|
6247
|
-
if (!isShadowRoot) {
|
|
6248
|
-
targetEl.replaceWith(...nodes);
|
|
6249
|
-
}
|
|
6250
|
-
} else if (pos === "replaceChildren") {
|
|
6251
|
-
targetEl.replaceChildren(...nodes);
|
|
6252
|
-
} else if (pos === "innerHtml") {
|
|
6253
|
-
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
6254
|
-
} else if (pos === "innerText") {
|
|
6255
|
-
if (targetEl.innerText !== void 0) {
|
|
6256
|
-
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
6257
|
-
}
|
|
6258
|
-
} else {
|
|
6259
|
-
if (pos === "beforeEnd")
|
|
6260
|
-
targetEl.append(...nodes);
|
|
6261
|
-
else if (pos === "afterBegin")
|
|
6262
|
-
targetEl.prepend(...nodes);
|
|
6263
|
-
else if (pos === "beforeBegin" && !isShadowRoot)
|
|
6264
|
-
targetEl.before(...nodes);
|
|
6265
|
-
else if (pos === "afterEnd" && !isShadowRoot)
|
|
6266
|
-
targetEl.after(...nodes);
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6559
|
+
if (selector === ":host") return applyRoot(this);
|
|
6560
|
+
if (selector === ":parentHost") return applyRoot(hostSet.$parentHost);
|
|
6561
|
+
if (selector === ":appHost") return applyRoot(hostSet.$appHost);
|
|
6562
|
+
if (selector === ":firstHost") return applyRoot(hostSet.$firstHost);
|
|
6563
|
+
if (selector === ":lastHost") return applyRoot(hostSet.$lastHost);
|
|
6564
|
+
const targetRoot = applyRoot(this);
|
|
6565
|
+
return targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6566
|
+
};
|
|
6567
|
+
const targetEl = getTarget();
|
|
6568
|
+
const res = original.apply(this, args);
|
|
6569
|
+
const runApply = (target, val) => {
|
|
6570
|
+
const pos = options.position || "beforeEnd";
|
|
6571
|
+
const defaultFilter = (t, v) => {
|
|
6572
|
+
if (v instanceof Node) return !t.contains(v);
|
|
6573
|
+
if (pos === "innerHtml" && typeof v === "string") return t.innerHTML !== v;
|
|
6574
|
+
if (pos === "replaceChildren" && v instanceof Node) return !t.contains(v);
|
|
6575
|
+
return true;
|
|
6576
|
+
};
|
|
6577
|
+
const activeFilter = options.filter || defaultFilter;
|
|
6578
|
+
if (activeFilter(target, val, hostSet)) {
|
|
6579
|
+
applyToDom(target, val, pos, currentDoc);
|
|
6269
6580
|
}
|
|
6581
|
+
};
|
|
6582
|
+
if (res instanceof Promise) {
|
|
6583
|
+
if (targetEl && options.loading) {
|
|
6584
|
+
const loadingRes = options.loading.call(this, hostSet);
|
|
6585
|
+
applyToDom(targetEl, loadingRes, options.position || "beforeEnd", currentDoc);
|
|
6586
|
+
}
|
|
6587
|
+
return res.then((finalRes) => {
|
|
6588
|
+
if (finalRes !== void 0 && targetEl) runApply(targetEl, finalRes);
|
|
6589
|
+
return finalRes;
|
|
6590
|
+
});
|
|
6591
|
+
} else {
|
|
6592
|
+
if (res !== void 0 && targetEl) runApply(targetEl, res);
|
|
6593
|
+
return res;
|
|
6270
6594
|
}
|
|
6271
|
-
return res;
|
|
6272
6595
|
};
|
|
6273
6596
|
};
|
|
6274
6597
|
}
|
|
@@ -6282,30 +6605,30 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6282
6605
|
});
|
|
6283
6606
|
return result;
|
|
6284
6607
|
};
|
|
6285
|
-
function applyNodeHost(
|
|
6286
|
-
return applyNode(":host",
|
|
6608
|
+
function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6609
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
|
|
6610
|
+
const opt = targetOrOptions || {};
|
|
6611
|
+
return applyNode(":host", { position: "beforeEnd", ...opt });
|
|
6612
|
+
}
|
|
6613
|
+
function applyReplaceChildrenNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6614
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "replaceChildren" })(targetOrOptions, propertyKey, descriptor);
|
|
6615
|
+
const opt = targetOrOptions || {};
|
|
6616
|
+
return applyNode(":host", { position: "replaceChildren", ...opt });
|
|
6617
|
+
}
|
|
6618
|
+
function applyInnerHtmlNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6619
|
+
if (propertyKey !== void 0) return applyNode(":host", { position: "innerHtml" })(targetOrOptions, propertyKey, descriptor);
|
|
6620
|
+
const opt = targetOrOptions || {};
|
|
6621
|
+
return applyNode(":host", { position: "innerHtml", ...opt });
|
|
6622
|
+
}
|
|
6623
|
+
function applyReplaceChildrenNode(selector, options = {}) {
|
|
6624
|
+
return applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6625
|
+
}
|
|
6626
|
+
function applyInnerHtmlNode(selector, options = {}) {
|
|
6627
|
+
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
6287
6628
|
}
|
|
6288
|
-
var applyBeforeBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeBegin" });
|
|
6289
|
-
var applyAfterBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterBegin" });
|
|
6290
|
-
var applyBeforeEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeEnd" });
|
|
6291
|
-
var applyAfterEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterEnd" });
|
|
6292
|
-
var applyReplaceNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replace" });
|
|
6293
|
-
var applyReplaceChildrenNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6294
|
-
var applyInnerHtmlNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerHtml" });
|
|
6295
|
-
var applyInnerTextNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerText" });
|
|
6296
|
-
var applyRemoveNode = (selector, options = {}) => applyNode(selector, { ...options, position: "remove" });
|
|
6297
|
-
var applyBeforeBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeBegin" });
|
|
6298
|
-
var applyAfterBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterBegin" });
|
|
6299
|
-
var applyBeforeEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeEnd" });
|
|
6300
|
-
var applyAfterEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterEnd" });
|
|
6301
|
-
var applyReplaceNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replace" });
|
|
6302
|
-
var applyReplaceChildrenNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replaceChildren" });
|
|
6303
|
-
var applyInnerHtmlNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerHtml" });
|
|
6304
|
-
var applyInnerTextNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerText" });
|
|
6305
|
-
var applyRemoveNodeHost = (options = {}) => applyNode(":host", { ...options, position: "remove" });
|
|
6306
6629
|
|
|
6307
6630
|
// src/decorators/query.ts
|
|
6308
|
-
var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
|
|
6631
|
+
var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
6309
6632
|
function query(selectorOrTarget, options = {}) {
|
|
6310
6633
|
return (targetObj, propertyKey, descriptor) => {
|
|
6311
6634
|
if (descriptor !== void 0) {
|
|
@@ -6403,12 +6726,80 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6403
6726
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6404
6727
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
6405
6728
|
};
|
|
6406
|
-
function queryHost(
|
|
6407
|
-
|
|
6729
|
+
function queryHost(targetOrOptions, propertyKey) {
|
|
6730
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6731
|
+
return query(":host", {})(targetOrOptions, propertyKey);
|
|
6732
|
+
}
|
|
6733
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6734
|
+
return query(":host", targetOrOptions);
|
|
6735
|
+
} else {
|
|
6736
|
+
return query(":host", {});
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
var host = queryHost;
|
|
6740
|
+
function parentHost(targetOrOptions, propertyKey) {
|
|
6741
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6742
|
+
return query(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6743
|
+
}
|
|
6744
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6745
|
+
return query(":parentHost", targetOrOptions);
|
|
6746
|
+
} else {
|
|
6747
|
+
return query(":parentHost", {});
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
function appHost(targetOrOptions, propertyKey) {
|
|
6751
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6752
|
+
return query(":appHost", {})(targetOrOptions, propertyKey);
|
|
6753
|
+
}
|
|
6754
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6755
|
+
return query(":appHost", targetOrOptions);
|
|
6756
|
+
} else {
|
|
6757
|
+
return query(":appHost", {});
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
function firstHost(targetOrOptions, propertyKey) {
|
|
6761
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6762
|
+
return query(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6763
|
+
}
|
|
6764
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6765
|
+
return query(":firstHost", targetOrOptions);
|
|
6766
|
+
} else {
|
|
6767
|
+
return query(":firstHost", {});
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
function lastHost(targetOrOptions, propertyKey) {
|
|
6771
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6772
|
+
return query(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6773
|
+
}
|
|
6774
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6775
|
+
return query(":lastHost", targetOrOptions);
|
|
6776
|
+
} else {
|
|
6777
|
+
return query(":lastHost", {});
|
|
6778
|
+
}
|
|
6779
|
+
}
|
|
6780
|
+
function firstAppHost(targetOrOptions, propertyKey) {
|
|
6781
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6782
|
+
return query(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6783
|
+
}
|
|
6784
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6785
|
+
return query(":firstAppHost", targetOrOptions);
|
|
6786
|
+
} else {
|
|
6787
|
+
return query(":firstAppHost", {});
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
function lastAppHost(targetOrOptions, propertyKey) {
|
|
6791
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6792
|
+
return query(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6793
|
+
}
|
|
6794
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6795
|
+
return query(":lastAppHost", targetOrOptions);
|
|
6796
|
+
} else {
|
|
6797
|
+
return query(":lastAppHost", {});
|
|
6798
|
+
}
|
|
6408
6799
|
}
|
|
6409
6800
|
|
|
6410
6801
|
// src/decorators/queryAll.ts
|
|
6411
|
-
var QUERY_ALL_METADATA_KEY = Symbol("simple-web-component:query-all");
|
|
6802
|
+
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
6412
6803
|
function queryAll(selectorOrTarget, options = {}) {
|
|
6413
6804
|
return (targetObj, propertyKey, descriptor) => {
|
|
6414
6805
|
if (descriptor !== void 0) {
|
|
@@ -6503,101 +6894,197 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6503
6894
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6504
6895
|
return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
6505
6896
|
};
|
|
6506
|
-
function queryAllHost(
|
|
6507
|
-
|
|
6897
|
+
function queryAllHost(targetOrOptions, propertyKey) {
|
|
6898
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6899
|
+
return queryAll(":host", {})(targetOrOptions, propertyKey);
|
|
6900
|
+
}
|
|
6901
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6902
|
+
return queryAll(":host", targetOrOptions);
|
|
6903
|
+
} else {
|
|
6904
|
+
return queryAll(":host", {});
|
|
6905
|
+
}
|
|
6508
6906
|
}
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6907
|
+
var allHost = queryAllHost;
|
|
6908
|
+
function allParentHost(targetOrOptions, propertyKey) {
|
|
6909
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6910
|
+
return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6911
|
+
}
|
|
6912
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6913
|
+
return queryAll(":parentHost", targetOrOptions);
|
|
6914
|
+
} else {
|
|
6915
|
+
return queryAll(":parentHost", {});
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6918
|
+
function allAppHost(targetOrOptions, propertyKey) {
|
|
6919
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6920
|
+
return queryAll(":appHost", {})(targetOrOptions, propertyKey);
|
|
6921
|
+
}
|
|
6922
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6923
|
+
return queryAll(":appHost", targetOrOptions);
|
|
6924
|
+
} else {
|
|
6925
|
+
return queryAll(":appHost", {});
|
|
6926
|
+
}
|
|
6927
|
+
}
|
|
6928
|
+
function allFirstHost(targetOrOptions, propertyKey) {
|
|
6929
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6930
|
+
return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6931
|
+
}
|
|
6932
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6933
|
+
return queryAll(":firstHost", targetOrOptions);
|
|
6934
|
+
} else {
|
|
6935
|
+
return queryAll(":firstHost", {});
|
|
6936
|
+
}
|
|
6937
|
+
}
|
|
6938
|
+
function allLastHost(targetOrOptions, propertyKey) {
|
|
6939
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6940
|
+
return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6941
|
+
}
|
|
6942
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6943
|
+
return queryAll(":lastHost", targetOrOptions);
|
|
6944
|
+
} else {
|
|
6945
|
+
return queryAll(":lastHost", {});
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
function allFirstAppHost(targetOrOptions, propertyKey) {
|
|
6949
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6950
|
+
return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6951
|
+
}
|
|
6952
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6953
|
+
return queryAll(":firstAppHost", targetOrOptions);
|
|
6954
|
+
} else {
|
|
6955
|
+
return queryAll(":firstAppHost", {});
|
|
6956
|
+
}
|
|
6957
|
+
}
|
|
6958
|
+
function allLastAppHost(targetOrOptions, propertyKey) {
|
|
6959
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6960
|
+
return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6961
|
+
}
|
|
6962
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6963
|
+
return queryAll(":lastAppHost", targetOrOptions);
|
|
6964
|
+
} else {
|
|
6965
|
+
return queryAll(":lastAppHost", {});
|
|
6966
|
+
}
|
|
6967
|
+
}
|
|
6968
|
+
|
|
6969
|
+
// src/decorators/applyClass.ts
|
|
6970
|
+
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
6971
|
+
function createClassDecorator(action) {
|
|
6972
|
+
return (selector, classMapOrOptions, options = {}) => {
|
|
6973
|
+
return (target, propertyKey, descriptor) => {
|
|
6974
|
+
const constructor = target.constructor;
|
|
6975
|
+
let metaList = ReflectUtils.getOwnMetadata(CLASS_METADATA_KEY, constructor);
|
|
6976
|
+
if (!metaList) {
|
|
6977
|
+
metaList = /* @__PURE__ */ new Map();
|
|
6978
|
+
ReflectUtils.defineMetadata(CLASS_METADATA_KEY, metaList, constructor);
|
|
6979
|
+
}
|
|
6980
|
+
let classMap = void 0;
|
|
6981
|
+
let finalOptions = options;
|
|
6982
|
+
if (typeof classMapOrOptions === "string" || typeof classMapOrOptions === "object" && classMapOrOptions !== null && !("root" in classMapOrOptions)) {
|
|
6983
|
+
classMap = classMapOrOptions;
|
|
6984
|
+
} else if (typeof classMapOrOptions === "object" && classMapOrOptions !== null && "root" in classMapOrOptions) {
|
|
6985
|
+
finalOptions = classMapOrOptions;
|
|
6986
|
+
}
|
|
6987
|
+
metaList.set(propertyKey, { propertyKey, selector, action, options: finalOptions });
|
|
6988
|
+
const original = descriptor.value;
|
|
6989
|
+
descriptor.value = async function(...args) {
|
|
6990
|
+
ensureInit2(this);
|
|
6525
6991
|
const res = await original.apply(this, args);
|
|
6526
6992
|
if (res !== void 0) {
|
|
6527
|
-
const
|
|
6528
|
-
const
|
|
6993
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
6994
|
+
const host2 = this;
|
|
6995
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
6996
|
+
const r = finalOptions.root || "auto";
|
|
6529
6997
|
const targetEls = [];
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
if (
|
|
6548
|
-
} else {
|
|
6549
|
-
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6550
|
-
if (found) targetEls.push(...found);
|
|
6998
|
+
const applyRoot = (t) => {
|
|
6999
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
7000
|
+
targetEls.push(t);
|
|
7001
|
+
};
|
|
7002
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
7003
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
7004
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
7005
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
7006
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
7007
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
7008
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
7009
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
7010
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
7011
|
+
else {
|
|
7012
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
7013
|
+
if (targetRoot) {
|
|
7014
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
7015
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6551
7016
|
}
|
|
6552
7017
|
}
|
|
6553
7018
|
targetEls.forEach((targetEl) => {
|
|
7019
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
6554
7020
|
if (action === "set") {
|
|
6555
7021
|
let classes = "";
|
|
6556
|
-
if (typeof
|
|
6557
|
-
classes =
|
|
7022
|
+
if (classMap && typeof classMap === "string") {
|
|
7023
|
+
classes = resolvedRes ? classMap : "";
|
|
7024
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7025
|
+
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls]) => cls).join(" ");
|
|
6558
7026
|
} else {
|
|
6559
|
-
classes = Array.isArray(
|
|
7027
|
+
classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
|
|
6560
7028
|
}
|
|
6561
7029
|
targetEl.className = classes;
|
|
6562
|
-
} else if (action === "update") {
|
|
6563
|
-
if (typeof
|
|
6564
|
-
|
|
6565
|
-
|
|
7030
|
+
} else if (action === "update" || action === "toggle") {
|
|
7031
|
+
if (classMap && typeof classMap === "string") {
|
|
7032
|
+
targetEl.classList.toggle(classMap, !!resolvedRes);
|
|
7033
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7034
|
+
Object.entries(resolvedRes).forEach(([cls, force]) => {
|
|
7035
|
+
const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
7036
|
+
targetEl.classList.toggle(cls, isActive);
|
|
6566
7037
|
});
|
|
6567
|
-
} else
|
|
6568
|
-
const classes = Array.isArray(
|
|
6569
|
-
targetEl.classList.add(...classes);
|
|
7038
|
+
} else {
|
|
7039
|
+
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
7040
|
+
if (action === "update") targetEl.classList.add(...classes);
|
|
7041
|
+
else classes.forEach((c) => targetEl.classList.toggle(c));
|
|
7042
|
+
}
|
|
7043
|
+
} else if (action === "add" || action === "remove") {
|
|
7044
|
+
if (classMap && typeof classMap === "string" && !!resolvedRes) {
|
|
7045
|
+
if (action === "add") targetEl.classList.add(classMap);
|
|
7046
|
+
else targetEl.classList.remove(classMap);
|
|
7047
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7048
|
+
Object.entries(resolvedRes).forEach(([cls, force]) => {
|
|
7049
|
+
const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
7050
|
+
if (shouldExecute) {
|
|
7051
|
+
if (action === "add") targetEl.classList.add(cls);
|
|
7052
|
+
else targetEl.classList.remove(cls);
|
|
7053
|
+
}
|
|
7054
|
+
});
|
|
7055
|
+
} else {
|
|
7056
|
+
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
7057
|
+
if (action === "add") targetEl.classList.add(...classes);
|
|
7058
|
+
else targetEl.classList.remove(...classes);
|
|
6570
7059
|
}
|
|
6571
|
-
} else if (action === "add") {
|
|
6572
|
-
const classes = Array.isArray(res) ? res.map(String) : [String(res)];
|
|
6573
|
-
targetEl.classList.add(...classes);
|
|
6574
|
-
} else if (action === "remove") {
|
|
6575
|
-
const classes = Array.isArray(res) ? res.map(String) : [String(res)];
|
|
6576
|
-
targetEl.classList.remove(...classes);
|
|
6577
|
-
} else if (action === "toggle") {
|
|
6578
|
-
const classes = Array.isArray(res) ? res.map(String) : [String(res)];
|
|
6579
|
-
classes.forEach((c) => targetEl.classList.toggle(c));
|
|
6580
7060
|
}
|
|
6581
7061
|
});
|
|
6582
7062
|
}
|
|
6583
7063
|
return res;
|
|
6584
7064
|
};
|
|
7065
|
+
return descriptor;
|
|
6585
7066
|
};
|
|
6586
7067
|
};
|
|
6587
7068
|
}
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
var
|
|
6592
|
-
var
|
|
6593
|
-
var
|
|
6594
|
-
var
|
|
6595
|
-
var
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
7069
|
+
function applyClass(selector, action = "update", options = {}) {
|
|
7070
|
+
return createClassDecorator(action)(selector, options);
|
|
7071
|
+
}
|
|
7072
|
+
var setClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("set")(selector, classMapOrOptions, options);
|
|
7073
|
+
var updateClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("update")(selector, classMapOrOptions, options);
|
|
7074
|
+
var addClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("add")(selector, classMapOrOptions, options);
|
|
7075
|
+
var removeClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("remove")(selector, classMapOrOptions, options);
|
|
7076
|
+
var toggleClass = (selector, classMapOrOptions, options = {}) => createClassDecorator("toggle")(selector, classMapOrOptions, options);
|
|
7077
|
+
function applyClassHost(action = "update", options = {}) {
|
|
7078
|
+
return createClassDecorator(action)(":host", options);
|
|
7079
|
+
}
|
|
7080
|
+
var setClassHost = (classMapOrOptions, options = {}) => createClassDecorator("set")(":host", classMapOrOptions, options);
|
|
7081
|
+
var updateClassHost = (classMapOrOptions, options = {}) => createClassDecorator("update")(":host", classMapOrOptions, options);
|
|
7082
|
+
var addClassHost = (classMapOrOptions, options = {}) => createClassDecorator("add")(":host", classMapOrOptions, options);
|
|
7083
|
+
var removeClassHost = (classMapOrOptions, options = {}) => createClassDecorator("remove")(":host", classMapOrOptions, options);
|
|
7084
|
+
var toggleClassHost = (classMapOrOptions, options = {}) => createClassDecorator("toggle")(":host", classMapOrOptions, options);
|
|
7085
|
+
var findAllClassMetadata = (target) => {
|
|
6599
7086
|
const result = /* @__PURE__ */ new Map();
|
|
6600
|
-
const maps = ReflectUtils.findAllMetadata(
|
|
7087
|
+
const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
|
|
6601
7088
|
maps.forEach((map) => {
|
|
6602
7089
|
if (map instanceof Map) {
|
|
6603
7090
|
map.forEach((v, k) => result.set(k, v));
|
|
@@ -6606,8 +7093,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6606
7093
|
return result;
|
|
6607
7094
|
};
|
|
6608
7095
|
|
|
6609
|
-
// src/decorators/
|
|
6610
|
-
var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
|
|
7096
|
+
// src/decorators/applyStyle.ts
|
|
7097
|
+
var STYLE_METADATA_KEY = Symbol.for("simple-web-component:style");
|
|
6611
7098
|
function createStyleDecorator(action) {
|
|
6612
7099
|
return (selector, options = {}) => {
|
|
6613
7100
|
return (target, propertyKey, descriptor) => {
|
|
@@ -6623,60 +7110,79 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6623
7110
|
ensureInit2(this);
|
|
6624
7111
|
const res = await original.apply(this, args);
|
|
6625
7112
|
if (res !== void 0) {
|
|
7113
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
7114
|
+
const host2 = this;
|
|
7115
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
6626
7116
|
const r = options.root || "auto";
|
|
6627
|
-
const hostSet = SwcUtils.getHostSet(this);
|
|
6628
7117
|
const targetEls = [];
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
if (
|
|
6647
|
-
} else {
|
|
6648
|
-
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6649
|
-
if (found) targetEls.push(...found);
|
|
7118
|
+
const applyRoot = (t) => {
|
|
7119
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
7120
|
+
targetEls.push(t);
|
|
7121
|
+
};
|
|
7122
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
7123
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
7124
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
7125
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
7126
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
7127
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
7128
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
7129
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
7130
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
7131
|
+
else {
|
|
7132
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
7133
|
+
if (targetRoot) {
|
|
7134
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
7135
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6650
7136
|
}
|
|
6651
7137
|
}
|
|
6652
7138
|
targetEls.forEach((targetEl) => {
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
if (
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
7139
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
7140
|
+
if (action === "set" || action === "update") {
|
|
7141
|
+
if (action === "set") targetEl.style.cssText = "";
|
|
7142
|
+
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7143
|
+
Object.entries(resolvedRes).forEach(([prop, val]) => {
|
|
7144
|
+
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
7145
|
+
if (finalVal === null || finalVal === void 0) {
|
|
7146
|
+
targetEl.style.removeProperty(prop);
|
|
7147
|
+
} else {
|
|
7148
|
+
targetEl.style[prop] = String(finalVal);
|
|
7149
|
+
}
|
|
7150
|
+
});
|
|
7151
|
+
} else if (typeof resolvedRes === "string") {
|
|
7152
|
+
targetEl.style.cssText = resolvedRes;
|
|
6663
7153
|
}
|
|
6664
7154
|
} else if (action === "remove") {
|
|
6665
|
-
|
|
6666
|
-
|
|
7155
|
+
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7156
|
+
Object.entries(resolvedRes).forEach(([prop, val]) => {
|
|
7157
|
+
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
7158
|
+
if (shouldRemove) {
|
|
7159
|
+
targetEl.style.removeProperty(prop);
|
|
7160
|
+
}
|
|
7161
|
+
});
|
|
7162
|
+
} else {
|
|
7163
|
+
const props = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
|
|
7164
|
+
props.forEach((p) => targetEl.style.removeProperty(String(p)));
|
|
7165
|
+
}
|
|
6667
7166
|
}
|
|
6668
7167
|
});
|
|
6669
7168
|
}
|
|
6670
7169
|
return res;
|
|
6671
7170
|
};
|
|
7171
|
+
return descriptor;
|
|
6672
7172
|
};
|
|
6673
7173
|
};
|
|
6674
7174
|
}
|
|
7175
|
+
function applyStyle(selector, action = "update", options = {}) {
|
|
7176
|
+
return createStyleDecorator(action)(selector, options);
|
|
7177
|
+
}
|
|
6675
7178
|
var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
|
|
6676
|
-
var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
|
|
6677
7179
|
var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
|
|
6678
|
-
var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
|
|
6679
7180
|
var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
|
|
7181
|
+
function applyStyleHost(action = "update", options = {}) {
|
|
7182
|
+
return createStyleDecorator(action)(":host", options);
|
|
7183
|
+
}
|
|
7184
|
+
var setStyleHost = (options = {}) => createStyleDecorator("set")(":host", options);
|
|
7185
|
+
var updateStyleHost = (options = {}) => createStyleDecorator("update")(":host", options);
|
|
6680
7186
|
var removeStyleHost = (options = {}) => createStyleDecorator("remove")(":host", options);
|
|
6681
7187
|
var findAllStyleMetadata = (target) => {
|
|
6682
7188
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -6689,8 +7195,248 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6689
7195
|
return result;
|
|
6690
7196
|
};
|
|
6691
7197
|
|
|
7198
|
+
// src/decorators/applyAttribute.ts
|
|
7199
|
+
var ATTRIBUTE_APPLY_METADATA_KEY = Symbol.for("simple-web-component:attribute-apply");
|
|
7200
|
+
function createAttributeDecorator(action) {
|
|
7201
|
+
return (selector, nameOrOptions, options = {}) => {
|
|
7202
|
+
return (target, propertyKey, descriptor) => {
|
|
7203
|
+
const constructor = target.constructor;
|
|
7204
|
+
let metaList = ReflectUtils.getOwnMetadata(ATTRIBUTE_APPLY_METADATA_KEY, constructor);
|
|
7205
|
+
if (!metaList) {
|
|
7206
|
+
metaList = /* @__PURE__ */ new Map();
|
|
7207
|
+
ReflectUtils.defineMetadata(ATTRIBUTE_APPLY_METADATA_KEY, metaList, constructor);
|
|
7208
|
+
}
|
|
7209
|
+
let attributeName = typeof nameOrOptions === "string" ? nameOrOptions : void 0;
|
|
7210
|
+
let finalOptions = options;
|
|
7211
|
+
if (typeof nameOrOptions === "object" && nameOrOptions !== null) {
|
|
7212
|
+
finalOptions = nameOrOptions;
|
|
7213
|
+
}
|
|
7214
|
+
metaList.set(propertyKey, {
|
|
7215
|
+
propertyKey,
|
|
7216
|
+
selector,
|
|
7217
|
+
action,
|
|
7218
|
+
options: { ...finalOptions, name: attributeName }
|
|
7219
|
+
});
|
|
7220
|
+
const original = descriptor.value;
|
|
7221
|
+
descriptor.value = async function(...args) {
|
|
7222
|
+
ensureInit2(this);
|
|
7223
|
+
const res = await original.apply(this, args);
|
|
7224
|
+
if (res !== void 0) {
|
|
7225
|
+
const win = this.ownerDocument?.defaultView || window;
|
|
7226
|
+
const host2 = this;
|
|
7227
|
+
const hostSet = { ...SwcUtils.getHelperAndHostSet(win, host2), $this: this };
|
|
7228
|
+
const r = finalOptions.root || "auto";
|
|
7229
|
+
const targetEls = [];
|
|
7230
|
+
const applyRoot = (t) => {
|
|
7231
|
+
if (!t || !(t instanceof win.HTMLElement)) return;
|
|
7232
|
+
targetEls.push(t);
|
|
7233
|
+
};
|
|
7234
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
7235
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
7236
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
7237
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
7238
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
7239
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
7240
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
7241
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
7242
|
+
else if (selector === ":host" || !selector) applyRoot(host2);
|
|
7243
|
+
else {
|
|
7244
|
+
const targetRoot = r === "auto" ? host2.shadowRoot || host2 : r === "shadow" ? host2.shadowRoot : host2;
|
|
7245
|
+
if (targetRoot) {
|
|
7246
|
+
const found = targetRoot.querySelectorAll(selector);
|
|
7247
|
+
if (found) targetEls.push(...Array.from(found));
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
7250
|
+
targetEls.forEach((targetEl) => {
|
|
7251
|
+
const resolvedRes = typeof res === "function" ? res(targetEl, hostSet) : res;
|
|
7252
|
+
if (action === "set" || action === "update") {
|
|
7253
|
+
if (attributeName) {
|
|
7254
|
+
if (resolvedRes === null || resolvedRes === void 0 || resolvedRes === false) {
|
|
7255
|
+
targetEl.removeAttribute(attributeName);
|
|
7256
|
+
} else {
|
|
7257
|
+
targetEl.setAttribute(attributeName, resolvedRes === true ? "" : String(resolvedRes));
|
|
7258
|
+
}
|
|
7259
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7260
|
+
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
7261
|
+
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
7262
|
+
if (finalVal === null || finalVal === void 0 || finalVal === false) {
|
|
7263
|
+
targetEl.removeAttribute(attr);
|
|
7264
|
+
} else {
|
|
7265
|
+
targetEl.setAttribute(attr, finalVal === true ? "" : String(finalVal));
|
|
7266
|
+
}
|
|
7267
|
+
});
|
|
7268
|
+
}
|
|
7269
|
+
} else if (action === "remove") {
|
|
7270
|
+
if (attributeName) {
|
|
7271
|
+
targetEl.removeAttribute(attributeName);
|
|
7272
|
+
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
7273
|
+
Object.entries(resolvedRes).forEach(([attr, val]) => {
|
|
7274
|
+
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
7275
|
+
if (shouldRemove) targetEl.removeAttribute(attr);
|
|
7276
|
+
});
|
|
7277
|
+
} else {
|
|
7278
|
+
const attrs = Array.isArray(resolvedRes) ? resolvedRes : [resolvedRes];
|
|
7279
|
+
attrs.forEach((a) => targetEl.removeAttribute(String(a)));
|
|
7280
|
+
}
|
|
7281
|
+
}
|
|
7282
|
+
});
|
|
7283
|
+
}
|
|
7284
|
+
return res;
|
|
7285
|
+
};
|
|
7286
|
+
return descriptor;
|
|
7287
|
+
};
|
|
7288
|
+
};
|
|
7289
|
+
}
|
|
7290
|
+
function applyAttribute(selector, action = "update", options = {}) {
|
|
7291
|
+
return createAttributeDecorator(action)(selector, options);
|
|
7292
|
+
}
|
|
7293
|
+
var setAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("set")(selector, nameOrOptions, options);
|
|
7294
|
+
var updateAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("update")(selector, nameOrOptions, options);
|
|
7295
|
+
var removeAttribute = (selector, nameOrOptions, options = {}) => createAttributeDecorator("remove")(selector, nameOrOptions, options);
|
|
7296
|
+
function applyAttributeHost(action = "update", options = {}) {
|
|
7297
|
+
return createAttributeDecorator(action)(":host", options);
|
|
7298
|
+
}
|
|
7299
|
+
var setAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("set")(":host", nameOrOptions, options);
|
|
7300
|
+
var updateAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("update")(":host", nameOrOptions, options);
|
|
7301
|
+
var removeAttributeHost = (nameOrOptions, options = {}) => createAttributeDecorator("remove")(":host", nameOrOptions, options);
|
|
7302
|
+
var findAllAttributeApplyMetadata = (target) => {
|
|
7303
|
+
const result = /* @__PURE__ */ new Map();
|
|
7304
|
+
const maps = ReflectUtils.findAllMetadata(ATTRIBUTE_APPLY_METADATA_KEY, target);
|
|
7305
|
+
maps.forEach((map) => {
|
|
7306
|
+
if (map instanceof Map) {
|
|
7307
|
+
map.forEach((v, k) => result.set(k, v));
|
|
7308
|
+
}
|
|
7309
|
+
});
|
|
7310
|
+
return result;
|
|
7311
|
+
};
|
|
7312
|
+
|
|
6692
7313
|
// src/utils/Utils.ts
|
|
6693
|
-
var SWC_NOT_FOUND = Symbol("
|
|
7314
|
+
var SWC_NOT_FOUND = Symbol.for("simple-web-component:not-found");
|
|
7315
|
+
var htmlFragment = (html, doc) => {
|
|
7316
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7317
|
+
if (!d) throw new Error("Document is not available");
|
|
7318
|
+
const template = d.createElement("template");
|
|
7319
|
+
template.innerHTML = html.trim();
|
|
7320
|
+
return template.content;
|
|
7321
|
+
};
|
|
7322
|
+
var textNode = (text, doc) => {
|
|
7323
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7324
|
+
if (!d) throw new Error("Document is not available");
|
|
7325
|
+
return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
|
|
7326
|
+
};
|
|
7327
|
+
var commentNode = (comment, doc) => {
|
|
7328
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7329
|
+
if (!d) throw new Error("Document is not available");
|
|
7330
|
+
return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
|
|
7331
|
+
};
|
|
7332
|
+
var createElement = (tagName, options) => {
|
|
7333
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7334
|
+
if (!d) throw new Error("Document is not available");
|
|
7335
|
+
const el = d.createElement(tagName);
|
|
7336
|
+
if (options?.html) el.innerHTML = options.html;
|
|
7337
|
+
if (options?.attrs) {
|
|
7338
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7339
|
+
}
|
|
7340
|
+
return el;
|
|
7341
|
+
};
|
|
7342
|
+
var htmlDivElement = (html, options) => {
|
|
7343
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7344
|
+
if (!d) throw new Error("Document is not available");
|
|
7345
|
+
const el = d.createElement("div");
|
|
7346
|
+
el.innerHTML = html.trim();
|
|
7347
|
+
if (options?.attrs) {
|
|
7348
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7349
|
+
}
|
|
7350
|
+
return el;
|
|
7351
|
+
};
|
|
7352
|
+
var htmlSpanElement = (html, options) => {
|
|
7353
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7354
|
+
if (!d) throw new Error("Document is not available");
|
|
7355
|
+
const el = d.createElement("span");
|
|
7356
|
+
el.innerHTML = html.trim();
|
|
7357
|
+
if (options?.attrs) {
|
|
7358
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7359
|
+
}
|
|
7360
|
+
return el;
|
|
7361
|
+
};
|
|
7362
|
+
var htmlButtonElement = (html, options) => {
|
|
7363
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7364
|
+
if (!d) throw new Error("Document is not available");
|
|
7365
|
+
const el = d.createElement("button");
|
|
7366
|
+
el.innerHTML = html.trim();
|
|
7367
|
+
if (options?.attrs) {
|
|
7368
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7369
|
+
}
|
|
7370
|
+
return el;
|
|
7371
|
+
};
|
|
7372
|
+
var htmlUlElement = (options) => {
|
|
7373
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7374
|
+
if (!d) throw new Error("Document is not available");
|
|
7375
|
+
const el = d.createElement("ul");
|
|
7376
|
+
if (options?.attrs) {
|
|
7377
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7378
|
+
}
|
|
7379
|
+
return el;
|
|
7380
|
+
};
|
|
7381
|
+
var htmlLiElement = (html, options) => {
|
|
7382
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7383
|
+
if (!d) throw new Error("Document is not available");
|
|
7384
|
+
const el = d.createElement("li");
|
|
7385
|
+
el.innerHTML = html.trim();
|
|
7386
|
+
if (options?.attrs) {
|
|
7387
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7388
|
+
}
|
|
7389
|
+
return el;
|
|
7390
|
+
};
|
|
7391
|
+
var htmlAElement = (html, options) => {
|
|
7392
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7393
|
+
if (!d) throw new Error("Document is not available");
|
|
7394
|
+
const el = d.createElement("a");
|
|
7395
|
+
el.innerHTML = html.trim();
|
|
7396
|
+
if (options?.href) el.href = options.href;
|
|
7397
|
+
if (options?.attrs) {
|
|
7398
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7399
|
+
}
|
|
7400
|
+
return el;
|
|
7401
|
+
};
|
|
7402
|
+
var htmlPElement = (html, options) => {
|
|
7403
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7404
|
+
if (!d) throw new Error("Document is not available");
|
|
7405
|
+
const el = d.createElement("p");
|
|
7406
|
+
el.innerHTML = html.trim();
|
|
7407
|
+
if (options?.attrs) {
|
|
7408
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7409
|
+
}
|
|
7410
|
+
return el;
|
|
7411
|
+
};
|
|
7412
|
+
var htmlHeadingElement = (level, html, options) => {
|
|
7413
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7414
|
+
if (!d) throw new Error("Document is not available");
|
|
7415
|
+
const el = d.createElement(`h${level}`);
|
|
7416
|
+
el.innerHTML = html.trim();
|
|
7417
|
+
if (options?.attrs) {
|
|
7418
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7419
|
+
}
|
|
7420
|
+
return el;
|
|
7421
|
+
};
|
|
7422
|
+
var htmlSectionElement = (options) => {
|
|
7423
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7424
|
+
if (!d) throw new Error("Document is not available");
|
|
7425
|
+
const el = d.createElement("section");
|
|
7426
|
+
if (options?.attrs) {
|
|
7427
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7428
|
+
}
|
|
7429
|
+
return el;
|
|
7430
|
+
};
|
|
7431
|
+
var htmlArticleElement = (options) => {
|
|
7432
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7433
|
+
if (!d) throw new Error("Document is not available");
|
|
7434
|
+
const el = d.createElement("article");
|
|
7435
|
+
if (options?.attrs) {
|
|
7436
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7437
|
+
}
|
|
7438
|
+
return el;
|
|
7439
|
+
};
|
|
6694
7440
|
var SwcUtils;
|
|
6695
7441
|
((SwcUtils2) => {
|
|
6696
7442
|
SwcUtils2.getHelperSet = (win) => {
|
|
@@ -6753,7 +7499,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6753
7499
|
};
|
|
6754
7500
|
SwcUtils2.getAppHosts = (el) => {
|
|
6755
7501
|
const hosts = (0, SwcUtils2.getHosts)(el);
|
|
6756
|
-
return hosts.filter((
|
|
7502
|
+
return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
|
|
6757
7503
|
};
|
|
6758
7504
|
SwcUtils2.getAppHost = (el) => {
|
|
6759
7505
|
const appHosts = (0, SwcUtils2.getAppHosts)(el);
|
|
@@ -6802,7 +7548,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6802
7548
|
})(SwcUtils || (SwcUtils = {}));
|
|
6803
7549
|
|
|
6804
7550
|
// src/decorators/emitCustomEvent.ts
|
|
6805
|
-
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol("simple-web-component:emit-custom-event");
|
|
7551
|
+
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
|
|
6806
7552
|
function emitCustomEvent(selectorOrTarget, type, options = {}) {
|
|
6807
7553
|
return (targetObj, propertyKey, descriptor) => {
|
|
6808
7554
|
const constructor = targetObj.constructor;
|
|
@@ -6871,7 +7617,10 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6871
7617
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6872
7618
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
6873
7619
|
};
|
|
6874
|
-
function emitCustomEventHost(type, options) {
|
|
7620
|
+
function emitCustomEventHost(type, options = {}) {
|
|
7621
|
+
if (!options.attributeName) {
|
|
7622
|
+
options.attributeName = `on-emit-${type}`;
|
|
7623
|
+
}
|
|
6875
7624
|
return emitCustomEvent(":host", type, options);
|
|
6876
7625
|
}
|
|
6877
7626
|
|
|
@@ -6963,7 +7712,46 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6963
7712
|
return this.containers.find(predicate);
|
|
6964
7713
|
}
|
|
6965
7714
|
};
|
|
6966
|
-
var
|
|
7715
|
+
var isTargetSymbol = (config) => {
|
|
7716
|
+
return "symbol" in config && config.symbol !== void 0;
|
|
7717
|
+
};
|
|
7718
|
+
var isTargetType = (config) => {
|
|
7719
|
+
return "type" in config && config.type !== void 0;
|
|
7720
|
+
};
|
|
7721
|
+
var isTargetScheme = (config) => {
|
|
7722
|
+
return "scheme" in config && config.scheme !== void 0;
|
|
7723
|
+
};
|
|
7724
|
+
var isTargetFactory = (config) => {
|
|
7725
|
+
return "factory" in config && typeof config.factory === "function" && !("symbol" in config) && !("type" in config) && !("scheme" in config);
|
|
7726
|
+
};
|
|
7727
|
+
var InjectMetadataKey = Symbol.for("simple-boot:inject-metadata");
|
|
7728
|
+
var injectProcess = (config, target, propertyKey, parameterIndex) => {
|
|
7729
|
+
if (propertyKey && typeof target === "object") {
|
|
7730
|
+
const otarget = target;
|
|
7731
|
+
target = target.constructor;
|
|
7732
|
+
const saves = Reflect.getOwnMetadata(InjectMetadataKey, target, propertyKey) || [];
|
|
7733
|
+
const type = ReflectUtils.getParameterTypes(otarget, propertyKey)[parameterIndex];
|
|
7734
|
+
saves.push({ index: parameterIndex, config, propertyKey, type });
|
|
7735
|
+
ReflectUtils.defineMetadata(InjectMetadataKey, saves, target, propertyKey);
|
|
7736
|
+
} else if (!propertyKey || typeof target === "function") {
|
|
7737
|
+
const existingInjectdParameters = ReflectUtils.getMetadata(InjectMetadataKey, target) || [];
|
|
7738
|
+
const type = ReflectUtils.getParameterTypes(target)[parameterIndex];
|
|
7739
|
+
existingInjectdParameters.push({ index: parameterIndex, config, type });
|
|
7740
|
+
ReflectUtils.defineMetadata(InjectMetadataKey, existingInjectdParameters, target);
|
|
7741
|
+
}
|
|
7742
|
+
};
|
|
7743
|
+
function Inject(configOrTarget, propertyKey, parameterIndex) {
|
|
7744
|
+
if (propertyKey && parameterIndex !== void 0) {
|
|
7745
|
+
injectProcess({}, configOrTarget, propertyKey, parameterIndex);
|
|
7746
|
+
} else {
|
|
7747
|
+
return (target, propertyKey2, parameterIndex2) => {
|
|
7748
|
+
injectProcess(configOrTarget, target, propertyKey2, parameterIndex2);
|
|
7749
|
+
};
|
|
7750
|
+
}
|
|
7751
|
+
}
|
|
7752
|
+
var getInject = (target, propertyKey) => {
|
|
7753
|
+
return ReflectUtils.findMetadata(InjectMetadataKey, target, propertyKey) ?? [];
|
|
7754
|
+
};
|
|
6967
7755
|
|
|
6968
7756
|
// src/types.ts
|
|
6969
7757
|
var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
@@ -6981,7 +7769,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6981
7769
|
})(InjectSituationType || {});
|
|
6982
7770
|
|
|
6983
7771
|
// src/decorators/elementDefine.ts
|
|
6984
|
-
var ELEMENT_CONFIG_KEY = Symbol("simple-web-component:element-config");
|
|
7772
|
+
var ELEMENT_CONFIG_KEY = Symbol.for("simple-web-component:element-config");
|
|
6985
7773
|
var getElementConfig = (target) => {
|
|
6986
7774
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6987
7775
|
return ReflectUtils.getMetadata(ELEMENT_CONFIG_KEY, constructor);
|
|
@@ -7010,9 +7798,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7010
7798
|
if (!(node instanceof HTMLElement)) continue;
|
|
7011
7799
|
const script = node.getAttribute?.(attrName);
|
|
7012
7800
|
if (script && !getElementConfig(node)) {
|
|
7013
|
-
const
|
|
7014
|
-
if (
|
|
7015
|
-
await
|
|
7801
|
+
const host2 = SwcUtils.findNearestSwcHost(node);
|
|
7802
|
+
if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
|
|
7803
|
+
await host2.__swc_executeAttributeEvent(node, attrName, script, event);
|
|
7016
7804
|
event.__swc_handled = true;
|
|
7017
7805
|
break;
|
|
7018
7806
|
}
|
|
@@ -7096,7 +7884,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7096
7884
|
const oldHandler = handlers.get(attrName);
|
|
7097
7885
|
if (oldHandler) el.removeEventListener(eventName, oldHandler);
|
|
7098
7886
|
const handler = async (event) => {
|
|
7099
|
-
console.log("execute handler", event);
|
|
7100
7887
|
const parent = SwcUtils.findNearestSwcHost(el);
|
|
7101
7888
|
const hostSet = SwcUtils.getHostSet(parent || el);
|
|
7102
7889
|
const conf = getElementConfig(this);
|
|
@@ -7117,7 +7904,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7117
7904
|
};
|
|
7118
7905
|
proto.__swc_executeAttributeEvent = async function(el, attrName, script, event) {
|
|
7119
7906
|
ensureInit2(this);
|
|
7120
|
-
console.log("execute handler2", event);
|
|
7121
7907
|
const parent = SwcUtils.findNearestSwcHost(el);
|
|
7122
7908
|
const hostSet = SwcUtils.getHostSet(parent || el);
|
|
7123
7909
|
const conf = getElementConfig(this);
|
|
@@ -7157,12 +7943,22 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7157
7943
|
const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
|
|
7158
7944
|
const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === ":host" || meta.selector === "");
|
|
7159
7945
|
const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
|
|
7160
|
-
const addHostEventListenerList = addEventListenerList.filter((meta) => meta.selector === ":host" || meta.selector === "");
|
|
7161
7946
|
const attrChangeMap = findAllAttributeChangedMetadata(constructor);
|
|
7162
7947
|
const attributeList = findAllAttributeMetadata(constructor);
|
|
7948
|
+
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
7163
7949
|
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"];
|
|
7164
7950
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
7165
|
-
const
|
|
7951
|
+
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
|
|
7952
|
+
const attributeListNames = attributeList.map((it) => it.options.name || String(it.propertyKey));
|
|
7953
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
|
|
7954
|
+
...metadata.observedAttributes ?? [],
|
|
7955
|
+
...attrChangeMap.keys(),
|
|
7956
|
+
...attributeApplyNames,
|
|
7957
|
+
...attributeListNames,
|
|
7958
|
+
...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
|
|
7959
|
+
...swcLifecycleAttributes,
|
|
7960
|
+
...swcOnEvents
|
|
7961
|
+
])];
|
|
7166
7962
|
const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
|
|
7167
7963
|
const proto = constructor.prototype;
|
|
7168
7964
|
setupPrototype(proto);
|
|
@@ -7181,7 +7977,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7181
7977
|
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
7182
7978
|
}
|
|
7183
7979
|
attributeList.forEach((meta) => {
|
|
7184
|
-
const attrName = meta.options.name || String(meta.propertyKey);
|
|
7185
7980
|
if (meta.options.connectedInitialize === true) {
|
|
7186
7981
|
this.__swc_syncing_init = true;
|
|
7187
7982
|
try {
|
|
@@ -7321,22 +8116,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7321
8116
|
}
|
|
7322
8117
|
});
|
|
7323
8118
|
});
|
|
7324
|
-
addHostEventListenerList.forEach((meta) => {
|
|
7325
|
-
const { type, options } = meta;
|
|
7326
|
-
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
7327
|
-
const handler = async (event) => {
|
|
7328
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
7329
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
7330
|
-
if (options.preventDefault) event.preventDefault();
|
|
7331
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
7332
|
-
const args = { event, ...currentHostSet, $el: this, $root: this.getRootNode() };
|
|
7333
|
-
await this[meta.propertyKey](event, currentHostSet, args);
|
|
7334
|
-
};
|
|
7335
|
-
this.addEventListener(type, handler, opts);
|
|
7336
|
-
if (options.removeOnDisconnected === true) {
|
|
7337
|
-
this._boundListeners.push({ target: this, type, handler, options: opts });
|
|
7338
|
-
}
|
|
7339
|
-
});
|
|
7340
8119
|
if (originalConnected) originalConnected.apply(this);
|
|
7341
8120
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
|
|
7342
8121
|
if (aMethods) {
|
|
@@ -7375,67 +8154,1226 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7375
8154
|
if (bMethods) {
|
|
7376
8155
|
for (const m of bMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
7377
8156
|
}
|
|
7378
|
-
if (originalAdopted) originalAdopted.apply(this);
|
|
7379
|
-
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);
|
|
7380
|
-
if (aMethods) {
|
|
7381
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
8157
|
+
if (originalAdopted) originalAdopted.apply(this);
|
|
8158
|
+
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY);
|
|
8159
|
+
if (aMethods) {
|
|
8160
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
8161
|
+
}
|
|
8162
|
+
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
8163
|
+
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
8164
|
+
};
|
|
8165
|
+
const originalAttributeChanged = proto.attributeChangedCallback;
|
|
8166
|
+
proto.attributeChangedCallback = function(name2, old, newVal) {
|
|
8167
|
+
if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
|
|
8168
|
+
const hSet = SwcUtils.getHostSet(this);
|
|
8169
|
+
if (name2.startsWith("swc-on-") && !swcLifecycleAttributes.includes(name2)) {
|
|
8170
|
+
if (newVal !== null) {
|
|
8171
|
+
const eventName = name2.substring(7);
|
|
8172
|
+
this._bindAttributeEvent(this, name2, newVal, eventName);
|
|
8173
|
+
}
|
|
8174
|
+
}
|
|
8175
|
+
const hostCustomEventMeta = emitHostCustomEventList.find((it) => it.options.attributeName === name2);
|
|
8176
|
+
if (hostCustomEventMeta && newVal !== null) {
|
|
8177
|
+
this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
|
|
8178
|
+
}
|
|
8179
|
+
const mKeys = attrChangeMap.get(name2);
|
|
8180
|
+
if (mKeys && Array.isArray(mKeys)) {
|
|
8181
|
+
for (const key of mKeys) this[key](newVal, old, name2, hSet);
|
|
8182
|
+
}
|
|
8183
|
+
};
|
|
8184
|
+
Object.defineProperty(constructor, "observedAttributes", {
|
|
8185
|
+
get: () => mergedObservedAttributes,
|
|
8186
|
+
configurable: true
|
|
8187
|
+
});
|
|
8188
|
+
ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);
|
|
8189
|
+
const registry = metadata.customElementRegistry || win?.customElements;
|
|
8190
|
+
if (registry && !registry.get(metadata.name)) {
|
|
8191
|
+
registry.define(metadata.name, constructor, metadata.extends ? { extends: metadata.extends } : void 0);
|
|
8192
|
+
}
|
|
8193
|
+
return constructor;
|
|
8194
|
+
};
|
|
8195
|
+
|
|
8196
|
+
// ../simple-boot/dist/esm/throwable/SimError.js
|
|
8197
|
+
var SimError = class {
|
|
8198
|
+
constructor(message, name, stack) {
|
|
8199
|
+
this.message = message;
|
|
8200
|
+
this.name = name;
|
|
8201
|
+
this.stack = stack;
|
|
8202
|
+
}
|
|
8203
|
+
};
|
|
8204
|
+
|
|
8205
|
+
// ../simple-boot/dist/esm/throwable/SimNoSuch.js
|
|
8206
|
+
var SimNoSuch = class extends SimError {
|
|
8207
|
+
constructor(message, name, stack) {
|
|
8208
|
+
super(message, name, stack);
|
|
8209
|
+
}
|
|
8210
|
+
};
|
|
8211
|
+
|
|
8212
|
+
// ../simple-boot/dist/esm/decorators/SimDecorator.js
|
|
8213
|
+
var Lifecycle = /* @__PURE__ */ ((Lifecycle2) => {
|
|
8214
|
+
Lifecycle2["Singleton"] = "Singleton";
|
|
8215
|
+
Lifecycle2["Transient"] = "Transient";
|
|
8216
|
+
return Lifecycle2;
|
|
8217
|
+
})(Lifecycle || {});
|
|
8218
|
+
var sims = /* @__PURE__ */ new Map();
|
|
8219
|
+
var containers = /* @__PURE__ */ new Set();
|
|
8220
|
+
var SimMetadataKey = Symbol.for("simple-boot:sim-metadata");
|
|
8221
|
+
var isNotNullObjetInstance = (target) => target != null && target !== void 0 && typeof target === "object";
|
|
8222
|
+
var simProcess = (config, inputTarget) => {
|
|
8223
|
+
const target = (() => {
|
|
8224
|
+
if (typeof inputTarget === "object") {
|
|
8225
|
+
return config.scope === "Singleton" ? inputTarget : ValidUtils.isPlainObject(inputTarget) ? { ...inputTarget } : inputTarget;
|
|
8226
|
+
}
|
|
8227
|
+
if (ValidUtils.isArrowFunction(inputTarget)) {
|
|
8228
|
+
return () => inputTarget();
|
|
8229
|
+
}
|
|
8230
|
+
return inputTarget;
|
|
8231
|
+
})();
|
|
8232
|
+
let targetType;
|
|
8233
|
+
if (isNotNullObjetInstance(target)) {
|
|
8234
|
+
targetType = target.constructor;
|
|
8235
|
+
} else {
|
|
8236
|
+
targetType = target;
|
|
8237
|
+
}
|
|
8238
|
+
config.scope = config?.scope ?? "Singleton";
|
|
8239
|
+
ReflectUtils.defineMetadata(SimMetadataKey, config, targetType);
|
|
8240
|
+
const adding = (targetKey, target2 = targetKey) => {
|
|
8241
|
+
const items = sims.get(targetKey) ?? /* @__PURE__ */ new Set();
|
|
8242
|
+
items.add(target2);
|
|
8243
|
+
sims.set(targetKey, items);
|
|
8244
|
+
};
|
|
8245
|
+
if (Array.isArray(config?.type)) {
|
|
8246
|
+
config?.type.forEach((it) => {
|
|
8247
|
+
adding(it, target);
|
|
8248
|
+
});
|
|
8249
|
+
} else if (config.type) {
|
|
8250
|
+
adding(config?.type, target);
|
|
8251
|
+
} else {
|
|
8252
|
+
adding(target);
|
|
8253
|
+
}
|
|
8254
|
+
};
|
|
8255
|
+
function Sim(configOrTarget) {
|
|
8256
|
+
if (typeof configOrTarget === "function") {
|
|
8257
|
+
simProcess({}, configOrTarget);
|
|
8258
|
+
} else {
|
|
8259
|
+
return (target) => {
|
|
8260
|
+
simProcess(configOrTarget, target);
|
|
8261
|
+
};
|
|
8262
|
+
}
|
|
8263
|
+
}
|
|
8264
|
+
var getSim = (target) => {
|
|
8265
|
+
if (target != null && target !== void 0 && typeof target === "object") {
|
|
8266
|
+
target = Object.getPrototypeOf(target).constructor;
|
|
8267
|
+
}
|
|
8268
|
+
try {
|
|
8269
|
+
return ReflectUtils.getMetadata(SimMetadataKey, target);
|
|
8270
|
+
} catch (e) {
|
|
8271
|
+
}
|
|
8272
|
+
};
|
|
8273
|
+
var PostConstructMetadataKey = Symbol.for("simple-boot:post-construct-metadata");
|
|
8274
|
+
var getPostConstructs = (target) => {
|
|
8275
|
+
return ReflectUtils.getMetadata(PostConstructMetadataKey, target) ?? [];
|
|
8276
|
+
};
|
|
8277
|
+
|
|
8278
|
+
// ../simple-boot/dist/esm/simstance/SimAtomic.js
|
|
8279
|
+
var SimAtomic = class {
|
|
8280
|
+
constructor(type, simstanceManager, config) {
|
|
8281
|
+
this.type = type;
|
|
8282
|
+
this.simstanceManager = simstanceManager;
|
|
8283
|
+
this.config = config;
|
|
8284
|
+
this.value = type.value;
|
|
8285
|
+
}
|
|
8286
|
+
getConfig(key = SimMetadataKey) {
|
|
8287
|
+
return ReflectUtils.getMetadata(key, this.type.originalType);
|
|
8288
|
+
}
|
|
8289
|
+
getConfigs() {
|
|
8290
|
+
return ReflectUtils.getMetadatas(this.type.originalType);
|
|
8291
|
+
}
|
|
8292
|
+
getValue(config) {
|
|
8293
|
+
if (config?.refresh) {
|
|
8294
|
+
this.value = void 0;
|
|
8295
|
+
}
|
|
8296
|
+
if (!this.value) {
|
|
8297
|
+
if (typeof this.type.targetKeyType === "symbol") {
|
|
8298
|
+
this.value = this.simstanceManager.findFirstSim(this.type.targetKeyType)?.getValue();
|
|
8299
|
+
} else {
|
|
8300
|
+
this.value = this.simstanceManager.getOrNewSim({ target: this.type.targetKeyType, originTypeTarget: this.type.originalType, newInstanceCarrier: config?.newInstanceCarrier });
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
return this.value;
|
|
8304
|
+
}
|
|
8305
|
+
};
|
|
8306
|
+
|
|
8307
|
+
// ../simple-boot/dist/esm/SimOption.js
|
|
8308
|
+
var SimOption = class {
|
|
8309
|
+
constructor({ rootRouter, container, cache, advice = [], excludeProxys, proxy, using } = {}) {
|
|
8310
|
+
this.rootRouter = rootRouter;
|
|
8311
|
+
this.container = container;
|
|
8312
|
+
this.advice = advice;
|
|
8313
|
+
this.excludeProxys = excludeProxys;
|
|
8314
|
+
this.proxy = proxy;
|
|
8315
|
+
this.using = using;
|
|
8316
|
+
this.cache = cache;
|
|
8317
|
+
}
|
|
8318
|
+
addAdvicce(advice) {
|
|
8319
|
+
this.advice ?? (this.advice = []);
|
|
8320
|
+
this.advice.push(advice);
|
|
8321
|
+
}
|
|
8322
|
+
setAdvice(...advice) {
|
|
8323
|
+
this.advice = advice;
|
|
8324
|
+
return this;
|
|
8325
|
+
}
|
|
8326
|
+
};
|
|
8327
|
+
|
|
8328
|
+
// ../simple-boot/dist/esm/decorators/MetaDataAtomic.js
|
|
8329
|
+
var MetaDataAtomic = class {
|
|
8330
|
+
constructor(target, metaData) {
|
|
8331
|
+
this.target = target;
|
|
8332
|
+
this.metaData = metaData;
|
|
8333
|
+
}
|
|
8334
|
+
};
|
|
8335
|
+
var MetaDataPropertyAtomic = class extends MetaDataAtomic {
|
|
8336
|
+
constructor(target, metaData, property, parameter) {
|
|
8337
|
+
super(target, metaData);
|
|
8338
|
+
this.property = property;
|
|
8339
|
+
this.parameter = parameter;
|
|
8340
|
+
}
|
|
8341
|
+
call(...parameter) {
|
|
8342
|
+
return this.target[this.property](...parameter);
|
|
8343
|
+
}
|
|
8344
|
+
};
|
|
8345
|
+
|
|
8346
|
+
// ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
|
|
8347
|
+
var AfterMetadataKey = Symbol.for("simple-boot:after-metadata");
|
|
8348
|
+
var BeforeMetadataKey = Symbol.for("simple-boot:before-metadata");
|
|
8349
|
+
var AroundMetadataKey = Symbol.for("simple-boot:around-metadata");
|
|
8350
|
+
var getAfter = (target, propertyKey) => {
|
|
8351
|
+
return ReflectUtils.getMetadata(AfterMetadataKey, target, propertyKey);
|
|
8352
|
+
};
|
|
8353
|
+
var getAfters = (target) => {
|
|
8354
|
+
return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getAfter(target, it), it)).filter((it) => it.metaData !== void 0) || [];
|
|
8355
|
+
};
|
|
8356
|
+
var getProtoAfters = (target, propertyKey, type) => {
|
|
8357
|
+
return getAfters(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
|
|
8358
|
+
};
|
|
8359
|
+
var getBefore = (target, propertyKey) => {
|
|
8360
|
+
return ReflectUtils.getMetadata(BeforeMetadataKey, target, propertyKey);
|
|
8361
|
+
};
|
|
8362
|
+
var getBefores = (target) => {
|
|
8363
|
+
return ObjectUtils.allProtoTypeName(target).map((it) => new MetaDataPropertyAtomic(target, getBefore(target, it), it)).filter((it) => it.metaData !== void 0) || [];
|
|
8364
|
+
};
|
|
8365
|
+
var getProtoBefores = (target, propertyKey, type) => {
|
|
8366
|
+
return getBefores(target).filter((it) => propertyKey === it.metaData?.property && type === it.metaData.type?.prototype) || [];
|
|
8367
|
+
};
|
|
8368
|
+
|
|
8369
|
+
// ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
|
|
8370
|
+
var ExceptionHandlerSituationType = /* @__PURE__ */ ((ExceptionHandlerSituationType2) => {
|
|
8371
|
+
ExceptionHandlerSituationType2["ERROR_OBJECT"] = "SIMPLE_BOOT_CORE://ExceptionHandler/ERROR_OBJECT";
|
|
8372
|
+
ExceptionHandlerSituationType2["PARAMETER"] = "SIMPLE_BOOT_CORE://ExceptionHandler/PARAMETER";
|
|
8373
|
+
return ExceptionHandlerSituationType2;
|
|
8374
|
+
})(ExceptionHandlerSituationType || {});
|
|
8375
|
+
var ExceptionHandlerMetadataKey = Symbol.for("simple-boot:exception-handler-metadata");
|
|
8376
|
+
var getExceptionHandlers = (target) => {
|
|
8377
|
+
if (target !== null && void 0 !== target && typeof target === "object") {
|
|
8378
|
+
target = target.constructor;
|
|
8379
|
+
}
|
|
8380
|
+
return ReflectUtils.getMetadata(ExceptionHandlerMetadataKey, target);
|
|
8381
|
+
};
|
|
8382
|
+
var targetExceptionHandlers = (target, error) => {
|
|
8383
|
+
const exceptionHandlers = getExceptionHandlers(target);
|
|
8384
|
+
const emptyTargets = exceptionHandlers?.filter((it) => it.config.type === void 0);
|
|
8385
|
+
const targets = exceptionHandlers?.filter((it) => ObjectUtils.isPrototypeOfTarget(it.config.type, error));
|
|
8386
|
+
const targetSorts = targets?.sort((a, b) => {
|
|
8387
|
+
const aPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, a.config.type);
|
|
8388
|
+
const bPrototypeOfDepth = ObjectUtils.prototypeOfDepth(error, b.config.type);
|
|
8389
|
+
return aPrototypeOfDepth.length - bPrototypeOfDepth.length;
|
|
8390
|
+
});
|
|
8391
|
+
return (targetSorts ?? []).concat(...emptyTargets ?? []);
|
|
8392
|
+
};
|
|
8393
|
+
var targetExceptionHandler = (target, error, excludeMethods = []) => {
|
|
8394
|
+
let exceptionHandlers = targetExceptionHandlers(target, error);
|
|
8395
|
+
exceptionHandlers = exceptionHandlers?.filter((it) => !excludeMethods.includes(it.method));
|
|
8396
|
+
if (exceptionHandlers && exceptionHandlers.length > 0) {
|
|
8397
|
+
return exceptionHandlers[0];
|
|
8398
|
+
} else {
|
|
8399
|
+
return void 0;
|
|
8400
|
+
}
|
|
8401
|
+
};
|
|
8402
|
+
|
|
8403
|
+
// ../simple-boot/dist/esm/proxy/SimProxyHandler.js
|
|
8404
|
+
var SimProxyHandler = class {
|
|
8405
|
+
constructor(simpleApplication, simstanceManager, simOption) {
|
|
8406
|
+
this.simpleApplication = simpleApplication;
|
|
8407
|
+
this.simstanceManager = simstanceManager;
|
|
8408
|
+
this.simOption = simOption;
|
|
8409
|
+
}
|
|
8410
|
+
// 잘받게 해놨네 ㅋㅋ simstanceManager
|
|
8411
|
+
get(target, name) {
|
|
8412
|
+
if (name === "_SimpleBoot_application") {
|
|
8413
|
+
return this.simpleApplication;
|
|
8414
|
+
} else if (name === "_SimpleBoot_simstanceManager") {
|
|
8415
|
+
return this.simstanceManager;
|
|
8416
|
+
} else if (name === "_SimpleBoot_simOption") {
|
|
8417
|
+
return this.simOption;
|
|
8418
|
+
} else if (name === "_SimpleBoot_origin") {
|
|
8419
|
+
return target;
|
|
8420
|
+
} else {
|
|
8421
|
+
return target[name];
|
|
8422
|
+
}
|
|
8423
|
+
}
|
|
8424
|
+
set(obj, prop, value, receiver) {
|
|
8425
|
+
value = this.simstanceManager?.proxy(value);
|
|
8426
|
+
obj[prop] = value;
|
|
8427
|
+
return true;
|
|
8428
|
+
}
|
|
8429
|
+
apply(target, thisArg, argumentsList) {
|
|
8430
|
+
let r;
|
|
8431
|
+
try {
|
|
8432
|
+
this.aopBefore(thisArg, target);
|
|
8433
|
+
try {
|
|
8434
|
+
r = Reflect.apply(target, thisArg, argumentsList);
|
|
8435
|
+
} catch (e) {
|
|
8436
|
+
throw e;
|
|
8437
|
+
} finally {
|
|
8438
|
+
this.aopAfter(thisArg, target);
|
|
8439
|
+
}
|
|
8440
|
+
} catch (e) {
|
|
8441
|
+
console.error(e);
|
|
8442
|
+
const inHandlers = this.getExceptionHandler(e, thisArg, target);
|
|
8443
|
+
if (inHandlers.length > 0 && inHandlers[0]) {
|
|
8444
|
+
const inHandler = inHandlers[0];
|
|
8445
|
+
this.executeExceptionHandler(e, inHandler, argumentsList);
|
|
8446
|
+
} else {
|
|
8447
|
+
throw e;
|
|
8448
|
+
}
|
|
8449
|
+
}
|
|
8450
|
+
return r;
|
|
8451
|
+
}
|
|
8452
|
+
executeExceptionHandler(e, inHandler, argumentsList) {
|
|
8453
|
+
const otherStorage = /* @__PURE__ */ new Map();
|
|
8454
|
+
otherStorage.set(e.constructor, e);
|
|
8455
|
+
const situationErrorTypeContainer = new SituationTypeContainer({
|
|
8456
|
+
situationType: ExceptionHandlerSituationType.ERROR_OBJECT,
|
|
8457
|
+
data: e
|
|
8458
|
+
});
|
|
8459
|
+
const situationParameterTypeContainer = new SituationTypeContainer({
|
|
8460
|
+
situationType: ExceptionHandlerSituationType.PARAMETER,
|
|
8461
|
+
data: argumentsList
|
|
8462
|
+
});
|
|
8463
|
+
otherStorage.set(SituationTypeContainers, new SituationTypeContainers([situationErrorTypeContainer, situationParameterTypeContainer]));
|
|
8464
|
+
argumentsList?.forEach((it) => {
|
|
8465
|
+
otherStorage.set(it.constructor, it);
|
|
8466
|
+
});
|
|
8467
|
+
try {
|
|
8468
|
+
this.simstanceManager.executeBindParameterSim(
|
|
8469
|
+
{
|
|
8470
|
+
target: inHandler.thisArg,
|
|
8471
|
+
targetKey: inHandler.config.propertyKey
|
|
8472
|
+
},
|
|
8473
|
+
otherStorage
|
|
8474
|
+
);
|
|
8475
|
+
} catch (es) {
|
|
8476
|
+
e = es;
|
|
8477
|
+
}
|
|
8478
|
+
if (inHandler.config.config.throw) {
|
|
8479
|
+
const exceptionHandler = this.getExceptionHandler(e, inHandler.thisArg, inHandler.config.method);
|
|
8480
|
+
if ((exceptionHandler?.length ?? 0) > 0) {
|
|
8481
|
+
this.executeExceptionHandler(e, exceptionHandler[0], argumentsList);
|
|
8482
|
+
}
|
|
8483
|
+
}
|
|
8484
|
+
}
|
|
8485
|
+
getExceptionHandler(e, thisArg, target) {
|
|
8486
|
+
const globalConfigSets = this.simOption.advice.map((it) => this.simstanceManager?.getOrNewSim({ target: it })).filter((it) => it).map((it) => {
|
|
8487
|
+
return { thisArg: it, config: targetExceptionHandler(it, e, [target]) };
|
|
8488
|
+
}) ?? [];
|
|
8489
|
+
const thisConfigSet = { thisArg, config: targetExceptionHandler(thisArg, e, [target]) };
|
|
8490
|
+
const inHandlers = [thisConfigSet, ...globalConfigSets].filter((it) => it && it.config);
|
|
8491
|
+
return inHandlers;
|
|
8492
|
+
}
|
|
8493
|
+
aopBefore(obj, protoType) {
|
|
8494
|
+
const propertyName = ObjectUtils.prototypeName(obj, protoType);
|
|
8495
|
+
if (propertyName && obj) {
|
|
8496
|
+
getProtoBefores(obj, propertyName).forEach((it) => {
|
|
8497
|
+
it.call(obj, protoType, propertyName);
|
|
8498
|
+
});
|
|
8499
|
+
for (let i = 0; i < this.simOption.advice.length; i++) {
|
|
8500
|
+
const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
|
|
8501
|
+
const protoBefores = getProtoBefores(sim, propertyName, Object.getPrototypeOf(obj));
|
|
8502
|
+
protoBefores.forEach((it) => {
|
|
8503
|
+
it.call(obj, protoType, propertyName);
|
|
8504
|
+
});
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
}
|
|
8508
|
+
aopAfter(obj, protoType) {
|
|
8509
|
+
const propertyName = ObjectUtils.prototypeName(obj, protoType);
|
|
8510
|
+
if (propertyName) {
|
|
8511
|
+
getProtoAfters(obj, propertyName).forEach((it) => {
|
|
8512
|
+
it.call(obj, protoType, propertyName);
|
|
8513
|
+
});
|
|
8514
|
+
for (let i = 0; i < this.simOption.advice.length; i++) {
|
|
8515
|
+
const sim = this.simstanceManager?.getOrNewSim({ target: this.simOption.advice[i] });
|
|
8516
|
+
const protoBefores = getProtoAfters(sim, propertyName, Object.getPrototypeOf(obj));
|
|
8517
|
+
protoBefores.forEach((it) => {
|
|
8518
|
+
it.call(obj, protoType, propertyName);
|
|
8519
|
+
});
|
|
8520
|
+
}
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
has(target, key) {
|
|
8524
|
+
if (key === "_SimpleBoot_isProxy") {
|
|
8525
|
+
return true;
|
|
8526
|
+
}
|
|
8527
|
+
return key in target;
|
|
8528
|
+
}
|
|
8529
|
+
};
|
|
8530
|
+
|
|
8531
|
+
// ../simple-boot/dist/esm/lifecycle/OnSimCreate.js
|
|
8532
|
+
var isOnSimCreate = (obj) => {
|
|
8533
|
+
return typeof obj?.onSimCreate === "function";
|
|
8534
|
+
};
|
|
8535
|
+
|
|
8536
|
+
// ../simple-boot/dist/esm/lifecycle/OnSimCreateCompleted.js
|
|
8537
|
+
var isOnSimCreateProxyCompleted = (obj) => {
|
|
8538
|
+
return typeof obj?.onSimCreateProxyCompleted === "function";
|
|
8539
|
+
};
|
|
8540
|
+
|
|
8541
|
+
// ../simple-boot/dist/esm/decorators/SimNoProxy.js
|
|
8542
|
+
var SimNoProxyKey = Symbol.for("simple-boot:sim-no-proxy-metadata");
|
|
8543
|
+
var getSimNoProxy = (target, propertyKey) => {
|
|
8544
|
+
try {
|
|
8545
|
+
if (propertyKey === void 0) {
|
|
8546
|
+
return Reflect.getMetadata(SimNoProxyKey, target);
|
|
8547
|
+
}
|
|
8548
|
+
return Reflect.getMetadata(SimNoProxyKey, target, propertyKey);
|
|
8549
|
+
} catch (e) {
|
|
8550
|
+
return void 0;
|
|
8551
|
+
}
|
|
8552
|
+
};
|
|
8553
|
+
var isSimNoProxy = (target, propertyKey) => {
|
|
8554
|
+
if (target === null || target === void 0) {
|
|
8555
|
+
return false;
|
|
8556
|
+
}
|
|
8557
|
+
return getSimNoProxy(target, propertyKey) === true;
|
|
8558
|
+
};
|
|
8559
|
+
|
|
8560
|
+
// ../simple-boot/dist/esm/simstance/SimstanceManager.js
|
|
8561
|
+
var SimstanceManager = class _SimstanceManager {
|
|
8562
|
+
// private otherInstanceSim?: Map<ConstructorType<any> | Function, any>;
|
|
8563
|
+
constructor(simpleApplication, option) {
|
|
8564
|
+
this.simpleApplication = simpleApplication;
|
|
8565
|
+
this.option = option;
|
|
8566
|
+
this._storage = /* @__PURE__ */ new Map();
|
|
8567
|
+
this.name = "simstanceManager-" + RandomUtils.uuid4();
|
|
8568
|
+
this.setStoreSet(SimpleApplication, this.simpleApplication);
|
|
8569
|
+
this.setStoreSet(_SimstanceManager, this);
|
|
8570
|
+
this.setStoreSet(option.constructor, option);
|
|
8571
|
+
this.setStoreSet(SimOption, option);
|
|
8572
|
+
this.simProxyHandler = new SimProxyHandler(this.simpleApplication, this, option);
|
|
8573
|
+
}
|
|
8574
|
+
get storage() {
|
|
8575
|
+
return this._storage;
|
|
8576
|
+
}
|
|
8577
|
+
getSimAtomics() {
|
|
8578
|
+
const r = [];
|
|
8579
|
+
Array.from(this.storage.entries()).forEach(([targetKeyType, targetMap]) => {
|
|
8580
|
+
r.push(
|
|
8581
|
+
...Array.from(Array.from(targetMap.keys())).map(
|
|
8582
|
+
(sit) => new SimAtomic(
|
|
8583
|
+
{
|
|
8584
|
+
targetKeyType,
|
|
8585
|
+
originalType: sit
|
|
8586
|
+
},
|
|
8587
|
+
this
|
|
8588
|
+
)
|
|
8589
|
+
)
|
|
8590
|
+
);
|
|
8591
|
+
});
|
|
8592
|
+
return r;
|
|
8593
|
+
}
|
|
8594
|
+
getSimConfig(schemeOrSymbol) {
|
|
8595
|
+
const newVar = this.getSimAtomics().filter((it) => {
|
|
8596
|
+
const config = it?.getConfig();
|
|
8597
|
+
const symbols = ConvertUtils.flatArray(config?.symbol);
|
|
8598
|
+
const schemes = ConvertUtils.flatArray(config?.scheme);
|
|
8599
|
+
if (typeof schemeOrSymbol === "symbol") {
|
|
8600
|
+
return schemeOrSymbol && it && symbols.includes(schemeOrSymbol);
|
|
8601
|
+
} else if (typeof schemeOrSymbol === "string") {
|
|
8602
|
+
return schemeOrSymbol && it && schemes.includes(schemeOrSymbol);
|
|
8603
|
+
} else {
|
|
8604
|
+
return false;
|
|
8605
|
+
}
|
|
8606
|
+
}) || [];
|
|
8607
|
+
return newVar;
|
|
8608
|
+
}
|
|
8609
|
+
findSims(data) {
|
|
8610
|
+
let r = [];
|
|
8611
|
+
if (data) {
|
|
8612
|
+
const simAtomics = this.getSimAtomics();
|
|
8613
|
+
r = simAtomics.filter((it) => {
|
|
8614
|
+
let b = false;
|
|
8615
|
+
const config = it.getConfig();
|
|
8616
|
+
const symbols = ConvertUtils.flatArray(config?.symbol).filter(ValidUtils.isDefined);
|
|
8617
|
+
const schemes = ConvertUtils.flatArray(config?.scheme).filter(ValidUtils.isDefined);
|
|
8618
|
+
if (typeof data === "symbol") {
|
|
8619
|
+
b = symbols.includes(data);
|
|
8620
|
+
} else {
|
|
8621
|
+
const { scheme, type } = data;
|
|
8622
|
+
b = (scheme ? schemes.includes(scheme) : true) && (type ? it.type.targetKeyType === type : true);
|
|
8623
|
+
}
|
|
8624
|
+
return b;
|
|
8625
|
+
});
|
|
8626
|
+
}
|
|
8627
|
+
return r;
|
|
8628
|
+
}
|
|
8629
|
+
findFirstSim(data) {
|
|
8630
|
+
if (typeof data === "symbol") {
|
|
8631
|
+
return this.findSims(data)[0];
|
|
8632
|
+
} else {
|
|
8633
|
+
return this.findSims(data)[0];
|
|
8634
|
+
}
|
|
8635
|
+
}
|
|
8636
|
+
findLastSim(data) {
|
|
8637
|
+
if (typeof data === "symbol") {
|
|
8638
|
+
return this.findSims(data).reverse()[0];
|
|
8639
|
+
} else {
|
|
8640
|
+
return this.findSims(data).reverse()[0];
|
|
8641
|
+
}
|
|
8642
|
+
}
|
|
8643
|
+
flatStoreSets() {
|
|
8644
|
+
return new Map(
|
|
8645
|
+
Array.from(this.storage.values()).map((it) => Array.from(it.entries())).flat()
|
|
8646
|
+
);
|
|
8647
|
+
}
|
|
8648
|
+
getStoreSets(targetKey) {
|
|
8649
|
+
const map = this.storage.get(targetKey);
|
|
8650
|
+
const datas = (Array.from(map?.entries?.() ?? []) ?? []).reverse();
|
|
8651
|
+
return datas.map((it) => ({ type: it[0], instance: it[1] }));
|
|
8652
|
+
}
|
|
8653
|
+
getStoreSet(targetKey, target) {
|
|
8654
|
+
const sets = this.getStoreSets(targetKey);
|
|
8655
|
+
let find = sets.find((it) => it.type === target);
|
|
8656
|
+
if (!find && (!target || target === targetKey)) {
|
|
8657
|
+
find = sets.find((it) => it.instance);
|
|
8658
|
+
}
|
|
8659
|
+
if (!find?.instance) {
|
|
8660
|
+
const type = target ?? targetKey;
|
|
8661
|
+
if (typeof type === "object") {
|
|
8662
|
+
const find2 = this.storage.get(type);
|
|
8663
|
+
if (find2) {
|
|
8664
|
+
return { type, instance: type };
|
|
8665
|
+
}
|
|
8666
|
+
}
|
|
8667
|
+
const flatStoreSets = this.flatStoreSets();
|
|
8668
|
+
const data = flatStoreSets.get(type);
|
|
8669
|
+
if (data) {
|
|
8670
|
+
this.setStoreSet(targetKey, data, type);
|
|
8671
|
+
}
|
|
8672
|
+
return { type, instance: data };
|
|
8673
|
+
} else {
|
|
8674
|
+
return find;
|
|
8675
|
+
}
|
|
8676
|
+
}
|
|
8677
|
+
getStoreInstance(targetKey, target) {
|
|
8678
|
+
return this.getStoreSet(targetKey, target)?.instance;
|
|
8679
|
+
}
|
|
8680
|
+
getOrNewSim({ target, originTypeTarget = target, newInstanceCarrier }) {
|
|
8681
|
+
if (target) {
|
|
8682
|
+
const registed = this.getStoreSet(target, originTypeTarget);
|
|
8683
|
+
if (registed?.type && !registed?.instance) {
|
|
8684
|
+
return this.resolve({
|
|
8685
|
+
targetKey: target,
|
|
8686
|
+
target: originTypeTarget,
|
|
8687
|
+
newInstanceCarrier
|
|
8688
|
+
});
|
|
8689
|
+
}
|
|
8690
|
+
return registed?.instance;
|
|
8691
|
+
}
|
|
8692
|
+
}
|
|
8693
|
+
setStoreSet(targetKey, obj, target = targetKey) {
|
|
8694
|
+
const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
|
|
8695
|
+
itemMap.set(target, obj);
|
|
8696
|
+
this.storage.set(targetKey, itemMap);
|
|
8697
|
+
}
|
|
8698
|
+
registerStore(targetKey, regTyps) {
|
|
8699
|
+
const itemMap = this.storage.get(targetKey) ?? /* @__PURE__ */ new Map();
|
|
8700
|
+
regTyps.forEach((it) => {
|
|
8701
|
+
const { type, value } = typeof it === "object" ? { type: it.constructor, value: it } : { type: it, value: void 0 };
|
|
8702
|
+
if (!itemMap.has(type) || value !== void 0 && itemMap.get(type) === void 0) {
|
|
8703
|
+
itemMap.set(type, value);
|
|
8704
|
+
}
|
|
8705
|
+
});
|
|
8706
|
+
this.storage.set(targetKey, itemMap);
|
|
8707
|
+
}
|
|
8708
|
+
// 진입점
|
|
8709
|
+
resolve({ target, targetKey, newInstanceCarrier = { newInstances: [], depth: 0 } }) {
|
|
8710
|
+
const registed = this.getStoreSet(targetKey, target);
|
|
8711
|
+
if (registed?.instance) {
|
|
8712
|
+
return registed.instance;
|
|
8713
|
+
}
|
|
8714
|
+
if (this.storage.has(targetKey) && void 0 === registed?.instance) {
|
|
8715
|
+
newInstanceCarrier.depth++;
|
|
8716
|
+
const newSim = this.newSim({
|
|
8717
|
+
target: registed?.type ?? targetKey,
|
|
8718
|
+
newInstanceCarrier,
|
|
8719
|
+
simCreateAfter: (data) => {
|
|
8720
|
+
if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
|
|
8721
|
+
this.setStoreSet(targetKey, data, target);
|
|
8722
|
+
}
|
|
8723
|
+
}
|
|
8724
|
+
});
|
|
8725
|
+
newInstanceCarrier.depth--;
|
|
8726
|
+
if (newInstanceCarrier.depth === 0) {
|
|
8727
|
+
newInstanceCarrier.newInstances.forEach((it) => {
|
|
8728
|
+
this.callBindPostConstruct(it);
|
|
8729
|
+
});
|
|
8730
|
+
}
|
|
8731
|
+
if (isOnSimCreate(newSim)) {
|
|
8732
|
+
newSim.onSimCreate();
|
|
8733
|
+
}
|
|
8734
|
+
return newSim;
|
|
8735
|
+
}
|
|
8736
|
+
const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
|
|
8737
|
+
console.error(simNoSuch);
|
|
8738
|
+
throw simNoSuch;
|
|
8739
|
+
}
|
|
8740
|
+
newSim({ target, simCreateAfter, otherStorage, newInstanceCarrier }) {
|
|
8741
|
+
const parameters = this.getParameterSim({
|
|
8742
|
+
target,
|
|
8743
|
+
otherStorage,
|
|
8744
|
+
newInstanceCarrier
|
|
8745
|
+
});
|
|
8746
|
+
const r = ValidUtils.isFunction(target) && !target.prototype ? target(...parameters) : new target(...parameters);
|
|
8747
|
+
let p = this.proxy(r);
|
|
8748
|
+
const config = getSim(target);
|
|
8749
|
+
if (config?.proxy) {
|
|
8750
|
+
const proxys = (Array.isArray(config.proxy) ? config.proxy : [config.proxy]).filter(ValidUtils.isDefined);
|
|
8751
|
+
proxys.forEach((it) => {
|
|
8752
|
+
if (typeof it === "object") {
|
|
8753
|
+
p = new Proxy(p, it);
|
|
8754
|
+
} else {
|
|
8755
|
+
const simConfig = getSim(it);
|
|
8756
|
+
p = new Proxy(p, simConfig ? this.getOrNewSim({ target: it }) : this.newSim({ target: it }));
|
|
8757
|
+
}
|
|
8758
|
+
});
|
|
8759
|
+
}
|
|
8760
|
+
newInstanceCarrier?.newInstances.push(p);
|
|
8761
|
+
simCreateAfter?.(p);
|
|
8762
|
+
if (isOnSimCreateProxyCompleted(p)) {
|
|
8763
|
+
p.onSimCreateProxyCompleted(p);
|
|
8764
|
+
}
|
|
8765
|
+
return p;
|
|
8766
|
+
}
|
|
8767
|
+
callBindPostConstruct(obj) {
|
|
8768
|
+
const postConstruct = getPostConstructs(obj);
|
|
8769
|
+
postConstruct.forEach((it) => {
|
|
8770
|
+
obj[it.property](...this.getParameterSim({ target: obj, targetKey: it.property }));
|
|
8771
|
+
});
|
|
8772
|
+
}
|
|
8773
|
+
async executeBindParameterSimPromise({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
|
|
8774
|
+
const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
|
|
8775
|
+
if (typeof target === "object" && targetKey) {
|
|
8776
|
+
const targetMethod = target[targetKey];
|
|
8777
|
+
return targetMethod?.bind(target)?.(...binds);
|
|
8778
|
+
} else if (typeof target === "function" && !targetKey) {
|
|
8779
|
+
return new target(...binds);
|
|
8780
|
+
}
|
|
8781
|
+
}
|
|
8782
|
+
executeBindParameterSim({ target, targetKey, firstCheckMaker, parameterCount, inputParameters }, otherStorage) {
|
|
8783
|
+
const binds = this.getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, parameterCount, inputParameters });
|
|
8784
|
+
if (typeof target === "object" && targetKey) {
|
|
8785
|
+
const targetMethod = target[targetKey];
|
|
8786
|
+
return targetMethod?.bind(target)?.(...binds);
|
|
8787
|
+
} else if (typeof target === "function" && !targetKey) {
|
|
8788
|
+
return new target(...binds);
|
|
8789
|
+
}
|
|
8790
|
+
}
|
|
8791
|
+
getParameterSim({ target, targetKey, firstCheckMaker, otherStorage, newInstanceCarrier, parameterCount, inputParameters = [] }) {
|
|
8792
|
+
const paramTypes = ReflectUtils.getParameterTypes(target, targetKey) || [];
|
|
8793
|
+
let injections = [];
|
|
8794
|
+
const injects = getInject(target, targetKey);
|
|
8795
|
+
const loopCount = Math.max(paramTypes.length, parameterCount ?? 0);
|
|
8796
|
+
const loopArray = new Array(loopCount).fill(void 0);
|
|
8797
|
+
injections = loopArray.map((_, idx) => {
|
|
8798
|
+
const token = paramTypes[idx];
|
|
8799
|
+
const saveInject = injects?.find((it) => it.index === idx);
|
|
8800
|
+
for (const f of firstCheckMaker ?? []) {
|
|
8801
|
+
const firstCheckObj = f({ target, targetKey }, token, idx, saveInject);
|
|
8802
|
+
if (void 0 !== firstCheckObj) {
|
|
8803
|
+
return firstCheckObj;
|
|
8804
|
+
}
|
|
8805
|
+
}
|
|
8806
|
+
if (saveInject) {
|
|
8807
|
+
const inject = saveInject.config;
|
|
8808
|
+
let obj = otherStorage?.get(token);
|
|
8809
|
+
if (token === Array && (isTargetType(inject) || isTargetScheme(inject) || isTargetSymbol(inject))) {
|
|
8810
|
+
const p = [];
|
|
8811
|
+
if (isTargetType(inject) && inject.type) {
|
|
8812
|
+
p.push(
|
|
8813
|
+
...this.getStoreSets(inject.type).map(
|
|
8814
|
+
(it) => this.resolve({
|
|
8815
|
+
targetKey: inject.type,
|
|
8816
|
+
target: it.type,
|
|
8817
|
+
newInstanceCarrier
|
|
8818
|
+
})
|
|
8819
|
+
).reverse()
|
|
8820
|
+
);
|
|
8821
|
+
}
|
|
8822
|
+
if (isTargetSymbol(inject)) {
|
|
8823
|
+
p.push(...this.getSimConfig(inject.symbol).map((it) => it.getValue({ newInstanceCarrier })));
|
|
8824
|
+
}
|
|
8825
|
+
if (isTargetScheme(inject)) {
|
|
8826
|
+
p.push(...this.getSimConfig(inject.scheme).map((it) => it.getValue({ newInstanceCarrier })));
|
|
8827
|
+
}
|
|
8828
|
+
return p;
|
|
8829
|
+
}
|
|
8830
|
+
if (inject.situationType && otherStorage) {
|
|
8831
|
+
const situations = otherStorage.get(SituationTypeContainers);
|
|
8832
|
+
const situation = otherStorage.get(SituationTypeContainer);
|
|
8833
|
+
if (inject.situationType === situation?.situationType) {
|
|
8834
|
+
obj = situation.data;
|
|
8835
|
+
} else if (situations && situations.length > 0) {
|
|
8836
|
+
const find = situations.find((a) => {
|
|
8837
|
+
if (a.index !== void 0) {
|
|
8838
|
+
return a.situationType === inject.situationType && a.index === idx;
|
|
8839
|
+
} else {
|
|
8840
|
+
return a.situationType === inject.situationType;
|
|
8841
|
+
}
|
|
8842
|
+
});
|
|
8843
|
+
if (find) {
|
|
8844
|
+
obj = find.data;
|
|
8845
|
+
}
|
|
8846
|
+
}
|
|
8847
|
+
}
|
|
8848
|
+
if (!obj) {
|
|
8849
|
+
const currentInstance = typeof target === "object" ? target : void 0;
|
|
8850
|
+
if (isTargetFactory(inject)) {
|
|
8851
|
+
obj = inject.factory({
|
|
8852
|
+
instance: currentInstance,
|
|
8853
|
+
methodName: String(targetKey),
|
|
8854
|
+
parameter: inputParameters,
|
|
8855
|
+
application: this.simpleApplication
|
|
8856
|
+
});
|
|
8857
|
+
} else {
|
|
8858
|
+
let findLastSim;
|
|
8859
|
+
if (isTargetSymbol(inject)) {
|
|
8860
|
+
findLastSim = this.findLastSim(inject.symbol);
|
|
8861
|
+
} else if (isTargetType(inject) || isTargetScheme(inject)) {
|
|
8862
|
+
findLastSim = this.findLastSim(inject);
|
|
8863
|
+
}
|
|
8864
|
+
try {
|
|
8865
|
+
obj = findLastSim ? this.resolve({
|
|
8866
|
+
targetKey: findLastSim?.type.targetKeyType ?? token,
|
|
8867
|
+
newInstanceCarrier
|
|
8868
|
+
}) : this.resolve({
|
|
8869
|
+
targetKey: token,
|
|
8870
|
+
newInstanceCarrier
|
|
8871
|
+
});
|
|
8872
|
+
if (inject.factory && obj) {
|
|
8873
|
+
if (typeof inject.factory === "function") {
|
|
8874
|
+
obj = inject.factory({
|
|
8875
|
+
instance: currentInstance,
|
|
8876
|
+
methodName: String(targetKey),
|
|
8877
|
+
parameter: inputParameters,
|
|
8878
|
+
application: this.simpleApplication,
|
|
8879
|
+
injectInstance: obj
|
|
8880
|
+
});
|
|
8881
|
+
}
|
|
8882
|
+
}
|
|
8883
|
+
} catch (e) {
|
|
8884
|
+
if (inject.optional) {
|
|
8885
|
+
return void 0;
|
|
8886
|
+
} else {
|
|
8887
|
+
throw e;
|
|
8888
|
+
}
|
|
8889
|
+
}
|
|
8890
|
+
}
|
|
8891
|
+
}
|
|
8892
|
+
if (inject.proxy && obj) {
|
|
8893
|
+
if (ValidUtils.isConstructor(inject.proxy)) {
|
|
8894
|
+
const handler = getSim(inject.proxy) ? this.getOrNewSim({ target: inject.proxy }) : new inject.proxy();
|
|
8895
|
+
if (handler) {
|
|
8896
|
+
obj = new Proxy(obj, handler);
|
|
8897
|
+
}
|
|
8898
|
+
} else if (typeof inject.proxy === "function") {
|
|
8899
|
+
const handler = inject.proxy({
|
|
8900
|
+
application: this.simpleApplication,
|
|
8901
|
+
instance: obj
|
|
8902
|
+
});
|
|
8903
|
+
if (handler) {
|
|
8904
|
+
obj = new Proxy(obj, handler);
|
|
8905
|
+
}
|
|
8906
|
+
}
|
|
8907
|
+
}
|
|
8908
|
+
return obj;
|
|
8909
|
+
} else {
|
|
8910
|
+
return otherStorage?.get(token) ?? (token ? this.resolve({ targetKey: token, newInstanceCarrier }) : void 0);
|
|
8911
|
+
}
|
|
8912
|
+
});
|
|
8913
|
+
return injections;
|
|
8914
|
+
}
|
|
8915
|
+
proxy(target) {
|
|
8916
|
+
try {
|
|
8917
|
+
const noProxy = isSimNoProxy(target);
|
|
8918
|
+
const isExcludeProxy = this.option.excludeProxys?.some((it) => target instanceof it);
|
|
8919
|
+
if (!noProxy && !isExcludeProxy && target !== null && getSim(target) && typeof target === "object" && !("_SimpleBoot_isProxy" in target)) {
|
|
8920
|
+
for (const key in target) {
|
|
8921
|
+
if (!isSimNoProxy(target, key)) {
|
|
8922
|
+
target[key] = this.proxy(target[key]);
|
|
8923
|
+
}
|
|
8924
|
+
}
|
|
8925
|
+
const protoTypeName = ObjectUtils.ownPropertyNames(target);
|
|
8926
|
+
protoTypeName.filter((it) => typeof target[it] === "function").filter((it) => !isSimNoProxy(target, it)).filter((it) => !("_SimpleBoot_isProxy" in target[it])).forEach((it) => {
|
|
8927
|
+
target[it] = new Proxy(target[it], this.simProxyHandler);
|
|
8928
|
+
});
|
|
8929
|
+
if (this.simProxyHandler) {
|
|
8930
|
+
target = new Proxy(target, this.simProxyHandler);
|
|
8931
|
+
}
|
|
8932
|
+
}
|
|
8933
|
+
if (this.option.proxy) {
|
|
8934
|
+
target = this.option.proxy.onAfterProxy(target);
|
|
8935
|
+
}
|
|
8936
|
+
return target;
|
|
8937
|
+
} catch (e) {
|
|
8938
|
+
console.log("sim proxy error");
|
|
8939
|
+
throw e;
|
|
8940
|
+
}
|
|
8941
|
+
}
|
|
8942
|
+
run(otherInstanceSim = /* @__PURE__ */ new Map()) {
|
|
8943
|
+
for (const [k, v] of Array.from(otherInstanceSim.entries())) {
|
|
8944
|
+
const storageKey = typeof k === "object" && k !== null && "type" in k ? k.type : k;
|
|
8945
|
+
this.registerStore(storageKey, /* @__PURE__ */ new Set([v]));
|
|
8946
|
+
if (typeof k === "object" && k !== null && "symbol" in k && k.symbol) {
|
|
8947
|
+
this.registerStore(k.symbol, /* @__PURE__ */ new Set([v]));
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8950
|
+
const myContainers = ConvertUtils.flatArray(this.option.container).filter(ValidUtils.isDefined);
|
|
8951
|
+
if (!myContainers.includes(this.simpleApplication)) {
|
|
8952
|
+
myContainers.push(this.simpleApplication);
|
|
8953
|
+
}
|
|
8954
|
+
Array.from(sims.entries()).forEach(([type, implementations]) => {
|
|
8955
|
+
const filteredSet = /* @__PURE__ */ new Set();
|
|
8956
|
+
implementations.forEach((impl) => {
|
|
8957
|
+
const config = getSim(impl);
|
|
8958
|
+
const targetContainers = ConvertUtils.flatArray(config?.container).filter(ValidUtils.isDefined);
|
|
8959
|
+
let isInclude = false;
|
|
8960
|
+
if (targetContainers.length <= 0) {
|
|
8961
|
+
isInclude = true;
|
|
8962
|
+
} else {
|
|
8963
|
+
isInclude = myContainers.some((it) => targetContainers.includes(it));
|
|
8964
|
+
}
|
|
8965
|
+
if (isInclude) {
|
|
8966
|
+
filteredSet.add(impl);
|
|
8967
|
+
}
|
|
8968
|
+
});
|
|
8969
|
+
if (filteredSet.size > 0) {
|
|
8970
|
+
this.registerStore(type, filteredSet);
|
|
8971
|
+
}
|
|
8972
|
+
});
|
|
8973
|
+
this.callBindPostConstruct(this);
|
|
8974
|
+
this.getSimAtomics().forEach((it) => {
|
|
8975
|
+
if (it.getConfig()?.autoCreate) {
|
|
8976
|
+
it.getValue();
|
|
8977
|
+
}
|
|
8978
|
+
});
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
|
|
8982
|
+
// ../simple-boot/dist/esm/intent/Intent.js
|
|
8983
|
+
var Intent = class {
|
|
8984
|
+
constructor(uri, data, event) {
|
|
8985
|
+
this.uri = uri;
|
|
8986
|
+
this.data = data;
|
|
8987
|
+
this.event = event;
|
|
8988
|
+
this.sessionData = /* @__PURE__ */ new Map();
|
|
8989
|
+
if (typeof uri === "string") {
|
|
8990
|
+
const match = uri.match(/^Symbol\.for\((.+)\):\/(.*)$/);
|
|
8991
|
+
if (match) {
|
|
8992
|
+
const symbol = Symbol.for(match[1]);
|
|
8993
|
+
this.uri = {
|
|
8994
|
+
symbol,
|
|
8995
|
+
uri: match[2]
|
|
8996
|
+
};
|
|
8997
|
+
}
|
|
8998
|
+
}
|
|
8999
|
+
}
|
|
9000
|
+
get symbols() {
|
|
9001
|
+
if (typeof this.uri === "object") {
|
|
9002
|
+
return Array.isArray(this.uri.symbol) ? this.uri.symbol : [this.uri.symbol];
|
|
9003
|
+
}
|
|
9004
|
+
return void 0;
|
|
9005
|
+
}
|
|
9006
|
+
get scheme() {
|
|
9007
|
+
if (typeof this.uri === "string") {
|
|
9008
|
+
const parts = this.uri.split("://");
|
|
9009
|
+
if (parts.length > 1) {
|
|
9010
|
+
return parts[0];
|
|
9011
|
+
}
|
|
9012
|
+
return void 0;
|
|
9013
|
+
} else {
|
|
9014
|
+
return void 0;
|
|
9015
|
+
}
|
|
9016
|
+
}
|
|
9017
|
+
get paths() {
|
|
9018
|
+
return this.pathname.split("/") ?? [];
|
|
9019
|
+
}
|
|
9020
|
+
get fullPath() {
|
|
9021
|
+
const uri = typeof this.uri === "string" ? this.uri : this.uri.uri;
|
|
9022
|
+
const paths = uri.split("://");
|
|
9023
|
+
return paths[paths.length >= 2 ? 1 : 0] ?? "";
|
|
9024
|
+
}
|
|
9025
|
+
get pathname() {
|
|
9026
|
+
const paths = this.fullPath.split("?");
|
|
9027
|
+
return paths[0];
|
|
9028
|
+
}
|
|
9029
|
+
get query() {
|
|
9030
|
+
const paths = this.fullPath.split("?");
|
|
9031
|
+
return paths[1] ?? "";
|
|
9032
|
+
}
|
|
9033
|
+
getQueryParamDecodeURI(key) {
|
|
9034
|
+
const p = this.queryParamsDecodeURI;
|
|
9035
|
+
if (key) {
|
|
9036
|
+
return p[key];
|
|
9037
|
+
} else {
|
|
9038
|
+
return p;
|
|
9039
|
+
}
|
|
9040
|
+
}
|
|
9041
|
+
getQueryParamDecodeURIFirst(key) {
|
|
9042
|
+
const param = this.getQueryParamDecodeURI(key);
|
|
9043
|
+
if (Array.isArray(param)) {
|
|
9044
|
+
return param[0];
|
|
9045
|
+
} else {
|
|
9046
|
+
return param;
|
|
9047
|
+
}
|
|
9048
|
+
}
|
|
9049
|
+
getQueryParam(key) {
|
|
9050
|
+
const p = this.queryParams;
|
|
9051
|
+
if (key) {
|
|
9052
|
+
return p[key];
|
|
9053
|
+
} else {
|
|
9054
|
+
return p;
|
|
9055
|
+
}
|
|
9056
|
+
}
|
|
9057
|
+
getQueryParamFirst(key) {
|
|
9058
|
+
const param = this.getQueryParam(key);
|
|
9059
|
+
if (Array.isArray(param)) {
|
|
9060
|
+
return param[0];
|
|
9061
|
+
} else {
|
|
9062
|
+
return param;
|
|
9063
|
+
}
|
|
9064
|
+
}
|
|
9065
|
+
get queryParams() {
|
|
9066
|
+
const param = {};
|
|
9067
|
+
this.query.split("&")?.forEach((it) => {
|
|
9068
|
+
const a = it.split("=");
|
|
9069
|
+
if (param[a[0]]) {
|
|
9070
|
+
if (Array.isArray(param[a[0]])) {
|
|
9071
|
+
param[a[0]].push(a[1]);
|
|
9072
|
+
} else {
|
|
9073
|
+
param[a[0]] = [param[a[0]], a[1]];
|
|
9074
|
+
}
|
|
9075
|
+
} else {
|
|
9076
|
+
param[a[0]] = a[1];
|
|
9077
|
+
}
|
|
9078
|
+
});
|
|
9079
|
+
return param;
|
|
9080
|
+
}
|
|
9081
|
+
get queryParamsDecodeURI() {
|
|
9082
|
+
const params = this.queryParams;
|
|
9083
|
+
for (const key in params) {
|
|
9084
|
+
if (params.hasOwnProperty(key)) {
|
|
9085
|
+
const param = params[key];
|
|
9086
|
+
if (Array.isArray(param)) {
|
|
9087
|
+
params[key] = param.map((p) => decodeURIComponent(p));
|
|
9088
|
+
} else {
|
|
9089
|
+
params[key] = decodeURIComponent(param);
|
|
9090
|
+
}
|
|
9091
|
+
}
|
|
9092
|
+
}
|
|
9093
|
+
return params;
|
|
9094
|
+
}
|
|
9095
|
+
getPathnameData(urlExpression) {
|
|
9096
|
+
return Expression.Path.pathNameData(this.pathname, urlExpression);
|
|
9097
|
+
}
|
|
9098
|
+
get isSymbolScheme() {
|
|
9099
|
+
return this.symbols !== void 0;
|
|
9100
|
+
}
|
|
9101
|
+
};
|
|
9102
|
+
|
|
9103
|
+
// ../simple-boot/dist/esm/intent/IntentSubscribe.js
|
|
9104
|
+
var isIntentSubscribe = (obj) => {
|
|
9105
|
+
return !!obj && typeof obj.intentSubscribe === "function";
|
|
9106
|
+
};
|
|
9107
|
+
|
|
9108
|
+
// ../simple-boot/dist/esm/intent/IntentManager.js
|
|
9109
|
+
var isRouterPublishType = (it) => typeof it === "object" && it !== null && typeof it.router === "string" && typeof it.rootRouter === "function";
|
|
9110
|
+
var isSymbolPublishType = (it) => typeof it === "object" && it !== null && "symbol" in it && "path" in it;
|
|
9111
|
+
var isSchemePublishType = (it) => typeof it === "object" && it !== null && "scheme" in it && "path" in it;
|
|
9112
|
+
var IntentManager = class {
|
|
9113
|
+
constructor(simpleApplication, simstanceManager, routerManager, simOption) {
|
|
9114
|
+
this.simpleApplication = simpleApplication;
|
|
9115
|
+
this.simstanceManager = simstanceManager;
|
|
9116
|
+
this.routerManager = routerManager;
|
|
9117
|
+
this.simOption = simOption;
|
|
9118
|
+
this.subject = new Subject();
|
|
9119
|
+
}
|
|
9120
|
+
get observable() {
|
|
9121
|
+
return this.subject.asObservable();
|
|
9122
|
+
}
|
|
9123
|
+
async makeIntentData(it, data) {
|
|
9124
|
+
const target = [];
|
|
9125
|
+
const rootRouter = isRouterPublishType(it) ? it.rootRouter : this.simOption.rootRouter;
|
|
9126
|
+
if (isRouterPublishType(it)) {
|
|
9127
|
+
it = it.router;
|
|
9128
|
+
}
|
|
9129
|
+
const routerMatch = typeof it === "string" && it.match(/^Router\((.+)\):\/(.*)$/);
|
|
9130
|
+
if (routerMatch && typeof it === "string") {
|
|
9131
|
+
const routerBasePath = routerMatch[1];
|
|
9132
|
+
const actualPath = routerMatch[2];
|
|
9133
|
+
const routerModule = await this.routerManager.routing(routerBasePath, {
|
|
9134
|
+
router: rootRouter
|
|
9135
|
+
});
|
|
9136
|
+
const instance = routerModule.getModuleInstance();
|
|
9137
|
+
if (instance) {
|
|
9138
|
+
target.push(instance);
|
|
9139
|
+
}
|
|
9140
|
+
it = new Intent(actualPath, data);
|
|
9141
|
+
} else if (isSymbolPublishType(it)) {
|
|
9142
|
+
it = new Intent({ symbol: it.symbol, uri: it.path }, data);
|
|
9143
|
+
} else if (isSchemePublishType(it)) {
|
|
9144
|
+
it = new Intent(`${it.scheme}://${it.path}`, data);
|
|
9145
|
+
} else if (typeof it === "string") {
|
|
9146
|
+
it = new Intent(it, data);
|
|
9147
|
+
}
|
|
9148
|
+
const intent = it;
|
|
9149
|
+
if (!routerMatch) {
|
|
9150
|
+
if (intent.symbols) {
|
|
9151
|
+
target.push(...intent.symbols.map((sym) => this.simstanceManager.findSims(sym)).flat());
|
|
9152
|
+
} else if (intent.scheme) {
|
|
9153
|
+
target.push(...this.simstanceManager.getSimConfig(intent.scheme));
|
|
9154
|
+
} else {
|
|
9155
|
+
target.push(...this.simstanceManager.getSimAtomics());
|
|
9156
|
+
}
|
|
9157
|
+
}
|
|
9158
|
+
return { intent, target };
|
|
9159
|
+
}
|
|
9160
|
+
async publishMeta(it, data) {
|
|
9161
|
+
const { intent, target } = await this.makeIntentData(it, data);
|
|
9162
|
+
const r = [];
|
|
9163
|
+
const targetInstances = target.map((it2) => {
|
|
9164
|
+
if (it2 instanceof SimAtomic) {
|
|
9165
|
+
return it2.getValue();
|
|
9166
|
+
} else {
|
|
9167
|
+
return it2;
|
|
9168
|
+
}
|
|
9169
|
+
});
|
|
9170
|
+
this.subject.next(intent);
|
|
9171
|
+
for (let data2 of targetInstances) {
|
|
9172
|
+
let orNewSim = data2;
|
|
9173
|
+
if (orNewSim) {
|
|
9174
|
+
const filteredPaths = intent.paths.filter((i) => i);
|
|
9175
|
+
if (filteredPaths.length > 0) {
|
|
9176
|
+
let callthis = orNewSim;
|
|
9177
|
+
let lastProp = "";
|
|
9178
|
+
filteredPaths.forEach((i) => {
|
|
9179
|
+
callthis = orNewSim;
|
|
9180
|
+
orNewSim = orNewSim?.[i];
|
|
9181
|
+
lastProp = i;
|
|
9182
|
+
});
|
|
9183
|
+
if (orNewSim && typeof orNewSim === "function") {
|
|
9184
|
+
const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
|
|
9185
|
+
const result = await this.simstanceManager.executeBindParameterSimPromise({
|
|
9186
|
+
target: callthis,
|
|
9187
|
+
targetKey: lastProp,
|
|
9188
|
+
parameterCount: intentData.length,
|
|
9189
|
+
inputParameters: intentData,
|
|
9190
|
+
firstCheckMaker: [
|
|
9191
|
+
(obj, token, idx) => {
|
|
9192
|
+
if (idx < intentData.length) {
|
|
9193
|
+
return intentData[idx];
|
|
9194
|
+
}
|
|
9195
|
+
if (token === Intent && idx === 0) {
|
|
9196
|
+
return intent;
|
|
9197
|
+
}
|
|
9198
|
+
}
|
|
9199
|
+
]
|
|
9200
|
+
});
|
|
9201
|
+
r.push(result);
|
|
9202
|
+
} else if (orNewSim) {
|
|
9203
|
+
callthis[lastProp] = intent.data;
|
|
9204
|
+
r.push(callthis[lastProp]);
|
|
9205
|
+
}
|
|
9206
|
+
} else {
|
|
9207
|
+
const intentData = Array.isArray(intent.data) ? intent.data : intent.data !== void 0 ? [intent.data] : [];
|
|
9208
|
+
if (isIntentSubscribe(orNewSim)) {
|
|
9209
|
+
r.push(orNewSim.intentSubscribe(...intentData));
|
|
9210
|
+
}
|
|
9211
|
+
}
|
|
9212
|
+
}
|
|
9213
|
+
}
|
|
9214
|
+
return { return: r, target };
|
|
9215
|
+
}
|
|
9216
|
+
async publish(it, data) {
|
|
9217
|
+
const rdata = await this.publishMeta(it, data);
|
|
9218
|
+
return rdata.return;
|
|
9219
|
+
}
|
|
9220
|
+
};
|
|
9221
|
+
|
|
9222
|
+
// ../simple-boot/dist/esm/decorators/inject/Injection.js
|
|
9223
|
+
var InjectionMetadataKey = Symbol("Injection");
|
|
9224
|
+
var getInjection = (target, propertyKey) => {
|
|
9225
|
+
return ReflectUtils.getMetadata(InjectionMetadataKey, target, propertyKey);
|
|
9226
|
+
};
|
|
9227
|
+
|
|
9228
|
+
// ../simple-boot/dist/esm/throwable/MethodNoSuch.js
|
|
9229
|
+
var MethodNoSuch = class extends SimError {
|
|
9230
|
+
constructor(message, name, propertyKeys, stack) {
|
|
9231
|
+
super(message, name, stack);
|
|
9232
|
+
this.propertyKeys = propertyKeys;
|
|
9233
|
+
}
|
|
9234
|
+
};
|
|
9235
|
+
|
|
9236
|
+
// ../simple-boot/dist/esm/decorators/route/Router.js
|
|
9237
|
+
var RouterMetadataKey = Symbol.for("simple-boot:router-metadata");
|
|
9238
|
+
var getRouter = (target) => {
|
|
9239
|
+
if (target != null && typeof target === "object") {
|
|
9240
|
+
target = target.constructor;
|
|
9241
|
+
}
|
|
9242
|
+
try {
|
|
9243
|
+
return ReflectUtils.getMetadata(RouterMetadataKey, target);
|
|
9244
|
+
} catch (e) {
|
|
9245
|
+
}
|
|
9246
|
+
};
|
|
9247
|
+
var RouteMetadataKey = Symbol.for("simple-boot:route-metadata");
|
|
9248
|
+
|
|
9249
|
+
// ../simple-boot/dist/esm/route/RouterModule.js
|
|
9250
|
+
var RouterModule = class {
|
|
9251
|
+
constructor(simstanceManager, router, module, routerChains = []) {
|
|
9252
|
+
this.simstanceManager = simstanceManager;
|
|
9253
|
+
this.router = router;
|
|
9254
|
+
this.module = module;
|
|
9255
|
+
this.routerChains = routerChains;
|
|
9256
|
+
}
|
|
9257
|
+
get path() {
|
|
9258
|
+
return this._path;
|
|
9259
|
+
}
|
|
9260
|
+
set path(value) {
|
|
9261
|
+
this._path = value;
|
|
9262
|
+
}
|
|
9263
|
+
get data() {
|
|
9264
|
+
return this._data;
|
|
9265
|
+
}
|
|
9266
|
+
set data(value) {
|
|
9267
|
+
this._data = value;
|
|
9268
|
+
}
|
|
9269
|
+
get intent() {
|
|
9270
|
+
return this._intent;
|
|
9271
|
+
}
|
|
9272
|
+
set intent(value) {
|
|
9273
|
+
this._intent = value;
|
|
9274
|
+
}
|
|
9275
|
+
get propertyKeys() {
|
|
9276
|
+
return this._propertyKeys;
|
|
9277
|
+
}
|
|
9278
|
+
set propertyKeys(value) {
|
|
9279
|
+
this._propertyKeys = value;
|
|
9280
|
+
}
|
|
9281
|
+
get pathData() {
|
|
9282
|
+
return this._pathData;
|
|
9283
|
+
}
|
|
9284
|
+
getPathData() {
|
|
9285
|
+
return this._pathData;
|
|
9286
|
+
}
|
|
9287
|
+
set pathData(value) {
|
|
9288
|
+
this._pathData = value;
|
|
9289
|
+
}
|
|
9290
|
+
getRouterPath(join = "") {
|
|
9291
|
+
return this.getRouterPaths().map((it) => it ?? "").join(join);
|
|
9292
|
+
}
|
|
9293
|
+
getRouterPaths() {
|
|
9294
|
+
return this.routerChains.map((it) => getRouter(it instanceof SimAtomic ? it.type.targetKeyType : it)?.path);
|
|
9295
|
+
}
|
|
9296
|
+
getRouterPathData(pathName) {
|
|
9297
|
+
return Expression.Path.pathNameData(pathName, this.getRouterPath());
|
|
9298
|
+
}
|
|
9299
|
+
getModuleInstance(propertyKey, instanceBind = true) {
|
|
9300
|
+
const instance = this.simstanceManager.getOrNewSim({ target: this.module?.targetKeyType, originTypeTarget: this.module?.originalType });
|
|
9301
|
+
if (propertyKey && this.propertyKeys && this.propertyKeys.includes(propertyKey)) {
|
|
9302
|
+
let instanceElement = instance[propertyKey];
|
|
9303
|
+
if (instanceBind && typeof instanceBind === "boolean") {
|
|
9304
|
+
instanceElement = instanceElement.bind(instance);
|
|
9305
|
+
} else if (instanceBind && typeof instanceBind === "object") {
|
|
9306
|
+
instanceElement = instanceElement.bind(instanceBind);
|
|
9307
|
+
}
|
|
9308
|
+
return instanceElement;
|
|
9309
|
+
} else {
|
|
9310
|
+
return instance;
|
|
9311
|
+
}
|
|
9312
|
+
}
|
|
9313
|
+
executeModuleProperty(propertyKey, ...param) {
|
|
9314
|
+
const target = this.getModuleInstance();
|
|
9315
|
+
if (propertyKey) {
|
|
9316
|
+
const config = getInjection(target, propertyKey);
|
|
9317
|
+
if (config) {
|
|
9318
|
+
const other = /* @__PURE__ */ new Map();
|
|
9319
|
+
param.forEach((it) => other.set(it.constructor, it));
|
|
9320
|
+
return this.simstanceManager.executeBindParameterSim({ target, targetKey: propertyKey }, other);
|
|
9321
|
+
} else {
|
|
9322
|
+
if (target[propertyKey]) {
|
|
9323
|
+
return target[propertyKey]?.(...param);
|
|
9324
|
+
} else {
|
|
9325
|
+
throw new MethodNoSuch(`${propertyKey.toString()} noSuch`, propertyKey.toString(), propertyKey);
|
|
9326
|
+
}
|
|
9327
|
+
}
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
get firstRouteChain() {
|
|
9331
|
+
return this.routerChains[0];
|
|
9332
|
+
}
|
|
9333
|
+
get firstRouteChainValue() {
|
|
9334
|
+
return this.firstRouteChain?.getValue();
|
|
9335
|
+
}
|
|
9336
|
+
get lastRouteChain() {
|
|
9337
|
+
return this.routerChains[this.routerChains.length - 1];
|
|
9338
|
+
}
|
|
9339
|
+
get lastRouteChainValue() {
|
|
9340
|
+
return this.lastRouteChain?.getValue();
|
|
9341
|
+
}
|
|
9342
|
+
hasActivateInLastRoute(obj) {
|
|
9343
|
+
return this.lastRouteChainValue?.hasActivate(obj) === true;
|
|
9344
|
+
}
|
|
9345
|
+
getQueryParamDecodeURI(key) {
|
|
9346
|
+
if (this.intent) {
|
|
9347
|
+
return this.intent.getQueryParamDecodeURI(key);
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9350
|
+
getQueryParamDecodeURIFirst(key) {
|
|
9351
|
+
if (this.intent) {
|
|
9352
|
+
return this.intent.getQueryParamDecodeURIFirst(key);
|
|
9353
|
+
}
|
|
9354
|
+
}
|
|
9355
|
+
getQueryParam(key) {
|
|
9356
|
+
if (this.intent) {
|
|
9357
|
+
return this.intent.getQueryParam(key);
|
|
7382
9358
|
}
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
proto.attributeChangedCallback = function(name2, old, newVal) {
|
|
7388
|
-
if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
|
|
7389
|
-
const hSet = SwcUtils.getHostSet(this);
|
|
7390
|
-
if (name2.startsWith("swc-on-") && !swcLifecycleAttributes.includes(name2)) {
|
|
7391
|
-
if (newVal !== null) {
|
|
7392
|
-
const eventName = name2.substring(7);
|
|
7393
|
-
this._bindAttributeEvent(this, name2, newVal, eventName);
|
|
7394
|
-
}
|
|
9359
|
+
}
|
|
9360
|
+
getQueryParamFirst(key) {
|
|
9361
|
+
if (this.intent) {
|
|
9362
|
+
return this.intent.getQueryParamFirst(key);
|
|
7395
9363
|
}
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
9364
|
+
}
|
|
9365
|
+
get queryParams() {
|
|
9366
|
+
if (this.intent) {
|
|
9367
|
+
return this.intent.queryParams;
|
|
7399
9368
|
}
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
9369
|
+
}
|
|
9370
|
+
get queryParamsAfterDecodeURI() {
|
|
9371
|
+
if (this.intent) {
|
|
9372
|
+
return this.intent.queryParamsDecodeURI;
|
|
7403
9373
|
}
|
|
7404
|
-
};
|
|
7405
|
-
Object.defineProperty(constructor, "observedAttributes", {
|
|
7406
|
-
get: () => mergedObservedAttributes,
|
|
7407
|
-
configurable: true
|
|
7408
|
-
});
|
|
7409
|
-
ReflectUtils.defineMetadata(ELEMENT_CONFIG_KEY, metadata, constructor);
|
|
7410
|
-
const registry = metadata.customElementRegistry || win?.customElements;
|
|
7411
|
-
if (registry && !registry.get(metadata.name)) {
|
|
7412
|
-
registry.define(metadata.name, constructor, metadata.extends ? { extends: metadata.extends } : void 0);
|
|
7413
9374
|
}
|
|
7414
|
-
return constructor;
|
|
7415
9375
|
};
|
|
7416
9376
|
|
|
7417
|
-
// ../simple-boot/dist/esm/decorators/SimDecorator.js
|
|
7418
|
-
var SimMetadataKey = Symbol("Sim");
|
|
7419
|
-
var PostConstructMetadataKey = Symbol("PostConstruct");
|
|
7420
|
-
|
|
7421
|
-
// ../simple-boot/dist/esm/decorators/aop/AOPDecorator.js
|
|
7422
|
-
var AfterMetadataKey = Symbol("After");
|
|
7423
|
-
var BeforeMetadataKey = Symbol("Before");
|
|
7424
|
-
var AroundMetadataKey = Symbol("Around");
|
|
7425
|
-
|
|
7426
|
-
// ../simple-boot/dist/esm/decorators/exception/ExceptionDecorator.js
|
|
7427
|
-
var ExceptionHandlerMetadataKey = Symbol("ExceptionHandler");
|
|
7428
|
-
|
|
7429
|
-
// ../simple-boot/dist/esm/decorators/SimNoProxy.js
|
|
7430
|
-
var SimNoProxyKey = Symbol("Sim:NoProxy");
|
|
7431
|
-
|
|
7432
|
-
// ../simple-boot/dist/esm/decorators/inject/Injection.js
|
|
7433
|
-
var InjectionMetadataKey = Symbol("Injection");
|
|
7434
|
-
|
|
7435
|
-
// ../simple-boot/dist/esm/decorators/route/Router.js
|
|
7436
|
-
var RouterMetadataKey = Symbol("Router");
|
|
7437
|
-
var RouteMetadataKey = Symbol("RouteMetadataKey");
|
|
7438
|
-
|
|
7439
9377
|
// ../simple-boot/dist/esm/route/RouterAction.js
|
|
7440
9378
|
var RouterAction;
|
|
7441
9379
|
((RouterAction2) => {
|
|
@@ -7450,6 +9388,435 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
7450
9388
|
};
|
|
7451
9389
|
})(RouterAction || (RouterAction = {}));
|
|
7452
9390
|
|
|
9391
|
+
// ../simple-boot/dist/esm/route/RouterManager.js
|
|
9392
|
+
var RouterManager = class {
|
|
9393
|
+
constructor(simpleApplication, simstanceManager, simOption) {
|
|
9394
|
+
this.simpleApplication = simpleApplication;
|
|
9395
|
+
this.simstanceManager = simstanceManager;
|
|
9396
|
+
this.simOption = simOption;
|
|
9397
|
+
this.subject = new Subject();
|
|
9398
|
+
}
|
|
9399
|
+
// @SimNoProxy
|
|
9400
|
+
get observable() {
|
|
9401
|
+
return this.subject.asObservable();
|
|
9402
|
+
}
|
|
9403
|
+
routingMap(option) {
|
|
9404
|
+
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9405
|
+
if (!targetRouter) {
|
|
9406
|
+
throw new Error("no router");
|
|
9407
|
+
}
|
|
9408
|
+
const map = {};
|
|
9409
|
+
if (targetRouter) {
|
|
9410
|
+
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9411
|
+
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9412
|
+
const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9413
|
+
const routerData = routerAtomic.getConfig(RouterMetadataKey);
|
|
9414
|
+
if (routerData) {
|
|
9415
|
+
const currentPrefix = (option?.prefix ?? "") + routerData.path;
|
|
9416
|
+
if (routerData.route && routerData.route[""]) {
|
|
9417
|
+
map[currentPrefix] = routerData.route[""];
|
|
9418
|
+
}
|
|
9419
|
+
if (routerData.route) {
|
|
9420
|
+
Object.entries(routerData.route).forEach(([key, value]) => {
|
|
9421
|
+
map[currentPrefix + key] = value;
|
|
9422
|
+
});
|
|
9423
|
+
}
|
|
9424
|
+
routerData.routers?.forEach((it) => {
|
|
9425
|
+
Object.assign(map, this.routingMap({ ...option, router: it, prefix: currentPrefix }));
|
|
9426
|
+
});
|
|
9427
|
+
}
|
|
9428
|
+
}
|
|
9429
|
+
return map;
|
|
9430
|
+
}
|
|
9431
|
+
/** 일반적인 lifecycle 타지않는 그냥 find.. 의미가없을듯.
|
|
9432
|
+
* @deprecated
|
|
9433
|
+
*/
|
|
9434
|
+
async routings(intent, option) {
|
|
9435
|
+
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9436
|
+
if (!targetRouter) {
|
|
9437
|
+
throw new Error("no router");
|
|
9438
|
+
}
|
|
9439
|
+
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9440
|
+
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9441
|
+
const routerAtomic = new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9442
|
+
const allMatches = this._collectAllMatchingModules(routerAtomic, intent, []);
|
|
9443
|
+
const exactModuleMatches = allMatches.filter((rm) => rm.path === intent.pathname && rm.module);
|
|
9444
|
+
if (exactModuleMatches.length > 0) {
|
|
9445
|
+
exactModuleMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
|
|
9446
|
+
return exactModuleMatches;
|
|
9447
|
+
}
|
|
9448
|
+
const exactPathMatches = allMatches.filter((rm) => rm.path === intent.pathname);
|
|
9449
|
+
if (exactPathMatches.length > 0) {
|
|
9450
|
+
exactPathMatches.forEach((it) => this.subject.next({ intent, routerManager: this, routerModule: it }));
|
|
9451
|
+
return exactPathMatches;
|
|
9452
|
+
}
|
|
9453
|
+
return [];
|
|
9454
|
+
}
|
|
9455
|
+
async routing(intent, option) {
|
|
9456
|
+
if (typeof intent === "string") {
|
|
9457
|
+
intent = new Intent(intent);
|
|
9458
|
+
}
|
|
9459
|
+
const targetRouter = option?.router ?? this.simOption.rootRouter;
|
|
9460
|
+
const callCheckOnRouting = option?.noOnRouting !== true;
|
|
9461
|
+
if (!targetRouter) {
|
|
9462
|
+
debugger;
|
|
9463
|
+
throw new Error("no router");
|
|
9464
|
+
}
|
|
9465
|
+
const targetType = typeof targetRouter === "object" ? targetRouter.constructor : targetRouter;
|
|
9466
|
+
const targetValue = typeof targetRouter === "object" ? targetRouter : void 0;
|
|
9467
|
+
const routerAtomic = typeof targetType === "symbol" ? this.simstanceManager.findFirstSim(targetType) : new SimAtomic({ targetKeyType: targetType, originalType: targetType, value: targetValue }, this.simstanceManager);
|
|
9468
|
+
const rootRouter = routerAtomic.getValue();
|
|
9469
|
+
const executeModuleResult = this.getExecuteModule(routerAtomic, intent, [], option);
|
|
9470
|
+
if (executeModuleResult) {
|
|
9471
|
+
const [executeModule, routerChains] = executeModuleResult;
|
|
9472
|
+
executeModule.routerChains = routerChains;
|
|
9473
|
+
this.activeRouterModule = executeModule;
|
|
9474
|
+
const routingDataSet = { intent, routerModule: executeModule, routerManager: this };
|
|
9475
|
+
if (routerChains.length > 0) {
|
|
9476
|
+
for (let i = 0; i < routerChains.length; i++) {
|
|
9477
|
+
const current = routerChains[i];
|
|
9478
|
+
const next = routerChains[i + 1];
|
|
9479
|
+
const value = current.getValue();
|
|
9480
|
+
if (RouterAction.isCanActivate(value) && next) {
|
|
9481
|
+
await value.canActivate(routingDataSet, next.getValue());
|
|
9482
|
+
}
|
|
9483
|
+
if (callCheckOnRouting && RouterAction.isOnRouting(value) && next) {
|
|
9484
|
+
await value.onRouting(routingDataSet);
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
}
|
|
9488
|
+
this.activeRouterModule = executeModule;
|
|
9489
|
+
const moduleInstance = executeModule.getModuleInstance();
|
|
9490
|
+
if (!executeModule?.module) {
|
|
9491
|
+
const routerChain = executeModule.routerChains[executeModule.routerChains.length - 1];
|
|
9492
|
+
const value = routerChain?.getValue();
|
|
9493
|
+
if (RouterAction.isCanActivate(value)) {
|
|
9494
|
+
await value.canActivate(routingDataSet, moduleInstance);
|
|
9495
|
+
}
|
|
9496
|
+
if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
|
|
9497
|
+
await value.onRouting(routingDataSet);
|
|
9498
|
+
}
|
|
9499
|
+
} else {
|
|
9500
|
+
const value = executeModule.router?.getValue();
|
|
9501
|
+
if (RouterAction.isCanActivate(value)) {
|
|
9502
|
+
await value.canActivate(routingDataSet, moduleInstance);
|
|
9503
|
+
}
|
|
9504
|
+
if (callCheckOnRouting && RouterAction.isOnRouting(value)) {
|
|
9505
|
+
await value.onRouting(routingDataSet);
|
|
9506
|
+
}
|
|
9507
|
+
if (moduleInstance && callCheckOnRouting && RouterAction.isOnRouting(moduleInstance)) {
|
|
9508
|
+
await moduleInstance.onRouting(routingDataSet);
|
|
9509
|
+
}
|
|
9510
|
+
}
|
|
9511
|
+
const find = this.activeRouterModule;
|
|
9512
|
+
this.subject.next({ intent, routerModule: find, routerManager: this });
|
|
9513
|
+
return find;
|
|
9514
|
+
} else {
|
|
9515
|
+
const empty = await this._handleNotFoundRouting(rootRouter, intent);
|
|
9516
|
+
this.subject.next({ intent, routerModule: empty, routerManager: this });
|
|
9517
|
+
return empty;
|
|
9518
|
+
}
|
|
9519
|
+
}
|
|
9520
|
+
/**
|
|
9521
|
+
* URL과 일치하는 라우트를 찾지 못했을 경우를 처리합니다.
|
|
9522
|
+
* "Not Found" 상태를 나타내는 비어있는 RouterModule 객체를 생성하여 반환합니다.
|
|
9523
|
+
* 이 과정에서 rootRouter의 라이프사이클을 호출하여 공통 레이아웃등을 처리할 수 있습니다.
|
|
9524
|
+
* @param rootRouter 앱의 최상위 라우터 인스턴스
|
|
9525
|
+
* @param intent 확인에 실패한 원본 Intent 객체
|
|
9526
|
+
* @private
|
|
9527
|
+
*/
|
|
9528
|
+
async _handleNotFoundRouting(rootRouter, intent) {
|
|
9529
|
+
const routerModule = new RouterModule(this.simstanceManager, rootRouter, void 0, []);
|
|
9530
|
+
const routingDataSet = { intent, routerModule, routerManager: this };
|
|
9531
|
+
const value = rootRouter;
|
|
9532
|
+
if (RouterAction.isCanActivate(value)) {
|
|
9533
|
+
await value.canActivate(routingDataSet, null);
|
|
9534
|
+
}
|
|
9535
|
+
if (RouterAction.isOnRouting(value)) {
|
|
9536
|
+
await value.onRouting(routingDataSet);
|
|
9537
|
+
}
|
|
9538
|
+
this.activeRouterModule = routerModule;
|
|
9539
|
+
return this.activeRouterModule;
|
|
9540
|
+
}
|
|
9541
|
+
getExecuteModule(router, intent, parentRouters, option) {
|
|
9542
|
+
const path = intent.pathname;
|
|
9543
|
+
const routerConfig = router.getConfig(RouterMetadataKey);
|
|
9544
|
+
if (routerConfig) {
|
|
9545
|
+
const filters = [];
|
|
9546
|
+
if (Array.isArray(routerConfig.filters)) {
|
|
9547
|
+
filters.push(...routerConfig.filters);
|
|
9548
|
+
} else if (routerConfig.filters) {
|
|
9549
|
+
filters.push(routerConfig.filters);
|
|
9550
|
+
}
|
|
9551
|
+
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9552
|
+
if (noAccept) {
|
|
9553
|
+
return;
|
|
9554
|
+
}
|
|
9555
|
+
const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
|
|
9556
|
+
const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
|
|
9557
|
+
if (isRoot) {
|
|
9558
|
+
const currentParentRouters = [...parentRouters, router];
|
|
9559
|
+
if (routerConfig.routers && routerConfig.routers.length > 0) {
|
|
9560
|
+
let bestMatchModule = void 0;
|
|
9561
|
+
let bestMatchLength = -1;
|
|
9562
|
+
for (const child of routerConfig.routers) {
|
|
9563
|
+
const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
|
|
9564
|
+
if (!routerAtomic) {
|
|
9565
|
+
continue;
|
|
9566
|
+
}
|
|
9567
|
+
const executeModule = this.getExecuteModule(routerAtomic, intent, currentParentRouters, option);
|
|
9568
|
+
if (executeModule) {
|
|
9569
|
+
const [rm, chains] = executeModule;
|
|
9570
|
+
const currentMatchLength = rm.path?.length || 0;
|
|
9571
|
+
if (currentMatchLength > bestMatchLength) {
|
|
9572
|
+
bestMatchLength = currentMatchLength;
|
|
9573
|
+
bestMatchModule = executeModule;
|
|
9574
|
+
} else if (currentMatchLength === bestMatchLength) {
|
|
9575
|
+
if (option?.find?.router === "last") {
|
|
9576
|
+
bestMatchModule = executeModule;
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
}
|
|
9580
|
+
}
|
|
9581
|
+
if (bestMatchModule) {
|
|
9582
|
+
return bestMatchModule;
|
|
9583
|
+
}
|
|
9584
|
+
}
|
|
9585
|
+
const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
|
|
9586
|
+
if (module) {
|
|
9587
|
+
return [module, currentParentRouters];
|
|
9588
|
+
}
|
|
9589
|
+
}
|
|
9590
|
+
}
|
|
9591
|
+
}
|
|
9592
|
+
// path: 지금 내 라우터의 path, parentRoots: 부모router path들, url: 사용자가 원하는 full intent url
|
|
9593
|
+
isRootUrl(path, parentRoots, url) {
|
|
9594
|
+
const searchString = parentRoots.join("") + (path || "");
|
|
9595
|
+
if (searchString === "/") {
|
|
9596
|
+
return true;
|
|
9597
|
+
}
|
|
9598
|
+
const searchs = searchString.split("/");
|
|
9599
|
+
const urls = url.split("/");
|
|
9600
|
+
const trimmedUrls = urls.slice(0, searchs.length).join("/");
|
|
9601
|
+
return !!Expression.Path.pathNameData(trimmedUrls, searchString);
|
|
9602
|
+
}
|
|
9603
|
+
_collectAllMatchingModules(router, intent, parentRouters) {
|
|
9604
|
+
const matches = [];
|
|
9605
|
+
const path = intent.pathname;
|
|
9606
|
+
const routerConfig = router.getConfig(RouterMetadataKey);
|
|
9607
|
+
if (routerConfig) {
|
|
9608
|
+
const filters = [];
|
|
9609
|
+
if (Array.isArray(routerConfig.filters)) {
|
|
9610
|
+
filters.push(...routerConfig.filters);
|
|
9611
|
+
} else if (routerConfig.filters) {
|
|
9612
|
+
filters.push(routerConfig.filters);
|
|
9613
|
+
}
|
|
9614
|
+
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9615
|
+
if (noAccept) {
|
|
9616
|
+
return matches;
|
|
9617
|
+
}
|
|
9618
|
+
const routerStrings = parentRouters.map((it) => it.getConfig(RouterMetadataKey)?.path || "");
|
|
9619
|
+
const isRoot = this.isRootUrl(routerConfig.path, routerStrings, path);
|
|
9620
|
+
if (isRoot) {
|
|
9621
|
+
const currentParentRouters = [...parentRouters, router];
|
|
9622
|
+
if (routerConfig.routers && routerConfig.routers.length > 0) {
|
|
9623
|
+
for (const child of routerConfig.routers) {
|
|
9624
|
+
const routerAtomic = typeof child === "symbol" ? this.simstanceManager.findFirstSim(child) : new SimAtomic({ targetKeyType: child, originalType: child }, this.simstanceManager);
|
|
9625
|
+
if (!routerAtomic) {
|
|
9626
|
+
continue;
|
|
9627
|
+
}
|
|
9628
|
+
matches.push(...this._collectAllMatchingModules(routerAtomic, intent, currentParentRouters));
|
|
9629
|
+
}
|
|
9630
|
+
}
|
|
9631
|
+
const module = this.findRouterOrModule(router, routerConfig, routerStrings, intent);
|
|
9632
|
+
if (module) {
|
|
9633
|
+
module.routerChains = currentParentRouters;
|
|
9634
|
+
matches.push(module);
|
|
9635
|
+
}
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
return matches;
|
|
9639
|
+
}
|
|
9640
|
+
findRouterOrModule(router, routerData, parentRoots, intent) {
|
|
9641
|
+
const module = this.findRouting(router, routerData, parentRoots, intent);
|
|
9642
|
+
if (module?.module) {
|
|
9643
|
+
module.intent = intent;
|
|
9644
|
+
return module;
|
|
9645
|
+
}
|
|
9646
|
+
const urlRoot = parentRoots.join("") + (routerData.path || "");
|
|
9647
|
+
if (this.isRootUrl(routerData.path, parentRoots, intent.pathname)) {
|
|
9648
|
+
const rm = new RouterModule(this.simstanceManager, router);
|
|
9649
|
+
rm.intent = intent;
|
|
9650
|
+
rm.path = urlRoot;
|
|
9651
|
+
rm.pathData = intent.getPathnameData(urlRoot);
|
|
9652
|
+
return rm;
|
|
9653
|
+
}
|
|
9654
|
+
return void 0;
|
|
9655
|
+
}
|
|
9656
|
+
findRouting(router, routerData, parentRoots, intent) {
|
|
9657
|
+
const urlRoot = parentRoots.join("") + routerData.path;
|
|
9658
|
+
if (routerData.route) {
|
|
9659
|
+
for (const it of Object.keys(routerData.route).filter((it2) => !it2.startsWith("_"))) {
|
|
9660
|
+
const path = urlRoot + it;
|
|
9661
|
+
const pathnameData = intent.getPathnameData(path);
|
|
9662
|
+
if (pathnameData) {
|
|
9663
|
+
try {
|
|
9664
|
+
const dataSet = this.findRouteProperty(routerData.route, it, intent);
|
|
9665
|
+
const rm = new RouterModule(this.simstanceManager, router, dataSet.child);
|
|
9666
|
+
rm.data = dataSet.data;
|
|
9667
|
+
rm.path = path;
|
|
9668
|
+
rm.pathData = pathnameData;
|
|
9669
|
+
rm.propertyKeys = dataSet.propertyKeys;
|
|
9670
|
+
return rm;
|
|
9671
|
+
} catch (e) {
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9676
|
+
}
|
|
9677
|
+
findRouteProperty(route, propertyName, intent) {
|
|
9678
|
+
let child;
|
|
9679
|
+
let data;
|
|
9680
|
+
let propertyKeys;
|
|
9681
|
+
const routeElement = route[propertyName];
|
|
9682
|
+
if (typeof routeElement === "function") {
|
|
9683
|
+
child = { targetKeyType: routeElement, originalType: routeElement };
|
|
9684
|
+
} else if (typeof routeElement === "symbol") {
|
|
9685
|
+
const findSimType = this.simstanceManager.findLastSim(routeElement)?.type;
|
|
9686
|
+
if (findSimType?.originalType) {
|
|
9687
|
+
child = { targetKeyType: findSimType.originalType, originalType: findSimType.originalType };
|
|
9688
|
+
}
|
|
9689
|
+
} else if (typeof routeElement === "string") {
|
|
9690
|
+
return this.findRouteProperty(route, routeElement, intent);
|
|
9691
|
+
} else if (Array.isArray(routeElement)) {
|
|
9692
|
+
const r = routeElement?.[0];
|
|
9693
|
+
if (typeof r === "object" && "filters" in r && "target" in r) {
|
|
9694
|
+
const filters = [];
|
|
9695
|
+
if (Array.isArray(r.filters)) {
|
|
9696
|
+
filters.push(...r.filters);
|
|
9697
|
+
} else if (r.filters) {
|
|
9698
|
+
filters.push(r.filters);
|
|
9699
|
+
}
|
|
9700
|
+
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9701
|
+
if (!noAccept) {
|
|
9702
|
+
child = { targetKeyType: r.target, originalType: r.target };
|
|
9703
|
+
}
|
|
9704
|
+
} else {
|
|
9705
|
+
child = { targetKeyType: r, originalType: r };
|
|
9706
|
+
}
|
|
9707
|
+
data = routeElement?.[1];
|
|
9708
|
+
} else if (typeof routeElement === "object" && "target" in routeElement && "propertyKeys" in routeElement) {
|
|
9709
|
+
const noAccept = routeElement.filters?.filter((it) => it).some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9710
|
+
if (!noAccept) {
|
|
9711
|
+
child = { targetKeyType: routeElement.target, originalType: routeElement.target };
|
|
9712
|
+
propertyKeys = routeElement.propertyKeys;
|
|
9713
|
+
}
|
|
9714
|
+
} else if (typeof routeElement === "object" && "filters" in routeElement && "target" in routeElement) {
|
|
9715
|
+
const filters = [];
|
|
9716
|
+
if (Array.isArray(routeElement.filters)) {
|
|
9717
|
+
filters.push(...routeElement.filters);
|
|
9718
|
+
} else if (routeElement.filters) {
|
|
9719
|
+
filters.push(routeElement.filters);
|
|
9720
|
+
}
|
|
9721
|
+
const noAccept = filters.some((it) => (typeof it === "function" ? this.simstanceManager.getOrNewSim({ target: it }) : it)?.isAccept(intent) === false);
|
|
9722
|
+
if (!noAccept) {
|
|
9723
|
+
child = { targetKeyType: routeElement.target, originalType: routeElement.target };
|
|
9724
|
+
}
|
|
9725
|
+
}
|
|
9726
|
+
return {
|
|
9727
|
+
child,
|
|
9728
|
+
data,
|
|
9729
|
+
propertyKeys
|
|
9730
|
+
};
|
|
9731
|
+
}
|
|
9732
|
+
};
|
|
9733
|
+
|
|
9734
|
+
// ../simple-boot/dist/esm/SimpleApplication.js
|
|
9735
|
+
var SimpleApplication = class _SimpleApplication {
|
|
9736
|
+
// public rootRouter?: ConstructorType<any>;
|
|
9737
|
+
// constructor();
|
|
9738
|
+
// constructor(option: SimOption);
|
|
9739
|
+
// constructor(rootRouter?: ConstructorType<Object> | Function);
|
|
9740
|
+
// constructor(rootRouter?: ConstructorType<Object> | Function, option?: SimOption);
|
|
9741
|
+
// constructor(rootRouter?: (ConstructorType<Object> | Function) | SimOption, option = new SimOption()) {
|
|
9742
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
9743
|
+
constructor(option = new SimOption()) {
|
|
9744
|
+
this.option = option;
|
|
9745
|
+
this.simstanceManager = new SimstanceManager(this, option);
|
|
9746
|
+
this.simstanceManager.setStoreSet(SimstanceManager, this.simstanceManager);
|
|
9747
|
+
this.routerManager = new RouterManager(this, this.simstanceManager, option);
|
|
9748
|
+
this.intentManager = new IntentManager(this, this.simstanceManager, this.routerManager, option);
|
|
9749
|
+
this.simstanceManager.setStoreSet(IntentManager, this.intentManager);
|
|
9750
|
+
this.simstanceManager.setStoreSet(RouterManager, this.routerManager);
|
|
9751
|
+
containers.add(this);
|
|
9752
|
+
}
|
|
9753
|
+
getSimstanceManager() {
|
|
9754
|
+
return this.simstanceManager;
|
|
9755
|
+
}
|
|
9756
|
+
getIntentManager() {
|
|
9757
|
+
return this.intentManager;
|
|
9758
|
+
}
|
|
9759
|
+
getRouterManager() {
|
|
9760
|
+
return this.routerManager;
|
|
9761
|
+
}
|
|
9762
|
+
run(otherInstanceSim) {
|
|
9763
|
+
otherInstanceSim ?? (otherInstanceSim = /* @__PURE__ */ new Map());
|
|
9764
|
+
otherInstanceSim.set(_SimpleApplication, this);
|
|
9765
|
+
this.simstanceManager.run(otherInstanceSim);
|
|
9766
|
+
return this;
|
|
9767
|
+
}
|
|
9768
|
+
simAtomic(type) {
|
|
9769
|
+
if (typeof type === "symbol") {
|
|
9770
|
+
return this.simstanceManager.findFirstSim(type);
|
|
9771
|
+
} else if (typeof type === "function") {
|
|
9772
|
+
return this.simstanceManager.findFirstSim({ type });
|
|
9773
|
+
}
|
|
9774
|
+
}
|
|
9775
|
+
simAtomics(type) {
|
|
9776
|
+
if (typeof type === "symbol") {
|
|
9777
|
+
return this.simstanceManager.findSims(type) ?? [];
|
|
9778
|
+
} else if (typeof type === "function") {
|
|
9779
|
+
return this.simstanceManager.findSims({ type }) ?? [];
|
|
9780
|
+
} else {
|
|
9781
|
+
return [];
|
|
9782
|
+
}
|
|
9783
|
+
}
|
|
9784
|
+
getInstance(type) {
|
|
9785
|
+
const i = this.sim(type);
|
|
9786
|
+
if (i) {
|
|
9787
|
+
return i;
|
|
9788
|
+
} else {
|
|
9789
|
+
throw new SimNoSuch("SimNoSuch: no simple instance(getInstance) name:" + type?.prototype?.constructor?.name + "," + type);
|
|
9790
|
+
}
|
|
9791
|
+
}
|
|
9792
|
+
sim(type) {
|
|
9793
|
+
return this.simAtomic(type)?.getValue();
|
|
9794
|
+
}
|
|
9795
|
+
sims(type) {
|
|
9796
|
+
return this.simAtomics(type).map((it) => it.getValue());
|
|
9797
|
+
}
|
|
9798
|
+
addSim(configOrTarget, target) {
|
|
9799
|
+
const r = Sim(configOrTarget);
|
|
9800
|
+
if (typeof r === "function" && target) {
|
|
9801
|
+
r(target);
|
|
9802
|
+
}
|
|
9803
|
+
}
|
|
9804
|
+
publishIntent(i, data) {
|
|
9805
|
+
return this.intentManager.publish(i, data);
|
|
9806
|
+
}
|
|
9807
|
+
routing(i, option) {
|
|
9808
|
+
if (i instanceof Intent) {
|
|
9809
|
+
return this.routerManager.routing(i, option);
|
|
9810
|
+
} else if (typeof i === "string") {
|
|
9811
|
+
const intent = new Intent(i);
|
|
9812
|
+
return this.routerManager.routing(intent, option);
|
|
9813
|
+
} else {
|
|
9814
|
+
const intent = new Intent(i.path, i.data);
|
|
9815
|
+
return this.routerManager.routing(intent, option);
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
};
|
|
9819
|
+
|
|
7453
9820
|
// ../core-web/dist/esm/element/CanvasUtils.js
|
|
7454
9821
|
var CanvasUtils;
|
|
7455
9822
|
((CanvasUtils2) => {
|
|
@@ -8211,73 +10578,391 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8211
10578
|
};
|
|
8212
10579
|
})(ValidUtils2 || (ValidUtils2 = {}));
|
|
8213
10580
|
|
|
8214
|
-
//
|
|
8215
|
-
var
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
10581
|
+
// ../simple-boot/dist/esm/index.js
|
|
10582
|
+
var import_reflect_metadata = __toESM(require_Reflect(), 1);
|
|
10583
|
+
|
|
10584
|
+
// ../simple-boot/dist/esm/alert/AlertAction.js
|
|
10585
|
+
var AlertAction = /* @__PURE__ */ ((AlertAction2) => {
|
|
10586
|
+
AlertAction2["ACTIVE"] = "ACTIVE";
|
|
10587
|
+
AlertAction2["IN_ACTIVE"] = "IN_ACTIVE";
|
|
10588
|
+
return AlertAction2;
|
|
10589
|
+
})(AlertAction || {});
|
|
10590
|
+
|
|
10591
|
+
// ../simple-boot/dist/esm/alert/Alert.js
|
|
10592
|
+
var Alert = class {
|
|
10593
|
+
constructor(alertService, config) {
|
|
10594
|
+
this.alertService = alertService;
|
|
10595
|
+
this.config = config;
|
|
10596
|
+
this.isActive = false;
|
|
10597
|
+
this.activateBefore = [];
|
|
10598
|
+
this.activateAfter = [];
|
|
10599
|
+
this.deActivateBefore = [];
|
|
10600
|
+
this.deActivateAfter = [];
|
|
10601
|
+
this.data = /* @__PURE__ */ new Map();
|
|
10602
|
+
if (config?.uuid) {
|
|
10603
|
+
this.uuid = config.uuid;
|
|
10604
|
+
} else {
|
|
10605
|
+
this.uuid = RandomUtils.uuid();
|
|
10606
|
+
}
|
|
10607
|
+
}
|
|
10608
|
+
addOpenBefore(fn) {
|
|
10609
|
+
this.activateBefore.push(fn);
|
|
10610
|
+
}
|
|
10611
|
+
addOpenAfter(fn) {
|
|
10612
|
+
this.activateAfter.push(fn);
|
|
10613
|
+
}
|
|
10614
|
+
addCloseBefore(fn) {
|
|
10615
|
+
this.deActivateBefore.push(fn);
|
|
10616
|
+
}
|
|
10617
|
+
addCloseAfter(fn) {
|
|
10618
|
+
this.deActivateAfter.push(fn);
|
|
10619
|
+
}
|
|
10620
|
+
setData(key, value) {
|
|
10621
|
+
this.data.set(key, value);
|
|
10622
|
+
}
|
|
10623
|
+
getData(key) {
|
|
10624
|
+
return this.data.get(key);
|
|
10625
|
+
}
|
|
10626
|
+
async activate() {
|
|
10627
|
+
try {
|
|
10628
|
+
await Promise.allSettled(this.activateBefore.map((it) => it())).then((it) => {
|
|
10629
|
+
this.result = this.make();
|
|
10630
|
+
this.alertService?.publish({ action: AlertAction.ACTIVE, alert: this });
|
|
10631
|
+
this.isActive = true;
|
|
10632
|
+
if (this.config?.closeTime !== void 0 && this.config?.closeTime > 0) {
|
|
10633
|
+
setTimeout(() => {
|
|
10634
|
+
this.deActivate();
|
|
10635
|
+
}, this.config.closeTime);
|
|
10636
|
+
}
|
|
10637
|
+
this.config?.activate?.(this.result, this);
|
|
10638
|
+
});
|
|
10639
|
+
} catch (e) {
|
|
10640
|
+
} finally {
|
|
10641
|
+
await Promise.allSettled(this.activateAfter.map((it) => it())).then((it) => {
|
|
10642
|
+
});
|
|
10643
|
+
}
|
|
10644
|
+
}
|
|
10645
|
+
async deActivate() {
|
|
10646
|
+
try {
|
|
10647
|
+
await Promise.allSettled(this.deActivateBefore.map((it) => it())).then((it) => {
|
|
10648
|
+
this.alertService?.publish({ action: AlertAction.IN_ACTIVE, alert: this });
|
|
10649
|
+
this.isActive = false;
|
|
10650
|
+
this.config?.deActivate?.(this.result, this);
|
|
10651
|
+
});
|
|
10652
|
+
} catch (e) {
|
|
10653
|
+
} finally {
|
|
10654
|
+
await Promise.allSettled(this.deActivateAfter.map((it) => it())).then((it) => {
|
|
10655
|
+
});
|
|
10656
|
+
}
|
|
10657
|
+
}
|
|
10658
|
+
};
|
|
10659
|
+
|
|
10660
|
+
// ../simple-boot/dist/esm/alert/AlertFactory.js
|
|
10661
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
10662
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10663
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10664
|
+
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;
|
|
10665
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10666
|
+
};
|
|
10667
|
+
var AlertFactory;
|
|
10668
|
+
(function(AlertFactory2) {
|
|
10669
|
+
AlertFactory2.SYMBOL = Symbol.for("simple-boot:alert-factory-token");
|
|
10670
|
+
})(AlertFactory || (AlertFactory = {}));
|
|
10671
|
+
var DefaultAlertFactory = class DefaultAlertFactory2 {
|
|
10672
|
+
create(data) {
|
|
10673
|
+
return void 0;
|
|
10674
|
+
}
|
|
10675
|
+
};
|
|
10676
|
+
DefaultAlertFactory = __decorate([
|
|
10677
|
+
Sim({ symbol: AlertFactory.SYMBOL })
|
|
10678
|
+
], DefaultAlertFactory);
|
|
10679
|
+
|
|
10680
|
+
// ../simple-boot/dist/esm/alert/AlertType.js
|
|
10681
|
+
var AlertType = /* @__PURE__ */ ((AlertType2) => {
|
|
10682
|
+
AlertType2["DANGER"] = "DANGER";
|
|
10683
|
+
AlertType2["NORMAL"] = "NORMAL";
|
|
10684
|
+
AlertType2["PROGRESS"] = "PROGRESS";
|
|
10685
|
+
AlertType2["SUCCESS"] = "SUCCESS";
|
|
10686
|
+
AlertType2["ERROR"] = "ERROR";
|
|
10687
|
+
AlertType2["INFO"] = "INFO";
|
|
10688
|
+
AlertType2["WARNING"] = "WARNING";
|
|
10689
|
+
AlertType2["CONSOLE"] = "CONSOLE";
|
|
10690
|
+
AlertType2["ETC"] = "ETC";
|
|
10691
|
+
return AlertType2;
|
|
10692
|
+
})(AlertType || {});
|
|
10693
|
+
|
|
10694
|
+
// ../simple-boot/dist/esm/alert/AlertService.js
|
|
10695
|
+
var __decorate2 = function(decorators, target, key, desc) {
|
|
10696
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10697
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10698
|
+
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;
|
|
10699
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10700
|
+
};
|
|
10701
|
+
var __metadata = function(k, v) {
|
|
10702
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10703
|
+
};
|
|
10704
|
+
var __param = function(paramIndex, decorator) {
|
|
10705
|
+
return function(target, key) {
|
|
10706
|
+
decorator(target, key, paramIndex);
|
|
10707
|
+
};
|
|
10708
|
+
};
|
|
10709
|
+
var _a;
|
|
10710
|
+
var AlertService = class AlertService2 {
|
|
10711
|
+
constructor(alertFactory) {
|
|
10712
|
+
this.name = (/* @__PURE__ */ new Date()).toUTCString();
|
|
10713
|
+
this.subject = new ReplaySubject();
|
|
10714
|
+
this.alertFactory = alertFactory;
|
|
10715
|
+
}
|
|
10716
|
+
// @PostConstruct
|
|
10717
|
+
// postConstruct(
|
|
10718
|
+
// ) {
|
|
10719
|
+
// this.alertFactory = alertFactory;
|
|
10720
|
+
// }
|
|
10721
|
+
get observable() {
|
|
10722
|
+
return this.subject.asObservable();
|
|
10723
|
+
}
|
|
10724
|
+
publish(data) {
|
|
10725
|
+
this.subject.next(data);
|
|
10726
|
+
}
|
|
10727
|
+
create(factory, config) {
|
|
10728
|
+
return new class extends Alert {
|
|
10729
|
+
make() {
|
|
10730
|
+
return factory(this);
|
|
10731
|
+
}
|
|
10732
|
+
}(this, config);
|
|
10733
|
+
}
|
|
10734
|
+
createFromFactory(type, config) {
|
|
10735
|
+
return this.alertFactory?.create({ caller: this, type, config });
|
|
10736
|
+
}
|
|
10737
|
+
danger(config) {
|
|
10738
|
+
return this.createFromFactory(AlertType.DANGER, config);
|
|
10739
|
+
}
|
|
10740
|
+
progress(config) {
|
|
10741
|
+
config = config ?? {};
|
|
10742
|
+
return this.createFromFactory(AlertType.PROGRESS, config);
|
|
10743
|
+
}
|
|
10744
|
+
success(config) {
|
|
10745
|
+
return this.createFromFactory(AlertType.SUCCESS, config);
|
|
10746
|
+
}
|
|
10747
|
+
info(config) {
|
|
10748
|
+
return this.createFromFactory(AlertType.INFO, config);
|
|
10749
|
+
}
|
|
10750
|
+
error(config) {
|
|
10751
|
+
return this.createFromFactory(AlertType.ERROR, config);
|
|
10752
|
+
}
|
|
10753
|
+
warning(config) {
|
|
10754
|
+
return this.createFromFactory(AlertType.WARNING, config);
|
|
10755
|
+
}
|
|
10756
|
+
};
|
|
10757
|
+
AlertService = __decorate2([
|
|
10758
|
+
Sim,
|
|
10759
|
+
__param(0, Inject({ symbol: AlertFactory.SYMBOL })),
|
|
10760
|
+
__metadata("design:paramtypes", [typeof (_a = typeof AlertFactory !== "undefined" && AlertFactory) === "function" ? _a : Object])
|
|
10761
|
+
], AlertService);
|
|
10762
|
+
|
|
10763
|
+
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
10764
|
+
var simpleApplicationCache = /* @__PURE__ */ new WeakMap();
|
|
10765
|
+
var getCacheSet = (simpleApplication) => {
|
|
10766
|
+
return simpleApplicationCache.get(simpleApplication);
|
|
10767
|
+
};
|
|
10768
|
+
var findCacheByKey = (simpleApplication, key) => {
|
|
10769
|
+
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10770
|
+
if (storage) {
|
|
10771
|
+
return Array.from(storage.config.entries()).find(([k, v]) => k === key);
|
|
10772
|
+
}
|
|
10773
|
+
};
|
|
10774
|
+
var findCacheByKeyStartWith = (simpleApplication, key) => {
|
|
10775
|
+
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10776
|
+
if (storage) {
|
|
10777
|
+
return Array.from(storage.config.entries()).filter(([k, v]) => k.startsWith(key));
|
|
10778
|
+
} else {
|
|
10779
|
+
return [];
|
|
10780
|
+
}
|
|
10781
|
+
};
|
|
10782
|
+
var deleteCacheByKey = (simpleApplication, key) => {
|
|
10783
|
+
const storage = simpleApplicationCache.get(simpleApplication);
|
|
10784
|
+
if (storage) {
|
|
10785
|
+
storage.storage.delete(key);
|
|
10786
|
+
findCacheByKeyStartWith(simpleApplication, key).forEach(([k, v]) => {
|
|
10787
|
+
const data = storage.config.get(k);
|
|
10788
|
+
if (data?.expireTimeout) {
|
|
10789
|
+
clearTimeout(data.expireTimeout);
|
|
10790
|
+
}
|
|
10791
|
+
storage.config.delete(k);
|
|
10792
|
+
storage.storage.delete(k);
|
|
10793
|
+
});
|
|
10794
|
+
}
|
|
10795
|
+
};
|
|
10796
|
+
var deleteCacheByKeyStartWith = (simpleApplication, key) => {
|
|
10797
|
+
findCacheByKeyStartWith(simpleApplication, key).forEach(([key2, data]) => deleteCacheByKey(simpleApplication, key2));
|
|
10798
|
+
};
|
|
10799
|
+
var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
|
|
10800
|
+
|
|
10801
|
+
// ../simple-boot/dist/esm/cache/CacheManager.js
|
|
10802
|
+
var __decorate3 = function(decorators, target, key, desc) {
|
|
10803
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10804
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10805
|
+
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;
|
|
10806
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10807
|
+
};
|
|
10808
|
+
var __metadata2 = function(k, v) {
|
|
10809
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10810
|
+
};
|
|
10811
|
+
var _a2;
|
|
10812
|
+
var CacheManager = class CacheManager2 {
|
|
10813
|
+
constructor(simpleApplication) {
|
|
10814
|
+
this.simpleApplication = simpleApplication;
|
|
10815
|
+
}
|
|
10816
|
+
findCacheByKey(key) {
|
|
10817
|
+
return findCacheByKey(this.simpleApplication, key);
|
|
10818
|
+
}
|
|
10819
|
+
findCacheByKeyStartWith(key) {
|
|
10820
|
+
return findCacheByKeyStartWith(this.simpleApplication, key);
|
|
10821
|
+
}
|
|
10822
|
+
deleteCacheByKey(key) {
|
|
10823
|
+
return deleteCacheByKey(this.simpleApplication, key);
|
|
10824
|
+
}
|
|
10825
|
+
deleteCacheByKeyStartWith(key) {
|
|
10826
|
+
return deleteCacheByKeyStartWith(this.simpleApplication, key);
|
|
10827
|
+
}
|
|
10828
|
+
getCacheSet() {
|
|
10829
|
+
return getCacheSet(this.simpleApplication);
|
|
10830
|
+
}
|
|
10831
|
+
};
|
|
10832
|
+
CacheManager = __decorate3([
|
|
10833
|
+
Sim,
|
|
10834
|
+
__metadata2("design:paramtypes", [typeof (_a2 = typeof SimpleApplication !== "undefined" && SimpleApplication) === "function" ? _a2 : Object])
|
|
10835
|
+
], CacheManager);
|
|
10836
|
+
|
|
10837
|
+
// ../simple-boot/dist/esm/decorators/event/EventListener.js
|
|
10838
|
+
var EventListenerMetadataKey = Symbol.for("simple-boot:event-listener-metadata");
|
|
10839
|
+
|
|
10840
|
+
// ../simple-boot/dist/esm/decorators/validate/Validation.js
|
|
10841
|
+
var ValidMetadataKey = Symbol.for("simple-boot:valid-metadata");
|
|
10842
|
+
var ValidationMetadataKey = Symbol.for("simple-boot:validation-metadata");
|
|
10843
|
+
|
|
10844
|
+
// ../simple-boot/dist/esm/fetch/ApiService.js
|
|
10845
|
+
var __decorate4 = function(decorators, target, key, desc) {
|
|
10846
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10847
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10848
|
+
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;
|
|
10849
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10850
|
+
};
|
|
10851
|
+
var __metadata3 = function(k, v) {
|
|
10852
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10853
|
+
};
|
|
10854
|
+
var _a3;
|
|
10855
|
+
var _b;
|
|
10856
|
+
var ApiServiceInterceptor;
|
|
10857
|
+
(function(ApiServiceInterceptor2) {
|
|
10858
|
+
ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
|
|
10859
|
+
ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
|
|
10860
|
+
try {
|
|
10861
|
+
return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
|
|
10862
|
+
} catch (e) {
|
|
10863
|
+
return [];
|
|
10864
|
+
}
|
|
8243
10865
|
};
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
10866
|
+
})(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
|
|
10867
|
+
var ApiService = class ApiService2 extends HttpJsonFetcher {
|
|
10868
|
+
constructor(simstanceManager, alertService) {
|
|
10869
|
+
super();
|
|
10870
|
+
this.simstanceManager = simstanceManager;
|
|
10871
|
+
this.subject = new Subject();
|
|
10872
|
+
this.alertService = alertService;
|
|
10873
|
+
}
|
|
10874
|
+
// @PostConstruct
|
|
10875
|
+
// postConstruct(alertService: AlertService<any>) {
|
|
10876
|
+
// this.alertService = alertService;
|
|
10877
|
+
// }
|
|
10878
|
+
get observable() {
|
|
10879
|
+
return this.subject.asObservable();
|
|
10880
|
+
}
|
|
10881
|
+
createPipe(config) {
|
|
10882
|
+
return {};
|
|
10883
|
+
}
|
|
10884
|
+
async beforeProxyFetch(config) {
|
|
10885
|
+
let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
|
|
10886
|
+
for (const interceptor of interceptors) {
|
|
10887
|
+
if (interceptor.beforeProxyFetch) {
|
|
10888
|
+
config = await interceptor.beforeProxyFetch(config);
|
|
10889
|
+
}
|
|
10890
|
+
}
|
|
10891
|
+
this.subject.next({ type: "beforeFetchData", config });
|
|
10892
|
+
return config;
|
|
10893
|
+
}
|
|
10894
|
+
async afterProxyFetch(config) {
|
|
10895
|
+
let interceptors = ApiServiceInterceptor.resolveAll(this.simstanceManager);
|
|
10896
|
+
let r = config.response;
|
|
10897
|
+
for (const interceptor of interceptors) {
|
|
10898
|
+
if (interceptor.afterProxyFetch) {
|
|
10899
|
+
r = await interceptor.afterProxyFetch(config);
|
|
10900
|
+
}
|
|
10901
|
+
}
|
|
10902
|
+
this.subject.next({ type: "afterFetchData", response: r });
|
|
10903
|
+
return r;
|
|
10904
|
+
}
|
|
10905
|
+
beforeFetch(fetch2) {
|
|
10906
|
+
this.subject.next({ type: "beforeFetch", fetch: fetch2 });
|
|
10907
|
+
}
|
|
10908
|
+
afterFetch(fetch2, response) {
|
|
10909
|
+
this.subject.next({ type: "afterFetch", fetch: fetch2, response });
|
|
10910
|
+
}
|
|
10911
|
+
before(config, pipe) {
|
|
10912
|
+
this.subject.next({ type: "progress", config, pipe });
|
|
10913
|
+
config.config?.config?.callBackProgress?.(config, pipe);
|
|
10914
|
+
if (config.config?.config?.alertProgress) {
|
|
10915
|
+
const alert = this.alertService?.progress({ title: config.config.config.title });
|
|
10916
|
+
if (alert) {
|
|
10917
|
+
pipe.progress = alert;
|
|
10918
|
+
alert.activate();
|
|
10919
|
+
}
|
|
10920
|
+
}
|
|
10921
|
+
}
|
|
10922
|
+
afterSuccess(config, pipe) {
|
|
10923
|
+
this.subject.next({ type: "success", config, pipe });
|
|
10924
|
+
config.config?.config?.callBackSuccess?.(config, pipe);
|
|
10925
|
+
if (config.config?.config?.alertSuccessMsg) {
|
|
10926
|
+
this.alertService?.success({ title: config.config.config.title })?.activate();
|
|
10927
|
+
}
|
|
10928
|
+
}
|
|
10929
|
+
afterSuccessTransform(config, pipe) {
|
|
10930
|
+
}
|
|
10931
|
+
finally(config, pipe) {
|
|
10932
|
+
this.subject.next({ type: "final", config, pipe });
|
|
10933
|
+
config.config?.config?.callBackFinal?.(config, pipe);
|
|
10934
|
+
pipe.progress?.deActivate();
|
|
10935
|
+
}
|
|
10936
|
+
error(config, pipe, e) {
|
|
10937
|
+
console.log("error", e);
|
|
10938
|
+
this.subject.next({ type: "error", config, pipe, e });
|
|
10939
|
+
config.config?.config?.callBackError?.(config, pipe, e);
|
|
10940
|
+
if (config.config?.config?.alertErrorMsg) {
|
|
10941
|
+
this.alertService?.danger({
|
|
10942
|
+
title: `${config.config.config.title ? config.config.config.title : ""}${e.message ? `(${e.message})` : ""}`
|
|
10943
|
+
})?.activate();
|
|
10944
|
+
}
|
|
10945
|
+
if (config.config?.config?.enableErrorConsole) {
|
|
10946
|
+
console.error(`apiService Error ${config?.config?.config?.title}`, e);
|
|
10947
|
+
}
|
|
10948
|
+
}
|
|
10949
|
+
async execute(fetcherRequest) {
|
|
10950
|
+
const target = fetcherRequest.target;
|
|
10951
|
+
const config = fetcherRequest.config;
|
|
10952
|
+
let r = { target, config };
|
|
10953
|
+
const interceptor = ApiServiceInterceptor.resolveAll(this.simstanceManager) ?? [];
|
|
10954
|
+
for (const apiServiceInterceptor of interceptor) {
|
|
10955
|
+
if (apiServiceInterceptor.beforeProxyExecute) {
|
|
10956
|
+
r = await apiServiceInterceptor.beforeProxyExecute?.(r);
|
|
10957
|
+
}
|
|
10958
|
+
}
|
|
10959
|
+
return super.execute(r);
|
|
10960
|
+
}
|
|
10961
|
+
};
|
|
10962
|
+
ApiService = __decorate4([
|
|
10963
|
+
Sim,
|
|
10964
|
+
__metadata3("design:paramtypes", [typeof (_a3 = typeof SimstanceManager !== "undefined" && SimstanceManager) === "function" ? _a3 : Object, typeof (_b = typeof AlertService !== "undefined" && AlertService) === "function" ? _b : Object])
|
|
10965
|
+
], ApiService);
|
|
8281
10966
|
return __toCommonJS(bundle_entry_exports);
|
|
8282
10967
|
})();
|
|
8283
10968
|
/*! Bundled license information:
|