@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,328 @@
1
+ import {SwcAppInterface, SwcAppMessage} from "../types";
2
+ import {findAllLifecycleMetadata, getSubscribeSwcAppMessageWhileConnectedMetadata, getSubscribeSwcAppRouteChangeWhileConnectedMetadata, ON_CONNECTED_SWC_APP_METADATA_KEY} from "../decorators";
3
+ import {SwcAppEngine, SwcAttributeConfigType, SwcConfigType} from "../SwcAppEngine";
4
+ import {debounceTimeIntervalLock, FunctionUtils, Subscription} from "@dooboostore/core";
5
+ import {RouterEventType} from "@dooboostore/core-web";
6
+ import {SwcUtils} from "../utils/Utils";
7
+
8
+ export const isSSR = (i: HTMLElement) => {
9
+ return i.hasAttribute('swc-use-ssr');
10
+ }
11
+ export const setSSRAttribute = (i: HTMLElement) => {
12
+ i.setAttribute('swc-use-ssr', (i as any)._swcId ?? '');
13
+ }
14
+ export const removeSSRAttribute = (i: HTMLElement) => {
15
+ i.removeAttribute('swc-use-ssr');
16
+ }
17
+
18
+ /**
19
+ * SwcAppMixin: SwcApp 기능을 모든 HTMLElement에 추가할 수 있는 Mixin
20
+ *
21
+ * 사용 예:
22
+ * @elementDefine('custom-app', { window: w })
23
+ * class CustomApp extends SwcAppMixin(w.HTMLElement) implements SwcAppInterface {
24
+ * // 추가 기능 구현
25
+ * }
26
+ */
27
+ export function SwcAppMixin<T extends { new(...args: any[]): HTMLElement }>(Base: T) {
28
+ return class SwcAppMixinClass extends Base implements SwcAppInterface {
29
+ __swc_engine = new SwcAppEngine(this as any);
30
+ _swc_connected_instance = new Set<any>();
31
+ _routerSubscription?: Subscription;
32
+ _lastRouterEvent?: RouterEventType;
33
+ _routeChangeInvocations = 0;
34
+ _connectedInvocations = 0;
35
+
36
+ _childrenRouteChangedInterval: any;
37
+ _childrenConnectedDoneInterval: any;
38
+
39
+ /**
40
+ * Safari is 속성 처리
41
+ * Safari polyfill에서는 자식부터 만들어지고 부모가 만들어지므로
42
+ * 부모가 자식들을 강제로 등록해주는 형태로 처리
43
+ */
44
+ _connected_safari_and_standby = [];
45
+
46
+ constructor(...args: any[]) {
47
+ super(...args);
48
+ console.log('[SWC-APP-MIXIN] constructor')
49
+ }
50
+
51
+ get simpleApplication() {
52
+ return this.__swc_engine.simpleApplication;
53
+ }
54
+
55
+ get config() {
56
+ return this.__swc_engine?.config;
57
+ }
58
+
59
+ get router() {
60
+ return this.__swc_engine?.router;
61
+ }
62
+
63
+ async _invokeRouteChangeSubscribers(instance: HTMLElement, re: RouterEventType) {
64
+ if (instance.isConnected === false) return;
65
+
66
+ this._routeChangeInvocations++;
67
+
68
+ if (this._childrenRouteChangedInterval) {
69
+ this.config.window.clearInterval(this._childrenRouteChangedInterval);
70
+ }
71
+ const intervalConfig = {setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window)};
72
+ this._childrenRouteChangedInterval = debounceTimeIntervalLock(
73
+ () => this._routeChangeInvocations === 0,
74
+ () => {
75
+ this._childrenRouteChangedInterval = null;
76
+ this.config.onChildrenRouteChanged?.(re, this)
77
+ },
78
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
79
+ intervalConfig
80
+ );
81
+
82
+ try {
83
+ const routeChangeSubscribers = getSubscribeSwcAppRouteChangeWhileConnectedMetadata(instance);
84
+ if (routeChangeSubscribers && Array.isArray(routeChangeSubscribers)) {
85
+ console.log('[SWC-MIXIN] Route change subscribers found')
86
+ const ps = routeChangeSubscribers.map(async metadata => {
87
+ const methodName = metadata.propertyKey;
88
+ let pathPattern = metadata.options?.path as any;
89
+ const filter = metadata.options?.filter;
90
+
91
+ if (typeof pathPattern === 'function') {
92
+ pathPattern = (pathPattern as Function)(instance);
93
+ }
94
+
95
+ let pathMatched = false;
96
+ let pathData: any = null;
97
+
98
+ if (!pathPattern) {
99
+ pathMatched = true;
100
+ pathData = {};
101
+ } else if (Array.isArray(pathPattern)) {
102
+ for (const pattern of pathPattern) {
103
+ const data = SwcUtils.parsePathPattern(pattern, re.path || '/');
104
+ if (data !== null) {
105
+ pathMatched = true;
106
+ pathData = data;
107
+ break;
108
+ }
109
+ }
110
+ } else {
111
+ pathData = SwcUtils.parsePathPattern(pathPattern, re.path || '/');
112
+ pathMatched = pathData !== null;
113
+ }
114
+
115
+ const hostSet = SwcUtils.getHelperAndHostSet(this.config.window, this);
116
+ const filterPassed = !filter || filter(this.router!, {helper:hostSet, currentThis:instance});
117
+
118
+ if (pathMatched && filterPassed && instance[methodName]) {
119
+ await instance[methodName]({...re, pathData: pathData});
120
+ }
121
+ });
122
+ await Promise.allSettled(ps);
123
+ }
124
+ } finally {
125
+ if (this.config?.ssr) {
126
+ setSSRAttribute(instance);
127
+ } else {
128
+ removeSSRAttribute(instance);
129
+ }
130
+ this._routeChangeInvocations = Math.max(0, this._routeChangeInvocations - 1);
131
+ }
132
+ }
133
+
134
+ async _connected(instance: HTMLElement, option?: { noIncrements: boolean }) {
135
+ if (instance) {
136
+ if (!this.simpleApplication && !this.config) {
137
+ this._connected_safari_and_standby.push(instance);
138
+ return;
139
+ }
140
+
141
+ this.config.onConnectedChildBefore?.(instance);
142
+ if (!option?.noIncrements) {
143
+ this._connectedInvocations++;
144
+ }
145
+ this._swc_connected_instance.add(instance);
146
+
147
+ const connectedSwcAppCallBacks = findAllLifecycleMetadata(instance, ON_CONNECTED_SWC_APP_METADATA_KEY) ?? [];
148
+ for (let connectedSwcAppCallBack of connectedSwcAppCallBacks) {
149
+ await (instance as any)?._invokeLifecycleMethod?.(connectedSwcAppCallBack);
150
+ }
151
+
152
+ if (this._childrenConnectedDoneInterval) {
153
+ this.config.window.clearInterval(this._childrenConnectedDoneInterval);
154
+ }
155
+ const intervalConfig = {setInterval: this.config.window.setInterval.bind(this.config.window), clearInterval: this.config.window.clearInterval.bind(this.config.window)};
156
+ this._childrenConnectedDoneInterval = debounceTimeIntervalLock(
157
+ () => this._connectedInvocations === 0,
158
+ () => {
159
+ this._childrenConnectedDoneInterval = null;
160
+ this.config.onChildrenConnectedDone?.(this)
161
+ },
162
+ this.config?.childrenConnectedDoneCheckIntervalTime ?? 30,
163
+ intervalConfig
164
+ );
165
+
166
+ if (this.simpleApplication) {
167
+ try {
168
+ if (this.router && this._lastRouterEvent) {
169
+ await this._invokeRouteChangeSubscribers(instance, this._lastRouterEvent!);
170
+ }
171
+ } catch (e) {
172
+ throw e;
173
+ }
174
+ }
175
+
176
+ if (this.config?.ssr) {
177
+ setSSRAttribute(instance);
178
+ } else {
179
+ removeSSRAttribute(instance);
180
+ }
181
+ }
182
+
183
+ this.config.onConnectedChildAfter?.(instance);
184
+ return this;
185
+ }
186
+
187
+ async _connectedDone(instance: any) {
188
+ try {
189
+ // 내부 연결 처리 로직
190
+ } finally {
191
+ this._connectedInvocations = Math.max(0, this._connectedInvocations - 1);
192
+ }
193
+ }
194
+
195
+ _disconnected(instance: any) {
196
+ if (instance) {
197
+ this._swc_connected_instance.delete(instance);
198
+ this.config?.onDisconnectedChildAfter?.(instance);
199
+ }
200
+ }
201
+
202
+ async _handleRouteChange(route: RouterEventType) {
203
+ this._lastRouterEvent = route;
204
+ const swcConnectedInstance = Array.from(this._swc_connected_instance);
205
+ const ps = swcConnectedInstance.map((instance: any) => this._invokeRouteChangeSubscribers(instance, route));
206
+ await Promise.allSettled(ps);
207
+ }
208
+
209
+ async connect(config?: SwcAttributeConfigType) {
210
+ console.log('[SWC-MIXIN] connect')
211
+ const swcConfig = {
212
+ routeType: 'element',
213
+ window: config?.window,
214
+ ...config
215
+ } as SwcConfigType;
216
+
217
+ await this.__swc_engine.connect(swcConfig);
218
+
219
+ // Safari is 속성 처리
220
+ this._connected_safari_and_standby.forEach((instance: any) => {
221
+ this._connected(instance, {noIncrements: true});
222
+ });
223
+
224
+ // 라우터 변경 구독
225
+ if (!this._routerSubscription && this.router) {
226
+ const config = this.__swc_engine.config;
227
+
228
+ this._routerSubscription = this.router.observable.subscribe(async (route: RouterEventType) => {
229
+ console.log('[SWC-MIXIN] Router event received:', route.triggerPoint);
230
+ if (route.triggerPoint === 'end') {
231
+ await this._handleRouteChange(route);
232
+ }
233
+ });
234
+
235
+ if (config?.path) {
236
+ console.log('[DEBUG] Navigating to initial path:', config.path);
237
+ }
238
+ }
239
+ }
240
+
241
+ connectedCallback() {
242
+ // 부모 클래스의 connectedCallback 호출
243
+ // @ts-ignore
244
+ super.connectedCallback?.();
245
+
246
+ const configStr = this.getAttribute('swc-get-application-config');
247
+ const win = this.ownerDocument?.defaultView || window;
248
+ if (configStr && win) {
249
+ try {
250
+ const userConfig = FunctionUtils.executeReturn({
251
+ script: configStr,
252
+ context: this,
253
+ args: SwcUtils.getHelperAndHostSet(win, this)
254
+ });
255
+ this.connect(userConfig);
256
+ } catch (e) {
257
+ console.error('[SWC-MIXIN] Script execution failed:', e);
258
+ }
259
+ }
260
+
261
+ this._connected(this);
262
+ this.__swc_engine?.config?.onConnected?.(this);
263
+ this._connectedDone(this);
264
+ }
265
+
266
+ disconnectedCallback() {
267
+ // 부모 클래스의 disconnectedCallback 호출
268
+ // @ts-ignore
269
+ super.disconnectedCallback?.();
270
+
271
+ this._routerSubscription?.unsubscribe();
272
+ this._routerSubscription = undefined;
273
+ this._lastRouterEvent = undefined;
274
+ this.__swc_engine.disconnect();
275
+ this.__swc_engine?.config?.onDisconnected?.(this);
276
+ this._disconnected(this);
277
+ }
278
+
279
+ async routing(path: string) {
280
+ await this.router?.go(path);
281
+ }
282
+
283
+ back(): void {
284
+ this.router?.back();
285
+ }
286
+
287
+ forward(): void {
288
+ this.router?.forward();
289
+ }
290
+
291
+ reload(): void {
292
+ this.router?.reload();
293
+ }
294
+
295
+ publishMessage(message: SwcAppMessage): void {
296
+ this._swc_connected_instance.forEach((instance: any) => {
297
+ this._invokeMessageSubscribers(instance, message);
298
+ });
299
+ }
300
+
301
+ _invokeMessageSubscribers(instance: any, message: SwcAppMessage) {
302
+ const messageSubscribers = getSubscribeSwcAppMessageWhileConnectedMetadata(instance);
303
+ if (messageSubscribers && Array.isArray(messageSubscribers)) {
304
+ messageSubscribers.forEach(metadata => {
305
+ const methodName = metadata.propertyKey;
306
+ const messageType = metadata.messageType;
307
+ const filter = metadata.filter;
308
+
309
+ let typeMatched = false;
310
+ if (!messageType) {
311
+ typeMatched = true;
312
+ } else if (message.type === messageType) {
313
+ typeMatched = true;
314
+ }
315
+
316
+ let filterMatched = true;
317
+ if (filter && typeMatched) {
318
+ filterMatched = filter(message, instance);
319
+ }
320
+
321
+ if (typeMatched && filterMatched && typeof instance[methodName] === 'function') {
322
+ instance[methodName](message);
323
+ }
324
+ });
325
+ }
326
+ }
327
+ };
328
+ }
@@ -1,11 +1,4 @@
1
1
  // export * from './tt/register';
2
- import swcAppFactory from './SwcApp'
3
- // import swcAsyncFactory from './SwcAsync'
4
- // import swcLoopFactory from './SwcLoop'
5
- // import swcIfFactory from './SwcIf'
6
- export const registerSwcApp = swcAppFactory;
7
- // export const registerSwcAsync = swcAsyncFactory;
8
- // export const registerSwcLoop = swcLoopFactory;
9
- // export const registerSwcIf = swcIfFactory;
2
+ export * from './SwcAppMixin'
3
+ export * from './SwcApp'
10
4
 
11
- export const register = [swcAppFactory];
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  export * from './elements'
3
- import { register } from './elements';
3
+ import { defineSwcAppAll } from './elements';
4
4
  import {ConstructorType} from "@dooboostore/core";
5
5
 
6
6
  // Decorators
@@ -17,9 +17,7 @@ export * from './config/config';
17
17
 
18
18
  // Registration Factory
19
19
  export default async (w: Window, other?: (((w: Window) => Promise<CustomElementConstructor> | CustomElementConstructor) | any) []) => {
20
- console.log('rr')
21
- const cr = await Promise.all(register.map(it => it(w)));
22
- console.log('rr11')
20
+ const cr = await defineSwcAppAll(w);
23
21
  // const cr = await elementFactories(w);
24
22
  if (other) {
25
23
  for (const fn of other) {
@@ -1,6 +1,6 @@
1
- import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';
1
+ import { SimpleApplication } from '@dooboostore/simple-boot';
2
2
  import { Router } from '@dooboostore/core-web';
3
- import {SwcAttributeConfigType, SwcConfigType} from "./SwcAppEngine";
3
+ import {SwcAttributeConfigType, SwcConfigType} from "../SwcAppEngine";
4
4
 
5
5
  export enum InjectSituationType {
6
6
  HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',
@@ -50,14 +50,7 @@ export type SwcAppMessage<T = any> = {
50
50
  type?: string;
51
51
  };
52
52
 
53
- export interface SwcChooseInterface extends HTMLTemplateElement {
54
- value: any;
55
- refresh(a: any): void;
56
- }
57
- export interface SwcIfInterface extends HTMLTemplateElement {
58
- value: any;
59
- refresh(): void;
60
- }
53
+
61
54
  export interface SwcAppInterface extends HTMLElement {
62
55
  simpleApplication?: SimpleApplication;
63
56
  config?: SwcConfigType;
@@ -69,3 +62,13 @@ export interface SwcAppInterface extends HTMLElement {
69
62
  forward(): void;
70
63
  publishMessage(message: SwcAppMessage): void;
71
64
  }
65
+
66
+ export interface SwcElement {
67
+ // _swcId: string;
68
+ createSlotString(id: string): string
69
+ createEaHtml(id: string, script: string): string
70
+ createEaText(id: string, script: string): string
71
+ createEaAttribute(id: string, attributeName: string): string
72
+ createEaEvent(id: string, eventName: string): string
73
+ createEaProperty(id: string, propertyName: string): string
74
+ }
@@ -11,6 +11,9 @@ declare global {
11
11
  HTMLTemplateElement: typeof HTMLTemplateElement;
12
12
  HTMLAnchorElement: typeof HTMLAnchorElement;
13
13
  HTMLDialogElement: typeof HTMLDialogElement;
14
+ HTMLBodyElement: typeof HTMLBodyElement;
15
+ HTMLSectionElement: typeof HTMLSectionElement;
16
+ HTMLMainElement: typeof HTMLMainElement;
14
17
  ShadowRoot: typeof ShadowRoot;
15
18
  location: Location;
16
19
  document: Document;