-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OOps, DiagramBox and Component need to be added as well.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/core-svelte/src/lib/components/DiagramBoxComponent.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts"> | ||
import RenderComponent from "$lib/components/RenderComponent.svelte"; | ||
import { Box, FreEditor } from "@freon4dsl/core"; | ||
import { Handle, Position, type NodeProps } from '@xyflow/svelte'; | ||
type $$Props = NodeProps; | ||
$$restProps; | ||
export let data: { box: Box, editor: FreEditor }; | ||
const { box, editor } = data; | ||
const onInput = (evt) => { | ||
console.log("Color inout") | ||
} | ||
const onClick = (evt) => { | ||
console.log("Color click") | ||
} | ||
</script> | ||
|
||
<div class="box"> | ||
<Handle type="target" position={Position.Left} /> | ||
<RenderComponent box={box} editor={editor} /> | ||
<Handle type="source" position={Position.Right} /> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
packages/core-svelte/src/lib/components/DiagramColorPicker.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script lang="ts"> | ||
import { Handle, Position, type NodeProps } from '@xyflow/svelte'; | ||
import type { Writable } from 'svelte/store'; | ||
type $$Props = NodeProps; | ||
$$restProps; | ||
export let data: { color: Writable<string> }; | ||
const { color } = data; | ||
const onInput = (evt) => { | ||
console.log("Color inout") | ||
data.color.set(evt.target?.value) | ||
} | ||
const onClick = (evt) => { | ||
console.log("Color click") | ||
} | ||
</script> | ||
|
||
<div class="color-picker" on:click={onClick}> | ||
<Handle type="target" position={Position.Left} /> | ||
<div> | ||
color: <strong>{$color}</strong> | ||
</div> | ||
<input | ||
class="nodrag" | ||
on:input={onInput} | ||
value={$color} | ||
/> | ||
<Handle type="source" position={Position.Right} /> | ||
</div> |