feat: show different ui when inside group
This commit is contained in:
@@ -559,9 +559,9 @@ export class GraphManager extends EventEmitter<{
|
|||||||
label: '',
|
label: '',
|
||||||
value: node.props?.groupId,
|
value: node.props?.groupId,
|
||||||
internal: true,
|
internal: true,
|
||||||
options: this.graph.groups.map((g, i) => ({
|
options: this.graph.groups.map((g) => ({
|
||||||
value: g.id,
|
value: g.id,
|
||||||
label: g.name || `Group ${i + 1}`
|
label: g.name || `Group#${g.id}`
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
...defaultInputs
|
...defaultInputs
|
||||||
@@ -863,7 +863,7 @@ export class GraphManager extends EventEmitter<{
|
|||||||
inputs[`input_${i}`] = input as NodeInput;
|
inputs[`input_${i}`] = input as NodeInput;
|
||||||
});
|
});
|
||||||
|
|
||||||
const outputs = [...groupOutputs.values()].map((edge, i) => ({
|
const outputs = [groupOutputs.values().next().value!].map((edge, i) => ({
|
||||||
label: `Output ${i}`,
|
label: `Output ${i}`,
|
||||||
type: edge[2].state.type?.inputs?.[edge[3]].type || '*'
|
type: edge[2].state.type?.inputs?.[edge[3]].type || '*'
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -154,8 +154,11 @@
|
|||||||
<label for="drop-zone"></label>
|
<label for="drop-zone"></label>
|
||||||
|
|
||||||
{#if graph.isInsideGroup}
|
{#if graph.isInsideGroup}
|
||||||
<button class="exit-group" onclick={() => graphState.exitGroupNode()}>
|
<button
|
||||||
↑ Exit Group
|
class="exit-group flex items-center gap-1 p-1 text-sm px-2 bg-layer-2"
|
||||||
|
onclick={() => graphState.exitGroupNode()}
|
||||||
|
>
|
||||||
|
<span class="i-[tabler--arrow-left]"></span>Exit Group
|
||||||
</button>
|
</button>
|
||||||
<p class="group-name absolute">
|
<p class="group-name absolute">
|
||||||
Group <b>{getGroupName()}</b>
|
Group <b>{getGroupName()}</b>
|
||||||
@@ -283,13 +286,9 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 12px;
|
top: 12px;
|
||||||
left: 12px;
|
left: 12px;
|
||||||
z-index: 1000;
|
z-index: 10;
|
||||||
padding: 4px 12px;
|
|
||||||
background: var(--color-layer-2);
|
|
||||||
border: 1px solid var(--stroke);
|
border: 1px solid var(--stroke);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: inherit;
|
|
||||||
font-size: 0.85em;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,13 @@
|
|||||||
|
|
||||||
.input-boolean > label {
|
.input-boolean > label {
|
||||||
order: 2;
|
order: 2;
|
||||||
|
font-size: 1em;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-size: 0.8em;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.first-level.input {
|
.first-level.input {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { GraphManager } from '$lib/graph-interface/graph-manager.svelte';
|
import type { GraphManager } from '$lib/graph-interface/graph-manager.svelte';
|
||||||
import type { NodeInstance } from '@nodarium/types';
|
import type { NodeInstance } from '@nodarium/types';
|
||||||
|
import InputSelect from '../../../../../packages/ui/src/lib/inputs/InputSelect.svelte';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
manager: GraphManager;
|
manager: GraphManager;
|
||||||
@@ -55,6 +56,22 @@
|
|||||||
value={groupName}
|
value={groupName}
|
||||||
oninput={handleRename}
|
oninput={handleRename}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<label for="group-name">Group Inputs</label>
|
||||||
|
<div>
|
||||||
|
{#each Object.keys(activeGroup?.inputs ?? {}) as key (key)}
|
||||||
|
<div class="flex">
|
||||||
|
<InputSelect
|
||||||
|
value={activeGroup.inputs?.[key].type}
|
||||||
|
options={['seed', 'float', 'boolean']}
|
||||||
|
/>
|
||||||
|
<input type="text" placeholder="Input {key}" />
|
||||||
|
<button>
|
||||||
|
🥊
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/key}
|
{/key}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
graph={pm.graph}
|
graph={pm.graph}
|
||||||
bind:this={graphInterface}
|
bind:this={graphInterface}
|
||||||
registry={nodeRegistry}
|
registry={nodeRegistry}
|
||||||
safePadding={{ right: sidebarOpen ? 320 : undefined }}
|
safePadding={{ right: sidebarOpen ? 321 : undefined }}
|
||||||
backgroundType={appSettings.value.nodeInterface.backgroundType}
|
backgroundType={appSettings.value.nodeInterface.backgroundType}
|
||||||
snapToGrid={appSettings.value.nodeInterface.snapToGrid}
|
snapToGrid={appSettings.value.nodeInterface.snapToGrid}
|
||||||
bind:activeNode
|
bind:activeNode
|
||||||
|
|||||||
Reference in New Issue
Block a user