@rslsp1/fa-app-tools 2.0.54 → 2.0.56

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
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
641
641
  declare function findForks(dag: Dag): DagFork[];
642
642
  declare function topoSort(events: HFEvent[]): HFEvent[];
643
643
 
644
- declare const LIB_VERSION = "2.0.54";
644
+ declare const LIB_VERSION = "2.0.56";
645
645
 
646
646
  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, LabFrameExtractor, type LabFrameExtractorProps, 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, ServerTab, 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
@@ -641,6 +641,6 @@ declare function findTips(dag: Dag): number[];
641
641
  declare function findForks(dag: Dag): DagFork[];
642
642
  declare function topoSort(events: HFEvent[]): HFEvent[];
643
643
 
644
- declare const LIB_VERSION = "2.0.54";
644
+ declare const LIB_VERSION = "2.0.56";
645
645
 
646
646
  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, LabFrameExtractor, type LabFrameExtractorProps, 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, ServerTab, 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
@@ -5087,8 +5087,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
5087
5087
  return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
5088
5088
  });
5089
5089
  const sortedEntries = [...hfState.metadata].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
5090
+ const galleryRepIds = new Set(groupByPrompt(skeletons).slice(0, 20).map((g) => g.representative.id));
5091
+ const historyIds = new Set(sortedEntries.slice(0, 20).map((e) => e.id));
5092
+ const initialIds = /* @__PURE__ */ new Set([...galleryRepIds, ...historyIds]);
5093
+ const toLoad = sortedEntries.filter((e) => initialIds.has(e.id));
5090
5094
  (async () => {
5091
- for (const entry of sortedEntries) {
5095
+ for (const entry of toLoad) {
5092
5096
  if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
5093
5097
  if (hfImageNotFoundRef.current.has(entry.id)) continue;
5094
5098
  try {
@@ -5343,6 +5347,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
5343
5347
  const group = groups.find((gr) => gr.prompt === currentResult.prompt);
5344
5348
  return group ? group.items : [];
5345
5349
  }, [galleryItems, currentResult?.prompt]);
5350
+ (0, import_react27.useEffect)(() => {
5351
+ if (!currentResult?.prompt || !hfToken || !effectiveNamespace || !hfState) return;
5352
+ const siblings = galleryItemsRef.current.filter(
5353
+ (g) => g.prompt === currentResult.prompt && !g.base64 && !hfImageNotFoundRef.current.has(g.id)
5354
+ );
5355
+ if (!siblings.length) return;
5356
+ (async () => {
5357
+ for (const sib of siblings) {
5358
+ const meta = hfState.metadata.find((m) => m.id === sib.id);
5359
+ if (!meta) continue;
5360
+ try {
5361
+ const b64 = await hfLoadImageAsBase64(sib.id, hfToken, effectiveNamespace, meta.filename, void 0, meta.mimeType, meta.hasThumb);
5362
+ if (!b64) {
5363
+ hfImageNotFoundRef.current.set(sib.id, Date.now());
5364
+ continue;
5365
+ }
5366
+ const prefix = `data:${meta.mimeType || "image/jpeg"};base64,`;
5367
+ setGalleryItems((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
5368
+ setHistory((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
5369
+ } catch {
5370
+ hfImageNotFoundRef.current.set(sib.id, Date.now());
5371
+ }
5372
+ }
5373
+ })();
5374
+ }, [currentResult?.id, currentResult?.prompt]);
5346
5375
  const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
5347
5376
  const isGenerating = activeGenerationsCount > 0;
5348
5377
  useKeyboardNavigation(history, currentResult, setCurrentResult);
@@ -6712,7 +6741,7 @@ function FaApp({
6712
6741
  // src/index.ts
6713
6742
  init_hfStateService();
6714
6743
  init_hfStateService();
6715
- var LIB_VERSION = "2.0.54";
6744
+ var LIB_VERSION = "2.0.56";
6716
6745
  // Annotate the CommonJS export names for ESM import in node:
6717
6746
  0 && (module.exports = {
6718
6747
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -4403,8 +4403,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4403
4403
  return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
4404
4404
  });
4405
4405
  const sortedEntries = [...hfState.metadata].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
4406
+ const galleryRepIds = new Set(groupByPrompt(skeletons).slice(0, 20).map((g) => g.representative.id));
4407
+ const historyIds = new Set(sortedEntries.slice(0, 20).map((e) => e.id));
4408
+ const initialIds = /* @__PURE__ */ new Set([...galleryRepIds, ...historyIds]);
4409
+ const toLoad = sortedEntries.filter((e) => initialIds.has(e.id));
4406
4410
  (async () => {
4407
- for (const entry of sortedEntries) {
4411
+ for (const entry of toLoad) {
4408
4412
  if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
4409
4413
  if (hfImageNotFoundRef.current.has(entry.id)) continue;
4410
4414
  try {
@@ -4659,6 +4663,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4659
4663
  const group = groups.find((gr) => gr.prompt === currentResult.prompt);
4660
4664
  return group ? group.items : [];
4661
4665
  }, [galleryItems, currentResult?.prompt]);
4666
+ useEffect7(() => {
4667
+ if (!currentResult?.prompt || !hfToken || !effectiveNamespace || !hfState) return;
4668
+ const siblings = galleryItemsRef.current.filter(
4669
+ (g) => g.prompt === currentResult.prompt && !g.base64 && !hfImageNotFoundRef.current.has(g.id)
4670
+ );
4671
+ if (!siblings.length) return;
4672
+ (async () => {
4673
+ for (const sib of siblings) {
4674
+ const meta = hfState.metadata.find((m) => m.id === sib.id);
4675
+ if (!meta) continue;
4676
+ try {
4677
+ const b64 = await hfLoadImageAsBase64(sib.id, hfToken, effectiveNamespace, meta.filename, void 0, meta.mimeType, meta.hasThumb);
4678
+ if (!b64) {
4679
+ hfImageNotFoundRef.current.set(sib.id, Date.now());
4680
+ continue;
4681
+ }
4682
+ const prefix = `data:${meta.mimeType || "image/jpeg"};base64,`;
4683
+ setGalleryItems((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
4684
+ setHistory((prev) => prev.map((g) => g.id === sib.id && !g.base64 ? { ...g, base64: prefix + b64 } : g));
4685
+ } catch {
4686
+ hfImageNotFoundRef.current.set(sib.id, Date.now());
4687
+ }
4688
+ }
4689
+ })();
4690
+ }, [currentResult?.id, currentResult?.prompt]);
4662
4691
  const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
4663
4692
  const isGenerating = activeGenerationsCount > 0;
4664
4693
  useKeyboardNavigation(history, currentResult, setCurrentResult);
@@ -6026,7 +6055,7 @@ function FaApp({
6026
6055
  }
6027
6056
 
6028
6057
  // src/index.ts
6029
- var LIB_VERSION = "2.0.54";
6058
+ var LIB_VERSION = "2.0.56";
6030
6059
  export {
6031
6060
  AvatarArchitectApp,
6032
6061
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "2.0.54",
3
+ "version": "2.0.56",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",