dsh-image-gen 0.10.2 → 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.en.md +148 -133
- package/README.md +148 -133
- package/docs/assets/readme/canvas-edit.webp +0 -0
- package/docs/assets/readme/canvas-sketch.webp +0 -0
- package/docs/assets/readme/chat-batch.webp +0 -0
- package/docs/assets/readme/config.webp +0 -0
- package/docs/assets/readme/hero-batch.webp +0 -0
- package/docs/assets/readme/hero-canvas.webp +0 -0
- package/docs/assets/readme/studio-ref.webp +0 -0
- package/docs/assets/readme/studio.webp +0 -0
- package/lib/client.js +10848 -6335
- package/lib/index.js +2625 -145
- package/lib/types/capabilities.d.ts +10 -6
- package/lib/types/client/browser-image-utils.d.ts +6 -0
- package/lib/types/client/conversation-image-revisions.d.ts +3 -0
- package/lib/types/client/conversation-regenerate.d.ts +9 -1
- package/lib/types/client/datalist-scroll-fix.d.ts +32 -0
- package/lib/types/client/gallery-batch-bar.d.ts +8 -0
- package/lib/types/client/gallery-card.d.ts +21 -0
- package/lib/types/client/gallery-format.d.ts +7 -0
- package/lib/types/client/gallery-i18n.d.ts +236 -0
- package/lib/types/client/gallery-media.d.ts +58 -0
- package/lib/types/client/gallery-merge.d.ts +15 -0
- package/lib/types/client/gallery-store.d.ts +23 -2
- package/lib/types/client/gallery-thumbs.d.ts +24 -0
- package/lib/types/client/gallery-view.d.ts +0 -207
- package/lib/types/client/gif-card.d.ts +67 -0
- package/lib/types/client/gif-comments.d.ts +95 -0
- package/lib/types/client/gif-controls.d.ts +22 -0
- package/lib/types/client/gif-edit.d.ts +87 -0
- package/lib/types/client/gif-filmstrip.d.ts +23 -0
- package/lib/types/client/gif-gallery.d.ts +39 -0
- package/lib/types/client/gif-i18n.d.ts +159 -0
- package/lib/types/client/gif-menus.d.ts +36 -0
- package/lib/types/client/gif-player.d.ts +131 -0
- package/lib/types/client/gif-sheet.d.ts +116 -0
- package/lib/types/client/gif-style.d.ts +2 -0
- package/lib/types/client/image-result-node.d.ts +19 -1
- package/lib/types/client/image-result-view.d.ts +26 -0
- package/lib/types/client/index.d.ts +1 -20
- package/lib/types/client/plugin-i18n.d.ts +375 -0
- package/lib/types/client/plugin-style.d.ts +1 -0
- package/lib/types/client/provider-pill.d.ts +9 -0
- package/lib/types/client/studio-helpers.d.ts +63 -0
- package/lib/types/client/studio-session.d.ts +54 -0
- package/lib/types/client/studio-style.d.ts +1 -1
- package/lib/types/client/studio-view.d.ts +6 -7
- package/lib/types/client/tl/gallery-image-transfer.d.ts +1 -1
- package/lib/types/config.d.ts +12 -0
- package/lib/types/gif-info.d.ts +32 -0
- package/lib/types/import-route.d.ts +11 -0
- package/lib/types/multipart.d.ts +29 -0
- package/lib/types/openai-compatible.d.ts +8 -0
- package/lib/types/openai-output.d.ts +20 -1
- package/lib/types/request-cache.d.ts +41 -0
- package/lib/types/shared.d.ts +57 -3
- package/lib/types/storage-stats.d.ts +34 -0
- package/lib/types/studio-route.d.ts +2 -0
- package/lib/types/studio.d.ts +9 -0
- package/lib/types/subscription/vendors/codex.d.ts +4 -3
- package/lib/types/thumb-route.d.ts +25 -0
- package/lib/types/vault-registry.d.ts +66 -0
- package/lib/types/vault-route.d.ts +8 -0
- package/lib/types/vault-store.d.ts +33 -0
- package/lib/types/zip-progress.d.ts +18 -0
- package/lib/types/zip-route.d.ts +25 -0
- package/lib/types/zip-stream.d.ts +43 -0
- package/package.json +2 -2
- package/lib/types/client/tl/tl-trace-bridge.d.ts +0 -55
- package/lib/types/client/tl/trace-playback.d.ts +0 -101
- package/lib/types/trace-drawing.d.ts +0 -102
- package/lib/types/trace-route.d.ts +0 -12
- package/lib/types/trace-sketch.d.ts +0 -26
- package/lib/types/trace-store.d.ts +0 -23
- package/lib/types/vendor/drawai/raster.d.ts +0 -43
- package/lib/types/vendor/drawai/trace-image.d.ts +0 -257
|
@@ -13,213 +13,6 @@ export interface LocaleService {
|
|
|
13
13
|
}
|
|
14
14
|
export type TabKey = 'gallery' | 'studio' | 'inspiration' | 'favorites';
|
|
15
15
|
export type SortKey = 'newest' | 'oldest';
|
|
16
|
-
declare const DICT: {
|
|
17
|
-
readonly zh: {
|
|
18
|
-
readonly tabGallery: "图库";
|
|
19
|
-
readonly tabStudio: "工作台";
|
|
20
|
-
readonly tabInspiration: "灵感";
|
|
21
|
-
readonly tabFavorites: "收藏";
|
|
22
|
-
readonly tabCompare: "对比";
|
|
23
|
-
readonly tabTasks: "任务";
|
|
24
|
-
readonly filterAllProviders: "全部提供商";
|
|
25
|
-
readonly filterGoogle: "Google Gemini";
|
|
26
|
-
readonly filterOpenAI: "OpenAI";
|
|
27
|
-
readonly filterOpenAICompat: "OpenAI 兼容";
|
|
28
|
-
readonly filterSeedream: "字节 Seedream";
|
|
29
|
-
readonly filterDashScope: "阿里 DashScope";
|
|
30
|
-
readonly filterXAI: "xAI Grok";
|
|
31
|
-
readonly filterZhipu: "智谱 GLM";
|
|
32
|
-
readonly filterComfyUI: "本地 ComfyUI";
|
|
33
|
-
readonly filterImport: "导入";
|
|
34
|
-
readonly importImages: "导入图片";
|
|
35
|
-
readonly importAdded: "已导入 {count} 张图片";
|
|
36
|
-
readonly importPartial: "导入 {count} 张,{fail} 张失败";
|
|
37
|
-
readonly importFailed: "导入失败";
|
|
38
|
-
readonly importPickHint: "选择要导入的图片(PNG/JPG/WebP/GIF)";
|
|
39
|
-
readonly filterAllModels: "全部模型";
|
|
40
|
-
readonly filterAllRatios: "全部比例";
|
|
41
|
-
readonly searchPlaceholder: "搜索 Prompt、标签…";
|
|
42
|
-
readonly filterCurrentWorkspace: "仅看此工作区";
|
|
43
|
-
readonly filterCurrentWorkspaceHint: "只展示属于当前工作区的生图记录与物理文件";
|
|
44
|
-
readonly sortNewest: "最新生成";
|
|
45
|
-
readonly sortOldest: "最早生成";
|
|
46
|
-
readonly totalCount: "共 {count} 张生成图片";
|
|
47
|
-
readonly emptyTitle: "暂无生图记录";
|
|
48
|
-
readonly emptyDesc: "在对话中让 Agent 生图后,生成的图片会自动收录到这里。";
|
|
49
|
-
readonly favEmptyTitle: "暂无收藏图片";
|
|
50
|
-
readonly favEmptyDesc: "在图库中点击卡片右下角的 ♡ 按钮,即可将喜爱的图片收录到这里。";
|
|
51
|
-
readonly noMatchTitle: "未找到匹配结果";
|
|
52
|
-
readonly noMatchDesc: "尝试更换搜索关键词或调整筛选条件。";
|
|
53
|
-
readonly copiedPrompt: "已复制 Prompt";
|
|
54
|
-
readonly copiedImage: "已复制图片";
|
|
55
|
-
readonly copyFailed: "复制失败";
|
|
56
|
-
readonly favoriteAdded: "已添加到收藏";
|
|
57
|
-
readonly favoriteRemoved: "已取消收藏";
|
|
58
|
-
readonly preview: "查看大图";
|
|
59
|
-
readonly download: "下载图片";
|
|
60
|
-
readonly copyImg: "复制图片";
|
|
61
|
-
readonly copyPpt: "复制 Prompt";
|
|
62
|
-
readonly regenerate: "重新生成";
|
|
63
|
-
readonly regenerateTitle: "重新生成图片";
|
|
64
|
-
readonly regenerateHint: "可按需修改 Prompt,基于当前模型和比例在画廊生成一张新图片。";
|
|
65
|
-
readonly confirmRegenerate: "开始生成";
|
|
66
|
-
readonly regenerating: "正在重新生成…";
|
|
67
|
-
readonly regenerateSuccess: "已生成新图片并收录到画廊";
|
|
68
|
-
readonly regenerateSaveFailed: "图片已生成,但保存到图库失败,请重试";
|
|
69
|
-
readonly regenerateFailed: "重新生成失败";
|
|
70
|
-
readonly delete: "从画廊删除";
|
|
71
|
-
readonly confirmDelete: "确定要从画廊中删除这张图片吗?(不会影响原聊天记录)";
|
|
72
|
-
readonly deleted: "已从画廊删除";
|
|
73
|
-
readonly model: "模型";
|
|
74
|
-
readonly prompt: "Prompt";
|
|
75
|
-
readonly close: "关闭 (Esc)";
|
|
76
|
-
readonly prevImage: "上一张 (←)";
|
|
77
|
-
readonly nextImage: "下一张 (→)";
|
|
78
|
-
readonly manage: "批量管理";
|
|
79
|
-
readonly exitManage: "退出选择";
|
|
80
|
-
readonly selectedCount: "已选 {n} 项";
|
|
81
|
-
readonly selectAll: "全选";
|
|
82
|
-
readonly invertSelect: "反选";
|
|
83
|
-
readonly clearSelect: "清空";
|
|
84
|
-
readonly batchFavorite: "批量收藏";
|
|
85
|
-
readonly batchUnfavorite: "批量取消收藏";
|
|
86
|
-
readonly batchFavoritedToast: "已将 {count} 张图片加入收藏";
|
|
87
|
-
readonly batchUnfavoritedToast: "已取消 {count} 张图片的收藏";
|
|
88
|
-
readonly batchFavoriteFailed: "收藏操作失败,请重试";
|
|
89
|
-
readonly batchDownload: "批量下载";
|
|
90
|
-
readonly batchDownloading: "打包中 ({current}/{total})…";
|
|
91
|
-
readonly batchDownloadSingleToast: "已下载 1 张图片";
|
|
92
|
-
readonly batchDownloadZipToast: "已打包下载 {count} 张图片";
|
|
93
|
-
readonly batchDownloadFailed: "批量下载失败,请重试";
|
|
94
|
-
readonly batchDelete: "批量删除";
|
|
95
|
-
readonly batchDeleteTitle: "确认批量删除选中的 {count} 张图片?";
|
|
96
|
-
readonly batchDeleteTitleSingle: "确认从画廊中删除这张图片?";
|
|
97
|
-
readonly batchDeleteDesc: "将从画廊历史记录中移除所选图片。";
|
|
98
|
-
readonly deleteWorkspaceFilesOpt: "同时清理工作区磁盘物理文件(不可恢复)";
|
|
99
|
-
readonly cancel: "取消";
|
|
100
|
-
readonly confirmBatchDelete: "确认删除 ({count})";
|
|
101
|
-
readonly confirmDeleteSingle: "确认删除";
|
|
102
|
-
readonly batchDeletedToast: "已删除 {count} 张图片";
|
|
103
|
-
readonly batchDeletedWithFilesToast: "已删除 {count} 张图片,并清理了 {files} 个工作区文件";
|
|
104
|
-
readonly deleteFailedFileLocked: "已删除 {count} 张图片,但有 {files} 个文件因被系统占用未能删除";
|
|
105
|
-
readonly deleteFailedDatabase: "删除失败:本地数据库操作异常";
|
|
106
|
-
readonly justNow: "刚刚";
|
|
107
|
-
readonly minutesAgo: "{n} 分钟前";
|
|
108
|
-
readonly hoursAgo: "{n} 小时前";
|
|
109
|
-
readonly daysAgo: "{n} 天前";
|
|
110
|
-
readonly studioTitle: "AI 图像工作台 (Studio)";
|
|
111
|
-
readonly studioDesc: "工作台模块正在紧锣密鼓开发中。在此你将体验大图精修、变体生成 (Variations)、参数重调并一键将生成结果无缝插回 DSH 正在进行的对话。";
|
|
112
|
-
readonly studioTip: "💡 提示:目前你可以在“图库”中点击任意图片,在弹窗中进行查看、复制与下载。";
|
|
113
|
-
readonly compareTitle: "多模型横向对比 (Compare)";
|
|
114
|
-
readonly compareDesc: "支持单个 Prompt 一键同时调度 Gemini、Seedream、DashScope 及本地 ComfyUI 模型并排生成,直观横评画质与细节。";
|
|
115
|
-
readonly tasksTitle: "异步任务队列 (Tasks)";
|
|
116
|
-
readonly tasksDesc: "集中管理后台批量生图、多模型并发生成与本地 ComfyUI 耗时任务。支持状态追踪、失败重试与执行耗时分析。";
|
|
117
|
-
readonly comingSoonBadge: "即将推出";
|
|
118
|
-
};
|
|
119
|
-
readonly en: {
|
|
120
|
-
readonly tabGallery: "Gallery";
|
|
121
|
-
readonly tabStudio: "Studio";
|
|
122
|
-
readonly tabInspiration: "Inspiration";
|
|
123
|
-
readonly tabFavorites: "Favorites";
|
|
124
|
-
readonly tabCompare: "Compare";
|
|
125
|
-
readonly tabTasks: "Tasks";
|
|
126
|
-
readonly filterAllProviders: "All Providers";
|
|
127
|
-
readonly filterGoogle: "Google Gemini";
|
|
128
|
-
readonly filterOpenAI: "OpenAI";
|
|
129
|
-
readonly filterOpenAICompat: "OpenAI-compatible";
|
|
130
|
-
readonly filterSeedream: "ByteDance Seedream";
|
|
131
|
-
readonly filterDashScope: "Aliyun DashScope";
|
|
132
|
-
readonly filterXAI: "xAI Grok";
|
|
133
|
-
readonly filterZhipu: "Zhipu GLM";
|
|
134
|
-
readonly filterComfyUI: "Local ComfyUI";
|
|
135
|
-
readonly filterImport: "Imported";
|
|
136
|
-
readonly importImages: "Import images";
|
|
137
|
-
readonly importAdded: "Imported {count} images";
|
|
138
|
-
readonly importPartial: "Imported {count}, {fail} failed";
|
|
139
|
-
readonly importFailed: "Import failed";
|
|
140
|
-
readonly importPickHint: "Choose images to import (PNG/JPG/WebP/GIF)";
|
|
141
|
-
readonly filterAllModels: "All Models";
|
|
142
|
-
readonly filterAllRatios: "All Ratios";
|
|
143
|
-
readonly searchPlaceholder: "Search prompt, tags…";
|
|
144
|
-
readonly filterCurrentWorkspace: "Current workspace only";
|
|
145
|
-
readonly filterCurrentWorkspaceHint: "Only show images belonging to the active workspace";
|
|
146
|
-
readonly sortNewest: "Newest first";
|
|
147
|
-
readonly sortOldest: "Oldest first";
|
|
148
|
-
readonly totalCount: "{count} images total";
|
|
149
|
-
readonly emptyTitle: "No images generated yet";
|
|
150
|
-
readonly emptyDesc: "Images generated during conversations will automatically appear here.";
|
|
151
|
-
readonly favEmptyTitle: "No favorite images yet";
|
|
152
|
-
readonly favEmptyDesc: "Click the ♡ button on any card in the gallery to collect your favorite images here.";
|
|
153
|
-
readonly noMatchTitle: "No matching images";
|
|
154
|
-
readonly noMatchDesc: "Try a different search keyword or adjust filter criteria.";
|
|
155
|
-
readonly copiedPrompt: "Prompt copied";
|
|
156
|
-
readonly copiedImage: "Image copied";
|
|
157
|
-
readonly copyFailed: "Copy failed";
|
|
158
|
-
readonly favoriteAdded: "Added to favorites";
|
|
159
|
-
readonly favoriteRemoved: "Removed from favorites";
|
|
160
|
-
readonly preview: "Full Preview";
|
|
161
|
-
readonly download: "Download";
|
|
162
|
-
readonly copyImg: "Copy Image";
|
|
163
|
-
readonly copyPpt: "Copy Prompt";
|
|
164
|
-
readonly regenerate: "Regenerate";
|
|
165
|
-
readonly regenerateTitle: "Regenerate Image";
|
|
166
|
-
readonly regenerateHint: "Edit prompt if needed. A new image will be generated and added to the gallery.";
|
|
167
|
-
readonly confirmRegenerate: "Generate";
|
|
168
|
-
readonly regenerating: "Regenerating…";
|
|
169
|
-
readonly regenerateSuccess: "New image generated and added to gallery";
|
|
170
|
-
readonly regenerateSaveFailed: "Image generated, but saving to the gallery failed. Please retry.";
|
|
171
|
-
readonly regenerateFailed: "Regeneration failed";
|
|
172
|
-
readonly delete: "Delete from gallery";
|
|
173
|
-
readonly confirmDelete: "Are you sure you want to remove this image from the gallery? (Chat history will not be affected)";
|
|
174
|
-
readonly deleted: "Deleted from gallery";
|
|
175
|
-
readonly model: "Model";
|
|
176
|
-
readonly prompt: "Prompt";
|
|
177
|
-
readonly close: "Close (Esc)";
|
|
178
|
-
readonly prevImage: "Previous (←)";
|
|
179
|
-
readonly nextImage: "Next (→)";
|
|
180
|
-
readonly manage: "Batch Manage";
|
|
181
|
-
readonly exitManage: "Done";
|
|
182
|
-
readonly selectedCount: "{n} selected";
|
|
183
|
-
readonly selectAll: "Select All";
|
|
184
|
-
readonly invertSelect: "Invert";
|
|
185
|
-
readonly clearSelect: "Clear";
|
|
186
|
-
readonly batchFavorite: "Batch Favorite";
|
|
187
|
-
readonly batchUnfavorite: "Batch Unfavorite";
|
|
188
|
-
readonly batchFavoritedToast: "Added {count} images to favorites";
|
|
189
|
-
readonly batchUnfavoritedToast: "Removed {count} images from favorites";
|
|
190
|
-
readonly batchFavoriteFailed: "Favorite operation failed, please retry";
|
|
191
|
-
readonly batchDownload: "Batch Download";
|
|
192
|
-
readonly batchDownloading: "Packaging ({current}/{total})…";
|
|
193
|
-
readonly batchDownloadSingleToast: "Downloaded 1 image";
|
|
194
|
-
readonly batchDownloadZipToast: "Packaged & downloaded {count} images";
|
|
195
|
-
readonly batchDownloadFailed: "Batch download failed, please retry";
|
|
196
|
-
readonly batchDelete: "Batch Delete";
|
|
197
|
-
readonly batchDeleteTitle: "Delete {count} selected images?";
|
|
198
|
-
readonly batchDeleteTitleSingle: "Delete this image from gallery?";
|
|
199
|
-
readonly batchDeleteDesc: "These images will be removed from your gallery history.";
|
|
200
|
-
readonly deleteWorkspaceFilesOpt: "Also delete files from workspace disk (cannot be undone)";
|
|
201
|
-
readonly cancel: "Cancel";
|
|
202
|
-
readonly confirmBatchDelete: "Delete ({count})";
|
|
203
|
-
readonly confirmDeleteSingle: "Delete";
|
|
204
|
-
readonly batchDeletedToast: "Deleted {count} images";
|
|
205
|
-
readonly batchDeletedWithFilesToast: "Deleted {count} images and cleaned {files} workspace files";
|
|
206
|
-
readonly deleteFailedFileLocked: "Deleted {count} images, but {files} files could not be deleted (busy/locked)";
|
|
207
|
-
readonly deleteFailedDatabase: "Failed to delete: local database error";
|
|
208
|
-
readonly justNow: "Just now";
|
|
209
|
-
readonly minutesAgo: "{n}m ago";
|
|
210
|
-
readonly hoursAgo: "{n}h ago";
|
|
211
|
-
readonly daysAgo: "{n}d ago";
|
|
212
|
-
readonly studioTitle: "AI Image Studio";
|
|
213
|
-
readonly studioDesc: "Studio workbench is under active development. Fine-tune prompts, generate variations (2x/4x), and inject images directly into DSH chat.";
|
|
214
|
-
readonly studioTip: "💡 Tip: You can currently click any image in the Gallery to preview, copy, or download it.";
|
|
215
|
-
readonly compareTitle: "Model Comparison (Compare)";
|
|
216
|
-
readonly compareDesc: "Side-by-side multi-model benchmarking coming soon. Test Gemini, Seedream, DashScope, and ComfyUI with a single prompt.";
|
|
217
|
-
readonly tasksTitle: "Task Queue (Tasks)";
|
|
218
|
-
readonly tasksDesc: "Centralized view for batch generation, asynchronous ComfyUI runs, live progress tracking, and retry controls.";
|
|
219
|
-
readonly comingSoonBadge: "Coming Soon";
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
export type DictKey = keyof typeof DICT.zh;
|
|
223
16
|
export interface GalleryViewTabProps {
|
|
224
17
|
locale?: LocaleService | undefined;
|
|
225
18
|
sessionId?: string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type DragEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type GifInfo } from '../gif-info.js';
|
|
3
|
+
import { type GifT } from './gif-i18n.js';
|
|
4
|
+
import { type GifDownloadKind } from './gif-menus.js';
|
|
5
|
+
import { type GifPlayer } from './gif-player.js';
|
|
6
|
+
export interface GifCardInput {
|
|
7
|
+
lang: 'zh' | 'en';
|
|
8
|
+
/** The vault copy of the version on display, when the host normalized its attachment. */
|
|
9
|
+
original: {
|
|
10
|
+
key: string;
|
|
11
|
+
mediaType: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/** The attachment on display; a GIF attachment is itself the raw file. */
|
|
14
|
+
attachmentMediaType: string | undefined;
|
|
15
|
+
attachmentBlob: Blob | undefined;
|
|
16
|
+
/** The vault says the file is gone (deleted from the gallery): the record should drop its reference. */
|
|
17
|
+
onOriginalGone(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface GifCard {
|
|
20
|
+
t: GifT;
|
|
21
|
+
/** Whether the version on display is an animation, before its bytes are at hand. */
|
|
22
|
+
animated: boolean;
|
|
23
|
+
/** Defined once the raw GIF is at hand. */
|
|
24
|
+
player: GifPlayer | undefined;
|
|
25
|
+
/** Frame facts for a regeneration that asks for an animation again. */
|
|
26
|
+
info(): Promise<GifInfo | undefined>;
|
|
27
|
+
/** The GIF as it plays now: retimed to the playback speed once its bytes are read. */
|
|
28
|
+
file(): Blob | undefined;
|
|
29
|
+
download(kind: GifDownloadKind): void;
|
|
30
|
+
/** Copy the frame on display as a still; resolves the message to show. */
|
|
31
|
+
copyFrame(): Promise<string | undefined>;
|
|
32
|
+
}
|
|
33
|
+
/** Save the GIF at its speed, at its original timing, or the frame on display, named after `stem`. */
|
|
34
|
+
export declare function downloadGif(player: GifPlayer, kind: GifDownloadKind, speed: number, stem: string): void;
|
|
35
|
+
/** The animation behind a conversation card: its raw bytes, the player over them, and what a card does with them. */
|
|
36
|
+
export declare function useGifCard({ lang, original, attachmentMediaType, attachmentBlob, onOriginalGone }: GifCardInput): GifCard;
|
|
37
|
+
/** The card's speed chip; its panel opens over the image, so the card unclips while it is open. */
|
|
38
|
+
export declare function GifCardOverlay({ gif, onOpenChange }: {
|
|
39
|
+
gif: GifCard;
|
|
40
|
+
onOpenChange(open: boolean): void;
|
|
41
|
+
}): import("react").JSX.Element | null;
|
|
42
|
+
/** The card's hover-toolbar download, as a menu of the GIF, its original timing and the frame on screen. */
|
|
43
|
+
export declare function GifToolbarDownload({ gif, onOpenChange }: {
|
|
44
|
+
gif: GifCard;
|
|
45
|
+
onOpenChange(open: boolean): void;
|
|
46
|
+
}): import("react").JSX.Element | null;
|
|
47
|
+
export interface GifLightboxProps {
|
|
48
|
+
gif: GifCard;
|
|
49
|
+
player: GifPlayer;
|
|
50
|
+
alt: string;
|
|
51
|
+
/** Still image for a paused player whose frames were released. */
|
|
52
|
+
poster: string | undefined;
|
|
53
|
+
onClose(): void;
|
|
54
|
+
onDragStart(event: DragEvent<HTMLElement>): void;
|
|
55
|
+
/** Drawn over the stage, e.g. comment pins. */
|
|
56
|
+
stageOverlay?: ReactNode;
|
|
57
|
+
/** Controls after the speed in the player bar. */
|
|
58
|
+
barTrailing?: ReactNode;
|
|
59
|
+
/** Drawn under the player bar, e.g. the comment editor. */
|
|
60
|
+
footer?: ReactNode;
|
|
61
|
+
/** Extra class on the picture's frame, e.g. while it is being edited. */
|
|
62
|
+
wrapClassName?: string | undefined;
|
|
63
|
+
/** Frames the strip marks, e.g. the ones with notes. */
|
|
64
|
+
frameMarks?: ReadonlySet<number>;
|
|
65
|
+
}
|
|
66
|
+
/** The GIF lightbox: the stage, the player bar, and copy, download and close at the top right. */
|
|
67
|
+
export declare function GifLightbox({ gif, player, alt, poster, onClose, onDragStart, stageOverlay, barTrailing, footer, wrapClassName, frameMarks }: GifLightboxProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type StudioConfigResponse } from '../shared.js';
|
|
2
|
+
import type { GifT } from './gif-i18n.js';
|
|
3
|
+
import { type GifPlayer, type GifPlayerSnapshot } from './gif-player.js';
|
|
4
|
+
import { type GifComment, type GifSheetPlan } from './gif-sheet.js';
|
|
5
|
+
export type GifEditAvailability = 'ready' | 'frame-count' | 'unsupported' | 'decoding' | 'unloaded';
|
|
6
|
+
/**
|
|
7
|
+
* Whether the animation can be edited, and why not: only OpenAI-shaped
|
|
8
|
+
* providers take the edit request, the frames must be decoded (the sheet is
|
|
9
|
+
* built from them) and their number must be one the GIF contract can ask for.
|
|
10
|
+
* Once decoded, the frames themselves are counted, whatever the header says:
|
|
11
|
+
* they are what the sheet and the request use.
|
|
12
|
+
*/
|
|
13
|
+
export declare function gifEditAvailability(input: {
|
|
14
|
+
provider: string;
|
|
15
|
+
animated: boolean;
|
|
16
|
+
snapshot: Pick<GifPlayerSnapshot, 'status' | 'frames' | 'info'> | undefined;
|
|
17
|
+
}): GifEditAvailability | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The model for the edit: the channel's separate editing model when it has
|
|
20
|
+
* one (the server takes nothing else for an edit); otherwise the model that
|
|
21
|
+
* drew this animation while the channel still offers it, else the channel's
|
|
22
|
+
* default; the card's own model when the channel is gone.
|
|
23
|
+
*/
|
|
24
|
+
export declare function gifEditModel(config: Pick<StudioConfigResponse, 'providers' | 'activeChannel'>, image: {
|
|
25
|
+
provider: string;
|
|
26
|
+
channel?: string | undefined;
|
|
27
|
+
model: string;
|
|
28
|
+
}): string;
|
|
29
|
+
export declare function fetchGifEditModel(image: {
|
|
30
|
+
provider: string;
|
|
31
|
+
channel?: string | undefined;
|
|
32
|
+
model: string;
|
|
33
|
+
}, signal: AbortSignal): Promise<string>;
|
|
34
|
+
/** What a key does in a note box: Enter confirms, Escape closes, and an input method still composing keeps every key. */
|
|
35
|
+
export declare function commentKeyAction(event: {
|
|
36
|
+
key: string;
|
|
37
|
+
nativeEvent: {
|
|
38
|
+
isComposing: boolean;
|
|
39
|
+
};
|
|
40
|
+
}): 'confirm' | 'close' | undefined;
|
|
41
|
+
/** The card's edit chip, opposite the speed chip; it opens the lightbox straight in edit mode. */
|
|
42
|
+
export declare function GifEditChip({ availability, t, disabled, onOpen }: {
|
|
43
|
+
availability: GifEditAvailability | undefined;
|
|
44
|
+
t: GifT;
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
onOpen(): void;
|
|
47
|
+
}): import("react").JSX.Element | null;
|
|
48
|
+
/** The player bar's editing switch. */
|
|
49
|
+
export declare function GifEditToggle({ availability, editing, t, onToggle }: {
|
|
50
|
+
availability: GifEditAvailability;
|
|
51
|
+
editing: boolean;
|
|
52
|
+
t: GifT;
|
|
53
|
+
onToggle(): void;
|
|
54
|
+
}): import("react").JSX.Element;
|
|
55
|
+
export interface GifCommentBarProps {
|
|
56
|
+
view: 'gif' | 'sheet';
|
|
57
|
+
/** One-based frame on screen. */
|
|
58
|
+
current: number;
|
|
59
|
+
total: number;
|
|
60
|
+
count: number;
|
|
61
|
+
sending: boolean;
|
|
62
|
+
/** The answer to the request just sent. */
|
|
63
|
+
error?: string | undefined;
|
|
64
|
+
/** What the error most likely means, when it came from the channel. */
|
|
65
|
+
errorHint?: string | undefined;
|
|
66
|
+
t: GifT;
|
|
67
|
+
onView(view: 'gif' | 'sheet'): void;
|
|
68
|
+
onClear(): void;
|
|
69
|
+
onCancel(): void;
|
|
70
|
+
onSend(): void;
|
|
71
|
+
onFallback(): void;
|
|
72
|
+
}
|
|
73
|
+
/** The edit bar under the player: what to do, the count, the view switch and the actions. */
|
|
74
|
+
export declare function GifCommentBar({ view, current, total, count, sending, error, errorHint, t, onView, onClear, onCancel, onSend, onFallback }: GifCommentBarProps): import("react").JSX.Element;
|
|
75
|
+
export interface GifCommentLayerProps {
|
|
76
|
+
player: GifPlayer;
|
|
77
|
+
editing: boolean;
|
|
78
|
+
view: 'gif' | 'sheet';
|
|
79
|
+
/** Every frame tiled when editing began; shown scaled in the sheet view. */
|
|
80
|
+
sheet: {
|
|
81
|
+
canvas: HTMLCanvasElement;
|
|
82
|
+
plan: GifSheetPlan;
|
|
83
|
+
} | undefined;
|
|
84
|
+
comments: readonly GifComment[];
|
|
85
|
+
onChange(comments: GifComment[]): void;
|
|
86
|
+
t: GifT;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Over the frame on screen: in editing, a layer that places a note on the
|
|
90
|
+
* frame (pausing first), and that frame's pins; outside editing, the pins of a
|
|
91
|
+
* paused frame, which open to read. In the sheet view every cell is a click
|
|
92
|
+
* target and every pin is shown in its cell. Keys typed in a box stay in it:
|
|
93
|
+
* Enter posts or saves, Escape closes only the box.
|
|
94
|
+
*/
|
|
95
|
+
export declare function GifCommentLayer({ player, editing, view, sheet, comments, onChange, t }: GifCommentLayerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { GifT } from './gif-i18n.js';
|
|
3
|
+
import { type GifPlayer } from './gif-player.js';
|
|
4
|
+
interface GifPlayerBarProps {
|
|
5
|
+
player: GifPlayer;
|
|
6
|
+
t: GifT;
|
|
7
|
+
/** Extra class for where the bar sits, e.g. above the gallery's own bottom bar. */
|
|
8
|
+
className?: string | undefined;
|
|
9
|
+
/** Controls after the speed, e.g. the frame editor toggle. */
|
|
10
|
+
trailing?: ReactNode;
|
|
11
|
+
/** The frame strip's tooltip, where its arrow keys mean something else around it. */
|
|
12
|
+
stripHint?: string | undefined;
|
|
13
|
+
/** Frames the strip marks, e.g. the ones with notes. */
|
|
14
|
+
marks?: ReadonlySet<number> | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The lightbox player: play/pause, the frame strip and the speed. The bar is
|
|
18
|
+
* in place from the first render; frame controls wait for decoded frames,
|
|
19
|
+
* the speed only for the file's bytes, which a speed-named download retimes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function GifPlayerBar({ player, t, className, trailing, stripHint, marks }: GifPlayerBarProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frame-comment editing of an animated card: the notes of each version, the
|
|
3
|
+
* edit request that redraws the animation from them, and the lightbox that
|
|
4
|
+
* hosts the editor. The card supplies its busy state, its version chain and
|
|
5
|
+
* its regenerate dialog; gif-comments.tsx draws the editor.
|
|
6
|
+
*/
|
|
7
|
+
import { type MutableRefObject } from 'react';
|
|
8
|
+
import type { ConversationImageRevision } from './conversation-image-revisions.js';
|
|
9
|
+
import type { RegeneratableImage } from './conversation-regenerate.js';
|
|
10
|
+
import { type GifCard, type GifLightboxProps } from './gif-card.js';
|
|
11
|
+
import { type GifEditAvailability } from './gif-comments.js';
|
|
12
|
+
import { type GifComment, type GifSheetPlan } from './gif-sheet.js';
|
|
13
|
+
/** The sheet drawn when editing began, with the frame facts the request needs; it outlives frames the player releases. */
|
|
14
|
+
export interface DrawnSheet {
|
|
15
|
+
canvas: HTMLCanvasElement;
|
|
16
|
+
plan: GifSheetPlan;
|
|
17
|
+
frame: {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
delaysMs: readonly number[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface GifEditInput {
|
|
24
|
+
gif: GifCard;
|
|
25
|
+
/** The version on display; editing is offered only for one the workbench can redraw. */
|
|
26
|
+
image: (RegeneratableImage & {
|
|
27
|
+
prompt: string;
|
|
28
|
+
}) | undefined;
|
|
29
|
+
/** Notes belong to the version they were made on. */
|
|
30
|
+
versionKey: string | undefined;
|
|
31
|
+
/** The card's single busy slot, shared with regeneration: one request at a time, and the card's cancel aborts either. */
|
|
32
|
+
busy: {
|
|
33
|
+
running: boolean;
|
|
34
|
+
setRunning(running: boolean): void;
|
|
35
|
+
controller: MutableRefObject<AbortController | undefined>;
|
|
36
|
+
};
|
|
37
|
+
/** File a new version under the card and in the gallery; resolves whether the gallery kept it. */
|
|
38
|
+
addRevision(revision: ConversationImageRevision): Promise<boolean>;
|
|
39
|
+
/** The edit came back as a new version: close the lightbox and say how it went. */
|
|
40
|
+
onSent(message: string): void;
|
|
41
|
+
/** Regenerate from a description instead, with the notes written into the prompt. */
|
|
42
|
+
onFallback(prompt: string, hint: string): void;
|
|
43
|
+
}
|
|
44
|
+
export interface GifEdit {
|
|
45
|
+
t: GifCard['t'];
|
|
46
|
+
availability: GifEditAvailability | undefined;
|
|
47
|
+
comments: readonly GifComment[];
|
|
48
|
+
setComments(comments: GifComment[]): void;
|
|
49
|
+
busy: boolean;
|
|
50
|
+
sending: boolean;
|
|
51
|
+
error: {
|
|
52
|
+
message: string;
|
|
53
|
+
fromChannel: boolean;
|
|
54
|
+
} | undefined;
|
|
55
|
+
/** Said under the card title: a failure that came back while no editor was on screen. */
|
|
56
|
+
notice: string | undefined;
|
|
57
|
+
/** The edit chip asked the next lightbox to open in edit mode. */
|
|
58
|
+
editRequested: boolean;
|
|
59
|
+
requestEdit(): void;
|
|
60
|
+
takeEditRequest(): boolean;
|
|
61
|
+
/** The lightbox reports whether its editor is on screen, so a late failure knows where to show. */
|
|
62
|
+
setEditorOpen(open: boolean): void;
|
|
63
|
+
beginEditing(): void;
|
|
64
|
+
send(sheet: DrawnSheet): void;
|
|
65
|
+
cancelSend(): void;
|
|
66
|
+
fallback(total: number): void;
|
|
67
|
+
}
|
|
68
|
+
/** The notes of the version on display and the edit request built from them. */
|
|
69
|
+
export declare function useGifEdit({ gif, image, versionKey, busy, addRevision, onSent, onFallback }: GifEditInput): GifEdit;
|
|
70
|
+
/** The card's edit chip, wired to open the lightbox in edit mode. */
|
|
71
|
+
export declare function GifCardEditChip({ edit, onOpen }: {
|
|
72
|
+
edit: GifEdit;
|
|
73
|
+
onOpen(): void;
|
|
74
|
+
}): import("react").JSX.Element;
|
|
75
|
+
/** A failure that came back while no editor was on screen, under the card title. */
|
|
76
|
+
export declare function GifEditNotice({ edit }: {
|
|
77
|
+
edit: GifEdit;
|
|
78
|
+
}): import("react").JSX.Element | null;
|
|
79
|
+
/**
|
|
80
|
+
* The GIF lightbox with the frame editor: entering edit mode pauses the
|
|
81
|
+
* player and draws the sheet once (the sheet view and the request read it,
|
|
82
|
+
* and it outlives frames the player releases); leaving it keeps the notes.
|
|
83
|
+
* Escape leaves edit mode before it closes the lightbox.
|
|
84
|
+
*/
|
|
85
|
+
export declare function GifEditLightbox({ edit, ...props }: GifLightboxProps & {
|
|
86
|
+
edit: GifEdit;
|
|
87
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { GifT } from './gif-i18n.js';
|
|
2
|
+
import { type GifPlayer } from './gif-player.js';
|
|
3
|
+
/** The frame under a pointer: one equal cell per frame across the strip; the ends hold outside it. */
|
|
4
|
+
export declare function filmstripFrameAt(x: number, width: number, total: number): number;
|
|
5
|
+
/** The centred source rectangle that fills a cell without stretching the frame. */
|
|
6
|
+
export declare function coverCrop(frameW: number, frameH: number, cellW: number, cellH: number): {
|
|
7
|
+
sx: number;
|
|
8
|
+
sy: number;
|
|
9
|
+
sw: number;
|
|
10
|
+
sh: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The frame timeline, as ChatGPT draws it: every frame in an equal cell and a
|
|
14
|
+
* playhead on the current one. Hovering previews a frame on the stage without
|
|
15
|
+
* changing play state; a press stops on it, and a drag keeps choosing. Keys
|
|
16
|
+
* are handled here and kept from the page, whose arrows turn gallery pages.
|
|
17
|
+
*/
|
|
18
|
+
export declare function GifFilmstrip({ player, t, hint, marks }: {
|
|
19
|
+
player: GifPlayer;
|
|
20
|
+
t: GifT;
|
|
21
|
+
hint?: string | undefined;
|
|
22
|
+
marks?: ReadonlySet<number> | undefined;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { GalleryItem } from './gallery-store.js';
|
|
2
|
+
import { type GifT } from './gif-i18n.js';
|
|
3
|
+
import { type GifPlayer } from './gif-player.js';
|
|
4
|
+
/** Where a gallery item's animation is served, when it has one: its vault original, or a GIF attachment. */
|
|
5
|
+
export declare function galleryGifUrl(item: GalleryItem): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* A grid tile's GIF badge, and its animation laid over the still thumbnail
|
|
8
|
+
* while the pointer is on the tile. The thumbnail stays underneath, so a slow
|
|
9
|
+
* or missing original never blanks the tile, and drags still start from it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function GalleryGifTile({ item, lang, hovered }: {
|
|
12
|
+
item: GalleryItem;
|
|
13
|
+
lang: 'zh' | 'en';
|
|
14
|
+
hovered: boolean;
|
|
15
|
+
}): import("react").JSX.Element | null;
|
|
16
|
+
export interface GalleryGifPreview {
|
|
17
|
+
t: GifT;
|
|
18
|
+
player: GifPlayer;
|
|
19
|
+
item: GalleryItem;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The player behind the gallery preview of an animated item, once its bytes
|
|
23
|
+
* are at hand. An original that is gone falls back to the still attachment,
|
|
24
|
+
* which the gallery's own image shows.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useGalleryGifPreview(item: GalleryItem | null, lang: 'zh' | 'en'): GalleryGifPreview | undefined;
|
|
27
|
+
/** The preview's animation, in place of the gallery image; sized to leave room for the player bar. */
|
|
28
|
+
export declare function GalleryGifStage({ preview, poster }: {
|
|
29
|
+
preview: GalleryGifPreview;
|
|
30
|
+
poster: string | undefined;
|
|
31
|
+
}): import("react").JSX.Element;
|
|
32
|
+
/** The player bar, floating above the gallery's own bottom bar. */
|
|
33
|
+
export declare function GalleryGifBar({ preview }: {
|
|
34
|
+
preview: GalleryGifPreview;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
/** The bottom bar's download, as a menu of the GIF at its speed, its original timing and the frame on display. */
|
|
37
|
+
export declare function GalleryGifDownload({ preview }: {
|
|
38
|
+
preview: GalleryGifPreview;
|
|
39
|
+
}): import("react").JSX.Element;
|