@rslsp1/fa-app-tools 1.3.10 → 1.3.11

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.10";
482
+ declare const LIB_VERSION = "1.3.11";
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.10";
482
+ declare const LIB_VERSION = "1.3.11";
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
@@ -3991,7 +3991,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3991
3991
  const mergedMeta = [...existingMeta || [], ...newEntries];
3992
3992
  await hfSaveMetadata(mergedMeta, hfToken);
3993
3993
  setHfMetadata(mergedMeta);
3994
- if (workspaceTags) await hfSaveTags(workspaceTags, hfToken);
3994
+ if (workspaceTags) {
3995
+ const remoteTags = await hfLoadTags(hfToken).catch(() => null);
3996
+ const mergedTags = mergeWorkspaceTags(workspaceTags, remoteTags);
3997
+ await hfSaveTags(mergedTags, hfToken);
3998
+ setWorkspaceTags(mergedTags);
3999
+ }
3995
4000
  };
3996
4001
  const handleComputeSyncDiff = async () => {
3997
4002
  if (!onFetchServerProjects || !onServerLoad) throw new Error("Server nicht konfiguriert");
@@ -4072,12 +4077,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4072
4077
  (0, import_react21.useEffect)(() => {
4073
4078
  if (hfToken) loadFromHF(hfToken);
4074
4079
  }, [hfToken]);
4080
+ const mergeWorkspaceTags = (local, remote) => {
4081
+ if (!remote?.by_category) return local;
4082
+ const merged = {};
4083
+ const allCategories = /* @__PURE__ */ new Set([...Object.keys(local.by_category), ...Object.keys(remote.by_category)]);
4084
+ for (const cat of allCategories) {
4085
+ const localTags = local.by_category[cat] || [];
4086
+ const remoteTags = remote.by_category[cat] || [];
4087
+ const localValues = new Set(localTags.map((t) => t.value));
4088
+ const onlyInRemote = remoteTags.filter((t) => !localValues.has(t.value));
4089
+ merged[cat] = [...localTags, ...onlyInRemote];
4090
+ }
4091
+ const all = Object.entries(merged).flatMap(([cat, tags]) => tags.map((t) => ({ ...t, category: cat })));
4092
+ return { by_category: merged, all };
4093
+ };
4075
4094
  (0, import_react21.useEffect)(() => {
4076
4095
  if (!hfToken || !workspaceTags) return;
4077
4096
  if (hfTagSaveTimer.current) clearTimeout(hfTagSaveTimer.current);
4078
- hfTagSaveTimer.current = setTimeout(() => {
4079
- hfSaveTags(workspaceTags, hfToken).catch(() => {
4097
+ hfTagSaveTimer.current = setTimeout(async () => {
4098
+ const remote = await hfLoadTags(hfToken).catch(() => null);
4099
+ const merged = mergeWorkspaceTags(workspaceTags, remote);
4100
+ await hfSaveTags(merged, hfToken).catch(() => {
4080
4101
  });
4102
+ if (Object.values(merged.by_category).some(
4103
+ (tags, i) => tags.length !== Object.values(workspaceTags.by_category)[i]?.length
4104
+ )) setWorkspaceTags(merged);
4081
4105
  }, 1500);
4082
4106
  return () => {
4083
4107
  if (hfTagSaveTimer.current) clearTimeout(hfTagSaveTimer.current);
@@ -4879,7 +4903,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4879
4903
 
4880
4904
  // src/index.ts
4881
4905
  init_hfStateService();
4882
- var LIB_VERSION = "1.3.10";
4906
+ var LIB_VERSION = "1.3.11";
4883
4907
  // Annotate the CommonJS export names for ESM import in node:
4884
4908
  0 && (module.exports = {
4885
4909
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -3434,7 +3434,12 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3434
3434
  const mergedMeta = [...existingMeta || [], ...newEntries];
3435
3435
  await hfSaveMetadata(mergedMeta, hfToken);
3436
3436
  setHfMetadata(mergedMeta);
3437
- if (workspaceTags) await hfSaveTags(workspaceTags, hfToken);
3437
+ if (workspaceTags) {
3438
+ const remoteTags = await hfLoadTags(hfToken).catch(() => null);
3439
+ const mergedTags = mergeWorkspaceTags(workspaceTags, remoteTags);
3440
+ await hfSaveTags(mergedTags, hfToken);
3441
+ setWorkspaceTags(mergedTags);
3442
+ }
3438
3443
  };
3439
3444
  const handleComputeSyncDiff = async () => {
3440
3445
  if (!onFetchServerProjects || !onServerLoad) throw new Error("Server nicht konfiguriert");
@@ -3515,12 +3520,31 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3515
3520
  useEffect5(() => {
3516
3521
  if (hfToken) loadFromHF(hfToken);
3517
3522
  }, [hfToken]);
3523
+ const mergeWorkspaceTags = (local, remote) => {
3524
+ if (!remote?.by_category) return local;
3525
+ const merged = {};
3526
+ const allCategories = /* @__PURE__ */ new Set([...Object.keys(local.by_category), ...Object.keys(remote.by_category)]);
3527
+ for (const cat of allCategories) {
3528
+ const localTags = local.by_category[cat] || [];
3529
+ const remoteTags = remote.by_category[cat] || [];
3530
+ const localValues = new Set(localTags.map((t) => t.value));
3531
+ const onlyInRemote = remoteTags.filter((t) => !localValues.has(t.value));
3532
+ merged[cat] = [...localTags, ...onlyInRemote];
3533
+ }
3534
+ const all = Object.entries(merged).flatMap(([cat, tags]) => tags.map((t) => ({ ...t, category: cat })));
3535
+ return { by_category: merged, all };
3536
+ };
3518
3537
  useEffect5(() => {
3519
3538
  if (!hfToken || !workspaceTags) return;
3520
3539
  if (hfTagSaveTimer.current) clearTimeout(hfTagSaveTimer.current);
3521
- hfTagSaveTimer.current = setTimeout(() => {
3522
- hfSaveTags(workspaceTags, hfToken).catch(() => {
3540
+ hfTagSaveTimer.current = setTimeout(async () => {
3541
+ const remote = await hfLoadTags(hfToken).catch(() => null);
3542
+ const merged = mergeWorkspaceTags(workspaceTags, remote);
3543
+ await hfSaveTags(merged, hfToken).catch(() => {
3523
3544
  });
3545
+ if (Object.values(merged.by_category).some(
3546
+ (tags, i) => tags.length !== Object.values(workspaceTags.by_category)[i]?.length
3547
+ )) setWorkspaceTags(merged);
3524
3548
  }, 1500);
3525
3549
  return () => {
3526
3550
  if (hfTagSaveTimer.current) clearTimeout(hfTagSaveTimer.current);
@@ -4321,7 +4345,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4321
4345
  }
4322
4346
 
4323
4347
  // src/index.ts
4324
- var LIB_VERSION = "1.3.10";
4348
+ var LIB_VERSION = "1.3.11";
4325
4349
  export {
4326
4350
  AvatarArchitectApp,
4327
4351
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",