gardenjs 1.7.1 → 1.7.3
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.
- package/README.md +1 -0
- package/bin/servegarden.js +22 -18
- package/dist/assets/{frame-BnV1YnGW.css → frame-DNQctfZb.css} +1 -1
- package/dist/assets/frame-Z1Hax3or.js +9 -0
- package/dist/assets/index-6DOENHaB.js +46 -0
- package/dist/assets/index-xKFU1UAQ.css +19 -0
- package/dist/assets/{props-BQOViwFg.js → props-BlmngvIZ.js} +1 -1
- package/dist/frame.html +3 -3
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/src/client/GardenApp.svelte +7 -4
- package/src/client/GardenFrame.svelte +11 -4
- package/src/client/components/sidebar/Sidebar.svelte +0 -1
- package/src/client/components/stage/BackgroundGrid.svelte +0 -11
- package/src/client/components/stage/DistanceMeasure.svelte +137 -0
- package/src/client/components/stage/Stage.svelte +15 -4
- package/src/client/components/stage/panel/PanelExamplesNav.svelte +10 -2
- package/src/client/components/stage/panel/ParamsPane.svelte +251 -124
- package/src/client/components/stage/panel/controls/ArrayControl.svelte +202 -124
- package/src/client/components/stage/panel/controls/NumberControl.svelte +1 -1
- package/src/client/components/stage/panel/controls/ObjectControl.svelte +139 -51
- package/src/client/components/stage/panel/controls/button.scss +8 -5
- package/src/client/components/stage/panel/controls/button_unset.scss +0 -1
- package/src/client/components/topbar/Topbar.svelte +7 -0
- package/src/client/logic/localStore.js +1 -1
- package/src/client/logic/stage.js +92 -31
- package/src/codegenerator/base_generator.js +13 -20
- package/dist/assets/frame-DZrm9TF0.js +0 -9
- package/dist/assets/index-BMUAOuQc.js +0 -46
- package/dist/assets/index-qFmggI7l.css +0 -19
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
import { writable, get, derived } from 'svelte/store'
|
|
2
2
|
import { localStore, textOrNumberParser } from './localStore'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const DEFAULT_THEME = {
|
|
5
|
+
name: 'default',
|
|
6
|
+
stageBg: 'white',
|
|
7
|
+
color: '#14aab8',
|
|
8
|
+
grid: {
|
|
9
|
+
style: 'lined', // 'dotted'
|
|
10
|
+
color: 'grey',
|
|
11
|
+
size: '16', // px
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// DEPRECATED
|
|
16
|
+
export function setGridSettings({ size, style, color }) {
|
|
17
|
+
themes.set(
|
|
18
|
+
get(themes).map((theme) => {
|
|
19
|
+
return {
|
|
20
|
+
...theme,
|
|
21
|
+
grid: { ...DEFAULT_THEME.grid, ...theme.grid, size, style, color },
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const themes = writable([{ ...DEFAULT_THEME }])
|
|
5
28
|
export const stageSizes = writable({
|
|
6
29
|
small: [{ name: 'small', h: 1170, w: 550 }],
|
|
7
30
|
medium: [{ name: 'medium', h: 1080, w: 810 }],
|
|
8
31
|
large: [{ name: 'large', h: 960, w: 1536 }],
|
|
9
32
|
})
|
|
10
33
|
|
|
34
|
+
const activeThemeName = localStore('frameTheme', 'default')
|
|
35
|
+
|
|
36
|
+
export const activeTheme = derived(
|
|
37
|
+
[themes, activeThemeName],
|
|
38
|
+
([themes, activeThemeName]) =>
|
|
39
|
+
themes.find((theme) => theme.name === activeThemeName) ?? DEFAULT_THEME
|
|
40
|
+
)
|
|
41
|
+
|
|
11
42
|
const fullStageSize = {
|
|
12
43
|
name: 'full',
|
|
13
44
|
h: '100%',
|
|
@@ -54,17 +85,10 @@ export const stageRect = writable({})
|
|
|
54
85
|
export const panelExpanded = writable(true)
|
|
55
86
|
export const appTheme = localStore('appTheme', 'default')
|
|
56
87
|
|
|
57
|
-
export const activeTheme = localStore('frameTheme')
|
|
58
|
-
|
|
59
88
|
export const showInspector = writable(false)
|
|
89
|
+
export const showDistanceMeasure = writable(false)
|
|
60
90
|
export const showGrid = writable(false)
|
|
61
91
|
|
|
62
|
-
export const gridSettings = writable({
|
|
63
|
-
size: 16,
|
|
64
|
-
style: 'lined',
|
|
65
|
-
color: '#ddd',
|
|
66
|
-
})
|
|
67
|
-
|
|
68
92
|
export const resetStage = () => {
|
|
69
93
|
stageSize.set('full')
|
|
70
94
|
landscape.set(false)
|
|
@@ -75,14 +99,6 @@ export const resetStage = () => {
|
|
|
75
99
|
stageWidth.set('full')
|
|
76
100
|
}
|
|
77
101
|
|
|
78
|
-
export function setGridSettings({ size, style, color }) {
|
|
79
|
-
gridSettings.set({
|
|
80
|
-
size: size ?? 50,
|
|
81
|
-
style: style ?? 'lined',
|
|
82
|
-
color: color ?? 'grey',
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
102
|
let previousPanelHeight = ''
|
|
87
103
|
|
|
88
104
|
export function setStageSizes(newStageSizes) {
|
|
@@ -90,19 +106,54 @@ export function setStageSizes(newStageSizes) {
|
|
|
90
106
|
setStagesize(get(stageSize))
|
|
91
107
|
}
|
|
92
108
|
|
|
93
|
-
export function setThemes(
|
|
94
|
-
if (!
|
|
95
|
-
|
|
96
|
-
newThemes?.find((theme) => theme.active)?.name ?? newThemes[0].name
|
|
97
|
-
)
|
|
109
|
+
export function setThemes(themeSettings) {
|
|
110
|
+
if (!themeSettings) {
|
|
111
|
+
return
|
|
98
112
|
}
|
|
113
|
+
if (Array.isArray(themeSettings)) {
|
|
114
|
+
// deprecated
|
|
115
|
+
if (!get(activeThemeName)) {
|
|
116
|
+
activeThemeName.set(
|
|
117
|
+
themeSettings?.find((theme) => theme.active)?.name ??
|
|
118
|
+
themeSettings[0].name
|
|
119
|
+
)
|
|
120
|
+
}
|
|
99
121
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
themes.set(
|
|
123
|
+
themeSettings?.map((theme) => ({
|
|
124
|
+
...theme,
|
|
125
|
+
active: theme.name === get(activeThemeName),
|
|
126
|
+
}))
|
|
127
|
+
)
|
|
128
|
+
} else {
|
|
129
|
+
// new way
|
|
130
|
+
const defaultTheme = {
|
|
131
|
+
...DEFAULT_THEME,
|
|
132
|
+
...themeSettings.default,
|
|
133
|
+
grid: {
|
|
134
|
+
...DEFAULT_THEME.grid,
|
|
135
|
+
...themeSettings.default?.grid,
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
themes.set([
|
|
139
|
+
defaultTheme,
|
|
140
|
+
...(themeSettings.extended?.map((extendedTheme) => {
|
|
141
|
+
return {
|
|
142
|
+
...defaultTheme,
|
|
143
|
+
...extendedTheme,
|
|
144
|
+
grid: {
|
|
145
|
+
...defaultTheme.grid,
|
|
146
|
+
...extendedTheme.grid,
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
}) ?? []),
|
|
150
|
+
])
|
|
151
|
+
|
|
152
|
+
const themeName =
|
|
153
|
+
get(themes).find((theme) => theme.name === get(activeThemeName))?.name ??
|
|
154
|
+
defaultTheme.name
|
|
155
|
+
setTheme(themeName)
|
|
156
|
+
}
|
|
106
157
|
computeStageStyle()
|
|
107
158
|
}
|
|
108
159
|
|
|
@@ -110,7 +161,7 @@ export function setTheme(themeName) {
|
|
|
110
161
|
themes.set(
|
|
111
162
|
get(themes).map((theme) => ({ ...theme, active: theme.name === themeName }))
|
|
112
163
|
)
|
|
113
|
-
|
|
164
|
+
activeThemeName.set(themeName)
|
|
114
165
|
computeStageStyle()
|
|
115
166
|
}
|
|
116
167
|
|
|
@@ -121,11 +172,11 @@ export function toggleAppTheme() {
|
|
|
121
172
|
export function getCurrentTheme() {
|
|
122
173
|
if (get(themes) && get(themes).length > 0) {
|
|
123
174
|
return (
|
|
124
|
-
get(themes).find((theme) => theme.name === get(
|
|
175
|
+
get(themes).find((theme) => theme.name === get(activeThemeName)) ??
|
|
125
176
|
get(themes)[0]
|
|
126
177
|
)
|
|
127
178
|
}
|
|
128
|
-
return
|
|
179
|
+
return DEFAULT_THEME
|
|
129
180
|
}
|
|
130
181
|
|
|
131
182
|
function findStageSize(name) {
|
|
@@ -222,6 +273,16 @@ export function toggleExpandPanel() {
|
|
|
222
273
|
|
|
223
274
|
export function toggleShowInspector() {
|
|
224
275
|
showInspector.set(!get(showInspector))
|
|
276
|
+
if (get(showInspector) && get(showDistanceMeasure)) {
|
|
277
|
+
showDistanceMeasure.set(false)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export function toggleShowDistanceMeasure() {
|
|
282
|
+
showDistanceMeasure.set(!get(showDistanceMeasure))
|
|
283
|
+
if (get(showInspector) && get(showDistanceMeasure)) {
|
|
284
|
+
showInspector.set(false)
|
|
285
|
+
}
|
|
225
286
|
}
|
|
226
287
|
|
|
227
288
|
export function toggleShowGrid() {
|
|
@@ -268,7 +268,7 @@ function createDasImportStmt(description) {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
function createDecoratorImportStmt(decorator) {
|
|
271
|
-
return `import ${decorator.fullname} from '${decorator.fullpath}'`
|
|
271
|
+
return `import ${decorator.fullname} from '${pathRelativeToGarden}${decorator.fullpath}'`
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
function createHookImportStmt(hook) {
|
|
@@ -361,27 +361,20 @@ function createComponentDescription({
|
|
|
361
361
|
}
|
|
362
362
|
})
|
|
363
363
|
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
decorators = [...decorators, ...dasDecorator].map(
|
|
364
|
+
const dasDecorators = (das.decorators ?? []).map((filename) => {
|
|
365
|
+
return {
|
|
366
|
+
basepath,
|
|
367
|
+
relativepath,
|
|
368
|
+
filename,
|
|
369
|
+
extension,
|
|
370
|
+
}
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
decorators = [...decorators, ...dasDecorators].map(
|
|
376
374
|
({ basepath, relativepath, filename, extension }) => {
|
|
377
375
|
return {
|
|
378
376
|
fullname: createFullname(navbasenode, relativepath, filename),
|
|
379
|
-
fullpath: path.join(
|
|
380
|
-
pathRelativeToGarden,
|
|
381
|
-
basepath,
|
|
382
|
-
relativepath,
|
|
383
|
-
filename
|
|
384
|
-
),
|
|
377
|
+
fullpath: path.join(basepath, relativepath, filename),
|
|
385
378
|
extension,
|
|
386
379
|
}
|
|
387
380
|
}
|
|
@@ -422,7 +415,7 @@ function createFullname(navfolder, relativepath, name) {
|
|
|
422
415
|
return navfolder
|
|
423
416
|
.split('/')
|
|
424
417
|
.concat(relativepath.split('/'))
|
|
425
|
-
.concat(
|
|
418
|
+
.concat(name.replaceAll('.', '').replaceAll('-', '_').split('/'))
|
|
426
419
|
.map(firstLetterToUpperCase)
|
|
427
420
|
.join('')
|
|
428
421
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{p as pe,j as _e,X as ge,F as ke,G as te,K as Z,C as L,D as ue,W as ze,a4 as Be,a5 as Se,o as V,w as y,v as b,L as Le,y as W,z as Ne,Z as Ce,V as D,g as e,T as Ee,l as g,J as fe,Y as Pe,x as Y,A as Fe,B as Re,m as c,M as X,P as Oe,k as De,H as Ve,I as je}from"./props-BQOViwFg.js";import{dasMap as Je}from"../das_import_map.js";import{componentMap as Ke}from"../component_import_map.js";import Xe from"../../garden.config.js";import"../gardenframe/cssimport.js";function Te(E,a){pe(a,!0);let r=_e(a,"afterRenderHook",3,()=>{});ge(async()=>{await r()()});var n=ke(),F=te(n);{var l=m=>{var i=ke(),s=te(i);ze(s,()=>a.component),L(m,i)};Z(F,m=>{a.component&&m(l)})}L(E,n),ue()}async function Ye(E){try{let a=Be(Te,{target:document.getElementById("garden_app"),props:{afterRenderHook:E}});return{destroy:()=>Se(a),updateComponent:r=>{Se(a),a=Be(Te,{target:document.getElementById("garden_app"),props:{...r,afterRenderHook:E}})}}}catch(a){console.log("error",a)}}const we={create:Ye};var Ze=Ce('<rect fill="black"></rect>'),qe=Ce('<rect fill="hsla(210, 75%, 50%, 0.45)"></rect>'),Qe=V('<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 Ue(E,a){var r=Qe();let n;var F=b(r),l=b(F),m=b(l),i=y(b(m));Le(i,17,()=>a.childElements,Ee,(h,p)=>{var u=Ze();W(()=>{D(u,"x",`${e(p).x??""}px`),D(u,"y",`${e(p).y??""}px`),D(u,"width",`${e(p).width??""}px`),D(u,"height",`${e(p).height??""}px`)}),L(h,u)});var s=y(l,2);Le(s,17,()=>a.childElements,Ee,(h,p)=>{var u=qe();W(()=>{D(u,"x",`${e(p).x??""}px`),D(u,"y",`${e(p).y??""}px`),D(u,"width",`${e(p).width??""}px`),D(u,"height",`${e(p).height??""}px`)}),L(h,u)}),W(h=>n=Ne(r,"",n,h),[()=>({top:`${a.top??""}px`,left:`${a.left??""}px`,width:`${a.width??""}px`,height:`${a.height??""}px`})]),L(E,r)}var $e=V('<div class="contentBox svelte-1p90mmv"></div>'),et=V('<div class="info-item svelte-1p90mmv"><div class="attribute svelte-1p90mmv">Gap:</div> <div class="value"> </div></div>'),tt=V('<div class="value"> </div>'),at=V('<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),ot=V('<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 it(E,a){pe(a,!0);let r,n,F,l,m,i=g(void 0),s=g(void 0),h=g(void 0),p=g(void 0),u=g(!1),H=g(fe([])),S=g(void 0),C=g(void 0),q=g(void 0),Q=g(void 0),ae=g(void 0),oe=g(void 0),U=g(void 0),z=g(void 0),P=g(void 0),G=g(void 0);function M(){if(!e(p)){n?.style&&(n.style.display="none"),r?.style&&(r.style.display="none"),c(i,null),c(s,null),c(h,null);return}r.style.display="block";const o=e(p).getBoundingClientRect(),v=getComputedStyle(e(p));c(P,document.body.scrollTop,!0),c(G,document.body.scrollLeft,!0),c(u,(v.display==="grid"||v.display==="flex")&&e(p).children.length>0,!0);const w=e(p).tagName,R=Array.from(e(p).classList);c(h,{tagName:w,classList:R,width:parseFloat(v.width),height:parseFloat(v.height),background:v.backgroundColor,gap:v.gap,rowGap:v.rowGap,columnGap:v.columnGap},!0),c(i,{top:parseFloat(v.marginTop),right:parseFloat(v.marginRight),bottom:parseFloat(v.marginBottom),left:parseFloat(v.marginLeft)},!0),c(s,{top:parseFloat(v.paddingTop),right:parseFloat(v.paddingRight),bottom:parseFloat(v.paddingBottom),left:parseFloat(v.paddingLeft)},!0),c(S,e(P)+o.top-e(i).top),c(q,o.height+e(i).top+e(i).bottom),c(Q,o.width+e(i).left+e(i).right);const T=e(S)+e(q);c(C,e(G)+o.left-e(i).left);const k=e(C)+e(Q);r.style.top=e(S)+"px",r.style.left=e(C)+"px",r.style.width=e(Q)+"px",r.style.height=e(q)+"px",F.style.borderWidth=`${e(i).top}px ${e(i).right}px ${e(i).bottom}px ${e(i).left}px`,l.style.top=e(i).top+"px",l.style.left=e(i).left+"px",l.style.width=o.width+"px",l.style.height=o.height+"px",l.style.borderWidth=`${e(s).top}px ${e(s).right}px ${e(s).bottom}px ${e(s).left}px`,c(ae,e(i).top+e(s).top),c(oe,e(i).left+e(s).left),c(U,o.width-e(s).left-e(s).right),c(z,o.height-e(s).top-e(s).bottom),e(u)?ie(e(p),e(P),e(G)):m&&(m.style.top=e(ae)+"px",m.style.left=e(oe)+"px",m.style.width=e(U)+"px",m.style.height=e(z)+"px"),j(e(S),T,e(P),e(C),e(G),k,e(i))}function ie(o,v,w){c(H,Array.from(o.children).map(R=>{const{marginTop:T,marginLeft:k,marginRight:I,marginBottom:O}=getComputedStyle(R),B=R.getBoundingClientRect();return{y:v+B.top-e(S)-e(i).top-e(s).top-parseFloat(T),x:w+B.left-e(C)-e(i).left-e(s).left-parseFloat(k),width:B.width+parseFloat(k)+parseFloat(I),height:B.height+parseFloat(T)+parseFloat(O)}}),!0)}function j(o,v,w,R,T,k,I){if(!n)return;const O=document.body.getBoundingClientRect(),B=130+(e(u)?20:0)+e(h).classList.length*20,t=225,d=O.height,x=O.width,_=o-w-B>0,f=v-w+B<d,K=R-k+t<x;n.style.bottom="unset",f?(n.style.top=v+I.top+I.bottom+8+"px",n.classList.add("infobox-bottom"),n.classList.remove("infobox-top")):_?(n.style.top=o+5-B+"px",n.classList.add("infobox-top"),n.classList.remove("infobox-bottom")):(n.style.top="unset",n.style.bottom=-w+"px",n.classList.remove("infobox-top"),n.classList.remove("infobox-bottom")),K?(n.style.left=R+"px",n.style.right="unset",n.classList.add("infobox-left"),n.classList.remove("infobox-right")):(n.style.left="unset",n.style.right=x-T+"px",n.classList.add("infobox-right"),n.classList.remove("infobox-left")),n.style.display="block"}const $=o=>{o.target&&o.target!==r&&!r?.contains(o.target)&&(c(p,o.target,!0),M())},le=o=>{r&&!r.contains(o.relatedTarget)&&(c(i,null),c(s,null),c(h,null),c(p,null),r.style.display="none",n.style.display="none")};ge(()=>{a.contentPane&&(a.contentPane.addEventListener("mousemove",$),a.contentPane.addEventListener("mouseout",le),document.body.addEventListener("scroll",M,{passive:!0}))}),Pe(()=>{a.contentPane.removeEventListener("mousemove",$),a.contentPane.removeEventListener("mouseout",le),document.body.removeEventListener("scroll",M)});var J=ot(),N=te(J),se=y(b(N),2);Y(se,o=>F=o,()=>F);var de=y(se,2);Y(de,o=>l=o,()=>l);var he=y(de,2);{var A=o=>{{let v=Fe(()=>e(i)?.top+e(s)?.top),w=Fe(()=>e(i)?.left+e(s)?.left);Ue(o,{get top(){return e(v)},get left(){return e(w)},get width(){return e(U)},get height(){return e(z)},get childElements(){return e(H)}})}},xe=o=>{var v=$e();Y(v,w=>m=w,()=>m),L(o,v)};Z(he,o=>{e(u)?o(A):o(xe,!1)})}Y(N,o=>r=o,()=>r);var ee=y(N,2);let ce;var ne=b(ee);{var ye=o=>{var v=at(),w=te(v),R=y(b(w),2),T=b(R),k=y(w,2),I=y(b(k),2),O=b(I),B=y(k,2);{var t=re=>{var ve=et(),me=y(b(ve),2),be=b(me);W(()=>X(be,`${e(h).gap??""}
|
|
2
|
-
${e(h).columnGap??""}
|
|
3
|
-
${e(h).rowGap??""}`)),L(re,ve)};Z(B,re=>{e(u)&&re(t)})}var d=y(B,2),x=y(b(d),2),_=b(x),f=y(d,2),K=y(b(f),2),Ge=b(K),He=y(f,2),Me=y(b(He),2),Ae=b(Me),Ie=y(He,2),We=y(b(Ie),2);Le(We,21,()=>e(h).classList,Ee,(re,ve)=>{var me=tt(),be=b(me);W(()=>X(be,e(ve))),L(re,me)}),W(()=>{X(T,`${e(h).width??""}px`),X(O,`${e(h).height??""}px`),X(_,`${e(i).top??""}${e(i).top!==0?"px":""}
|
|
4
|
-
${e(i).right??""}${e(i).right!==0?"px":""}
|
|
5
|
-
${e(i).bottom??""}${e(i).bottom!==0?"px":""}
|
|
6
|
-
${e(i).left??""}${e(i).left!==0?"px":""}`),X(Ge,`${e(s).top??""}${e(s).top!==0?"px":""}
|
|
7
|
-
${e(s).right??""}${e(s).right!==0?"px":""}
|
|
8
|
-
${e(s).bottom??""}${e(s).bottom!==0?"px":""}
|
|
9
|
-
${e(s).left??""}${e(s).left!==0?"px":""}`),X(Ae,e(h).tagName)}),L(o,v)};Z(ne,o=>{e(h)&&e(i)&&e(s)&&e(p)&&o(ye)})}Y(ee,o=>n=o,()=>n),W(o=>ce=Re(ee,1,"infobox infobox-left infobox-right infobox-bottom infobox-top svelte-1p90mmv",null,ce,o),[()=>({dark:a.appTheme==="dark"})]),L(E,J),ue()}var nt=V("<div></div>");function rt(E,a){pe(a,!0);let r,n;function F(){const m=document.getElementById("garden_app").getBoundingClientRect(),i=document.body.getBoundingClientRect(),s=Math.max(m.height,i.height),h=Math.max(m.width,i.width);r.style.margin=a.appMargin;const p=a.gridSettings.size,u=a.gridSettings.color;r.style.backgroundSize=`${p}px ${p}px`;const H=getComputedStyle(r);r.style.width=`calc(${h}px - ${H.marginLeft} - ${H.marginRight})`,r.style.height=`calc(${s}px - ${H.marginTop} - ${H.marginBottom})`,a.gridSettings.style==="lined"&&(r.style.backgroundImage=`linear-gradient(to right, ${u} 1px, transparent 1px), linear-gradient(to bottom, ${u} 1px, transparent 1px)`),a.gridSettings.style==="dotted"&&(r.style.top=`-${p/2}px`,r.style.left=`-${p/2}px`,r.style.backgroundImage=`radial-gradient(circle, ${u} 1px, transparent 1px)`)}ge(()=>{a.contentPane&&(F(),n=new ResizeObserver(()=>{F()}),n.observe(a.contentPane),n.observe(document.body))}),Pe(()=>{n.disconnect()});var l=nt();Y(l,m=>r=m,()=>r),W(()=>Re(l,1,Oe({grid:!0,lined:a.gridSettings.style==="lined",dotted:a.gridSettings.style==="dotted"}),"svelte-17fzfog")),L(E,l),ue()}var lt=V('<!> <!> <div id="garden_app"><!></div>',1);function st(E,a){pe(a,!0);let r=_e(a,"componentMap",19,()=>({})),n=_e(a,"dasMap",19,()=>({})),F=a.config.hookTimeout|5e3,l=g(fe({})),m=g(fe({})),i,s=g(!1),h=g(void 0),p,u,H,S=g(void 0),C={},q,Q,ae=g(!1),oe=g(!1),U=g(fe({})),z=[],P=[],G=[],M=[],ie=[],j=g(void 0),$=g(!1);ge(()=>{c($,!0)}),window.addEventListener("message",t=>{a.config.themeHandler&&a.config.themeHandler(t.data.theme),c(s,t.data.stageSize==="full"),c(ae,t.data.showInspector===!0),c(oe,t.data.showGrid===!0),c(U,t.data.gridSettings,!0),c(l,n()[t.data.componentName],!0);const d=e(l)?.examples?.find(_=>_.title===t.data.selectedExample)??{},x=t.data?.paramValues??void 0;if(c(m,{...d,input:x??d?.input??{}},!0),q=H!==t.data.componentName,H=t.data.componentName||"Welcome",Q=i!==t.data.selectedExample,i=t.data.selectedExample,c(h,t.data.appTheme,!0),c(S,r()?.[H],!0),a.config.devmodus){C={};return}else se(()=>de(e(S),e(m),e(l)))});async function le(t){if(!t)return we;for(const d in a.config.renderer)if(new RegExp(d+"$").test(t))return a.config.renderer[d];return we}let J,N=!1;const se=async t=>{if(J=t,!N&&!N){for(N=!0;J!=null;){const d=J;J=void 0,await d()}N=!1}};async function de(t,d,x){if(a.config.renderer){const _=await le(x?.file);_!==p&&await ee(_)}await xe();try{await u?.updateComponent({component:t,selectedExample:d,das:x,decorators:x?.decorators,afterRenderHook:he})}catch(_){console.error(_)}}async function he(){await ne(ie)}let A=[];async function xe(){if(q){ie=[e(m)?.play],M=e(l)?.beforeAll?[e(l)?.beforeAll]:[];const t=e(l)?.hooks?A.filter(f=>!e(l)?.hooks.find(K=>K===f)):A,d=A.length>0?e(l)?.hooks.filter(f=>!A.find(K=>f===K)):e(l)?.hooks??[];A=e(l)?.hooks??[];const x=A.filter(f=>f.before).map(f=>f.before)??[];P=[...P,...t.filter(f=>f.afterAll).map(f=>f.afterAll)],M=[...d.filter(f=>f.beforeAll).map(f=>f.beforeAll),...M],G=[...x,e(l)?.before,e(m)?.before].filter(f=>!!f),await ne([...z,...P,...M,...G]);const _=A.filter(f=>f.after).map(f=>f.after)??[];P=e(l)?.afterAll?[e(l)?.afterAll]:[],z=[e(m)?.after,e(l)?.after,..._].filter(f=>!!f),M=[]}else Q&&(ie=[e(m)?.play],G=[e(l)?.before,e(m)?.before],await ne([...z,...G]),z=[e(m)?.after,e(l)?.after])}async function ee(t){try{await u?.destroy()}catch(d){console.error("Could not destroy current renderer",d)}u=await t.create()}De(()=>{a.config.devmodus||ee(we)});function ce(t){e(l).out&&e(l).out.forEach(d=>{if(t.detail[d.name]&&(console.log(t.detail[d.name]),e(m).redirect&&e(m).redirect[d.name])){const x=e(m).redirect[d.name];C[x]=t.detail[d.name]}})}async function ne(t){for(const d of t)if(d)try{await Promise.race([ye(F),d()])}catch(x){console.error(x)}}function ye(t){return new Promise((d,x)=>{setTimeout(()=>x(new Error("Timeout on")),t)})}var o=lt(),v=te(o);{var w=t=>{it(t,{get contentPane(){return e(j)},get appTheme(){return e(h)}})};Z(v,t=>{e($)&&e(ae)&&e(j)&&t(w)})}var R=y(v,2);{var T=t=>{{let d=Fe(()=>e(s)?"0.5rem 0.5rem 0":0);rt(t,{get gridSettings(){return e(U)},get contentPane(){return e(j)},get appMargin(){return e(d)}})}};Z(R,t=>{e($)&&e(oe)&&t(T)})}var k=y(R,2);let I;var O=b(k);{var B=t=>{var d=ke(),x=te(d);Ve(x,()=>e(S),(_,f)=>{f(_,je(()=>e(m)?.input,()=>C,{$$events:{out:ce}}))}),L(t,d)};Z(O,t=>{a.config.devmodus&&e(S)&&(e(l)?.file??"").indexOf(".svelte")>0&&t(B)})}Y(k,t=>c(j,t),()=>e(j)),W(t=>I=Re(k,1,"svelte-16w9tv2",null,I,t),[()=>({full:e(s)})]),L(E,o),ue()}Be(st,{target:document.body,props:{componentMap:Ke,dasMap:Je,config:Xe}});
|