json-canvas-viewer 3.2.1 → 3.2.2
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/README.md +11 -12
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/canvasViewer.d.ts +4 -1
- package/dist/types/controller.d.ts +1 -1
- package/dist/types/declarations.d.ts +16 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/types/utilities.d.ts +1 -0
- package/package.json +3 -2
- package/dist/types/shared.d.ts +0 -1
|
@@ -12,11 +12,14 @@ type InternalModules = [
|
|
|
12
12
|
typeof InteractionHandler,
|
|
13
13
|
typeof Renderer
|
|
14
14
|
];
|
|
15
|
-
export
|
|
15
|
+
export default class JSONCanvasViewer<M extends ModuleInput = []> {
|
|
16
16
|
private options;
|
|
17
17
|
private allModules;
|
|
18
|
+
private IO;
|
|
18
19
|
container: Container;
|
|
19
20
|
constructor(options: Options<[...InternalModules, ...M]>, modules?: M);
|
|
21
|
+
private load;
|
|
22
|
+
private onVisibilityCheck;
|
|
20
23
|
dispose: () => void;
|
|
21
24
|
}
|
|
22
25
|
export {};
|
|
@@ -6,6 +6,7 @@ export default class Controller extends BaseModule<Options> {
|
|
|
6
6
|
private animationId;
|
|
7
7
|
private resizeAnimationId;
|
|
8
8
|
private DM;
|
|
9
|
+
private resizeObserver;
|
|
9
10
|
private perFrame;
|
|
10
11
|
private lastResizeCenter;
|
|
11
12
|
hooks: {
|
|
@@ -27,7 +28,6 @@ export default class Controller extends BaseModule<Options> {
|
|
|
27
28
|
private draw;
|
|
28
29
|
private refresh;
|
|
29
30
|
private onResize;
|
|
30
|
-
private resizeObserver;
|
|
31
31
|
dispose: () => void;
|
|
32
32
|
}
|
|
33
33
|
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type { GeneralModuleCtor } from './baseModule';
|
|
1
|
+
import type { BaseModule, GeneralModule, GeneralModuleCtor } from './baseModule';
|
|
2
|
+
import type Controller from './controller';
|
|
3
|
+
import type DataManager from './dataManager';
|
|
4
|
+
import type InteractionHandler from './interactionHandler';
|
|
5
|
+
import type OverlayManager from './overlayManager';
|
|
6
|
+
import type Renderer from './renderer';
|
|
2
7
|
declare global {
|
|
3
8
|
interface JSONCanvasGenericNode {
|
|
4
9
|
id: string;
|
|
@@ -45,6 +50,10 @@ declare global {
|
|
|
45
50
|
nodes?: Array<JSONCanvasNode>;
|
|
46
51
|
edges?: Array<JSONCanvasEdge>;
|
|
47
52
|
}
|
|
53
|
+
module '*.scss?inline' {
|
|
54
|
+
const content: string;
|
|
55
|
+
export default content;
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
export type Coordinates = {
|
|
50
59
|
x: number;
|
|
@@ -80,7 +89,12 @@ type AllModuleInstances<T extends ModuleInput> = InstanceType<T[number]>;
|
|
|
80
89
|
export type DefaultOptions = {
|
|
81
90
|
container: HTMLElement;
|
|
82
91
|
canvasPath: string;
|
|
92
|
+
lazyLoad?: boolean;
|
|
83
93
|
};
|
|
84
94
|
export type ModuleInput = Array<GeneralModuleCtor>;
|
|
85
|
-
export type Options<T extends ModuleInput> = Omit<UnionToIntersection<AllModuleInstances<T>['options']>, keyof DefaultOptions> & DefaultOptions;
|
|
95
|
+
export type Options<T extends ModuleInput = []> = Omit<UnionToIntersection<AllModuleInstances<T>['options']>, keyof DefaultOptions> & DefaultOptions;
|
|
96
|
+
type Ctors<T extends Array<BaseModule> | BaseModule> = T extends Array<BaseModule> ? {
|
|
97
|
+
[K in keyof T]: new (...args: GeneralArguments) => T[K];
|
|
98
|
+
} : [new (...args: GeneralArguments) => T];
|
|
99
|
+
export type UserOptions<T extends Array<GeneralModule> = []> = Options<Ctors<[Controller, InteractionHandler, DataManager, OverlayManager, Renderer, ...T]>>;
|
|
86
100
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { type BaseArgs, BaseModule } from './baseModule';
|
|
2
|
-
export { JSONCanvasViewer } from './canvasViewer';
|
|
2
|
+
export { default as JSONCanvasViewer } from './canvasViewer';
|
|
3
3
|
export { default as Controls } from './controls';
|
|
4
4
|
export { default as DebugPanel } from './debugPanel';
|
|
5
|
+
export type { UserOptions as Options } from './declarations';
|
|
5
6
|
export { default as Minimap } from './minimap';
|
|
6
7
|
export { default as MistouchPreventer } from './mistouchPreventer';
|
|
7
8
|
export { default as renderToString } from './renderToString';
|
|
8
|
-
export { default as
|
|
9
|
+
export { default as canvasUtils } from './utilities';
|
|
9
10
|
import Controller from './controller';
|
|
10
11
|
import DataManager from './dataManager';
|
|
11
12
|
import InteractionHandler from './interactionHandler';
|
|
@@ -10,6 +10,7 @@ declare const _default: {
|
|
|
10
10
|
makeHook: typeof makeHook;
|
|
11
11
|
};
|
|
12
12
|
export default _default;
|
|
13
|
+
export declare const destroyError: Error;
|
|
13
14
|
declare function applyStyles(container: HTMLElement | ShadowRoot, styleString: string): void;
|
|
14
15
|
declare function drawRoundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number): void;
|
|
15
16
|
declare function getAnchorCoord(node: JSONCanvasNode, side: 'top' | 'bottom' | 'left' | 'right'): number[];
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-canvas-viewer",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "An extensible TypeScript-based viewer for JSON Canvas, easy to embed into websites.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"types": "dist/types/
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"repository": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"name": "Hēsperus",
|
|
26
26
|
"email": "hesprs@outlook.com"
|
|
27
27
|
},
|
|
28
|
+
"sideEffects": false,
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"provenance": true,
|
|
30
31
|
"access": "public"
|
package/dist/types/shared.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const destroyError: Error;
|