vis-core 0.22.14 → 0.23.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.
@@ -4,16 +4,12 @@ import { EventEmitter } from 'events';
4
4
  import Pencil, { BaseObject } from 'gl-draw';
5
5
  import History from './history';
6
6
  import Viewport from './viewport';
7
+ import Scripts from './scripts';
7
8
  import Arc from "../vis/all/objects/Arc";
8
9
  import Sprite from "../vis/all/objects/Sprite";
9
10
  import Base from "../vis/base";
10
11
  export * as THREE from 'three';
11
12
  export { MeshLineMaterial } from 'gl-draw/dist/objects';
12
- export interface Hooks {
13
- beforeSetVisOptions?: (json: any) => any;
14
- beforeExecuteUndo?: (undo: any) => any;
15
- afterExecuteUndo?: (undo: any) => any;
16
- }
17
13
  export interface IBaseObject extends BaseObject {
18
14
  }
19
15
  interface SelectedMeta {
@@ -44,6 +40,7 @@ export default class Editor {
44
40
  events: EventEmitter;
45
41
  history: History;
46
42
  viewport: Viewport;
43
+ scripts: Scripts;
47
44
  pencil: Pencil;
48
45
  on: (eventName: string | symbol, listener: (...args: any[]) => void) => EventEmitter;
49
46
  emit: (eventName: string | symbol, ...args: any[]) => boolean;
@@ -53,7 +50,6 @@ export default class Editor {
53
50
  name: string;
54
51
  open: boolean;
55
52
  options: Options;
56
- hooks?: Hooks;
57
53
  constructor(options: Options);
58
54
  getObjectMaterial(object?: THREE.Mesh | null, slot?: number): THREE.Material | THREE.Material[] | undefined;
59
55
  setObjectMaterial(object: THREE.Mesh, slot: number, newMaterial: THREE.Material): void;
@@ -75,7 +71,7 @@ export default class Editor {
75
71
  baseObject?: BaseObject;
76
72
  }[]) => void>;
77
73
  execute(cmd: any, optionalName?: string): Promise<void>;
78
- fromJSON(jsonOrUrl: Record<string, any> | string, hooks?: Hooks): Promise<Record<string, any>>;
74
+ fromJSON(jsonOrUrl: Record<string, any> | string, scripts?: Record<string, any>): Promise<Record<string, any>>;
79
75
  toJSON(): {};
80
76
  select(...args: any[]): void;
81
77
  select2(...args: any[]): void;
@@ -0,0 +1,19 @@
1
+ import Editor from "./";
2
+ declare class Scripts {
3
+ editor: Editor;
4
+ events: {
5
+ beforeSetVisOptions: Function[];
6
+ beforeExecuteUndo: Function[];
7
+ afterExecuteUndo: Function[];
8
+ beforeShow: Function[];
9
+ afterShow: Function[];
10
+ };
11
+ source: string;
12
+ constructor(editor: Editor);
13
+ add(event: Record<string, Function>): void;
14
+ fromJSON(source: string): void;
15
+ toJSON(): string;
16
+ clear(): void;
17
+ dispatch(type: keyof Scripts['events'], ...args: any[]): any;
18
+ }
19
+ export default Scripts;
package/dist/index.d.ts CHANGED
@@ -8,4 +8,4 @@ export * from './getVisConfig';
8
8
  export declare const access: {
9
9
  token: string;
10
10
  };
11
- export declare const VERSION = "0.22.14";
11
+ export declare const VERSION = "0.23.0";