@dooboostore/simple-web-component 1.0.39 → 1.0.40

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 (85) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +65 -46
  3. package/dist/cjs/SwcAppEngine.js.map +2 -2
  4. package/dist/cjs/decorators/applyAttribute.js +194 -111
  5. package/dist/cjs/decorators/applyAttribute.js.map +2 -2
  6. package/dist/cjs/decorators/applyNode.js +58 -43
  7. package/dist/cjs/decorators/applyNode.js.map +2 -2
  8. package/dist/cjs/decorators/applyProperty.js +213 -0
  9. package/dist/cjs/decorators/applyProperty.js.map +7 -0
  10. package/dist/cjs/decorators/applySlot.js +32 -26
  11. package/dist/cjs/decorators/applySlot.js.map +2 -2
  12. package/dist/cjs/decorators/changedAttributeThis.js.map +1 -1
  13. package/dist/cjs/decorators/elementDefine.js +17 -30
  14. package/dist/cjs/decorators/elementDefine.js.map +2 -2
  15. package/dist/cjs/decorators/index.js +2 -2
  16. package/dist/cjs/decorators/index.js.map +2 -2
  17. package/dist/cjs/decorators/lifecycles.js +4 -4
  18. package/dist/cjs/decorators/lifecycles.js.map +2 -2
  19. package/dist/cjs/elements/SwcApp.js.map +2 -2
  20. package/dist/cjs/types/index.js.map +1 -1
  21. package/dist/esm/SwcAppEngine.js.map +2 -2
  22. package/dist/esm/decorators/applyAttribute.js +196 -113
  23. package/dist/esm/decorators/applyAttribute.js.map +2 -2
  24. package/dist/esm/decorators/applyNode.js +58 -43
  25. package/dist/esm/decorators/applyNode.js.map +2 -2
  26. package/dist/esm/decorators/applyProperty.js +194 -0
  27. package/dist/esm/decorators/applyProperty.js.map +7 -0
  28. package/dist/esm/decorators/applySlot.js +32 -26
  29. package/dist/esm/decorators/applySlot.js.map +2 -2
  30. package/dist/esm/decorators/changedAttributeThis.js.map +1 -1
  31. package/dist/esm/decorators/elementDefine.js +17 -30
  32. package/dist/esm/decorators/elementDefine.js.map +2 -2
  33. package/dist/esm/decorators/index.js +2 -2
  34. package/dist/esm/decorators/index.js.map +1 -1
  35. package/dist/esm/decorators/lifecycles.js +4 -4
  36. package/dist/esm/decorators/lifecycles.js.map +2 -2
  37. package/dist/esm/elements/SwcApp.js.map +2 -2
  38. package/dist/esm/types/index.js.map +1 -1
  39. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +421 -394
  40. package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
  41. package/dist/types/SwcAppEngine.d.ts.map +1 -1
  42. package/dist/types/decorators/applyAttribute.d.ts +56 -15
  43. package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
  44. package/dist/types/decorators/applyNode.d.ts +28 -24
  45. package/dist/types/decorators/applyNode.d.ts.map +1 -1
  46. package/dist/types/decorators/applyProperty.d.ts +61 -0
  47. package/dist/types/decorators/applyProperty.d.ts.map +1 -0
  48. package/dist/types/decorators/applySlot.d.ts +10 -10
  49. package/dist/types/decorators/applySlot.d.ts.map +1 -1
  50. package/dist/types/decorators/elementDefine.d.ts.map +1 -1
  51. package/dist/types/decorators/index.d.ts +2 -2
  52. package/dist/types/decorators/index.d.ts.map +1 -1
  53. package/dist/types/decorators/lifecycles.d.ts +4 -4
  54. package/dist/types/decorators/lifecycles.d.ts.map +1 -1
  55. package/dist/types/elements/SwcApp.d.ts.map +1 -1
  56. package/dist/types/types/index.d.ts +1 -6
  57. package/dist/types/types/index.d.ts.map +1 -1
  58. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +421 -394
  59. package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
  60. package/package.json +3 -3
  61. package/src/SwcAppEngine.ts +1 -0
  62. package/src/decorators/applyAttribute.ts +311 -126
  63. package/src/decorators/applyNode.ts +68 -57
  64. package/src/decorators/applyProperty.ts +302 -0
  65. package/src/decorators/applySlot.ts +25 -18
  66. package/src/decorators/changedAttributeThis.ts +1 -1
  67. package/src/decorators/elementDefine.ts +41 -30
  68. package/src/decorators/index.ts +2 -3
  69. package/src/decorators/lifecycles.ts +6 -6
  70. package/src/elements/SwcApp.ts +0 -1
  71. package/src/types/index.ts +7 -7
  72. package/dist/cjs/decorators/attribute.js +0 -187
  73. package/dist/cjs/decorators/attribute.js.map +0 -7
  74. package/dist/cjs/decorators/setProperty.js +0 -109
  75. package/dist/cjs/decorators/setProperty.js.map +0 -7
  76. package/dist/esm/decorators/attribute.js +0 -168
  77. package/dist/esm/decorators/attribute.js.map +0 -7
  78. package/dist/esm/decorators/setProperty.js +0 -90
  79. package/dist/esm/decorators/setProperty.js.map +0 -7
  80. package/dist/types/decorators/attribute.d.ts +0 -31
  81. package/dist/types/decorators/attribute.d.ts.map +0 -1
  82. package/dist/types/decorators/setProperty.d.ts +0 -17
  83. package/dist/types/decorators/setProperty.d.ts.map +0 -1
  84. package/src/decorators/attribute.ts +0 -223
  85. package/src/decorators/setProperty.ts +0 -112
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2016-21 these people
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -39,31 +39,31 @@ class Dashboard extends HTMLElement {
39
39
 
40
40
  ### 3. **Declarative DOM Updates**
41
41
 
42
- #### @onConnectedInnerHtml
42
+ #### @onConnectedShadow
43
43
  Render HTML automatically when component connects to DOM.
44
44
 
45
45
  ```typescript
46
- @onConnectedShadowDom
46
+ @onConnectedShadow
47
47
  render() {
48
48
  return `<div>Hello, <span>${this.name}</span>!</div>`;
49
49
  }
50
50
  ```
51
51
 
52
- #### @applyNodeThisInnerHtml
52
+ #### @innerHtmlLightNodeThis
53
53
  Apply HTML to specific host element.
54
54
 
55
55
  ```typescript
56
- @applyThisInnerHtmlNodeLightDom
56
+ @innerHtmlLightNodeThis
57
57
  updateContent() {
58
58
  return `<p>Updated content</p>`;
59
59
  }
60
60
  ```
61
61
 
62
- #### @applyNodeThisReplaceChildren
62
+ #### @replaceChildrenLightNodeThis
63
63
  Replace child nodes with new content.
64
64
 
65
65
  ```typescript
66
- @applyNodeThisReplaceChildrenLightDom
66
+ @replaceChildrenLightNodeThis
67
67
  replaceChildren(node: Node) {
68
68
  return node;
69
69
  }
@@ -73,39 +73,40 @@ replaceChildren(node: Node) {
73
73
  Manage dynamic content insertion into named slots using the `@applySlot` decorator. Slots are placeholders in templates that can be updated dynamically.
74
74
 
75
75
  ```typescript
76
+ import {clearSlot} from "./applySlot";
77
+
76
78
  @elementDefine('content-manager')
77
79
  class ContentManager extends HTMLElement {
78
-
80
+
79
81
 
80
82
  // Method: Replace children in slot with HTML
81
83
  @addEventListener('.update-btn', 'click')
82
- @applySlotReplaceChildren('main-content')
84
+ @replaceChildrenSlot('main-content')
83
85
  updateContent() {
84
86
  return '<div>Updated content here</div>';
85
87
  }
86
88
 
87
89
  // Method: Append HTML to slot
88
- @applySlotAppendHtml('main-content')
90
+ @appendHtmlSlot('main-content')
89
91
  addMoreContent() {
90
92
  return '<p>Additional content</p>';
91
93
  }
92
94
 
93
95
  // Method: Append text to slot
94
- @applySlotAppendText('sidebar')
96
+ @appendTextSlot('sidebar')
95
97
  addSidebarText() {
96
98
  return 'Sidebar text: ' + new Date().toISOString();
97
99
  }
98
100
 
99
101
  // Method: Clear slot content
100
102
  @addEventListener('.clear-btn', 'click')
101
- @applySlotClear('main-content')
103
+ @clearSlot('main-content')
102
104
  clearContent() {
103
105
  return true;
104
106
  }
105
107
 
106
-
107
108
 
108
- @onConnectedInnerHtml
109
+ @onConnectedLight
109
110
  render() {
110
111
  return `
111
112
  <div>
@@ -129,22 +130,28 @@ class ContentManager extends HTMLElement {
129
130
  - `<!--[[ slot-id ]]-->` - Named slot placeholder (HTML comment syntax)
130
131
 
131
132
  **@applySlot Decorator Variants:**
132
- - `@applySlot(id, options)` - Generic slot operation with position option
133
- - `@applySlotReplaceChildren(id)` - Replace all children with HTML
134
- - `@applySlotReplaceChildrenText(id)` - Replace all children with text
135
- - `@applySlotAppendHtml(id)` - Append HTML to slot
136
- - `@applySlotAppendText(id)` - Append text to slot
137
- - `@applySlotPrependHtml(id)` - Prepend HTML to slot
138
- - `@applySlotPrependText(id)` - Prepend text to slot
139
- - `@applySlotClear(id)` - Clear slot content
133
+ - clearSlot
134
+ - prependHtmlSlot
135
+ - prependSlot
136
+ - prependTextSlot
137
+ - appendHtmlSlot
138
+ - appendTextSlot
139
+ - appendSlot
140
+ - replaceChildrenHtmlSlot
141
+ - replaceChildrenSlot
142
+ - replaceChildrenTextSlot
143
+
140
144
 
141
145
  **Position Options:**
142
146
  ```typescript
143
147
  export type ApplySlotPosition =
148
+ | 'prepend'
144
149
  | 'prependHtml' // Add HTML at beginning
145
150
  | 'prependText' // Add text at beginning
151
+ | 'append'
146
152
  | 'appendHtml' // Add HTML at end
147
153
  | 'appendText' // Add text at end
154
+ | 'replaceChildren'
148
155
  | 'replaceChildrenHtml' // Replace all with HTML
149
156
  | 'replaceChildrenText' // Replace all with text
150
157
  | 'clear'; // Clear all content
@@ -184,14 +191,13 @@ class CounterApp extends HTMLElement {
184
191
  <!--[text Count: @count@ ]-->
185
192
 
186
193
  <!-- Attribute binding with a: prefix -->
187
- <div a:title="Count is @count@"></div>
194
+ <div a:title="'Count is'+@count@"></div>
188
195
 
189
196
  <!-- Event binding with e: prefix -->
190
197
  <button e:click="@increment@()">Increment (@count@)</button>
191
198
 
192
199
  <!-- Conditional rendering -->
193
200
  <div a:style="@isActive@ ? 'color: green' : 'color: red'">
194
- Status: @isActive@
195
201
  </div>
196
202
  </div>
197
203
  `;
@@ -240,7 +246,7 @@ class UserProfile extends HTMLElement {
240
246
  this.isEditing = !this.isEditing;
241
247
  }
242
248
 
243
- @onConnectedShadowDom
249
+ @onConnectedShadow
244
250
  render() {
245
251
  return `
246
252
  <div>
@@ -253,9 +259,7 @@ class UserProfile extends HTMLElement {
253
259
  <!--[html @isEditing@ ? '<input type="text" />' : '<span>View Mode</span>' ]-->
254
260
  </div>
255
261
 
256
- <button e:click="toggleEdit">
257
- @isEditing@ ? 'Save' : 'Edit'
258
- </button>
262
+ <button e:click="toggleEdit"> toggleEdit </button>
259
263
  </div>
260
264
  `;
261
265
  }
@@ -284,6 +288,17 @@ onCriticalClick(event: Event) {
284
288
  }
285
289
  ```
286
290
 
291
+ **other Event decorators**
292
+ - addEventListenerDelegateLightDom
293
+ - addEventListenerDelegateShadowDom
294
+ - addEventListenerDelegateAllDom
295
+ - addEventListenerDelegate
296
+ - addEventListenerThis
297
+ - addEventListenerAppHost
298
+ - addEventListenerWindow
299
+ - addEventListenerDocument
300
+
301
+
287
302
  #### @emitCustomEvent
288
303
  Emit custom events with data.
289
304
 
@@ -384,11 +399,11 @@ printTag() {
384
399
  Bind HTML attributes to properties (automatic sync).
385
400
 
386
401
  ```typescript
387
- @attribute
388
- width: string = '100px';
402
+ @attributeThis
403
+ width: string = '100px'; // Bind to this.width
389
404
 
390
405
  @attribute('data-id')
391
- resourceId: string = '';
406
+ resourceId: string; // element attribute first
392
407
  ```
393
408
 
394
409
  #### @attributeThis
@@ -396,7 +411,7 @@ Bind attributes on host element itself.
396
411
 
397
412
  ```typescript
398
413
  @attributeThis('product-id')
399
- productId: string = '';
414
+ productId?: string;
400
415
 
401
416
  @onInitialize
402
417
  onconstructor() {
@@ -632,34 +647,37 @@ w.document.addEventListener('DOMContentLoaded', async () => {
632
647
 
633
648
  ```typescript
634
649
  // Component factory
650
+ import {defineSwcApp} from "./SwcApp";
651
+
635
652
  export default (w: Window) => {
636
653
  const tagName = 'my-component';
637
654
  const existing = w.customElements.get(tagName);
638
655
  if (existing) return tagName;
639
656
 
640
- @elementDefine(tagName, { window: w })
657
+ @elementDefine(tagName, {window: w})
641
658
  class MyComponent extends w.HTMLElement {
642
659
  @onInitialize
643
660
  onconstructor(service: MyService) {
644
661
  this.service = service;
645
662
  }
646
663
  }
647
-
664
+
648
665
  return tagName;
649
666
  };
650
667
 
651
668
  // Boot factory
652
669
  export default (w: Window, container: symbol) => {
653
670
  serviceFactories.forEach(s => s(container));
654
- register(w, [...pageFactories, ...componentFactories]);
655
671
  };
656
672
 
657
673
  // Entry point
658
674
  const container = Symbol('app');
659
- bootFactory(w, container);
675
+ await defineSwcAppBody(w)
676
+ const appElement = w.document.querySelector('#app') as SwcAppInterface;
660
677
  appElement.connect({
661
678
  container,
662
679
  window: w,
680
+ onStartedLazyDefineComponent: [...pageFactories, ...componentFactories],
663
681
  onEngineStarted: () => {
664
682
  appElement.innerHTML = '<root-router></root-router>';
665
683
  }
@@ -700,18 +718,18 @@ export default (w: Window) => {
700
718
  ## ⚠️ Critical Rules
701
719
 
702
720
  ### DO NOT Use @Sim on Web Components
703
- `@Sim` is for **Services only**. Web Components should use `@elementDefine`.
721
+ `@sim` is for **Services only**. Web Components should use `@elementDefine`.
704
722
 
705
723
  ```typescript
706
724
  // ✅ CORRECT
707
- @Sim
725
+ @sim
708
726
  export class UserService { }
709
727
 
710
728
  @elementDefine(tagName, { window: w })
711
729
  class UserWidget extends w.HTMLElement { }
712
730
 
713
731
  // ❌ WRONG
714
- @Sim
732
+ @sim
715
733
  @elementDefine(tagName, { window: w })
716
734
  class UserWidget extends w.HTMLElement { }
717
735
  ```
@@ -734,7 +752,7 @@ export default (w: Window) => {
734
752
  ```typescript
735
753
  // ✅ CORRECT
736
754
  @onInitialize
737
- onconstructor(@Inject(symbol: Service.SYMBOL) service: Service) {
755
+ onconstructor(@inject(Service.SYMBOL) service: Service) {
738
756
  this.service = service;
739
757
  }
740
758
 
@@ -746,19 +764,20 @@ constructor(private service: Service) { super(); } // Web Components can't have
746
764
 
747
765
  ## 📚 Examples
748
766
 
749
- - **[Commerce (E-Commerce SPA)](./examples/commerce)** - Full shopping cart example
750
- - **[Stock (Market Dashboard)](./examples/stock)** - Real-time data with routing
751
- - **[Accommodation (Reference Pattern)](./examples/accommodation)** - Standard setup pattern
767
+ - **[Commerce (E-Commerce SPA)](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/simple-web-component/examples/commerce)** - Full shopping cart example
768
+ - **[Stock (Market Dashboard)](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/simple-web-component/examples/stock)** - Real-time data with routing
769
+ - **[Accommodation (Reference Pattern)](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/simple-web-component/examples/accommodation)** - Standard setup pattern
752
770
 
753
771
  ---
754
772
 
755
773
  ## 🔗 Related Packages
756
774
 
757
- - **[@dooboostore/simple-boot](../simple-boot)** - DI & AOP Container
758
- - **[@dooboostore/core-web](../core-web)** - Web Utilities & Router
759
- - **[@dooboostore/dom-parser](../dom-parser)** - HTML Parsing & AST
775
+ - **[@dooboostore/simple-boot](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/simple-boot)** - DI & AOP Container
776
+ - **[@dooboostore/core-web](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/core-web)** - Web Utilities & Router
777
+ - **[@dooboostore/dom-parser](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/dom-parser)** - HTML Parsing & AST
760
778
 
761
779
  ---
762
780
 
763
781
  ## 📄 License
764
- MIT © 2024 dooboostore-develop
782
+ [MIT License](https://github.com/dooboostore-develop/packages/tree/main/%40dooboostore/simple-web-component/LICENSE.md)
783
+
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SwcAppEngine.ts"],
4
- "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAClC,sBAAgE;AAChE,2BAA8B;AAC9B,IAAAA,sBAA0B;AAgCnB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AALpB,wBAAO;AACP,wBAAO;AACP,wBAAQ;AACR,wBAAQ;AA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,cAAQ,MAAM,iCAAiC,GAAG,KAAK,OAAO;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,aAAa;AACX,SAAK,oBAAoB,YAAY;AAAA,EACvC;AACF;",
4
+ "sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => it(this._config.window)))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAkC;AAClC,sBAAgE;AAChE,2BAA8B;AAC9B,IAAAA,sBAA0B;AAgCnB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AALpB,wBAAO;A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