@genfeedai/workflow-ui 0.2.3 → 0.2.5
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.ts +22 -22
- package/dist/canvas.mjs +16 -16
- package/dist/{chunk-XPZAHIWY.mjs → chunk-2FUPL67V.mjs} +1592 -1044
- package/dist/{chunk-HWVTD2LC.mjs → chunk-53XDE62A.mjs} +818 -623
- package/dist/{chunk-PCIWWD37.mjs → chunk-7LV4UAUS.mjs} +19 -19
- package/dist/{chunk-7SKSRSS7.mjs → chunk-B4EAAKYF.mjs} +16 -16
- package/dist/{chunk-ZJD5WMR3.mjs → chunk-C6MQBJFC.mjs} +45 -13
- package/dist/{chunk-7H3WJJYS.mjs → chunk-ESVULCFY.mjs} +12 -6
- package/dist/{chunk-GWBGK3KL.mjs → chunk-FWJIAW2E.mjs} +82 -47
- package/dist/{chunk-R727OFBR.mjs → chunk-GPYIIWD5.mjs} +404 -350
- package/dist/{chunk-OQREHJXK.mjs → chunk-IYFWAJBB.mjs} +208 -203
- package/dist/{chunk-N5NJZTK4.mjs → chunk-MGLAKMDP.mjs} +23 -21
- package/dist/{chunk-LT3ZJJL6.mjs → chunk-OJWVEEMM.mjs} +497 -399
- package/dist/{chunk-ZD2BADZO.mjs → chunk-ORVDYXDP.mjs} +221 -175
- package/dist/{chunk-CV4M7CNU.mjs → chunk-QQVHGJ2G.mjs} +149 -142
- package/dist/{chunk-6PSJTBNV.mjs → chunk-U4QPE4CY.mjs} +387 -347
- package/dist/{chunk-EFXQT23N.mjs → chunk-VVQ4CH77.mjs} +5 -5
- package/dist/{chunk-VRN3UWE5.mjs → chunk-XRC3O5GK.mjs} +73 -73
- package/dist/{chunk-FT33LFII.mjs → chunk-YUIK4AHM.mjs} +1 -1
- package/dist/{chunk-FMJPFB6W.mjs → chunk-ZSITTZ4S.mjs} +630 -569
- package/dist/hooks.d.ts +37 -37
- package/dist/hooks.mjs +10 -10
- package/dist/index.d.ts +26 -11
- package/dist/index.mjs +105 -19
- package/dist/lib.d.ts +203 -203
- package/dist/lib.mjs +228 -198
- package/dist/nodes.d.ts +2 -2
- package/dist/nodes.mjs +12 -12
- package/dist/panels.d.ts +2 -3
- package/dist/panels.mjs +3 -3
- package/dist/provider.d.ts +2 -2
- package/dist/provider.mjs +2 -2
- package/dist/stores.d.ts +5 -5
- package/dist/stores.mjs +5 -5
- package/dist/toolbar.d.ts +42 -24
- package/dist/toolbar.mjs +4 -4
- package/dist/ui.d.ts +2 -2
- package/dist/ui.mjs +2 -2
- package/dist/{useCommentNavigation-BakbiiIc.d.ts → useRequiredInputs-ByoIS-fT.d.ts} +160 -160
- package/dist/{promptLibraryStore-Dl3Q3cP6.d.ts → workflowStore-Bsz0nd5c.d.ts} +368 -368
- package/dist/workflowStore-N2F7WIG3.mjs +2 -0
- package/package.json +77 -75
- package/src/styles/workflow-ui.css +56 -19
- package/dist/workflowStore-UAAKOOIK.mjs +0 -2
- package/dist/{types-IEKYuYhu.d.ts → types-CRXJnajq.d.ts} +1 -1
package/dist/lib.mjs
CHANGED
|
@@ -1,135 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-
|
|
1
|
+
export { calculateWorkflowCost, formatCost } from './chunk-MGLAKMDP.mjs';
|
|
2
|
+
import { easing, getEasingFunction } from './chunk-U4QPE4CY.mjs';
|
|
3
|
+
export { CubicBezierEditor, DEFAULT_CUSTOM_BEZIER, DEFAULT_IMAGE_MODEL, DEFAULT_LIPSYNC_MODEL, DEFAULT_LLM_MODEL, DEFAULT_VIDEO_MODEL, EASING_BEZIER_MAP, EASING_PRESETS, IMAGE_MODELS, IMAGE_MODEL_ID_MAP, IMAGE_MODEL_MAP, LIPSYNC_MODELS, LIPSYNC_SYNC_MODES, LLM_MODELS, LLM_MODEL_ID_MAP, LLM_MODEL_MAP, PRESET_BEZIERS, VIDEO_MODELS, VIDEO_MODEL_ID_MAP, VIDEO_MODEL_MAP, applySpeedCurve, createAsymmetricEase, createBezierEasing, easing, evaluateBezier, generateHandlesFromSchema, getAllEasingNames, getEasingBezier, getEasingDisplayName, getEasingFunction, getImageModelLabel, getLLMModelLabel, getLipSyncModelLabel, getMediaFromNode, getPresetBezier, getVideoModelLabel, isSchemaHandle, lipSyncModelSupportsImage } from './chunk-U4QPE4CY.mjs';
|
|
4
|
+
export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-VVQ4CH77.mjs';
|
|
5
5
|
|
|
6
|
-
// src/lib/
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
return cached;
|
|
17
|
-
}
|
|
18
|
-
let prev = func(0);
|
|
19
|
-
for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
|
|
20
|
-
const value = func(i / MONOTONICITY_SAMPLES);
|
|
21
|
-
if (value + MONOTONICITY_TOLERANCE < prev) {
|
|
22
|
-
monotonicityCache.set(func, false);
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
prev = value;
|
|
26
|
-
}
|
|
27
|
-
monotonicityCache.set(func, true);
|
|
28
|
-
return true;
|
|
6
|
+
// src/lib/deduplicatedFetch.ts
|
|
7
|
+
var inFlightRequests = /* @__PURE__ */ new Map();
|
|
8
|
+
var responseCache = /* @__PURE__ */ new Map();
|
|
9
|
+
var CACHE_TTL = 5e3;
|
|
10
|
+
var pendingTimeouts = /* @__PURE__ */ new Map();
|
|
11
|
+
function getCacheKey(url, headers) {
|
|
12
|
+
if (!headers) return url;
|
|
13
|
+
const headerObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers;
|
|
14
|
+
const sortedHeaders = Object.keys(headerObj).sort().map((k) => `${k}:${headerObj[k]}`).join("|");
|
|
15
|
+
return `${url}|${sortedHeaders}`;
|
|
29
16
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
async function deduplicatedFetch(url, options) {
|
|
18
|
+
const cacheKey = getCacheKey(url, options?.headers);
|
|
19
|
+
const cached = responseCache.get(cacheKey);
|
|
20
|
+
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
|
21
|
+
return new Response(cached.bodyText, {
|
|
22
|
+
headers: cached.headers,
|
|
23
|
+
status: cached.status
|
|
24
|
+
});
|
|
36
25
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (diff < 0) {
|
|
48
|
-
low = mid;
|
|
49
|
-
} else {
|
|
50
|
-
high = mid;
|
|
26
|
+
const existingRequest = inFlightRequests.get(cacheKey);
|
|
27
|
+
if (existingRequest) {
|
|
28
|
+
await existingRequest;
|
|
29
|
+
const cachedData = responseCache.get(cacheKey);
|
|
30
|
+
if (cachedData) {
|
|
31
|
+
return new Response(cachedData.bodyText, {
|
|
32
|
+
headers: cachedData.headers,
|
|
33
|
+
status: cachedData.status
|
|
34
|
+
});
|
|
51
35
|
}
|
|
36
|
+
return new Response(JSON.stringify({ error: "Cache miss" }), {
|
|
37
|
+
status: 500
|
|
38
|
+
});
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const inverse = (value) => {
|
|
64
|
-
const clamped = Math.max(0, Math.min(1, value));
|
|
65
|
-
return invertEasingValue(clamped, func);
|
|
66
|
-
};
|
|
67
|
-
inverseCache.set(func, inverse);
|
|
68
|
-
return inverse;
|
|
69
|
-
}
|
|
70
|
-
function mapTimeWithEasing(normalizedTime, func) {
|
|
71
|
-
const inverse = getInverseEasing(func);
|
|
72
|
-
if (!inverse) {
|
|
73
|
-
return func(normalizedTime);
|
|
74
|
-
}
|
|
75
|
-
return inverse(normalizedTime);
|
|
76
|
-
}
|
|
77
|
-
function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
|
|
78
|
-
const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
|
|
79
|
-
const t = originalTime / inputDuration;
|
|
80
|
-
const clamped = Math.max(0, Math.min(1, t));
|
|
81
|
-
const eased = mapTimeWithEasing(clamped, easingFunc);
|
|
82
|
-
return eased * outputDuration;
|
|
83
|
-
}
|
|
84
|
-
function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
|
|
85
|
-
const warpedStart = warpTime(originalStart, inputDuration, outputDuration, easingFunction);
|
|
86
|
-
const warpedEnd = warpTime(
|
|
87
|
-
originalStart + originalDuration,
|
|
88
|
-
inputDuration,
|
|
89
|
-
outputDuration,
|
|
90
|
-
easingFunction
|
|
91
|
-
);
|
|
92
|
-
return warpedEnd - warpedStart;
|
|
93
|
-
}
|
|
94
|
-
function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
|
|
95
|
-
const errors = [];
|
|
96
|
-
const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
|
|
97
|
-
if (Math.abs(startWarp - 0) > tolerance) {
|
|
98
|
-
errors.push(`Start point should be 0, got ${startWarp}`);
|
|
99
|
-
}
|
|
100
|
-
const endWarp = warpTime(inputDuration, inputDuration, outputDuration, easingFunction);
|
|
101
|
-
if (Math.abs(endWarp - outputDuration) > tolerance) {
|
|
102
|
-
errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
|
|
103
|
-
}
|
|
104
|
-
let prevWarp = 0;
|
|
105
|
-
for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
|
|
106
|
-
const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
|
|
107
|
-
if (warp < prevWarp) {
|
|
108
|
-
errors.push(`Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`);
|
|
109
|
-
break;
|
|
40
|
+
const requestPromise = fetch(url, options).then(async (response) => {
|
|
41
|
+
try {
|
|
42
|
+
const bodyText = await response.clone().text();
|
|
43
|
+
responseCache.set(cacheKey, {
|
|
44
|
+
bodyText,
|
|
45
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
46
|
+
status: response.status,
|
|
47
|
+
timestamp: Date.now()
|
|
48
|
+
});
|
|
49
|
+
} catch {
|
|
110
50
|
}
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
51
|
+
return response;
|
|
52
|
+
}).finally(() => {
|
|
53
|
+
const timeoutId = setTimeout(() => {
|
|
54
|
+
inFlightRequests.delete(cacheKey);
|
|
55
|
+
pendingTimeouts.delete(cacheKey);
|
|
56
|
+
}, 50);
|
|
57
|
+
pendingTimeouts.set(cacheKey, timeoutId);
|
|
58
|
+
});
|
|
59
|
+
inFlightRequests.set(cacheKey, requestPromise);
|
|
60
|
+
return requestPromise;
|
|
114
61
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
for (
|
|
119
|
-
|
|
120
|
-
const t2 = (i + 1) / samples * inputDuration;
|
|
121
|
-
const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
|
|
122
|
-
const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
|
|
123
|
-
const inputSegmentDuration = t2 - t1;
|
|
124
|
-
const outputSegmentDuration = warp2 - warp1;
|
|
125
|
-
const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
|
|
126
|
-
const speedMultiplier = absoluteSpeed / averageSpeed;
|
|
127
|
-
speedMultipliers.push(speedMultiplier);
|
|
62
|
+
function clearFetchCache() {
|
|
63
|
+
responseCache.clear();
|
|
64
|
+
inFlightRequests.clear();
|
|
65
|
+
for (const timeoutId of pendingTimeouts.values()) {
|
|
66
|
+
clearTimeout(timeoutId);
|
|
128
67
|
}
|
|
129
|
-
|
|
130
|
-
const maxSpeed = Math.max(...speedMultipliers);
|
|
131
|
-
const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
|
|
132
|
-
return { speedMultipliers, minSpeed, maxSpeed, avgSpeed };
|
|
68
|
+
pendingTimeouts.clear();
|
|
133
69
|
}
|
|
134
70
|
|
|
135
71
|
// src/lib/gridSplitter.ts
|
|
@@ -188,14 +124,14 @@ function createGridForDimensions(width, height, rows, cols) {
|
|
|
188
124
|
for (let row = 0; row < rows; row++) {
|
|
189
125
|
for (let col = 0; col < cols; col++) {
|
|
190
126
|
cells.push({
|
|
191
|
-
|
|
192
|
-
y: Math.round(row * cellHeight),
|
|
127
|
+
height: Math.round(cellHeight),
|
|
193
128
|
width: Math.round(cellWidth),
|
|
194
|
-
|
|
129
|
+
x: Math.round(col * cellWidth),
|
|
130
|
+
y: Math.round(row * cellHeight)
|
|
195
131
|
});
|
|
196
132
|
}
|
|
197
133
|
}
|
|
198
|
-
return {
|
|
134
|
+
return { cells, cols, confidence: 1, rows };
|
|
199
135
|
}
|
|
200
136
|
async function detectGridWithDimensions(imageDataUrl, rows, cols) {
|
|
201
137
|
return new Promise((resolve, reject) => {
|
|
@@ -238,11 +174,11 @@ function getGridCandidates(width, height) {
|
|
|
238
174
|
const gridSymmetry = 1 - Math.abs(rows - cols) / Math.max(rows, cols);
|
|
239
175
|
const score = cellARScore * 0.45 + layoutScore * 0.25 + cellCountScore * 0.15 + gridSymmetry * 0.15;
|
|
240
176
|
candidates.push({
|
|
241
|
-
rows,
|
|
242
|
-
cols,
|
|
243
|
-
cellWidth,
|
|
244
|
-
cellHeight,
|
|
245
177
|
cellAspectRatio,
|
|
178
|
+
cellHeight,
|
|
179
|
+
cellWidth,
|
|
180
|
+
cols,
|
|
181
|
+
rows,
|
|
246
182
|
score
|
|
247
183
|
});
|
|
248
184
|
}
|
|
@@ -252,8 +188,16 @@ function getGridCandidates(width, height) {
|
|
|
252
188
|
function analyzeGridFromImageData(imageData) {
|
|
253
189
|
const { width, height, data } = imageData;
|
|
254
190
|
const candidates = getGridCandidates(width, height);
|
|
255
|
-
const verticalEdgeStrength = calculateVerticalEdgeProfile(
|
|
256
|
-
|
|
191
|
+
const verticalEdgeStrength = calculateVerticalEdgeProfile(
|
|
192
|
+
data,
|
|
193
|
+
width,
|
|
194
|
+
height
|
|
195
|
+
);
|
|
196
|
+
const horizontalEdgeStrength = calculateHorizontalEdgeProfile(
|
|
197
|
+
data,
|
|
198
|
+
width,
|
|
199
|
+
height
|
|
200
|
+
);
|
|
257
201
|
let bestCandidate = candidates[0];
|
|
258
202
|
let bestCombinedScore = -Infinity;
|
|
259
203
|
for (const candidate of candidates.slice(0, 8)) {
|
|
@@ -271,7 +215,12 @@ function analyzeGridFromImageData(imageData) {
|
|
|
271
215
|
bestCandidate = candidate;
|
|
272
216
|
}
|
|
273
217
|
}
|
|
274
|
-
const result = createGridForDimensions(
|
|
218
|
+
const result = createGridForDimensions(
|
|
219
|
+
width,
|
|
220
|
+
height,
|
|
221
|
+
bestCandidate.rows,
|
|
222
|
+
bestCandidate.cols
|
|
223
|
+
);
|
|
275
224
|
result.confidence = bestCombinedScore;
|
|
276
225
|
return result;
|
|
277
226
|
}
|
|
@@ -320,7 +269,10 @@ function scoreGridByEdges(rows, cols, width, height, verticalProfile, horizontal
|
|
|
320
269
|
const horizontalBaseline = horizontalSum / horizontalProfile.length;
|
|
321
270
|
let totalRatio = 0;
|
|
322
271
|
let divisions = 0;
|
|
323
|
-
const searchWindow = Math.max(
|
|
272
|
+
const searchWindow = Math.max(
|
|
273
|
+
3,
|
|
274
|
+
Math.floor(Math.min(width / cols, height / rows) * 0.03)
|
|
275
|
+
);
|
|
324
276
|
if (cols > 1) {
|
|
325
277
|
const cellWidth = width / cols;
|
|
326
278
|
for (let i = 1; i < cols; i++) {
|
|
@@ -417,7 +369,7 @@ function getImageDimensions2(base64DataUrl) {
|
|
|
417
369
|
}
|
|
418
370
|
const img = new Image();
|
|
419
371
|
img.onload = () => {
|
|
420
|
-
resolve({
|
|
372
|
+
resolve({ height: img.naturalHeight, width: img.naturalWidth });
|
|
421
373
|
};
|
|
422
374
|
img.onerror = () => {
|
|
423
375
|
resolve(null);
|
|
@@ -433,7 +385,7 @@ function getVideoDimensions(videoUrl) {
|
|
|
433
385
|
}
|
|
434
386
|
const video = document.createElement("video");
|
|
435
387
|
video.onloadedmetadata = () => {
|
|
436
|
-
resolve({
|
|
388
|
+
resolve({ height: video.videoHeight, width: video.videoWidth });
|
|
437
389
|
};
|
|
438
390
|
video.onerror = () => {
|
|
439
391
|
resolve(null);
|
|
@@ -448,7 +400,7 @@ var MAX_HEIGHT = 600;
|
|
|
448
400
|
var NODE_CHROME_HEIGHT = 100;
|
|
449
401
|
function calculateNodeSize(aspectRatio, baseWidth = 300) {
|
|
450
402
|
if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
|
|
451
|
-
return {
|
|
403
|
+
return { height: 300, width: 300 };
|
|
452
404
|
}
|
|
453
405
|
let width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, baseWidth));
|
|
454
406
|
let contentHeight = width / aspectRatio;
|
|
@@ -476,87 +428,165 @@ function calculateNodeSize(aspectRatio, baseWidth = 300) {
|
|
|
476
428
|
totalHeight = Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, totalHeight));
|
|
477
429
|
}
|
|
478
430
|
return {
|
|
479
|
-
|
|
480
|
-
|
|
431
|
+
height: Math.round(totalHeight),
|
|
432
|
+
width: Math.round(width)
|
|
481
433
|
};
|
|
482
434
|
}
|
|
483
435
|
function calculateNodeSizePreservingHeight(aspectRatio, currentHeight) {
|
|
484
436
|
if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
|
|
485
|
-
return {
|
|
437
|
+
return { height: currentHeight ?? 300, width: 300 };
|
|
486
438
|
}
|
|
487
439
|
if (currentHeight !== void 0 && currentHeight >= MIN_HEIGHT && currentHeight <= MAX_HEIGHT) {
|
|
488
440
|
const contentHeight = currentHeight - NODE_CHROME_HEIGHT;
|
|
489
441
|
let width = contentHeight * aspectRatio;
|
|
490
442
|
width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, width));
|
|
491
443
|
return {
|
|
492
|
-
|
|
493
|
-
|
|
444
|
+
height: Math.round(currentHeight),
|
|
445
|
+
width: Math.round(width)
|
|
494
446
|
};
|
|
495
447
|
}
|
|
496
448
|
return calculateNodeSize(aspectRatio);
|
|
497
449
|
}
|
|
498
450
|
|
|
499
|
-
// src/lib/
|
|
500
|
-
var
|
|
501
|
-
var
|
|
502
|
-
var
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const
|
|
508
|
-
|
|
451
|
+
// src/lib/speedCurve.ts
|
|
452
|
+
var INVERSE_TOLERANCE = 1e-6;
|
|
453
|
+
var INVERSE_MAX_ITERATIONS = 32;
|
|
454
|
+
var MONOTONICITY_SAMPLES = 256;
|
|
455
|
+
var MONOTONICITY_TOLERANCE = 1e-6;
|
|
456
|
+
var inverseCache = /* @__PURE__ */ new WeakMap();
|
|
457
|
+
var monotonicityCache = /* @__PURE__ */ new WeakMap();
|
|
458
|
+
function isMonotonicIncreasing(func) {
|
|
459
|
+
const cached = monotonicityCache.get(func);
|
|
460
|
+
if (cached !== void 0) {
|
|
461
|
+
return cached;
|
|
462
|
+
}
|
|
463
|
+
let prev = func(0);
|
|
464
|
+
for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
|
|
465
|
+
const value = func(i / MONOTONICITY_SAMPLES);
|
|
466
|
+
if (value + MONOTONICITY_TOLERANCE < prev) {
|
|
467
|
+
monotonicityCache.set(func, false);
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
prev = value;
|
|
471
|
+
}
|
|
472
|
+
monotonicityCache.set(func, true);
|
|
473
|
+
return true;
|
|
509
474
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
|
514
|
-
return new Response(cached.bodyText, {
|
|
515
|
-
status: cached.status,
|
|
516
|
-
headers: cached.headers
|
|
517
|
-
});
|
|
475
|
+
function invertEasingValue(target, func) {
|
|
476
|
+
if (target <= INVERSE_TOLERANCE) {
|
|
477
|
+
return 0;
|
|
518
478
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
479
|
+
if (target >= 1 - INVERSE_TOLERANCE) {
|
|
480
|
+
return 1;
|
|
481
|
+
}
|
|
482
|
+
let low = 0;
|
|
483
|
+
let high = 1;
|
|
484
|
+
let mid = 0.5;
|
|
485
|
+
for (let i = 0; i < INVERSE_MAX_ITERATIONS; i++) {
|
|
486
|
+
mid = (low + high) / 2;
|
|
487
|
+
const value = func(mid);
|
|
488
|
+
const diff = value - target;
|
|
489
|
+
if (Math.abs(diff) <= INVERSE_TOLERANCE) {
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
if (diff < 0) {
|
|
493
|
+
low = mid;
|
|
494
|
+
} else {
|
|
495
|
+
high = mid;
|
|
528
496
|
}
|
|
529
|
-
return new Response(JSON.stringify({ error: "Cache miss" }), { status: 500 });
|
|
530
497
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
498
|
+
return Math.min(1, Math.max(0, mid));
|
|
499
|
+
}
|
|
500
|
+
function getInverseEasing(func) {
|
|
501
|
+
if (inverseCache.has(func)) {
|
|
502
|
+
return inverseCache.get(func);
|
|
503
|
+
}
|
|
504
|
+
if (!isMonotonicIncreasing(func)) {
|
|
505
|
+
inverseCache.set(func, null);
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
const inverse = (value) => {
|
|
509
|
+
const clamped = Math.max(0, Math.min(1, value));
|
|
510
|
+
return invertEasingValue(clamped, func);
|
|
511
|
+
};
|
|
512
|
+
inverseCache.set(func, inverse);
|
|
513
|
+
return inverse;
|
|
514
|
+
}
|
|
515
|
+
function mapTimeWithEasing(normalizedTime, func) {
|
|
516
|
+
const inverse = getInverseEasing(func);
|
|
517
|
+
if (!inverse) {
|
|
518
|
+
return func(normalizedTime);
|
|
519
|
+
}
|
|
520
|
+
return inverse(normalizedTime);
|
|
521
|
+
}
|
|
522
|
+
function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
|
|
523
|
+
const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
|
|
524
|
+
const t = originalTime / inputDuration;
|
|
525
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
526
|
+
const eased = mapTimeWithEasing(clamped, easingFunc);
|
|
527
|
+
return eased * outputDuration;
|
|
528
|
+
}
|
|
529
|
+
function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
|
|
530
|
+
const warpedStart = warpTime(
|
|
531
|
+
originalStart,
|
|
532
|
+
inputDuration,
|
|
533
|
+
outputDuration,
|
|
534
|
+
easingFunction
|
|
535
|
+
);
|
|
536
|
+
const warpedEnd = warpTime(
|
|
537
|
+
originalStart + originalDuration,
|
|
538
|
+
inputDuration,
|
|
539
|
+
outputDuration,
|
|
540
|
+
easingFunction
|
|
541
|
+
);
|
|
542
|
+
return warpedEnd - warpedStart;
|
|
543
|
+
}
|
|
544
|
+
function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
|
|
545
|
+
const errors = [];
|
|
546
|
+
const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
|
|
547
|
+
if (Math.abs(startWarp - 0) > tolerance) {
|
|
548
|
+
errors.push(`Start point should be 0, got ${startWarp}`);
|
|
549
|
+
}
|
|
550
|
+
const endWarp = warpTime(
|
|
551
|
+
inputDuration,
|
|
552
|
+
inputDuration,
|
|
553
|
+
outputDuration,
|
|
554
|
+
easingFunction
|
|
555
|
+
);
|
|
556
|
+
if (Math.abs(endWarp - outputDuration) > tolerance) {
|
|
557
|
+
errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
|
|
558
|
+
}
|
|
559
|
+
let prevWarp = 0;
|
|
560
|
+
for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
|
|
561
|
+
const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
|
|
562
|
+
if (warp < prevWarp) {
|
|
563
|
+
errors.push(
|
|
564
|
+
`Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`
|
|
565
|
+
);
|
|
566
|
+
break;
|
|
541
567
|
}
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
inFlightRequests.delete(cacheKey);
|
|
546
|
-
pendingTimeouts.delete(cacheKey);
|
|
547
|
-
}, 50);
|
|
548
|
-
pendingTimeouts.set(cacheKey, timeoutId);
|
|
549
|
-
});
|
|
550
|
-
inFlightRequests.set(cacheKey, requestPromise);
|
|
551
|
-
return requestPromise;
|
|
568
|
+
prevWarp = warp;
|
|
569
|
+
}
|
|
570
|
+
return { errors, valid: errors.length === 0 };
|
|
552
571
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
for (
|
|
557
|
-
|
|
572
|
+
function analyzeWarpCurve(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, samples = 100) {
|
|
573
|
+
const speedMultipliers = [];
|
|
574
|
+
const averageSpeed = inputDuration / outputDuration;
|
|
575
|
+
for (let i = 0; i < samples; i++) {
|
|
576
|
+
const t1 = i / samples * inputDuration;
|
|
577
|
+
const t2 = (i + 1) / samples * inputDuration;
|
|
578
|
+
const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
|
|
579
|
+
const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
|
|
580
|
+
const inputSegmentDuration = t2 - t1;
|
|
581
|
+
const outputSegmentDuration = warp2 - warp1;
|
|
582
|
+
const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
|
|
583
|
+
const speedMultiplier = absoluteSpeed / averageSpeed;
|
|
584
|
+
speedMultipliers.push(speedMultiplier);
|
|
558
585
|
}
|
|
559
|
-
|
|
586
|
+
const minSpeed = Math.min(...speedMultipliers);
|
|
587
|
+
const maxSpeed = Math.max(...speedMultipliers);
|
|
588
|
+
const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
|
|
589
|
+
return { avgSpeed, maxSpeed, minSpeed, speedMultipliers };
|
|
560
590
|
}
|
|
561
591
|
|
|
562
592
|
export { analyzeWarpCurve, calculateNodeSize, calculateNodeSizePreservingHeight, calculateWarpedDuration, clearFetchCache, createGridForDimensions, deduplicatedFetch, detectAndSplitGrid, detectGrid, detectGridWithDimensions, getGridCandidates, getImageDimensions2 as getImageDimensionsFromDataUrl, getVideoDimensions as getVideoDimensionsFromUrl, splitImage, splitWithDimensions, validateWarpFunction, warpTime };
|
package/dist/nodes.d.ts
CHANGED
|
@@ -41,8 +41,6 @@ interface BaseNodeProps extends NodeProps {
|
|
|
41
41
|
declare function BaseNodeComponent({ id, type, data, selected, children, headerActions, title, titleElement, hideStatusIndicator, width, height, disabledInputs, }: BaseNodeProps): react_jsx_runtime.JSX.Element | null;
|
|
42
42
|
declare const BaseNode: react.MemoExoticComponent<typeof BaseNodeComponent>;
|
|
43
43
|
|
|
44
|
-
declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
|
|
45
|
-
|
|
46
44
|
declare function WorkflowInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
|
|
47
45
|
declare const WorkflowInputNode: react.MemoExoticComponent<typeof WorkflowInputNodeComponent>;
|
|
48
46
|
|
|
@@ -84,6 +82,8 @@ declare const PromptNode: react.MemoExoticComponent<typeof PromptNodeComponent>;
|
|
|
84
82
|
declare function VideoInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
|
|
85
83
|
declare const VideoInputNode: react.MemoExoticComponent<typeof VideoInputNodeComponent>;
|
|
86
84
|
|
|
85
|
+
declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
|
|
86
|
+
|
|
87
87
|
declare function DownloadNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
|
|
88
88
|
declare const DownloadNode: react.MemoExoticComponent<typeof DownloadNodeComponent>;
|
|
89
89
|
/** @deprecated Use DownloadNode instead */
|
package/dist/nodes.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-CV4M7CNU.mjs';
|
|
8
|
-
import './chunk-LDN7IX4Y.mjs';
|
|
9
|
-
import './chunk-LT3ZJJL6.mjs';
|
|
10
|
-
import './chunk-R727OFBR.mjs';
|
|
1
|
+
export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-2FUPL67V.mjs';
|
|
2
|
+
import './chunk-C6MQBJFC.mjs';
|
|
3
|
+
import './chunk-FWJIAW2E.mjs';
|
|
4
|
+
import './chunk-B4EAAKYF.mjs';
|
|
5
|
+
import './chunk-U4QPE4CY.mjs';
|
|
6
|
+
import './chunk-VVQ4CH77.mjs';
|
|
11
7
|
import './chunk-MLJJBBTB.mjs';
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
8
|
+
import './chunk-YUIK4AHM.mjs';
|
|
9
|
+
import './chunk-QQVHGJ2G.mjs';
|
|
10
|
+
import './chunk-LDN7IX4Y.mjs';
|
|
11
|
+
import './chunk-OJWVEEMM.mjs';
|
|
12
|
+
import './chunk-GPYIIWD5.mjs';
|
|
13
|
+
import './chunk-XRC3O5GK.mjs';
|
package/dist/panels.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
+
declare function DebugPanel(): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
5
7
|
declare function NodePalette(): react_jsx_runtime.JSX.Element;
|
|
6
8
|
|
|
7
9
|
interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -16,7 +18,4 @@ interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
18
|
*/
|
|
17
19
|
declare const PanelContainer: react.ForwardRefExoticComponent<PanelContainerProps & react.RefAttributes<HTMLDivElement>>;
|
|
18
20
|
|
|
19
|
-
declare function DebugPanelComponent(): react_jsx_runtime.JSX.Element;
|
|
20
|
-
declare const DebugPanel: react.MemoExoticComponent<typeof DebugPanelComponent>;
|
|
21
|
-
|
|
22
21
|
export { DebugPanel, NodePalette, PanelContainer };
|
package/dist/panels.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DebugPanel, NodePalette, PanelContainer } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { DebugPanel, NodePalette, PanelContainer } from './chunk-IYFWAJBB.mjs';
|
|
2
|
+
import './chunk-OJWVEEMM.mjs';
|
|
3
|
+
import './chunk-GPYIIWD5.mjs';
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { W as WorkflowUIConfig } from './types-CRXJnajq.js';
|
|
2
|
+
export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-CRXJnajq.js';
|
|
1
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
4
|
import { ReactNode } from 'react';
|
|
3
|
-
import { W as WorkflowUIConfig } from './types-IEKYuYhu.js';
|
|
4
|
-
export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-IEKYuYhu.js';
|
|
5
5
|
import '@genfeedai/types';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/provider.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './chunk-MLJJBBTB.mjs';
|
|
2
|
-
export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-YUIK4AHM.mjs';
|
|
3
|
+
import './chunk-XRC3O5GK.mjs';
|
package/dist/stores.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { W as WorkflowStore } from './
|
|
2
|
-
export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './
|
|
1
|
+
import { W as WorkflowStore } from './workflowStore-Bsz0nd5c.js';
|
|
2
|
+
export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './workflowStore-Bsz0nd5c.js';
|
|
3
|
+
export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
|
|
3
4
|
import * as _xyflow_react from '@xyflow/react';
|
|
4
5
|
import * as _genfeedai_types from '@genfeedai/types';
|
|
5
|
-
export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
|
|
6
6
|
import 'zustand';
|
|
7
|
-
import '
|
|
8
|
-
import './types-IEKYuYhu.js';
|
|
7
|
+
import './types-CRXJnajq.js';
|
|
9
8
|
import 'react';
|
|
9
|
+
import 'zundo';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Stable Zustand Selectors
|
package/dist/stores.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { createSelectGroupByNodeId, createSelectIsNodeSelected, createSelectNodeById, selectAddNode, selectAddNodesAndEdges, selectCreateGroup, selectDeleteGroup, selectDuplicateNode, selectEdgeStyle, selectEdges, selectFindCompatibleHandle, selectGetConnectedNodeIds, selectGetNodeById, selectGroups, selectIsDirty, selectIsLoading, selectIsSaving, selectIsValidConnection, selectNavigationTargetId, selectNodes, selectOnConnect, selectOnEdgesChange, selectOnNodesChange, selectRemoveEdge, selectRemoveNode, selectSelectedNodeIds, selectSetDirty, selectSetSelectedNodeIds, selectToggleNodeLock, selectUnlockAllNodes, selectUpdateNodeData, selectWorkflowId, selectWorkflowName, useContextMenuStore } from './chunk-7LV4UAUS.mjs';
|
|
2
|
+
export { useAnnotationStore, usePromptEditorStore } from './chunk-QQVHGJ2G.mjs';
|
|
3
3
|
import './chunk-LDN7IX4Y.mjs';
|
|
4
|
-
export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-
|
|
5
|
-
export { useWorkflowStore } from './chunk-
|
|
6
|
-
export { configurePromptLibrary, usePromptLibraryStore } from './chunk-
|
|
4
|
+
export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-OJWVEEMM.mjs';
|
|
5
|
+
export { useWorkflowStore } from './chunk-GPYIIWD5.mjs';
|
|
6
|
+
export { configurePromptLibrary, usePromptLibraryStore } from './chunk-XRC3O5GK.mjs';
|