update: no vue-2 compatability (doesn't work with current build)
* README.md
This commit is contained in:
@@ -33,14 +33,7 @@ import '@braks/revue-flow/dist/style.css';
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Vue2
|
## Vue2
|
||||||
With Vue2 make sure you have the composition api installed as a dependency. Same goes for Nuxtjs.
|
This doesn't work with Vue2, sorry.
|
||||||
```bash
|
|
||||||
# install revue flow
|
|
||||||
$ yarn add @braks/revue-flow @vue/composition-api
|
|
||||||
|
|
||||||
# or
|
|
||||||
$ npm i --save @braks/revue-flowy @vue/composition-api
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
This project uses Vite for development and Rollup to create type definitions.
|
This project uses Vite for development and Rollup to create type definitions.
|
||||||
|
|||||||
+2
-2
@@ -82,7 +82,7 @@ function createConfig(format, output, plugins = []) {
|
|||||||
output.sourcemap = !!process.env.SOURCE_MAP;
|
output.sourcemap = !!process.env.SOURCE_MAP;
|
||||||
output.banner = banner;
|
output.banner = banner;
|
||||||
output.externalLiveBindings = false;
|
output.externalLiveBindings = false;
|
||||||
output.globals = { 'vue-demi': 'VueDemi' };
|
output.globals = { 'vue': 'Vue' };
|
||||||
|
|
||||||
const isProductionBuild = /\.prod\.js$/.test(output.file);
|
const isProductionBuild = /\.prod\.js$/.test(output.file);
|
||||||
const isGlobalBuild = format.startsWith('global');
|
const isGlobalBuild = format.startsWith('global');
|
||||||
@@ -111,7 +111,7 @@ function createConfig(format, output, plugins = []) {
|
|||||||
// during a single build.
|
// during a single build.
|
||||||
hasTSChecked = true;
|
hasTSChecked = true;
|
||||||
|
|
||||||
const external = ['vue-demi'];
|
const external = ['vue'];
|
||||||
|
|
||||||
const nodePlugins = [resolve(), commonjs({ include: 'node_modules/**' })];
|
const nodePlugins = [resolve(), commonjs({ include: 'node_modules/**' })];
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue-demi';
|
import { defineComponent } from 'vue';
|
||||||
import Basic from './Basic';
|
import Basic from './Basic';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { Connection, Edge, Elements, FlowElement, Node, OnLoadParams } from './t
|
|||||||
import { addEdge, isNode, removeElements } from './utils/graph';
|
import { addEdge, isNode, removeElements } from './utils/graph';
|
||||||
import RevueFlow from './container/RevueFlow';
|
import RevueFlow from './container/RevueFlow';
|
||||||
import { MiniMap, Controls, Background } from './additional-components';
|
import { MiniMap, Controls, Background } from './additional-components';
|
||||||
import { defineComponent, ref } from 'vue-demi';
|
import { defineComponent, ref } from 'vue';
|
||||||
|
|
||||||
const onNodeDragStop = (_: MouseEvent, node: Node) => console.log('drag stop', node);
|
const onNodeDragStop = (_: MouseEvent, node: Node) => console.log('drag stop', node);
|
||||||
const onElementClick = (_: MouseEvent, element: FlowElement) => console.log('click', element);
|
const onElementClick = (_: MouseEvent, element: FlowElement) => console.log('click', element);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { BackgroundVariant } from '../../types';
|
import { BackgroundVariant } from '../../types';
|
||||||
import { createGridDotsPath, createGridLinesPath } from './utils';
|
import { createGridDotsPath, createGridLinesPath } from './utils';
|
||||||
import { computed, defineComponent, HTMLAttributes, PropType } from 'vue-demi';
|
import { computed, defineComponent, HTMLAttributes, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
export interface BackgroundProps extends HTMLAttributes {
|
export interface BackgroundProps extends HTMLAttributes {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import useZoomPanHelper from '../../hooks/useZoomPanHelper';
|
import useZoomPanHelper from '../../hooks/useZoomPanHelper';
|
||||||
import { FitViewParams } from '../../types';
|
import { FitViewParams } from '../../types';
|
||||||
import { defineComponent, HTMLAttributes, onMounted, PropType, ref } from 'vue-demi';
|
import { defineComponent, HTMLAttributes, onMounted, PropType, ref } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
export interface ControlProps extends HTMLAttributes {
|
export interface ControlProps extends HTMLAttributes {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
interface MiniMapNodeProps {
|
interface MiniMapNodeProps {
|
||||||
x: number;
|
x: number;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getRectOfNodes, getBoundsofRects } from '../../utils/graph';
|
import { getRectOfNodes, getBoundsofRects } from '../../utils/graph';
|
||||||
import { Node, Rect } from '../../types';
|
import { Node, Rect } from '../../types';
|
||||||
import MiniMapNode from './MiniMapNode';
|
import MiniMapNode from './MiniMapNode';
|
||||||
import { computed, defineComponent, HTMLAttributes, PropType } from 'vue-demi';
|
import { computed, defineComponent, HTMLAttributes, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
type StringFunc = (node: Node) => string;
|
type StringFunc = (node: Node) => string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ref, defineComponent, CSSProperties, PropType, computed } from 'vue-demi';
|
import { ref, defineComponent, CSSProperties, PropType, computed } from 'vue';
|
||||||
|
|
||||||
import { getBezierPath } from '../Edges/BezierEdge';
|
import { getBezierPath } from '../Edges/BezierEdge';
|
||||||
import { getSmoothStepPath } from '../Edges/SmoothStepEdge';
|
import { getSmoothStepPath } from '../Edges/SmoothStepEdge';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { computed, CSSProperties, defineComponent, PropType } from 'vue-demi';
|
import { computed, CSSProperties, defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
import EdgeText from './EdgeText';
|
import EdgeText from './EdgeText';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Position } from '../../types';
|
import { Position } from '../../types';
|
||||||
import { defineComponent, HTMLAttributes, PropType } from 'vue-demi';
|
import { defineComponent, HTMLAttributes, PropType } from 'vue';
|
||||||
|
|
||||||
const shiftX = (x: number, shift: number, position: Position): number => {
|
const shiftX = (x: number, shift: number, position: Position): number => {
|
||||||
if (position === Position.Left) return x - shift;
|
if (position === Position.Left) return x - shift;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EdgeTextProps, Rect } from '../../types';
|
import { EdgeTextProps, Rect } from '../../types';
|
||||||
import { defineComponent, PropType, ref, watch } from 'vue-demi';
|
import { defineComponent, PropType, ref, watch } from 'vue';
|
||||||
|
|
||||||
const EdgeText = defineComponent({
|
const EdgeText = defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent } from 'vue-demi';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
import EdgeText from './EdgeText';
|
import EdgeText from './EdgeText';
|
||||||
import { getMarkerEnd, getCenter } from './utils';
|
import { getMarkerEnd, getCenter } from './utils';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent } from 'vue-demi';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
import { EdgeSmoothStepProps } from '../../types';
|
import { EdgeSmoothStepProps } from '../../types';
|
||||||
import SmoothStepEdge from './SmoothStepEdge';
|
import SmoothStepEdge from './SmoothStepEdge';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent } from 'vue-demi';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
import EdgeText from './EdgeText';
|
import EdgeText from './EdgeText';
|
||||||
import { getMarkerEnd } from './utils';
|
import { getMarkerEnd } from './utils';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component, computed, defineComponent, ref } from 'vue-demi';
|
import { Component, computed, defineComponent, ref } from 'vue';
|
||||||
|
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
import { Edge, EdgeProps, Position, WrapEdgeProps } from '../../types';
|
import { Edge, EdgeProps, Position, WrapEdgeProps } from '../../types';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Connection, ElementId, Position } from '../../types';
|
import { Connection, ElementId, Position } from '../../types';
|
||||||
import { onMouseDown, ValidConnectionFunc } from './handler';
|
import { onMouseDown, ValidConnectionFunc } from './handler';
|
||||||
import { defineComponent, inject, PropType } from 'vue-demi';
|
import { defineComponent, inject, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
const alwaysValid = () => true;
|
const alwaysValid = () => true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Handle from '../../components/Handle';
|
import Handle from '../../components/Handle';
|
||||||
import { NodeProps, Position } from '../../types';
|
import { NodeProps, Position } from '../../types';
|
||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
const DefaultNode = defineComponent({
|
const DefaultNode = defineComponent({
|
||||||
name: 'DefaultNode',
|
name: 'DefaultNode',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Handle from '../../components/Handle';
|
import Handle from '../../components/Handle';
|
||||||
import { NodeProps, Position } from '../../types';
|
import { NodeProps, Position } from '../../types';
|
||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
const InputNode = defineComponent({
|
const InputNode = defineComponent({
|
||||||
name: 'InputNode',
|
name: 'InputNode',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Handle from '../../components/Handle';
|
import Handle from '../../components/Handle';
|
||||||
import { NodeProps, Position } from '../../types';
|
import { NodeProps, Position } from '../../types';
|
||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
const OutputNode = defineComponent({
|
const OutputNode = defineComponent({
|
||||||
name: 'OutputNode',
|
name: 'OutputNode',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Node, WrapNodeProps } from '../../types';
|
import { Node, WrapNodeProps } from '../../types';
|
||||||
import { computed, CSSProperties, defineComponent, onMounted, provide, ref } from 'vue-demi';
|
import { computed, CSSProperties, defineComponent, onMounted, provide, ref } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
export default (NodeComponent: any) => {
|
export default (NodeComponent: any) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* The user selection rectangle gets displayed when a user drags the mouse while pressing shift
|
* The user selection rectangle gets displayed when a user drags the mouse while pressing shift
|
||||||
*/
|
*/
|
||||||
import { XYPosition } from '../../types';
|
import { XYPosition } from '../../types';
|
||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
type UserSelectionProps = {
|
type UserSelectionProps = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
|
|
||||||
interface MarkerProps {
|
interface MarkerProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
Transform,
|
Transform,
|
||||||
OnEdgeUpdateFunc
|
OnEdgeUpdateFunc
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
import { computed, CSSProperties, defineComponent, PropType } from 'vue-demi';
|
import { computed, CSSProperties, defineComponent, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
interface EdgeRendererProps {
|
interface EdgeRendererProps {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import wrapEdge from '../../components/Edges/wrapEdge';
|
|||||||
import { rectToBox } from '../../utils/graph';
|
import { rectToBox } from '../../utils/graph';
|
||||||
|
|
||||||
import { EdgeTypesType, EdgeProps, Position, Node, XYPosition, ElementId, HandleElement, Transform, Edge } from '../../types';
|
import { EdgeTypesType, EdgeProps, Position, Node, XYPosition, ElementId, HandleElement, Transform, Edge } from '../../types';
|
||||||
import { Component } from 'vue-demi';
|
import { Component } from 'vue';
|
||||||
|
|
||||||
export function createEdgeTypes(edgeTypes: EdgeTypesType): EdgeTypesType {
|
export function createEdgeTypes(edgeTypes: EdgeTypesType): EdgeTypesType {
|
||||||
const standardTypes: EdgeTypesType = {
|
const standardTypes: EdgeTypesType = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { GraphViewProps } from '../GraphView';
|
import { GraphViewProps } from '../GraphView';
|
||||||
import ZoomPane from '../ZoomPane';
|
import ZoomPane from '../ZoomPane';
|
||||||
import UserSelection from '../../components/UserSelection';
|
import UserSelection from '../../components/UserSelection';
|
||||||
import { defineComponent, PropType } from 'vue-demi';
|
import { defineComponent, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
type FlowRendererProps = Omit<
|
type FlowRendererProps = Omit<
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import EdgeRenderer from '../EdgeRenderer';
|
|||||||
import { onLoadProject, onLoadGetElements, onLoadToObject } from '../../utils/graph';
|
import { onLoadProject, onLoadGetElements, onLoadToObject } from '../../utils/graph';
|
||||||
import { RevueFlowProps } from '../RevueFlow';
|
import { RevueFlowProps } from '../RevueFlow';
|
||||||
import { NodeTypesType, EdgeTypesType, ConnectionLineType, KeyCode } from '../../types';
|
import { NodeTypesType, EdgeTypesType, ConnectionLineType, KeyCode } from '../../types';
|
||||||
import { CSSProperties, defineComponent, onBeforeMount, onMounted, PropType, ref } from 'vue-demi';
|
import { CSSProperties, defineComponent, onBeforeMount, onMounted, PropType, ref } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
import useZoomPanHelper from '../../hooks/useZoomPanHelper';
|
import useZoomPanHelper from '../../hooks/useZoomPanHelper';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getNodesInside } from '../../utils/graph';
|
import { getNodesInside } from '../../utils/graph';
|
||||||
import { Node, NodeTypesType, Edge } from '../../types';
|
import { Node, NodeTypesType, Edge } from '../../types';
|
||||||
import { computed, defineComponent, PropType } from 'vue-demi';
|
import { computed, defineComponent, PropType } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
|
|
||||||
interface NodeRendererProps {
|
interface NodeRendererProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { computed, CSSProperties, defineComponent, HTMLAttributes, onUpdated, PropType } from 'vue-demi';
|
import { computed, CSSProperties, defineComponent, HTMLAttributes, onUpdated, PropType } from 'vue';
|
||||||
import GraphView from '../GraphView';
|
import GraphView from '../GraphView';
|
||||||
import DefaultNode from '../../components/Nodes/DefaultNode';
|
import DefaultNode from '../../components/Nodes/DefaultNode';
|
||||||
import InputNode from '../../components/Nodes/InputNode';
|
import InputNode from '../../components/Nodes/InputNode';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { select, pointer } from 'd3-selection';
|
|||||||
|
|
||||||
import { clamp } from '../../utils';
|
import { clamp } from '../../utils';
|
||||||
import { FlowTransform, TranslateExtent, PanOnScrollMode, KeyCode } from '../../types';
|
import { FlowTransform, TranslateExtent, PanOnScrollMode, KeyCode } from '../../types';
|
||||||
import { defineComponent, onMounted, PropType, ref, watch } from 'vue-demi';
|
import { defineComponent, onMounted, PropType, ref, watch } from 'vue';
|
||||||
import store from '../../store';
|
import store from '../../store';
|
||||||
import useKeyPress from '../../hooks/useKeyPress';
|
import useKeyPress from '../../hooks/useKeyPress';
|
||||||
import useResizeHandler from '../../hooks/useResizeHandler';
|
import useResizeHandler from '../../hooks/useResizeHandler';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import useKeyPress from './useKeyPress';
|
|||||||
import { isNode, getConnectedEdges } from '../utils/graph';
|
import { isNode, getConnectedEdges } from '../utils/graph';
|
||||||
import { Elements, KeyCode, ElementId, FlowElement } from '../types';
|
import { Elements, KeyCode, ElementId, FlowElement } from '../types';
|
||||||
import store from '../store';
|
import store from '../store';
|
||||||
import { onMounted } from 'vue-demi';
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
interface HookParams {
|
interface HookParams {
|
||||||
deleteKeyCode: KeyCode;
|
deleteKeyCode: KeyCode;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { isInputDOMNode } from '../utils';
|
import { isInputDOMNode } from '../utils';
|
||||||
import { KeyCode } from '../types';
|
import { KeyCode } from '../types';
|
||||||
import { onMounted, ref } from 'vue-demi';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
export default (keyCode?: KeyCode): boolean => {
|
export default (keyCode?: KeyCode): boolean => {
|
||||||
const keyPressed = ref<boolean>(false);
|
const keyPressed = ref<boolean>(false);
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { createApp } from 'vue-demi';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Selection as D3Selection, ZoomBehavior } from 'd3';
|
import { Selection as D3Selection, ZoomBehavior } from 'd3';
|
||||||
import { Component, HTMLAttributes, PropType, VNode } from 'vue-demi';
|
import { Component, HTMLAttributes, PropType, VNode } from 'vue';
|
||||||
|
|
||||||
export type ElementId = string;
|
export type ElementId = string;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user