@rslsp1/fa-app-tools 0.1.7 → 0.1.9

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
@@ -86,16 +86,16 @@ interface InspectPanelProps {
86
86
  declare const InspectPanel: React.FC<InspectPanelProps>;
87
87
 
88
88
  interface SetupPanelProps {
89
- onWorkspaceImport: (e: React.ChangeEvent<HTMLInputElement>) => void;
89
+ onWorkspaceImport: (file: File) => void;
90
90
  onProjectExport: () => void;
91
- onProjectImport: (e: React.ChangeEvent<HTMLInputElement>) => void;
91
+ onProjectImport: (file: File) => void;
92
92
  projectActionState: 'idle' | 'working' | 'done' | 'error';
93
93
  }
94
94
  declare const SetupPanel: React.FC<SetupPanelProps>;
95
95
 
96
96
  interface MediaLibraryProps {
97
97
  items: Generation[];
98
- onImport: (files: FileList) => void;
98
+ onImport: () => void;
99
99
  onDelete: (id: string) => void;
100
100
  onSelect: (item: Generation) => void;
101
101
  onToggleSelection: (id: string) => void;
package/dist/index.d.ts CHANGED
@@ -86,16 +86,16 @@ interface InspectPanelProps {
86
86
  declare const InspectPanel: React.FC<InspectPanelProps>;
87
87
 
88
88
  interface SetupPanelProps {
89
- onWorkspaceImport: (e: React.ChangeEvent<HTMLInputElement>) => void;
89
+ onWorkspaceImport: (file: File) => void;
90
90
  onProjectExport: () => void;
91
- onProjectImport: (e: React.ChangeEvent<HTMLInputElement>) => void;
91
+ onProjectImport: (file: File) => void;
92
92
  projectActionState: 'idle' | 'working' | 'done' | 'error';
93
93
  }
94
94
  declare const SetupPanel: React.FC<SetupPanelProps>;
95
95
 
96
96
  interface MediaLibraryProps {
97
97
  items: Generation[];
98
- onImport: (files: FileList) => void;
98
+ onImport: () => void;
99
99
  onDelete: (id: string) => void;
100
100
  onSelect: (item: Generation) => void;
101
101
  onToggleSelection: (id: string) => void;
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -273,7 +263,11 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
273
263
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-[9px] text-white/30 px-2 italic", children: "Importiere Kategorien und Tags als JSON-Struktur." })
274
264
  ] }),
275
265
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PillButton, { variant: "outline", icon: "upload_file", onClick: () => workspaceInputRef.current?.click(), children: "Tags laden (.json)" }),
276
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ref: workspaceInputRef, type: "file", accept: ".json", className: "hidden", onChange: onWorkspaceImport })
266
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ref: workspaceInputRef, type: "file", accept: ".json", className: "hidden", onChange: (e) => {
267
+ const f = e.target.files?.[0];
268
+ if (f) onWorkspaceImport(f);
269
+ e.target.value = "";
270
+ } })
277
271
  ] }),
278
272
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-4", children: [
279
273
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1", children: [
@@ -284,8 +278,9 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
284
278
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PillButton, { variant: "filled", icon: "download", onClick: onProjectExport, loading: projectActionState === "working", children: "Exportieren (.zip)" }),
285
279
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PillButton, { variant: "outline", icon: "upload", onClick: () => projectInputRef.current?.click(), children: "Projekt laden (.zip)" }),
286
280
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ref: projectInputRef, type: "file", accept: ".zip", className: "hidden", onChange: (e) => {
287
- onProjectImport(e);
288
- if (e.target) e.target.value = "";
281
+ const f = e.target.files?.[0];
282
+ if (f) onProjectImport(f);
283
+ e.target.value = "";
289
284
  } })
290
285
  ] })
291
286
  ] }),
@@ -304,12 +299,10 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
304
299
  };
305
300
 
306
301
  // src/components/MediaLibrary.tsx
307
- var import_react7 = __toESM(require("react"));
308
- var import_react8 = require("motion/react");
302
+ var import_react7 = require("motion/react");
309
303
  var import_jsx_runtime8 = require("react/jsx-runtime");
310
304
  var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, onBatchDownload }) => {
311
305
  const selectedCount = items.filter((i) => i.selectedForExport).length;
312
- const fileInputRef = import_react7.default.useRef(null);
313
306
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col h-full overflow-hidden", children: [
314
307
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col p-4 border-b border-white/5 gap-3 bg-black/20", children: [
315
308
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
@@ -320,18 +313,12 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
320
313
  " Assets geladen"
321
314
  ] })
322
315
  ] }),
323
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { onClick: () => fileInputRef.current?.click(), className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-400 text-white rounded-lg text-[10px] font-bold uppercase transition-all shadow-[0_0_15px_rgba(59,130,246,0.3)]", type: "button", children: [
316
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", onClick: () => onImport?.(), className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-400 text-white rounded-lg text-[10px] font-bold uppercase transition-all shadow-[0_0_15px_rgba(59,130,246,0.3)]", children: [
324
317
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "material-symbols-outlined text-[16px]", children: "add_photo_alternate" }),
325
318
  "Laden"
326
- ] }),
327
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ref: fileInputRef, type: "file", accept: "image/*", multiple: true, className: "hidden", onChange: (e) => {
328
- if (e.target.files?.length) {
329
- onImport(e.target.files);
330
- e.target.value = "";
331
- }
332
- } })
319
+ ] })
333
320
  ] }),
334
- selectedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react8.motion.div, { initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, className: "flex items-center justify-between bg-blue-500/10 border border-blue-500/20 p-2 rounded-xl", children: [
321
+ selectedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.motion.div, { initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, className: "flex items-center justify-between bg-blue-500/10 border border-blue-500/20 p-2 rounded-xl", children: [
335
322
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-[9px] font-bold uppercase text-blue-400 ml-1", children: [
336
323
  selectedCount,
337
324
  " ausgew\xE4hlt"
@@ -348,7 +335,7 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
348
335
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[12px] font-bold uppercase tracking-widest", children: "Keine Medien" }),
349
336
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[10px] italic", children: "Importiere Assets aus deinem Projekt." })
350
337
  ] })
351
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-3 pb-10", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react8.motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, className: `relative aspect-square group/item rounded-xl overflow-hidden border transition-all bg-white/5 cursor-pointer shadow-lg ${item.selectedForExport ? "border-blue-500 shadow-[0_0_15px_rgba(59,130,246,0.2)]" : "border-white/10 opacity-70 hover:opacity-100"}`, onClick: () => onSelect?.(item), children: [
338
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "grid grid-cols-2 gap-3 pb-10", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react7.motion.div, { initial: { opacity: 0, scale: 0.9 }, animate: { opacity: 1, scale: 1 }, className: `relative aspect-square group/item rounded-xl overflow-hidden border transition-all bg-white/5 cursor-pointer shadow-lg ${item.selectedForExport ? "border-blue-500 shadow-[0_0_15px_rgba(59,130,246,0.2)]" : "border-white/10 opacity-70 hover:opacity-100"}`, onClick: () => onSelect?.(item), children: [
352
339
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: item.base64?.startsWith("data:") ? item.base64 : `data:image/png;base64,${item.base64}`, className: "w-full h-full object-cover transition-transform duration-500 group-hover/item:scale-110", alt: item.prompt }),
353
340
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: `absolute top-2 left-2 w-5 h-5 rounded-md border flex items-center justify-center transition-all z-30 pointer-events-auto ${item.selectedForExport ? "bg-blue-500 border-blue-400" : "bg-black/60 border-white/20"}`, onClick: (e) => {
354
341
  e.stopPropagation();
@@ -367,10 +354,10 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
367
354
  };
368
355
 
369
356
  // src/components/ListView.tsx
370
- var import_react9 = require("react");
357
+ var import_react8 = require("react");
371
358
  var import_jsx_runtime9 = require("react/jsx-runtime");
372
359
  var ListNode = ({ node, depth, onNodeChange, onAddChild, onDeleteNode, onMoveNode, onIndentNode, onOutdentNode, onAddSibling, isActive, isInPath, onFocus, onGenerate, onGenerateBranch, onGenerateSubtree, isGenerating, isCollapsed, toggleCollapse, renderNode, children }) => {
373
- const inputRef = (0, import_react9.useRef)(null);
360
+ const inputRef = (0, import_react8.useRef)(null);
374
361
  const hasChildren = children && children.length > 0;
375
362
  const handleKeyDown = (e) => {
376
363
  if (e.key === "Tab") {
@@ -398,7 +385,7 @@ var ListNode = ({ node, depth, onNodeChange, onAddChild, onDeleteNode, onMoveNod
398
385
  onMoveNode(node.id, "down");
399
386
  }
400
387
  };
401
- (0, import_react9.useEffect)(() => {
388
+ (0, import_react8.useEffect)(() => {
402
389
  if (isActive && inputRef.current) inputRef.current.focus();
403
390
  }, [isActive]);
404
391
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col w-full", children: [
@@ -432,7 +419,7 @@ var ListNode = ({ node, depth, onNodeChange, onAddChild, onDeleteNode, onMoveNod
432
419
  ] });
433
420
  };
434
421
  function ListView({ nodes, edges, onNodeChange, onAddChild, onDeleteNode, onMoveNode, onIndentNode, onOutdentNode, onAddSibling, focusedNodeId, onFocus, activePath, onGenerate, onGenerateBranch, onGenerateSubtree, isGeneratingNodeId }) {
435
- const [collapsed, setCollapsed] = (0, import_react9.useState)(/* @__PURE__ */ new Set());
422
+ const [collapsed, setCollapsed] = (0, import_react8.useState)(/* @__PURE__ */ new Set());
436
423
  const toggleCollapse = (id) => {
437
424
  setCollapsed((prev) => {
438
425
  const next = new Set(prev);
package/dist/index.mjs CHANGED
@@ -228,7 +228,11 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
228
228
  /* @__PURE__ */ jsx7("p", { className: "text-[9px] text-white/30 px-2 italic", children: "Importiere Kategorien und Tags als JSON-Struktur." })
229
229
  ] }),
230
230
  /* @__PURE__ */ jsx7(PillButton, { variant: "outline", icon: "upload_file", onClick: () => workspaceInputRef.current?.click(), children: "Tags laden (.json)" }),
231
- /* @__PURE__ */ jsx7("input", { ref: workspaceInputRef, type: "file", accept: ".json", className: "hidden", onChange: onWorkspaceImport })
231
+ /* @__PURE__ */ jsx7("input", { ref: workspaceInputRef, type: "file", accept: ".json", className: "hidden", onChange: (e) => {
232
+ const f = e.target.files?.[0];
233
+ if (f) onWorkspaceImport(f);
234
+ e.target.value = "";
235
+ } })
232
236
  ] }),
233
237
  /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-4", children: [
234
238
  /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1", children: [
@@ -239,8 +243,9 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
239
243
  /* @__PURE__ */ jsx7(PillButton, { variant: "filled", icon: "download", onClick: onProjectExport, loading: projectActionState === "working", children: "Exportieren (.zip)" }),
240
244
  /* @__PURE__ */ jsx7(PillButton, { variant: "outline", icon: "upload", onClick: () => projectInputRef.current?.click(), children: "Projekt laden (.zip)" }),
241
245
  /* @__PURE__ */ jsx7("input", { ref: projectInputRef, type: "file", accept: ".zip", className: "hidden", onChange: (e) => {
242
- onProjectImport(e);
243
- if (e.target) e.target.value = "";
246
+ const f = e.target.files?.[0];
247
+ if (f) onProjectImport(f);
248
+ e.target.value = "";
244
249
  } })
245
250
  ] })
246
251
  ] }),
@@ -259,12 +264,10 @@ var SetupPanel = ({ onWorkspaceImport, onProjectExport, onProjectImport, project
259
264
  };
260
265
 
261
266
  // src/components/MediaLibrary.tsx
262
- import React3 from "react";
263
267
  import { motion as motion4 } from "motion/react";
264
268
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
265
269
  var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, onBatchDownload }) => {
266
270
  const selectedCount = items.filter((i) => i.selectedForExport).length;
267
- const fileInputRef = React3.useRef(null);
268
271
  return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col h-full overflow-hidden", children: [
269
272
  /* @__PURE__ */ jsxs6("div", { className: "flex flex-col p-4 border-b border-white/5 gap-3 bg-black/20", children: [
270
273
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between", children: [
@@ -275,16 +278,10 @@ var MediaLibrary = ({ items, onImport, onDelete, onSelect, onToggleSelection, on
275
278
  " Assets geladen"
276
279
  ] })
277
280
  ] }),
278
- /* @__PURE__ */ jsxs6("button", { onClick: () => fileInputRef.current?.click(), className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-400 text-white rounded-lg text-[10px] font-bold uppercase transition-all shadow-[0_0_15px_rgba(59,130,246,0.3)]", type: "button", children: [
281
+ /* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => onImport?.(), className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-400 text-white rounded-lg text-[10px] font-bold uppercase transition-all shadow-[0_0_15px_rgba(59,130,246,0.3)]", children: [
279
282
  /* @__PURE__ */ jsx8("span", { className: "material-symbols-outlined text-[16px]", children: "add_photo_alternate" }),
280
283
  "Laden"
281
- ] }),
282
- /* @__PURE__ */ jsx8("input", { ref: fileInputRef, type: "file", accept: "image/*", multiple: true, className: "hidden", onChange: (e) => {
283
- if (e.target.files?.length) {
284
- onImport(e.target.files);
285
- e.target.value = "";
286
- }
287
- } })
284
+ ] })
288
285
  ] }),
289
286
  selectedCount > 0 && /* @__PURE__ */ jsxs6(motion4.div, { initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, className: "flex items-center justify-between bg-blue-500/10 border border-blue-500/20 p-2 rounded-xl", children: [
290
287
  /* @__PURE__ */ jsxs6("span", { className: "text-[9px] font-bold uppercase text-blue-400 ml-1", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",