json-canvas-viewer 3.4.2 → 4.0.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.
- package/LICENSE +2 -2
- package/README.md +51 -107
- package/dist/chimp.js +1 -1
- package/dist/index.d.ts +609 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +21 -58
- package/dist/bridges.cjs +0 -2
- package/dist/bridges.cjs.map +0 -1
- package/dist/bridges.js +0 -2
- package/dist/bridges.js.map +0 -1
- package/dist/chimp.cjs +0 -1
- package/dist/dev.cjs +0 -2
- package/dist/dev.cjs.map +0 -1
- package/dist/dev.js +0 -2
- package/dist/dev.js.map +0 -1
- package/dist/index-BPBGNZi4.js +0 -2
- package/dist/index-BPBGNZi4.js.map +0 -1
- package/dist/index-BcNvzPvZ.cjs +0 -2
- package/dist/index-BcNvzPvZ.cjs.map +0 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/interactionHandler-CrVH9u7P.js +0 -2
- package/dist/interactionHandler-CrVH9u7P.js.map +0 -1
- package/dist/interactionHandler-DCMxklIx.cjs +0 -2
- package/dist/interactionHandler-DCMxklIx.cjs.map +0 -1
- package/dist/modules.cjs +0 -2
- package/dist/modules.cjs.map +0 -1
- package/dist/modules.js +0 -2
- package/dist/modules.js.map +0 -1
- package/dist/react.cjs +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.js +0 -2
- package/dist/react.js.map +0 -1
- package/dist/renderToString-B4iG1OSr.cjs +0 -2
- package/dist/renderToString-B4iG1OSr.cjs.map +0 -1
- package/dist/renderToString-Dp8A-Rka.js +0 -2
- package/dist/renderToString-Dp8A-Rka.js.map +0 -1
- package/dist/renderer-BGA72dN1.js +0 -2
- package/dist/renderer-BGA72dN1.js.map +0 -1
- package/dist/renderer-IqJN8N1G.cjs +0 -2
- package/dist/renderer-IqJN8N1G.cjs.map +0 -1
- package/dist/types/bridges/reactComponent.d.ts +0 -12
- package/dist/types/bridges/renderToString.d.ts +0 -6
- package/dist/types/bridges/vitePlugin.d.ts +0 -8
- package/dist/types/bridges/vueComponent.vue.d.ts +0 -28
- package/dist/types/bridges/webpackPlugin.d.ts +0 -7
- package/dist/types/bridges.d.ts +0 -3
- package/dist/types/chimp.d.ts +0 -7
- package/dist/types/core/baseModule.d.ts +0 -19
- package/dist/types/core/controller.d.ts +0 -35
- package/dist/types/core/dataManager.d.ts +0 -59
- package/dist/types/core/declarations.d.ts +0 -105
- package/dist/types/core/index.d.ts +0 -25
- package/dist/types/core/interactionHandler.d.ts +0 -39
- package/dist/types/core/overlayManager.d.ts +0 -44
- package/dist/types/core/renderer.d.ts +0 -32
- package/dist/types/core/styleManager.d.ts +0 -49
- package/dist/types/core/utilities.d.ts +0 -25
- package/dist/types/dev.d.ts +0 -9
- package/dist/types/index.d.ts +0 -2
- package/dist/types/modules/controls/index.d.ts +0 -38
- package/dist/types/modules/debugPanel/index.d.ts +0 -9
- package/dist/types/modules/minimap/index.d.ts +0 -32
- package/dist/types/modules/mistouchPreventer/index.d.ts +0 -25
- package/dist/types/modules.d.ts +0 -4
- package/dist/vue.cjs +0 -2
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.js +0 -2
- package/dist/vue.js.map +0 -1
- package/dist/webpackLoader.js +0 -33
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { 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';
|
|
7
|
-
import type StyleManager from './styleManager';
|
|
8
|
-
declare global {
|
|
9
|
-
interface JSONCanvasGroupNode extends JSONCanvasGenericNode {
|
|
10
|
-
type: 'group';
|
|
11
|
-
label?: string;
|
|
12
|
-
background?: string;
|
|
13
|
-
backgroundStyle?: 'cover' | 'ratio' | 'repeat';
|
|
14
|
-
}
|
|
15
|
-
interface JSONCanvasFileNode extends JSONCanvasGenericNode {
|
|
16
|
-
type: 'file';
|
|
17
|
-
file: string;
|
|
18
|
-
subpath?: string;
|
|
19
|
-
}
|
|
20
|
-
interface JSONCanvasTextNode extends JSONCanvasGenericNode {
|
|
21
|
-
type: 'text';
|
|
22
|
-
text: string;
|
|
23
|
-
}
|
|
24
|
-
interface JSONCanvasLinkNode extends JSONCanvasGenericNode {
|
|
25
|
-
type: 'link';
|
|
26
|
-
url: string;
|
|
27
|
-
}
|
|
28
|
-
type JSONCanvasNode = JSONCanvasGroupNode | JSONCanvasFileNode | JSONCanvasTextNode | JSONCanvasLinkNode;
|
|
29
|
-
interface JSONCanvasEdge {
|
|
30
|
-
id: string;
|
|
31
|
-
fromNode: string;
|
|
32
|
-
toNode: string;
|
|
33
|
-
fromSide: 'right' | 'left' | 'top' | 'bottom';
|
|
34
|
-
toSide: 'right' | 'left' | 'top' | 'bottom';
|
|
35
|
-
toEnd?: 'arrow' | 'none';
|
|
36
|
-
label?: string;
|
|
37
|
-
styleAttributes?: Record<string, string>;
|
|
38
|
-
color?: string;
|
|
39
|
-
}
|
|
40
|
-
interface JSONCanvas {
|
|
41
|
-
nodes?: Array<JSONCanvasNode>;
|
|
42
|
-
edges?: Array<JSONCanvasEdge>;
|
|
43
|
-
}
|
|
44
|
-
module '*.canvas' {
|
|
45
|
-
const content: JSONCanvas;
|
|
46
|
-
export default content;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
interface JSONCanvasGenericNode {
|
|
50
|
-
id: string;
|
|
51
|
-
type: 'group' | 'file' | 'text' | 'link';
|
|
52
|
-
x: number;
|
|
53
|
-
y: number;
|
|
54
|
-
width: number;
|
|
55
|
-
height: number;
|
|
56
|
-
styleAttributes?: Record<string, string>;
|
|
57
|
-
color?: string;
|
|
58
|
-
}
|
|
59
|
-
export type Coordinates = {
|
|
60
|
-
x: number;
|
|
61
|
-
y: number;
|
|
62
|
-
};
|
|
63
|
-
export type NodeBounds = {
|
|
64
|
-
minX: number;
|
|
65
|
-
minY: number;
|
|
66
|
-
maxX: number;
|
|
67
|
-
maxY: number;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
centerX: number;
|
|
71
|
-
centerY: number;
|
|
72
|
-
};
|
|
73
|
-
export type Box = {
|
|
74
|
-
top: number;
|
|
75
|
-
right: number;
|
|
76
|
-
bottom: number;
|
|
77
|
-
left: number;
|
|
78
|
-
};
|
|
79
|
-
export type GeneralArguments = Array<any>;
|
|
80
|
-
export type GeneralObject = Record<Indexable, any>;
|
|
81
|
-
export type Indexable = string | number | symbol;
|
|
82
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
83
|
-
export type ModuleInputCtor = Array<GeneralModuleCtor>;
|
|
84
|
-
type ModuleInputInstance = Array<GeneralModule>;
|
|
85
|
-
export type ModuleInput = ModuleInputCtor | ModuleInputInstance;
|
|
86
|
-
type Instances<T extends ModuleInput> = T extends ModuleInputCtor ? InstanceType<T[number]> : T[number];
|
|
87
|
-
export interface BaseOptions {
|
|
88
|
-
container: HTMLElement;
|
|
89
|
-
loading?: 'normal' | 'lazy' | 'none';
|
|
90
|
-
}
|
|
91
|
-
export type MarkdownParser = (markdown: string) => string | Promise<string>;
|
|
92
|
-
type Orchestratable<T extends ModuleInput, K extends 'options' | '_Augmentation'> = UnionToIntersection<Instances<T>[K]>;
|
|
93
|
-
export type Options<T extends ModuleInput = []> = Orchestratable<T, 'options'>;
|
|
94
|
-
export type Augmentation<T extends ModuleInput = []> = Orchestratable<T, '_Augmentation'>;
|
|
95
|
-
type InternalModules = [
|
|
96
|
-
DataManager,
|
|
97
|
-
StyleManager,
|
|
98
|
-
Controller,
|
|
99
|
-
OverlayManager,
|
|
100
|
-
InteractionHandler,
|
|
101
|
-
Renderer
|
|
102
|
-
];
|
|
103
|
-
export type UserOptions<M extends ModuleInput> = Options<M> & Options<InternalModules>;
|
|
104
|
-
export type UserAugmentation<M extends ModuleInput> = Augmentation<M> & Augmentation<InternalModules>;
|
|
105
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ModuleInputCtor, UserOptions, UserAugmentation, ModuleInput } from './declarations';
|
|
2
|
-
import { Container } from '@needle-di/core';
|
|
3
|
-
declare class JSONCanvasViewer<M extends ModuleInputCtor> {
|
|
4
|
-
private allModules;
|
|
5
|
-
private IO;
|
|
6
|
-
private onDispose;
|
|
7
|
-
private onStart;
|
|
8
|
-
private onRestart;
|
|
9
|
-
private started;
|
|
10
|
-
options: UserOptions<M>;
|
|
11
|
-
container: Container;
|
|
12
|
-
constructor(options: UserOptions<M>, modules?: M);
|
|
13
|
-
private onVisibilityCheck;
|
|
14
|
-
private _augmentSlot;
|
|
15
|
-
private augment;
|
|
16
|
-
load: (options?: {
|
|
17
|
-
canvas?: JSONCanvas;
|
|
18
|
-
attachmentDir?: string;
|
|
19
|
-
}) => void;
|
|
20
|
-
dispose: () => void;
|
|
21
|
-
}
|
|
22
|
-
type JSONCanvasViewerType = new <M extends ModuleInputCtor = []>(...args: ConstructorParameters<typeof JSONCanvasViewer<M>>) => JSONCanvasViewer<M> & UserAugmentation<M>;
|
|
23
|
-
export type JSONCanvasViewerInterface<M extends ModuleInput = []> = JSONCanvasViewer<never> & UserAugmentation<M>;
|
|
24
|
-
declare const _default: JSONCanvasViewerType;
|
|
25
|
-
export default _default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from './baseModule';
|
|
2
|
-
import type { BaseOptions, Coordinates } from './declarations';
|
|
3
|
-
import { Click, Drag, MultitouchPanZoom, type Options as PointeractOptions, PreventDefault, WheelPanZoom, Lubricator, type PointeractInterface } from 'pointeract';
|
|
4
|
-
type LoadedModules = [Click, Drag, WheelPanZoom, PreventDefault, MultitouchPanZoom, Lubricator];
|
|
5
|
-
interface Options extends BaseOptions {
|
|
6
|
-
pointeract?: PointeractOptions<LoadedModules>;
|
|
7
|
-
}
|
|
8
|
-
interface Augmentation {
|
|
9
|
-
pan: InteractionHandler['pan'];
|
|
10
|
-
panToCoords: InteractionHandler['panToCoords'];
|
|
11
|
-
zoom: InteractionHandler['zoom'];
|
|
12
|
-
zoomToScale: InteractionHandler['zoomToScale'];
|
|
13
|
-
}
|
|
14
|
-
export default class InteractionHandler extends BaseModule<Options, Augmentation> {
|
|
15
|
-
pointeract: PointeractInterface<LoadedModules>;
|
|
16
|
-
private DM;
|
|
17
|
-
onClick: {
|
|
18
|
-
(args_0: string | null): void;
|
|
19
|
-
subs: Set<(args_0: string | null) => unknown>;
|
|
20
|
-
subscribe(callback: (args_0: string | null) => unknown): void;
|
|
21
|
-
unsubscribe(callback: (args_0: string | null) => unknown): void;
|
|
22
|
-
};
|
|
23
|
-
constructor(...args: BaseArgs);
|
|
24
|
-
private start;
|
|
25
|
-
private onPan;
|
|
26
|
-
private onZoom;
|
|
27
|
-
trueZoom: (_factor: number, origin: Coordinates) => void;
|
|
28
|
-
truePan: ({ x, y }: Coordinates) => void;
|
|
29
|
-
zoom: (_factor: number, origin: Coordinates) => void;
|
|
30
|
-
pan: ({ x, y }: Coordinates) => void;
|
|
31
|
-
zoomToScale: (newScale: number, origin: Coordinates) => void;
|
|
32
|
-
panToCoords: ({ x, y }: Coordinates) => void;
|
|
33
|
-
private C2C;
|
|
34
|
-
private onTrueClick;
|
|
35
|
-
private isUIControl;
|
|
36
|
-
private findNodeId;
|
|
37
|
-
private dispose;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from './baseModule';
|
|
2
|
-
import type { BaseOptions, MarkdownParser } from './declarations';
|
|
3
|
-
interface Options extends BaseOptions {
|
|
4
|
-
markdownParser?: MarkdownParser;
|
|
5
|
-
}
|
|
6
|
-
export default class OverlayManager extends BaseModule<Options> {
|
|
7
|
-
private _overlaysLayer;
|
|
8
|
-
private overlays;
|
|
9
|
-
private selectedId;
|
|
10
|
-
private eventListeners;
|
|
11
|
-
private DM;
|
|
12
|
-
private SM;
|
|
13
|
-
private parse;
|
|
14
|
-
private get overlaysLayer();
|
|
15
|
-
hooks: {
|
|
16
|
-
onInteractionStart: {
|
|
17
|
-
(): void;
|
|
18
|
-
subs: Set<() => unknown>;
|
|
19
|
-
subscribe(callback: () => unknown): void;
|
|
20
|
-
unsubscribe(callback: () => unknown): void;
|
|
21
|
-
};
|
|
22
|
-
onInteractionEnd: {
|
|
23
|
-
(): void;
|
|
24
|
-
subs: Set<() => unknown>;
|
|
25
|
-
subscribe(callback: () => unknown): void;
|
|
26
|
-
unsubscribe(callback: () => unknown): void;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
constructor(...args: BaseArgs);
|
|
30
|
-
private start;
|
|
31
|
-
private restart;
|
|
32
|
-
private renderOverlays;
|
|
33
|
-
private themeChanged;
|
|
34
|
-
private select;
|
|
35
|
-
private loadMarkdownForNode;
|
|
36
|
-
private updateOverlays;
|
|
37
|
-
private createOverlay;
|
|
38
|
-
private updateOverlay;
|
|
39
|
-
private constructOverlay;
|
|
40
|
-
private setOverlayColor;
|
|
41
|
-
private clearOverlays;
|
|
42
|
-
private dispose;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from './baseModule';
|
|
2
|
-
import type { BaseOptions } from './declarations';
|
|
3
|
-
interface Options extends BaseOptions {
|
|
4
|
-
zoomInOptimization?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export default class Renderer extends BaseModule<Options> {
|
|
7
|
-
private _canvas;
|
|
8
|
-
private ctx;
|
|
9
|
-
private DM;
|
|
10
|
-
private SM;
|
|
11
|
-
private zoomInOptimize;
|
|
12
|
-
private get canvas();
|
|
13
|
-
constructor(...args: BaseArgs);
|
|
14
|
-
private optimizeDPR;
|
|
15
|
-
private redraw;
|
|
16
|
-
private trueRedraw;
|
|
17
|
-
private fakeRedraw;
|
|
18
|
-
private isInside;
|
|
19
|
-
private isOutside;
|
|
20
|
-
private getCurrentViewport;
|
|
21
|
-
private drawLabelBar;
|
|
22
|
-
private drawNodeBackground;
|
|
23
|
-
private drawGroup;
|
|
24
|
-
private drawFile;
|
|
25
|
-
private drawEdge;
|
|
26
|
-
private getControlPoints;
|
|
27
|
-
private drawGridDots;
|
|
28
|
-
private drawCurvedPath;
|
|
29
|
-
private drawArrowhead;
|
|
30
|
-
private dispose;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BaseModule, type BaseArgs } from './baseModule';
|
|
2
|
-
import type { BaseOptions } from './declarations';
|
|
3
|
-
export type Color = {
|
|
4
|
-
border: string;
|
|
5
|
-
background: string;
|
|
6
|
-
active: string;
|
|
7
|
-
text: string;
|
|
8
|
-
card: string;
|
|
9
|
-
};
|
|
10
|
-
interface Options extends BaseOptions {
|
|
11
|
-
theme?: 'dark' | 'light';
|
|
12
|
-
}
|
|
13
|
-
interface Augmentation {
|
|
14
|
-
changeTheme: StyleManager['changeTheme'];
|
|
15
|
-
}
|
|
16
|
-
declare const namedColors: {
|
|
17
|
-
light: {
|
|
18
|
-
dots: string;
|
|
19
|
-
text: string;
|
|
20
|
-
background: string;
|
|
21
|
-
'background-secondary': string;
|
|
22
|
-
shadow: string;
|
|
23
|
-
border: string;
|
|
24
|
-
};
|
|
25
|
-
dark: {
|
|
26
|
-
dots: string;
|
|
27
|
-
text: string;
|
|
28
|
-
background: string;
|
|
29
|
-
'background-secondary': string;
|
|
30
|
-
shadow: string;
|
|
31
|
-
border: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export default class StyleManager extends BaseModule<Options, Augmentation> {
|
|
35
|
-
theme: 'dark' | 'light';
|
|
36
|
-
onChangeTheme: {
|
|
37
|
-
(args_0: "dark" | "light"): void;
|
|
38
|
-
subs: Set<(args_0: "dark" | "light") => unknown>;
|
|
39
|
-
subscribe(callback: (args_0: "dark" | "light") => unknown): void;
|
|
40
|
-
unsubscribe(callback: (args_0: "dark" | "light") => unknown): void;
|
|
41
|
-
};
|
|
42
|
-
private colorCache;
|
|
43
|
-
constructor(...args: BaseArgs);
|
|
44
|
-
private hslProcessor;
|
|
45
|
-
getColor: (colorIndex?: string) => Color;
|
|
46
|
-
getNamedColor: (name: keyof typeof namedColors.dark) => string;
|
|
47
|
-
changeTheme: (theme?: "dark" | "light") => void;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { GeneralArguments } from './declarations';
|
|
2
|
-
declare const _default: {
|
|
3
|
-
round: typeof round;
|
|
4
|
-
resizeCanvasForDPR: typeof resizeCanvasForDPR;
|
|
5
|
-
applyStyles: typeof applyStyles;
|
|
6
|
-
drawRoundRect: typeof drawRoundRect;
|
|
7
|
-
getAnchorCoord: typeof getAnchorCoord;
|
|
8
|
-
makeHook: typeof makeHook;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
11
|
-
export declare const destroyError: Error;
|
|
12
|
-
declare function applyStyles(container: HTMLElement | ShadowRoot, styleString: string): void;
|
|
13
|
-
declare function drawRoundRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number): void;
|
|
14
|
-
declare function getAnchorCoord(node: JSONCanvasNode, side: 'top' | 'bottom' | 'left' | 'right'): {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
declare function resizeCanvasForDPR(canvas: HTMLCanvasElement, width: number, height: number): void;
|
|
19
|
-
declare function round(roundedNum: number, digits: number): number;
|
|
20
|
-
declare function makeHook<Args extends GeneralArguments = []>(reverse?: boolean): {
|
|
21
|
-
(...args: Args): void;
|
|
22
|
-
subs: Set<(...args: Args) => unknown>;
|
|
23
|
-
subscribe(callback: (...args: Args) => unknown): void;
|
|
24
|
-
unsubscribe(callback: (...args: Args) => unknown): void;
|
|
25
|
-
};
|
package/dist/types/dev.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { type GeneralModule, type GeneralModuleCtor, type BaseArgs, BaseModule, } from './core/baseModule';
|
|
2
|
-
export type { BaseOptions } from './core/declarations';
|
|
3
|
-
export { default as Controller } from './core/controller';
|
|
4
|
-
export { default as DataManager } from './core/dataManager';
|
|
5
|
-
export { default as InteractionHandler } from './core/interactionHandler';
|
|
6
|
-
export { default as OverlayManager } from './core/overlayManager';
|
|
7
|
-
export { default as Renderer } from './core/renderer';
|
|
8
|
-
export { default as StyleManager } from './core/styleManager';
|
|
9
|
-
export { default as canvasUtils } from './core/utilities';
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from '../../core/baseModule';
|
|
2
|
-
import type { BaseOptions } from '../../core/declarations';
|
|
3
|
-
interface Options extends BaseOptions {
|
|
4
|
-
controlsCollapsed?: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface Augmentation {
|
|
7
|
-
toggleControlsCollapse: Controls['toggleCollapse'];
|
|
8
|
-
}
|
|
9
|
-
export default class Controls extends BaseModule<Options, Augmentation> {
|
|
10
|
-
private _controlsPanel;
|
|
11
|
-
private _toggleCollapseBtn;
|
|
12
|
-
private _toggleFullscreenBtn;
|
|
13
|
-
private _zoomOutBtn;
|
|
14
|
-
private _zoomSlider;
|
|
15
|
-
private _zoomInBtn;
|
|
16
|
-
private _resetViewBtn;
|
|
17
|
-
private DM;
|
|
18
|
-
private IH;
|
|
19
|
-
private collapsed;
|
|
20
|
-
private get controlsPanel();
|
|
21
|
-
private get toggleCollapseBtn();
|
|
22
|
-
private get toggleFullscreenBtn();
|
|
23
|
-
private get zoomOutBtn();
|
|
24
|
-
private get zoomSlider();
|
|
25
|
-
private get zoomInBtn();
|
|
26
|
-
private get resetViewBtn();
|
|
27
|
-
constructor(...args: BaseArgs);
|
|
28
|
-
toggleCollapse: () => void;
|
|
29
|
-
private zoomIn;
|
|
30
|
-
private zoomOut;
|
|
31
|
-
private slide;
|
|
32
|
-
private updateFullscreenBtn;
|
|
33
|
-
private toggleFullscreen;
|
|
34
|
-
private updateSlider;
|
|
35
|
-
private scaleToSlider;
|
|
36
|
-
private dispose;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from '../../core/baseModule';
|
|
2
|
-
import type { BaseOptions } from '../../core/declarations';
|
|
3
|
-
interface Options extends BaseOptions {
|
|
4
|
-
minimapCollapsed?: boolean;
|
|
5
|
-
}
|
|
6
|
-
interface Augmentation {
|
|
7
|
-
toggleMinimapCollapse: Minimap['toggleCollapse'];
|
|
8
|
-
}
|
|
9
|
-
export default class Minimap extends BaseModule<Options, Augmentation> {
|
|
10
|
-
private _minimapCtx;
|
|
11
|
-
private _viewportRectangle;
|
|
12
|
-
private _minimap;
|
|
13
|
-
private _minimapContainer;
|
|
14
|
-
private _toggleMinimapBtn;
|
|
15
|
-
private minimapCache;
|
|
16
|
-
private DM;
|
|
17
|
-
private SM;
|
|
18
|
-
private collapsed;
|
|
19
|
-
private get minimap();
|
|
20
|
-
private get minimapCtx();
|
|
21
|
-
private get viewportRectangle();
|
|
22
|
-
private get minimapContainer();
|
|
23
|
-
private get toggleMinimapBtn();
|
|
24
|
-
constructor(...args: BaseArgs);
|
|
25
|
-
toggleCollapse: () => void;
|
|
26
|
-
private start;
|
|
27
|
-
private drawMinimapNode;
|
|
28
|
-
private drawMinimapEdge;
|
|
29
|
-
private updateViewportRectangle;
|
|
30
|
-
private dispose;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type BaseArgs, BaseModule } from '../../core/baseModule';
|
|
2
|
-
import type { BaseOptions } from '../../core/declarations';
|
|
3
|
-
interface Options extends BaseOptions {
|
|
4
|
-
preventMistouchAtStart?: boolean;
|
|
5
|
-
mistouchPreventerBannerText?: string;
|
|
6
|
-
}
|
|
7
|
-
interface Augmentation {
|
|
8
|
-
startMistouchPrevention: MistouchPreventer['startPrevention'];
|
|
9
|
-
endMistouchPrevention: MistouchPreventer['endPrevention'];
|
|
10
|
-
}
|
|
11
|
-
export default class MistouchPreventer extends BaseModule<Options, Augmentation> {
|
|
12
|
-
private _preventionContainer;
|
|
13
|
-
private preventMt;
|
|
14
|
-
private DM;
|
|
15
|
-
private preventMistouch;
|
|
16
|
-
private get preventionContainer();
|
|
17
|
-
constructor(...args: BaseArgs);
|
|
18
|
-
private onPointerDown;
|
|
19
|
-
private onPointerMove;
|
|
20
|
-
private onPointerUp;
|
|
21
|
-
startPrevention: () => void;
|
|
22
|
-
endPrevention: () => void;
|
|
23
|
-
private dispose;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
package/dist/types/modules.d.ts
DELETED
package/dist/vue.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),n=require("./index-BcNvzPvZ.cjs"),t=require("./renderToString-B4iG1OSr.cjs"),a=["innerHTML"],r=e.defineComponent({__name:"vueComponent",props:{modules:{},canvas:{},attachmentDir:{},options:{},isPrerendering:{type:Boolean},theme:{}},async setup(r,{expose:i}){let s,c;const o=r,m=o.isPrerendering??!1,h=e.useTemplateRef("viewerRef");let l=null;const u=m?([s,c]=e.withAsyncContext(()=>t.renderToString({canvas:o.canvas??{},attachmentDir:o.attachmentDir,...o.options})),s=await s,c(),s):"";return e.watch(()=>o.theme,e=>l?.changeTheme(e)),e.watch(()=>({canvas:o.canvas,attachmentDir:o.attachmentDir}),({canvas:e,attachmentDir:n})=>l?.load({canvas:e,attachmentDir:n})),e.onMounted(()=>{h.value&&(l=new n.JSONCanvasViewer(Object.assign(o.options??{},{container:h.value,theme:o.theme,canvas:o.canvas,attachmentDir:o.attachmentDir}),o.modules))}),e.onUnmounted(()=>{l?.dispose(),l=null}),i({viewer:l}),(n,t)=>(e.openBlock(),e.createElementBlock("section",{ref_key:"viewerRef",ref:h,innerHTML:e.unref(u),style:{"max-height":"100vh","max-width":"100vw"}},null,8,a))}});module.exports=r;
|
|
2
|
-
//# sourceMappingURL=vue.cjs.map
|
package/dist/vue.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue.cjs","sources":["../src/bridges/vueComponent.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T extends ModuleInputCtor\" setup>\nimport { onMounted, onUnmounted, useTemplateRef, watch } from 'vue';\nimport JSONCanvasViewer, { type JSONCanvasViewerInterface } from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport renderToString from './renderToString';\n\ntype ComponentOptions<T extends ModuleInputCtor> = {\n\tmodules?: T;\n\tcanvas?: JSONCanvas;\n\tattachmentDir?: string;\n\toptions?: Omit<UserOptions<T>, 'container' | 'theme' | 'canvas' | 'attachmentDir'>;\n\tisPrerendering?: boolean;\n\ttheme?: 'dark' | 'light';\n};\n\nconst props = defineProps<ComponentOptions<T>>();\n\nconst isPrerendering = props.isPrerendering ?? false;\nconst viewerRef = useTemplateRef('viewerRef');\nlet viewer: JSONCanvasViewerInterface<T> | null = null;\nconst prerender = isPrerendering\n\t? await renderToString({\n\t\t\tcanvas: props.canvas ?? {},\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t\t...props.options,\n\t\t})\n\t: '';\nwatch(\n\t() => props.theme,\n\t(theme) => viewer?.changeTheme(theme),\n);\nwatch(\n\t() => {\n\t\treturn {\n\t\t\tcanvas: props.canvas,\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t};\n\t},\n\t({ canvas, attachmentDir }) => viewer?.load({ canvas, attachmentDir }),\n);\n\nonMounted(() => {\n\tif (!viewerRef.value) return;\n\tviewer = new JSONCanvasViewer(\n\t\tObject.assign(props.options ?? {}, {\n\t\t\tcontainer: viewerRef.value,\n\t\t\ttheme: props.theme,\n\t\t\tcanvas: props.canvas,\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t}) as UserOptions<T>,\n\t\tprops.modules,\n\t);\n});\n\nonUnmounted(() => {\n\tviewer?.dispose();\n\tviewer = null;\n});\n\ndefineExpose({ viewer });\n</script>\n\n<template>\n\t<section ref=\"viewerRef\" v-html=\"prerender\" style=\"max-height: 100vh; max-width: 100vw\" />\n</template>\n"],"names":["props","__props","isPrerendering","viewerRef","useTemplateRef","viewer","prerender","__temp","__restore","_withAsyncContext","renderToString","canvas","attachmentDir","options","watch","theme","changeTheme","load","onMounted","value","JSONCanvasViewer","Object","assign","container","modules","onUnmounted","dispose","__expose","_createElementBlock","ref","innerHTML","_unref","style"],"mappings":"8SAeA,MAAMA,EAAQC,EAERC,EAAiBF,EAAME,iBAAkB,EACzCC,EAAYC,EAAAA,eAAe,aACjC,IAAIC,EAA8C,KAClD,MAAMC,EAAYJ,IACfK,EAAAC,GAAAC,EAAAA,iBAAA,IAAMC,iBAAe,CACrBC,OAAQX,EAAMW,QAAU,CAAA,EACxBC,cAAeZ,EAAMY,iBAClBZ,EAAMa,4BAET,UACHC,EAAAA,MACC,IAAMd,EAAMe,MACXA,GAAUV,GAAQW,YAAYD,IAEhCD,EAAAA,MACC,KACQ,CACNH,OAAQX,EAAMW,OACdC,cAAeZ,EAAMY,gBAGvB,EAAGD,SAAQC,mBAAoBP,GAAQY,KAAK,CAAEN,SAAQC,mBAGvDM,EAAAA,UAAU,KACJf,EAAUgB,QACfd,EAAS,IAAIe,EAAAA,iBACZC,OAAOC,OAAOtB,EAAMa,SAAW,CAAA,EAAI,CAClCU,UAAWpB,EAAUgB,MACrBJ,MAAOf,EAAMe,MACbJ,OAAQX,EAAMW,OACdC,cAAeZ,EAAMY,gBAEtBZ,EAAMwB,YAIRC,EAAAA,YAAY,KACXpB,GAAQqB,UACRrB,EAAS,OAGVsB,EAAa,CAAEtB,iCAIduB,EAAAA,mBAA0F,UAAA,SAA7E,YAAJC,IAAI1B,EAAY2B,UAAQC,EAAAA,MAAAzB,GAAW0B,MAAA,CAAA,aAAA,QAAA,YAAA"}
|
package/dist/vue.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{defineComponent as e,useTemplateRef as t,withAsyncContext as a,watch as n,onMounted as r,onUnmounted as s,openBlock as i,createElementBlock as o,unref as c}from"vue";import{J as m}from"./index-BPBGNZi4.js";import{r as h}from"./renderToString-Dp8A-Rka.js";const v=["innerHTML"],l=/* @__PURE__ */e({__name:"vueComponent",props:{modules:{},canvas:{},attachmentDir:{},options:{},isPrerendering:{type:Boolean},theme:{}},async setup(e,{expose:l}){let p,u;const d=e,D=d.isPrerendering??!1,f=t("viewerRef");let w=null;const g=D?([p,u]=a(()=>h({canvas:d.canvas??{},attachmentDir:d.attachmentDir,...d.options})),p=await p,u(),p):"";return n(()=>d.theme,e=>w?.changeTheme(e)),n(()=>({canvas:d.canvas,attachmentDir:d.attachmentDir}),({canvas:e,attachmentDir:t})=>w?.load({canvas:e,attachmentDir:t})),r(()=>{f.value&&(w=new m(Object.assign(d.options??{},{container:f.value,theme:d.theme,canvas:d.canvas,attachmentDir:d.attachmentDir}),d.modules))}),s(()=>{w?.dispose(),w=null}),l({viewer:w}),(e,t)=>(i(),o("section",{ref_key:"viewerRef",ref:f,innerHTML:c(g),style:{"max-height":"100vh","max-width":"100vw"}},null,8,v))}});export{l as default};
|
|
2
|
-
//# sourceMappingURL=vue.js.map
|
package/dist/vue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue.js","sources":["../src/bridges/vueComponent.vue"],"sourcesContent":["<script lang=\"ts\" generic=\"T extends ModuleInputCtor\" setup>\nimport { onMounted, onUnmounted, useTemplateRef, watch } from 'vue';\nimport JSONCanvasViewer, { type JSONCanvasViewerInterface } from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport renderToString from './renderToString';\n\ntype ComponentOptions<T extends ModuleInputCtor> = {\n\tmodules?: T;\n\tcanvas?: JSONCanvas;\n\tattachmentDir?: string;\n\toptions?: Omit<UserOptions<T>, 'container' | 'theme' | 'canvas' | 'attachmentDir'>;\n\tisPrerendering?: boolean;\n\ttheme?: 'dark' | 'light';\n};\n\nconst props = defineProps<ComponentOptions<T>>();\n\nconst isPrerendering = props.isPrerendering ?? false;\nconst viewerRef = useTemplateRef('viewerRef');\nlet viewer: JSONCanvasViewerInterface<T> | null = null;\nconst prerender = isPrerendering\n\t? await renderToString({\n\t\t\tcanvas: props.canvas ?? {},\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t\t...props.options,\n\t\t})\n\t: '';\nwatch(\n\t() => props.theme,\n\t(theme) => viewer?.changeTheme(theme),\n);\nwatch(\n\t() => {\n\t\treturn {\n\t\t\tcanvas: props.canvas,\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t};\n\t},\n\t({ canvas, attachmentDir }) => viewer?.load({ canvas, attachmentDir }),\n);\n\nonMounted(() => {\n\tif (!viewerRef.value) return;\n\tviewer = new JSONCanvasViewer(\n\t\tObject.assign(props.options ?? {}, {\n\t\t\tcontainer: viewerRef.value,\n\t\t\ttheme: props.theme,\n\t\t\tcanvas: props.canvas,\n\t\t\tattachmentDir: props.attachmentDir,\n\t\t}) as UserOptions<T>,\n\t\tprops.modules,\n\t);\n});\n\nonUnmounted(() => {\n\tviewer?.dispose();\n\tviewer = null;\n});\n\ndefineExpose({ viewer });\n</script>\n\n<template>\n\t<section ref=\"viewerRef\" v-html=\"prerender\" style=\"max-height: 100vh; max-width: 100vw\" />\n</template>\n"],"names":["props","__props","isPrerendering","viewerRef","useTemplateRef","viewer","prerender","__temp","__restore","_withAsyncContext","renderToString","canvas","attachmentDir","options","watch","theme","changeTheme","load","onMounted","value","JSONCanvasViewer","Object","assign","container","modules","onUnmounted","dispose","__expose","_createElementBlock","ref","innerHTML","_unref","style"],"mappings":"wcAeA,MAAMA,EAAQC,EAERC,EAAiBF,EAAME,iBAAkB,EACzCC,EAAYC,EAAe,aACjC,IAAIC,EAA8C,KAClD,MAAMC,EAAYJ,IACfK,EAAAC,GAAAC,EAAA,IAAMC,EAAe,CACrBC,OAAQX,EAAMW,QAAU,CAAA,EACxBC,cAAeZ,EAAMY,iBAClBZ,EAAMa,4BAET,UACHC,EACC,IAAMd,EAAMe,MACXA,GAAUV,GAAQW,YAAYD,IAEhCD,EACC,KACQ,CACNH,OAAQX,EAAMW,OACdC,cAAeZ,EAAMY,gBAGvB,EAAGD,SAAQC,mBAAoBP,GAAQY,KAAK,CAAEN,SAAQC,mBAGvDM,EAAU,KACJf,EAAUgB,QACfd,EAAS,IAAIe,EACZC,OAAOC,OAAOtB,EAAMa,SAAW,CAAA,EAAI,CAClCU,UAAWpB,EAAUgB,MACrBJ,MAAOf,EAAMe,MACbJ,OAAQX,EAAMW,OACdC,cAAeZ,EAAMY,gBAEtBZ,EAAMwB,YAIRC,EAAY,KACXpB,GAAQqB,UACRrB,EAAS,OAGVsB,EAAa,CAAEtB,uBAIduB,EAA0F,UAAA,SAA7E,YAAJC,IAAI1B,EAAY2B,UAAQC,EAAAzB,GAAW0B,MAAA,CAAA,aAAA,QAAA,YAAA"}
|
package/dist/webpackLoader.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { validate } from "schema-utils";
|
|
2
|
-
const schema = {
|
|
3
|
-
type: "object",
|
|
4
|
-
properties: {
|
|
5
|
-
parser: { instanceof: "Function" }
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
async function jsonCanvasLoader(source) {
|
|
9
|
-
const options = this.getOptions() ?? {};
|
|
10
|
-
validate(schema, options, { name: "JSON Canvas Loader" });
|
|
11
|
-
const { parser } = options;
|
|
12
|
-
this.cacheable(true);
|
|
13
|
-
try {
|
|
14
|
-
const json = JSON.parse(source);
|
|
15
|
-
if (parser && Array.isArray(json.nodes)) {
|
|
16
|
-
await Promise.all(
|
|
17
|
-
json.nodes.map(async (node) => {
|
|
18
|
-
if (node.type === "text") {
|
|
19
|
-
node.text = await parser(node.text);
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return `export default ${JSON.stringify(json)}`;
|
|
25
|
-
} catch (e) {
|
|
26
|
-
this.emitError(`[json-canvas] Failed to parse ${this.resourcePath}: ${e.message}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const raw = true;
|
|
30
|
-
export {
|
|
31
|
-
jsonCanvasLoader as default,
|
|
32
|
-
raw
|
|
33
|
-
};
|