@rslsp1/fa-app-tools 1.3.7 → 1.3.9

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
@@ -479,6 +479,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
479
479
  declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
480
480
  declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
481
481
 
482
- declare const LIB_VERSION = "1.3.7";
482
+ declare const LIB_VERSION = "1.3.9";
483
483
 
484
484
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFMetadataEntry, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, groupGenerationsToLabItems, hfDeleteProject, hfDownloadProject, hfListProjects, hfLoadImageAsBase64, hfLoadMetadata, hfLoadTags, hfSaveMetadata, hfSaveTags, hfUploadImage, hfUploadProjectForm, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, setHFToken, useKeyboardNavigation, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -479,6 +479,6 @@ declare function hfLoadMetadata(token: string): Promise<any[]>;
479
479
  declare function hfUploadImage(base64: string, id: string, token: string, mimeType?: string): Promise<void>;
480
480
  declare function hfLoadImageAsBase64(id: string, token: string): Promise<string | null>;
481
481
 
482
- declare const LIB_VERSION = "1.3.7";
482
+ declare const LIB_VERSION = "1.3.9";
483
483
 
484
484
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, type HFMetadataEntry, HistoryPanel, InspectPanel, LIB_VERSION, LabBlend, LabCompare, type LabFrame, LabImagePicker, type LabItem, LabLoop, LabRemix, type LabServices, LabsTab, ListView, type MediaItem, MediaLibrary, PillButton, type ProjectMeta, type ProjectSettings, ProjectSyncTab, PromptTab, SectionLabel, type SelectedLabImage, type SelectedTag, SetupPanel, type SyncDiff, TagManagerPanel, type TagOption, type WorkspaceTags, autoLabel, buildBlendInstruction, buildCompareInstruction, buildFallbackPrompt, buildGenerationPrompt, buildImageGenerationOptions, buildLoopInstruction, buildPromptTabPayload, buildReferenceImageMediaIds, buildRemixInstruction, buildScanInstruction, cleanAiResponse, createFlowServices, exportProjectToZip, formatTreeToMarkdown, frameToGeneration, getFormattedTimestamp, getHFToken, groupGenerationsToLabItems, hfDeleteProject, hfDownloadProject, hfListProjects, hfLoadImageAsBase64, hfLoadMetadata, hfLoadTags, hfSaveMetadata, hfSaveTags, hfUploadImage, hfUploadProjectForm, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, setHFToken, useKeyboardNavigation, useOnClickOutside };
package/dist/index.js CHANGED
@@ -4024,13 +4024,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4024
4024
  (0, import_react21.useEffect)(() => {
4025
4025
  if (activeTab === "setup" || activeTab === "sync") fetchServerProjects();
4026
4026
  }, [activeTab]);
4027
- (0, import_react21.useEffect)(() => {
4028
- if (!hfToken) return;
4029
- hfLoadTags(hfToken).then((tags) => {
4030
- if (tags?.by_category) setWorkspaceTags(tags);
4031
- }).catch(() => {
4032
- });
4033
- hfLoadMetadata(hfToken).then(async (entries) => {
4027
+ const [isHfRefreshing, setIsHfRefreshing] = (0, import_react21.useState)(false);
4028
+ const loadFromHF = (0, import_react21.useCallback)(async (token) => {
4029
+ setIsHfRefreshing(true);
4030
+ try {
4031
+ hfLoadTags(token).then((tags) => {
4032
+ if (tags?.by_category) setWorkspaceTags(tags);
4033
+ }).catch(() => {
4034
+ });
4035
+ const entries = await hfLoadMetadata(token);
4034
4036
  if (!Array.isArray(entries) || entries.length === 0) return;
4035
4037
  setHfMetadata(entries);
4036
4038
  const skeletons = entries.map((e) => ({
@@ -4044,18 +4046,23 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4044
4046
  status: "done"
4045
4047
  }));
4046
4048
  setGalleryItems(skeletons);
4049
+ setHistory(skeletons);
4050
+ if (skeletons.length > 0) setCurrentResult(skeletons[0]);
4047
4051
  for (const entry of entries) {
4048
- hfLoadImageAsBase64(entry.id, hfToken).then((b64) => {
4052
+ hfLoadImageAsBase64(entry.id, token).then((b64) => {
4049
4053
  if (!b64) return;
4050
4054
  const prefix = `data:${entry.mimeType || "image/jpeg"};base64,`;
4051
- setGalleryItems((prev) => prev.map(
4052
- (g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g
4053
- ));
4055
+ setGalleryItems((prev) => prev.map((g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g));
4056
+ setHistory((prev) => prev.map((g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g));
4054
4057
  }).catch(() => {
4055
4058
  });
4056
4059
  }
4057
- }).catch(() => {
4058
- });
4060
+ } finally {
4061
+ setIsHfRefreshing(false);
4062
+ }
4063
+ }, []);
4064
+ (0, import_react21.useEffect)(() => {
4065
+ if (hfToken) loadFromHF(hfToken);
4059
4066
  }, [hfToken]);
4060
4067
  (0, import_react21.useEffect)(() => {
4061
4068
  if (!hfToken || !workspaceTags) return;
@@ -4406,7 +4413,10 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4406
4413
  ] })
4407
4414
  ] }),
4408
4415
  mobileTab === "browse" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col flex-1 min-h-0", children: [
4409
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex border-b border-white/5 shrink-0", style: { height: 52 }, children: ["history", "gallery", "inspect"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: () => setActiveTab(tab), className: `flex-1 flex items-center justify-center gap-1.5 transition-colors text-[11px] font-bold uppercase tracking-wide ${activeTab === tab ? "text-white border-b-2 border-white" : "text-white/30"}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : "info" }) }, tab)) }),
4416
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex border-b border-white/5 shrink-0", style: { height: 52 }, children: [
4417
+ ["history", "gallery", "inspect"].map((tab) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: () => setActiveTab(tab), className: `flex-1 flex items-center justify-center gap-1.5 transition-colors text-[11px] font-bold uppercase tracking-wide ${activeTab === tab ? "text-white border-b-2 border-white" : "text-white/30"}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : "info" }) }, tab)),
4418
+ hfToken && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: () => loadFromHF(hfToken), disabled: isHfRefreshing, className: "w-12 flex items-center justify-center text-white/20 active:text-white transition-colors disabled:opacity-30", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: `material-symbols-outlined text-[20px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) })
4419
+ ] }),
4410
4420
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 overflow-hidden relative", children: [
4411
4421
  activeTab === "history" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(HistoryPanel, { history, currentResultId: currentResult?.id || null, onSelect: (g) => {
4412
4422
  setCurrentResult(g);
@@ -4795,6 +4805,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4795
4805
  setActiveTab(tab);
4796
4806
  setIsRightCollapsed(false);
4797
4807
  }, className: `flex-1 flex items-center justify-center relative transition-colors ${activeTab === tab ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : tab === "inspect" ? "info" : tab === "setup" ? "settings" : tab === "sync" ? "cloud_sync" : "label" }) }, tab)) }),
4808
+ hfToken && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: () => loadFromHF(hfToken), disabled: isHfRefreshing, className: "w-10 flex items-center justify-center text-white/20 hover:text-white/60 transition-colors disabled:opacity-30", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: `material-symbols-outlined text-[18px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) }),
4798
4809
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { onClick: () => setIsRightCollapsed(!isRightCollapsed), className: "w-10 flex items-center justify-center text-white/20 hover:text-white", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "material-symbols-outlined text-[18px]", children: isRightCollapsed ? "chevron_left" : "chevron_right" }) })
4799
4810
  ] }),
4800
4811
  !isRightCollapsed && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 overflow-hidden relative", children: [
@@ -4860,7 +4871,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4860
4871
 
4861
4872
  // src/index.ts
4862
4873
  init_hfStateService();
4863
- var LIB_VERSION = "1.3.7";
4874
+ var LIB_VERSION = "1.3.9";
4864
4875
  // Annotate the CommonJS export names for ESM import in node:
4865
4876
  0 && (module.exports = {
4866
4877
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -3467,13 +3467,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3467
3467
  useEffect5(() => {
3468
3468
  if (activeTab === "setup" || activeTab === "sync") fetchServerProjects();
3469
3469
  }, [activeTab]);
3470
- useEffect5(() => {
3471
- if (!hfToken) return;
3472
- hfLoadTags(hfToken).then((tags) => {
3473
- if (tags?.by_category) setWorkspaceTags(tags);
3474
- }).catch(() => {
3475
- });
3476
- hfLoadMetadata(hfToken).then(async (entries) => {
3470
+ const [isHfRefreshing, setIsHfRefreshing] = useState14(false);
3471
+ const loadFromHF = useCallback(async (token) => {
3472
+ setIsHfRefreshing(true);
3473
+ try {
3474
+ hfLoadTags(token).then((tags) => {
3475
+ if (tags?.by_category) setWorkspaceTags(tags);
3476
+ }).catch(() => {
3477
+ });
3478
+ const entries = await hfLoadMetadata(token);
3477
3479
  if (!Array.isArray(entries) || entries.length === 0) return;
3478
3480
  setHfMetadata(entries);
3479
3481
  const skeletons = entries.map((e) => ({
@@ -3487,18 +3489,23 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3487
3489
  status: "done"
3488
3490
  }));
3489
3491
  setGalleryItems(skeletons);
3492
+ setHistory(skeletons);
3493
+ if (skeletons.length > 0) setCurrentResult(skeletons[0]);
3490
3494
  for (const entry of entries) {
3491
- hfLoadImageAsBase64(entry.id, hfToken).then((b64) => {
3495
+ hfLoadImageAsBase64(entry.id, token).then((b64) => {
3492
3496
  if (!b64) return;
3493
3497
  const prefix = `data:${entry.mimeType || "image/jpeg"};base64,`;
3494
- setGalleryItems((prev) => prev.map(
3495
- (g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g
3496
- ));
3498
+ setGalleryItems((prev) => prev.map((g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g));
3499
+ setHistory((prev) => prev.map((g) => g.id === entry.id ? { ...g, base64: prefix + b64 } : g));
3497
3500
  }).catch(() => {
3498
3501
  });
3499
3502
  }
3500
- }).catch(() => {
3501
- });
3503
+ } finally {
3504
+ setIsHfRefreshing(false);
3505
+ }
3506
+ }, []);
3507
+ useEffect5(() => {
3508
+ if (hfToken) loadFromHF(hfToken);
3502
3509
  }, [hfToken]);
3503
3510
  useEffect5(() => {
3504
3511
  if (!hfToken || !workspaceTags) return;
@@ -3849,7 +3856,10 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3849
3856
  ] })
3850
3857
  ] }),
3851
3858
  mobileTab === "browse" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col flex-1 min-h-0", children: [
3852
- /* @__PURE__ */ jsx20("div", { className: "flex border-b border-white/5 shrink-0", style: { height: 52 }, children: ["history", "gallery", "inspect"].map((tab) => /* @__PURE__ */ jsx20("button", { onClick: () => setActiveTab(tab), className: `flex-1 flex items-center justify-center gap-1.5 transition-colors text-[11px] font-bold uppercase tracking-wide ${activeTab === tab ? "text-white border-b-2 border-white" : "text-white/30"}`, children: /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : "info" }) }, tab)) }),
3859
+ /* @__PURE__ */ jsxs18("div", { className: "flex border-b border-white/5 shrink-0", style: { height: 52 }, children: [
3860
+ ["history", "gallery", "inspect"].map((tab) => /* @__PURE__ */ jsx20("button", { onClick: () => setActiveTab(tab), className: `flex-1 flex items-center justify-center gap-1.5 transition-colors text-[11px] font-bold uppercase tracking-wide ${activeTab === tab ? "text-white border-b-2 border-white" : "text-white/30"}`, children: /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : "info" }) }, tab)),
3861
+ hfToken && /* @__PURE__ */ jsx20("button", { onClick: () => loadFromHF(hfToken), disabled: isHfRefreshing, className: "w-12 flex items-center justify-center text-white/20 active:text-white transition-colors disabled:opacity-30", children: /* @__PURE__ */ jsx20("span", { className: `material-symbols-outlined text-[20px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) })
3862
+ ] }),
3853
3863
  /* @__PURE__ */ jsxs18("div", { className: "flex-1 overflow-hidden relative", children: [
3854
3864
  activeTab === "history" && /* @__PURE__ */ jsx20(HistoryPanel, { history, currentResultId: currentResult?.id || null, onSelect: (g) => {
3855
3865
  setCurrentResult(g);
@@ -4238,6 +4248,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4238
4248
  setActiveTab(tab);
4239
4249
  setIsRightCollapsed(false);
4240
4250
  }, className: `flex-1 flex items-center justify-center relative transition-colors ${activeTab === tab ? "text-white" : "text-white/20"}`, children: /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined text-[20px]", children: tab === "history" ? "history" : tab === "gallery" ? "photo_library" : tab === "inspect" ? "info" : tab === "setup" ? "settings" : tab === "sync" ? "cloud_sync" : "label" }) }, tab)) }),
4251
+ hfToken && /* @__PURE__ */ jsx20("button", { onClick: () => loadFromHF(hfToken), disabled: isHfRefreshing, className: "w-10 flex items-center justify-center text-white/20 hover:text-white/60 transition-colors disabled:opacity-30", children: /* @__PURE__ */ jsx20("span", { className: `material-symbols-outlined text-[18px]${isHfRefreshing ? " animate-spin" : ""}`, children: "sync" }) }),
4241
4252
  /* @__PURE__ */ jsx20("button", { onClick: () => setIsRightCollapsed(!isRightCollapsed), className: "w-10 flex items-center justify-center text-white/20 hover:text-white", children: /* @__PURE__ */ jsx20("span", { className: "material-symbols-outlined text-[18px]", children: isRightCollapsed ? "chevron_left" : "chevron_right" }) })
4242
4253
  ] }),
4243
4254
  !isRightCollapsed && /* @__PURE__ */ jsxs18("div", { className: "flex-1 overflow-hidden relative", children: [
@@ -4302,7 +4313,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4302
4313
  }
4303
4314
 
4304
4315
  // src/index.ts
4305
- var LIB_VERSION = "1.3.7";
4316
+ var LIB_VERSION = "1.3.9";
4306
4317
  export {
4307
4318
  AvatarArchitectApp,
4308
4319
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",