gardenjs 1.6.9 → 1.7.0

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 (34) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/frame-BOcgZVOc.js +9 -0
  3. package/dist/assets/index-BDdBNVTh.css +19 -0
  4. package/dist/assets/index-DFG9gkdS.js +46 -0
  5. package/dist/assets/props-COK33XqS.js +2 -0
  6. package/dist/frame.html +2 -2
  7. package/dist/index.html +3 -3
  8. package/package.json +1 -1
  9. package/src/client/GardenApp.svelte +105 -92
  10. package/src/client/GardenFrame.svelte +21 -5
  11. package/src/client/components/panes/HorizontalSplitPane.svelte +27 -23
  12. package/src/client/components/panes/VerticalSplitPane.svelte +32 -36
  13. package/src/client/components/sidebar/Sidebar.svelte +6 -10
  14. package/src/client/components/stage/Stage.svelte +47 -27
  15. package/src/client/components/stage/panel/ParamsPane.svelte +11 -13
  16. package/src/client/components/stage/panel/controls/ArrayControl.svelte +3 -3
  17. package/src/client/components/stage/panel/controls/BooleanControl.svelte +24 -22
  18. package/src/client/components/stage/panel/controls/ColorPickerControl.svelte +21 -19
  19. package/src/client/components/stage/panel/controls/DateControl.svelte +23 -21
  20. package/src/client/components/stage/panel/controls/DatetimeControl.svelte +23 -21
  21. package/src/client/components/stage/panel/controls/JsonControl.svelte +3 -3
  22. package/src/client/components/stage/panel/controls/MultiselectControl.svelte +43 -39
  23. package/src/client/components/stage/panel/controls/RangeControl.svelte +23 -21
  24. package/src/client/components/stage/panel/controls/SelectControl.svelte +50 -46
  25. package/src/client/components/stage/panel/controls/TextInputControl.svelte +64 -23
  26. package/src/client/components/stage/panel/controls/TimeControl.svelte +23 -21
  27. package/src/client/components/stage/panel/controls/button_unset.scss +12 -2
  28. package/src/client/logic/localStore.js +23 -0
  29. package/src/client/logic/sidebar.svelte.js +55 -0
  30. package/src/client/logic/stage.js +2 -63
  31. package/dist/assets/frame-HIvQhXZT.js +0 -9
  32. package/dist/assets/index-B_e-ixXE.css +0 -19
  33. package/dist/assets/index-CePXpz0w.js +0 -46
  34. package/dist/assets/props-C0iXbu7F.js +0 -2
@@ -1,10 +1,10 @@
1
1
  <script>
2
- let { value, onChange, options = [], variant = 'dropdown' } = $props()
2
+ let { value, onChange, options = [], control = 'dropdown' } = $props()
3
3
 
4
4
  let isUnset = $derived(!value || value === undefined || value === null)
5
5
  </script>
6
6
 
7
- {#if variant === 'radio'}
7
+ {#if control === 'radio'}
8
8
  <div class="radio-group">
9
9
  {#each options as option, index (option.value ?? option ?? index)}
10
10
  {@const optionValue = option.value ?? option}
@@ -21,30 +21,32 @@
21
21
  </label>
22
22
  {/each}
23
23
  </div>
24
- {#if isUnset}
25
- <div class="unset-info radio-unset">is not set</div>
26
- {:else}
27
- <button
28
- class="btn_unset radio-btn-unset"
29
- onclick={() => onChange(undefined)}
30
- >
31
- <svg
32
- class="close"
33
- xmlns="http://www.w3.org/2000/svg"
34
- width="12"
35
- height="12"
36
- viewBox="0 0 24 24"
37
- fill="none"
38
- stroke="currentColor"
39
- stroke-width="2"
40
- stroke-linecap="round"
41
- stroke-linejoin="round"
24
+ <div class="unset-area">
25
+ {#if isUnset}
26
+ <div class="unset-info radio-unset">is not set</div>
27
+ {:else}
28
+ <button
29
+ class="btn_unset radio-btn-unset"
30
+ onclick={() => onChange(undefined)}
42
31
  >
43
- <path d="M18 6L6 18M6 6l12 12" />
44
- </svg>
45
- unset
46
- </button>
47
- {/if}
32
+ <svg
33
+ class="close"
34
+ xmlns="http://www.w3.org/2000/svg"
35
+ width="12"
36
+ height="12"
37
+ viewBox="0 0 24 24"
38
+ fill="none"
39
+ stroke="currentColor"
40
+ stroke-width="2"
41
+ stroke-linecap="round"
42
+ stroke-linejoin="round"
43
+ >
44
+ <path d="M18 6L6 18M6 6l12 12" />
45
+ </svg>
46
+ unset
47
+ </button>
48
+ {/if}
49
+ </div>
48
50
  {:else}
49
51
  <div class="row">
50
52
  <div class="container">
@@ -77,27 +79,29 @@
77
79
  <path d="M6 9l6 6 6-6" />
78
80
  </svg>
79
81
  </div>
80
- {#if isUnset}
81
- <span class="unset-info">is not set</span>
82
- {:else}
83
- <button class="btn_unset" onclick={() => onChange(undefined)}>
84
- <svg
85
- class="close"
86
- xmlns="http://www.w3.org/2000/svg"
87
- width="12"
88
- height="12"
89
- viewBox="0 0 24 24"
90
- fill="none"
91
- stroke="currentColor"
92
- stroke-width="2"
93
- stroke-linecap="round"
94
- stroke-linejoin="round"
95
- >
96
- <path d="M18 6L6 18M6 6l12 12" />
97
- </svg>
98
- unset
99
- </button>
100
- {/if}
82
+ <div class="unset-area">
83
+ {#if isUnset}
84
+ <span class="unset-info">is not set</span>
85
+ {:else}
86
+ <button class="btn_unset" onclick={() => onChange(undefined)}>
87
+ <svg
88
+ class="close"
89
+ xmlns="http://www.w3.org/2000/svg"
90
+ width="12"
91
+ height="12"
92
+ viewBox="0 0 24 24"
93
+ fill="none"
94
+ stroke="currentColor"
95
+ stroke-width="2"
96
+ stroke-linecap="round"
97
+ stroke-linejoin="round"
98
+ >
99
+ <path d="M18 6L6 18M6 6l12 12" />
100
+ </svg>
101
+ unset
102
+ </button>
103
+ {/if}
104
+ </div>
101
105
  </div>
102
106
  {/if}
103
107
 
@@ -2,38 +2,79 @@
2
2
  let {
3
3
  value,
4
4
  onChange,
5
- variant = 'text',
6
- rows = 4,
5
+ control = 'text',
6
+ numberOfRows = 4,
7
7
  }: {
8
8
  value: string
9
9
  onChange: (value: string) => void
10
- variant?: 'text' | 'textarea'
11
- rows?: number
10
+ control?: 'text' | 'textarea'
11
+ numberOfRows?: number
12
12
  } = $props()
13
+
14
+ let isUnset = $derived(!value || value === undefined || value === null)
13
15
  </script>
14
16
 
15
- {#if variant === 'textarea'}
16
- <textarea
17
- class="input textarea"
18
- {rows}
19
- value={String(value ?? '')}
20
- oninput={(e) => {
21
- onChange(String((e.currentTarget as HTMLTextAreaElement).value ?? ''))
22
- }}
23
- ></textarea>
24
- {:else}
25
- <input
26
- class="input"
27
- type="text"
28
- value={String(value ?? '')}
29
- oninput={(e) => {
30
- onChange(String((e.currentTarget as HTMLInputElement).value ?? ''))
31
- }}
32
- />
33
- {/if}
17
+ <div class="row">
18
+ <div class="container">
19
+ {#if control === 'textarea'}
20
+ <textarea
21
+ class="input textarea"
22
+ rows={numberOfRows}
23
+ value={String(value ?? '')}
24
+ oninput={(e) => {
25
+ onChange(String((e.currentTarget as HTMLTextAreaElement).value ?? ''))
26
+ }}
27
+ ></textarea>
28
+ {:else}
29
+ <input
30
+ class="input"
31
+ type="text"
32
+ value={String(value ?? '')}
33
+ oninput={(e) => {
34
+ onChange(String((e.currentTarget as HTMLInputElement).value ?? ''))
35
+ }}
36
+ />
37
+ {/if}
38
+ </div>
39
+ <div class="unset-area">
40
+ {#if isUnset}
41
+ <span class="unset-info">is not set</span>
42
+ {:else}
43
+ <button class="btn_unset" onclick={() => onChange(undefined as any)}>
44
+ <svg
45
+ class="close"
46
+ xmlns="http://www.w3.org/2000/svg"
47
+ width="12"
48
+ height="12"
49
+ viewBox="0 0 24 24"
50
+ fill="none"
51
+ stroke="currentColor"
52
+ stroke-width="2"
53
+ stroke-linecap="round"
54
+ stroke-linejoin="round"
55
+ >
56
+ <path d="M18 6L6 18M6 6l12 12" />
57
+ </svg>
58
+ unset
59
+ </button>
60
+ {/if}
61
+ </div>
62
+ </div>
34
63
 
35
64
  <style lang="scss">
36
65
  @use './input.scss';
66
+ @use './button_unset.scss';
67
+
68
+ .row {
69
+ display: flex;
70
+ gap: 0.5rem;
71
+ align-items: center;
72
+ }
73
+
74
+ .container {
75
+ flex: 1;
76
+ display: block;
77
+ }
37
78
 
38
79
  .textarea {
39
80
  resize: vertical;
@@ -17,27 +17,29 @@
17
17
  onChange(newValue || (undefined as any))
18
18
  }}
19
19
  />
20
- {#if isUnset}
21
- <span class="unset-info">is not set</span>
22
- {:else}
23
- <button class="btn_unset" onclick={() => onChange(undefined as any)}>
24
- <svg
25
- class="close"
26
- xmlns="http://www.w3.org/2000/svg"
27
- width="12"
28
- height="12"
29
- viewBox="0 0 24 24"
30
- fill="none"
31
- stroke="currentColor"
32
- stroke-width="2"
33
- stroke-linecap="round"
34
- stroke-linejoin="round"
35
- >
36
- <path d="M18 6L6 18M6 6l12 12" />
37
- </svg>
38
- unset
39
- </button>
40
- {/if}
20
+ <div class="unset-area">
21
+ {#if isUnset}
22
+ <span class="unset-info">is not set</span>
23
+ {:else}
24
+ <button class="btn_unset" onclick={() => onChange(undefined as any)}>
25
+ <svg
26
+ class="close"
27
+ xmlns="http://www.w3.org/2000/svg"
28
+ width="12"
29
+ height="12"
30
+ viewBox="0 0 24 24"
31
+ fill="none"
32
+ stroke="currentColor"
33
+ stroke-width="2"
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ >
37
+ <path d="M18 6L6 18M6 6l12 12" />
38
+ </svg>
39
+ unset
40
+ </button>
41
+ {/if}
42
+ </div>
41
43
  </div>
42
44
 
43
45
  <style lang="scss">
@@ -1,14 +1,24 @@
1
+ .unset-area {
2
+ display: flex;
3
+ justify-content: flex-end;
4
+ align-self: start;
5
+ margin: 0.25rem 0 0;
6
+ }
1
7
  .unset-info {
2
8
  margin: 0 0 0 0.5rem;
3
- color: var(--c-basic-800);
9
+ padding: 0.25rem 0 0;
10
+ width: 4.25rem;
4
11
  font-size: 0.75rem;
12
+ color: var(--c-basic-800);
13
+ text-align: right;
5
14
  }
6
15
  .btn_unset {
7
16
  display: inline-flex;
8
17
  align-items: center;
9
- justify-content: center;
18
+ justify-content: space-between;
10
19
  margin: 0 0 0 0.5rem;
11
20
  padding: 0.25rem 0.5rem;
21
+ width: 4.25rem;
12
22
  height: 1.25rem;
13
23
  background-color: var(--c-basic-100);
14
24
  border-radius: 0.375rem;
@@ -0,0 +1,23 @@
1
+ import { writable } from 'svelte/store'
2
+
3
+ export function localStore(
4
+ name,
5
+ defaultValue,
6
+ parseString = (value) => value,
7
+ stringify = (value) => value
8
+ ) {
9
+ const store = writable(
10
+ parseString(localStorage.getItem(name)) ?? defaultValue
11
+ )
12
+ store.subscribe((value) => {
13
+ localStorage.setItem(name, stringify(value))
14
+ })
15
+ return store
16
+ }
17
+
18
+ export const textOrNumberParser = (value) => {
19
+ if (Number.isNaN(Number(value))) {
20
+ return value
21
+ }
22
+ return Number(value)
23
+ }
@@ -0,0 +1,55 @@
1
+ import { writable, get } from 'svelte/store'
2
+ import { localStore, textOrNumberParser } from './localStore'
3
+ import { innerWidth } from 'svelte/reactivity/window'
4
+
5
+ export const sidebarWidth = localStore('sidebarWidth', 260, textOrNumberParser)
6
+ export const sidebarMaxWidth = writable(260)
7
+ export const sidebarExpanded = localStore('sidebarExpanded', false)
8
+
9
+ let previousWidth = $state(260)
10
+ let desktopExpanded = $state(true)
11
+ let mobileExpanded = $state(false)
12
+ let showMobileNav = $state(true)
13
+
14
+ export const initSidebar = () => {
15
+ $effect(() => {
16
+ if (innerWidth.current < 840) {
17
+ mobileExpanded = false
18
+ showMobileNav = true
19
+ } else {
20
+ showMobileNav = false
21
+ }
22
+ })
23
+
24
+ $effect(() => {
25
+ sidebarExpanded.set(showMobileNav ? mobileExpanded : desktopExpanded)
26
+ })
27
+ }
28
+
29
+ export function toggleExpandSidebar() {
30
+ if (get(sidebarExpanded)) {
31
+ previousWidth = get(sidebarWidth)
32
+ sidebarWidth.set(0)
33
+ } else {
34
+ sidebarWidth.set(previousWidth ?? 260)
35
+ }
36
+ if (showMobileNav) {
37
+ mobileExpanded = !mobileExpanded
38
+ } else {
39
+ desktopExpanded = !desktopExpanded
40
+ }
41
+ }
42
+
43
+ export function collapseMobileNavIfVisible() {
44
+ if (showMobileNav) {
45
+ mobileExpanded = false
46
+ }
47
+ }
48
+
49
+ export function updateSidebarWidth(newWidth) {
50
+ sidebarWidth.set(newWidth)
51
+ }
52
+
53
+ export function updateSidebarMaxWidth(newMaxWidth) {
54
+ sidebarMaxWidth.set(newMaxWidth)
55
+ }
@@ -1,26 +1,5 @@
1
- import { writable, get, derived, readable } from 'svelte/store'
2
-
3
- function localStore(
4
- name,
5
- defaultValue,
6
- parseString = (value) => value,
7
- stringify = (value) => value
8
- ) {
9
- const store = writable(
10
- parseString(localStorage.getItem(name)) ?? defaultValue
11
- )
12
- store.subscribe((value) => {
13
- localStorage.setItem(name, stringify(value))
14
- })
15
- return store
16
- }
17
-
18
- const textOrNumberParser = (value) => {
19
- if (Number.isNaN(Number(value))) {
20
- return value
21
- }
22
- return Number(value)
23
- }
1
+ import { writable, get, derived } from 'svelte/store'
2
+ import { localStore, textOrNumberParser } from './localStore'
24
3
 
25
4
  export const themes = writable([])
26
5
  export const stageSizes = writable({
@@ -77,9 +56,6 @@ export const appTheme = localStore('appTheme', 'default')
77
56
 
78
57
  export const activeTheme = localStore('frameTheme')
79
58
 
80
- export const desktopSidebarExpanded = writable(true)
81
- export const mobileSidebarExpanded = writable(false)
82
-
83
59
  export const showInspector = writable(false)
84
60
  export const showGrid = writable(false)
85
61
 
@@ -244,14 +220,6 @@ export function toggleExpandPanel() {
244
220
  panelExpanded.set(!get(panelExpanded))
245
221
  }
246
222
 
247
- export function toggleExpandSidebar() {
248
- if (get(mobileNav)) {
249
- mobileSidebarExpanded.set(!get(mobileSidebarExpanded))
250
- } else {
251
- desktopSidebarExpanded.set(!get(desktopSidebarExpanded))
252
- }
253
- }
254
-
255
223
  export function toggleShowInspector() {
256
224
  showInspector.set(!get(showInspector))
257
225
  }
@@ -260,35 +228,6 @@ export function toggleShowGrid() {
260
228
  showGrid.set(!get(showGrid))
261
229
  }
262
230
 
263
- export const mobileNav = readable(window.innerWidth < 840, (set) => {
264
- // Funktion zum Aktualisieren der Fensterbreite
265
- const updateWidth = () => {
266
- set(window.innerWidth < 840)
267
- mobileSidebarExpanded.set(false)
268
- }
269
-
270
- // Event-Listener für das Resize-Event hinzufügen
271
- window.addEventListener('resize', updateWidth)
272
-
273
- // Cleanup-Funktion, um den Event-Listener zu entfernen, wenn der Store nicht mehr verwendet wird
274
- return () => {
275
- window.removeEventListener('resize', updateWidth)
276
- }
277
- })
278
-
279
- export const sidebarExpanded = derived(
280
- [desktopSidebarExpanded, mobileSidebarExpanded, mobileNav],
281
- ([$desktopSidebarExpanded, $mobileSidebarExpanded, $mobileNav]) => {
282
- return $mobileNav ? $mobileSidebarExpanded : $desktopSidebarExpanded
283
- }
284
- )
285
-
286
- export function handleSelectionChanged() {
287
- if (get(mobileNav)) {
288
- mobileSidebarExpanded.set(false)
289
- }
290
- }
291
-
292
231
  export function setStagesize(nStageSize) {
293
232
  stageSize.set(nStageSize)
294
233
  const oldStageSizes = get(stageSizes)
@@ -1,9 +0,0 @@
1
- import{p as ft,f as wt,o as pt,A as kt,B as U,G as q,y as k,z as gt,R as zt,Z as Bt,_ as Ht,k as N,l as y,m as b,H as Lt,r as A,v as Nt,S as Gt,Q as z,g as t,O as Ft,s as u,F as mt,j as Pt,q as j,w as Rt,x as Et,h as c,I as D,K as Ot,u as Dt,C as jt,D as qt}from"./props-C0iXbu7F.js";import{dasMap as Kt}from"../das_import_map.js";import{componentMap as Qt}from"../component_import_map.js";import Zt from"../../garden.config.js";import"../gardenframe/cssimport.js";function Ct(B,o){ft(o,!0);let n=wt(o,"afterRenderHook",3,()=>{});pt(async()=>{await n()()});var r=kt(),L=U(r);{var l=v=>{var i=kt(),s=U(i);zt(s,()=>o.component),k(v,i)};q(L,v=>{o.component&&v(l)})}k(B,r),gt()}async function Jt(B){try{let o=Bt(Ct,{target:document.getElementById("garden_app"),props:{afterRenderHook:B}});return{destroy:()=>Ht(o),updateComponent:n=>{Ht(o),o=Bt(Ct,{target:document.getElementById("garden_app"),props:{...n,afterRenderHook:B}})}}}catch(o){console.log("error",o)}}const _t={create:Jt};var Ut=Gt('<rect fill="black"></rect>'),Vt=Gt('<rect fill="hsla(210, 75%, 50%, 0.45)"></rect>'),Xt=N('<div class="mask svelte-11d34ym"><svg xmlns="http://www.w3.org/2000/svg" class="svelte-11d34ym"><defs><mask id="mask"><rect y="0" x="0" width="100%" height="100%" fill="white"></rect><!></mask></defs><rect y="0" x="0" width="100%" height="100%" fill="hsla(256, 55%, 45%, 0.45)" mask="url(#mask)"></rect><!></svg></div>');function Yt(B,o){var n=Xt();let r;var L=b(n),l=b(L),v=b(l),i=y(b(v));Lt(i,17,()=>o.childElements,Ft,(x,g)=>{var h=Ut();A(()=>{z(h,"x",`${t(g).x??""}px`),z(h,"y",`${t(g).y??""}px`),z(h,"width",`${t(g).width??""}px`),z(h,"height",`${t(g).height??""}px`)}),k(x,h)});var s=y(l,2);Lt(s,17,()=>o.childElements,Ft,(x,g)=>{var h=Vt();A(()=>{z(h,"x",`${t(g).x??""}px`),z(h,"y",`${t(g).y??""}px`),z(h,"width",`${t(g).width??""}px`),z(h,"height",`${t(g).height??""}px`)}),k(x,h)}),A(x=>r=Nt(n,"",r,x),[()=>({top:`${o.top??""}px`,left:`${o.left??""}px`,width:`${o.width??""}px`,height:`${o.height??""}px`})]),k(B,n)}var $t=N('<div class="contentBox svelte-1p90mmv"></div>'),te=N('<div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Gap:</div> <div class="value"> </div></div>'),ee=N('<div class="value"> </div>'),oe=N('<div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Width:</div> <div class="value"> </div></div> <div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Height:</div> <div class="value"> </div></div> <!> <div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Margin:</div> <div class="value"> </div></div> <div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Padding:</div> <div class="value"> </div></div> <div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Role:</div> <div class="value"> </div></div> <div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Class Name:</div> <div class="info-classlist svelte-1p90mmv"></div></div>',1),ae=N('<div class="overlay svelte-1p90mmv"><div class="borderBox svelte-1p90mmv"></div> <div class="marginBox svelte-1p90mmv"></div> <div class="paddingBox svelte-1p90mmv"></div> <!></div> <div><!></div>',1);function ie(B,o){ft(o,!0);let n,r,L,l,v,i=u(void 0),s=u(void 0),x=u(void 0),g=u(void 0),h=u(!1),R=u(mt([])),S=u(void 0),G=u(void 0),K=u(void 0),Q=u(void 0),V=u(void 0),X=u(void 0),Z=u(void 0),I=u(void 0),P=u(void 0),T=u(void 0);function M(){if(!t(g)){r?.style&&(r.style.display="none"),n?.style&&(n.style.display="none"),c(i,null),c(s,null),c(x,null);return}n.style.display="block";const a=t(g).getBoundingClientRect(),m=getComputedStyle(t(g));c(P,document.body.scrollTop,!0),c(T,document.body.scrollLeft,!0),c(h,(m.display==="grid"||m.display==="flex")&&t(g).children.length>0,!0);const _=t(g).tagName,F=Array.from(t(g).classList);c(x,{tagName:_,classList:F,width:parseFloat(m.width),height:parseFloat(m.height),background:m.backgroundColor,gap:m.gap,rowGap:m.rowGap,columnGap:m.columnGap},!0),c(i,{top:parseFloat(m.marginTop),right:parseFloat(m.marginRight),bottom:parseFloat(m.marginBottom),left:parseFloat(m.marginLeft)},!0),c(s,{top:parseFloat(m.paddingTop),right:parseFloat(m.paddingRight),bottom:parseFloat(m.paddingBottom),left:parseFloat(m.paddingLeft)},!0),c(S,t(P)+a.top-t(i).top),c(K,a.height+t(i).top+t(i).bottom),c(Q,a.width+t(i).left+t(i).right);const C=t(S)+t(K);c(G,t(T)+a.left-t(i).left);const E=t(G)+t(Q);n.style.top=t(S)+"px",n.style.left=t(G)+"px",n.style.width=t(Q)+"px",n.style.height=t(K)+"px",L.style.borderWidth=`${t(i).top}px ${t(i).right}px ${t(i).bottom}px ${t(i).left}px`,l.style.top=t(i).top+"px",l.style.left=t(i).left+"px",l.style.width=a.width+"px",l.style.height=a.height+"px",l.style.borderWidth=`${t(s).top}px ${t(s).right}px ${t(s).bottom}px ${t(s).left}px`,c(V,t(i).top+t(s).top),c(X,t(i).left+t(s).left),c(Z,a.width-t(s).left-t(s).right),c(I,a.height-t(s).top-t(s).bottom),t(h)?Y(t(g),t(P),t(T)):v&&(v.style.top=t(V)+"px",v.style.left=t(X)+"px",v.style.width=t(Z)+"px",v.style.height=t(I)+"px"),O(t(S),C,t(P),t(G),t(T),E,t(i))}function Y(a,m,_){c(R,Array.from(a.children).map(F=>{const{marginTop:C,marginLeft:E,marginRight:e,marginBottom:d}=getComputedStyle(F),p=F.getBoundingClientRect();return{y:m+p.top-t(S)-t(i).top-t(s).top-parseFloat(C),x:_+p.left-t(G)-t(i).left-t(s).left-parseFloat(E),width:p.width+parseFloat(E)+parseFloat(e),height:p.height+parseFloat(C)+parseFloat(d)}}),!0)}function O(a,m,_,F,C,E,e){if(!r)return;const d=document.body.getBoundingClientRect(),p=130+(t(h)?20:0)+t(x).classList.length*20,w=225,f=d.height,W=d.width,xt=a-_-p>0,dt=m-_+p<f,yt=F-E+w<W;r.style.bottom="unset",dt?(r.style.top=m+e.top+e.bottom+8+"px",r.classList.add("infobox-bottom"),r.classList.remove("infobox-top")):xt?(r.style.top=a+5-p+"px",r.classList.add("infobox-top"),r.classList.remove("infobox-bottom")):(r.style.top="unset",r.style.bottom=-_+"px",r.classList.remove("infobox-top"),r.classList.remove("infobox-bottom")),yt?(r.style.left=F+"px",r.style.right="unset",r.classList.add("infobox-left"),r.classList.remove("infobox-right")):(r.style.left="unset",r.style.right=W-C+"px",r.classList.add("infobox-right"),r.classList.remove("infobox-left")),r.style.display="block"}const J=a=>{a.target&&a.target!==n&&!n?.contains(a.target)&&(c(g,a.target,!0),M())},it=a=>{n&&!n.contains(a.relatedTarget)&&(c(i,null),c(s,null),c(x,null),c(g,null),n.style.display="none",r.style.display="none")};pt(()=>{o.contentPane&&(o.contentPane.addEventListener("mousemove",J),o.contentPane.addEventListener("mouseout",it),document.body.addEventListener("scroll",M,{passive:!0}))}),Pt(()=>{o.contentPane.removeEventListener("mousemove",J),o.contentPane.removeEventListener("mouseout",it),document.body.removeEventListener("scroll",M)});var rt=ae(),$=U(rt),H=y(b($),2);j(H,a=>L=a,()=>L);var nt=y(H,2);j(nt,a=>l=a,()=>l);var lt=y(nt,2);{var ut=a=>{{let m=Rt(()=>t(i)?.top+t(s)?.top),_=Rt(()=>t(i)?.left+t(s)?.left);Yt(a,{get top(){return t(m)},get left(){return t(_)},get width(){return t(Z)},get height(){return t(I)},get childElements(){return t(R)}})}},tt=a=>{var m=$t();j(m,_=>v=_,()=>v),k(a,m)};q(lt,a=>{t(h)?a(ut):a(tt,!1)})}j($,a=>n=a,()=>n);var et=y($,2);let ot;var st=b(et);{var ht=a=>{var m=oe(),_=U(m),F=y(b(_),2),C=b(F),E=y(_,2),e=y(b(E),2),d=b(e),p=y(E,2);{var w=at=>{var ct=te(),vt=y(b(ct),2),bt=b(vt);A(()=>D(bt,`${t(x).gap??""}
2
- ${t(x).columnGap??""}
3
- ${t(x).rowGap??""}`)),k(at,ct)};q(p,at=>{t(h)&&at(w)})}var f=y(p,2),W=y(b(f),2),xt=b(W),dt=y(f,2),yt=y(b(dt),2),Tt=b(yt),St=y(dt,2),Mt=y(b(St),2),At=b(Mt),It=y(St,2),Wt=y(b(It),2);Lt(Wt,21,()=>t(x).classList,Ft,(at,ct)=>{var vt=ee(),bt=b(vt);A(()=>D(bt,t(ct))),k(at,vt)}),A(()=>{D(C,`${t(x).width??""}px`),D(d,`${t(x).height??""}px`),D(xt,`${t(i).top??""}${t(i).top!==0?"px":""}
4
- ${t(i).right??""}${t(i).right!==0?"px":""}
5
- ${t(i).bottom??""}${t(i).bottom!==0?"px":""}
6
- ${t(i).left??""}${t(i).left!==0?"px":""}`),D(Tt,`${t(s).top??""}${t(s).top!==0?"px":""}
7
- ${t(s).right??""}${t(s).right!==0?"px":""}
8
- ${t(s).bottom??""}${t(s).bottom!==0?"px":""}
9
- ${t(s).left??""}${t(s).left!==0?"px":""}`),D(At,t(x).tagName)}),k(a,m)};q(st,a=>{t(x)&&t(i)&&t(s)&&t(g)&&a(ht)})}j(et,a=>r=a,()=>r),A(a=>ot=Et(et,1,"infobox infobox-left infobox-right infobox-bottom infobox-top svelte-1p90mmv",null,ot,a),[()=>({dark:o.appTheme==="dark"})]),k(B,rt),gt()}var re=N("<div></div>");function ne(B,o){ft(o,!0);let n,r;function L(){const v=document.getElementById("garden_app").getBoundingClientRect(),i=document.body.getBoundingClientRect(),s=Math.max(v.height,i.height),x=Math.max(v.width,i.width);n.style.margin=o.appMargin;const g=o.gridSettings.size,h=o.gridSettings.color;n.style.backgroundSize=`${g}px ${g}px`;const R=getComputedStyle(n);n.style.width=`calc(${x}px - ${R.marginLeft} - ${R.marginRight})`,n.style.height=`calc(${s}px - ${R.marginTop} - ${R.marginBottom})`,o.gridSettings.style==="lined"&&(n.style.backgroundImage=`linear-gradient(to right, ${h} 1px, transparent 1px), linear-gradient(to bottom, ${h} 1px, transparent 1px)`),o.gridSettings.style==="dotted"&&(n.style.top=`-${g/2}px`,n.style.left=`-${g/2}px`,n.style.backgroundImage=`radial-gradient(circle, ${h} 1px, transparent 1px)`)}pt(()=>{o.contentPane&&(L(),r=new ResizeObserver(()=>{L()}),r.observe(o.contentPane),r.observe(document.body))}),Pt(()=>{r.disconnect()});var l=re();j(l,v=>n=v,()=>n),A(()=>Et(l,1,Ot({grid:!0,lined:o.gridSettings.style==="lined",dotted:o.gridSettings.style==="dotted"}),"svelte-17fzfog")),k(B,l),gt()}var le=N('<!> <!> <div id="garden_app"><!></div>',1);function se(B,o){ft(o,!0);let n=wt(o,"componentMap",19,()=>({})),r=wt(o,"dasMap",19,()=>({})),L=o.config.hookTimeout|5e3,l=u(mt({})),v=u(mt({})),i,s=u(!1),x=u(void 0),g,h,R,S=u(void 0),G={},K,Q,V=u(!1),X=u(!1),Z=u(mt({})),I=[],P=[],T=[],M=[],Y=[],O=u(void 0),J=u(!1);pt(()=>{c(J,!0)}),window.addEventListener("message",e=>{o.config.themeHandler&&o.config.themeHandler(e.data.theme),c(s,e.data.stageSize==="full"),c(V,e.data.showInspector===!0),c(X,e.data.showGrid===!0),c(Z,e.data.gridSettings,!0),c(l,r()[e.data.componentName],!0);const d=t(l)?.examples?.find(w=>w.title===e.data.selectedExample)??{},p=e.data?.args&&typeof e.data.args=="object"?e.data.args:{};if(c(v,{...d,input:{...d?.input??{},...p}},!0),K=R!==e.data.componentName,R=e.data.componentName||"Welcome",Q=i!==e.data.selectedExample,i=e.data.selectedExample,c(x,e.data.appTheme,!0),c(S,n()?.[R],!0),o.config.devmodus){G={};return}else rt(t(S),t(v),t(l))});async function it(e){if(!e)return _t;for(const d in o.config.renderer)if(new RegExp(d+"$").test(e))return o.config.renderer[d];return _t}async function rt(e,d,p){if(o.config.renderer){const w=await it(p?.file);w!==g&&await lt(w)}await nt();try{h?.updateComponent({component:e,selectedExample:d,das:p,decorators:p?.decorators,afterRenderHook:$})}catch(w){console.error(w)}}async function $(){await tt(Y)}let H=[];async function nt(){if(K){Y=[t(v)?.play],M=t(l)?.beforeAll?[t(l)?.beforeAll]:[];const e=t(l)?.hooks?H.filter(f=>!t(l)?.hooks.find(W=>W===f)):H,d=H.length>0?t(l)?.hooks.filter(f=>!H.find(W=>f===W)):t(l)?.hooks??[];H=t(l)?.hooks??[];const p=H.filter(f=>f.before).map(f=>f.before)??[];P=[...P,...e.filter(f=>f.afterAll).map(f=>f.afterAll)],M=[...d.filter(f=>f.beforeAll).map(f=>f.beforeAll),...M],T=[...p,t(l)?.before,t(v)?.before].filter(f=>!!f),await tt([...I,...P,...M,...T]);const w=H.filter(f=>f.after).map(f=>f.after)??[];P=t(l)?.afterAll?[t(l)?.afterAll]:[],I=[t(v)?.after,t(l)?.after,...w].filter(f=>!!f),M=[]}else Q&&(Y=[t(v)?.play],T=[t(l)?.before,t(v)?.before],await tt([...I,...T]),I=[t(v)?.after,t(l)?.after])}async function lt(e){try{await h?.destroy()}catch(d){console.error("Could not destroy current renderer",d)}h=await e.create()}Dt(()=>{o.config.devmodus||lt(_t)});function ut(e){t(l).out&&t(l).out.forEach(d=>{if(e.detail[d.name]&&(console.log(e.detail[d.name]),t(v).redirect&&t(v).redirect[d.name])){const p=t(v).redirect[d.name];G[p]=e.detail[d.name]}})}async function tt(e){for(const d of e)if(d)try{await Promise.race([et(L),d()])}catch(p){console.error(p)}}function et(e){return new Promise((d,p)=>{setTimeout(()=>p(new Error("Timeout on")),e)})}var ot=le(),st=U(ot);{var ht=e=>{ie(e,{get contentPane(){return t(O)},get appTheme(){return t(x)}})};q(st,e=>{t(J)&&t(V)&&t(O)&&e(ht)})}var a=y(st,2);{var m=e=>{{let d=Rt(()=>t(s)?"0.5rem 0.5rem 0":0);ne(e,{get gridSettings(){return t(Z)},get contentPane(){return t(O)},get appMargin(){return t(d)}})}};q(a,e=>{t(J)&&t(X)&&e(m)})}var _=y(a,2);let F;var C=b(_);{var E=e=>{var d=kt(),p=U(d);jt(p,()=>t(S),(w,f)=>{f(w,qt(()=>t(v)?.input,()=>G,{$$events:{out:ut}}))}),k(e,d)};q(C,e=>{o.config.devmodus&&t(S)&&(t(l)?.file??"").indexOf(".svelte")>0&&e(E)})}j(_,e=>c(O,e),()=>t(O)),A(e=>F=Et(_,1,"svelte-16w9tv2",null,F,e),[()=>({full:t(s)})]),k(B,ot),gt()}Bt(se,{target:document.body,props:{componentMap:Qt,dasMap:Kt,config:Zt}});