| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import DetermineLayout from "./Logic/DetermineLayout" | 
					
						
							| 
									
										
										
										
											2023-04-13 23:40:28 +02:00
										 |  |  | import ThemeViewState from "./Models/ThemeViewState" | 
					
						
							|  |  |  | import SvelteUIElement from "./UI/Base/SvelteUIElement" | 
					
						
							|  |  |  | import ThemeViewGUI from "./UI/ThemeViewGUI.svelte" | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  | import { FixedUiElement } from "./UI/Base/FixedUiElement" | 
					
						
							| 
									
										
										
										
											2023-07-08 02:53:45 +02:00
										 |  |  | import Combine from "./UI/Base/Combine" | 
					
						
							|  |  |  | import { SubtleButton } from "./UI/Base/SubtleButton" | 
					
						
							|  |  |  | import Svg from "./Svg" | 
					
						
							|  |  |  | import { Utils } from "./Utils" | 
					
						
							| 
									
										
										
										
											2021-03-22 02:45:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-21 18:35:31 +01:00
										 |  |  | // @ts-ignore
 | 
					
						
							| 
									
										
										
										
											2023-06-26 11:11:22 +02:00
										 |  |  | try { | 
					
						
							|  |  |  |     DetermineLayout.GetLayout() | 
					
						
							|  |  |  |         .then((layout) => { | 
					
						
							|  |  |  |             const state = new ThemeViewState(layout) | 
					
						
							|  |  |  |             const main = new SvelteUIElement(ThemeViewGUI, { state }) | 
					
						
							|  |  |  |             main.AttachTo("maindiv") | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         .catch((err) => { | 
					
						
							|  |  |  |             console.error("Error while initializing: ", err, err.stack) | 
					
						
							| 
									
										
										
										
											2023-07-08 02:53:45 +02:00
										 |  |  |             new Combine([ | 
					
						
							|  |  |  |                 new FixedUiElement(err).SetClass("block alert"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 new SubtleButton(Svg.download_svg(), "Download the raw file").onClick(() => | 
					
						
							|  |  |  |                     Utils.offerContentsAsDownloadableFile( | 
					
						
							|  |  |  |                         DetermineLayout.getCustomDefinition(), | 
					
						
							|  |  |  |                         "mapcomplete-theme.json", | 
					
						
							|  |  |  |                         { mimetype: "application/json" } | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |             ]).AttachTo("maindiv") | 
					
						
							| 
									
										
										
										
											2023-06-26 11:11:22 +02:00
										 |  |  |         }) | 
					
						
							|  |  |  | } catch (err) { | 
					
						
							|  |  |  |     new FixedUiElement(err).SetClass("block alert").AttachTo("maindiv") | 
					
						
							|  |  |  | } |