@rslsp1/fa-app-tools 1.3.9 → 1.3.10

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.9";
482
+ declare const LIB_VERSION = "1.3.10";
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.9";
482
+ declare const LIB_VERSION = "1.3.10";
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
@@ -3747,11 +3747,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3747
3747
  };
3748
3748
  hfUploadImage(base64, genId, hfToken).catch(() => {
3749
3749
  });
3750
- setHfMetadata((prev) => {
3751
- const next = [...prev, entry];
3752
- hfSaveMetadata(next, hfToken).catch(() => {
3753
- });
3754
- return next;
3750
+ hfLoadMetadata(hfToken).then((existing) => {
3751
+ const ids = new Set((existing || []).map((e) => e.id));
3752
+ if (!ids.has(genId)) {
3753
+ const next = [...existing || [], entry];
3754
+ hfSaveMetadata(next, hfToken).catch(() => {
3755
+ });
3756
+ setHfMetadata(next);
3757
+ }
3758
+ }).catch(() => {
3755
3759
  });
3756
3760
  }
3757
3761
  } catch (err) {
@@ -3972,7 +3976,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3972
3976
  done++;
3973
3977
  onProgress(done, total);
3974
3978
  }
3975
- const metaEntries = gens.map((g) => ({
3979
+ const localEntries = gens.map((g) => ({
3976
3980
  id: g.id,
3977
3981
  prompt: g.prompt || void 0,
3978
3982
  seed: g.seed,
@@ -3981,8 +3985,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3981
3985
  timestamp: g.timestamp,
3982
3986
  mimeType: g.base64.startsWith("data:image/png") ? "image/png" : "image/jpeg"
3983
3987
  }));
3984
- await hfSaveMetadata(metaEntries, hfToken);
3985
- setHfMetadata(metaEntries);
3988
+ const existingMeta = await hfLoadMetadata(hfToken);
3989
+ const existingIds = new Set((existingMeta || []).map((e) => e.id));
3990
+ const newEntries = localEntries.filter((e) => !existingIds.has(e.id));
3991
+ const mergedMeta = [...existingMeta || [], ...newEntries];
3992
+ await hfSaveMetadata(mergedMeta, hfToken);
3993
+ setHfMetadata(mergedMeta);
3986
3994
  if (workspaceTags) await hfSaveTags(workspaceTags, hfToken);
3987
3995
  };
3988
3996
  const handleComputeSyncDiff = async () => {
@@ -4871,7 +4879,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4871
4879
 
4872
4880
  // src/index.ts
4873
4881
  init_hfStateService();
4874
- var LIB_VERSION = "1.3.9";
4882
+ var LIB_VERSION = "1.3.10";
4875
4883
  // Annotate the CommonJS export names for ESM import in node:
4876
4884
  0 && (module.exports = {
4877
4885
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -3190,11 +3190,15 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3190
3190
  };
3191
3191
  hfUploadImage(base64, genId, hfToken).catch(() => {
3192
3192
  });
3193
- setHfMetadata((prev) => {
3194
- const next = [...prev, entry];
3195
- hfSaveMetadata(next, hfToken).catch(() => {
3196
- });
3197
- return next;
3193
+ hfLoadMetadata(hfToken).then((existing) => {
3194
+ const ids = new Set((existing || []).map((e) => e.id));
3195
+ if (!ids.has(genId)) {
3196
+ const next = [...existing || [], entry];
3197
+ hfSaveMetadata(next, hfToken).catch(() => {
3198
+ });
3199
+ setHfMetadata(next);
3200
+ }
3201
+ }).catch(() => {
3198
3202
  });
3199
3203
  }
3200
3204
  } catch (err) {
@@ -3415,7 +3419,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3415
3419
  done++;
3416
3420
  onProgress(done, total);
3417
3421
  }
3418
- const metaEntries = gens.map((g) => ({
3422
+ const localEntries = gens.map((g) => ({
3419
3423
  id: g.id,
3420
3424
  prompt: g.prompt || void 0,
3421
3425
  seed: g.seed,
@@ -3424,8 +3428,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3424
3428
  timestamp: g.timestamp,
3425
3429
  mimeType: g.base64.startsWith("data:image/png") ? "image/png" : "image/jpeg"
3426
3430
  }));
3427
- await hfSaveMetadata(metaEntries, hfToken);
3428
- setHfMetadata(metaEntries);
3431
+ const existingMeta = await hfLoadMetadata(hfToken);
3432
+ const existingIds = new Set((existingMeta || []).map((e) => e.id));
3433
+ const newEntries = localEntries.filter((e) => !existingIds.has(e.id));
3434
+ const mergedMeta = [...existingMeta || [], ...newEntries];
3435
+ await hfSaveMetadata(mergedMeta, hfToken);
3436
+ setHfMetadata(mergedMeta);
3429
3437
  if (workspaceTags) await hfSaveTags(workspaceTags, hfToken);
3430
3438
  };
3431
3439
  const handleComputeSyncDiff = async () => {
@@ -4313,7 +4321,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4313
4321
  }
4314
4322
 
4315
4323
  // src/index.ts
4316
- var LIB_VERSION = "1.3.9";
4324
+ var LIB_VERSION = "1.3.10";
4317
4325
  export {
4318
4326
  AvatarArchitectApp,
4319
4327
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",