2020-01-21 15:50:35 +01:00
|
|
|
<script>
|
2020-02-03 10:50:30 +01:00
|
|
|
import PropsView from "./PropsView.svelte"
|
|
|
|
import { store } from "../builderStore"
|
|
|
|
import IconButton from "../common/IconButton.svelte"
|
|
|
|
import {
|
|
|
|
LayoutIcon,
|
|
|
|
PaintIcon,
|
|
|
|
TerminalIcon,
|
|
|
|
CircleIndicator,
|
|
|
|
EventsIcon,
|
|
|
|
} from "../common/Icons/"
|
|
|
|
import CodeEditor from "./CodeEditor.svelte"
|
|
|
|
import LayoutEditor from "./LayoutEditor.svelte"
|
|
|
|
import EventsEditor from "./EventsEditor"
|
|
|
|
|
|
|
|
let current_view = "props"
|
|
|
|
let codeEditor
|
|
|
|
|
|
|
|
$: component = $store.currentComponentInfo
|
|
|
|
$: originalName = component.name
|
|
|
|
$: name = component.name
|
|
|
|
$: description = component.description
|
|
|
|
$: components = $store.components
|
|
|
|
|
|
|
|
const onPropChanged = store.setComponentProp
|
|
|
|
const onStyleChanged = store.setComponentStyle
|
2020-01-21 15:50:35 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
2020-02-03 10:50:30 +01:00
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<button
|
|
|
|
class:selected={current_view === 'props'}
|
|
|
|
on:click={() => (current_view = 'props')}>
|
|
|
|
<PaintIcon />
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button
|
|
|
|
class:selected={current_view === 'layout'}
|
|
|
|
on:click={() => (current_view = 'layout')}>
|
|
|
|
<LayoutIcon />
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button
|
|
|
|
class:selected={current_view === 'code'}
|
|
|
|
on:click={() => codeEditor && codeEditor.show()}>
|
2020-02-10 16:51:09 +01:00
|
|
|
{#if component._code && component._code.trim().length > 0}
|
2020-02-03 10:50:30 +01:00
|
|
|
<div class="button-indicator">
|
|
|
|
<CircleIndicator />
|
|
|
|
</div>
|
2020-01-24 15:30:17 +01:00
|
|
|
{/if}
|
2020-02-03 10:50:30 +01:00
|
|
|
<TerminalIcon />
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button
|
|
|
|
class:selected={current_view === 'events'}
|
|
|
|
on:click={() => (current_view = 'events')}>
|
|
|
|
<EventsIcon />
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2020-02-10 16:51:09 +01:00
|
|
|
{$store.currentFrontEndType}
|
2020-02-03 10:50:30 +01:00
|
|
|
|
2020-02-10 16:51:09 +01:00
|
|
|
<div class="component-props-container">
|
|
|
|
|
|
|
|
{#if current_view === 'props'}
|
|
|
|
<PropsView {component} {components} {onPropChanged} />
|
|
|
|
{:else if current_view === 'layout'}
|
|
|
|
<LayoutEditor {onStyleChanged} {component} />
|
|
|
|
{:else if current_view === 'events'}
|
|
|
|
<EventsEditor {component} {components} {onPropChanged} />
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
<CodeEditor
|
|
|
|
bind:this={codeEditor}
|
|
|
|
code={component._code}
|
|
|
|
onCodeChanged={store.setComponentCode} />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-01-24 15:30:17 +01:00
|
|
|
</div>
|
2020-01-21 15:50:35 +01:00
|
|
|
|
|
|
|
<style>
|
2020-02-03 10:50:30 +01:00
|
|
|
.root {
|
2020-01-21 15:50:35 +01:00
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.title > div:nth-child(1) {
|
2020-01-21 15:50:35 +01:00
|
|
|
grid-column-start: name;
|
|
|
|
color: var(--secondary100);
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.title > div:nth-child(2) {
|
2020-01-21 15:50:35 +01:00
|
|
|
grid-column-start: actions;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.component-props-container {
|
|
|
|
margin-top: 10px;
|
2020-01-21 15:50:35 +01:00
|
|
|
flex: 1 1 auto;
|
|
|
|
overflow-y: auto;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
ul {
|
2020-01-21 15:50:35 +01:00
|
|
|
list-style: none;
|
|
|
|
display: flex;
|
|
|
|
padding: 0;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
li {
|
2020-01-21 15:50:35 +01:00
|
|
|
margin-right: 20px;
|
|
|
|
background: none;
|
|
|
|
border-radius: 5px;
|
2020-01-22 12:30:19 +01:00
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
li button {
|
2020-01-21 15:50:35 +01:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background: none;
|
|
|
|
border: none;
|
|
|
|
border-radius: 5px;
|
|
|
|
padding: 12px;
|
|
|
|
outline: none;
|
|
|
|
cursor: pointer;
|
2020-02-01 00:11:50 +01:00
|
|
|
position: relative;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.selected {
|
2020-01-21 15:50:35 +01:00
|
|
|
color: var(--button-text);
|
2020-02-03 10:50:30 +01:00
|
|
|
background: var(--background-button) !important;
|
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.button-indicator {
|
2020-02-01 00:11:50 +01:00
|
|
|
position: absolute;
|
|
|
|
top: 8px;
|
|
|
|
right: 10px;
|
|
|
|
color: var(--button-text);
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-21 15:50:35 +01:00
|
|
|
</style>
|