@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.
@@ -1 +1 @@
1
- import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-KFCCNTO2.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
1
+ import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-KZGD5EMI.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
@@ -1 +1 @@
1
- import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-KFCCNTO2.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
1
+ import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-KZGD5EMI.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
@@ -20,6 +20,22 @@ export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDelet
20
20
  */
21
21
  export declare const groupByFrameLikes: (elements: readonly ExcalidrawElement[]) => Map<string, ExcalidrawElement[]>;
22
22
  export declare const getFrameChildren: (allElements: ElementsMapOrArray, frameId: string) => ExcalidrawElement[];
23
+ /**
24
+ * Frames are containers, not artwork: a frame drawn above the elements sitting
25
+ * on or near it hides them behind its fill and steals clicks meant for them,
26
+ * which reads to the user as "my image disappeared". Element order is z-order,
27
+ * so this pushes every frame-like element below every other element.
28
+ *
29
+ * Applied at the presentation layer only — rendering and hit testing — never to
30
+ * the scene itself: the scene array is mirrored by fractional indices that the
31
+ * store, history and collab reconciliation all reason about, and rewriting them
32
+ * on every scene update fights undo/redo. Relative order within each bucket is
33
+ * preserved, so frame-vs-frame and image-vs-image stacking survives untouched.
34
+ *
35
+ * Returns the passed array unchanged (same reference) when it already satisfies
36
+ * the invariant, which is the common case.
37
+ */
38
+ export declare const orderFramesToBack: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly T[];
23
39
  export declare const getFrameLikeElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawFrameLikeElement[];
24
40
  /**
25
41
  * Returns ExcalidrawFrameElements and non-frame-children elements.
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Pending video generation state — module-level so a run survives the panel
3
+ * unmounting. VideoGeneratorPanel is rendered only while its frame is
4
+ * selected (see App.tsx), so clicking empty canvas mid-generation tears the
5
+ * component down; without this store the spinner, progress and prompt would
6
+ * vanish and reselecting the frame would show an idle panel even though the
7
+ * request is still in flight.
8
+ *
9
+ * Mirrors image-generation/pendingGenerations.ts. Flow:
10
+ * 1. Generate → startPendingVideoGeneration(frameId, prompt, controller).
11
+ * 2. The panel seeds its local state from getPendingVideoState(frameId) on
12
+ * mount and subscribes for the rest, so a remount picks the run back up.
13
+ * 3. Status/progress updates flow through the store, so the in-flight closure
14
+ * (which may belong to an already-unmounted instance) and whichever panel
15
+ * is currently mounted stay in sync.
16
+ * 4. On success → clearVideoGenerationState(frameId) so reselecting the frame
17
+ * shows a clean prompt. On error the entry is kept so the message survives.
18
+ * 5. Stop button → abortPendingVideoGeneration(frameId).
19
+ *
20
+ * Subscribers are tracked separately from entries so a panel can subscribe
21
+ * before any generation has started on its frame.
22
+ */
23
+ export type PendingVideoStatus = "submitting" | "polling" | "done" | "error";
24
+ export interface PendingVideoState {
25
+ prompt: string;
26
+ status: PendingVideoStatus;
27
+ progress: number;
28
+ error: string | null;
29
+ }
30
+ export type VideoGenerationUpdateCallback = (state: PendingVideoState | null) => void;
31
+ export declare function startPendingVideoGeneration(frameId: string, prompt: string, controller: AbortController): void;
32
+ export declare function setPendingVideoStatus(frameId: string, status: PendingVideoStatus): void;
33
+ export declare function setPendingVideoProgress(frameId: string, progress: number): void;
34
+ /**
35
+ * Terminal update. `null` → success and `"aborted"` → stopped both drop the
36
+ * entry (nothing left to show); any other string parks the entry in "error"
37
+ * so a panel remounted afterwards still explains what happened.
38
+ */
39
+ export declare function finishPendingVideoGeneration(frameId: string, error: string | null): void;
40
+ export declare function subscribeVideoGeneration(frameId: string, fn: VideoGenerationUpdateCallback): void;
41
+ export declare function unsubscribeVideoGeneration(frameId: string, fn: VideoGenerationUpdateCallback): void;
42
+ export declare function clearVideoGenerationState(frameId: string): void;
43
+ export declare function abortPendingVideoGeneration(frameId: string): void;
44
+ export declare function hasPendingVideoGeneration(frameId: string): boolean;
45
+ export declare function getPendingVideoState(frameId: string): PendingVideoState | null;
46
+ export declare function getPendingVideoPrompt(frameId: string): string;
@@ -2,4 +2,4 @@ import type { NonDeletedExcalidrawElement } from "@orangecatai/element/types";
2
2
  import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
3
3
  import type { BinaryFiles } from "../types";
4
4
  import type { RoughSVG } from "roughjs/bin/svg";
5
- export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, renderConfig: SVGRenderConfig) => void;
5
+ export declare const renderSceneToSvg: (unorderedElements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, renderConfig: SVGRenderConfig) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangecatai/adgen-canvas",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -85,7 +85,7 @@
85
85
  "@excalidraw/mermaid-to-excalidraw": "2.0.0-rfc3",
86
86
  "@excalidraw/random-username": "1.1.0",
87
87
  "@orangecatai/common": "0.0.4",
88
- "@orangecatai/element": "0.0.4",
88
+ "@orangecatai/element": "0.0.5",
89
89
  "@orangecatai/math": "0.0.2",
90
90
  "@radix-ui/react-avatar": "1.1.11",
91
91
  "@radix-ui/react-select": "2.2.6",
@@ -1 +0,0 @@
1
- import{S as a,T as b,U as c}from"../chunk-T2MY3VHD.js";import"../chunk-KFCCNTO2.js";import"../chunk-SRAX5OIU.js";export{c as decodePngMetadata,b as encodePngMetadata,a as getTEXtChunk};