@teamflojo/floimg-studio-ui 0.1.6 → 0.1.7
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/api/client.d.ts +1 -0
- package/dist/index.js +112 -111
- package/dist/index.js.map +1 -1
- package/dist/stores/workflowStore.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as c, jsx as e, Fragment as
|
|
2
|
-
import { memo as
|
|
3
|
-
import ke, { Handle as
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { memo as P, useRef as xe, useCallback as C, useState as N, useEffect as M, useMemo as ee } from "react";
|
|
3
|
+
import ke, { Handle as W, Position as A, applyNodeChanges as we, applyEdgeChanges as ve, MarkerType as ye, Background as Ne, Controls as ze, MiniMap as Ce, ReactFlowProvider as Se } from "reactflow";
|
|
4
4
|
import { create as se } from "zustand";
|
|
5
|
-
import { useQuery as
|
|
5
|
+
import { useQuery as K } from "@tanstack/react-query";
|
|
6
6
|
function Ie(r, i) {
|
|
7
7
|
let t;
|
|
8
8
|
try {
|
|
@@ -20,12 +20,12 @@ function Ie(r, i) {
|
|
|
20
20
|
removeItem: (s) => t.removeItem(s)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const _ = (r) => (i) => {
|
|
24
24
|
try {
|
|
25
25
|
const t = r(i);
|
|
26
26
|
return t instanceof Promise ? t : {
|
|
27
27
|
then(a) {
|
|
28
|
-
return
|
|
28
|
+
return _(a)(t);
|
|
29
29
|
},
|
|
30
30
|
catch(a) {
|
|
31
31
|
return this;
|
|
@@ -37,7 +37,7 @@ const H = (r) => (i) => {
|
|
|
37
37
|
return this;
|
|
38
38
|
},
|
|
39
39
|
catch(a) {
|
|
40
|
-
return
|
|
40
|
+
return _(a)(t);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -87,7 +87,7 @@ const H = (r) => (i) => {
|
|
|
87
87
|
return h((z = a()) != null ? z : f);
|
|
88
88
|
});
|
|
89
89
|
const w = ((v = d.onRehydrateStorage) == null ? void 0 : v.call(d, (g = a()) != null ? g : f)) || void 0;
|
|
90
|
-
return
|
|
90
|
+
return _(u.getItem.bind(u))(d.name).then((h) => {
|
|
91
91
|
if (h)
|
|
92
92
|
if (typeof h.version == "number" && h.version !== d.version) {
|
|
93
93
|
if (d.migrate) {
|
|
@@ -138,7 +138,7 @@ const H = (r) => (i) => {
|
|
|
138
138
|
})
|
|
139
139
|
}, d.skipHydration || k(), b || f;
|
|
140
140
|
}, ie = Le, I = "/api";
|
|
141
|
-
async function
|
|
141
|
+
async function D(r, i) {
|
|
142
142
|
const t = await fetch(r, {
|
|
143
143
|
...i,
|
|
144
144
|
headers: {
|
|
@@ -153,37 +153,37 @@ async function A(r, i) {
|
|
|
153
153
|
return t.json();
|
|
154
154
|
}
|
|
155
155
|
async function We() {
|
|
156
|
-
return
|
|
156
|
+
return D(`${I}/nodes/generators`);
|
|
157
157
|
}
|
|
158
158
|
async function Ae() {
|
|
159
|
-
return
|
|
159
|
+
return D(`${I}/nodes/transforms`);
|
|
160
160
|
}
|
|
161
161
|
async function De(r, i, t) {
|
|
162
|
-
return
|
|
162
|
+
return D(`${I}/execute/sync`, {
|
|
163
163
|
method: "POST",
|
|
164
164
|
body: JSON.stringify({ nodes: r, edges: i, aiProviders: t })
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
async function $e(r, i) {
|
|
168
|
-
return
|
|
168
|
+
return D(`${I}/export/yaml`, {
|
|
169
169
|
method: "POST",
|
|
170
170
|
body: JSON.stringify({ nodes: r, edges: i })
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
async function Me() {
|
|
174
|
-
return
|
|
174
|
+
return D(`${I}/images`);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function te(r) {
|
|
177
177
|
return `${I}/images/${r}/blob`;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function Ue(r) {
|
|
180
180
|
try {
|
|
181
|
-
return await
|
|
181
|
+
return await D(`${I}/images/${r}/workflow`);
|
|
182
182
|
} catch {
|
|
183
183
|
return null;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
async function
|
|
186
|
+
async function je(r) {
|
|
187
187
|
const i = new FormData();
|
|
188
188
|
i.append("file", r);
|
|
189
189
|
const t = await fetch(`${I}/uploads`, {
|
|
@@ -196,10 +196,10 @@ async function Pe(r) {
|
|
|
196
196
|
}
|
|
197
197
|
return t.json();
|
|
198
198
|
}
|
|
199
|
-
async function
|
|
200
|
-
return
|
|
199
|
+
async function Pe() {
|
|
200
|
+
return D(`${I}/uploads`);
|
|
201
201
|
}
|
|
202
|
-
async function
|
|
202
|
+
async function Te(r) {
|
|
203
203
|
const i = await fetch(`${I}/uploads/${r}`, {
|
|
204
204
|
method: "DELETE"
|
|
205
205
|
});
|
|
@@ -210,13 +210,13 @@ function de(r) {
|
|
|
210
210
|
return `${I}/uploads/${r}/blob`;
|
|
211
211
|
}
|
|
212
212
|
async function Ee(r) {
|
|
213
|
-
return
|
|
213
|
+
return D(`${I}/import`, {
|
|
214
214
|
method: "POST",
|
|
215
215
|
body: JSON.stringify({ yaml: r })
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
async function Oe(r) {
|
|
219
|
-
return
|
|
219
|
+
return D(`${I}/import/validate`, {
|
|
220
220
|
method: "POST",
|
|
221
221
|
body: JSON.stringify({ yaml: r })
|
|
222
222
|
});
|
|
@@ -265,7 +265,7 @@ const re = "http://localhost:11434", ae = "http://localhost:1234", $ = se()(
|
|
|
265
265
|
)
|
|
266
266
|
);
|
|
267
267
|
let Be = 0;
|
|
268
|
-
function
|
|
268
|
+
function q() {
|
|
269
269
|
return `node_${++Be}`;
|
|
270
270
|
}
|
|
271
271
|
function oe() {
|
|
@@ -291,13 +291,14 @@ const x = se()(
|
|
|
291
291
|
execution: {
|
|
292
292
|
status: "idle",
|
|
293
293
|
imageIds: [],
|
|
294
|
+
imageUrls: [],
|
|
294
295
|
previews: {},
|
|
295
296
|
dataOutputs: {},
|
|
296
297
|
nodeStatus: {}
|
|
297
298
|
},
|
|
298
299
|
loadTemplate: (t) => {
|
|
299
300
|
const a = /* @__PURE__ */ new Map(), s = t.workflow.nodes.map((m) => {
|
|
300
|
-
const o =
|
|
301
|
+
const o = q();
|
|
301
302
|
return a.set(m.id, o), {
|
|
302
303
|
id: o,
|
|
303
304
|
type: m.type,
|
|
@@ -321,6 +322,7 @@ const x = se()(
|
|
|
321
322
|
execution: {
|
|
322
323
|
status: "idle",
|
|
323
324
|
imageIds: [],
|
|
325
|
+
imageUrls: [],
|
|
324
326
|
previews: {},
|
|
325
327
|
dataOutputs: {},
|
|
326
328
|
nodeStatus: {}
|
|
@@ -337,6 +339,7 @@ const x = se()(
|
|
|
337
339
|
execution: {
|
|
338
340
|
status: "idle",
|
|
339
341
|
imageIds: [],
|
|
342
|
+
imageUrls: [],
|
|
340
343
|
previews: {},
|
|
341
344
|
dataOutputs: {},
|
|
342
345
|
nodeStatus: {}
|
|
@@ -356,7 +359,7 @@ const x = se()(
|
|
|
356
359
|
setTransforms: (t) => r({ transforms: t }),
|
|
357
360
|
addNode: (t, a) => {
|
|
358
361
|
var o, n, u;
|
|
359
|
-
const s =
|
|
362
|
+
const s = q();
|
|
360
363
|
let d;
|
|
361
364
|
if (t.type === "generator")
|
|
362
365
|
d = {
|
|
@@ -451,6 +454,7 @@ const x = se()(
|
|
|
451
454
|
execution: {
|
|
452
455
|
status: "running",
|
|
453
456
|
imageIds: [],
|
|
457
|
+
imageUrls: [],
|
|
454
458
|
previews: {},
|
|
455
459
|
dataOutputs: {},
|
|
456
460
|
nodeStatus: o
|
|
@@ -464,6 +468,7 @@ const x = se()(
|
|
|
464
468
|
execution: {
|
|
465
469
|
status: "completed",
|
|
466
470
|
imageIds: n.imageIds,
|
|
471
|
+
imageUrls: n.imageUrls || [],
|
|
467
472
|
previews: n.previews || {},
|
|
468
473
|
dataOutputs: n.dataOutputs || {},
|
|
469
474
|
nodeStatus: u
|
|
@@ -472,6 +477,7 @@ const x = se()(
|
|
|
472
477
|
execution: {
|
|
473
478
|
status: "error",
|
|
474
479
|
imageIds: [],
|
|
480
|
+
imageUrls: [],
|
|
475
481
|
previews: {},
|
|
476
482
|
dataOutputs: {},
|
|
477
483
|
nodeStatus: u,
|
|
@@ -486,6 +492,7 @@ const x = se()(
|
|
|
486
492
|
execution: {
|
|
487
493
|
status: "error",
|
|
488
494
|
imageIds: [],
|
|
495
|
+
imageUrls: [],
|
|
489
496
|
previews: {},
|
|
490
497
|
dataOutputs: {},
|
|
491
498
|
nodeStatus: u,
|
|
@@ -509,7 +516,7 @@ const x = se()(
|
|
|
509
516
|
},
|
|
510
517
|
importFromYaml: (t, a, s) => {
|
|
511
518
|
const d = /* @__PURE__ */ new Map(), m = t.map((n) => {
|
|
512
|
-
const u =
|
|
519
|
+
const u = q();
|
|
513
520
|
return d.set(n.id, u), {
|
|
514
521
|
id: u,
|
|
515
522
|
type: n.type,
|
|
@@ -536,6 +543,7 @@ const x = se()(
|
|
|
536
543
|
execution: {
|
|
537
544
|
status: "idle",
|
|
538
545
|
imageIds: [],
|
|
546
|
+
imageUrls: [],
|
|
539
547
|
previews: {},
|
|
540
548
|
dataOutputs: {},
|
|
541
549
|
nodeStatus: {}
|
|
@@ -559,6 +567,7 @@ const x = se()(
|
|
|
559
567
|
execution: {
|
|
560
568
|
status: "idle",
|
|
561
569
|
imageIds: [],
|
|
570
|
+
imageUrls: [],
|
|
562
571
|
previews: {},
|
|
563
572
|
dataOutputs: {},
|
|
564
573
|
nodeStatus: {}
|
|
@@ -615,6 +624,7 @@ const x = se()(
|
|
|
615
624
|
execution: {
|
|
616
625
|
status: "idle",
|
|
617
626
|
imageIds: [],
|
|
627
|
+
imageUrls: [],
|
|
618
628
|
previews: {},
|
|
619
629
|
dataOutputs: {},
|
|
620
630
|
nodeStatus: {}
|
|
@@ -636,6 +646,7 @@ const x = se()(
|
|
|
636
646
|
execution: {
|
|
637
647
|
status: "idle",
|
|
638
648
|
imageIds: [],
|
|
649
|
+
imageUrls: [],
|
|
639
650
|
previews: {},
|
|
640
651
|
dataOutputs: {},
|
|
641
652
|
nodeStatus: {}
|
|
@@ -681,10 +692,10 @@ function R(r) {
|
|
|
681
692
|
s.default !== void 0 && (i[a] = s.default);
|
|
682
693
|
return i;
|
|
683
694
|
}
|
|
684
|
-
function
|
|
695
|
+
function T(r) {
|
|
685
696
|
return r === "running" ? "border-yellow-400 animate-pulse" : r === "completed" ? "border-green-500" : r === "error" ? "border-red-500" : "";
|
|
686
697
|
}
|
|
687
|
-
function
|
|
698
|
+
function H({ nodeId: r, color: i }) {
|
|
688
699
|
const t = x((s) => s.previewVisible[r] !== !1), a = x((s) => s.togglePreview);
|
|
689
700
|
return /* @__PURE__ */ e(
|
|
690
701
|
"button",
|
|
@@ -714,12 +725,12 @@ function Q({ nodeId: r, color: i }) {
|
|
|
714
725
|
}
|
|
715
726
|
);
|
|
716
727
|
}
|
|
717
|
-
const Re =
|
|
728
|
+
const Re = P(function({
|
|
718
729
|
id: i,
|
|
719
730
|
data: t,
|
|
720
731
|
selected: a
|
|
721
732
|
}) {
|
|
722
|
-
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n =
|
|
733
|
+
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = T(d) || (a ? "border-blue-500" : "border-blue-200");
|
|
723
734
|
return /* @__PURE__ */ c(
|
|
724
735
|
"div",
|
|
725
736
|
{
|
|
@@ -730,7 +741,7 @@ const Re = T(function({
|
|
|
730
741
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
731
742
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-blue-500" }),
|
|
732
743
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-blue-700 dark:text-blue-400", children: t.generatorName }),
|
|
733
|
-
/* @__PURE__ */ e(
|
|
744
|
+
/* @__PURE__ */ e(H, { nodeId: i, color: "text-blue-500 dark:text-blue-400" })
|
|
734
745
|
] }),
|
|
735
746
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
736
747
|
u,
|
|
@@ -738,28 +749,28 @@ const Re = T(function({
|
|
|
738
749
|
String(l).slice(0, 20)
|
|
739
750
|
] }, u)) })
|
|
740
751
|
] }),
|
|
741
|
-
/* @__PURE__ */ e(
|
|
752
|
+
/* @__PURE__ */ e(W, { type: "source", position: A.Right, className: "w-3 h-3 !bg-blue-500" })
|
|
742
753
|
]
|
|
743
754
|
}
|
|
744
755
|
);
|
|
745
|
-
}), Fe =
|
|
756
|
+
}), Fe = P(function({
|
|
746
757
|
id: i,
|
|
747
758
|
data: t,
|
|
748
759
|
selected: a
|
|
749
760
|
}) {
|
|
750
|
-
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n =
|
|
761
|
+
const s = x((u) => u.execution.previews[i]), d = x((u) => u.execution.nodeStatus[i]), m = x((u) => u.previewVisible[i] !== !1), n = T(d) || (a ? "border-teal-500" : "border-teal-200");
|
|
751
762
|
return /* @__PURE__ */ c(
|
|
752
763
|
"div",
|
|
753
764
|
{
|
|
754
765
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${n}`,
|
|
755
766
|
children: [
|
|
756
|
-
/* @__PURE__ */ e(
|
|
767
|
+
/* @__PURE__ */ e(W, { type: "target", position: A.Left, className: "w-3 h-3 !bg-teal-500" }),
|
|
757
768
|
s && m && /* @__PURE__ */ e("div", { className: "bg-gray-100 dark:bg-zinc-900 border-b border-gray-200 dark:border-zinc-700", children: /* @__PURE__ */ e("img", { src: s, alt: "Preview", className: "w-full h-24 object-contain" }) }),
|
|
758
769
|
/* @__PURE__ */ c("div", { className: "px-4 py-3", children: [
|
|
759
770
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
760
771
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-teal-500" }),
|
|
761
772
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-teal-700 dark:text-teal-400", children: t.operation }),
|
|
762
|
-
/* @__PURE__ */ e(
|
|
773
|
+
/* @__PURE__ */ e(H, { nodeId: i, color: "text-teal-500 dark:text-teal-400" })
|
|
763
774
|
] }),
|
|
764
775
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400", children: Object.entries(t.params).filter(([, u]) => typeof u != "object" || u === null).slice(0, 2).map(([u, l]) => /* @__PURE__ */ c("div", { className: "truncate", children: [
|
|
765
776
|
u,
|
|
@@ -767,18 +778,18 @@ const Re = T(function({
|
|
|
767
778
|
String(l).slice(0, 20)
|
|
768
779
|
] }, u)) })
|
|
769
780
|
] }),
|
|
770
|
-
/* @__PURE__ */ e(
|
|
781
|
+
/* @__PURE__ */ e(W, { type: "source", position: A.Right, className: "w-3 h-3 !bg-teal-500" })
|
|
771
782
|
]
|
|
772
783
|
}
|
|
773
784
|
);
|
|
774
|
-
}), Ve =
|
|
775
|
-
const s = x((o) => o.execution.nodeStatus[i]), m =
|
|
785
|
+
}), Ve = P(function({ id: i, data: t, selected: a }) {
|
|
786
|
+
const s = x((o) => o.execution.nodeStatus[i]), m = T(s) || (a ? "border-green-500" : "border-green-200");
|
|
776
787
|
return /* @__PURE__ */ c(
|
|
777
788
|
"div",
|
|
778
789
|
{
|
|
779
790
|
className: `px-4 py-3 rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] ${m}`,
|
|
780
791
|
children: [
|
|
781
|
-
/* @__PURE__ */ e(
|
|
792
|
+
/* @__PURE__ */ e(W, { type: "target", position: A.Left, className: "w-3 h-3 !bg-green-500" }),
|
|
782
793
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
783
794
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-green-500" }),
|
|
784
795
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-green-700 dark:text-green-400", children: "Save" })
|
|
@@ -787,11 +798,11 @@ const Re = T(function({
|
|
|
787
798
|
]
|
|
788
799
|
}
|
|
789
800
|
);
|
|
790
|
-
}), Ge =
|
|
791
|
-
const s = x((v) => v.execution.previews[i]), d = x((v) => v.execution.nodeStatus[i]), m = x((v) => v.previewVisible[i] !== !1), o = x((v) => v.updateNodeData), n = xe(null), l =
|
|
801
|
+
}), Ge = P(function({ id: i, data: t, selected: a }) {
|
|
802
|
+
const s = x((v) => v.execution.previews[i]), d = x((v) => v.execution.nodeStatus[i]), m = x((v) => v.previewVisible[i] !== !1), o = x((v) => v.updateNodeData), n = xe(null), l = T(d) || (a ? "border-amber-500" : "border-amber-200"), p = C(
|
|
792
803
|
async (v) => {
|
|
793
804
|
try {
|
|
794
|
-
const w = await
|
|
805
|
+
const w = await je(v);
|
|
795
806
|
o(i, {
|
|
796
807
|
uploadId: w.id,
|
|
797
808
|
filename: w.filename,
|
|
@@ -854,15 +865,15 @@ const Re = T(function({
|
|
|
854
865
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2 mb-2", children: [
|
|
855
866
|
/* @__PURE__ */ e("div", { className: "w-3 h-3 rounded-full bg-amber-500" }),
|
|
856
867
|
/* @__PURE__ */ e("span", { className: "font-semibold text-sm text-amber-700 dark:text-amber-400", children: "Input" }),
|
|
857
|
-
/* @__PURE__ */ e(
|
|
868
|
+
/* @__PURE__ */ e(H, { nodeId: i, color: "text-amber-500 dark:text-amber-400" })
|
|
858
869
|
] }),
|
|
859
870
|
/* @__PURE__ */ e("div", { className: "text-xs text-gray-500 dark:text-zinc-400 truncate", children: t.filename || "No image selected" })
|
|
860
871
|
] }),
|
|
861
|
-
/* @__PURE__ */ e(
|
|
872
|
+
/* @__PURE__ */ e(W, { type: "source", position: A.Right, className: "w-3 h-3 !bg-amber-500" })
|
|
862
873
|
]
|
|
863
874
|
}
|
|
864
875
|
);
|
|
865
|
-
}), qe =
|
|
876
|
+
}), qe = P(function({
|
|
866
877
|
id: i,
|
|
867
878
|
data: t,
|
|
868
879
|
selected: a
|
|
@@ -871,13 +882,13 @@ const Re = T(function({
|
|
|
871
882
|
const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
|
|
872
883
|
var p;
|
|
873
884
|
return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
|
|
874
|
-
}), o =
|
|
885
|
+
}), o = T(s) || (a ? "border-cyan-500" : "border-cyan-200");
|
|
875
886
|
return /* @__PURE__ */ c(
|
|
876
887
|
"div",
|
|
877
888
|
{
|
|
878
889
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
|
|
879
890
|
children: [
|
|
880
|
-
/* @__PURE__ */ e(
|
|
891
|
+
/* @__PURE__ */ e(W, { type: "target", position: A.Left, className: "w-3 h-3 !bg-cyan-500" }),
|
|
881
892
|
d && /* @__PURE__ */ e("div", { className: "bg-cyan-50 dark:bg-cyan-900/30 border-b border-cyan-100 dark:border-cyan-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ c("pre", { className: "text-xs text-cyan-800 dark:text-cyan-200 whitespace-pre-wrap", children: [
|
|
882
893
|
(n = d.content) == null ? void 0 : n.slice(0, 200),
|
|
883
894
|
(((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
@@ -902,22 +913,22 @@ const Re = T(function({
|
|
|
902
913
|
"..."
|
|
903
914
|
] }) : null })
|
|
904
915
|
] }),
|
|
905
|
-
/* @__PURE__ */ e(
|
|
916
|
+
/* @__PURE__ */ e(W, { type: "source", position: A.Right, className: "w-3 h-3 !bg-cyan-500" })
|
|
906
917
|
]
|
|
907
918
|
}
|
|
908
919
|
);
|
|
909
|
-
}), Ke =
|
|
920
|
+
}), Ke = P(function({ id: i, data: t, selected: a }) {
|
|
910
921
|
var n, u;
|
|
911
922
|
const s = x((l) => l.execution.nodeStatus[i]), d = x((l) => {
|
|
912
923
|
var p;
|
|
913
924
|
return (p = l.execution.dataOutputs) == null ? void 0 : p[i];
|
|
914
|
-
}), o =
|
|
925
|
+
}), o = T(s) || (a ? "border-pink-500" : "border-pink-200");
|
|
915
926
|
return /* @__PURE__ */ c(
|
|
916
927
|
"div",
|
|
917
928
|
{
|
|
918
929
|
className: `rounded-lg border-2 bg-white dark:bg-zinc-800 shadow-md min-w-[180px] overflow-hidden ${o}`,
|
|
919
930
|
children: [
|
|
920
|
-
/* @__PURE__ */ e(
|
|
931
|
+
/* @__PURE__ */ e(W, { type: "target", position: A.Left, className: "w-3 h-3 !bg-pink-500" }),
|
|
921
932
|
d && /* @__PURE__ */ e("div", { className: "bg-pink-50 dark:bg-pink-900/30 border-b border-pink-100 dark:border-pink-800 p-2 max-h-24 overflow-auto", children: /* @__PURE__ */ c("pre", { className: "text-xs text-pink-800 dark:text-pink-200 whitespace-pre-wrap", children: [
|
|
922
933
|
(n = d.content) == null ? void 0 : n.slice(0, 200),
|
|
923
934
|
(((u = d.content) == null ? void 0 : u.length) || 0) > 200 && "..."
|
|
@@ -939,7 +950,7 @@ const Re = T(function({
|
|
|
939
950
|
"..."
|
|
940
951
|
] }) : null })
|
|
941
952
|
] }),
|
|
942
|
-
/* @__PURE__ */ e(
|
|
953
|
+
/* @__PURE__ */ e(W, { type: "source", position: A.Right, className: "w-3 h-3 !bg-pink-500" })
|
|
943
954
|
]
|
|
944
955
|
}
|
|
945
956
|
);
|
|
@@ -1028,7 +1039,7 @@ function Je({ onSelect: r }) {
|
|
|
1028
1039
|
const [i, t] = N([]), [a, s] = N(!0), [d, m] = N(null), o = async () => {
|
|
1029
1040
|
try {
|
|
1030
1041
|
s(!0);
|
|
1031
|
-
const l = await
|
|
1042
|
+
const l = await Pe();
|
|
1032
1043
|
t(l), m(null);
|
|
1033
1044
|
} catch (l) {
|
|
1034
1045
|
m(l instanceof Error ? l.message : "Failed to load uploads");
|
|
@@ -1042,7 +1053,7 @@ function Je({ onSelect: r }) {
|
|
|
1042
1053
|
const n = async (l, p) => {
|
|
1043
1054
|
if (p.stopPropagation(), !!confirm("Delete this upload?"))
|
|
1044
1055
|
try {
|
|
1045
|
-
await
|
|
1056
|
+
await Te(l), t((f) => f.filter((b) => b.id !== l));
|
|
1046
1057
|
} catch (f) {
|
|
1047
1058
|
console.error("Failed to delete:", f);
|
|
1048
1059
|
}
|
|
@@ -1087,10 +1098,10 @@ function Je({ onSelect: r }) {
|
|
|
1087
1098
|
)) }) });
|
|
1088
1099
|
}
|
|
1089
1100
|
function Ye() {
|
|
1090
|
-
const r = x((g) => g.setGenerators), i = x((g) => g.setTransforms), t = x((g) => g.generators), a = x((g) => g.transforms), s = x((g) => g.addNode), [d, m] = N(!1), { data: o } =
|
|
1101
|
+
const r = x((g) => g.setGenerators), i = x((g) => g.setTransforms), t = x((g) => g.generators), a = x((g) => g.transforms), s = x((g) => g.addNode), [d, m] = N(!1), { data: o } = K({
|
|
1091
1102
|
queryKey: ["generators"],
|
|
1092
1103
|
queryFn: We
|
|
1093
|
-
}), { data: n } =
|
|
1104
|
+
}), { data: n } = K({
|
|
1094
1105
|
queryKey: ["transforms"],
|
|
1095
1106
|
queryFn: Ae
|
|
1096
1107
|
});
|
|
@@ -1783,44 +1794,44 @@ function nt({
|
|
|
1783
1794
|
afterActionsSlot: t,
|
|
1784
1795
|
hideAttribution: a = !1
|
|
1785
1796
|
} = {}) {
|
|
1786
|
-
const s = x((y) => y.execution), d = x((y) => y.execute), m = x((y) => y.exportToYaml), o = x((y) => y.importFromYaml), n = x((y) => y.nodes), u = x((y) => y.edges), l = $((y) => y.openSettings), p = x((y) => y.activeWorkflowName), f = x((y) => y.hasUnsavedChanges), b = x((y) => y.saveWorkflow), k = x((y) => y.toggleLibrary), g = x((y) => y.setActiveWorkflowName), [v, w] = N(!1), [h, z] = N(!1), [S, B] = N("yaml"), [
|
|
1797
|
+
const s = x((y) => y.execution), d = x((y) => y.execute), m = x((y) => y.exportToYaml), o = x((y) => y.importFromYaml), n = x((y) => y.nodes), u = x((y) => y.edges), l = $((y) => y.openSettings), p = x((y) => y.activeWorkflowName), f = x((y) => y.hasUnsavedChanges), b = x((y) => y.saveWorkflow), k = x((y) => y.toggleLibrary), g = x((y) => y.setActiveWorkflowName), [v, w] = N(!1), [h, z] = N(!1), [S, B] = N("yaml"), [Q, le] = N(""), [J, ce] = N(""), [Y, U] = N(null), [me, F] = N(!1), [X, V] = N("");
|
|
1787
1798
|
M(() => {
|
|
1788
1799
|
const y = () => {
|
|
1789
|
-
|
|
1800
|
+
U("New workflow created"), setTimeout(() => U(null), 2e3);
|
|
1790
1801
|
};
|
|
1791
1802
|
return window.addEventListener("new-workflow-created", y), () => window.removeEventListener("new-workflow-created", y);
|
|
1792
1803
|
}, []);
|
|
1793
|
-
const
|
|
1794
|
-
n.length !== 0 && (b(),
|
|
1804
|
+
const G = C(() => {
|
|
1805
|
+
n.length !== 0 && (b(), U("Saved!"), setTimeout(() => U(null), 2e3));
|
|
1795
1806
|
}, [n.length, b]), ue = () => {
|
|
1796
|
-
|
|
1797
|
-
},
|
|
1798
|
-
const y =
|
|
1799
|
-
y && y !== p && g(y),
|
|
1807
|
+
V(p), F(!0);
|
|
1808
|
+
}, Z = () => {
|
|
1809
|
+
const y = X.trim();
|
|
1810
|
+
y && y !== p && g(y), F(!1);
|
|
1800
1811
|
};
|
|
1801
1812
|
M(() => {
|
|
1802
|
-
function y(
|
|
1803
|
-
(
|
|
1813
|
+
function y(L) {
|
|
1814
|
+
(L.metaKey || L.ctrlKey) && L.key === "s" && (L.preventDefault(), G());
|
|
1804
1815
|
}
|
|
1805
1816
|
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
1806
|
-
}, [
|
|
1817
|
+
}, [G]);
|
|
1807
1818
|
const ge = async () => {
|
|
1808
1819
|
await d();
|
|
1809
1820
|
}, pe = async () => {
|
|
1810
1821
|
const y = await m();
|
|
1811
1822
|
le(y);
|
|
1812
|
-
const
|
|
1813
|
-
ce(
|
|
1823
|
+
const L = at(n, u);
|
|
1824
|
+
ce(L), w(!0);
|
|
1814
1825
|
}, he = () => {
|
|
1815
|
-
const y = S === "yaml" ?
|
|
1826
|
+
const y = S === "yaml" ? Q : J;
|
|
1816
1827
|
navigator.clipboard.writeText(y);
|
|
1817
1828
|
}, fe = C(
|
|
1818
|
-
(y,
|
|
1819
|
-
o(y,
|
|
1829
|
+
(y, L, be) => {
|
|
1830
|
+
o(y, L, be), U("Workflow imported!"), setTimeout(() => U(null), 2e3);
|
|
1820
1831
|
},
|
|
1821
1832
|
[o]
|
|
1822
1833
|
);
|
|
1823
|
-
return /* @__PURE__ */ c(
|
|
1834
|
+
return /* @__PURE__ */ c(j, { children: [
|
|
1824
1835
|
/* @__PURE__ */ c("div", { className: "h-14 bg-white dark:bg-zinc-800 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between px-4", children: [
|
|
1825
1836
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
1826
1837
|
/* @__PURE__ */ e(
|
|
@@ -1859,11 +1870,11 @@ function nt({
|
|
|
1859
1870
|
"input",
|
|
1860
1871
|
{
|
|
1861
1872
|
type: "text",
|
|
1862
|
-
value:
|
|
1863
|
-
onChange: (y) =>
|
|
1864
|
-
onBlur:
|
|
1873
|
+
value: X,
|
|
1874
|
+
onChange: (y) => V(y.target.value),
|
|
1875
|
+
onBlur: Z,
|
|
1865
1876
|
onKeyDown: (y) => {
|
|
1866
|
-
y.key === "Enter" &&
|
|
1877
|
+
y.key === "Enter" && Z(), y.key === "Escape" && (V(p), F(!1));
|
|
1867
1878
|
},
|
|
1868
1879
|
className: "w-48 px-2 py-1 text-sm font-medium bg-white dark:bg-zinc-900 border border-teal-500 rounded focus:outline-none focus:ring-1 focus:ring-teal-500 text-gray-900 dark:text-zinc-100",
|
|
1869
1880
|
autoFocus: !0
|
|
@@ -1878,7 +1889,7 @@ function nt({
|
|
|
1878
1889
|
}
|
|
1879
1890
|
),
|
|
1880
1891
|
f && /* @__PURE__ */ e("span", { className: "text-xs text-amber-600 dark:text-amber-400", children: "(unsaved)" }),
|
|
1881
|
-
|
|
1892
|
+
Y && /* @__PURE__ */ e("span", { className: "text-xs text-green-600 dark:text-green-400", children: Y })
|
|
1882
1893
|
] }),
|
|
1883
1894
|
/* @__PURE__ */ c("span", { className: "text-sm text-gray-500 dark:text-zinc-400", children: [
|
|
1884
1895
|
n.length,
|
|
@@ -1919,7 +1930,7 @@ function nt({
|
|
|
1919
1930
|
/* @__PURE__ */ e(
|
|
1920
1931
|
"button",
|
|
1921
1932
|
{
|
|
1922
|
-
onClick:
|
|
1933
|
+
onClick: G,
|
|
1923
1934
|
disabled: n.length === 0,
|
|
1924
1935
|
className: "p-2 text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-700 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1925
1936
|
title: "Save Workflow (Cmd+S)",
|
|
@@ -1957,7 +1968,7 @@ function nt({
|
|
|
1957
1968
|
onClick: ge,
|
|
1958
1969
|
disabled: n.length === 0 || s.status === "running",
|
|
1959
1970
|
className: "px-4 py-2 text-sm font-medium text-white bg-teal-600 rounded-md hover:bg-teal-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
|
|
1960
|
-
children: s.status === "running" ? /* @__PURE__ */ c(
|
|
1971
|
+
children: s.status === "running" ? /* @__PURE__ */ c(j, { children: [
|
|
1961
1972
|
/* @__PURE__ */ c("svg", { className: "animate-spin h-4 w-4", viewBox: "0 0 24 24", fill: "none", children: [
|
|
1962
1973
|
/* @__PURE__ */ e(
|
|
1963
1974
|
"circle",
|
|
@@ -1980,7 +1991,7 @@ function nt({
|
|
|
1980
1991
|
)
|
|
1981
1992
|
] }),
|
|
1982
1993
|
"Running..."
|
|
1983
|
-
] }) : /* @__PURE__ */ c(
|
|
1994
|
+
] }) : /* @__PURE__ */ c(j, { children: [
|
|
1984
1995
|
/* @__PURE__ */ c("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: [
|
|
1985
1996
|
/* @__PURE__ */ e(
|
|
1986
1997
|
"path",
|
|
@@ -2015,24 +2026,14 @@ function nt({
|
|
|
2015
2026
|
" image",
|
|
2016
2027
|
s.imageIds.length !== 1 ? "s" : ""
|
|
2017
2028
|
] }),
|
|
2018
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2", children: s.
|
|
2019
|
-
"
|
|
2029
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2", children: s.imageUrls.slice(0, 4).map((y, L) => /* @__PURE__ */ e("a", { href: y, target: "_blank", rel: "noopener noreferrer", className: "block", children: /* @__PURE__ */ e(
|
|
2030
|
+
"img",
|
|
2020
2031
|
{
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
"img",
|
|
2027
|
-
{
|
|
2028
|
-
src: F(y),
|
|
2029
|
-
alt: "Generated",
|
|
2030
|
-
className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
|
|
2031
|
-
}
|
|
2032
|
-
)
|
|
2033
|
-
},
|
|
2034
|
-
y
|
|
2035
|
-
)) })
|
|
2032
|
+
src: y,
|
|
2033
|
+
alt: "Generated",
|
|
2034
|
+
className: "h-12 w-12 object-cover rounded border border-green-300 dark:border-green-700"
|
|
2035
|
+
}
|
|
2036
|
+
) }, L)) })
|
|
2036
2037
|
] }) }),
|
|
2037
2038
|
s.status === "error" && /* @__PURE__ */ e("div", { className: "bg-red-50 dark:bg-red-900/30 border-b border-red-200 dark:border-red-800 px-4 py-3", children: /* @__PURE__ */ c("span", { className: "text-red-700 dark:text-red-400", children: [
|
|
2038
2039
|
"Error: ",
|
|
@@ -2078,7 +2079,7 @@ function nt({
|
|
|
2078
2079
|
}
|
|
2079
2080
|
)
|
|
2080
2081
|
] }),
|
|
2081
|
-
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ?
|
|
2082
|
+
/* @__PURE__ */ e("div", { className: "p-4 overflow-auto flex-1", children: /* @__PURE__ */ e("pre", { className: "bg-gray-100 dark:bg-zinc-900 p-4 rounded text-sm font-mono whitespace-pre-wrap text-gray-800 dark:text-zinc-200", children: S === "yaml" ? Q : J }) }),
|
|
2082
2083
|
/* @__PURE__ */ c("div", { className: "flex justify-between items-center px-4 py-3 border-t border-gray-200 dark:border-zinc-700", children: [
|
|
2083
2084
|
/* @__PURE__ */ e("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: S === "yaml" ? "Use with floimg CLI: floimg run workflow.yaml" : "Run with Node.js or Bun" }),
|
|
2084
2085
|
/* @__PURE__ */ c("div", { className: "flex gap-2", children: [
|
|
@@ -2117,7 +2118,7 @@ function st() {
|
|
|
2117
2118
|
isLoading: s,
|
|
2118
2119
|
error: d,
|
|
2119
2120
|
refetch: m
|
|
2120
|
-
} =
|
|
2121
|
+
} = K({
|
|
2121
2122
|
queryKey: ["images"],
|
|
2122
2123
|
queryFn: Me,
|
|
2123
2124
|
refetchInterval: 5e3
|
|
@@ -2125,7 +2126,7 @@ function st() {
|
|
|
2125
2126
|
}), o = async (n) => {
|
|
2126
2127
|
t(n);
|
|
2127
2128
|
try {
|
|
2128
|
-
const u = await
|
|
2129
|
+
const u = await Ue(n);
|
|
2129
2130
|
if (u != null && u.workflow) {
|
|
2130
2131
|
const l = {
|
|
2131
2132
|
id: `image-${n}`,
|
|
@@ -2189,14 +2190,14 @@ function it({ image: r, onLoadWorkflow: i, isLoading: t }) {
|
|
|
2189
2190
|
/* @__PURE__ */ e(
|
|
2190
2191
|
"a",
|
|
2191
2192
|
{
|
|
2192
|
-
href:
|
|
2193
|
+
href: te(r.id),
|
|
2193
2194
|
target: "_blank",
|
|
2194
2195
|
rel: "noopener noreferrer",
|
|
2195
2196
|
className: "block aspect-square bg-gray-100 dark:bg-zinc-900",
|
|
2196
2197
|
children: /* @__PURE__ */ e(
|
|
2197
2198
|
"img",
|
|
2198
2199
|
{
|
|
2199
|
-
src:
|
|
2200
|
+
src: te(r.id),
|
|
2200
2201
|
alt: r.filename,
|
|
2201
2202
|
className: "w-full h-full object-cover",
|
|
2202
2203
|
loading: "lazy"
|
|
@@ -2666,7 +2667,7 @@ function Mt(r) {
|
|
|
2666
2667
|
);
|
|
2667
2668
|
}
|
|
2668
2669
|
function xt({ onSelect: r }) {
|
|
2669
|
-
const [i, t] = N(null), [a, s] = N(""), d =
|
|
2670
|
+
const [i, t] = N(null), [a, s] = N(""), d = ee(() => bt(), []), m = ee(() => {
|
|
2670
2671
|
let o = O;
|
|
2671
2672
|
if (i && (o = o.filter((n) => n.category === i)), a) {
|
|
2672
2673
|
const n = a.toLowerCase();
|
|
@@ -2875,7 +2876,7 @@ function wt({
|
|
|
2875
2876
|
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e("path", { d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" }) })
|
|
2876
2877
|
}
|
|
2877
2878
|
),
|
|
2878
|
-
l && /* @__PURE__ */ c(
|
|
2879
|
+
l && /* @__PURE__ */ c(j, { children: [
|
|
2879
2880
|
/* @__PURE__ */ e("div", { className: "fixed inset-0 z-10", onClick: () => p(!1) }),
|
|
2880
2881
|
/* @__PURE__ */ c("div", { className: "absolute right-0 top-full mt-1 w-36 bg-white dark:bg-zinc-800 rounded-lg shadow-lg border border-zinc-200 dark:border-zinc-700 py-1 z-20", children: [
|
|
2881
2882
|
/* @__PURE__ */ e(
|
|
@@ -2921,7 +2922,7 @@ function vt() {
|
|
|
2921
2922
|
const r = x((l) => l.showLibrary), i = x((l) => l.toggleLibrary), t = x((l) => l.savedWorkflows), a = x((l) => l.activeWorkflowId), s = x((l) => l.loadWorkflow), d = x((l) => l.deleteWorkflow), m = x((l) => l.renameWorkflow), o = x((l) => l.duplicateWorkflow), n = x((l) => l.newWorkflow);
|
|
2922
2923
|
if (!r) return null;
|
|
2923
2924
|
const u = [...t].sort((l, p) => p.updatedAt - l.updatedAt);
|
|
2924
|
-
return /* @__PURE__ */ c(
|
|
2925
|
+
return /* @__PURE__ */ c(j, { children: [
|
|
2925
2926
|
/* @__PURE__ */ e("div", { className: "fixed inset-0 bg-black/20 dark:bg-black/40 z-40", onClick: i }),
|
|
2926
2927
|
/* @__PURE__ */ c("div", { className: "fixed left-0 top-0 bottom-0 w-80 bg-zinc-50 dark:bg-zinc-900 border-r border-zinc-200 dark:border-zinc-700 z-50 flex flex-col shadow-xl", children: [
|
|
2927
2928
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-700", children: [
|
|
@@ -3258,7 +3259,7 @@ function St() {
|
|
|
3258
3259
|
) })
|
|
3259
3260
|
] }) }) : null;
|
|
3260
3261
|
}
|
|
3261
|
-
function
|
|
3262
|
+
function Ut() {
|
|
3262
3263
|
const [r, i] = N("editor"), t = x((o) => o.addNode), a = x((o) => o.loadTemplate);
|
|
3263
3264
|
M(() => {
|
|
3264
3265
|
const n = new URLSearchParams(window.location.search).get("template");
|
|
@@ -3334,7 +3335,7 @@ function jt() {
|
|
|
3334
3335
|
)
|
|
3335
3336
|
] }) }),
|
|
3336
3337
|
/* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
3337
|
-
r === "editor" && /* @__PURE__ */ c(
|
|
3338
|
+
r === "editor" && /* @__PURE__ */ c(j, { children: [
|
|
3338
3339
|
/* @__PURE__ */ e(Ye, {}),
|
|
3339
3340
|
/* @__PURE__ */ e("div", { className: "flex-1", onDrop: d, onDragOver: m, children: /* @__PURE__ */ e(Qe, {}) }),
|
|
3340
3341
|
/* @__PURE__ */ e(Xe, {})
|
|
@@ -3347,7 +3348,7 @@ function jt() {
|
|
|
3347
3348
|
}
|
|
3348
3349
|
export {
|
|
3349
3350
|
St as AISettings,
|
|
3350
|
-
|
|
3351
|
+
Ut as App,
|
|
3351
3352
|
st as Gallery,
|
|
3352
3353
|
Xe as NodeInspector,
|
|
3353
3354
|
Ye as NodePalette,
|