@orangecatai/adgen-canvas 0.0.34 → 0.0.36
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/dev/{chunk-DB6EMYXB.js → chunk-2NSNU2PO.js} +2 -2
- package/dist/dev/{chunk-JBHZ6CNN.js → chunk-UECNYULR.js} +9 -6
- package/dist/dev/{chunk-JBHZ6CNN.js.map → chunk-UECNYULR.js.map} +3 -3
- package/dist/dev/data/{image-IIQSXNFT.js → image-3S7FVECW.js} +3 -3
- package/dist/dev/index.js +143 -25
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/{chunk-T2MY3VHD.js → chunk-7MAYRMSQ.js} +3 -3
- package/dist/prod/{chunk-KFCCNTO2.js → chunk-KZGD5EMI.js} +1 -1
- package/dist/prod/data/image-I3FR2Q7R.js +1 -0
- package/dist/prod/index.js +71 -71
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/element/src/frame.d.ts +16 -0
- package/dist/types/excalidraw/components/video/pendingVideoGenerations.d.ts +46 -0
- package/dist/types/excalidraw/renderer/staticSvgScene.d.ts +1 -1
- package/package.json +2 -2
- package/dist/prod/data/image-3RDLE3VN.js +0 -1
- /package/dist/dev/{chunk-DB6EMYXB.js.map → chunk-2NSNU2PO.js.map} +0 -0
- /package/dist/dev/data/{image-IIQSXNFT.js.map → image-3S7FVECW.js.map} +0 -0
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
decodePngMetadata,
|
|
3
3
|
encodePngMetadata,
|
|
4
4
|
getTEXtChunk
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-UECNYULR.js";
|
|
6
|
+
import "../chunk-2NSNU2PO.js";
|
|
7
7
|
import "../chunk-XDFCUUT6.js";
|
|
8
8
|
export {
|
|
9
9
|
decodePngMetadata,
|
|
10
10
|
encodePngMetadata,
|
|
11
11
|
getTEXtChunk
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=image-
|
|
13
|
+
//# sourceMappingURL=image-3S7FVECW.js.map
|
package/dist/dev/index.js
CHANGED
|
@@ -66,10 +66,10 @@ import {
|
|
|
66
66
|
serializeAsJSON,
|
|
67
67
|
serializeLibraryAsJSON,
|
|
68
68
|
strokeRectWithRotation_simple
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-UECNYULR.js";
|
|
70
70
|
import {
|
|
71
71
|
define_import_meta_env_default
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-2NSNU2PO.js";
|
|
73
73
|
import {
|
|
74
74
|
en_default
|
|
75
75
|
} from "./chunk-LIELFD5T.js";
|
|
@@ -268,6 +268,7 @@ import {
|
|
|
268
268
|
getElementsInResizingFrame as getElementsInResizingFrame4,
|
|
269
269
|
getElementsInNewFrame,
|
|
270
270
|
getContainingFrame as getContainingFrame3,
|
|
271
|
+
orderFramesToBack,
|
|
271
272
|
elementOverlapsWithFrame as elementOverlapsWithFrame2,
|
|
272
273
|
updateFrameMembershipOfSelectedElements as updateFrameMembershipOfSelectedElements4,
|
|
273
274
|
isElementInFrame,
|
|
@@ -9641,12 +9642,12 @@ var copyBlobToClipboardAsPng = async (blob) => {
|
|
|
9641
9642
|
};
|
|
9642
9643
|
var copyTextToSystemClipboard = async (text, clipboardEvent) => {
|
|
9643
9644
|
text = text || "";
|
|
9644
|
-
const
|
|
9645
|
+
const entries2 = Object.entries(
|
|
9645
9646
|
typeof text === "string" ? { [MIME_TYPES2.text]: text } : text
|
|
9646
9647
|
);
|
|
9647
9648
|
try {
|
|
9648
9649
|
if (clipboardEvent) {
|
|
9649
|
-
for (const [mimeType, value] of
|
|
9650
|
+
for (const [mimeType, value] of entries2) {
|
|
9650
9651
|
clipboardEvent.clipboardData?.setData(mimeType, value);
|
|
9651
9652
|
if (clipboardEvent.clipboardData?.getData(mimeType) !== value) {
|
|
9652
9653
|
throw new Error("Failed to setData on clipboardEvent");
|
|
@@ -9657,7 +9658,7 @@ var copyTextToSystemClipboard = async (text, clipboardEvent) => {
|
|
|
9657
9658
|
} catch (error) {
|
|
9658
9659
|
console.error(error);
|
|
9659
9660
|
}
|
|
9660
|
-
const plainTextEntry =
|
|
9661
|
+
const plainTextEntry = entries2.find(
|
|
9661
9662
|
([mimeType]) => mimeType === MIME_TYPES2.text
|
|
9662
9663
|
);
|
|
9663
9664
|
if (probablySupportsClipboardWriteText && plainTextEntry) {
|
|
@@ -9796,7 +9797,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
9796
9797
|
let blob = canvasToBlob(tempCanvas);
|
|
9797
9798
|
if (appState.exportEmbedScene) {
|
|
9798
9799
|
blob = blob.then(
|
|
9799
|
-
(blob2) => import("./data/image-
|
|
9800
|
+
(blob2) => import("./data/image-3S7FVECW.js").then(
|
|
9800
9801
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
9801
9802
|
blob: blob2,
|
|
9802
9803
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -20826,12 +20827,12 @@ var HistoryDelta = class extends StoreDelta {
|
|
|
20826
20827
|
/**
|
|
20827
20828
|
* Apply the delta to the passed elements and appState, does not modify the snapshot.
|
|
20828
20829
|
*/
|
|
20829
|
-
applyTo(elements, appState,
|
|
20830
|
+
applyTo(elements, appState, snapshot2) {
|
|
20830
20831
|
const [nextElements, elementsContainVisibleChange] = this.elements.applyTo(
|
|
20831
20832
|
elements,
|
|
20832
20833
|
// used to fallback into local snapshot in case we couldn't apply the delta
|
|
20833
20834
|
// due to a missing (force deleted) elements in the scene
|
|
20834
|
-
|
|
20835
|
+
snapshot2.elements,
|
|
20835
20836
|
// we don't want to apply the `version` and `versionNonce` properties for history
|
|
20836
20837
|
// as we always need to end up with a new version due to collaboration,
|
|
20837
20838
|
// approaching each undo / redo as a new user action
|
|
@@ -31427,6 +31428,90 @@ var VideoChainPanel = forwardRef6(
|
|
|
31427
31428
|
);
|
|
31428
31429
|
VideoChainPanel.displayName = "VideoChainPanel";
|
|
31429
31430
|
|
|
31431
|
+
// components/video/pendingVideoGenerations.ts
|
|
31432
|
+
var entries = /* @__PURE__ */ new Map();
|
|
31433
|
+
var subscribers = /* @__PURE__ */ new Map();
|
|
31434
|
+
var snapshot = (frameId) => {
|
|
31435
|
+
const entry = entries.get(frameId);
|
|
31436
|
+
return entry ? {
|
|
31437
|
+
prompt: entry.prompt,
|
|
31438
|
+
status: entry.status,
|
|
31439
|
+
progress: entry.progress,
|
|
31440
|
+
error: entry.error
|
|
31441
|
+
} : null;
|
|
31442
|
+
};
|
|
31443
|
+
var notify5 = (frameId) => {
|
|
31444
|
+
const snap = snapshot(frameId);
|
|
31445
|
+
subscribers.get(frameId)?.forEach((fn) => fn(snap));
|
|
31446
|
+
};
|
|
31447
|
+
function startPendingVideoGeneration(frameId, prompt, controller) {
|
|
31448
|
+
entries.set(frameId, {
|
|
31449
|
+
prompt,
|
|
31450
|
+
status: "submitting",
|
|
31451
|
+
progress: 0,
|
|
31452
|
+
error: null,
|
|
31453
|
+
controller
|
|
31454
|
+
});
|
|
31455
|
+
notify5(frameId);
|
|
31456
|
+
}
|
|
31457
|
+
function setPendingVideoStatus(frameId, status) {
|
|
31458
|
+
const entry = entries.get(frameId);
|
|
31459
|
+
if (!entry) {
|
|
31460
|
+
return;
|
|
31461
|
+
}
|
|
31462
|
+
entry.status = status;
|
|
31463
|
+
notify5(frameId);
|
|
31464
|
+
}
|
|
31465
|
+
function setPendingVideoProgress(frameId, progress) {
|
|
31466
|
+
const entry = entries.get(frameId);
|
|
31467
|
+
if (!entry) {
|
|
31468
|
+
return;
|
|
31469
|
+
}
|
|
31470
|
+
entry.progress = progress;
|
|
31471
|
+
notify5(frameId);
|
|
31472
|
+
}
|
|
31473
|
+
function finishPendingVideoGeneration(frameId, error) {
|
|
31474
|
+
const entry = entries.get(frameId);
|
|
31475
|
+
if (!entry) {
|
|
31476
|
+
return;
|
|
31477
|
+
}
|
|
31478
|
+
if (error === null || error === "aborted") {
|
|
31479
|
+
entries.delete(frameId);
|
|
31480
|
+
} else {
|
|
31481
|
+
entry.status = "error";
|
|
31482
|
+
entry.error = error;
|
|
31483
|
+
entry.progress = 0;
|
|
31484
|
+
}
|
|
31485
|
+
notify5(frameId);
|
|
31486
|
+
}
|
|
31487
|
+
function subscribeVideoGeneration(frameId, fn) {
|
|
31488
|
+
let set = subscribers.get(frameId);
|
|
31489
|
+
if (!set) {
|
|
31490
|
+
set = /* @__PURE__ */ new Set();
|
|
31491
|
+
subscribers.set(frameId, set);
|
|
31492
|
+
}
|
|
31493
|
+
set.add(fn);
|
|
31494
|
+
}
|
|
31495
|
+
function unsubscribeVideoGeneration(frameId, fn) {
|
|
31496
|
+
const set = subscribers.get(frameId);
|
|
31497
|
+
if (!set) {
|
|
31498
|
+
return;
|
|
31499
|
+
}
|
|
31500
|
+
set.delete(fn);
|
|
31501
|
+
if (set.size === 0) {
|
|
31502
|
+
subscribers.delete(frameId);
|
|
31503
|
+
}
|
|
31504
|
+
}
|
|
31505
|
+
function clearVideoGenerationState(frameId) {
|
|
31506
|
+
entries.delete(frameId);
|
|
31507
|
+
}
|
|
31508
|
+
function abortPendingVideoGeneration(frameId) {
|
|
31509
|
+
entries.get(frameId)?.controller.abort();
|
|
31510
|
+
}
|
|
31511
|
+
function getPendingVideoState(frameId) {
|
|
31512
|
+
return snapshot(frameId);
|
|
31513
|
+
}
|
|
31514
|
+
|
|
31430
31515
|
// components/VideoGeneratorPanel.tsx
|
|
31431
31516
|
import { Fragment as Fragment18, jsx as jsx99, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
31432
31517
|
var VIDEO_MODEL_CONFIG = {
|
|
@@ -31910,7 +31995,8 @@ var VideoGeneratorPanel = ({
|
|
|
31910
31995
|
}
|
|
31911
31996
|
return stopsFor(modelCfg)[0];
|
|
31912
31997
|
})();
|
|
31913
|
-
const
|
|
31998
|
+
const restored = getPendingVideoState(element.id);
|
|
31999
|
+
const [prompt, setPrompt] = useState37(restored?.prompt ?? "");
|
|
31914
32000
|
const [selectedModel, setSelectedModel] = useState37(defaultModel);
|
|
31915
32001
|
const [selectedRatio, setSelectedRatio] = useState37(defaultRatio);
|
|
31916
32002
|
const [selectedResolution, setSelectedResolution] = useState37(defaultResolution);
|
|
@@ -31929,9 +32015,13 @@ var VideoGeneratorPanel = ({
|
|
|
31929
32015
|
);
|
|
31930
32016
|
const [chainPhase, setChainPhase] = useState37("idle");
|
|
31931
32017
|
const chainPanelRef = useRef34(null);
|
|
31932
|
-
const [genStatus, setGenStatus] = useState37(
|
|
31933
|
-
|
|
31934
|
-
|
|
32018
|
+
const [genStatus, setGenStatus] = useState37(
|
|
32019
|
+
restored?.status ?? "idle"
|
|
32020
|
+
);
|
|
32021
|
+
const [progress, setProgress] = useState37(restored?.progress ?? 0);
|
|
32022
|
+
const [generateError, setGenerateError] = useState37(
|
|
32023
|
+
restored?.error ?? null
|
|
32024
|
+
);
|
|
31935
32025
|
const [modelOpen, setModelOpen] = useState37(false);
|
|
31936
32026
|
const [settingsOpen, setSettingsOpen] = useState37(false);
|
|
31937
32027
|
const [frameTypeOpen, setFrameTypeOpen] = useState37(false);
|
|
@@ -31950,6 +32040,22 @@ var VideoGeneratorPanel = ({
|
|
|
31950
32040
|
elementRef.current = element;
|
|
31951
32041
|
appRef.current = app;
|
|
31952
32042
|
});
|
|
32043
|
+
useEffect41(() => {
|
|
32044
|
+
const cb = (state3) => {
|
|
32045
|
+
if (!state3) {
|
|
32046
|
+
setGenStatus("idle");
|
|
32047
|
+
setProgress(0);
|
|
32048
|
+
return;
|
|
32049
|
+
}
|
|
32050
|
+
setGenStatus(state3.status);
|
|
32051
|
+
setProgress(state3.progress);
|
|
32052
|
+
if (state3.error) {
|
|
32053
|
+
setGenerateError(state3.error);
|
|
32054
|
+
}
|
|
32055
|
+
};
|
|
32056
|
+
subscribeVideoGeneration(element.id, cb);
|
|
32057
|
+
return () => unsubscribeVideoGeneration(element.id, cb);
|
|
32058
|
+
}, [element.id]);
|
|
31953
32059
|
const cfg = VIDEO_MODEL_CONFIG[selectedModel];
|
|
31954
32060
|
const durationStops = stopsFor(cfg);
|
|
31955
32061
|
const nativeMax = nativeMaxFor(cfg);
|
|
@@ -32166,10 +32272,12 @@ var VideoGeneratorPanel = ({
|
|
|
32166
32272
|
const chainIsRunning = chainPhase === "planning" || chainPhase === "generating" || chainPhase === "stitching";
|
|
32167
32273
|
const isBusy = isGenerating || chainIsRunning;
|
|
32168
32274
|
const handleStop = useCallback21(() => {
|
|
32275
|
+
abortPendingVideoGeneration(element.id);
|
|
32169
32276
|
abortControllerRef.current?.abort();
|
|
32277
|
+
clearVideoGenerationState(element.id);
|
|
32170
32278
|
setGenStatus("idle");
|
|
32171
32279
|
setProgress(0);
|
|
32172
|
-
}, []);
|
|
32280
|
+
}, [element.id]);
|
|
32173
32281
|
const handleGenerate = useCallback21(async () => {
|
|
32174
32282
|
if (!prompt.trim()) {
|
|
32175
32283
|
setGenerateError("Please enter a prompt.");
|
|
@@ -32187,24 +32295,27 @@ var VideoGeneratorPanel = ({
|
|
|
32187
32295
|
setGenStatus("submitting");
|
|
32188
32296
|
setGenerateError(null);
|
|
32189
32297
|
setProgress(0);
|
|
32298
|
+
const controller = new AbortController();
|
|
32299
|
+
abortControllerRef.current = controller;
|
|
32300
|
+
const frameId = element.id;
|
|
32301
|
+
startPendingVideoGeneration(frameId, prompt, controller);
|
|
32190
32302
|
if (onBeforeVideoGen) {
|
|
32191
32303
|
try {
|
|
32192
32304
|
const { allowed, error } = await onBeforeVideoGen();
|
|
32193
32305
|
if (!allowed) {
|
|
32194
|
-
|
|
32195
|
-
|
|
32196
|
-
);
|
|
32306
|
+
const message = error || "Insufficient credits for video generation";
|
|
32307
|
+
setGenerateError(message);
|
|
32197
32308
|
setGenStatus("error");
|
|
32309
|
+
finishPendingVideoGeneration(frameId, message);
|
|
32198
32310
|
return;
|
|
32199
32311
|
}
|
|
32200
32312
|
} catch {
|
|
32201
32313
|
setGenerateError("Credit check failed");
|
|
32202
32314
|
setGenStatus("error");
|
|
32315
|
+
finishPendingVideoGeneration(frameId, "Credit check failed");
|
|
32203
32316
|
return;
|
|
32204
32317
|
}
|
|
32205
32318
|
}
|
|
32206
|
-
const controller = new AbortController();
|
|
32207
|
-
abortControllerRef.current = controller;
|
|
32208
32319
|
try {
|
|
32209
32320
|
const currentCfg = VIDEO_MODEL_CONFIG[selectedModel];
|
|
32210
32321
|
const cameraPhrase = cameraMovement ? CAMERA_MOVEMENTS.find((c) => c.label === cameraMovement)?.phrase : null;
|
|
@@ -32239,10 +32350,14 @@ var VideoGeneratorPanel = ({
|
|
|
32239
32350
|
videoGenUrl
|
|
32240
32351
|
);
|
|
32241
32352
|
setGenStatus("polling");
|
|
32353
|
+
setPendingVideoStatus(frameId, "polling");
|
|
32242
32354
|
const { videoPresignedUrl } = await pollVideoJob(
|
|
32243
32355
|
jobId,
|
|
32244
32356
|
videoGenStatusUrl,
|
|
32245
|
-
(p) =>
|
|
32357
|
+
(p) => {
|
|
32358
|
+
setProgress(p);
|
|
32359
|
+
setPendingVideoProgress(frameId, p);
|
|
32360
|
+
},
|
|
32246
32361
|
controller.signal
|
|
32247
32362
|
);
|
|
32248
32363
|
appRef.current.insertGeneratedVideoIntoFrame(
|
|
@@ -32260,21 +32375,24 @@ var VideoGeneratorPanel = ({
|
|
|
32260
32375
|
setPrompt("");
|
|
32261
32376
|
setFirstFrame(null);
|
|
32262
32377
|
setLastFrame(null);
|
|
32378
|
+
finishPendingVideoGeneration(frameId, null);
|
|
32263
32379
|
onAfterVideoGen?.();
|
|
32264
32380
|
} catch (err) {
|
|
32265
32381
|
if (err instanceof Error && err.name === "AbortError") {
|
|
32266
32382
|
setGenStatus("idle");
|
|
32383
|
+
finishPendingVideoGeneration(frameId, "aborted");
|
|
32267
32384
|
} else {
|
|
32268
|
-
|
|
32269
|
-
|
|
32270
|
-
);
|
|
32385
|
+
const message = err instanceof Error ? err.message : "Generation failed";
|
|
32386
|
+
setGenerateError(message);
|
|
32271
32387
|
setGenStatus("error");
|
|
32388
|
+
finishPendingVideoGeneration(frameId, message);
|
|
32272
32389
|
}
|
|
32273
32390
|
} finally {
|
|
32274
32391
|
abortControllerRef.current = null;
|
|
32275
32392
|
}
|
|
32276
32393
|
}, [
|
|
32277
32394
|
prompt,
|
|
32395
|
+
element.id,
|
|
32278
32396
|
segmentCount,
|
|
32279
32397
|
videoGenUrl,
|
|
32280
32398
|
videoGenStatusUrl,
|
|
@@ -36093,8 +36211,8 @@ var UserList = React48.memo(
|
|
|
36093
36211
|
if (!supportsResizeObserver) {
|
|
36094
36212
|
return;
|
|
36095
36213
|
}
|
|
36096
|
-
const resizeObserver = new ResizeObserver((
|
|
36097
|
-
for (const entry of
|
|
36214
|
+
const resizeObserver = new ResizeObserver((entries2) => {
|
|
36215
|
+
for (const entry of entries2) {
|
|
36098
36216
|
const { width } = entry.contentRect;
|
|
36099
36217
|
updateMaxAvatars(width);
|
|
36100
36218
|
}
|
|
@@ -55013,7 +55131,7 @@ var App = class _App extends React64.Component {
|
|
|
55013
55131
|
}
|
|
55014
55132
|
return true;
|
|
55015
55133
|
}).concat(iframeLikes);
|
|
55016
|
-
return elements;
|
|
55134
|
+
return orderFramesToBack(elements);
|
|
55017
55135
|
}
|
|
55018
55136
|
getElementHitThreshold(element) {
|
|
55019
55137
|
return Math.max(
|