| 
									
										
										
										
											2023-02-02 17:57:07 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   import BaseUIElement from "../BaseUIElement.js" | 
					
						
							|  |  |  |   import { onDestroy, onMount } from "svelte" | 
					
						
							| 
									
										
										
										
											2023-02-02 17:57:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   export let construct: BaseUIElement | (() => BaseUIElement) | 
					
						
							|  |  |  |   let elem: HTMLElement | 
					
						
							|  |  |  |   let html: HTMLElement | 
					
						
							| 
									
										
										
										
											2023-02-02 17:57:07 +01:00
										 |  |  |   onMount(() => { | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     const uiElem = typeof construct === "function" ? construct() : construct | 
					
						
							|  |  |  |     html = uiElem?.ConstructElement() | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     if (html !== undefined) { | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |       elem.replaceWith(html) | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   }) | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   onDestroy(() => { | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     html?.remove() | 
					
						
							|  |  |  |   }) | 
					
						
							| 
									
										
										
										
											2023-02-02 17:57:07 +01:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-02-03 14:59:08 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | <span bind:this={elem} /> |