@teamflojo/floimg-studio-ui 0.10.5 → 0.11.0

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/README.md CHANGED
@@ -73,6 +73,37 @@ import { Toolbar, type ToolbarProps } from "@teamflojo/floimg-studio-ui";
73
73
  />;
74
74
  ```
75
75
 
76
+ ## Storage Adapter
77
+
78
+ For custom storage backends (e.g., S3, cloud storage), provide a `StorageAdapter`:
79
+
80
+ ```tsx
81
+ import { StorageAdapterProvider, ossStorageAdapter } from "@teamflojo/floimg-studio-ui";
82
+ import type { StorageAdapter } from "@teamflojo/floimg-studio-shared";
83
+
84
+ // Use the built-in OSS adapter (local filesystem)
85
+ <StorageAdapterProvider adapter={ossStorageAdapter}>
86
+ <App />
87
+ </StorageAdapterProvider>;
88
+
89
+ // Or implement your own
90
+ const myAdapter: StorageAdapter = {
91
+ async upload(file: File) {
92
+ // Upload to your storage backend
93
+ return { reference: "id", filename: file.name, mime: file.type, size: file.size };
94
+ },
95
+ getPreviewUrl(reference: string) {
96
+ return `/my-storage/${reference}`;
97
+ },
98
+ };
99
+
100
+ <StorageAdapterProvider adapter={myAdapter}>
101
+ <App />
102
+ </StorageAdapterProvider>;
103
+ ```
104
+
105
+ The adapter handles Input node file uploads. Without a provider, the default `/api/uploads` endpoint is used.
106
+
76
107
  ## State Management
77
108
 
78
109
  Access workflow state with Zustand:
@@ -52,20 +52,6 @@ export interface ImageInfo {
52
52
  export declare function listImages(): Promise<ImageInfo[]>;
53
53
  export declare function getImageUrl(id: string): string;
54
54
  export declare function getImageWorkflow(id: string): Promise<ImageMetadata | null>;
55
- export interface UploadInfo {
56
- id: string;
57
- filename: string;
58
- mime: string;
59
- size: number;
60
- createdAt: number;
61
- }
62
- export declare function uploadImage(file: File): Promise<UploadInfo>;
63
- export declare function listUploads(): Promise<UploadInfo[]>;
64
- export declare function getUploadThumbnail(id: string): Promise<{
65
- dataUrl: string;
66
- }>;
67
- export declare function deleteUpload(id: string): Promise<void>;
68
- export declare function getUploadBlobUrl(id: string): string;
69
55
  export declare function getInputNodes(): Promise<NodeDefinition[]>;
70
56
  export interface ImportResult {
71
57
  success: boolean;
@@ -0,0 +1,44 @@
1
+ import { GeneratedWorkflowData } from '@teamflojo/floimg-studio-shared';
2
+ import { CanvasSnapshot, ExecutionContext } from '../stores/aiChatStore';
3
+
4
+ /**
5
+ * Analytics data for successful workflow generation
6
+ */
7
+ export interface GenerationSuccessData {
8
+ nodeCount: number;
9
+ hasAINodes: boolean;
10
+ promptLength: number;
11
+ isConversation: boolean;
12
+ }
13
+ /**
14
+ * Analytics data for failed workflow generation
15
+ */
16
+ export interface GenerationFailedData {
17
+ errorType: "invalid_node_type" | "generation_error" | "rate_limit" | "network" | "unknown";
18
+ promptLength: number;
19
+ isConversation: boolean;
20
+ }
21
+ interface AIPanelProps {
22
+ onApplyWorkflow: (workflow: GeneratedWorkflowData) => void;
23
+ /** Apply workflow as a new workflow (fork) - clears workflow name/ID */
24
+ onApplyAsNewWorkflow?: (workflow: GeneratedWorkflowData) => void;
25
+ /** Current canvas state for AI context */
26
+ canvasSnapshot?: CanvasSnapshot;
27
+ /** Last execution results for AI context */
28
+ executionContext?: ExecutionContext;
29
+ /** Called when workflow generation succeeds (for analytics) */
30
+ onGenerationSuccess?: (data: GenerationSuccessData) => void;
31
+ /** Called when workflow generation fails (for analytics) */
32
+ onGenerationFailed?: (data: GenerationFailedData) => void;
33
+ }
34
+ /**
35
+ * AIPanel - Persistent slide-out panel for AI workflow generation
36
+ *
37
+ * Features:
38
+ * - Stays open while editing canvas
39
+ * - Maintains conversation history
40
+ * - Aware of current canvas state
41
+ * - Includes execution results context
42
+ */
43
+ export declare function AIPanel({ onApplyWorkflow, onApplyAsNewWorkflow, canvasSnapshot, executionContext, onGenerationSuccess, onGenerationFailed, }: AIPanelProps): import("react/jsx-runtime").JSX.Element | null;
44
+ export {};
@@ -0,0 +1,13 @@
1
+ import { OperationConflict, ResolvedConflict } from '@teamflojo/floimg-studio-shared';
2
+
3
+ interface ConflictResolutionModalProps {
4
+ conflicts: OperationConflict[];
5
+ onResolve: (resolved: ResolvedConflict[]) => void;
6
+ onCancel: () => void;
7
+ }
8
+ /**
9
+ * Modal for resolving conflicts between user edits and AI operations.
10
+ * Shows each conflict with options to keep user's changes, accept AI's changes, or skip.
11
+ */
12
+ export declare function ConflictResolutionModal({ conflicts, onResolve, onCancel, }: ConflictResolutionModalProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
package/dist/index.d.ts CHANGED
@@ -11,7 +11,8 @@ export { TemplateGallery } from './components/TemplateGallery';
11
11
  export { WorkflowLibrary } from './components/WorkflowLibrary';
12
12
  export { AISettings } from './components/AISettings';
13
13
  export { AIChat, type GenerationSuccessData, type GenerationFailedData } from './components/AIChat';
14
- export { UploadGallery } from './components/UploadGallery';
14
+ export { AIPanel } from './components/AIPanel';
15
+ export { useAIChatStore, type CanvasSnapshot, type ExecutionContext } from './stores/aiChatStore';
15
16
  export { CommandPalette } from './components/CommandPalette';
16
17
  export { KeyboardShortcutsModal } from './components/KeyboardShortcutsModal';
17
18
  export { useKeyboardShortcuts } from './lib/keyboard/useKeyboardShortcuts';