@arronqzy/vue-blueprint 0.1.13 → 0.1.16
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 +20 -12
- package/package.json +5 -5
- package/src/BlueprintNodeConfigSidebar.vue +3 -0
- package/src/blueprint.css +336 -54
- package/src/components/ApiCollectionManagerDialog.vue +397 -0
- package/src/components/BlueprintCanvas.vue +10 -1
- package/src/components/FetchNodeConfigPanel.vue +335 -3
- package/src/components/JsonLintTextarea.vue +112 -0
- package/src/components/JsonNodeConfigPanel.vue +79 -18
- package/src/components/ScopeTemplateAutocompleteHost.vue +7 -9
- package/src/components/StorageKeyAutocomplete.vue +157 -0
- package/src/components/StorageNodeConfigPanel.vue +13 -10
- package/src/edges/BlueprintSmoothEdge.vue +2 -2
- package/src/graph/blueprint-graph.ts +9 -0
- package/src/graph/document.ts +12 -0
- package/src/graph/sync-edges.ts +2 -2
- package/src/index.ts +27 -0
- package/src/library/api-collection-db.ts +98 -0
- package/src/library/api-collection-store.ts +143 -0
- package/src/nodes/AndFlowNode.vue +3 -2
- package/src/nodes/BlueprintFlowNode.vue +9 -2
- package/src/nodes/BlueprintNodeCard.vue +78 -122
- package/src/nodes/BlueprintNodeShell.vue +1 -0
- package/src/nodes/LifecycleFlowNode.vue +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useI18n } from "@arronqzy/i18n/vue";
|
|
3
|
+
import { computed } from "vue";
|
|
3
4
|
import { cn } from "../utils/cn";
|
|
4
5
|
|
|
5
6
|
const { t } = useI18n();
|
|
@@ -10,7 +11,7 @@ export type BlueprintNodeCardProps = {
|
|
|
10
11
|
meta?: string;
|
|
11
12
|
subtitle?: string;
|
|
12
13
|
progressLabel?: string;
|
|
13
|
-
variant?: "blueprint" | "logic" | "and" | "lifecycle" | "event" | "fetch" | "json" | "storage" | "clock";
|
|
14
|
+
variant?: "blueprint" | "view" | "logic" | "and" | "lifecycle" | "event" | "fetch" | "json" | "storage" | "clock";
|
|
14
15
|
selected?: boolean;
|
|
15
16
|
hideLeadingDot?: boolean;
|
|
16
17
|
};
|
|
@@ -25,146 +26,101 @@ const emit = defineEmits<{
|
|
|
25
26
|
select: [nodeId: string];
|
|
26
27
|
}>();
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
-
blueprint: {
|
|
30
|
-
accent: "border-l-primary",
|
|
31
|
-
badge: "bg-primary/10 text-primary",
|
|
32
|
-
dot: "bg-primary",
|
|
33
|
-
},
|
|
34
|
-
logic: {
|
|
35
|
-
accent: "border-l-sky-500 dark:border-l-sky-400",
|
|
36
|
-
badge: "bg-sky-500/10 text-sky-700 dark:text-sky-300",
|
|
37
|
-
dot: "bg-sky-500",
|
|
38
|
-
},
|
|
39
|
-
and: {
|
|
40
|
-
accent: "border-l-indigo-500 dark:border-l-indigo-400",
|
|
41
|
-
badge: "bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",
|
|
42
|
-
dot: "bg-indigo-500",
|
|
43
|
-
},
|
|
44
|
-
lifecycle: {
|
|
45
|
-
accent: "border-l-amber-500 dark:border-l-amber-400",
|
|
46
|
-
badge: "bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
47
|
-
dot: "bg-amber-500",
|
|
48
|
-
},
|
|
49
|
-
event: {
|
|
50
|
-
accent: "border-l-fuchsia-500 dark:border-l-fuchsia-400",
|
|
51
|
-
badge: "bg-fuchsia-500/10 text-fuchsia-700 dark:text-fuchsia-300",
|
|
52
|
-
dot: "bg-fuchsia-500",
|
|
53
|
-
},
|
|
54
|
-
fetch: {
|
|
55
|
-
accent: "border-l-violet-500 dark:border-l-violet-400",
|
|
56
|
-
badge: "bg-violet-500/10 text-violet-700 dark:text-violet-300",
|
|
57
|
-
dot: "bg-violet-500",
|
|
58
|
-
},
|
|
59
|
-
json: {
|
|
60
|
-
accent: "border-l-teal-500 dark:border-l-teal-400",
|
|
61
|
-
badge: "bg-teal-500/10 text-teal-700 dark:text-teal-300",
|
|
62
|
-
dot: "bg-teal-500",
|
|
63
|
-
},
|
|
64
|
-
storage: {
|
|
65
|
-
accent: "border-l-emerald-500 dark:border-l-emerald-400",
|
|
66
|
-
badge: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
67
|
-
dot: "bg-emerald-500",
|
|
68
|
-
},
|
|
69
|
-
clock: {
|
|
70
|
-
accent: "border-l-rose-500 dark:border-l-rose-400",
|
|
71
|
-
badge: "bg-rose-500/10 text-rose-700 dark:text-rose-300",
|
|
72
|
-
dot: "bg-rose-500",
|
|
73
|
-
},
|
|
74
|
-
} as const;
|
|
75
|
-
|
|
76
|
-
const v = variantStyle[props.variant];
|
|
29
|
+
const showMeta = computed(() => Boolean(props.meta && props.meta !== props.label));
|
|
77
30
|
</script>
|
|
78
31
|
|
|
79
32
|
<template>
|
|
80
33
|
<div
|
|
81
34
|
data-blueprint-node-card
|
|
82
|
-
:class="
|
|
83
|
-
|
|
84
|
-
'bp-node-card w-[168px] overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-sm',
|
|
85
|
-
'transition-[box-shadow,border-color] duration-150',
|
|
86
|
-
hideLeadingDot
|
|
87
|
-
? cn(
|
|
88
|
-
'border-t-[3px]',
|
|
89
|
-
variant === 'event'
|
|
90
|
-
? 'border-t-fuchsia-500 dark:border-t-fuchsia-400'
|
|
91
|
-
: 'border-t-amber-500 dark:border-t-amber-400'
|
|
92
|
-
)
|
|
93
|
-
: cn('border-l-[3px]', v.accent),
|
|
94
|
-
selected &&
|
|
95
|
-
'border-primary/50 shadow-[0_0_0_1px_hsl(var(--primary)/0.35),0_4px_12px_hsl(var(--primary)/0.12)]'
|
|
96
|
-
)
|
|
97
|
-
"
|
|
35
|
+
:class="cn('bp-node-card bp-flow-drag-handle', selected && 'bp-node-card--selected')"
|
|
36
|
+
:title="t('blueprint.node.dragToMove')"
|
|
98
37
|
>
|
|
99
|
-
<div
|
|
100
|
-
class="bp-flow-drag-handle flex cursor-grab items-center gap-2 border-b border-border/50 px-2 py-1.5 bg-muted/25 text-muted-foreground active:cursor-grabbing"
|
|
101
|
-
:title="t('blueprint.node.dragToMove')"
|
|
102
|
-
>
|
|
103
|
-
<div class="flex shrink-0 flex-col gap-[3px] opacity-35" aria-hidden="true">
|
|
104
|
-
<span class="flex gap-[3px]">
|
|
105
|
-
<span class="h-[3px] w-[3px] rounded-full bg-current" />
|
|
106
|
-
<span class="h-[3px] w-[3px] rounded-full bg-current" />
|
|
107
|
-
</span>
|
|
108
|
-
<span class="flex gap-[3px]">
|
|
109
|
-
<span class="h-[3px] w-[3px] rounded-full bg-current" />
|
|
110
|
-
<span class="h-[3px] w-[3px] rounded-full bg-current" />
|
|
111
|
-
</span>
|
|
112
|
-
</div>
|
|
113
|
-
<span
|
|
114
|
-
v-if="meta"
|
|
115
|
-
:class="
|
|
116
|
-
cn(
|
|
117
|
-
'min-w-0 flex-1 truncate rounded px-1.5 py-0.5 text-[10px] font-medium leading-none tracking-wide',
|
|
118
|
-
v.badge
|
|
119
|
-
)
|
|
120
|
-
"
|
|
121
|
-
:title="meta"
|
|
122
|
-
>
|
|
123
|
-
{{ meta }}
|
|
124
|
-
</span>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
38
|
<button
|
|
128
39
|
type="button"
|
|
129
|
-
|
|
130
|
-
cn(
|
|
131
|
-
'nodrag flex w-full text-left outline-none transition-colors hover:bg-accent/30',
|
|
132
|
-
'focus-visible:ring-1 focus-visible:ring-primary focus-visible:ring-inset',
|
|
133
|
-
hideLeadingDot
|
|
134
|
-
? cn('px-2.5 py-2', subtitle ? 'items-start' : 'items-center')
|
|
135
|
-
: 'items-start gap-2 px-2.5 py-2'
|
|
136
|
-
)
|
|
137
|
-
"
|
|
40
|
+
class="bp-node-card__body"
|
|
138
41
|
@click.stop="emit('select', nodeId)"
|
|
139
42
|
>
|
|
140
43
|
<span
|
|
141
|
-
|
|
142
|
-
:class="cn('mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full', v.dot)"
|
|
44
|
+
:class="cn('bp-node-icon', `bp-node-icon--${variant}`)"
|
|
143
45
|
aria-hidden="true"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
46
|
+
>
|
|
47
|
+
<svg
|
|
48
|
+
viewBox="0 0 24 24"
|
|
49
|
+
fill="none"
|
|
50
|
+
stroke="currentColor"
|
|
51
|
+
stroke-width="2"
|
|
52
|
+
stroke-linecap="round"
|
|
53
|
+
stroke-linejoin="round"
|
|
54
|
+
>
|
|
55
|
+
<template v-if="variant === 'logic'">
|
|
56
|
+
<path d="M6 4v6a4 4 0 0 0 4 4h4" />
|
|
57
|
+
<path d="M14 14v6" />
|
|
58
|
+
<circle cx="6" cy="4" r="1.5" fill="currentColor" stroke="none" />
|
|
59
|
+
<circle cx="14" cy="20" r="1.5" fill="currentColor" stroke="none" />
|
|
60
|
+
<circle cx="18" cy="14" r="1.5" fill="currentColor" stroke="none" />
|
|
61
|
+
</template>
|
|
62
|
+
<template v-else-if="variant === 'and'">
|
|
63
|
+
<path d="M8 6v12" />
|
|
64
|
+
<path d="M8 12h8" />
|
|
65
|
+
<path d="M16 6v12" />
|
|
66
|
+
</template>
|
|
67
|
+
<template v-else-if="variant === 'lifecycle'">
|
|
68
|
+
<circle cx="12" cy="12" r="7" />
|
|
69
|
+
<path d="M12 8v4l2.5 1.5" />
|
|
70
|
+
</template>
|
|
71
|
+
<template v-else-if="variant === 'event'">
|
|
72
|
+
<path d="M13 2 4 14h7l-1 8 9-12h-7l1-8z" />
|
|
73
|
+
</template>
|
|
74
|
+
<template v-else-if="variant === 'fetch'">
|
|
75
|
+
<path d="M12 3v12" />
|
|
76
|
+
<path d="m7 10 5 5 5-5" />
|
|
77
|
+
<path d="M5 19h14" />
|
|
78
|
+
</template>
|
|
79
|
+
<template v-else-if="variant === 'json'">
|
|
80
|
+
<path d="M8 4c-2 0-3 1.5-3 4s1 4 3 4" />
|
|
81
|
+
<path d="M8 12c-2 0-3 1.5-3 4s1 4 3 4" />
|
|
82
|
+
<path d="M16 4c2 0 3 1.5 3 4s-1 4-3 4" />
|
|
83
|
+
<path d="M16 12c2 0 3 1.5 3 4s-1 4-3 4" />
|
|
84
|
+
</template>
|
|
85
|
+
<template v-else-if="variant === 'storage'">
|
|
86
|
+
<ellipse cx="12" cy="6" rx="7" ry="3" />
|
|
87
|
+
<path d="M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6" />
|
|
88
|
+
<path d="M5 12v6c0 1.7 3.1 3 7 3s7-1.3 7-3v-6" />
|
|
89
|
+
</template>
|
|
90
|
+
<template v-else-if="variant === 'clock'">
|
|
91
|
+
<circle cx="12" cy="12" r="8" />
|
|
92
|
+
<path d="M12 8v4.5L15 15" />
|
|
93
|
+
</template>
|
|
94
|
+
<template v-else-if="variant === 'view'">
|
|
95
|
+
<rect x="3" y="5" width="18" height="14" rx="2" />
|
|
96
|
+
<path d="M3 9h18" />
|
|
97
|
+
<path d="M8 14h4" />
|
|
98
|
+
</template>
|
|
99
|
+
<template v-else>
|
|
100
|
+
<circle cx="7" cy="7" r="2.5" />
|
|
101
|
+
<circle cx="17" cy="7" r="2.5" />
|
|
102
|
+
<circle cx="12" cy="17" r="2.5" />
|
|
103
|
+
<path d="M9.2 8.2 14.8 8.2" />
|
|
104
|
+
<path d="M8.2 9.2 11 14.8" />
|
|
105
|
+
<path d="M15.8 9.2 13 14.8" />
|
|
106
|
+
</template>
|
|
107
|
+
</svg>
|
|
108
|
+
</span>
|
|
109
|
+
<div class="bp-node-card__content">
|
|
110
|
+
<div class="bp-node-card__title-row">
|
|
111
|
+
<div class="bp-node-card__title">{{ label }}</div>
|
|
150
112
|
<span
|
|
151
113
|
v-if="progressLabel"
|
|
152
|
-
:class="
|
|
153
|
-
cn(
|
|
154
|
-
'shrink-0 rounded px-1.5 py-0.5 text-[10px] font-semibold leading-none',
|
|
155
|
-
v.badge
|
|
156
|
-
)
|
|
157
|
-
"
|
|
114
|
+
:class="cn('bp-node-card__badge', `bp-node-card__badge--${variant}`)"
|
|
158
115
|
:title="t('blueprint.node.signalSentCount')"
|
|
159
116
|
>
|
|
160
117
|
{{ progressLabel }}
|
|
161
118
|
</span>
|
|
162
119
|
</div>
|
|
163
|
-
<div
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
>
|
|
120
|
+
<div v-if="showMeta" class="bp-node-card__meta" :title="meta">
|
|
121
|
+
{{ meta }}
|
|
122
|
+
</div>
|
|
123
|
+
<div v-if="subtitle" class="bp-node-card__subtitle" :title="subtitle">
|
|
168
124
|
{{ subtitle }}
|
|
169
125
|
</div>
|
|
170
126
|
</div>
|
|
@@ -22,6 +22,7 @@ const executionTone = resolveBlueprintNodeExecutionTone(nodeData);
|
|
|
22
22
|
:class="
|
|
23
23
|
cn(
|
|
24
24
|
'bp-node bp-node--lifecycle',
|
|
25
|
+
nodeData.isSelected && 'bp-node--selected',
|
|
25
26
|
executionTone === 'success' && 'bp-node--execution-true',
|
|
26
27
|
executionTone === 'error' && 'bp-node--execution-false'
|
|
27
28
|
)
|