@genfeedai/workflow-ui 0.1.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/canvas.d.mts +27 -0
- package/dist/canvas.d.ts +27 -0
- package/dist/canvas.js +45 -0
- package/dist/canvas.mjs +16 -0
- package/dist/chunk-22PDGHNQ.mjs +737 -0
- package/dist/chunk-3SPPKCWR.js +458 -0
- package/dist/chunk-3YFFDHC5.js +300 -0
- package/dist/chunk-5HJFQVUR.js +61 -0
- package/dist/chunk-5LQ4QBR5.js +2 -0
- package/dist/chunk-6DOEUDD5.js +254 -0
- package/dist/chunk-7SKSRSS7.mjs +57 -0
- package/dist/chunk-AC6TWLRT.mjs +27 -0
- package/dist/chunk-ADWNF7V3.js +120 -0
- package/dist/chunk-BJ3R5R32.mjs +2163 -0
- package/dist/chunk-CETJJ73S.js +1555 -0
- package/dist/chunk-CSUBLSKZ.mjs +1002 -0
- package/dist/chunk-CV4M7CNU.mjs +251 -0
- package/dist/chunk-E323WAZG.mjs +272 -0
- package/dist/chunk-E544XUBL.js +378 -0
- package/dist/chunk-EC2ZIWOK.js +1007 -0
- package/dist/chunk-EFXQT23N.mjs +99 -0
- package/dist/chunk-EMUMKW5C.js +107 -0
- package/dist/chunk-FOMOOERN.js +2 -0
- package/dist/chunk-FT33LFII.mjs +21 -0
- package/dist/chunk-FT64PCUP.mjs +533 -0
- package/dist/chunk-H6LZKSLY.js +5678 -0
- package/dist/chunk-HPQT36RR.js +543 -0
- package/dist/chunk-JLWKW3G5.js +2 -0
- package/dist/chunk-L5TF4EHW.mjs +1 -0
- package/dist/chunk-LAJ34AH2.mjs +374 -0
- package/dist/chunk-LDN7IX4Y.mjs +1 -0
- package/dist/chunk-MLJJBBTB.mjs +1 -0
- package/dist/chunk-NSDLGLAQ.js +2166 -0
- package/dist/chunk-RJ262NXS.js +24 -0
- package/dist/chunk-RXNEDWK2.js +141 -0
- package/dist/chunk-SW7QNEZU.js +744 -0
- package/dist/chunk-UQQUWGHW.mjs +118 -0
- package/dist/chunk-VOGL2WCE.mjs +1542 -0
- package/dist/chunk-VRN3UWE5.mjs +138 -0
- package/dist/chunk-XV5Z5XYR.mjs +5640 -0
- package/dist/chunk-Z7PWFZG5.js +30 -0
- package/dist/chunk-ZJD5WMR3.mjs +418 -0
- package/dist/hooks.d.mts +255 -0
- package/dist/hooks.d.ts +255 -0
- package/dist/hooks.js +56 -0
- package/dist/hooks.mjs +11 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +180 -0
- package/dist/index.mjs +19 -0
- package/dist/lib.d.mts +164 -0
- package/dist/lib.d.ts +164 -0
- package/dist/lib.js +144 -0
- package/dist/lib.mjs +3 -0
- package/dist/nodes.d.mts +128 -0
- package/dist/nodes.d.ts +128 -0
- package/dist/nodes.js +151 -0
- package/dist/nodes.mjs +14 -0
- package/dist/panels.d.mts +22 -0
- package/dist/panels.d.ts +22 -0
- package/dist/panels.js +21 -0
- package/dist/panels.mjs +4 -0
- package/dist/promptLibraryStore-BZnfmEkc.d.ts +464 -0
- package/dist/promptLibraryStore-zqb59nsu.d.mts +464 -0
- package/dist/provider.d.mts +29 -0
- package/dist/provider.d.ts +29 -0
- package/dist/provider.js +17 -0
- package/dist/provider.mjs +4 -0
- package/dist/stores.d.mts +96 -0
- package/dist/stores.d.ts +96 -0
- package/dist/stores.js +113 -0
- package/dist/stores.mjs +43 -0
- package/dist/toolbar.d.mts +73 -0
- package/dist/toolbar.d.ts +73 -0
- package/dist/toolbar.js +34 -0
- package/dist/toolbar.mjs +5 -0
- package/dist/types-ipAnBzAJ.d.mts +46 -0
- package/dist/types-ipAnBzAJ.d.ts +46 -0
- package/dist/ui.d.mts +67 -0
- package/dist/ui.d.ts +67 -0
- package/dist/ui.js +84 -0
- package/dist/ui.mjs +3 -0
- package/dist/workflowStore-4EGKJLYK.mjs +3 -0
- package/dist/workflowStore-KM32FDL7.js +12 -0
- package/package.json +117 -0
- package/src/styles/workflow-ui.css +186 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
exports.__commonJS = __commonJS;
|
|
30
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { cn } from './chunk-7SKSRSS7.mjs';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { memo, useCallback, useRef, useState } from 'react';
|
|
8
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
9
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
10
|
+
|
|
11
|
+
function Checkbox({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
CheckboxPrimitive.Root,
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "checkbox",
|
|
16
|
+
className: cn(
|
|
17
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
...props,
|
|
21
|
+
children: /* @__PURE__ */ jsx(
|
|
22
|
+
CheckboxPrimitive.Indicator,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "checkbox-indicator",
|
|
25
|
+
className: "grid place-content-center text-current transition-none",
|
|
26
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function Select({ ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
34
|
+
}
|
|
35
|
+
function SelectGroup({ ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
37
|
+
}
|
|
38
|
+
function SelectValue({ ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
40
|
+
}
|
|
41
|
+
function SelectTrigger({
|
|
42
|
+
className,
|
|
43
|
+
size = "default",
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}) {
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
SelectPrimitive.Trigger,
|
|
49
|
+
{
|
|
50
|
+
"data-slot": "select-trigger",
|
|
51
|
+
"data-size": size,
|
|
52
|
+
className: cn(
|
|
53
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
children,
|
|
59
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function SelectContent({
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
position = "item-aligned",
|
|
68
|
+
align = "center",
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
72
|
+
SelectPrimitive.Content,
|
|
73
|
+
{
|
|
74
|
+
"data-slot": "select-content",
|
|
75
|
+
className: cn(
|
|
76
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
77
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
position,
|
|
81
|
+
align,
|
|
82
|
+
...props,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
SelectPrimitive.Viewport,
|
|
87
|
+
{
|
|
88
|
+
className: cn(
|
|
89
|
+
"p-1",
|
|
90
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
91
|
+
),
|
|
92
|
+
children
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) });
|
|
99
|
+
}
|
|
100
|
+
function SelectLabel({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
SelectPrimitive.Label,
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "select-label",
|
|
105
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
106
|
+
...props
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function SelectItem({
|
|
111
|
+
className,
|
|
112
|
+
children,
|
|
113
|
+
...props
|
|
114
|
+
}) {
|
|
115
|
+
return /* @__PURE__ */ jsxs(
|
|
116
|
+
SelectPrimitive.Item,
|
|
117
|
+
{
|
|
118
|
+
"data-slot": "select-item",
|
|
119
|
+
className: cn(
|
|
120
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
...props,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
"span",
|
|
127
|
+
{
|
|
128
|
+
"data-slot": "select-item-indicator",
|
|
129
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
130
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function SelectSeparator({
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
SelectPrimitive.Separator,
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "select-separator",
|
|
146
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
147
|
+
...props
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
function SelectScrollUpButton({
|
|
152
|
+
className,
|
|
153
|
+
...props
|
|
154
|
+
}) {
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
156
|
+
SelectPrimitive.ScrollUpButton,
|
|
157
|
+
{
|
|
158
|
+
"data-slot": "select-scroll-up-button",
|
|
159
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
160
|
+
...props,
|
|
161
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function SelectScrollDownButton({
|
|
166
|
+
className,
|
|
167
|
+
...props
|
|
168
|
+
}) {
|
|
169
|
+
return /* @__PURE__ */ jsx(
|
|
170
|
+
SelectPrimitive.ScrollDownButton,
|
|
171
|
+
{
|
|
172
|
+
"data-slot": "select-scroll-down-button",
|
|
173
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
174
|
+
...props,
|
|
175
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function Slider({
|
|
180
|
+
className,
|
|
181
|
+
defaultValue,
|
|
182
|
+
value,
|
|
183
|
+
min = 0,
|
|
184
|
+
max = 100,
|
|
185
|
+
...props
|
|
186
|
+
}) {
|
|
187
|
+
const _values = React.useMemo(
|
|
188
|
+
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
189
|
+
[value, defaultValue, min, max]
|
|
190
|
+
);
|
|
191
|
+
return /* @__PURE__ */ jsxs(
|
|
192
|
+
SliderPrimitive.Root,
|
|
193
|
+
{
|
|
194
|
+
"data-slot": "slider",
|
|
195
|
+
defaultValue,
|
|
196
|
+
value,
|
|
197
|
+
min,
|
|
198
|
+
max,
|
|
199
|
+
className: cn(
|
|
200
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
201
|
+
className
|
|
202
|
+
),
|
|
203
|
+
...props,
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
SliderPrimitive.Track,
|
|
207
|
+
{
|
|
208
|
+
"data-slot": "slider-track",
|
|
209
|
+
className: cn(
|
|
210
|
+
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
211
|
+
),
|
|
212
|
+
children: /* @__PURE__ */ jsx(
|
|
213
|
+
SliderPrimitive.Range,
|
|
214
|
+
{
|
|
215
|
+
"data-slot": "slider-range",
|
|
216
|
+
className: cn(
|
|
217
|
+
"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx(
|
|
224
|
+
SliderPrimitive.Thumb,
|
|
225
|
+
{
|
|
226
|
+
"data-slot": "slider-thumb",
|
|
227
|
+
className: "border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
228
|
+
},
|
|
229
|
+
index
|
|
230
|
+
))
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function Label2({ className, ...props }) {
|
|
236
|
+
return /* @__PURE__ */ jsx(
|
|
237
|
+
LabelPrimitive.Root,
|
|
238
|
+
{
|
|
239
|
+
"data-slot": "label",
|
|
240
|
+
className: cn(
|
|
241
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
242
|
+
className
|
|
243
|
+
),
|
|
244
|
+
...props
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
function Input({ className, type, ...props }) {
|
|
249
|
+
return /* @__PURE__ */ jsx(
|
|
250
|
+
"input",
|
|
251
|
+
{
|
|
252
|
+
type,
|
|
253
|
+
"data-slot": "input",
|
|
254
|
+
className: cn(
|
|
255
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
256
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
257
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
258
|
+
className
|
|
259
|
+
),
|
|
260
|
+
...props
|
|
261
|
+
}
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
var GRID_POSITIONS = [
|
|
265
|
+
{ x: 0, y: 0 },
|
|
266
|
+
{ x: 0.5, y: 0 },
|
|
267
|
+
{ x: 1, y: 0 },
|
|
268
|
+
{ x: 0, y: 0.5 },
|
|
269
|
+
{ x: 0.5, y: 0.5 },
|
|
270
|
+
{ x: 1, y: 0.5 },
|
|
271
|
+
{ x: 0, y: 1 },
|
|
272
|
+
{ x: 0.5, y: 1 },
|
|
273
|
+
{ x: 1, y: 1 }
|
|
274
|
+
];
|
|
275
|
+
var X_LABELS = { 0: "left", 0.5: "center", 1: "right" };
|
|
276
|
+
var Y_LABELS = { 0: "top", 0.5: "middle", 1: "bottom" };
|
|
277
|
+
function getPositionTitle(pos) {
|
|
278
|
+
return `Position: ${X_LABELS[pos.x] ?? "center"}, ${Y_LABELS[pos.y] ?? "middle"}`;
|
|
279
|
+
}
|
|
280
|
+
function GridPositionSelectorComponent({
|
|
281
|
+
position,
|
|
282
|
+
onPositionChange,
|
|
283
|
+
className
|
|
284
|
+
}) {
|
|
285
|
+
const isSelected = useCallback(
|
|
286
|
+
(pos) => Math.abs(pos.x - position.x) < 0.01 && Math.abs(pos.y - position.y) < 0.01,
|
|
287
|
+
[position]
|
|
288
|
+
);
|
|
289
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", className), children: [
|
|
290
|
+
/* @__PURE__ */ jsx("label", { className: "text-xs text-muted-foreground", children: "Content Position" }),
|
|
291
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-1 p-2 bg-background border border-input rounded-md", children: GRID_POSITIONS.map((pos, idx) => /* @__PURE__ */ jsx(
|
|
292
|
+
"button",
|
|
293
|
+
{
|
|
294
|
+
type: "button",
|
|
295
|
+
onClick: () => onPositionChange(pos),
|
|
296
|
+
className: cn(
|
|
297
|
+
"w-5 h-5 rounded-sm border transition-all",
|
|
298
|
+
isSelected(pos) ? "bg-primary border-primary" : "bg-secondary border-input hover:border-primary"
|
|
299
|
+
),
|
|
300
|
+
title: getPositionTitle(pos)
|
|
301
|
+
},
|
|
302
|
+
idx
|
|
303
|
+
)) }),
|
|
304
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "Where original content appears in the new frame" })
|
|
305
|
+
] });
|
|
306
|
+
}
|
|
307
|
+
var GridPositionSelector = memo(GridPositionSelectorComponent);
|
|
308
|
+
function ComparisonSliderComponent({
|
|
309
|
+
beforeSrc,
|
|
310
|
+
afterSrc,
|
|
311
|
+
beforeLabel = "Before",
|
|
312
|
+
afterLabel = "After",
|
|
313
|
+
position,
|
|
314
|
+
onPositionChange,
|
|
315
|
+
height = 128,
|
|
316
|
+
className
|
|
317
|
+
}) {
|
|
318
|
+
const containerRef = useRef(null);
|
|
319
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
320
|
+
const handleMove = useCallback(
|
|
321
|
+
(clientX) => {
|
|
322
|
+
if (!containerRef.current) return;
|
|
323
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
324
|
+
const x = clientX - rect.left;
|
|
325
|
+
const newPosition = Math.max(0, Math.min(100, x / rect.width * 100));
|
|
326
|
+
onPositionChange(newPosition);
|
|
327
|
+
},
|
|
328
|
+
[onPositionChange]
|
|
329
|
+
);
|
|
330
|
+
const handleMouseDown = useCallback(
|
|
331
|
+
(e) => {
|
|
332
|
+
e.preventDefault();
|
|
333
|
+
setIsDragging(true);
|
|
334
|
+
handleMove(e.clientX);
|
|
335
|
+
},
|
|
336
|
+
[handleMove]
|
|
337
|
+
);
|
|
338
|
+
const handleMouseMove = useCallback(
|
|
339
|
+
(e) => {
|
|
340
|
+
if (!isDragging) return;
|
|
341
|
+
handleMove(e.clientX);
|
|
342
|
+
},
|
|
343
|
+
[isDragging, handleMove]
|
|
344
|
+
);
|
|
345
|
+
const handleMouseUp = useCallback(() => {
|
|
346
|
+
setIsDragging(false);
|
|
347
|
+
}, []);
|
|
348
|
+
const handleTouchStart = useCallback(
|
|
349
|
+
(e) => {
|
|
350
|
+
setIsDragging(true);
|
|
351
|
+
handleMove(e.touches[0].clientX);
|
|
352
|
+
},
|
|
353
|
+
[handleMove]
|
|
354
|
+
);
|
|
355
|
+
const handleTouchMove = useCallback(
|
|
356
|
+
(e) => {
|
|
357
|
+
if (!isDragging) return;
|
|
358
|
+
handleMove(e.touches[0].clientX);
|
|
359
|
+
},
|
|
360
|
+
[isDragging, handleMove]
|
|
361
|
+
);
|
|
362
|
+
return /* @__PURE__ */ jsxs(
|
|
363
|
+
"div",
|
|
364
|
+
{
|
|
365
|
+
ref: containerRef,
|
|
366
|
+
className: cn("relative overflow-hidden rounded-md cursor-ew-resize select-none", className),
|
|
367
|
+
style: { height },
|
|
368
|
+
onMouseDown: handleMouseDown,
|
|
369
|
+
onMouseMove: handleMouseMove,
|
|
370
|
+
onMouseUp: handleMouseUp,
|
|
371
|
+
onMouseLeave: handleMouseUp,
|
|
372
|
+
onTouchStart: handleTouchStart,
|
|
373
|
+
onTouchMove: handleTouchMove,
|
|
374
|
+
onTouchEnd: handleMouseUp,
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ jsx(
|
|
377
|
+
"img",
|
|
378
|
+
{
|
|
379
|
+
src: afterSrc,
|
|
380
|
+
alt: afterLabel,
|
|
381
|
+
className: "absolute inset-0 w-full h-full object-cover pointer-events-none",
|
|
382
|
+
draggable: false
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
/* @__PURE__ */ jsx(
|
|
386
|
+
"div",
|
|
387
|
+
{
|
|
388
|
+
className: "absolute inset-0 overflow-hidden pointer-events-none",
|
|
389
|
+
style: { width: `${position}%` },
|
|
390
|
+
children: /* @__PURE__ */ jsx(
|
|
391
|
+
"img",
|
|
392
|
+
{
|
|
393
|
+
src: beforeSrc,
|
|
394
|
+
alt: beforeLabel,
|
|
395
|
+
className: "absolute inset-0 h-full object-cover",
|
|
396
|
+
style: { width: containerRef.current?.offsetWidth ?? "100%" },
|
|
397
|
+
draggable: false
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsx(
|
|
403
|
+
"div",
|
|
404
|
+
{
|
|
405
|
+
className: "absolute top-0 bottom-0 w-0.5 bg-white shadow-lg pointer-events-none",
|
|
406
|
+
style: { left: `${position}%`, transform: "translateX(-50%)" },
|
|
407
|
+
children: /* @__PURE__ */ jsx("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 bg-white rounded-full shadow-lg flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", className: "w-3 h-3 text-gray-600", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M8 5v14l-7-7 7-7m8 0v14l7-7-7-7" }) }) })
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1.5 left-1.5 px-1 py-0.5 bg-black/60 rounded text-[9px] text-white font-medium pointer-events-none", children: beforeLabel }),
|
|
411
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1.5 right-1.5 px-1 py-0.5 bg-black/60 rounded text-[9px] text-white font-medium pointer-events-none", children: afterLabel })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
var ComparisonSlider = memo(ComparisonSliderComponent);
|
|
417
|
+
|
|
418
|
+
export { Checkbox, ComparisonSlider, GridPositionSelector, Input, Label2 as Label, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Slider };
|