| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   /*** | 
					
						
							|  |  |  |    * A 'region' is a collection of properties that can be edited which are somewhat related. | 
					
						
							|  |  |  |    * They will typically be a subset of some properties | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   import type { ConfigMeta } from "./configMeta" | 
					
						
							|  |  |  |   import EditLayerState from "./EditLayerState" | 
					
						
							|  |  |  |   import SchemaBasedInput from "./SchemaBasedInput.svelte" | 
					
						
							| 
									
										
										
										
											2023-06-16 02:36:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   export let state: EditLayerState | 
					
						
							|  |  |  |   export let configs: ConfigMeta[] | 
					
						
							|  |  |  |   export let title: string | undefined = undefined | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   export let path: (string | number)[] = [] | 
					
						
							| 
									
										
										
										
											2023-11-07 02:13:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   let expertMode = state.expertMode | 
					
						
							|  |  |  |   let configsNoHidden = configs.filter((schema) => schema.hints?.group !== "hidden") | 
					
						
							|  |  |  |   let configsFiltered = $expertMode | 
					
						
							|  |  |  |     ? configsNoHidden | 
					
						
							|  |  |  |     : configsNoHidden.filter((schema) => schema.hints?.group !== "expert") | 
					
						
							| 
									
										
										
										
											2023-06-16 02:36:11 +02:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {#if configs === undefined} | 
					
						
							|  |  |  |   Bug: 'Region' received 'undefined' | 
					
						
							|  |  |  | {:else if configs.length === 0} | 
					
						
							|  |  |  |   Bug: Region received empty list as configuration | 
					
						
							|  |  |  | {:else if title} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <div class="flex w-full flex-col"> | 
					
						
							| 
									
										
										
										
											2023-06-23 16:14:43 +02:00
										 |  |  |     <h3>{title}</h3> | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |     <div class="flex w-full flex-col gap-y-1 border border-black pl-2"> | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  |       <slot name="description" /> | 
					
						
							| 
									
										
										
										
											2023-11-07 02:13:16 +01:00
										 |  |  |       {#each configsFiltered as config} | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  |         <SchemaBasedInput {state} path={config.path} schema={config} /> | 
					
						
							|  |  |  |       {/each} | 
					
						
							| 
									
										
										
										
											2023-06-23 16:14:43 +02:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-06-23 16:14:43 +02:00
										 |  |  | {:else} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <div class="flex w-full flex-col gap-y-1 pl-2"> | 
					
						
							| 
									
										
										
										
											2023-11-07 02:13:16 +01:00
										 |  |  |     {#each configsFiltered as config} | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  |       <SchemaBasedInput {state} path={path.concat(config.path)} schema={config} /> | 
					
						
							|  |  |  |     {/each} | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-06-23 16:14:43 +02:00
										 |  |  | {/if} |