@rslsp1/fa-app-tools 2.0.50 → 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.50";
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.50";
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
@@ -4955,12 +4955,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4955
4955
  const [hfTokenInput, setHfTokenInput] = (0, import_react27.useState)(initialHfToken || "");
4956
4956
  const [isLoadingFromHF, setIsLoadingFromHF] = (0, import_react27.useState)(false);
4957
4957
  const [hfNamespaceLocal, setHfNamespaceLocal] = (0, import_react27.useState)(() => {
4958
+ const KNOWN = ["app.art-by-rolands.de/", "dev-app.art-by-rolands.de/"];
4959
+ const DEFAULT = "app.art-by-rolands.de/";
4958
4960
  try {
4959
4961
  const stored = localStorage.getItem("aa-hf-namespace");
4960
- if (stored) return stored;
4961
- return "app.art-by-rolands.de/";
4962
+ if (stored && KNOWN.includes(stored)) return stored;
4963
+ localStorage.setItem("aa-hf-namespace", DEFAULT);
4964
+ return DEFAULT;
4962
4965
  } catch {
4963
- return "";
4966
+ return DEFAULT;
4964
4967
  }
4965
4968
  });
4966
4969
  const [hfNamespaceFromServer, setHfNamespaceFromServer] = (0, import_react27.useState)(null);
@@ -5084,8 +5087,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
5084
5087
  return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
5085
5088
  });
5086
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));
5087
5094
  (async () => {
5088
- for (const entry of sortedEntries) {
5095
+ for (const entry of toLoad) {
5089
5096
  if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
5090
5097
  if (hfImageNotFoundRef.current.has(entry.id)) continue;
5091
5098
  try {
@@ -5340,6 +5347,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
5340
5347
  const group = groups.find((gr) => gr.prompt === currentResult.prompt);
5341
5348
  return group ? group.items : [];
5342
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]);
5343
5375
  const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
5344
5376
  const isGenerating = activeGenerationsCount > 0;
5345
5377
  useKeyboardNavigation(history, currentResult, setCurrentResult);
@@ -6709,7 +6741,7 @@ function FaApp({
6709
6741
  // src/index.ts
6710
6742
  init_hfStateService();
6711
6743
  init_hfStateService();
6712
- var LIB_VERSION = "2.0.50";
6744
+ var LIB_VERSION = "2.0.56";
6713
6745
  // Annotate the CommonJS export names for ESM import in node:
6714
6746
  0 && (module.exports = {
6715
6747
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -4271,12 +4271,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4271
4271
  const [hfTokenInput, setHfTokenInput] = useState20(initialHfToken || "");
4272
4272
  const [isLoadingFromHF, setIsLoadingFromHF] = useState20(false);
4273
4273
  const [hfNamespaceLocal, setHfNamespaceLocal] = useState20(() => {
4274
+ const KNOWN = ["app.art-by-rolands.de/", "dev-app.art-by-rolands.de/"];
4275
+ const DEFAULT = "app.art-by-rolands.de/";
4274
4276
  try {
4275
4277
  const stored = localStorage.getItem("aa-hf-namespace");
4276
- if (stored) return stored;
4277
- return "app.art-by-rolands.de/";
4278
+ if (stored && KNOWN.includes(stored)) return stored;
4279
+ localStorage.setItem("aa-hf-namespace", DEFAULT);
4280
+ return DEFAULT;
4278
4281
  } catch {
4279
- return "";
4282
+ return DEFAULT;
4280
4283
  }
4281
4284
  });
4282
4285
  const [hfNamespaceFromServer, setHfNamespaceFromServer] = useState20(null);
@@ -4400,8 +4403,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4400
4403
  return [...localOnly, ...merged].sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
4401
4404
  });
4402
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));
4403
4410
  (async () => {
4404
- for (const entry of sortedEntries) {
4411
+ for (const entry of toLoad) {
4405
4412
  if (galleryItemsRef.current.find((g) => g.id === entry.id)?.base64) continue;
4406
4413
  if (hfImageNotFoundRef.current.has(entry.id)) continue;
4407
4414
  try {
@@ -4656,6 +4663,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4656
4663
  const group = groups.find((gr) => gr.prompt === currentResult.prompt);
4657
4664
  return group ? group.items : [];
4658
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]);
4659
4691
  const hcStyle = highContrast ? { filter: "brightness(1.6) contrast(1.05)" } : void 0;
4660
4692
  const isGenerating = activeGenerationsCount > 0;
4661
4693
  useKeyboardNavigation(history, currentResult, setCurrentResult);
@@ -6023,7 +6055,7 @@ function FaApp({
6023
6055
  }
6024
6056
 
6025
6057
  // src/index.ts
6026
- var LIB_VERSION = "2.0.50";
6058
+ var LIB_VERSION = "2.0.56";
6027
6059
  export {
6028
6060
  AvatarArchitectApp,
6029
6061
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "2.0.50",
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",