Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@logicflow/core

Package Overview
Dependencies
Maintainers
6
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logicflow/core - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

23

CHANGELOG.md

@@ -6,2 +6,25 @@ # Change Log

# [0.2.0](https://github.com/didichuxing/LogicFlow/compare/@logicflow/core@0.1.0...@logicflow/core@0.2.0) (2021-02-01)
### Bug Fixes
* Spelling errors EdgeConifg -> EdgeConfig and EdgeConfig Repeat Definitions in type/index.ts ([401dfb5](https://github.com/didichuxing/LogicFlow/commit/401dfb533e860d03b60ddfc6d9a006900af38c35))
* **core:** fix anchor error ([7a30f23](https://github.com/didichuxing/LogicFlow/commit/7a30f238bda918be25caa6e9646846f379042b3c))
* **core:** fix checking repeatedly verification rules ([f0efbf4](https://github.com/didichuxing/LogicFlow/commit/f0efbf481eb254bdaf29fd25b29ee1ee495d439b))
* **core:** move the tool overlay out of the graph ([fcc586d](https://github.com/didichuxing/LogicFlow/commit/fcc586df6d9e8f5188fb6d87bdb86aa461950f98))
### Features
* 替换文件夹名称 ([9155d8a](https://github.com/didichuxing/LogicFlow/commit/9155d8a7af3cd0aff983f8a036bd3ffafd0d4d56))
* **core:** Add stroke-dasharray vlaue to outline of node & edge ([4cb1bca](https://github.com/didichuxing/LogicFlow/commit/4cb1bca0f5090de035adda717b9bb509c79753d7)), closes [#12](https://github.com/didichuxing/LogicFlow/issues/12)
* **core:** support open text edit by double click anchor ([690d1d1](https://github.com/didichuxing/LogicFlow/commit/690d1d1648237c06580f51439ec67e4d07931774))
* **core:** v0.2.0 ([f11d143](https://github.com/didichuxing/LogicFlow/commit/f11d143a998ca68887f08e6ccd98604f165cec8a))
* **extension:** v0.2.0 ([ee67636](https://github.com/didichuxing/LogicFlow/commit/ee676365b82d2d07d40cbc77e955eb3506690804))
# 0.1.0 (2020-12-29)

@@ -8,0 +31,0 @@

18

package.json
{
"name": "@logicflow/core",
"version": "0.1.0",
"description": "logic flow",
"version": "0.2.0",
"description": "LogicFlow core, to quickly build flowchart editor",
"main": "dist/logic-flow.js",

@@ -33,2 +33,3 @@ "license": "Apache 2.0",

"@commitlint/config-conventional": "^8.3.4",
"@types/lodash-es": "^4.17.3",
"@types/mousetrap": "^1.6.4",

@@ -57,4 +58,4 @@ "@typescript-eslint/eslint-plugin": "^3.6.1",

"husky": "^4.2.5",
"lerna": "^3.22.1",
"less-loader": "^6.0.0",
"prettier": "^2.2.1",
"standard-version": "^9.0.0",

@@ -66,3 +67,2 @@ "style-loader": "^1.2.0",

"url-loader": "^4.1.0",
"vuepress": "^1.5.3",
"webpack": "^4.43.0",

@@ -84,10 +84,3 @@ "webpack-bundle-analyzer": "^3.7.0",

},
"standard-version": {
"skip": {
"tag": true,
"commit": true
}
},
"dependencies": {
"@types/lodash-es": "^4.17.3",
"ids": "^1.0.0",

@@ -106,4 +99,3 @@ "lodash-es": "^4.17.15",

}
},
"gitHead": "de2115a3c68944e9df670da869a46d273921a56e"
}
}

@@ -29,3 +29,4 @@ export declare enum ElementState {

NODE = "node",
EDGE = "edge"
EDGE = "edge",
GRAPH = "graph"
}

@@ -56,7 +57,5 @@ export declare enum EventType {

BLANK_CONTEXTMENU = "blank:contextmenu",
CONNECTION_NOT_ALLOWED = "connection:not-allowed"
CONNECTION_NOT_ALLOWED = "connection:not-allowed",
HISTORY_CHANGE = "history:change"
}
export declare enum InnerEventType {
HISTORY_CHANGE = "inner:history:change"
}
export declare enum SegmentDirection {

@@ -63,0 +62,0 @@ HORIZONTAL = "horizontal",

@@ -13,2 +13,3 @@ export declare const defaultTheme: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -24,2 +25,3 @@ circle: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -36,2 +38,3 @@ diamond: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -48,2 +51,3 @@ ellipse: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -58,2 +62,3 @@ polygon: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -69,2 +74,3 @@ anchor: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -100,2 +106,3 @@ text: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -109,2 +116,3 @@ polyline: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -122,2 +130,3 @@ bezier: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -124,0 +133,0 @@ arrow: {

import EventEmitter from '../event/eventEmitter';
declare class History extends EventEmitter {
declare class History {
undos: any[];

@@ -10,2 +10,4 @@ redos: any[];

waitTime: number;
eventCenter: EventEmitter;
constructor(eventCenter: any);
add(data: any): void;

@@ -12,0 +14,0 @@ undoAble(): boolean;

@@ -29,7 +29,7 @@ import { h } from 'preact';

import Keyboard from './keyboard';
import { EdgeConifg, EdgeFilter, NodeConfig, NodeAttribute, ExtensionLike, FocusOnArgs, RegisterElementFn, EdgeAttribute, EdgeData } from './type';
import { EdgeConfig, EdgeFilter, NodeConfig, NodeAttribute, Extension, ComponentRender, FocusOnArgs, RegisterElementFn, EdgeAttribute, EdgeData } from './type';
import SnaplineModel from './model/SnaplineModel';
declare type GraphConfigData = {
nodes: NodeConfig[];
edges: EdgeConifg[];
edges: EdgeConfig[];
};

@@ -50,5 +50,7 @@ export default class LogicFlow {

snaplineModel: SnaplineModel;
static extensions: ExtensionLike[];
static extensions: Extension[];
components: ComponentRender[];
adapterIn: (data: unknown) => GraphConfigData;
adapterOut: (data: GraphConfigData) => unknown;
[propName: string]: any;
constructor(options: Options.Definition);

@@ -62,3 +64,3 @@ on(evt: string, callback: CallbackType): void;

*/
static use(extension: ExtensionLike): void;
static use(extension: Extension): void;
installPlugins(): void;

@@ -96,2 +98,6 @@ register(type: string, fn: RegisterElementFn): void;

/**
* 还原图形为初始位置
*/
resetTranslate(): void;
/**
* 将图形定位到画布中心

@@ -111,2 +117,4 @@ * @param focusOnArgs 支持用户传入图形当前的坐标或id,可以通过type来区分是节点还是连线的id,也可以不传(兜底)

addNode(nodeConfig: NodeConfig): BaseNodeModel;
setProperties(id: string, properties: Object): void;
getProperties(id: string): Object;
/**

@@ -135,4 +143,12 @@ * 显示节点文本编辑框

getView: (type: string) => any;
createEdge(edgeConfig: EdgeConifg): void;
removeEdge(config: EdgeFilter): void;
createEdge(edgeConfig: EdgeConfig): void;
/**
* 删除边
* @param {string} edgeId 边Id
*/
deleteEdge(edgeId: string): void;
removeEdge(config: {
sourceNodeId: string;
targetNodeId: string;
}): void;
getEdge(config: EdgeFilter): BaseEdgeModel[];

@@ -139,0 +155,0 @@ /**

@@ -16,2 +16,3 @@ import { ElementState } from '../constant/constant';

setSelected(flag: boolean): void;
setZIndex(zindex?: number): void;
/**

@@ -22,3 +23,5 @@ * 设置Node|Edge等model的状态

setElementState(state: ElementState, additionStateData?: AdditionData): void;
getProperties(): Object;
setProperties(properties: Object): void;
}
export { IBaseModel, };
import { IBaseModel } from '../BaseModel';
import GraphModel from '../GraphModel';
import { Point, AdditionData, EdgeAttribute, EdgeData } from '../../type/index';
import { Point, AdditionData, EdgeAttribute, EdgeData, MenuConfig } from '../../type/index';
import { ElementState, ModelType, ElementType } from '../../constant/constant';

@@ -12,2 +12,3 @@ declare class BaseEdgeModel implements IBaseModel {

graphModel: GraphModel;
menu?: MenuConfig[];
text: {

@@ -18,2 +19,3 @@ value: string;

draggable: boolean;
editable: boolean;
};

@@ -29,2 +31,3 @@ type: string;

outlineColor: string;
outlineStrokeDashArray: string;
strokeOpacity: number;

@@ -39,2 +42,3 @@ zIndex: number;

pointsList: any[];
draggable: boolean;
constructor(data: any, graphModel: GraphModel);

@@ -66,4 +70,5 @@ get sourceNode(): import("..").BaseNodeModel;

setStyleFromTheme(type: any, graphModel: any): void;
setZIndex(zindex?: number): void;
}
export { BaseEdgeModel };
export default BaseEdgeModel;

@@ -23,3 +23,3 @@ import BaseEdgeModel from './BaseEdgeModel';

endPoint: Point;
text: import("../../type").TextConfig;
text?: import("../../type").TextConfig;
properties: Record<string, unknown>;

@@ -26,0 +26,0 @@ };

@@ -30,3 +30,3 @@ import { ModelType } from '../../constant/constant';

endPoint: Point;
text: import("../../type").TextConfig;
text?: import("../../type").TextConfig;
properties: Record<string, unknown>;

@@ -33,0 +33,0 @@ };

@@ -6,4 +6,4 @@ import BaseNodeModel from './node/BaseNodeModel';

import { IBaseModel } from './BaseModel';
import { ElementState, ModelType } from '../constant/constant';
import { AdditionData, Point, NodeConfig, EdgeConifg, Style } from '../type';
import { ElementState, ModelType, ElementType } from '../constant/constant';
import { AdditionData, Point, NodeConfig, EdgeConfig, Style } from '../type';
import EventEmitter from '../event/eventEmitter';

@@ -13,2 +13,3 @@ declare type BaseNodeModelId = string;

declare class GraphModel {
readonly BaseType = ElementType.GRAPH;
modelType: ModelType;

@@ -21,2 +22,4 @@ rootEl: HTMLElement;

height: number;
topElement: BaseNodeModel | BaseEdgeModel;
selectElement: BaseNodeModel | BaseEdgeModel;
edgeType: string;

@@ -32,3 +35,2 @@ nodes: BaseNodeModel[];

tools: any[];
topElement: string;
background: any;

@@ -55,3 +57,2 @@ transformMatrix: TransfromModel;

get sortElements(): any[];
get selectedNode(): BaseNodeModel | BaseEdgeModel;
/**

@@ -65,3 +66,3 @@ * 当前编辑的元素,低频操作,先循环找吧。

get showMenuElement(): BaseNodeModel | this | BaseEdgeModel | {
modelType: string;
BaseType: string;
additionStateData: string;

@@ -71,4 +72,2 @@ setElementState(): void;

getModel(type: string): any;
getSelected(): BaseNodeModel;
getSelectedEdge(): BaseEdgeModel;
getNodeModel(nodeId: BaseNodeModelId): BaseNodeModel;

@@ -80,5 +79,11 @@ /**

*/
getPointByClient({ x, y }: Point): {
x: number;
y: number;
getPointByClient({ x: x1, y: y1 }: Point): {
domOverlayPostion: {
x: number;
y: number;
};
canvasOverlayPostion: {
x: number;
y: number;
};
};

@@ -91,2 +96,4 @@ isElementVisible(element: any): boolean;

};
getEdgeModel(edgeId: string): BaseEdgeModel;
getElement(id: string): IBaseModel | undefined;
setFakerNode(nodeModel: BaseNodeModel): void;

@@ -113,3 +120,3 @@ removeFakerNode(): void;

setTextEditable(id: ElementModeId): void;
createEdge(edgeConfig: EdgeConifg): void;
createEdge(edgeConfig: EdgeConfig): void;
moveEdge(nodeId: BaseNodeModelId, deltaX: number, deltaY: number): void;

@@ -124,2 +131,4 @@ removeEdge(sourceNodeId: any, targetNodeId: any): void;

resetElementState(): void;
selectNodeById(id: any): void;
selectEdgeById(id: any): void;
changeEdgeType(type: string): void;

@@ -126,0 +135,0 @@ setTheme(style: Style): void;

@@ -18,5 +18,7 @@ import { ElementState, ModelType, ElementType } from '../../constant/constant';

additionStateData: AdditionData;
menu?: MenuConfig;
menu?: MenuConfig[];
targetRules: ConnectRule[];
sourceRules: ConnectRule[];
hasSetTargetRules: boolean;
hasSetSourceRules: boolean;
properties: {};

@@ -35,2 +37,3 @@ type: string;

outlineColor: string;
outlineStrokeDashArray: string;
isSelected: boolean;

@@ -49,3 +52,5 @@ isHovered: boolean;

draggable: boolean;
editable: boolean;
};
draggable: boolean;
constructor(data: any);

@@ -75,3 +80,3 @@ formatText(data: any): void;

updateText(value: string): void;
setSelected(flag?: boolean, zIndexFlag?: boolean): void;
setSelected(flag?: boolean): void;
setHovered(flag?: boolean): void;

@@ -87,2 +92,3 @@ setHitable(flag?: boolean): void;

setStyleFromTheme(type: any, graphModel: any): void;
setZIndex(zindex?: number): void;
}

@@ -1,2 +0,2 @@

import { Point, PointTuple } from '../../type';
import { NodeData, Point, PointTuple } from '../../type';
import BaseNodeModel from './BaseNodeModel';

@@ -10,2 +10,3 @@ import { ModelType } from '../../constant/constant';

constructor(data: any, graphModel: GraphModel);
getData(): NodeData;
get points(): PointTuple[];

@@ -12,0 +13,0 @@ get width(): number;

import { DndOptions } from './view/behavior/DnD';
import { GridOptions } from './view/overlay/Grid';
import { BackgroundConfig } from './view/overlay/BackgroundOverlay';
import { ToolConfig } from './tool';
import { MenuConfig, Style } from './type';
import { Style, NodeData, EdgeData } from './type';
import { KeyboardDef } from './keyboard';

@@ -13,8 +12,4 @@ export declare type Definition = {

grid?: boolean | GridOptions;
tool?: ToolConfig;
textEdit?: boolean;
keyboard?: KeyboardDef;
edgeMenuConfig?: false | MenuConfig[];
nodeMenuConfig?: false | MenuConfig[];
graphMenuConfig?: false | MenuConfig[];
style?: Style;

@@ -29,4 +24,13 @@ dndOptions?: DndOptions;

stopZoomGraph?: boolean;
guards?: GuardsTypes;
};
export declare function get(options: Definition): Definition;
export interface GuardsTypes {
beforeClone?: (data: NodeData) => boolean;
beforeDelete?: (data: NodeData | EdgeData) => boolean;
}
export declare function get(options: Definition): {
background: boolean;
grid: boolean;
textEdit: boolean;
} & Definition;
export declare const defaults: {

@@ -33,0 +37,0 @@ background: boolean;

import { Component } from 'preact';
import LogicFlow from '../LogicFlow';
export declare type ToolConfig = {
control?: boolean;
menu?: boolean;
};
export default class Tool {

@@ -11,7 +7,7 @@ tools: Component[];

toolMap: Map<any, any>;
toolConfig: ToolConfig;
instance: LogicFlow;
constructor(tool: ToolConfig, instance: LogicFlow);
constructor(instance: LogicFlow);
registerTool(name: any, component: any): void;
getTools(): any[];
getInstance(): LogicFlow;
}

@@ -48,4 +48,7 @@ import mobx from 'mobx';

y: number;
text: TextConfig;
rx?: number;
ry?: number;
text?: TextConfig;
properties: Record<string, unknown>;
baseType?: 'node' | 'edge' | 'graph';
};

@@ -61,17 +64,8 @@ export declare type NodeAttribute = {

export declare type MenuConfig = {
text: string;
className: string;
text?: string;
className?: string;
icon?: boolean;
callback: (id: any) => void;
};
export declare type AdditionData = Record<string, unknown>;
export declare type EdgeConifg = {
id?: string;
type?: string;
sourceNodeId: string;
startPoint?: Point;
targetNodeId: string;
endPoint?: Point;
text?: string | TextConfig;
properties?: Record<string, unknown>;
};
export declare type EdgeData = {

@@ -84,3 +78,3 @@ id: string;

endPoint: Point;
text: TextConfig;
text?: TextConfig;
properties: Record<string, unknown>;

@@ -105,3 +99,3 @@ pointsList?: Point[];

export declare type EdgeConfig = {
id: string;
id?: string;
type: string;

@@ -224,4 +218,6 @@ sourceNodeId: string;

};
export interface ExtensionLike {
export declare type ComponentRender = (lf: LogicFlow, container: HTMLElement) => void;
export interface Extension {
install: (lf: LogicFlow) => void;
render?: ComponentRender;
}

@@ -228,0 +224,0 @@ export declare type Direction = 'vertical' | 'horizontal';

@@ -59,3 +59,2 @@ import BaseNode from '../model/node/BaseNodeModel';

export declare const segmentDirection: (start: Point, end: Point) => Direction;
export declare const isEdgeModel: (model: any) => boolean;
export declare const poins2PointsList: (points: string) => PolyPoint[];

@@ -62,0 +61,0 @@ export declare const getSimplePoints: (start: any, end: any, sPoint: any, tPoint: any) => Point[];

@@ -13,2 +13,3 @@ export declare const updateTheme: (style: any) => {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -24,2 +25,3 @@ circle: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -36,2 +38,3 @@ diamond: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -48,2 +51,3 @@ ellipse: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -58,2 +62,3 @@ polygon: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -69,2 +74,3 @@ anchor: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -100,2 +106,3 @@ text: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -109,2 +116,3 @@ polyline: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -122,2 +130,3 @@ bezier: {

outlineColor: string;
outlineStrokeDashArray: string;
};

@@ -124,0 +133,0 @@ arrow: {

import { h, Component } from 'preact';
import BaseNodeModel from '../model/node/BaseNodeModel';
import BaseNodeModel, { ConnectRuleResult } from '../model/node/BaseNodeModel';
import GraphModel from '../model/GraphModel';
import EventEmitter from '../event/eventEmitter';
declare type TargetNodeId = string;
interface IProps extends CSSStyleDeclaration {

@@ -18,2 +19,3 @@ x: number;

nodeDraging: boolean;
setHoverOFF: Function;
}

@@ -26,2 +28,3 @@ interface IState {

hover: boolean;
draging: boolean;
}

@@ -31,2 +34,4 @@ declare class Anchor extends Component<IProps, IState> {

dragHandler: Function;
sourceRuleResults: Map<TargetNodeId, ConnectRuleResult>;
targetRuleResults: Map<TargetNodeId, ConnectRuleResult>;
constructor();

@@ -39,3 +44,4 @@ onDragStart: () => void;

onDragEnd: () => void;
setHover(isHover: boolean): void;
onDblClick: () => void;
setHover(isHover: boolean, ev: MouseEvent): void;
checkEnd: () => void;

@@ -42,0 +48,0 @@ isShowLine(): boolean;

@@ -17,2 +17,3 @@ import { Component, h } from 'preact';

snaplineModel: SnaplineModel;
components: any;
};

@@ -19,0 +20,0 @@ declare type InjectedProps = IProps & {

@@ -20,2 +20,4 @@ import { h, Component } from 'preact';

preStartTime: number;
contextMenuTime: number;
clickTimer: number;
constructor(props: any);

@@ -56,2 +58,3 @@ abstract getShape(): any;

draggable: boolean;
editable: boolean;
};

@@ -58,0 +61,0 @@ };

@@ -49,2 +49,3 @@ import { h } from 'preact';

draggable: boolean;
editable: boolean;
};

@@ -51,0 +52,0 @@ };

@@ -39,2 +39,3 @@ import { h } from 'preact';

draggable: boolean;
editable: boolean;
};

@@ -41,0 +42,0 @@ };

@@ -50,2 +50,3 @@ import { h } from 'preact';

draggable: boolean;
editable: boolean;
};

@@ -52,0 +53,0 @@ };

@@ -49,2 +49,3 @@ import { h } from 'preact';

draggable: boolean;
editable: boolean;
};

@@ -51,0 +52,0 @@ };

@@ -1,52 +0,2 @@

import { h } from 'preact';
import GraphModel from '../../model/GraphModel';
import EventEmitter from '../../event/eventEmitter';
import { GraphTransform } from '../../type';
declare type IProps = {
graphModel: GraphModel;
eventCenter: EventEmitter;
};
declare const _default: {
new (props?: {
graphModel: GraphModel;
} & IProps, context?: any): {
getMatrixString(): GraphTransform;
render(): h.JSX.Element;
componentWillMount?(): void;
componentDidMount?(): void;
componentWillUnmount?(): void;
getChildContext?(): object;
componentWillReceiveProps?(nextProps: Readonly<{
graphModel: GraphModel;
} & IProps>, nextContext: any): void;
shouldComponentUpdate?(nextProps: Readonly<{
graphModel: GraphModel;
} & IProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUpdate?(nextProps: Readonly<{
graphModel: GraphModel;
} & IProps>, nextState: Readonly<{}>, nextContext: any): void;
getSnapshotBeforeUpdate?(oldProps: Readonly<{
graphModel: GraphModel;
} & IProps>, oldState: Readonly<{}>): any;
componentDidUpdate?(previousProps: Readonly<{
graphModel: GraphModel;
} & IProps>, previousState: Readonly<{}>, snapshot: any): void;
componentDidCatch?(error: any, errorInfo: any): void;
state: Readonly<{}>;
props: import("preact").RenderableProps<{
graphModel: GraphModel;
} & IProps, any>;
context: any;
base?: Element | Text;
setState<K extends never>(state: Partial<{}> | ((prevState: Readonly<{}>, props: Readonly<{
graphModel: GraphModel;
} & IProps>) => Partial<{}> | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
};
displayName?: string;
defaultProps?: any;
contextType?: import("preact").Context<any>;
getDerivedStateFromProps?(props: object, state: object): object;
getDerivedStateFromError?(error: any): object;
};
declare const _default: import("mobx-react/dist/types/IReactComponent").IReactComponent<any>;
export default _default;

@@ -8,2 +8,3 @@ import { h, Component } from 'preact';

export default class ToolOverlay extends Component<IProps> {
setToolOverlayRef: (element: any) => void;
/**

@@ -10,0 +11,0 @@ * 外部传入的一般是HTMLElement

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc