@stonecrop/node-editor 0.2.33 → 0.2.34
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/dist/node-editor.js +1651 -1653
- package/dist/node-editor.js.map +1 -1
- package/dist/node-editor.umd.cjs +2 -2
- package/dist/node-editor.umd.cjs.map +1 -1
- package/dist/node_editor/src/tsdoc-metadata.json +1 -1
- package/package.json +5 -5
- package/src/components/EditableEdge.vue +4 -4
- package/src/components/EditableNode.vue +6 -6
- package/src/components/NodeEditor.vue +2 -2
- package/src/components/StateEditor.vue +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/node-editor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Node editor UI for Stonecrop",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,21 +33,21 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@vue-flow/core": "^1.37.1",
|
|
36
|
-
"vue": "^3.
|
|
36
|
+
"vue": "^3.5.6",
|
|
37
37
|
"vue-router": "^4.4.0",
|
|
38
38
|
"xstate": "^4.38.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@microsoft/api-documenter": "^7.25.3",
|
|
42
|
-
"@rushstack/heft": "^0.
|
|
42
|
+
"@rushstack/heft": "^0.67.2",
|
|
43
43
|
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
44
44
|
"@typescript-eslint/parser": "^7.14.1",
|
|
45
|
-
"@vitejs/plugin-vue": "^5.
|
|
45
|
+
"@vitejs/plugin-vue": "^5.1.3",
|
|
46
46
|
"eslint": "^8.40.0",
|
|
47
47
|
"eslint-config-prettier": "^8.8.0",
|
|
48
48
|
"eslint-plugin-vue": "^9.11.1",
|
|
49
49
|
"typescript": "^5.5.2",
|
|
50
|
-
"vite": "^5.
|
|
50
|
+
"vite": "^5.4.5",
|
|
51
51
|
"stonecrop-rig": "0.2.22"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}"
|
|
11
11
|
class="nodrag nopan editable-edge-label"
|
|
12
12
|
@click="labelOnClick()">
|
|
13
|
-
<div class="vue-flow__edge-label">{{
|
|
13
|
+
<div class="vue-flow__edge-label">{{ label }}</div>
|
|
14
14
|
<div v-if="showInput" class="label-input-wrapper">
|
|
15
15
|
<input
|
|
16
16
|
ref="labelInput"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
27
|
import { type EdgeProps, EdgeLabelRenderer, getBezierPath /* useVueFlow */ } from '@vue-flow/core'
|
|
28
|
-
import { computed, ref, nextTick } from 'vue'
|
|
28
|
+
import { computed, ref, nextTick, useTemplateRef } from 'vue'
|
|
29
29
|
|
|
30
30
|
const props = defineProps<EdgeProps>()
|
|
31
31
|
const emit = defineEmits(['change'])
|
|
@@ -33,7 +33,7 @@ const emit = defineEmits(['change'])
|
|
|
33
33
|
// TODO: Implement edge removal
|
|
34
34
|
// const { removeEdges } = useVueFlow()
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const inputRef = useTemplateRef<HTMLInputElement>('labelInput')
|
|
37
37
|
const newLabel = ref<EdgeProps['label']>('')
|
|
38
38
|
const showInput = ref(false)
|
|
39
39
|
let lastClick = 0
|
|
@@ -50,7 +50,7 @@ const showLabelInput = async () => {
|
|
|
50
50
|
newLabel.value = props.label
|
|
51
51
|
showInput.value = true
|
|
52
52
|
await nextTick()
|
|
53
|
-
|
|
53
|
+
inputRef.value.focus()
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const submitNewLabel = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div @click="nodeOnClick()">
|
|
3
|
-
<div>{{
|
|
3
|
+
<div>{{ label }}</div>
|
|
4
4
|
<div v-if="showInput" class="label-input-wrapper">
|
|
5
5
|
<input
|
|
6
6
|
ref="labelInput"
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
@blur="showInput = false"
|
|
10
10
|
@keypress.enter="submitNewLabel" />
|
|
11
11
|
</div>
|
|
12
|
-
<Handle v-if="
|
|
13
|
-
<Handle v-if="
|
|
12
|
+
<Handle v-if="data.hasInput" id="a" type="target" :position="targetPosition" />
|
|
13
|
+
<Handle v-if="data.hasOutput" id="b" type="source" :position="sourcePosition" />
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script setup lang="ts">
|
|
18
18
|
import { NodeProps, Handle } from '@vue-flow/core'
|
|
19
|
-
import { ref, nextTick } from 'vue'
|
|
19
|
+
import { ref, nextTick, useTemplateRef } from 'vue'
|
|
20
20
|
|
|
21
21
|
const props = defineProps<NodeProps>()
|
|
22
22
|
const emit = defineEmits(['change'])
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const inputRef = useTemplateRef<HTMLInputElement>('labelInput')
|
|
25
25
|
const newLabel = ref<NodeProps['label']>('')
|
|
26
26
|
const showInput = ref(false)
|
|
27
27
|
let lastClick = 0
|
|
@@ -38,7 +38,7 @@ const showLabelInput = async () => {
|
|
|
38
38
|
newLabel.value = props.label
|
|
39
39
|
showInput.value = true
|
|
40
40
|
await nextTick()
|
|
41
|
-
|
|
41
|
+
inputRef.value.focus()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const submitNewLabel = () => {
|
|
@@ -46,7 +46,7 @@ import EditableEdge from '@/components/EditableEdge.vue'
|
|
|
46
46
|
import EditableNode from '@/components/EditableNode.vue'
|
|
47
47
|
import type { FlowElements } from '@/types'
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const { modelValue, nodeContainerClass } = defineProps<{
|
|
50
50
|
modelValue: FlowElements
|
|
51
51
|
nodeContainerClass?: HTMLAttributes['class']
|
|
52
52
|
}>()
|
|
@@ -69,7 +69,7 @@ const activeElementIndex = computed(() => {
|
|
|
69
69
|
|
|
70
70
|
const elements = computed({
|
|
71
71
|
get: () => {
|
|
72
|
-
const _elements =
|
|
72
|
+
const _elements = modelValue
|
|
73
73
|
|
|
74
74
|
// Add data to each element
|
|
75
75
|
for (const _element of _elements) {
|
|
@@ -11,12 +11,12 @@ import { type HTMLAttributes, computed } from 'vue'
|
|
|
11
11
|
import NodeEditor from '@/components/NodeEditor.vue'
|
|
12
12
|
import type { EditorStates, FlowElement, FlowElements, Layout } from '@/types'
|
|
13
13
|
|
|
14
|
+
const emit = defineEmits(['update:modelValue'])
|
|
14
15
|
const states = defineModel<EditorStates>()
|
|
15
|
-
const
|
|
16
|
+
const { layout, nodeContainerClass } = defineProps<{
|
|
16
17
|
layout: Layout
|
|
17
18
|
nodeContainerClass?: HTMLAttributes['class']
|
|
18
19
|
}>()
|
|
19
|
-
const emit = defineEmits(['update:modelValue'])
|
|
20
20
|
|
|
21
21
|
const elements = computed<FlowElements>({
|
|
22
22
|
get: () => {
|
|
@@ -29,9 +29,9 @@ const elements = computed<FlowElements>({
|
|
|
29
29
|
const el: Node = {
|
|
30
30
|
id: key,
|
|
31
31
|
label: key,
|
|
32
|
-
position:
|
|
33
|
-
targetPosition:
|
|
34
|
-
sourcePosition:
|
|
32
|
+
position: layout[key]?.position || { x: 200 * index, y: 100 },
|
|
33
|
+
targetPosition: layout[key]?.targetPosition || Position.Left,
|
|
34
|
+
sourcePosition: layout[key]?.sourcePosition || Position.Right,
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (value.type === 'final') {
|
|
@@ -82,7 +82,7 @@ const elements = computed<FlowElements>({
|
|
|
82
82
|
// update modelValue when elements change
|
|
83
83
|
onElementsChange(newValue)
|
|
84
84
|
|
|
85
|
-
// TODO: emit('update:modelValue',
|
|
85
|
+
// TODO: emit('update:modelValue', modelValue)
|
|
86
86
|
},
|
|
87
87
|
})
|
|
88
88
|
|