@teamflojo/floimg-studio-ui 0.2.0 → 0.2.1

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/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export { Gallery } from './components/Gallery';
15
15
  export { TemplateGallery } from './components/TemplateGallery';
16
16
  export { WorkflowLibrary } from './components/WorkflowLibrary';
17
17
  export { AISettings } from './components/AISettings';
18
+ export { AIChat } from './components/AIChat';
18
19
  export { UploadGallery } from './components/UploadGallery';
19
20
  export { useWorkflowStore } from './stores/workflowStore';
20
21
  export { templates, getCategories, getTemplatesByCategory, getTemplateById, searchTemplates, } from './templates';
package/dist/index.js CHANGED
@@ -202,10 +202,10 @@ async function Be(r) {
202
202
  }
203
203
  return t.json();
204
204
  }
205
- async function Ge() {
205
+ async function Ve() {
206
206
  return j(`${$}/uploads`);
207
207
  }
208
- async function Ve(r) {
208
+ async function Ge(r) {
209
209
  const l = await fetch(`${$}/uploads/${r}`, {
210
210
  method: "DELETE"
211
211
  });
@@ -280,7 +280,7 @@ const se = "http://localhost:11434", ie = "http://localhost:1234", O = ce()(
280
280
  )
281
281
  );
282
282
  let qe = 0;
283
- function G() {
283
+ function V() {
284
284
  return `node_${++qe}`;
285
285
  }
286
286
  function le() {
@@ -315,7 +315,7 @@ const k = ce()(
315
315
  },
316
316
  loadTemplate: (t) => {
317
317
  const n = /* @__PURE__ */ new Map(), o = t.workflow.nodes.map((m) => {
318
- const d = G();
318
+ const d = V();
319
319
  return n.set(m.id, d), {
320
320
  id: d,
321
321
  type: m.type,
@@ -378,7 +378,7 @@ const k = ce()(
378
378
  setVisionProviders: (t) => r({ visionProviders: t }),
379
379
  addNode: (t, n) => {
380
380
  var d, a, p;
381
- const o = G();
381
+ const o = V();
382
382
  let i;
383
383
  if (t.type === "generator")
384
384
  i = {
@@ -454,7 +454,7 @@ const k = ce()(
454
454
  duplicateNode: (t) => {
455
455
  const n = l(), o = n.nodes.find((d) => d.id === t);
456
456
  if (!o) return;
457
- const i = G(), m = {
457
+ const i = V(), m = {
458
458
  ...o,
459
459
  id: i,
460
460
  position: {
@@ -575,7 +575,7 @@ const k = ce()(
575
575
  },
576
576
  importFromYaml: (t, n, o) => {
577
577
  const i = /* @__PURE__ */ new Map(), m = t.map((a) => {
578
- const p = G();
578
+ const p = V();
579
579
  return i.set(a.id, p), {
580
580
  id: p,
581
581
  type: a.type,
@@ -735,7 +735,7 @@ const k = ce()(
735
735
  },
736
736
  loadGeneratedWorkflow: (t) => {
737
737
  const n = /* @__PURE__ */ new Map(), o = 250, i = 150, m = 3, d = t.nodes.map((p, c) => {
738
- const u = G();
738
+ const u = V();
739
739
  n.set(p.id, u);
740
740
  const h = p.nodeType.split(":"), f = h[0], w = Math.floor(c / m), y = {
741
741
  x: 100 + c % m * o,
@@ -1339,7 +1339,7 @@ function nt({ onSelect: r }) {
1339
1339
  const [l, t] = I([]), [n, o] = I(!0), [i, m] = I(null), d = async () => {
1340
1340
  try {
1341
1341
  o(!0);
1342
- const c = await Ge();
1342
+ const c = await Ve();
1343
1343
  t(c), m(null);
1344
1344
  } catch (c) {
1345
1345
  m(c instanceof Error ? c.message : "Failed to load uploads");
@@ -1353,7 +1353,7 @@ function nt({ onSelect: r }) {
1353
1353
  const a = async (c, u) => {
1354
1354
  if (u.stopPropagation(), !!confirm("Delete this upload?"))
1355
1355
  try {
1356
- await Ve(c), t((h) => h.filter((f) => f.id !== c));
1356
+ await Ge(c), t((h) => h.filter((f) => f.id !== c));
1357
1357
  } catch (h) {
1358
1358
  console.error("Failed to delete:", h);
1359
1359
  }
@@ -1943,7 +1943,7 @@ function ct(r) {
1943
1943
  const l = r.type || "node", t = r.id.replace(/[^a-zA-Z0-9]/g, "_");
1944
1944
  return `${l}_${t}`;
1945
1945
  }
1946
- function V(r) {
1946
+ function G(r) {
1947
1947
  return typeof r == "string" ? r.includes(`
1948
1948
  `) ? "`" + r.replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`" : JSON.stringify(r) : JSON.stringify(r, null, 2);
1949
1949
  }
@@ -1953,7 +1953,7 @@ function mt(r, l, t) {
1953
1953
  case "generator": {
1954
1954
  const d = r.data;
1955
1955
  o.push(d.generatorName);
1956
- const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${V(u)}`).join(`,
1956
+ const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1957
1957
  `);
1958
1958
  return {
1959
1959
  code: `// Generate image using ${d.generatorName}
@@ -1970,7 +1970,7 @@ const ${n} = await flo.loadImage("./input.png");`,
1970
1970
  imports: []
1971
1971
  };
1972
1972
  case "transform": {
1973
- const d = r.data, a = d.params || {}, p = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${V(h)}`).join(", "), c = m || "image";
1973
+ const d = r.data, a = d.params || {}, p = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${G(h)}`).join(", "), c = m || "image";
1974
1974
  return {
1975
1975
  code: `// Apply ${d.operation} transform
1976
1976
  const ${n} = await flo.transform(${c}, "${d.operation}"${p ? `, { ${p} }` : ""});`,
@@ -1980,7 +1980,7 @@ const ${n} = await flo.transform(${c}, "${d.operation}"${p ? `, { ${p} }` : ""})
1980
1980
  case "vision": {
1981
1981
  const d = r.data;
1982
1982
  o.push(d.providerName);
1983
- const a = d.params || {}, p = m || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${V(h)}`).join(`,
1983
+ const a = d.params || {}, p = m || "image", c = Object.entries(a).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => ` ${u}: ${G(h)}`).join(`,
1984
1984
  `);
1985
1985
  return {
1986
1986
  code: `// Analyze image with ${d.providerName}
@@ -1993,7 +1993,7 @@ ${c}
1993
1993
  case "text": {
1994
1994
  const d = r.data;
1995
1995
  o.push(d.providerName);
1996
- const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${V(u)}`).join(`,
1996
+ const a = d.params || {}, p = Object.entries(a).filter(([, c]) => c !== void 0 && c !== "").map(([c, u]) => ` ${c}: ${G(u)}`).join(`,
1997
1997
  `);
1998
1998
  return {
1999
1999
  code: `// Generate text with ${d.providerName}
@@ -2007,7 +2007,7 @@ ${p}
2007
2007
  const d = r.data;
2008
2008
  return {
2009
2009
  code: `// Save result
2010
- await flo.save(${m || "result"}, ${V(d.destination)});`,
2010
+ await flo.save(${m || "result"}, ${G(d.destination)});`,
2011
2011
  imports: []
2012
2012
  };
2013
2013
  }
@@ -2659,12 +2659,13 @@ function ht() {
2659
2659
  /* @__PURE__ */ e("div", { className: "text-sm", children: "Create a workflow and click Execute to generate images" })
2660
2660
  ] }) : /* @__PURE__ */ s("div", { className: "p-4 bg-gray-100 dark:bg-zinc-900 min-h-full", children: [
2661
2661
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between mb-4", children: [
2662
- /* @__PURE__ */ s("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
2663
- "Gallery (",
2664
- n.length,
2665
- " image",
2666
- n.length !== 1 ? "s" : "",
2667
- ")"
2662
+ /* @__PURE__ */ s("div", { children: [
2663
+ /* @__PURE__ */ s("h2", { className: "text-lg font-semibold text-gray-800 dark:text-white", children: [
2664
+ "Images (",
2665
+ n.length,
2666
+ ")"
2667
+ ] }),
2668
+ /* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-zinc-500", children: "Your generated images" })
2668
2669
  ] }),
2669
2670
  /* @__PURE__ */ e(
2670
2671
  "button",
@@ -3154,7 +3155,7 @@ function It() {
3154
3155
  const r = new Set(H.map((l) => l.category));
3155
3156
  return Array.from(r).sort();
3156
3157
  }
3157
- function Vt(r) {
3158
+ function Gt(r) {
3158
3159
  return H.filter((l) => l.category === r);
3159
3160
  }
3160
3161
  function de(r) {
@@ -4132,7 +4133,7 @@ function Ht() {
4132
4133
  {
4133
4134
  onClick: () => l("gallery"),
4134
4135
  className: `px-6 py-3 text-sm font-medium border-b-2 transition-colors ${r === "gallery" ? "border-teal-500 text-teal-600 dark:text-teal-400" : "border-transparent text-gray-500 dark:text-zinc-400 hover:text-gray-700 dark:hover:text-zinc-200"}`,
4135
- children: "Gallery"
4136
+ children: "Images"
4136
4137
  }
4137
4138
  ),
4138
4139
  /* @__PURE__ */ e(
@@ -4177,6 +4178,7 @@ function Ht() {
4177
4178
  ] });
4178
4179
  }
4179
4180
  export {
4181
+ Tt as AIChat,
4180
4182
  Dt as AISettings,
4181
4183
  Ht as App,
4182
4184
  ht as Gallery,
@@ -4189,7 +4191,7 @@ export {
4189
4191
  At as WorkflowLibrary,
4190
4192
  It as getCategories,
4191
4193
  de as getTemplateById,
4192
- Vt as getTemplatesByCategory,
4194
+ Gt as getTemplatesByCategory,
4193
4195
  Ft as searchTemplates,
4194
4196
  H as templates,
4195
4197
  k as useWorkflowStore