@dooboostore/simple-web-component 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +384 -93
  2. package/dist/cjs/SwcAppEngine.js +3 -0
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/addEventListener.js +20 -4
  5. package/dist/cjs/decorators/addEventListener.js.map +2 -2
  6. package/dist/cjs/decorators/applyAttribute.js.map +1 -1
  7. package/dist/cjs/decorators/applyClass.js.map +1 -1
  8. package/dist/cjs/decorators/applyNode.js +97 -15
  9. package/dist/cjs/decorators/applyNode.js.map +2 -2
  10. package/dist/cjs/decorators/applySlot.js +16 -9
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/applyStyle.js.map +2 -2
  13. package/dist/cjs/decorators/attribute.js.map +1 -1
  14. package/dist/cjs/decorators/elementDefine.js +68 -38
  15. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  16. package/dist/cjs/decorators/emitCustomEvent.js.map +1 -1
  17. package/dist/cjs/decorators/index.js +1 -0
  18. package/dist/cjs/decorators/index.js.map +2 -2
  19. package/dist/cjs/decorators/lifecycles.js +47 -31
  20. package/dist/cjs/decorators/lifecycles.js.map +3 -3
  21. package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
  22. package/dist/cjs/decorators/query.js +1 -1
  23. package/dist/cjs/decorators/query.js.map +2 -2
  24. package/dist/cjs/decorators/queryAll.js.map +1 -1
  25. package/dist/cjs/decorators/setProperty.js.map +1 -1
  26. package/dist/cjs/decorators/state.js +84 -0
  27. package/dist/cjs/decorators/state.js.map +7 -0
  28. package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  29. package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  30. package/dist/cjs/elements/SwcApp.js +193 -305
  31. package/dist/cjs/elements/SwcApp.js.map +3 -3
  32. package/dist/cjs/elements/SwcAppMixin.js +291 -0
  33. package/dist/cjs/elements/SwcAppMixin.js.map +7 -0
  34. package/dist/cjs/elements/index.js +3 -21
  35. package/dist/cjs/elements/index.js.map +3 -3
  36. package/dist/cjs/index.js +1 -3
  37. package/dist/cjs/index.js.map +2 -2
  38. package/dist/cjs/{types.js → types/index.js} +1 -1
  39. package/dist/cjs/types/index.js.map +7 -0
  40. package/dist/cjs/types/window.d.js.map +1 -1
  41. package/dist/cjs/utils/Utils.js +159 -20
  42. package/dist/cjs/utils/Utils.js.map +3 -3
  43. package/dist/esm/SwcAppEngine.js +3 -0
  44. package/dist/esm/SwcAppEngine.js.map +2 -2
  45. package/dist/esm/decorators/addEventListener.js +20 -4
  46. package/dist/esm/decorators/addEventListener.js.map +2 -2
  47. package/dist/esm/decorators/applyAttribute.js.map +1 -1
  48. package/dist/esm/decorators/applyClass.js.map +1 -1
  49. package/dist/esm/decorators/applyNode.js +97 -15
  50. package/dist/esm/decorators/applyNode.js.map +2 -2
  51. package/dist/esm/decorators/applySlot.js +16 -9
  52. package/dist/esm/decorators/applySlot.js.map +2 -2
  53. package/dist/esm/decorators/applyStyle.js.map +2 -2
  54. package/dist/esm/decorators/attribute.js.map +1 -1
  55. package/dist/esm/decorators/elementDefine.js +72 -42
  56. package/dist/esm/decorators/elementDefine.js.map +2 -2
  57. package/dist/esm/decorators/emitCustomEvent.js.map +1 -1
  58. package/dist/esm/decorators/index.js +1 -0
  59. package/dist/esm/decorators/index.js.map +2 -2
  60. package/dist/esm/decorators/lifecycles.js +47 -31
  61. package/dist/esm/decorators/lifecycles.js.map +3 -3
  62. package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
  63. package/dist/esm/decorators/query.js +1 -1
  64. package/dist/esm/decorators/query.js.map +2 -2
  65. package/dist/esm/decorators/queryAll.js.map +1 -1
  66. package/dist/esm/decorators/setProperty.js.map +1 -1
  67. package/dist/esm/decorators/state.js +65 -0
  68. package/dist/esm/decorators/state.js.map +7 -0
  69. package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +1 -1
  70. package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
  71. package/dist/esm/elements/SwcApp.js +195 -307
  72. package/dist/esm/elements/SwcApp.js.map +3 -3
  73. package/dist/esm/elements/SwcAppMixin.js +273 -0
  74. package/dist/esm/elements/SwcAppMixin.js.map +7 -0
  75. package/dist/esm/elements/index.js +2 -7
  76. package/dist/esm/elements/index.js.map +2 -2
  77. package/dist/esm/index.js +2 -4
  78. package/dist/esm/index.js.map +2 -2
  79. package/dist/esm/{types.js → types/index.js} +1 -1
  80. package/dist/esm/types/index.js.map +7 -0
  81. package/dist/esm/utils/Utils.js +159 -20
  82. package/dist/esm/utils/Utils.js.map +3 -3
  83. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +3356 -2477
  84. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  85. package/dist/types/SwcAppEngine.d.ts +1 -1
  86. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  87. package/dist/types/decorators/addEventListener.d.ts +5 -2
  88. package/dist/types/decorators/addEventListener.d.ts.map +1 -1
  89. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  90. package/dist/types/decorators/applyClass.d.ts.map +1 -1
  91. package/dist/types/decorators/applyNode.d.ts +22 -6
  92. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  93. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  94. package/dist/types/decorators/applyStyle.d.ts.map +1 -1
  95. package/dist/types/decorators/attribute.d.ts.map +1 -1
  96. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  97. package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
  98. package/dist/types/decorators/index.d.ts +1 -0
  99. package/dist/types/decorators/index.d.ts.map +1 -1
  100. package/dist/types/decorators/lifecycles.d.ts +10 -14
  101. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  102. package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
  103. package/dist/types/decorators/query.d.ts +1 -1
  104. package/dist/types/decorators/query.d.ts.map +1 -1
  105. package/dist/types/decorators/queryAll.d.ts.map +1 -1
  106. package/dist/types/decorators/setProperty.d.ts +1 -1
  107. package/dist/types/decorators/setProperty.d.ts.map +1 -1
  108. package/dist/types/decorators/state.d.ts +9 -0
  109. package/dist/types/decorators/state.d.ts.map +1 -0
  110. package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
  111. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +5 -1
  112. package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
  113. package/dist/types/elements/SwcApp.d.ts +35 -6
  114. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  115. package/dist/types/elements/SwcAppMixin.d.ts +405 -0
  116. package/dist/types/elements/SwcAppMixin.d.ts.map +1 -0
  117. package/dist/types/elements/index.d.ts +2 -2
  118. package/dist/types/elements/index.d.ts.map +1 -1
  119. package/dist/types/index.d.ts +1 -1
  120. package/dist/types/index.d.ts.map +1 -1
  121. package/dist/types/{types.d.ts → types/index.d.ts} +11 -11
  122. package/dist/types/types/index.d.ts.map +1 -0
  123. package/dist/types/utils/Utils.d.ts +14 -2
  124. package/dist/types/utils/Utils.d.ts.map +1 -1
  125. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +3358 -2479
  126. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  127. package/package.json +4 -4
  128. package/src/SwcAppEngine.ts +6 -2
  129. package/src/decorators/addEventListener.ts +21 -5
  130. package/src/decorators/applyAttribute.ts +1 -1
  131. package/src/decorators/applyClass.ts +1 -1
  132. package/src/decorators/applyNode.ts +180 -62
  133. package/src/decorators/applySlot.ts +27 -67
  134. package/src/decorators/applyStyle.ts +4 -4
  135. package/src/decorators/attribute.ts +1 -1
  136. package/src/decorators/elementDefine.ts +110 -58
  137. package/src/decorators/emitCustomEvent.ts +1 -1
  138. package/src/decorators/index.ts +2 -0
  139. package/src/decorators/lifecycles.ts +50 -26
  140. package/src/decorators/publishSwcAppMessage.ts +2 -3
  141. package/src/decorators/query.ts +4 -4
  142. package/src/decorators/queryAll.ts +1 -1
  143. package/src/decorators/setProperty.ts +1 -1
  144. package/src/decorators/state.ts +84 -0
  145. package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +1 -1
  146. package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +4 -3
  147. package/src/elements/SwcApp.ts +239 -441
  148. package/src/elements/SwcAppMixin.ts +328 -0
  149. package/src/elements/index.ts +2 -9
  150. package/src/index.ts +2 -4
  151. package/src/{types.ts → types/index.ts} +13 -10
  152. package/src/types/window.d.ts +3 -0
  153. package/src/utils/Utils.ts +205 -20
  154. package/dist/cjs/types.js.map +0 -7
  155. package/dist/esm/types.js.map +0 -7
  156. package/dist/types/types.d.ts.map +0 -1
@@ -0,0 +1,291 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
+ var SwcAppMixin_exports = {};
21
+ __export(SwcAppMixin_exports, {
22
+ SwcAppMixin: () => SwcAppMixin,
23
+ isSSR: () => isSSR,
24
+ removeSSRAttribute: () => removeSSRAttribute,
25
+ setSSRAttribute: () => setSSRAttribute
26
+ });
27
+ module.exports = __toCommonJS(SwcAppMixin_exports);
28
+ var import_decorators = require("../decorators");
29
+ var import_SwcAppEngine = require("../SwcAppEngine");
30
+ var import_core = require("@dooboostore/core");
31
+ var import_Utils = require("../utils/Utils");
32
+ const isSSR = (i) => {
33
+ return i.hasAttribute("swc-use-ssr");
34
+ };
35
+ const setSSRAttribute = (i) => {
36
+ i.setAttribute("swc-use-ssr", i._swcId ?? "");
37
+ };
38
+ const removeSSRAttribute = (i) => {
39
+ i.removeAttribute("swc-use-ssr");
40
+ };
41
+ function SwcAppMixin(Base) {
42
+ return class SwcAppMixinClass extends Base {
43
+ constructor(...args) {
44
+ super(...args);
45
+ __publicField(this, "__swc_engine", new import_SwcAppEngine.SwcAppEngine(this));
46
+ __publicField(this, "_swc_connected_instance", /* @__PURE__ */ new Set());
47
+ __publicField(this, "_routerSubscription");
48
+ __publicField(this, "_lastRouterEvent");
49
+ __publicField(this, "_routeChangeInvocations", 0);
50
+ __publicField(this, "_connectedInvocations", 0);
51
+ __publicField(this, "_childrenRouteChangedInterval");
52
+ __publicField(this, "_childrenConnectedDoneInterval");
53
+ /**
54
+ * Safari is 속성 처리
55
+ * Safari polyfill에서는 자식부터 만들어지고 부모가 만들어지므로
56
+ * 부모가 자식들을 강제로 등록해주는 형태로 처리
57
+ */
58
+ __publicField(this, "_connected_safari_and_standby", []);
59
+ console.log("[SWC-APP-MIXIN] constructor");
60
+ }
61
+ get simpleApplication() {
62
+ return this.__swc_engine.simpleApplication;
63
+ }
64
+ get config() {
65
+ return this.__swc_engine?.config;
66
+ }
67
+ get router() {
68
+ return this.__swc_engine?.router;
69
+ }
70
+ async _invokeRouteChangeSubscribers(instance, re) {
71
+ if (instance.isConnected === false) return;
72
+ this._routeChangeInvocations++;
73
+ if (this._childrenRouteChangedInterval) {
74
+ this.config.window.clearInterval(this._childrenRouteChangedInterval);
75
+ }
76
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
77
+ this._childrenRouteChangedInterval = (0, import_core.debounceTimeIntervalLock)(
78
+ () => this._routeChangeInvocations === 0,
79
+ () => {
80
+ this._childrenRouteChangedInterval = null;
81
+ this.config.onChildrenRouteChanged?.(re, this);
82
+ },
83
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
84
+ intervalConfig
85
+ );
86
+ try {
87
+ const routeChangeSubscribers = (0, import_decorators.getSubscribeSwcAppRouteChangeWhileConnectedMetadata)(instance);
88
+ if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
89
+ console.log("[SWC-MIXIN] Route change subscribers found");
90
+ const ps = routeChangeSubscribers.map(async (metadata) => {
91
+ const methodName = metadata.propertyKey;
92
+ let pathPattern = metadata.options?.path;
93
+ const filter = metadata.options?.filter;
94
+ if (typeof pathPattern === "function") {
95
+ pathPattern = pathPattern(instance);
96
+ }
97
+ let pathMatched = false;
98
+ let pathData = null;
99
+ if (!pathPattern) {
100
+ pathMatched = true;
101
+ pathData = {};
102
+ } else if (Array.isArray(pathPattern)) {
103
+ for (const pattern of pathPattern) {
104
+ const data = import_Utils.SwcUtils.parsePathPattern(pattern, re.path || "/");
105
+ if (data !== null) {
106
+ pathMatched = true;
107
+ pathData = data;
108
+ break;
109
+ }
110
+ }
111
+ } else {
112
+ pathData = import_Utils.SwcUtils.parsePathPattern(pathPattern, re.path || "/");
113
+ pathMatched = pathData !== null;
114
+ }
115
+ const hostSet = import_Utils.SwcUtils.getHelperAndHostSet(this.config.window, this);
116
+ const filterPassed = !filter || filter(this.router, { helper: hostSet, currentThis: instance });
117
+ if (pathMatched && filterPassed && instance[methodName]) {
118
+ await instance[methodName]({ ...re, pathData });
119
+ }
120
+ });
121
+ await Promise.allSettled(ps);
122
+ }
123
+ } finally {
124
+ if (this.config?.ssr) {
125
+ setSSRAttribute(instance);
126
+ } else {
127
+ removeSSRAttribute(instance);
128
+ }
129
+ this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
130
+ }
131
+ }
132
+ async _connected(instance, option) {
133
+ if (instance) {
134
+ if (!this.simpleApplication && !this.config) {
135
+ this._connected_safari_and_standby.push(instance);
136
+ return;
137
+ }
138
+ this.config.onConnectedChildBefore?.(instance);
139
+ if (!option?.noIncrements) {
140
+ this._connectedInvocations++;
141
+ }
142
+ this._swc_connected_instance.add(instance);
143
+ const connectedSwcAppCallBacks = (0, import_decorators.findAllLifecycleMetadata)(instance, import_decorators.ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
144
+ for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
145
+ await instance?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
146
+ }
147
+ if (this._childrenConnectedDoneInterval) {
148
+ this.config.window.clearInterval(this._childrenConnectedDoneInterval);
149
+ }
150
+ const intervalConfig = { setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window) };
151
+ this._childrenConnectedDoneInterval = (0, import_core.debounceTimeIntervalLock)(
152
+ () => this._connectedInvocations === 0,
153
+ () => {
154
+ this._childrenConnectedDoneInterval = null;
155
+ this.config.onChildrenConnectedDone?.(this);
156
+ },
157
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
158
+ intervalConfig
159
+ );
160
+ if (this.simpleApplication) {
161
+ try {
162
+ if (this.router && this._lastRouterEvent) {
163
+ await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent);
164
+ }
165
+ } catch (e) {
166
+ throw e;
167
+ }
168
+ }
169
+ if (this.config?.ssr) {
170
+ setSSRAttribute(instance);
171
+ } else {
172
+ removeSSRAttribute(instance);
173
+ }
174
+ }
175
+ this.config.onConnectedChildAfter?.(instance);
176
+ return this;
177
+ }
178
+ async _connectedDone(instance) {
179
+ try {
180
+ } finally {
181
+ this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
182
+ }
183
+ }
184
+ _disconnected(instance) {
185
+ if (instance) {
186
+ this._swc_connected_instance.delete(instance);
187
+ this.config?.onDisconnectedChildAfter?.(instance);
188
+ }
189
+ }
190
+ async _handleRouteChange(route) {
191
+ this._lastRouterEvent = route;
192
+ const swcConnectedInstance = Array.from(this._swc_connected_instance);
193
+ const ps = swcConnectedInstance.map((instance) => this._invokeRouteChangeSubscribers(instance, route));
194
+ await Promise.allSettled(ps);
195
+ }
196
+ async connect(config) {
197
+ console.log("[SWC-MIXIN] connect");
198
+ const swcConfig = {
199
+ routeType: "element",
200
+ window: config?.window,
201
+ ...config
202
+ };
203
+ await this.__swc_engine.connect(swcConfig);
204
+ this._connected_safari_and_standby.forEach((instance) => {
205
+ this._connected(instance, { noIncrements: true });
206
+ });
207
+ if (!this._routerSubscription && this.router) {
208
+ const config2 = this.__swc_engine.config;
209
+ this._routerSubscription = this.router.observable.subscribe(async (route) => {
210
+ console.log("[SWC-MIXIN] Router event received:", route.triggerPoint);
211
+ if (route.triggerPoint === "end") {
212
+ await this._handleRouteChange(route);
213
+ }
214
+ });
215
+ if (config2?.path) {
216
+ console.log("[DEBUG] Navigating to initial path:", config2.path);
217
+ }
218
+ }
219
+ }
220
+ connectedCallback() {
221
+ super.connectedCallback?.();
222
+ const configStr = this.getAttribute("swc-get-application-config");
223
+ const win = this.ownerDocument?.defaultView || window;
224
+ if (configStr && win) {
225
+ try {
226
+ const userConfig = import_core.FunctionUtils.executeReturn({
227
+ script: configStr,
228
+ context: this,
229
+ args: import_Utils.SwcUtils.getHelperAndHostSet(win, this)
230
+ });
231
+ this.connect(userConfig);
232
+ } catch (e) {
233
+ console.error("[SWC-MIXIN] Script execution failed:", e);
234
+ }
235
+ }
236
+ this._connected(this);
237
+ this.__swc_engine?.config?.onConnected?.(this);
238
+ this._connectedDone(this);
239
+ }
240
+ disconnectedCallback() {
241
+ super.disconnectedCallback?.();
242
+ this._routerSubscription?.unsubscribe();
243
+ this._routerSubscription = void 0;
244
+ this._lastRouterEvent = void 0;
245
+ this.__swc_engine.disconnect();
246
+ this.__swc_engine?.config?.onDisconnected?.(this);
247
+ this._disconnected(this);
248
+ }
249
+ async routing(path) {
250
+ await this.router?.go(path);
251
+ }
252
+ back() {
253
+ this.router?.back();
254
+ }
255
+ forward() {
256
+ this.router?.forward();
257
+ }
258
+ reload() {
259
+ this.router?.reload();
260
+ }
261
+ publishMessage(message) {
262
+ this._swc_connected_instance.forEach((instance) => {
263
+ this._invokeMessageSubscribers(instance, message);
264
+ });
265
+ }
266
+ _invokeMessageSubscribers(instance, message) {
267
+ const messageSubscribers = (0, import_decorators.getSubscribeSwcAppMessageWhileConnectedMetadata)(instance);
268
+ if (messageSubscribers && Array.isArray(messageSubscribers)) {
269
+ messageSubscribers.forEach((metadata) => {
270
+ const methodName = metadata.propertyKey;
271
+ const messageType = metadata.messageType;
272
+ const filter = metadata.filter;
273
+ let typeMatched = false;
274
+ if (!messageType) {
275
+ typeMatched = true;
276
+ } else if (message.type === messageType) {
277
+ typeMatched = true;
278
+ }
279
+ let filterMatched = true;
280
+ if (filter && typeMatched) {
281
+ filterMatched = filter(message, instance);
282
+ }
283
+ if (typeMatched && filterMatched && typeof instance[methodName] === "function") {
284
+ instance[methodName](message);
285
+ }
286
+ });
287
+ }
288
+ }
289
+ };
290
+ }
291
+ //# sourceMappingURL=SwcAppMixin.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/elements/SwcAppMixin.ts"],
4
+ "sourcesContent": ["import {SwcAppInterface, SwcAppMessage} from \"../types\";\nimport {findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY} from \"../decorators\";\nimport {SwcAppEngine, SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\nimport {debounceTimeIntervalLock, FunctionUtils, Subscription} from \"@dooboostore/core\";\nimport {RouterEventType} from \"@dooboostore/core-web\";\nimport {SwcUtils} from \"../utils/Utils\";\n\nexport const isSSR = (i: HTMLElement) => {\n return i.hasAttribute('swc-use-ssr');\n}\nexport const setSSRAttribute = (i: HTMLElement) => {\n i.setAttribute('swc-use-ssr', (i as any)._swcId ?? '');\n}\nexport const removeSSRAttribute = (i: HTMLElement) => {\n i.removeAttribute('swc-use-ssr');\n}\n\n/**\n * SwcAppMixin: SwcApp \uAE30\uB2A5\uC744 \uBAA8\uB4E0 HTMLElement\uC5D0 \uCD94\uAC00\uD560 \uC218 \uC788\uB294 Mixin\n * \n * \uC0AC\uC6A9 \uC608:\n * @elementDefine('custom-app', { window: w })\n * class CustomApp extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {\n * // \uCD94\uAC00 \uAE30\uB2A5 \uAD6C\uD604\n * }\n */\nexport function SwcAppMixin<T extends { new(...args: any[]): HTMLElement }>(Base: T) {\n return class SwcAppMixinClass extends Base implements SwcAppInterface {\n __swc_engine = new SwcAppEngine(this as any);\n _swc_connected_instance = new Set<any>();\n _routerSubscription?: Subscription;\n _lastRouterEvent?: RouterEventType;\n _routeChangeInvocations = 0;\n _connectedInvocations = 0;\n\n _childrenRouteChangedInterval: any;\n _childrenConnectedDoneInterval: any;\n\n /**\n * Safari is \uC18D\uC131 \uCC98\uB9AC\n * Safari polyfill\uC5D0\uC11C\uB294 \uC790\uC2DD\uBD80\uD130 \uB9CC\uB4E4\uC5B4\uC9C0\uACE0 \uBD80\uBAA8\uAC00 \uB9CC\uB4E4\uC5B4\uC9C0\uBBC0\uB85C\n * \uBD80\uBAA8\uAC00 \uC790\uC2DD\uB4E4\uC744 \uAC15\uC81C\uB85C \uB4F1\uB85D\uD574\uC8FC\uB294 \uD615\uD0DC\uB85C \uCC98\uB9AC\n */\n _connected_safari_and_standby = [];\n\n constructor(...args: any[]) {\n super(...args);\n console.log('[SWC-APP-MIXIN] constructor')\n }\n\n get simpleApplication() {\n return this.__swc_engine.simpleApplication;\n }\n\n get config() {\n return this.__swc_engine?.config;\n }\n\n get router() {\n return this.__swc_engine?.router;\n }\n\n async _invokeRouteChangeSubscribers(instance: HTMLElement, re: RouterEventType) {\n if (instance.isConnected === false) return;\n\n this._routeChangeInvocations++;\n\n if (this._childrenRouteChangedInterval) {\n this.config.window.clearInterval(this._childrenRouteChangedInterval);\n }\n const intervalConfig = {setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window)};\n this._childrenRouteChangedInterval = debounceTimeIntervalLock(\n () => this._routeChangeInvocations === 0,\n () => {\n this._childrenRouteChangedInterval = null;\n this.config.onChildrenRouteChanged?.(re, this)\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n try {\n const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);\n if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {\n console.log('[SWC-MIXIN] Route change subscribers found')\n const ps = routeChangeSubscribers.map(async metadata => {\n const methodName = metadata.propertyKey;\n let pathPattern = metadata.options?.path as any;\n const filter = metadata.options?.filter;\n\n if (typeof pathPattern === 'function') {\n pathPattern = (pathPattern as Function)(instance);\n }\n\n let pathMatched = false;\n let pathData: any = null;\n\n if (!pathPattern) {\n pathMatched = true;\n pathData = {};\n } else if (Array.isArray(pathPattern)) {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, re.path || '/');\n if (data !== null) {\n pathMatched = true;\n pathData = data;\n break;\n }\n }\n } else {\n pathData = SwcUtils.parsePathPattern(pathPattern, re.path || '/');\n pathMatched = pathData !== null;\n }\n\n const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);\n const filterPassed = !filter || filter(this.router!, {helper:hostSet, currentThis:instance});\n\n if (pathMatched && filterPassed && instance[methodName]) {\n await instance[methodName]({...re, pathData: pathData});\n }\n });\n await Promise.allSettled(ps);\n }\n } finally {\n if (this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);\n }\n }\n\n async _connected(instance: HTMLElement, option?: { noIncrements: boolean }) {\n if (instance) {\n if (!this.simpleApplication && !this.config) {\n this._connected_safari_and_standby.push(instance);\n return;\n }\n\n this.config.onConnectedChildBefore?.(instance);\n if (!option?.noIncrements) {\n this._connectedInvocations++;\n }\n this._swc_connected_instance.add(instance);\n\n const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];\n for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {\n await (instance as any)?._invokeLifecycleMethod?.(connectedSwcAppCallBack);\n }\n\n if (this._childrenConnectedDoneInterval) {\n this.config.window.clearInterval(this._childrenConnectedDoneInterval);\n }\n const intervalConfig = {setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window)};\n this._childrenConnectedDoneInterval = debounceTimeIntervalLock(\n () => this._connectedInvocations === 0,\n () => {\n this._childrenConnectedDoneInterval = null;\n this.config.onChildrenConnectedDone?.(this)\n },\n this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,\n intervalConfig\n );\n\n if (this.simpleApplication) {\n try {\n if (this.router && this._lastRouterEvent) {\n await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent!);\n }\n } catch (e) {\n throw e;\n }\n }\n\n if (this.config?.ssr) {\n setSSRAttribute(instance);\n } else {\n removeSSRAttribute(instance);\n }\n }\n\n this.config.onConnectedChildAfter?.(instance);\n return this;\n }\n\n async _connectedDone(instance: any) {\n try {\n // \uB0B4\uBD80 \uC5F0\uACB0 \uCC98\uB9AC \uB85C\uC9C1\n } finally {\n this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);\n }\n }\n\n _disconnected(instance: any) {\n if (instance) {\n this._swc_connected_instance.delete(instance);\n this.config?.onDisconnectedChildAfter?.(instance);\n }\n }\n\n async _handleRouteChange(route: RouterEventType) {\n this._lastRouterEvent = route;\n const swcConnectedInstance = Array.from(this._swc_connected_instance);\n const ps = swcConnectedInstance.map((instance: any) => this._invokeRouteChangeSubscribers(instance, route));\n await Promise.allSettled(ps);\n }\n\n async connect(config?: SwcAttributeConfigType) {\n console.log('[SWC-MIXIN] connect')\n const swcConfig = {\n routeType: 'element',\n window: config?.window,\n ...config\n } as SwcConfigType;\n\n await this.__swc_engine.connect(swcConfig);\n\n // Safari is \uC18D\uC131 \uCC98\uB9AC\n this._connected_safari_and_standby.forEach((instance: any) => {\n this._connected(instance, {noIncrements: true});\n });\n\n // \uB77C\uC6B0\uD130 \uBCC0\uACBD \uAD6C\uB3C5\n if (!this._routerSubscription && this.router) {\n const config = this.__swc_engine.config;\n\n this._routerSubscription = this.router.observable.subscribe(async (route: RouterEventType) => {\n console.log('[SWC-MIXIN] Router event received:', route.triggerPoint);\n if (route.triggerPoint === 'end') {\n await this._handleRouteChange(route);\n }\n });\n\n if (config?.path) {\n console.log('[DEBUG] Navigating to initial path:', config.path);\n }\n }\n }\n\n connectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 connectedCallback \uD638\uCD9C\n // @ts-ignore\n super.connectedCallback?.();\n\n const configStr = this.getAttribute('swc-get-application-config');\n const win = this.ownerDocument?.defaultView || window;\n if (configStr && win) {\n try {\n const userConfig = FunctionUtils.executeReturn({\n script: configStr,\n context: this,\n args: SwcUtils.getHelperAndHostSet(win, this)\n });\n this.connect(userConfig);\n } catch (e) {\n console.error('[SWC-MIXIN] Script execution failed:', e);\n }\n }\n\n this._connected(this);\n this.__swc_engine?.config?.onConnected?.(this);\n this._connectedDone(this);\n }\n\n disconnectedCallback() {\n // \uBD80\uBAA8 \uD074\uB798\uC2A4\uC758 disconnectedCallback \uD638\uCD9C\n // @ts-ignore\n super.disconnectedCallback?.();\n \n this._routerSubscription?.unsubscribe();\n this._routerSubscription = undefined;\n this._lastRouterEvent = undefined;\n this.__swc_engine.disconnect();\n this.__swc_engine?.config?.onDisconnected?.(this);\n this._disconnected(this);\n }\n\n async routing(path: string) {\n await this.router?.go(path);\n }\n\n back(): void {\n this.router?.back();\n }\n\n forward(): void {\n this.router?.forward();\n }\n\n reload(): void {\n this.router?.reload();\n }\n\n publishMessage(message: SwcAppMessage): void {\n this._swc_connected_instance.forEach((instance: any) => {\n this._invokeMessageSubscribers(instance, message);\n });\n }\n\n _invokeMessageSubscribers(instance: any, message: SwcAppMessage) {\n const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);\n if (messageSubscribers && Array.isArray(messageSubscribers)) {\n messageSubscribers.forEach(metadata => {\n const methodName = metadata.propertyKey;\n const messageType = metadata.messageType;\n const filter = metadata.filter;\n\n let typeMatched = false;\n if (!messageType) {\n typeMatched = true;\n } else if (message.type === messageType) {\n typeMatched = true;\n }\n\n let filterMatched = true;\n if (filter && typeMatched) {\n filterMatched = filter(message, instance);\n }\n\n if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {\n instance[methodName](message);\n }\n });\n }\n }\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAgL;AAChL,0BAAkE;AAClE,kBAAoE;AAEpE,mBAAuB;AAEhB,MAAM,QAAQ,CAAC,MAAmB;AACvC,SAAO,EAAE,aAAa,aAAa;AACrC;AACO,MAAM,kBAAkB,CAAC,MAAmB;AACjD,IAAE,aAAa,eAAgB,EAAU,UAAU,EAAE;AACvD;AACO,MAAM,qBAAqB,CAAC,MAAmB;AACpD,IAAE,gBAAgB,aAAa;AACjC;AAWO,SAAS,YAA4D,MAAS;AACnF,SAAO,MAAM,yBAAyB,KAAgC;AAAA,IAkBpE,eAAe,MAAa;AAC1B,YAAM,GAAG,IAAI;AAlBf,0CAAe,IAAI,iCAA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UAC9B;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": ["config"]
7
+ }
@@ -1,13 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
6
  if (from && typeof from === "object" || typeof from === "function") {
13
7
  for (let key of __getOwnPropNames(from))
@@ -16,22 +10,10 @@ var __copyProps = (to, from, except, desc) => {
16
10
  }
17
11
  return to;
18
12
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
27
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
15
  var elements_exports = {};
29
- __export(elements_exports, {
30
- register: () => register,
31
- registerSwcApp: () => registerSwcApp
32
- });
33
16
  module.exports = __toCommonJS(elements_exports);
34
- var import_SwcApp = __toESM(require("./SwcApp"), 1);
35
- const registerSwcApp = import_SwcApp.default;
36
- const register = [import_SwcApp.default];
17
+ __reExport(elements_exports, require("./SwcAppMixin"), module.exports);
18
+ __reExport(elements_exports, require("./SwcApp"), module.exports);
37
19
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/elements/index.ts"],
4
- "sourcesContent": ["// export * from './tt/register';\nimport swcAppFactory from './SwcApp'\n// import swcAsyncFactory from './SwcAsync'\n// import swcLoopFactory from './SwcLoop'\n// import swcIfFactory from './SwcIf'\nexport const registerSwcApp = swcAppFactory;\n// export const registerSwcAsync = swcAsyncFactory;\n// export const registerSwcLoop = swcLoopFactory;\n// export const registerSwcIf = swcIfFactory;\n\nexport const register = [swcAppFactory];"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA0B;AAInB,MAAM,iBAAiB,cAAAA;AAKvB,MAAM,WAAW,CAAC,cAAAA,OAAa;",
6
- "names": ["swcAppFactory"]
4
+ "sourcesContent": ["// export * from './tt/register';\nexport * from './SwcAppMixin'\nexport * from './SwcApp'\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AACA,6BAAc,0BADd;AAEA,6BAAc,qBAFd;",
6
+ "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -29,9 +29,7 @@ __reExport(src_exports, require("./types"), module.exports);
29
29
  __reExport(src_exports, require("./utils/Utils"), module.exports);
30
30
  __reExport(src_exports, require("./config/config"), module.exports);
31
31
  var src_default = async (w, other) => {
32
- console.log("rr");
33
- const cr = await Promise.all(import_elements.register.map((it) => it(w)));
34
- console.log("rr11");
32
+ const cr = await (0, import_elements.defineSwcAppAll)(w);
35
33
  if (other) {
36
34
  for (const fn of other) {
37
35
  if (typeof fn === "function") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { register } from './elements';\nimport {ConstructorType} from \"@dooboostore/core\";\n\n// Decorators\nexport * from './decorators';\n\n// Types\nexport * from './types';\n\n// Utilities\nexport * from './utils/Utils';\n\n// Config\nexport * from './config/config';\n\n// Registration Factory\nexport default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {\n console.log('rr')\n const cr = await Promise.all(register.map(it => it(w)));\n console.log('rr11')\n // const cr = await elementFactories(w);\n if (other) {\n for (const fn of other) {\n if (typeof fn === 'function') {\n await fn(w);\n }\n }\n }\n\n return cr;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AACP,wBAAc,uBADd;AAEA,sBAAyB;AAIzB,wBAAc,yBANd;AASA,wBAAc,oBATd;AAYA,wBAAc,0BAZd;AAeA,wBAAc,4BAfd;AAkBA,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,UAAQ,IAAI,IAAI;AAChB,QAAM,KAAK,MAAM,QAAQ,IAAI,yBAAS,IAAI,QAAM,GAAG,CAAC,CAAC,CAAC;AACtD,UAAQ,IAAI,MAAM;AAElB,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
4
+ "sourcesContent": ["import 'reflect-metadata';\nexport * from './elements'\nimport { defineSwcAppAll } from './elements';\nimport {ConstructorType} from \"@dooboostore/core\";\n\n// Decorators\nexport * from './decorators';\n\n// Types\nexport * from './types';\n\n// Utilities\nexport * from './utils/Utils';\n\n// Config\nexport * from './config/config';\n\n// Registration Factory\nexport default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {\n const cr = await defineSwcAppAll(w);\n // const cr = await elementFactories(w);\n if (other) {\n for (const fn of other) {\n if (typeof fn === 'function') {\n await fn(w);\n }\n }\n }\n\n return cr;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AACP,wBAAc,uBADd;AAEA,sBAAgC;AAIhC,wBAAc,yBANd;AASA,wBAAc,oBATd;AAYA,wBAAc,0BAZd;AAeA,wBAAc,4BAfd;AAkBA,IAAO,cAAQ,OAAO,GAAW,UAAqG;AACpI,QAAM,KAAK,UAAM,iCAAgB,CAAC;AAElC,MAAI,OAAO;AACT,eAAW,MAAM,OAAO;AACtB,UAAI,OAAO,OAAO,YAAY;AAC5B,cAAM,GAAG,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -33,4 +33,4 @@ var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
33
33
  InjectSituationType2["LAST_APP_HOST"] = "SIMPLE_WEB_COMPONENT://LASTAPPHOST";
34
34
  return InjectSituationType2;
35
35
  })(InjectSituationType || {});
36
- //# sourceMappingURL=types.js.map
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/index.ts"],
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n // _swcId: string;\n createSlotString(id: string): string\n createEaHtml(id: string, script: string): string\n createEaText(id: string, script: string): string\n createEaAttribute(id: string, attributeName: string): string\n createEaEvent(id: string, eventName: string): string\n createEaProperty(id: string, propertyName: string): string\n}"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;",
6
+ "names": ["InjectSituationType"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/types/window.d.ts"],
4
- "sourcesContent": ["import {HTMLDialogElement} from \"@dooboostore/dom-parser\";\n\n/**\n * Global type augmentation for @dooboostore showcase\n */\ndeclare global {\n interface Window {\n HTMLElement: typeof HTMLElement;\n HTMLDivElement: typeof HTMLDivElement;\n HTMLButtonElement: typeof HTMLButtonElement;\n HTMLTemplateElement: typeof HTMLTemplateElement;\n HTMLAnchorElement: typeof HTMLAnchorElement;\n HTMLDialogElement: typeof HTMLDialogElement;\n ShadowRoot: typeof ShadowRoot;\n location: Location;\n document: Document;\n history: History;\n console: Console;\n IntersectionObserver: typeof IntersectionObserver;\n SwaggerUIBundle: any;\n\n }\n\n namespace Dooboostore {\n interface PackageInfo {\n id: string;\n name: string;\n description: string;\n longDescription: string;\n icon: string;\n color: string;\n features: PackageFeature[];\n example: string;\n }\n\n interface PackageFeature {\n title: string;\n desc: string;\n }\n }\n}\n\nexport {};\n"],
4
+ "sourcesContent": ["import {HTMLDialogElement} from \"@dooboostore/dom-parser\";\n\n/**\n * Global type augmentation for @dooboostore showcase\n */\ndeclare global {\n interface Window {\n HTMLElement: typeof HTMLElement;\n HTMLDivElement: typeof HTMLDivElement;\n HTMLButtonElement: typeof HTMLButtonElement;\n HTMLTemplateElement: typeof HTMLTemplateElement;\n HTMLAnchorElement: typeof HTMLAnchorElement;\n HTMLDialogElement: typeof HTMLDialogElement;\n HTMLBodyElement: typeof HTMLBodyElement;\n HTMLSectionElement: typeof HTMLSectionElement;\n HTMLMainElement: typeof HTMLMainElement;\n ShadowRoot: typeof ShadowRoot;\n location: Location;\n document: Document;\n history: History;\n console: Console;\n IntersectionObserver: typeof IntersectionObserver;\n SwaggerUIBundle: any;\n\n }\n\n namespace Dooboostore {\n interface PackageInfo {\n id: string;\n name: string;\n description: string;\n longDescription: string;\n icon: string;\n color: string;\n features: PackageFeature[];\n example: string;\n }\n\n interface PackageFeature {\n title: string;\n desc: string;\n }\n }\n}\n\nexport {};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }