light-chain-open-ui 1.0.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.
Files changed (44) hide show
  1. package/dist/button-Bvgi18zf.js +4535 -0
  2. package/dist/button-DyttCdLa.cjs +1101 -0
  3. package/dist/lightchain-ui.cjs +1 -0
  4. package/dist/lightchain-ui.mjs +5 -0
  5. package/dist/react.cjs +1 -0
  6. package/dist/react.mjs +71 -0
  7. package/dist/types/components/button/button.d.ts +16 -0
  8. package/dist/types/components/button/index.d.ts +1 -0
  9. package/dist/types/components/color-picker/color-picker.d.ts +19 -0
  10. package/dist/types/components/color-picker/index.d.ts +1 -0
  11. package/dist/types/components/enum-selector/enum-selector.d.ts +40 -0
  12. package/dist/types/components/enum-selector/index.d.ts +1 -0
  13. package/dist/types/components/image-compare-slider/image-compare-slider.d.ts +25 -0
  14. package/dist/types/components/image-compare-slider/index.d.ts +1 -0
  15. package/dist/types/components/image-uploader/image-uploader.d.ts +54 -0
  16. package/dist/types/components/image-uploader/index.d.ts +1 -0
  17. package/dist/types/components/mask-editor/index.d.ts +1 -0
  18. package/dist/types/components/mask-editor/mask-editor.d.ts +88 -0
  19. package/dist/types/components/prompt-input/index.d.ts +1 -0
  20. package/dist/types/components/prompt-input/prompt-input.d.ts +19 -0
  21. package/dist/types/components/result-gallery/index.d.ts +1 -0
  22. package/dist/types/components/result-gallery/result-gallery.d.ts +23 -0
  23. package/dist/types/components/strength-slider/index.d.ts +1 -0
  24. package/dist/types/components/strength-slider/strength-slider.d.ts +19 -0
  25. package/dist/types/components/task-progress-card/index.d.ts +1 -0
  26. package/dist/types/components/task-progress-card/task-progress-card.d.ts +28 -0
  27. package/dist/types/components/task-workflow/index.d.ts +3 -0
  28. package/dist/types/components/task-workflow/task-workflow.d.ts +56 -0
  29. package/dist/types/core/client.d.ts +97 -0
  30. package/dist/types/core/constants.d.ts +420 -0
  31. package/dist/types/core/image-validator.d.ts +16 -0
  32. package/dist/types/core/index.d.ts +6 -0
  33. package/dist/types/core/task-types/index.d.ts +31 -0
  34. package/dist/types/core/task-types/types-part-a.d.ts +3 -0
  35. package/dist/types/core/task-types/types-part-b.d.ts +3 -0
  36. package/dist/types/core/types.d.ts +65 -0
  37. package/dist/types/core/validate.d.ts +11 -0
  38. package/dist/types/index.d.ts +28 -0
  39. package/dist/types/react/index.d.ts +43 -0
  40. package/package.json +65 -0
  41. package/src/styles/reset.css +2 -0
  42. package/src/styles/themes/dark.css +14 -0
  43. package/src/styles/themes/default.css +2 -0
  44. package/src/styles/tokens.css +68 -0
@@ -0,0 +1,420 @@
1
+ /** API 基础 URL */
2
+ export declare const API_BASE_URL = "https://api.lightchainai.com";
3
+ /** 鉴权请求头字段名 */
4
+ export declare const AUTH_HEADER_KEY = "client-secret";
5
+ /** 任务进度查询路径 */
6
+ export declare const TASK_PROGRESS_PATH = "/task/progress";
7
+ /** 任务提交路径前缀 */
8
+ export declare const TASK_SUBMIT_PREFIX = "/task/submit";
9
+ export declare const ERROR_CODES: {
10
+ readonly BAD_REQUEST: 400;
11
+ readonly UNAUTHORIZED: 401;
12
+ readonly RATE_LIMIT: 429;
13
+ readonly SERVER_ERROR: 500;
14
+ };
15
+ export declare const TASK_WORKFLOW_TYPES: {
16
+ readonly GENERATE_PRINTING: "GeneratePrinting";
17
+ readonly VIRTUAL_FITTING: "VirtualFitting";
18
+ readonly FIX_FACE: "FixFace";
19
+ readonly CHANGE_FACE: "ChangeFace";
20
+ readonly MULTI_PERSPECTIVE: "MultiPerspective";
21
+ readonly PRINTING_TILING: "PrintingTiling";
22
+ readonly CHANGE_DESIGN_POINT: "ChangeDesignPoint";
23
+ readonly CHANGE_COLOR: "ChangeColor";
24
+ readonly CHANGE_FABRIC: "ChangeFabric";
25
+ readonly SR: "Sr";
26
+ readonly VECTOR_CONVERT: "VectorConvert";
27
+ readonly CHANGE_MODEL: "ChangeModel";
28
+ readonly GENERATE_SKETCH: "GenerateSketch";
29
+ readonly MODEL_GENERATE_SKETCH: "ModelGenerateSketch";
30
+ readonly ELIMINATE: "Eliminate";
31
+ readonly EXPAND_IMAGE: "ExpandImage";
32
+ readonly CLOTHING_DESIGN: "ClothingDesign";
33
+ readonly CHANGE_PATTERN: "ChangePattern";
34
+ readonly GENERATE_MODEL: "GenerateModel";
35
+ readonly MODIFY_PRINTING: "ModifyPrinting";
36
+ readonly CUT_OUT: "CutOut";
37
+ readonly LINE_ART_TO_REAL: "LineArtToReal";
38
+ readonly FIX_PARTIAL: "FixPartial";
39
+ readonly DETAIL_COMPENSATION: "DetailCompensation";
40
+ readonly CHANGE_CLOTHES_BY_IMG: "ChangeClothesByImg";
41
+ readonly CHANGE_ACCESSORIES_BY_IMG: "ChangeAccessoriesByImg";
42
+ readonly VIRTUAL_FITTING_REFERENCE: "VirtualFittingReference";
43
+ readonly VIRTUAL_FITTING_TEMPLATE: "VirtualFittingTemplate";
44
+ readonly FIX_DEFORMITIES: "FixDeformities";
45
+ readonly INTELLIGENT_CROPPING: "IntelligentCropping";
46
+ readonly MODEL_TO_FLAT: "ModelToFlat";
47
+ readonly GENERATE_SHORT_VIDEO: "GenerateShortVideo";
48
+ readonly ONE_CLICK_MODIFY_PRINTING: "OneClickModifyPrinting";
49
+ readonly ORIENTATION_DESIGN: "OrientationDesign";
50
+ readonly DIRECTIONAL_INTEGRATION: "DirectionalIntegration";
51
+ readonly ONE_CLICK_INTEGRATION: "OneClickIntegration";
52
+ readonly CHANGE_FABRIC_V2: "ChangeFabricV2";
53
+ readonly VIRTUAL_FITTING_REFERENCE_V2: "VirtualFittingReferenceV2";
54
+ readonly FLOWER_SHAPED_DESIGN: "FlowerShapedDesign";
55
+ readonly FLOWER_SHAPED_VIRTUAL_PRINTING: "FlowerShapedVirtualPrinting";
56
+ readonly ONE_CLICK_CHANGE_COLOR: "OneClickChangeColor";
57
+ readonly FITTING_MODEL_WITH_LABELS: "FittingModelWithLabels";
58
+ readonly FITTING_MODEL_CUSTOM: "FittingModelCustom";
59
+ readonly FITTING_MODEL_CHANGE_FACE: "FittingModelChangeFace";
60
+ readonly FITTING_MODEL_CHANGE_MODEL: "FittingModelChangeModel";
61
+ readonly FITTING_MODEL_CHANGE_BODY_SHAPE: "FittingModelChangeBodyShape";
62
+ readonly FITTING_MODEL_CHANGE_CLOTHING_SIZE: "FittingModelChangeClothingSize";
63
+ readonly FITTING_MODEL_CHANGE_POSTURE: "FittingModelChangePosture";
64
+ readonly FITTING_MODEL_CHANGE_BACKGROUND: "FittingModelChangeBackground";
65
+ readonly FITTING_MODEL_CHANGE_PERSPECTIVE: "FittingModelChangePerspective";
66
+ readonly TRAIN_CLOTHING_MODEL: "TrainClothingModel";
67
+ };
68
+ export type TaskWorkflowType = (typeof TASK_WORKFLOW_TYPES)[keyof typeof TASK_WORKFLOW_TYPES];
69
+ export declare const FIELD_TYPES: {
70
+ readonly IMAGE: "image";
71
+ readonly MASK: "mask";
72
+ readonly IMAGES: "images";
73
+ readonly TEXT: "text";
74
+ readonly ENUM: "enum";
75
+ readonly MULTI_ENUM: "multiEnum";
76
+ readonly ASPECT_RATIO: "aspectRatio";
77
+ readonly COLOR: "color";
78
+ readonly STRENGTH: "strength";
79
+ readonly NUMBER: "number";
80
+ };
81
+ export type FieldType = (typeof FIELD_TYPES)[keyof typeof FIELD_TYPES];
82
+ export declare const WORKFLOW_PHASES: {
83
+ readonly IDLE: "idle";
84
+ readonly SUBMITTING: "submitting";
85
+ readonly POLLING: "polling";
86
+ readonly SUCCESS: "success";
87
+ readonly ERROR: "error";
88
+ };
89
+ export type WorkflowPhase = (typeof WORKFLOW_PHASES)[keyof typeof WORKFLOW_PHASES];
90
+ export declare const WORKFLOW_DEFAULTS: {
91
+ readonly POLL_INTERVAL: number;
92
+ readonly MAX_POLL_ATTEMPTS: number;
93
+ readonly POLL_ENDPOINT: string;
94
+ };
95
+ export declare const EVENT_NAMES: {
96
+ /** 值变更 */
97
+ readonly CHANGE: "change";
98
+ /** 任务提交成功 */
99
+ readonly SUBMIT: "submit";
100
+ /** 轮询更新 */
101
+ readonly POLL: "poll";
102
+ /** 任务完成 */
103
+ readonly SUCCESS: "success";
104
+ /** 错误 */
105
+ readonly ERROR: "error";
106
+ /** 图片点击 */
107
+ readonly IMAGE_CLICK: "image-click";
108
+ /** 对比 */
109
+ readonly COMPARE: "compare";
110
+ };
111
+ export declare const ERROR_MESSAGES: {
112
+ readonly MISSING_ENDPOINT: "未指定提交端点或任务类型";
113
+ readonly POLL_TIMEOUT: (taskId: string) => string;
114
+ readonly POLL_FAILED: "轮询失败";
115
+ readonly TASK_NOT_FOUND: (taskId: string) => string;
116
+ readonly SUBMIT_FAILED: "提交失败";
117
+ readonly FIELD_REQUIRED: (label: string) => string;
118
+ readonly FIELD_STRING: (label: string) => string;
119
+ readonly FIELD_ARRAY: (label: string) => string;
120
+ readonly FIELD_ARRAY_ELEMENTS: (label: string) => string;
121
+ readonly FIELD_MAX_LENGTH: (label: string, max: number) => string;
122
+ readonly FIELD_ENUM_INVALID: (label: string) => string;
123
+ readonly FIELD_COLOR_FORMAT: (label: string) => string;
124
+ readonly FIELD_NUMBER: (label: string) => string;
125
+ };
126
+ export declare const ACCEPTED_FILE_TYPES: {
127
+ readonly IMAGE: readonly ["image/jpeg", "image/png", "image/webp"];
128
+ };
129
+ export declare const FILE_SIZE_LIMITS: {
130
+ readonly MAX_IMAGE_SIZE: number;
131
+ };
132
+ export type OptionValue<T extends ReadonlyArray<{
133
+ readonly value: string;
134
+ }>> = T[number]['value'];
135
+ export declare const OPTIONS_ASPECT_RATIO: readonly [{
136
+ readonly label: "1:1";
137
+ readonly value: "1:1";
138
+ }, {
139
+ readonly label: "2:3";
140
+ readonly value: "2:3";
141
+ }, {
142
+ readonly label: "3:4";
143
+ readonly value: "3:4";
144
+ }, {
145
+ readonly label: "3:2";
146
+ readonly value: "3:2";
147
+ }, {
148
+ readonly label: "4:3";
149
+ readonly value: "4:3";
150
+ }, {
151
+ readonly label: "9:16";
152
+ readonly value: "9:16";
153
+ }, {
154
+ readonly label: "16:9";
155
+ readonly value: "16:9";
156
+ }];
157
+ /** 视角 */
158
+ export declare const OPTIONS_PERSPECTIVE: readonly [{
159
+ readonly label: "正面";
160
+ readonly value: "front";
161
+ }, {
162
+ readonly label: "背面";
163
+ readonly value: "back";
164
+ }, {
165
+ readonly label: "左侧";
166
+ readonly value: "left";
167
+ }, {
168
+ readonly label: "右侧";
169
+ readonly value: "right";
170
+ }];
171
+ export type PerspectiveValue = OptionValue<typeof OPTIONS_PERSPECTIVE>;
172
+ /** 超分辨率倍数 */
173
+ export declare const OPTIONS_SCALE: readonly [{
174
+ readonly label: "2倍";
175
+ readonly value: "2";
176
+ }, {
177
+ readonly label: "3倍";
178
+ readonly value: "3";
179
+ }, {
180
+ readonly label: "4倍";
181
+ readonly value: "4";
182
+ }];
183
+ export type ScaleValue = OptionValue<typeof OPTIONS_SCALE>;
184
+ /** 图案类型 */
185
+ export declare const OPTIONS_PATTERN_TYPE: readonly [{
186
+ readonly label: "线稿";
187
+ readonly value: "line";
188
+ }, {
189
+ readonly label: "印花";
190
+ readonly value: "printing";
191
+ }];
192
+ export type PatternTypeValue = OptionValue<typeof OPTIONS_PATTERN_TYPE>;
193
+ /** 性别 */
194
+ export declare const OPTIONS_GENDER: readonly [{
195
+ readonly label: "女";
196
+ readonly value: "female";
197
+ }, {
198
+ readonly label: "男";
199
+ readonly value: "male";
200
+ }];
201
+ export type GenderValue = OptionValue<typeof OPTIONS_GENDER>;
202
+ /** 年龄 */
203
+ export declare const OPTIONS_AGE: readonly [{
204
+ readonly label: "青年";
205
+ readonly value: "young";
206
+ }, {
207
+ readonly label: "中年";
208
+ readonly value: "middle";
209
+ }];
210
+ export type AgeValue = OptionValue<typeof OPTIONS_AGE>;
211
+ /** 种族 */
212
+ export declare const OPTIONS_RACE: readonly [{
213
+ readonly label: "亚洲";
214
+ readonly value: "asian";
215
+ }, {
216
+ readonly label: "欧洲";
217
+ readonly value: "european";
218
+ }, {
219
+ readonly label: "非洲";
220
+ readonly value: "african";
221
+ }];
222
+ export type RaceValue = OptionValue<typeof OPTIONS_RACE>;
223
+ /** 部位 */
224
+ export declare const OPTIONS_POSITION: readonly [{
225
+ readonly label: "上装";
226
+ readonly value: "upper";
227
+ }, {
228
+ readonly label: "下装";
229
+ readonly value: "lower";
230
+ }, {
231
+ readonly label: "连身装";
232
+ readonly value: "dress";
233
+ }];
234
+ export type PositionValue = OptionValue<typeof OPTIONS_POSITION>;
235
+ /** 细节部位 */
236
+ export declare const OPTIONS_DETAIL_LIST: readonly [{
237
+ readonly label: "袖型";
238
+ readonly value: "sleeve";
239
+ }, {
240
+ readonly label: "领型";
241
+ readonly value: "collar";
242
+ }, {
243
+ readonly label: "裤型";
244
+ readonly value: "pants";
245
+ }, {
246
+ readonly label: "裙型";
247
+ readonly value: "skirt";
248
+ }];
249
+ export type DetailListValue = OptionValue<typeof OPTIONS_DETAIL_LIST>;
250
+ /** 抠图识别类型 */
251
+ export declare const OPTIONS_RECOGNITION_TYPE: readonly [{
252
+ readonly label: "全身";
253
+ readonly value: "full";
254
+ }, {
255
+ readonly label: "半身";
256
+ readonly value: "half";
257
+ }, {
258
+ readonly label: "服装";
259
+ readonly value: "clothing";
260
+ }];
261
+ export type RecognitionTypeValue = OptionValue<typeof OPTIONS_RECOGNITION_TYPE>;
262
+ /** 线稿类型 */
263
+ export declare const OPTIONS_IMAGE_TYPE: readonly [{
264
+ readonly label: "黑白线稿";
265
+ readonly value: "bw";
266
+ }, {
267
+ readonly label: "彩色线稿";
268
+ readonly value: "color";
269
+ }];
270
+ export type ImageTypeValue = OptionValue<typeof OPTIONS_IMAGE_TYPE>;
271
+ /** 配饰类型 */
272
+ export declare const OPTIONS_ACCESSORY_TYPE: readonly [{
273
+ readonly label: "背包";
274
+ readonly value: "bag";
275
+ }, {
276
+ readonly label: "鞋子";
277
+ readonly value: "shoes";
278
+ }, {
279
+ readonly label: "首饰";
280
+ readonly value: "jewelry";
281
+ }, {
282
+ readonly label: "腰带";
283
+ readonly value: "belt";
284
+ }, {
285
+ readonly label: "帽子";
286
+ readonly value: "hat";
287
+ }];
288
+ export type AccessoryTypeValue = OptionValue<typeof OPTIONS_ACCESSORY_TYPE>;
289
+ /** 试衣模板 */
290
+ export declare const OPTIONS_TEMPLATE_ID: readonly [{
291
+ readonly label: "棚内瑜伽";
292
+ readonly value: "yoga";
293
+ }, {
294
+ readonly label: "极简棚拍";
295
+ readonly value: "minimal";
296
+ }];
297
+ export type TemplateIdValue = OptionValue<typeof OPTIONS_TEMPLATE_ID>;
298
+ /** 智能裁剪模式 */
299
+ export declare const OPTIONS_CROP_MODE: readonly [{
300
+ readonly label: "自定义像素";
301
+ readonly value: "1";
302
+ }, {
303
+ readonly label: "比例裁剪";
304
+ readonly value: "2";
305
+ }];
306
+ export type CropModeValue = OptionValue<typeof OPTIONS_CROP_MODE>;
307
+ /** 视频时长 */
308
+ export declare const OPTIONS_DURATION: readonly [{
309
+ readonly label: "3秒";
310
+ readonly value: "3";
311
+ }, {
312
+ readonly label: "5秒";
313
+ readonly value: "5";
314
+ }];
315
+ export type DurationValue = OptionValue<typeof OPTIONS_DURATION>;
316
+ /** 是否移除图案 */
317
+ export declare const OPTIONS_REMOVE_PATTERN: readonly [{
318
+ readonly label: "是";
319
+ readonly value: "true";
320
+ }, {
321
+ readonly label: "否";
322
+ readonly value: "false";
323
+ }];
324
+ export type RemovePatternValue = OptionValue<typeof OPTIONS_REMOVE_PATTERN>;
325
+ /** 国籍 */
326
+ export declare const OPTIONS_NATIONALITY: readonly [{
327
+ readonly label: "中国";
328
+ readonly value: "china";
329
+ }, {
330
+ readonly label: "美国";
331
+ readonly value: "usa";
332
+ }, {
333
+ readonly label: "英国";
334
+ readonly value: "uk";
335
+ }, {
336
+ readonly label: "法国";
337
+ readonly value: "france";
338
+ }, {
339
+ readonly label: "德国";
340
+ readonly value: "germany";
341
+ }, {
342
+ readonly label: "意大利";
343
+ readonly value: "italy";
344
+ }, {
345
+ readonly label: "西班牙";
346
+ readonly value: "spain";
347
+ }, {
348
+ readonly label: "俄罗斯";
349
+ readonly value: "russia";
350
+ }, {
351
+ readonly label: "日本";
352
+ readonly value: "japan";
353
+ }, {
354
+ readonly label: "韩国";
355
+ readonly value: "korea";
356
+ }, {
357
+ readonly label: "泰国";
358
+ readonly value: "thailand";
359
+ }, {
360
+ readonly label: "印度";
361
+ readonly value: "india";
362
+ }, {
363
+ readonly label: "越南";
364
+ readonly value: "vietnam";
365
+ }, {
366
+ readonly label: "其他";
367
+ readonly value: "other";
368
+ }];
369
+ export type NationalityValue = OptionValue<typeof OPTIONS_NATIONALITY>;
370
+ /** 肤色 */
371
+ export declare const OPTIONS_SKIN_COLOR: readonly [{
372
+ readonly label: "白皙";
373
+ readonly value: "fair";
374
+ }, {
375
+ readonly label: "中等";
376
+ readonly value: "medium";
377
+ }, {
378
+ readonly label: "小麦色";
379
+ readonly value: "wheatish";
380
+ }, {
381
+ readonly label: "深色";
382
+ readonly value: "dark";
383
+ }, {
384
+ readonly label: "其他";
385
+ readonly value: "other";
386
+ }];
387
+ export type SkinColorValue = OptionValue<typeof OPTIONS_SKIN_COLOR>;
388
+ /** 体型 */
389
+ export declare const OPTIONS_BODY_SHAPE: readonly [{
390
+ readonly label: "偏瘦";
391
+ readonly value: "slim";
392
+ }, {
393
+ readonly label: "标准";
394
+ readonly value: "standard";
395
+ }, {
396
+ readonly label: "微胖";
397
+ readonly value: "chubby";
398
+ }, {
399
+ readonly label: "肥胖";
400
+ readonly value: "fat";
401
+ }];
402
+ export type BodyShapeValue = OptionValue<typeof OPTIONS_BODY_SHAPE>;
403
+ /** 相似度 */
404
+ export declare const OPTIONS_SIMILARITY: readonly [{
405
+ readonly label: "一致";
406
+ readonly value: "same";
407
+ }, {
408
+ readonly label: "相似";
409
+ readonly value: "similar";
410
+ }];
411
+ export type SimilarityValue = OptionValue<typeof OPTIONS_SIMILARITY>;
412
+ /** 尺码调整 */
413
+ export declare const OPTIONS_SIZE: readonly [{
414
+ readonly label: "偏小";
415
+ readonly value: "smaller";
416
+ }, {
417
+ readonly label: "偏大";
418
+ readonly value: "larger";
419
+ }];
420
+ export type SizeValue = OptionValue<typeof OPTIONS_SIZE>;
@@ -0,0 +1,16 @@
1
+ import type { ValidationResult } from './types.js';
2
+ export interface ImageDimensions {
3
+ width: number;
4
+ height: number;
5
+ size: number;
6
+ }
7
+ export declare function validateImage(image: ImageDimensions): ValidationResult;
8
+ export declare function validateMask(original: {
9
+ width: number;
10
+ height: number;
11
+ }, mask: {
12
+ width: number;
13
+ height: number;
14
+ }): ValidationResult;
15
+ /** 校验 File 对象(用于 Web Components 中) */
16
+ export declare function validateImageFile(file: File): Promise<ValidationResult>;
@@ -0,0 +1,6 @@
1
+ export * from './types.js';
2
+ export * from './client.js';
3
+ export * from './constants.js';
4
+ export * from './image-validator.js';
5
+ export * from './task-types/index.js';
6
+ export * from './validate.js';
@@ -0,0 +1,31 @@
1
+ /** 任务字段定义 */
2
+ export interface TaskFieldDef {
3
+ name: string;
4
+ label: string;
5
+ type: 'image' | 'mask' | 'images' | 'text' | 'enum' | 'multiEnum' | 'aspectRatio' | 'color' | 'strength' | 'number';
6
+ required?: boolean;
7
+ hint?: string;
8
+ placeholder?: string;
9
+ maxLength?: number;
10
+ options?: ReadonlyArray<{
11
+ readonly label: string;
12
+ readonly value: string;
13
+ }>;
14
+ defaultValue?: unknown;
15
+ }
16
+ /** 任务类型定义 */
17
+ export interface TaskTypeDef {
18
+ readonly key: string;
19
+ readonly endpoint?: string;
20
+ readonly title: string;
21
+ readonly description: string;
22
+ readonly fields: ReadonlyArray<TaskFieldDef>;
23
+ }
24
+ export { TASK_TYPES_PART_A } from './types-part-a.js';
25
+ export { TASK_TYPES_PART_B } from './types-part-b.js';
26
+ /** 所有任务类型(51 个提交类接口) */
27
+ export declare const TASK_TYPES: Record<string, TaskTypeDef>;
28
+ /** 根据 key 获取任务类型定义 */
29
+ export declare function getTaskTypeDef(key: string): TaskTypeDef | undefined;
30
+ /** 获取所有可用任务类型列表 */
31
+ export declare function getAllTaskTypes(): TaskTypeDef[];
@@ -0,0 +1,3 @@
1
+ import type { TaskTypeDef } from './index.js';
2
+ import type { TaskWorkflowType } from '../constants.js';
3
+ export declare const TASK_TYPES_PART_A: Partial<Record<TaskWorkflowType, TaskTypeDef>>;
@@ -0,0 +1,3 @@
1
+ import type { TaskTypeDef } from './index.js';
2
+ import type { TaskWorkflowType } from '../constants.js';
3
+ export declare const TASK_TYPES_PART_B: Partial<Record<TaskWorkflowType, TaskTypeDef>>;
@@ -0,0 +1,65 @@
1
+ /** 统一 API 响应格式 */
2
+ export interface ApiResponse<T> {
3
+ code: number;
4
+ success: boolean;
5
+ data: T;
6
+ msg?: string;
7
+ }
8
+ /** 任务提交响应 */
9
+ export interface TaskSubmitResponse {
10
+ taskId: string;
11
+ }
12
+ /** 任务进度查询结果 */
13
+ export interface TaskProgressResult {
14
+ aiTaskId: string;
15
+ aiTaskStatus: 'running' | 'done';
16
+ queuePos: number | null;
17
+ taskProgress: number;
18
+ aiTaskResult: string | null;
19
+ imgInfo?: string;
20
+ }
21
+ /** 回调图片结果 */
22
+ export interface CallbackImage {
23
+ index: number;
24
+ url: string;
25
+ }
26
+ /** 回调请求体 */
27
+ export interface CallbackPayload {
28
+ task_id: string;
29
+ task_status: 'done' | 'exception';
30
+ task_status_msg?: string;
31
+ task_info: Record<string, unknown>;
32
+ created_at: number;
33
+ updated_at: number;
34
+ task_result?: {
35
+ images?: CallbackImage[];
36
+ };
37
+ }
38
+ /** 任务状态 */
39
+ export declare const TaskStatus: {
40
+ readonly RUNNING: "running";
41
+ readonly DONE: "done";
42
+ };
43
+ export type TaskStatusValue = (typeof TaskStatus)[keyof typeof TaskStatus];
44
+ /** 回调状态 */
45
+ export declare const CallbackStatus: {
46
+ readonly DONE: "done";
47
+ readonly EXCEPTION: "exception";
48
+ };
49
+ export type CallbackStatusValue = (typeof CallbackStatus)[keyof typeof CallbackStatus];
50
+ /** 图片限制常量 */
51
+ export declare const IMAGE_LIMITS: {
52
+ readonly MAX_SIZE_MB: 10;
53
+ readonly MAX_WIDTH: 2048;
54
+ readonly MAX_HEIGHT: 2048;
55
+ readonly ASPECT_RATIO_MIN: number;
56
+ readonly ASPECT_RATIO_MAX: 3;
57
+ };
58
+ /** 常用宽高比 */
59
+ export declare const ASPECT_RATIOS: readonly ["1:1", "2:3", "3:4", "3:2", "4:3", "9:16", "16:9"];
60
+ export type AspectRatio = (typeof ASPECT_RATIOS)[number];
61
+ /** 校验结果 */
62
+ export interface ValidationResult {
63
+ valid: boolean;
64
+ errors: string[];
65
+ }
@@ -0,0 +1,11 @@
1
+ import type { TaskFieldDef } from './task-types/index.js';
2
+ export interface FieldError {
3
+ field: string;
4
+ label: string;
5
+ message: string;
6
+ }
7
+ export interface FormValidationResult {
8
+ valid: boolean;
9
+ errors: FieldError[];
10
+ }
11
+ export declare function validateFormData(formData: Record<string, unknown>, fields: ReadonlyArray<TaskFieldDef>): FormValidationResult;
@@ -0,0 +1,28 @@
1
+ import './components/image-uploader/index.js';
2
+ import './components/mask-editor/index.js';
3
+ import './components/enum-selector/index.js';
4
+ import './components/prompt-input/index.js';
5
+ import './components/color-picker/index.js';
6
+ import './components/strength-slider/index.js';
7
+ import './components/task-progress-card/index.js';
8
+ import './components/result-gallery/index.js';
9
+ import './components/image-compare-slider/index.js';
10
+ import './components/task-workflow/index.js';
11
+ import './components/button/index.js';
12
+ export * from './core/index.js';
13
+ export { LcImageUploader } from './components/image-uploader/image-uploader.js';
14
+ export { LcMaskEditor } from './components/mask-editor/mask-editor.js';
15
+ export { LcEnumSelector } from './components/enum-selector/enum-selector.js';
16
+ export { LcPromptInput } from './components/prompt-input/prompt-input.js';
17
+ export { LcColorPicker } from './components/color-picker/color-picker.js';
18
+ export { LcStrengthSlider } from './components/strength-slider/strength-slider.js';
19
+ export { LcTaskProgressCard } from './components/task-progress-card/task-progress-card.js';
20
+ export { LcResultGallery } from './components/result-gallery/result-gallery.js';
21
+ export { LcImageCompareSlider } from './components/image-compare-slider/image-compare-slider.js';
22
+ export { LcTaskWorkflow } from './components/task-workflow/task-workflow.js';
23
+ export { LcButton } from './components/button/button.js';
24
+ export type { CustomRequestFn, CustomUploadRequestFn } from './components/task-workflow/task-workflow.js';
25
+ export type { LightChainUploadRequestFn, LightChainUploadRequestOptions, LightChainUploadRequestResult, } from './core/client.js';
26
+ export type { WorkflowPhase } from './core/constants.js';
27
+ /** 娉ㄥ唽鎵€鏈夌粍浠讹紙宸查€氳繃 side-effect import 鑷姩娉ㄥ唽锛?*/
28
+ export declare function registerAllComponents(): void;
@@ -0,0 +1,43 @@
1
+ import { LcImageUploader } from '../components/image-uploader/image-uploader.js';
2
+ import { LcMaskEditor } from '../components/mask-editor/mask-editor.js';
3
+ import { LcEnumSelector } from '../components/enum-selector/enum-selector.js';
4
+ import { LcPromptInput } from '../components/prompt-input/prompt-input.js';
5
+ import { LcColorPicker } from '../components/color-picker/color-picker.js';
6
+ import { LcStrengthSlider } from '../components/strength-slider/strength-slider.js';
7
+ import { LcTaskProgressCard } from '../components/task-progress-card/task-progress-card.js';
8
+ import { LcResultGallery } from '../components/result-gallery/result-gallery.js';
9
+ import { LcImageCompareSlider } from '../components/image-compare-slider/image-compare-slider.js';
10
+ import { LcTaskWorkflow } from '../components/task-workflow/task-workflow.js';
11
+ import { LcButton } from '../components/button/button.js';
12
+ export declare const LcImageUploaderReact: import("@lit/react").ReactWebComponent<LcImageUploader, {
13
+ onChange: "change";
14
+ }>;
15
+ export declare const LcMaskEditorReact: import("@lit/react").ReactWebComponent<LcMaskEditor, {
16
+ onChange: "change";
17
+ }>;
18
+ export declare const LcEnumSelectorReact: import("@lit/react").ReactWebComponent<LcEnumSelector, {
19
+ onChange: "change";
20
+ }>;
21
+ export declare const LcPromptInputReact: import("@lit/react").ReactWebComponent<LcPromptInput, {
22
+ onChange: "change";
23
+ }>;
24
+ export declare const LcColorPickerReact: import("@lit/react").ReactWebComponent<LcColorPicker, {
25
+ onChange: "change";
26
+ }>;
27
+ export declare const LcStrengthSliderReact: import("@lit/react").ReactWebComponent<LcStrengthSlider, {
28
+ onChange: "change";
29
+ }>;
30
+ export declare const LcTaskProgressCardReact: import("@lit/react").ReactWebComponent<LcTaskProgressCard, {}>;
31
+ export declare const LcResultGalleryReact: import("@lit/react").ReactWebComponent<LcResultGallery, {
32
+ onImageClick: "image-click";
33
+ onCompare: "compare";
34
+ }>;
35
+ export declare const LcImageCompareSliderReact: import("@lit/react").ReactWebComponent<LcImageCompareSlider, {}>;
36
+ export declare const LcTaskWorkflowReact: import("@lit/react").ReactWebComponent<LcTaskWorkflow, {
37
+ onSubmit: "submit";
38
+ onPoll: "poll";
39
+ onPolling: "poll";
40
+ onSuccess: "success";
41
+ onError: "error";
42
+ }>;
43
+ export declare const LcButtonReact: import("@lit/react").ReactWebComponent<LcButton, {}>;