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.
- package/dist/button-Bvgi18zf.js +4535 -0
- package/dist/button-DyttCdLa.cjs +1101 -0
- package/dist/lightchain-ui.cjs +1 -0
- package/dist/lightchain-ui.mjs +5 -0
- package/dist/react.cjs +1 -0
- package/dist/react.mjs +71 -0
- package/dist/types/components/button/button.d.ts +16 -0
- package/dist/types/components/button/index.d.ts +1 -0
- package/dist/types/components/color-picker/color-picker.d.ts +19 -0
- package/dist/types/components/color-picker/index.d.ts +1 -0
- package/dist/types/components/enum-selector/enum-selector.d.ts +40 -0
- package/dist/types/components/enum-selector/index.d.ts +1 -0
- package/dist/types/components/image-compare-slider/image-compare-slider.d.ts +25 -0
- package/dist/types/components/image-compare-slider/index.d.ts +1 -0
- package/dist/types/components/image-uploader/image-uploader.d.ts +54 -0
- package/dist/types/components/image-uploader/index.d.ts +1 -0
- package/dist/types/components/mask-editor/index.d.ts +1 -0
- package/dist/types/components/mask-editor/mask-editor.d.ts +88 -0
- package/dist/types/components/prompt-input/index.d.ts +1 -0
- package/dist/types/components/prompt-input/prompt-input.d.ts +19 -0
- package/dist/types/components/result-gallery/index.d.ts +1 -0
- package/dist/types/components/result-gallery/result-gallery.d.ts +23 -0
- package/dist/types/components/strength-slider/index.d.ts +1 -0
- package/dist/types/components/strength-slider/strength-slider.d.ts +19 -0
- package/dist/types/components/task-progress-card/index.d.ts +1 -0
- package/dist/types/components/task-progress-card/task-progress-card.d.ts +28 -0
- package/dist/types/components/task-workflow/index.d.ts +3 -0
- package/dist/types/components/task-workflow/task-workflow.d.ts +56 -0
- package/dist/types/core/client.d.ts +97 -0
- package/dist/types/core/constants.d.ts +420 -0
- package/dist/types/core/image-validator.d.ts +16 -0
- package/dist/types/core/index.d.ts +6 -0
- package/dist/types/core/task-types/index.d.ts +31 -0
- package/dist/types/core/task-types/types-part-a.d.ts +3 -0
- package/dist/types/core/task-types/types-part-b.d.ts +3 -0
- package/dist/types/core/types.d.ts +65 -0
- package/dist/types/core/validate.d.ts +11 -0
- package/dist/types/index.d.ts +28 -0
- package/dist/types/react/index.d.ts +43 -0
- package/package.json +65 -0
- package/src/styles/reset.css +2 -0
- package/src/styles/themes/dark.css +14 -0
- package/src/styles/themes/default.css +2 -0
- package/src/styles/tokens.css +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./button-DyttCdLa.cjs`);function t(){}exports.ACCEPTED_FILE_TYPES=e.y,exports.API_BASE_URL=e.b,exports.ASPECT_RATIOS=e.nt,exports.AUTH_HEADER_KEY=e.x,exports.CallbackStatus=e.rt,exports.ERROR_CODES=e.S,exports.ERROR_MESSAGES=e.C,exports.EVENT_NAMES=e.w,exports.FIELD_TYPES=e.T,exports.FILE_SIZE_LIMITS=e.E,exports.IMAGE_LIMITS=e.it,Object.defineProperty(exports,`LcButton`,{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,`LcColorPicker`,{enumerable:!0,get:function(){return e.m}}),Object.defineProperty(exports,`LcEnumSelector`,{enumerable:!0,get:function(){return e.g}}),Object.defineProperty(exports,`LcImageCompareSlider`,{enumerable:!0,get:function(){return e.u}}),Object.defineProperty(exports,`LcImageUploader`,{enumerable:!0,get:function(){return e.v}}),Object.defineProperty(exports,`LcMaskEditor`,{enumerable:!0,get:function(){return e._}}),Object.defineProperty(exports,`LcPromptInput`,{enumerable:!0,get:function(){return e.h}}),Object.defineProperty(exports,`LcResultGallery`,{enumerable:!0,get:function(){return e.d}}),Object.defineProperty(exports,`LcStrengthSlider`,{enumerable:!0,get:function(){return e.p}}),Object.defineProperty(exports,`LcTaskProgressCard`,{enumerable:!0,get:function(){return e.f}}),Object.defineProperty(exports,`LcTaskWorkflow`,{enumerable:!0,get:function(){return e.n}}),exports.LightChainClient=e.r,exports.OPTIONS_ACCESSORY_TYPE=e.D,exports.OPTIONS_AGE=e.O,exports.OPTIONS_ASPECT_RATIO=e.k,exports.OPTIONS_BODY_SHAPE=e.A,exports.OPTIONS_CROP_MODE=e.j,exports.OPTIONS_DETAIL_LIST=e.M,exports.OPTIONS_DURATION=e.N,exports.OPTIONS_GENDER=e.P,exports.OPTIONS_IMAGE_TYPE=e.F,exports.OPTIONS_NATIONALITY=e.I,exports.OPTIONS_PATTERN_TYPE=e.L,exports.OPTIONS_PERSPECTIVE=e.R,exports.OPTIONS_POSITION=e.z,exports.OPTIONS_RACE=e.B,exports.OPTIONS_RECOGNITION_TYPE=e.V,exports.OPTIONS_REMOVE_PATTERN=e.H,exports.OPTIONS_SCALE=e.U,exports.OPTIONS_SIMILARITY=e.W,exports.OPTIONS_SIZE=e.G,exports.OPTIONS_SKIN_COLOR=e.K,exports.OPTIONS_TEMPLATE_ID=e.q,exports.TASK_PROGRESS_PATH=e.J,exports.TASK_SUBMIT_PREFIX=e.Y,exports.TASK_TYPES=e.a,exports.TASK_TYPES_PART_A=e.l,exports.TASK_TYPES_PART_B=e.c,exports.TASK_WORKFLOW_TYPES=e.X,exports.TaskStatus=e.at,exports.WORKFLOW_DEFAULTS=e.Z,exports.WORKFLOW_PHASES=e.Q,exports.getAllTaskTypes=e.o,exports.getTaskTypeDef=e.s,exports.registerAllComponents=t,exports.validateFormData=e.i,exports.validateImage=e.$,exports.validateImageFile=e.et,exports.validateMask=e.tt;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as A, c as j, d as M, et as N, f as P, g as F, h as I, i as L, it as R, j as z, k as B, l as V, m as H, n as U, nt as W, o as G, p as K, q, r as J, rt as Y, s as X, t as Z, tt as Q, u as $, v as ee, w as te, x as ne, y as re, z as ie } from "./button-Bvgi18zf.js";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
function ae() {}
|
|
4
|
+
//#endregion
|
|
5
|
+
export { re as ACCEPTED_FILE_TYPES, A as API_BASE_URL, W as ASPECT_RATIOS, ne as AUTH_HEADER_KEY, Y as CallbackStatus, y as ERROR_CODES, r as ERROR_MESSAGES, te as EVENT_NAMES, b as FIELD_TYPES, a as FILE_SIZE_LIMITS, R as IMAGE_LIMITS, Z as LcButton, H as LcColorPicker, F as LcEnumSelector, $ as LcImageCompareSlider, ee as LcImageUploader, D as LcMaskEditor, I as LcPromptInput, M as LcResultGallery, K as LcStrengthSlider, P as LcTaskProgressCard, U as LcTaskWorkflow, J as LightChainClient, i as OPTIONS_ACCESSORY_TYPE, h as OPTIONS_AGE, B as OPTIONS_ASPECT_RATIO, t as OPTIONS_BODY_SHAPE, z as OPTIONS_CROP_MODE, p as OPTIONS_DETAIL_LIST, m as OPTIONS_DURATION, g as OPTIONS_GENDER, o as OPTIONS_IMAGE_TYPE, l as OPTIONS_NATIONALITY, f as OPTIONS_PATTERN_TYPE, v as OPTIONS_PERSPECTIVE, ie as OPTIONS_POSITION, n as OPTIONS_RACE, S as OPTIONS_RECOGNITION_TYPE, c as OPTIONS_REMOVE_PATTERN, x as OPTIONS_SCALE, C as OPTIONS_SIMILARITY, s as OPTIONS_SIZE, d as OPTIONS_SKIN_COLOR, q as OPTIONS_TEMPLATE_ID, u as TASK_PROGRESS_PATH, T as TASK_SUBMIT_PREFIX, O as TASK_TYPES, V as TASK_TYPES_PART_A, j as TASK_TYPES_PART_B, w as TASK_WORKFLOW_TYPES, k as TaskStatus, E as WORKFLOW_DEFAULTS, _ as WORKFLOW_PHASES, G as getAllTaskTypes, X as getTaskTypeDef, ae as registerAllComponents, L as validateFormData, e as validateImage, N as validateImageFile, Q as validateMask };
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./button-DyttCdLa.cjs`);let l=require(`@lit/react`),u=require(`react`);u=s(u,1);var d=c.w,f=(0,l.createComponent)({react:u.default,tagName:`lc-image-uploader`,elementClass:c.v,events:{onChange:d.CHANGE}}),p=(0,l.createComponent)({react:u.default,tagName:`lc-mask-editor`,elementClass:c._,events:{onChange:d.CHANGE}}),m=(0,l.createComponent)({react:u.default,tagName:`lc-enum-selector`,elementClass:c.g,events:{onChange:d.CHANGE}}),h=(0,l.createComponent)({react:u.default,tagName:`lc-prompt-input`,elementClass:c.h,events:{onChange:d.CHANGE}}),g=(0,l.createComponent)({react:u.default,tagName:`lc-color-picker`,elementClass:c.m,events:{onChange:d.CHANGE}}),_=(0,l.createComponent)({react:u.default,tagName:`lc-strength-slider`,elementClass:c.p,events:{onChange:d.CHANGE}}),v=(0,l.createComponent)({react:u.default,tagName:`lc-task-progress-card`,elementClass:c.f,events:{}}),y=(0,l.createComponent)({react:u.default,tagName:`lc-result-gallery`,elementClass:c.d,events:{onImageClick:d.IMAGE_CLICK,onCompare:d.COMPARE}}),b=(0,l.createComponent)({react:u.default,tagName:`lc-image-compare-slider`,elementClass:c.u,events:{}}),x=(0,l.createComponent)({react:u.default,tagName:`lc-task-workflow`,elementClass:c.n,events:{onSubmit:d.SUBMIT,onPoll:d.POLL,onPolling:d.POLL,onSuccess:d.SUCCESS,onError:d.ERROR}}),S=(0,l.createComponent)({react:u.default,tagName:`lc-button`,elementClass:c.t,events:{}});exports.LcButtonReact=S,exports.LcColorPickerReact=g,exports.LcEnumSelectorReact=m,exports.LcImageCompareSliderReact=b,exports.LcImageUploaderReact=f,exports.LcMaskEditorReact=p,exports.LcPromptInputReact=h,exports.LcResultGalleryReact=y,exports.LcStrengthSliderReact=_,exports.LcTaskProgressCardReact=v,exports.LcTaskWorkflowReact=x,exports.t=s;
|
package/dist/react.mjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { _ as e, d as t, f as n, g as r, h as i, m as a, n as o, p as s, t as c, u as l, v as u, w as d } from "./button-Bvgi18zf.js";
|
|
2
|
+
import { createComponent as f } from "@lit/react";
|
|
3
|
+
import p from "react";
|
|
4
|
+
//#region src/react/index.ts
|
|
5
|
+
var m = d, h = f({
|
|
6
|
+
react: p,
|
|
7
|
+
tagName: "lc-image-uploader",
|
|
8
|
+
elementClass: u,
|
|
9
|
+
events: { onChange: m.CHANGE }
|
|
10
|
+
}), g = f({
|
|
11
|
+
react: p,
|
|
12
|
+
tagName: "lc-mask-editor",
|
|
13
|
+
elementClass: e,
|
|
14
|
+
events: { onChange: m.CHANGE }
|
|
15
|
+
}), _ = f({
|
|
16
|
+
react: p,
|
|
17
|
+
tagName: "lc-enum-selector",
|
|
18
|
+
elementClass: r,
|
|
19
|
+
events: { onChange: m.CHANGE }
|
|
20
|
+
}), v = f({
|
|
21
|
+
react: p,
|
|
22
|
+
tagName: "lc-prompt-input",
|
|
23
|
+
elementClass: i,
|
|
24
|
+
events: { onChange: m.CHANGE }
|
|
25
|
+
}), y = f({
|
|
26
|
+
react: p,
|
|
27
|
+
tagName: "lc-color-picker",
|
|
28
|
+
elementClass: a,
|
|
29
|
+
events: { onChange: m.CHANGE }
|
|
30
|
+
}), b = f({
|
|
31
|
+
react: p,
|
|
32
|
+
tagName: "lc-strength-slider",
|
|
33
|
+
elementClass: s,
|
|
34
|
+
events: { onChange: m.CHANGE }
|
|
35
|
+
}), x = f({
|
|
36
|
+
react: p,
|
|
37
|
+
tagName: "lc-task-progress-card",
|
|
38
|
+
elementClass: n,
|
|
39
|
+
events: {}
|
|
40
|
+
}), S = f({
|
|
41
|
+
react: p,
|
|
42
|
+
tagName: "lc-result-gallery",
|
|
43
|
+
elementClass: t,
|
|
44
|
+
events: {
|
|
45
|
+
onImageClick: m.IMAGE_CLICK,
|
|
46
|
+
onCompare: m.COMPARE
|
|
47
|
+
}
|
|
48
|
+
}), C = f({
|
|
49
|
+
react: p,
|
|
50
|
+
tagName: "lc-image-compare-slider",
|
|
51
|
+
elementClass: l,
|
|
52
|
+
events: {}
|
|
53
|
+
}), w = f({
|
|
54
|
+
react: p,
|
|
55
|
+
tagName: "lc-task-workflow",
|
|
56
|
+
elementClass: o,
|
|
57
|
+
events: {
|
|
58
|
+
onSubmit: m.SUBMIT,
|
|
59
|
+
onPoll: m.POLL,
|
|
60
|
+
onPolling: m.POLL,
|
|
61
|
+
onSuccess: m.SUCCESS,
|
|
62
|
+
onError: m.ERROR
|
|
63
|
+
}
|
|
64
|
+
}), T = f({
|
|
65
|
+
react: p,
|
|
66
|
+
tagName: "lc-button",
|
|
67
|
+
elementClass: c,
|
|
68
|
+
events: {}
|
|
69
|
+
});
|
|
70
|
+
//#endregion
|
|
71
|
+
export { T as LcButtonReact, y as LcColorPickerReact, _ as LcEnumSelectorReact, C as LcImageCompareSliderReact, h as LcImageUploaderReact, g as LcMaskEditorReact, v as LcPromptInputReact, S as LcResultGalleryReact, b as LcStrengthSliderReact, x as LcTaskProgressCardReact, w as LcTaskWorkflowReact };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type LcButtonType = 'button' | 'submit' | 'reset';
|
|
3
|
+
export type LcButtonVariant = 'primary' | 'secondary';
|
|
4
|
+
export declare class LcButton extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
type: LcButtonType;
|
|
7
|
+
variant: LcButtonVariant;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
private handleClick;
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'lc-button': LcButton;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class LcColorPicker extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
value: string;
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
private colorInputRef;
|
|
9
|
+
private emitChange;
|
|
10
|
+
private handleHexInput;
|
|
11
|
+
private handleColorInput;
|
|
12
|
+
private openPicker;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'lc-color-picker': LcColorPicker;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcColorPicker } from './color-picker.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export interface EnumSelectorOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
type SelectorValue = string | string[];
|
|
8
|
+
export declare class LcEnumSelector extends LitElement {
|
|
9
|
+
static styles: import("lit").CSSResult;
|
|
10
|
+
label: string;
|
|
11
|
+
name: string;
|
|
12
|
+
value: SelectorValue;
|
|
13
|
+
mode: 'button' | 'radio' | 'select';
|
|
14
|
+
multiple: boolean;
|
|
15
|
+
required: boolean;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
showIcon: boolean;
|
|
18
|
+
options: string;
|
|
19
|
+
get parsedOptions(): EnumSelectorOption[];
|
|
20
|
+
private get selectedValues();
|
|
21
|
+
private isSelected;
|
|
22
|
+
private emitChange;
|
|
23
|
+
private getRatioBoxDimensions;
|
|
24
|
+
private isRatioValue;
|
|
25
|
+
private renderOptionIcon;
|
|
26
|
+
private handleSelect;
|
|
27
|
+
private handleRadioChange;
|
|
28
|
+
private handleCheckboxChange;
|
|
29
|
+
private handleButtonClick;
|
|
30
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
31
|
+
private renderButtonGroup;
|
|
32
|
+
private renderRadioGroup;
|
|
33
|
+
private renderSelect;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'lc-enum-selector': LcEnumSelector;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcEnumSelector } from './enum-selector.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 图片对比滑块组件
|
|
4
|
+
*
|
|
5
|
+
* 使用 CSS clip-path 实现原图与结果图的左右对比。
|
|
6
|
+
*
|
|
7
|
+
* @csspart container - 对比容器
|
|
8
|
+
* @csspart slider - 滑动手柄
|
|
9
|
+
*/
|
|
10
|
+
export declare class LcImageCompareSlider extends LitElement {
|
|
11
|
+
static styles: import("lit").CSSResult;
|
|
12
|
+
beforeSrc: string;
|
|
13
|
+
afterSrc: string;
|
|
14
|
+
beforeLabel: string;
|
|
15
|
+
afterLabel: string;
|
|
16
|
+
private _position;
|
|
17
|
+
private _onPointerDown;
|
|
18
|
+
private _onPointerMove;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'lc-image-compare-slider': LcImageCompareSlider;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcImageCompareSlider } from './image-compare-slider.js';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 图片上传组件
|
|
4
|
+
*
|
|
5
|
+
* @fires lc-change - 文件选择或移除时触发,detail: { file: File | null }
|
|
6
|
+
*
|
|
7
|
+
* @csspart container - 外层容器
|
|
8
|
+
* @csspart dropzone - 拖拽上传区域
|
|
9
|
+
* @csspart preview - 图片预览区域
|
|
10
|
+
* @csspart hint - 提示文本
|
|
11
|
+
*/
|
|
12
|
+
export declare class LcImageUploader extends LitElement {
|
|
13
|
+
static styles: import("lit").CSSResult;
|
|
14
|
+
/** 字段名,用于 workflow 表单收集 */
|
|
15
|
+
name: string;
|
|
16
|
+
/** 字段标签 */
|
|
17
|
+
label: string;
|
|
18
|
+
/** 提示文字 */
|
|
19
|
+
hint: string;
|
|
20
|
+
/** 已上传图片 URL */
|
|
21
|
+
value: string;
|
|
22
|
+
file: File | null;
|
|
23
|
+
/** 是否禁用 */
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
/** 是否显示蒙版说明 */
|
|
26
|
+
showMaskHint: boolean;
|
|
27
|
+
/** 预览 URL(内部状态) */
|
|
28
|
+
private _previewUrl;
|
|
29
|
+
/** 错误信息(内部状态) */
|
|
30
|
+
private _errorMessage;
|
|
31
|
+
/** 拖拽悬停状态 */
|
|
32
|
+
private _isDragOver;
|
|
33
|
+
/** 隐藏的 file input 引用 */
|
|
34
|
+
private _fileInput;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
private _cleanupPreview;
|
|
37
|
+
private _handleClick;
|
|
38
|
+
private _handleDragOver;
|
|
39
|
+
private _handleDragLeave;
|
|
40
|
+
private _handleDrop;
|
|
41
|
+
private _handleFileChange;
|
|
42
|
+
private _processFile;
|
|
43
|
+
private _handleRemove;
|
|
44
|
+
private _dispatchChange;
|
|
45
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
46
|
+
private _renderDropzone;
|
|
47
|
+
private _renderPreview;
|
|
48
|
+
private _renderMaskHint;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'lc-image-uploader': LcImageUploader;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcImageUploader } from './image-uploader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcMaskEditor } from './mask-editor.js';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 蒙版涂抹组件
|
|
4
|
+
*
|
|
5
|
+
* 基于用户上传的原图进行涂抹,不提供蒙版文件上传。
|
|
6
|
+
*
|
|
7
|
+
* @fires lc-change - 蒙版变化时触发,detail: { value: string }
|
|
8
|
+
*
|
|
9
|
+
* @csspart editor - 编辑区域
|
|
10
|
+
* @csspart canvas - 涂抹画布
|
|
11
|
+
* @csspart label - 标签文本
|
|
12
|
+
* @csspart hint - 提示文本
|
|
13
|
+
*/
|
|
14
|
+
export declare class LcMaskEditor extends LitElement {
|
|
15
|
+
static styles: import("lit").CSSResult;
|
|
16
|
+
label: string;
|
|
17
|
+
name: string;
|
|
18
|
+
hint: string;
|
|
19
|
+
required: boolean;
|
|
20
|
+
value: string;
|
|
21
|
+
source: string;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
brushSize: number;
|
|
24
|
+
private _mode;
|
|
25
|
+
private _isDrawing;
|
|
26
|
+
private _errorMessage;
|
|
27
|
+
private _aspectRatio;
|
|
28
|
+
private _canUndo;
|
|
29
|
+
private _canRedo;
|
|
30
|
+
private _zoom;
|
|
31
|
+
private _isSpacePressed;
|
|
32
|
+
private _isPanning;
|
|
33
|
+
private _panX;
|
|
34
|
+
private _panY;
|
|
35
|
+
private _canvas?;
|
|
36
|
+
private _ctx?;
|
|
37
|
+
private _resizeObserver?;
|
|
38
|
+
private _lastPoint;
|
|
39
|
+
private _lastPanPoint;
|
|
40
|
+
private _history;
|
|
41
|
+
private _historyIndex;
|
|
42
|
+
private _sourceWidth;
|
|
43
|
+
private _sourceHeight;
|
|
44
|
+
firstUpdated(): void;
|
|
45
|
+
updated(changed: Map<string, unknown>): void;
|
|
46
|
+
disconnectedCallback(): void;
|
|
47
|
+
private _setupCanvas;
|
|
48
|
+
private _loadSource;
|
|
49
|
+
private _resizeCanvas;
|
|
50
|
+
private _clearCanvas;
|
|
51
|
+
private _handlePointerDown;
|
|
52
|
+
private _handleWheel;
|
|
53
|
+
private _handlePointerMove;
|
|
54
|
+
private _handlePointerUp;
|
|
55
|
+
private _focusStage;
|
|
56
|
+
private _handleKeyDown;
|
|
57
|
+
private _handleKeyUp;
|
|
58
|
+
private _handleBlur;
|
|
59
|
+
private _pan;
|
|
60
|
+
private _getCanvasPoint;
|
|
61
|
+
private _getStagePoint;
|
|
62
|
+
private _isPointInCanvas;
|
|
63
|
+
private _getImageCanvasRect;
|
|
64
|
+
private _drawPoint;
|
|
65
|
+
private _drawLineTo;
|
|
66
|
+
private _clipToImage;
|
|
67
|
+
private _syncValue;
|
|
68
|
+
private _setZoom;
|
|
69
|
+
private _setZoomAt;
|
|
70
|
+
private _setPan;
|
|
71
|
+
private _resetView;
|
|
72
|
+
private _resetHistory;
|
|
73
|
+
private _commitHistory;
|
|
74
|
+
private _updateHistoryState;
|
|
75
|
+
private _undo;
|
|
76
|
+
private _redo;
|
|
77
|
+
private _restoreHistory;
|
|
78
|
+
private _restoreSnapshot;
|
|
79
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
80
|
+
private _renderLabel;
|
|
81
|
+
private _renderEmpty;
|
|
82
|
+
private _renderEditor;
|
|
83
|
+
}
|
|
84
|
+
declare global {
|
|
85
|
+
interface HTMLElementTagNameMap {
|
|
86
|
+
'lc-mask-editor': LcMaskEditor;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcPromptInput } from './prompt-input.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class LcPromptInput extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
value: string;
|
|
5
|
+
name: string;
|
|
6
|
+
label: string;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
maxLength: number;
|
|
9
|
+
required: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
private emitChange;
|
|
12
|
+
private handleInput;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'lc-prompt-input': LcPromptInput;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcResultGallery } from './result-gallery.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* 结果图片画廊组件
|
|
4
|
+
*
|
|
5
|
+
* @fires lc-image-click - 点击图片时触发,detail: { index: number, url: string }
|
|
6
|
+
* @fires lc-compare - 点击对比按钮时触发,detail: { originalUrl: string, resultUrl: string }
|
|
7
|
+
*/
|
|
8
|
+
export declare class LcResultGallery extends LitElement {
|
|
9
|
+
static styles: import("lit").CSSResult;
|
|
10
|
+
images: string;
|
|
11
|
+
originalUrl: string;
|
|
12
|
+
showDownload: boolean;
|
|
13
|
+
private getParsedImages;
|
|
14
|
+
private _onImageClick;
|
|
15
|
+
private _onCompare;
|
|
16
|
+
private renderImageItem;
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'lc-result-gallery': LcResultGallery;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcStrengthSlider } from './strength-slider.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class LcStrengthSlider extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
value: number;
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
step: number;
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
private emitChange;
|
|
12
|
+
private handleInput;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'lc-strength-slider': LcStrengthSlider;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LcTaskProgressCard } from './task-progress-card.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
type TaskStatus = 'pending' | 'running' | 'done' | 'exception';
|
|
3
|
+
/**
|
|
4
|
+
* 任务进度卡片组件
|
|
5
|
+
*
|
|
6
|
+
* @csspart card - 卡片容器
|
|
7
|
+
* @csspart progress-bar - 进度条轨道
|
|
8
|
+
* @csspart progress-fill - 进度条填充
|
|
9
|
+
* @csspart status - 状态标签
|
|
10
|
+
*/
|
|
11
|
+
export declare class LcTaskProgressCard extends LitElement {
|
|
12
|
+
static styles: import("lit").CSSResult;
|
|
13
|
+
taskId: string;
|
|
14
|
+
status: TaskStatus;
|
|
15
|
+
progress: number;
|
|
16
|
+
queuePos: number;
|
|
17
|
+
errorMessage: string;
|
|
18
|
+
submittedAt: number;
|
|
19
|
+
private getStatusColor;
|
|
20
|
+
private formatTime;
|
|
21
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
'lc-task-progress-card': LcTaskProgressCard;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { LightChainClient } from '../../core/client.js';
|
|
3
|
+
import type { TaskTypeDef, TaskFieldDef } from '../../core/task-types/index.js';
|
|
4
|
+
import type { TaskProgressResult } from '../../core/types.js';
|
|
5
|
+
import type { TaskWorkflowType, WorkflowPhase } from '../../core/constants.js';
|
|
6
|
+
import type { LightChainClientOptions } from '../../core/client.js';
|
|
7
|
+
/** 任务类型枚举 key */
|
|
8
|
+
/** 自定义请求函数 */
|
|
9
|
+
export type CustomRequestFn = NonNullable<LightChainClientOptions['customRequest']>;
|
|
10
|
+
export type CustomUploadRequestFn = NonNullable<LightChainClientOptions['customUploadRequest']>;
|
|
11
|
+
/**
|
|
12
|
+
* 无头任务生命周期控制器
|
|
13
|
+
*
|
|
14
|
+
* 不渲染 UI,通过事件和公开方法管理 提交→轮询→结果 的完整生命周期。
|
|
15
|
+
* 用户自行组合原子 UI 组件,通过 submit() 提交数据,监听事件获取状态。
|
|
16
|
+
*
|
|
17
|
+
* @fires submit - 提交成功后触发,detail: { taskId, endpoint, formData }
|
|
18
|
+
* @fires poll - 每次轮询后触发,detail: { taskId, progress, status, queuePos }
|
|
19
|
+
* @fires success - 任务完成时触发,detail: { taskId, images, result }
|
|
20
|
+
* @fires error - 出错时触发,detail: { message, phase }
|
|
21
|
+
*/
|
|
22
|
+
export declare class LcTaskWorkflow extends LitElement {
|
|
23
|
+
type: TaskWorkflowType | string;
|
|
24
|
+
submitEndpoint: string;
|
|
25
|
+
pollEndpoint: string;
|
|
26
|
+
pollInterval: number;
|
|
27
|
+
maxPollAttempts: number;
|
|
28
|
+
client?: LightChainClient;
|
|
29
|
+
customRequest?: CustomRequestFn;
|
|
30
|
+
customUploadRequest?: CustomUploadRequestFn;
|
|
31
|
+
phase: WorkflowPhase;
|
|
32
|
+
taskId: string;
|
|
33
|
+
progress: number;
|
|
34
|
+
result: TaskProgressResult | null;
|
|
35
|
+
error: string;
|
|
36
|
+
private readonly _defaultClient;
|
|
37
|
+
get typeDef(): TaskTypeDef | undefined;
|
|
38
|
+
get taskFields(): ReadonlyArray<TaskFieldDef>;
|
|
39
|
+
submit(formData: Record<string, unknown>): Promise<void>;
|
|
40
|
+
reset(): void;
|
|
41
|
+
private _handleFormSubmit;
|
|
42
|
+
private _handleClick;
|
|
43
|
+
private _handleChildChange;
|
|
44
|
+
private _syncMaskSources;
|
|
45
|
+
collectFormData(): Record<string, unknown>;
|
|
46
|
+
private get _activeClient();
|
|
47
|
+
private _syncClientConfig;
|
|
48
|
+
private _syncStateFromClient;
|
|
49
|
+
private _fail;
|
|
50
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'lc-task-workflow': LcTaskWorkflow;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { TaskWorkflowType, WorkflowPhase } from './constants.js';
|
|
2
|
+
import type { TaskFieldDef, TaskTypeDef } from './task-types/index.js';
|
|
3
|
+
import type { TaskProgressResult } from './types.js';
|
|
4
|
+
export interface LightChainUploadRequestOptions {
|
|
5
|
+
file: File;
|
|
6
|
+
name: string;
|
|
7
|
+
formData: FormData;
|
|
8
|
+
field?: Pick<TaskFieldDef, 'name' | 'type'>;
|
|
9
|
+
}
|
|
10
|
+
export type LightChainUploadRequestResult = string | {
|
|
11
|
+
value?: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
data?: string | {
|
|
14
|
+
value?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
};
|
|
17
|
+
} | Response | null | undefined;
|
|
18
|
+
export type LightChainUploadRequestFn = (options: LightChainUploadRequestOptions) => Promise<LightChainUploadRequestResult> | LightChainUploadRequestResult;
|
|
19
|
+
export interface LightChainSubmitDetail {
|
|
20
|
+
taskId: string;
|
|
21
|
+
endpoint: string;
|
|
22
|
+
formData: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface LightChainPollDetail {
|
|
25
|
+
taskId: string;
|
|
26
|
+
progress: number;
|
|
27
|
+
status: TaskProgressResult['aiTaskStatus'];
|
|
28
|
+
queuePos: number | null;
|
|
29
|
+
}
|
|
30
|
+
export interface LightChainSuccessDetail {
|
|
31
|
+
taskId: string;
|
|
32
|
+
images: Array<{
|
|
33
|
+
index: number;
|
|
34
|
+
url: string;
|
|
35
|
+
}>;
|
|
36
|
+
result: TaskProgressResult;
|
|
37
|
+
}
|
|
38
|
+
export interface LightChainErrorDetail {
|
|
39
|
+
message: string;
|
|
40
|
+
phase: WorkflowPhase;
|
|
41
|
+
taskId?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface LightChainClientOptions {
|
|
44
|
+
type?: TaskWorkflowType | string;
|
|
45
|
+
submitEndpoint?: string;
|
|
46
|
+
submitEndpointMode?: 'prefix' | 'full';
|
|
47
|
+
pollEndpoint?: string;
|
|
48
|
+
pollInterval?: number;
|
|
49
|
+
maxPollAttempts?: number;
|
|
50
|
+
customRequest?: typeof fetch;
|
|
51
|
+
customUploadRequest?: LightChainUploadRequestFn;
|
|
52
|
+
customUploadRequert?: LightChainUploadRequestFn;
|
|
53
|
+
onSubmit?: (detail: LightChainSubmitDetail) => void;
|
|
54
|
+
onPoll?: (detail: LightChainPollDetail) => void;
|
|
55
|
+
onSuccess?: (detail: LightChainSuccessDetail) => void;
|
|
56
|
+
onError?: (detail: LightChainErrorDetail) => void;
|
|
57
|
+
}
|
|
58
|
+
export declare class LightChainClient {
|
|
59
|
+
type: TaskWorkflowType | string;
|
|
60
|
+
submitEndpoint: string;
|
|
61
|
+
submitEndpointMode: 'prefix' | 'full';
|
|
62
|
+
pollEndpoint: string;
|
|
63
|
+
pollInterval: number;
|
|
64
|
+
maxPollAttempts: number;
|
|
65
|
+
customRequest?: typeof fetch;
|
|
66
|
+
customUploadRequest?: LightChainUploadRequestFn;
|
|
67
|
+
phase: WorkflowPhase;
|
|
68
|
+
taskId: string;
|
|
69
|
+
progress: number;
|
|
70
|
+
result: TaskProgressResult | null;
|
|
71
|
+
error: string;
|
|
72
|
+
private onSubmit?;
|
|
73
|
+
private onPoll?;
|
|
74
|
+
private onSuccess?;
|
|
75
|
+
private onError?;
|
|
76
|
+
private readonly activeTasks;
|
|
77
|
+
private pollTimer;
|
|
78
|
+
private isPollingBatch;
|
|
79
|
+
constructor(options?: LightChainClientOptions);
|
|
80
|
+
configure(options: LightChainClientOptions): void;
|
|
81
|
+
get typeDef(): TaskTypeDef | undefined;
|
|
82
|
+
get taskFields(): ReadonlyArray<TaskFieldDef>;
|
|
83
|
+
submit(type: TaskWorkflowType | string, formData: Record<string, unknown>): Promise<void>;
|
|
84
|
+
reset(): void;
|
|
85
|
+
private createRequestUri;
|
|
86
|
+
private get resolvedTaskTypeKey();
|
|
87
|
+
private getTaskFields;
|
|
88
|
+
private resolveUploads;
|
|
89
|
+
private resolveUploadValue;
|
|
90
|
+
private trackTask;
|
|
91
|
+
private ensurePolling;
|
|
92
|
+
private pollActiveTasks;
|
|
93
|
+
private completeTask;
|
|
94
|
+
private failTask;
|
|
95
|
+
private request;
|
|
96
|
+
private fail;
|
|
97
|
+
}
|