@rslsp1/fa-app-tools 2.0.20 → 2.0.22

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.mts CHANGED
@@ -614,6 +614,6 @@ declare function findTips(dag: Dag): number[];
614
614
  declare function findForks(dag: Dag): DagFork[];
615
615
  declare function topoSort(events: HFEvent[]): HFEvent[];
616
616
 
617
- declare const LIB_VERSION = "2.0.20";
617
+ declare const LIB_VERSION = "2.0.22";
618
618
 
619
619
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
package/dist/index.d.ts CHANGED
@@ -614,6 +614,6 @@ declare function findTips(dag: Dag): number[];
614
614
  declare function findForks(dag: Dag): DagFork[];
615
615
  declare function topoSort(events: HFEvent[]): HFEvent[];
616
616
 
617
- declare const LIB_VERSION = "2.0.20";
617
+ declare const LIB_VERSION = "2.0.22";
618
618
 
619
619
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type DagFork, type ExtractedCharacter, FaApp, type FaAppProps, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFEvent, type HFEventVersion, type HFFileInfo$1 as HFFileInfo, type HFMetadataEntry, type HFStateMeta, type HFStateResult, type HFStateSnapshot, HistoryPanel, type ImageAddedPayload, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, type MetadataUpdatedPayload, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type TagUpsertedPayload, type WorkspaceTags, applyEvent, applyEvents, autoLabel, buildBlendInstruction, buildCompareInstruction, buildDag, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, findForks, findTips, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, getSessionClientId, groupGenerationsToLabItems, hfBatchArchive, hfBootstrapFromLegacy, hfDeleteProject, hfDownloadProject, hfListDir, hfListProjects, hfLoadImageAsBase64, hfUploadImage, hfUploadProjectForm, hfUploadSmallFile, importProjectFromZip, injectXMPMetadata, interpretSdkError, loadHFState, loadPendingEvents, parsePromptFile, parsePromptResponse, setHFToken, topoSort, tsFromEventPath, useHFState, useKeyboardNavigation, useOnClickOutside, writeHFEvent };
package/dist/index.js CHANGED
@@ -1341,7 +1341,10 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
1341
1341
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[10px] italic", children: "Importiere Assets aus deinem Projekt." })
1342
1342
  ] })
1343
1343
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-3 pb-10", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react9.motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, className: `relative aspect-square group/item rounded-xl overflow-hidden border transition-all bg-white/5 cursor-pointer shadow-lg ${item.selectedForExport ? "border-blue-500 shadow-[0_0_15px_rgba(59,130,246,0.2)]" : "border-white/10 opacity-70 hover:opacity-100"}`, onClick: () => onSelect?.(item), children: [
1344
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: item.base64 ? item.base64.startsWith("data:") ? item.base64 : `data:image/png;base64,${item.base64}` : "", className: "w-full h-full object-cover transition-transform duration-500 group-hover/item:scale-110", alt: item.prompt }),
1344
+ item.status === "processing" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full h-full flex flex-col items-center justify-center gap-2 bg-black/40", children: [
1345
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-6 h-6 border-t-2 border-white rounded-full animate-spin" }),
1346
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-[8px] text-white/40 uppercase font-bold tracking-widest", children: "Generiere\u2026" })
1347
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: item.base64 ? item.base64.startsWith("data:") ? item.base64 : `data:image/png;base64,${item.base64}` : "", className: "w-full h-full object-cover transition-transform duration-500 group-hover/item:scale-110", alt: item.prompt }),
1345
1348
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: `absolute top-2 left-2 w-5 h-5 rounded-md border flex items-center justify-center transition-all z-30 pointer-events-auto ${item.selectedForExport ? "bg-blue-500 border-blue-400" : "bg-black/60 border-white/20"}`, onClick: (e) => {
1346
1349
  e.stopPropagation();
1347
1350
  onToggleSelection?.(item.id);
@@ -4161,26 +4164,25 @@ function EventMonitor({ events, confirmedEventKeys, galleryItems, imageUploadSta
4161
4164
  "lokal"
4162
4165
  ] })
4163
4166
  ] }),
4164
- isImageEvent && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3 }, children: [
4167
+ isImageEvent && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
4165
4168
  uploadStatus === "done" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#4ade80", display: "flex", alignItems: "center", gap: 2 }, children: [
4166
4169
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_done" }),
4167
- "Bild auf HF"
4170
+ "Upload \u2713"
4168
4171
  ] }),
4169
4172
  uploadStatus === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#60a5fa", display: "flex", alignItems: "center", gap: 2 }, children: [
4170
4173
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_upload" }),
4171
- "Bild l\xE4dt\u2026"
4174
+ "l\xE4dt hoch\u2026"
4172
4175
  ] }),
4173
4176
  uploadStatus === "failed" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#f87171", display: "flex", alignItems: "center", gap: 2 }, children: [
4174
4177
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_off" }),
4175
- "Bild-Upload fehlgeschlagen"
4178
+ "Upload fehlgeschlagen"
4176
4179
  ] }),
4177
- !uploadStatus && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { fontSize: 9, color: "rgba(255,255,255,0.2)" }, children: "Bild-Upload unbekannt (anderes Ger\xE4t?)" }),
4178
- galleryItem?.base64 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#4ade80", marginLeft: 6, display: "flex", alignItems: "center", gap: 2 }, children: [
4180
+ galleryItem?.base64 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#4ade80", display: "flex", alignItems: "center", gap: 2 }, children: [
4179
4181
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "photo" }),
4180
- "lokal vorhanden"
4181
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#f87171", marginLeft: 6, display: "flex", alignItems: "center", gap: 2 }, children: [
4182
+ uploadStatus ? "lokal" : "von HF geladen"
4183
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { fontSize: 9, color: "#f87171", display: "flex", alignItems: "center", gap: 2 }, children: [
4182
4184
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "broken_image" }),
4183
- "kein lokales Bild"
4185
+ uploadStatus === "failed" ? "Binary nicht auf HF" : "wird geladen\u2026"
4184
4186
  ] })
4185
4187
  ] }),
4186
4188
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { fontSize: 9, color: "rgba(255,255,255,0.25)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: payloadPreview })
@@ -4511,12 +4513,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4511
4513
  setGalleryItems((prev) => {
4512
4514
  const localOnly = prev.filter((g) => !hfIds.has(g.id));
4513
4515
  const merged = skeletons.map((s) => prev.find((g) => g.id === s.id) ?? s);
4514
- return [...localOnly, ...merged];
4516
+ return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
4515
4517
  });
4516
4518
  setHistory((prev) => {
4517
4519
  const localOnly = prev.filter((g) => !hfIds.has(g.id));
4518
4520
  const merged = skeletons.map((s) => prev.find((g) => g.id === s.id) ?? s);
4519
- return [...localOnly, ...merged];
4521
+ return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
4520
4522
  });
4521
4523
  const COOLDOWN_MS = 5 * 60 * 1e3;
4522
4524
  for (const entry of hfState.metadata) {
@@ -4772,13 +4774,14 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4772
4774
  const activeSeed = seedMode === "random" ? Math.floor(Math.random() * 1e9) : seed;
4773
4775
  const newGen = { id: genId, nodeId: overrideNodeId || focusedNodeId || "1", status: "processing", timestamp: Date.now(), prompt: promptToUse, seed: activeSeed, model: selectedModel, tags: [], type: "generation" };
4774
4776
  setHistory((prev) => [newGen, ...prev]);
4777
+ setGalleryItems((prev) => [newGen, ...prev]);
4775
4778
  if (!options.silent) setCurrentResult(newGen);
4776
4779
  if (seedMode === "random") setSeed(activeSeed);
4777
4780
  try {
4778
4781
  const { base64, mediaId } = await onGenerateImage(buildImageGenerationOptions(promptToUse, aspectRatio, selectedModel, useReferenceId ?? activeReferenceId ?? void 0));
4779
4782
  const finishedGen = { ...newGen, status: "done", base64: `data:image/png;base64,${base64}`, mediaId };
4780
4783
  setHistory((prev) => prev.map((g) => g.id === genId ? finishedGen : g));
4781
- setGalleryItems((prev) => [finishedGen, ...prev]);
4784
+ setGalleryItems((prev) => prev.map((g) => g.id === genId ? finishedGen : g));
4782
4785
  setCurrentResult((prev) => {
4783
4786
  if (!prev) return finishedGen;
4784
4787
  if (prev.id === genId || !options.silent) return finishedGen;
@@ -4808,6 +4811,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4808
4811
  } catch (err) {
4809
4812
  const errorGen = { ...newGen, status: "error", error: { message: err.message || "Unbekannter Fehler", details: err.toString() } };
4810
4813
  setHistory((prev) => prev.map((g) => g.id === genId ? errorGen : g));
4814
+ setGalleryItems((prev) => prev.filter((g) => g.id !== genId));
4811
4815
  if (!options.silent || currentResult?.id === genId) setCurrentResult(errorGen);
4812
4816
  } finally {
4813
4817
  setActiveGenerationsCount((prev) => Math.max(0, prev - 1));
@@ -6008,7 +6012,7 @@ function FaApp({
6008
6012
  // src/index.ts
6009
6013
  init_hfStateService();
6010
6014
  init_hfStateService();
6011
- var LIB_VERSION = "2.0.20";
6015
+ var LIB_VERSION = "2.0.22";
6012
6016
  // Annotate the CommonJS export names for ESM import in node:
6013
6017
  0 && (module.exports = {
6014
6018
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -681,7 +681,10 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
681
681
  /* @__PURE__ */ jsx8("p", { className: "text-[10px] italic", children: "Importiere Assets aus deinem Projekt." })
682
682
  ] })
683
683
  ] }) : /* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 gap-3 pb-10", children: items.map((item) => /* @__PURE__ */ jsxs6(motion4.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, className: `relative aspect-square group/item rounded-xl overflow-hidden border transition-all bg-white/5 cursor-pointer shadow-lg ${item.selectedForExport ? "border-blue-500 shadow-[0_0_15px_rgba(59,130,246,0.2)]" : "border-white/10 opacity-70 hover:opacity-100"}`, onClick: () => onSelect?.(item), children: [
684
- /* @__PURE__ */ jsx8("img", { src: item.base64 ? item.base64.startsWith("data:") ? item.base64 : `data:image/png;base64,${item.base64}` : "", className: "w-full h-full object-cover transition-transform duration-500 group-hover/item:scale-110", alt: item.prompt }),
684
+ item.status === "processing" ? /* @__PURE__ */ jsxs6("div", { className: "w-full h-full flex flex-col items-center justify-center gap-2 bg-black/40", children: [
685
+ /* @__PURE__ */ jsx8("div", { className: "w-6 h-6 border-t-2 border-white rounded-full animate-spin" }),
686
+ /* @__PURE__ */ jsx8("span", { className: "text-[8px] text-white/40 uppercase font-bold tracking-widest", children: "Generiere\u2026" })
687
+ ] }) : /* @__PURE__ */ jsx8("img", { src: item.base64 ? item.base64.startsWith("data:") ? item.base64 : `data:image/png;base64,${item.base64}` : "", className: "w-full h-full object-cover transition-transform duration-500 group-hover/item:scale-110", alt: item.prompt }),
685
688
  /* @__PURE__ */ jsx8("button", { type: "button", className: `absolute top-2 left-2 w-5 h-5 rounded-md border flex items-center justify-center transition-all z-30 pointer-events-auto ${item.selectedForExport ? "bg-blue-500 border-blue-400" : "bg-black/60 border-white/20"}`, onClick: (e) => {
686
689
  e.stopPropagation();
687
690
  onToggleSelection?.(item.id);
@@ -3492,26 +3495,25 @@ function EventMonitor({ events, confirmedEventKeys, galleryItems, imageUploadSta
3492
3495
  "lokal"
3493
3496
  ] })
3494
3497
  ] }),
3495
- isImageEvent && /* @__PURE__ */ jsxs18("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3 }, children: [
3498
+ isImageEvent && /* @__PURE__ */ jsxs18("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
3496
3499
  uploadStatus === "done" && /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#4ade80", display: "flex", alignItems: "center", gap: 2 }, children: [
3497
3500
  /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_done" }),
3498
- "Bild auf HF"
3501
+ "Upload \u2713"
3499
3502
  ] }),
3500
3503
  uploadStatus === "uploading" && /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#60a5fa", display: "flex", alignItems: "center", gap: 2 }, children: [
3501
3504
  /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_upload" }),
3502
- "Bild l\xE4dt\u2026"
3505
+ "l\xE4dt hoch\u2026"
3503
3506
  ] }),
3504
3507
  uploadStatus === "failed" && /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#f87171", display: "flex", alignItems: "center", gap: 2 }, children: [
3505
3508
  /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "cloud_off" }),
3506
- "Bild-Upload fehlgeschlagen"
3509
+ "Upload fehlgeschlagen"
3507
3510
  ] }),
3508
- !uploadStatus && /* @__PURE__ */ jsx20("span", { style: { fontSize: 9, color: "rgba(255,255,255,0.2)" }, children: "Bild-Upload unbekannt (anderes Ger\xE4t?)" }),
3509
- galleryItem?.base64 ? /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#4ade80", marginLeft: 6, display: "flex", alignItems: "center", gap: 2 }, children: [
3511
+ galleryItem?.base64 ? /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#4ade80", display: "flex", alignItems: "center", gap: 2 }, children: [
3510
3512
  /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "photo" }),
3511
- "lokal vorhanden"
3512
- ] }) : /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#f87171", marginLeft: 6, display: "flex", alignItems: "center", gap: 2 }, children: [
3513
+ uploadStatus ? "lokal" : "von HF geladen"
3514
+ ] }) : /* @__PURE__ */ jsxs18("span", { style: { fontSize: 9, color: "#f87171", display: "flex", alignItems: "center", gap: 2 }, children: [
3513
3515
  /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined", style: { fontSize: 11 }, children: "broken_image" }),
3514
- "kein lokales Bild"
3516
+ uploadStatus === "failed" ? "Binary nicht auf HF" : "wird geladen\u2026"
3515
3517
  ] })
3516
3518
  ] }),
3517
3519
  /* @__PURE__ */ jsx20("div", { style: { fontSize: 9, color: "rgba(255,255,255,0.25)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: payloadPreview })
@@ -3842,12 +3844,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3842
3844
  setGalleryItems((prev) => {
3843
3845
  const localOnly = prev.filter((g) => !hfIds.has(g.id));
3844
3846
  const merged = skeletons.map((s) => prev.find((g) => g.id === s.id) ?? s);
3845
- return [...localOnly, ...merged];
3847
+ return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
3846
3848
  });
3847
3849
  setHistory((prev) => {
3848
3850
  const localOnly = prev.filter((g) => !hfIds.has(g.id));
3849
3851
  const merged = skeletons.map((s) => prev.find((g) => g.id === s.id) ?? s);
3850
- return [...localOnly, ...merged];
3852
+ return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
3851
3853
  });
3852
3854
  const COOLDOWN_MS = 5 * 60 * 1e3;
3853
3855
  for (const entry of hfState.metadata) {
@@ -4103,13 +4105,14 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4103
4105
  const activeSeed = seedMode === "random" ? Math.floor(Math.random() * 1e9) : seed;
4104
4106
  const newGen = { id: genId, nodeId: overrideNodeId || focusedNodeId || "1", status: "processing", timestamp: Date.now(), prompt: promptToUse, seed: activeSeed, model: selectedModel, tags: [], type: "generation" };
4105
4107
  setHistory((prev) => [newGen, ...prev]);
4108
+ setGalleryItems((prev) => [newGen, ...prev]);
4106
4109
  if (!options.silent) setCurrentResult(newGen);
4107
4110
  if (seedMode === "random") setSeed(activeSeed);
4108
4111
  try {
4109
4112
  const { base64, mediaId } = await onGenerateImage(buildImageGenerationOptions(promptToUse, aspectRatio, selectedModel, useReferenceId ?? activeReferenceId ?? void 0));
4110
4113
  const finishedGen = { ...newGen, status: "done", base64: `data:image/png;base64,${base64}`, mediaId };
4111
4114
  setHistory((prev) => prev.map((g) => g.id === genId ? finishedGen : g));
4112
- setGalleryItems((prev) => [finishedGen, ...prev]);
4115
+ setGalleryItems((prev) => prev.map((g) => g.id === genId ? finishedGen : g));
4113
4116
  setCurrentResult((prev) => {
4114
4117
  if (!prev) return finishedGen;
4115
4118
  if (prev.id === genId || !options.silent) return finishedGen;
@@ -4139,6 +4142,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4139
4142
  } catch (err) {
4140
4143
  const errorGen = { ...newGen, status: "error", error: { message: err.message || "Unbekannter Fehler", details: err.toString() } };
4141
4144
  setHistory((prev) => prev.map((g) => g.id === genId ? errorGen : g));
4145
+ setGalleryItems((prev) => prev.filter((g) => g.id !== genId));
4142
4146
  if (!options.silent || currentResult?.id === genId) setCurrentResult(errorGen);
4143
4147
  } finally {
4144
4148
  setActiveGenerationsCount((prev) => Math.max(0, prev - 1));
@@ -5337,7 +5341,7 @@ function FaApp({
5337
5341
  }
5338
5342
 
5339
5343
  // src/index.ts
5340
- var LIB_VERSION = "2.0.20";
5344
+ var LIB_VERSION = "2.0.22";
5341
5345
  export {
5342
5346
  AvatarArchitectApp,
5343
5347
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",