app-v3-scripts-editor 1.16.0 → 1.16.1

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,6 +1,6 @@
1
1
  import { Edge, EdgeProps, Node, ReactFlowJsonObject as OriginalReactFlowJsonObject, Viewport } from '@xyflow/react';
2
- import { UseErrorsAndInfosReturn } from '../../hooks/use-alerts';
3
2
  import { VOICE_CHOICE } from '../../constants/global-setting';
3
+ import { UseErrorsAndInfosReturn } from '../../hooks/use-alerts';
4
4
  type ReactFlowJsonObject = OriginalReactFlowJsonObject & {
5
5
  version?: string;
6
6
  type?: string;
@@ -35,10 +35,9 @@ export interface ScriptEditorInterface {
35
35
  viewport: Viewport;
36
36
  }, globalSetting: GlobalSettingData) => void, enabled?: boolean) => void;
37
37
  instanceId: string;
38
- resetHistory: (snap?: OriginalReactFlowJsonObject) => void;
39
38
  }
40
39
  export interface ScriptEditorProps {
41
40
  onAlertsChange?: (values: UseErrorsAndInfosReturn) => void;
42
41
  type: "autocall" | "autoflow";
43
42
  }
44
- export type { EdgeProps, Node, ReactFlowJsonObject, GlobalSettingData };
43
+ export type { EdgeProps, GlobalSettingData, Node, ReactFlowJsonObject };
@@ -8,15 +8,31 @@ export type FlowSnapshot = {
8
8
  zoom: number;
9
9
  } | null;
10
10
  };
11
- type UndoStoreState = {
11
+ type UndoInstanceState = {
12
12
  history: FlowSnapshot[];
13
13
  currentStep: number;
14
- pushSnapshot: (snap: FlowSnapshot) => void;
15
- applySnapshot: (step: number) => FlowSnapshot | null;
16
- reset: (snap?: FlowSnapshot) => void;
17
14
  canUndo: boolean;
18
15
  canRedo: boolean;
19
16
  };
17
+ type UndoStoreState = {
18
+ instances: Record<string, UndoInstanceState>;
19
+ pushSnapshot: (id: string, snap: FlowSnapshot) => void;
20
+ applySnapshot: (id: string, step: number) => FlowSnapshot | null;
21
+ reset: (id: string, snap?: FlowSnapshot) => void;
22
+ remove: (id: string) => void;
23
+ };
20
24
  export declare const makeSnapshotSignature: (snap: FlowSnapshot) => string;
21
- export declare const useUndoStore: import('zustand').UseBoundStore<import('zustand').StoreApi<UndoStoreState>>;
25
+ export declare const useUndoInternalStore: import('zustand').UseBoundStore<import('zustand').StoreApi<UndoStoreState>>;
26
+ export declare function useUndo(instanceId: string): {
27
+ history: FlowSnapshot[];
28
+ currentStep: number;
29
+ canUndo: boolean;
30
+ canRedo: boolean;
31
+ pushSnapshot: (snap: FlowSnapshot) => void;
32
+ undo: () => FlowSnapshot;
33
+ redo: () => FlowSnapshot;
34
+ goTo: (step: number) => FlowSnapshot;
35
+ reset: (snap?: FlowSnapshot) => void;
36
+ dispose: () => void;
37
+ };
22
38
  export {};
@@ -1,10 +1,10 @@
1
- export declare const useUndoControls: () => {
1
+ export declare const useUndoControls: (instanceId: string) => {
2
2
  canUndo: boolean;
3
3
  canRedo: boolean;
4
4
  undo: () => void;
5
5
  redo: () => void;
6
6
  };
7
- export declare const useFlowUndo: (opts?: {
7
+ export declare const useFlowUndo: (instanceId: string, opts?: {
8
8
  snapshotDebounceMs?: number;
9
9
  takeInitialSnapshot?: boolean;
10
10
  }) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "app-v3-scripts-editor",
3
3
  "private": false,
4
- "version": "1.16.0",
4
+ "version": "1.16.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ucall-asia/app-v3-scripts-editor.git"
@@ -1,8 +0,0 @@
1
- export declare const useUndoRedo: () => {
2
- undo: () => void;
3
- redo: () => void;
4
- canUndo: boolean;
5
- canRedo: boolean;
6
- commit: import('lodash').DebouncedFunc<() => void>;
7
- setIsDragging: (val: boolean) => void;
8
- };
@@ -1,12 +0,0 @@
1
- export declare const useUndoRedoManager: () => {
2
- commitImmediate: () => void;
3
- applySnapshot: (step: number, api: {
4
- setNodes: (n: any[]) => void;
5
- setEdges: (e: any[]) => void;
6
- setViewport: (v: {
7
- x: number;
8
- y: number;
9
- zoom: number;
10
- }) => void;
11
- }) => void;
12
- };