@rslsp1/fa-app-tools 1.3.1 → 1.3.3

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.
@@ -110,16 +110,14 @@ async function hfUploadProjectForm(zipBase64, name, token) {
110
110
  const bytes = new Uint8Array(binary.length);
111
111
  for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
112
112
  const blob = new Blob([bytes], { type: "application/zip" });
113
- const form = new FormData();
114
- form.append("files[]", blob, filename);
115
- const res = await fetch(
116
- `${HF_BASE}/api/datasets/${HF_REPO}/upload/main`,
117
- { method: "POST", headers: { Authorization: `Bearer ${token}` }, body: form }
118
- );
119
- if (!res.ok) {
120
- const err = await res.text().catch(() => "");
121
- throw new Error(`HF FormData upload failed: ${res.status} \u2014 ${err.slice(0, 300)}`);
122
- }
113
+ const { uploadFile } = await import("@huggingface/hub");
114
+ await uploadFile({
115
+ repo: { type: "dataset", name: HF_REPO },
116
+ credentials: { accessToken: token },
117
+ file: { path: filename, content: blob },
118
+ branch: "main",
119
+ commitTitle: `Upload ${filename}`
120
+ });
123
121
  return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
124
122
  }
125
123
  async function hfDeleteProject(path, token) {
@@ -7,7 +7,7 @@ import {
7
7
  hfUploadProject,
8
8
  hfUploadProjectForm,
9
9
  setHFToken
10
- } from "./chunk-4MIV2ED3.mjs";
10
+ } from "./chunk-JW5O3URT.mjs";
11
11
  export {
12
12
  HF_TOKEN_KEY,
13
13
  getHFToken,
package/dist/index.d.mts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.3.1";
451
+ declare const LIB_VERSION = "1.3.3";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, 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, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.d.ts CHANGED
@@ -448,6 +448,6 @@ declare function buildLoopInstruction(rounds: Array<{
448
448
  declare function autoLabel(index: number): string;
449
449
  declare function buildReferenceImageMediaIds(images: SelectedLabImage[]): string[];
450
450
 
451
- declare const LIB_VERSION = "1.3.1";
451
+ declare const LIB_VERSION = "1.3.3";
452
452
 
453
453
  export { AvatarArchitectApp, type AvatarArchitectAppProps, CollapsibleCard, CompactDropdown, type ExtractedCharacter, FaToolsBadge, type FlowSdk, GLOBAL_STYLES, type Generation, 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, groupGenerationsToLabItems, importProjectFromZip, injectXMPMetadata, interpretSdkError, parsePromptFile, parsePromptResponse, useKeyboardNavigation, useOnClickOutside };
package/dist/index.js CHANGED
@@ -379,16 +379,14 @@ async function hfUploadProjectForm(zipBase64, name, token) {
379
379
  const bytes = new Uint8Array(binary.length);
380
380
  for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
381
381
  const blob = new Blob([bytes], { type: "application/zip" });
382
- const form = new FormData();
383
- form.append("files[]", blob, filename);
384
- const res = await fetch(
385
- `${HF_BASE}/api/datasets/${HF_REPO}/upload/main`,
386
- { method: "POST", headers: { Authorization: `Bearer ${token}` }, body: form }
387
- );
388
- if (!res.ok) {
389
- const err = await res.text().catch(() => "");
390
- throw new Error(`HF FormData upload failed: ${res.status} \u2014 ${err.slice(0, 300)}`);
391
- }
382
+ const { uploadFile } = await import("@huggingface/hub");
383
+ await uploadFile({
384
+ repo: { type: "dataset", name: HF_REPO },
385
+ credentials: { accessToken: token },
386
+ file: { path: filename, content: blob },
387
+ branch: "main",
388
+ commitTitle: `Upload ${filename}`
389
+ });
392
390
  return { id: filename.replace(/\.zip$/, ""), name: filename.replace(/\.zip$/, ""), path: filename, size: bytes.length, isLfs: true };
393
391
  }
394
392
  async function hfDeleteProject(path, token) {
@@ -3929,42 +3927,32 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3929
3927
  !projectLoaded && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-white/20 text-[10px] text-center", children: "Baum, Bilder und Einstellungen wiederherstellen" })
3930
3928
  ] }),
3931
3929
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col items-center gap-2 w-full max-w-[280px]", children: [
3932
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3933
- "form",
3934
- {
3935
- onSubmit: (e) => {
3936
- e.preventDefault();
3937
- if (hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3938
- },
3939
- className: "flex gap-2 w-full",
3940
- autoComplete: "on",
3941
- children: [
3942
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { type: "text", name: "username", value: "hf-token", readOnly: true, autoComplete: "username", className: "hidden" }),
3943
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3944
- "input",
3945
- {
3946
- type: "password",
3947
- name: "password",
3948
- autoComplete: "current-password",
3949
- value: hfTokenInput,
3950
- onChange: (e) => setHfTokenInput(e.target.value),
3951
- placeholder: "HF Token (hf_\u2026)",
3952
- className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3953
- style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3954
- }
3955
- ),
3956
- hfTokenInput.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3957
- "button",
3958
- {
3959
- type: "submit",
3960
- className: "px-3 rounded-xl text-[11px] font-bold text-white",
3961
- style: { background: "#f59e0b", height: 44 },
3962
- children: "OK"
3963
- }
3964
- )
3965
- ]
3966
- }
3967
- ),
3930
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-2 w-full", children: [
3931
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3932
+ "input",
3933
+ {
3934
+ type: "password",
3935
+ value: hfTokenInput,
3936
+ onChange: (e) => setHfTokenInput(e.target.value),
3937
+ onKeyDown: (e) => {
3938
+ if (e.key === "Enter" && hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3939
+ },
3940
+ placeholder: "HF Token (hf_\u2026)",
3941
+ className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3942
+ style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3943
+ }
3944
+ ),
3945
+ hfTokenInput.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3946
+ "button",
3947
+ {
3948
+ type: "button",
3949
+ onClick: () => setHfToken(hfTokenInput.trim()),
3950
+ className: "px-3 rounded-xl text-[11px] font-bold text-white",
3951
+ style: { background: "#f59e0b", height: 44 },
3952
+ children: "OK"
3953
+ }
3954
+ )
3955
+ ] }),
3968
3956
  hfToken && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3969
3957
  "button",
3970
3958
  {
@@ -4630,7 +4618,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4630
4618
  }
4631
4619
 
4632
4620
  // src/index.ts
4633
- var LIB_VERSION = "1.3.1";
4621
+ var LIB_VERSION = "1.3.3";
4634
4622
  // Annotate the CommonJS export names for ESM import in node:
4635
4623
  0 && (module.exports = {
4636
4624
  AvatarArchitectApp,
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  hfDeleteProject,
8
8
  hfListProjects,
9
9
  hfUploadProjectForm
10
- } from "./chunk-4MIV2ED3.mjs";
10
+ } from "./chunk-JW5O3URT.mjs";
11
11
 
12
12
  // src/hooks/useOnClickOutside.ts
13
13
  import { useEffect } from "react";
@@ -1547,7 +1547,7 @@ var ProjectSyncTab = ({
1547
1547
  {
1548
1548
  onClick: async () => {
1549
1549
  try {
1550
- const { hfDownloadProject } = await import("./hfStateService-UKEBY3QR.mjs");
1550
+ const { hfDownloadProject } = await import("./hfStateService-UUDYKEMD.mjs");
1551
1551
  const file = await hfDownloadProject(p.path, hfToken);
1552
1552
  onHfLoad(file);
1553
1553
  } catch (e) {
@@ -3464,42 +3464,32 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3464
3464
  !projectLoaded && /* @__PURE__ */ jsx20("span", { className: "text-white/20 text-[10px] text-center", children: "Baum, Bilder und Einstellungen wiederherstellen" })
3465
3465
  ] }),
3466
3466
  /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center gap-2 w-full max-w-[280px]", children: [
3467
- /* @__PURE__ */ jsxs18(
3468
- "form",
3469
- {
3470
- onSubmit: (e) => {
3471
- e.preventDefault();
3472
- if (hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3473
- },
3474
- className: "flex gap-2 w-full",
3475
- autoComplete: "on",
3476
- children: [
3477
- /* @__PURE__ */ jsx20("input", { type: "text", name: "username", value: "hf-token", readOnly: true, autoComplete: "username", className: "hidden" }),
3478
- /* @__PURE__ */ jsx20(
3479
- "input",
3480
- {
3481
- type: "password",
3482
- name: "password",
3483
- autoComplete: "current-password",
3484
- value: hfTokenInput,
3485
- onChange: (e) => setHfTokenInput(e.target.value),
3486
- placeholder: "HF Token (hf_\u2026)",
3487
- className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3488
- style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3489
- }
3490
- ),
3491
- hfTokenInput.trim() && /* @__PURE__ */ jsx20(
3492
- "button",
3493
- {
3494
- type: "submit",
3495
- className: "px-3 rounded-xl text-[11px] font-bold text-white",
3496
- style: { background: "#f59e0b", height: 44 },
3497
- children: "OK"
3498
- }
3499
- )
3500
- ]
3501
- }
3502
- ),
3467
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 w-full", children: [
3468
+ /* @__PURE__ */ jsx20(
3469
+ "input",
3470
+ {
3471
+ type: "password",
3472
+ value: hfTokenInput,
3473
+ onChange: (e) => setHfTokenInput(e.target.value),
3474
+ onKeyDown: (e) => {
3475
+ if (e.key === "Enter" && hfTokenInput.trim()) setHfToken(hfTokenInput.trim());
3476
+ },
3477
+ placeholder: "HF Token (hf_\u2026)",
3478
+ className: "flex-1 rounded-xl px-3 text-[11px] font-mono outline-none",
3479
+ style: { height: 44, background: "rgba(255,255,255,0.05)", border: "1px solid rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.7)" }
3480
+ }
3481
+ ),
3482
+ hfTokenInput.trim() && /* @__PURE__ */ jsx20(
3483
+ "button",
3484
+ {
3485
+ type: "button",
3486
+ onClick: () => setHfToken(hfTokenInput.trim()),
3487
+ className: "px-3 rounded-xl text-[11px] font-bold text-white",
3488
+ style: { background: "#f59e0b", height: 44 },
3489
+ children: "OK"
3490
+ }
3491
+ )
3492
+ ] }),
3503
3493
  hfToken && /* @__PURE__ */ jsxs18(
3504
3494
  "button",
3505
3495
  {
@@ -3507,7 +3497,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
3507
3497
  onClick: async () => {
3508
3498
  setIsLoadingFromHF(true);
3509
3499
  try {
3510
- const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-UKEBY3QR.mjs");
3500
+ const { hfListProjects: hfListProjects2, hfDownloadProject } = await import("./hfStateService-UUDYKEMD.mjs");
3511
3501
  const projects = await hfListProjects2(hfToken);
3512
3502
  if (projects.length > 0) {
3513
3503
  const file = await hfDownloadProject(projects[0].path, hfToken);
@@ -4165,7 +4155,7 @@ function AvatarArchitectApp({ onGenerateImage, onGeneratePrompt, onDownload, onS
4165
4155
  }
4166
4156
 
4167
4157
  // src/index.ts
4168
- var LIB_VERSION = "1.3.1";
4158
+ var LIB_VERSION = "1.3.3";
4169
4159
  export {
4170
4160
  AvatarArchitectApp,
4171
4161
  CollapsibleCard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,6 +24,7 @@
24
24
  "react": ">=18"
25
25
  },
26
26
  "dependencies": {
27
+ "@huggingface/hub": "^2.13.0",
27
28
  "jszip": "^3.10.1"
28
29
  },
29
30
  "devDependencies": {