Skip to content

Commit

Permalink
fix(docs): dedupe and add alias for vue
Browse files Browse the repository at this point in the history
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
  • Loading branch information
bcakmakoglu committed Nov 6, 2021
1 parent ae0772b commit 3931a59
Show file tree
Hide file tree
Showing 41 changed files with 853 additions and 807 deletions.
3 changes: 1 addition & 2 deletions docs/assets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ html,
body,
#root,
#__nuxt {
height: 100vh;
margin: 0;
height: 100%;
color: #111;
overflow: hidden;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<header class="flex items-center py-4 px-8 text-white h-[92px]">
<header class="flex items-center py-4 px-8 text-white">
<div class="flex flex-col">
<a class="logo text-xl" href="https://github.com/bcakmakoglu/vue-flow"> Vue Flow </a>
<span class="text-xs text-gray-800 mt-2"
Expand Down
10 changes: 10 additions & 0 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { resolve } from 'path'
import { defineNuxtConfig } from 'nuxt3'

export default defineNuxtConfig({
Expand All @@ -8,5 +9,14 @@ export default defineNuxtConfig({
router: {
base: '/',
},
vite: {
alias: {
vue: resolve('./node_modules/vue'),
},
resolve: {
dedupe: ['vue'],
preserveSymlinks: false,
},
},
buildModules: ['nuxt-windicss'],
})
5 changes: 2 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"private": true,
"scripts": {
"dev": "nuxt dev",
"build": "nuxt build",
"dev": "nuxi dev",
"build": "nuxi build",
"start": "node .output/server/index.mjs"
},
"dependencies": {
Expand All @@ -11,7 +11,6 @@
"localforage": "^1.10.0"
},
"devDependencies": {
"@nuxt/nitro": "^0.10.0",
"@types/dagre": "^0.7.46",
"nuxt-windicss": "^2.0.4",
"nuxt3": "latest"
Expand Down
3 changes: 0 additions & 3 deletions docs/pages/examples/edge-types.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<script lang="ts" setup>
/**
* Example for checking the different edge types and source and target positions
*/
import {
Flow,
removeElements,
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup></script>
<template>
<div class="flex justify-center items-center h-full">
<div class="flex justify-center items-center h-full w-full">
<h1 class="text-5xl">Vue Flow</h1>
</div>
</template>
1,345 changes: 654 additions & 691 deletions docs/yarn.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions examples/Basic/Basic.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import Flow, {
import {
Flow,
MiniMap,
Controls,
Background,
Expand All @@ -12,7 +13,7 @@ import Flow, {
isNode,
removeElements,
Node,
} from '~/index'
} from '@braks/vue-flow'
const onNodeDragStop = ({ node }: { node: Node }) => console.log('drag stop', node)
const onElementClick = ({ node }: { node: Node }) => console.log('click', node)
Expand Down
2 changes: 1 addition & 1 deletion examples/CustomConnectionLine/CustomConnectionLine.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import ConnectionLine from './ConnectionLine.vue'
import Flow, { removeElements, addEdge, Background, BackgroundVariant, Elements, Connection, Edge } from '~/index'
import { Flow, removeElements, addEdge, Background, BackgroundVariant, Elements, Connection, Edge } from '~/index'
const elements = ref<Elements>([
{
Expand Down
3 changes: 2 additions & 1 deletion examples/CustomNode/CustomNode.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import ColorSelectorNode from './ColorSelectorNode.vue'
import Flow, {
import {
Flow,
isEdge,
removeElements,
addEdge,
Expand Down
2 changes: 1 addition & 1 deletion examples/DragNDrop/DnD.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import Sidebar from './Sidebar.vue'
import Flow, { addEdge, removeElements, Controls, FlowInstance, Elements, Connection, Edge, ElementId, Node } from '~/index'
import { Flow, addEdge, removeElements, Controls, FlowInstance, Elements, Connection, Edge, ElementId, Node } from '~/index'
import './dnd.css'
const flowInstance = ref<FlowInstance>()
Expand Down
2 changes: 1 addition & 1 deletion examples/EdgeTypes/EdgeTypesExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Example for checking the different edge types and source and target positions
*/
import { getElements } from './utils'
import Flow, { removeElements, addEdge, MiniMap, Controls, Background, FlowInstance, Connection, Edge, Elements } from '~/index'
import { Flow, removeElements, addEdge, MiniMap, Controls, Background, FlowInstance, Connection, Edge, Elements } from '~/index'
const onLoad = (flowInstance: FlowInstance) => {
flowInstance.fitView()
Expand Down
3 changes: 2 additions & 1 deletion examples/EdgeWithButton/EdgeWithButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import ButtonEdge from './ButtonEdge.vue'
import Flow, {
import {
Flow,
addEdge,
Background,
Connection,
Expand Down
3 changes: 2 additions & 1 deletion examples/Edges/EdgesExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import CustomEdge from './CustomEdge.vue'
import CustomEdge2 from './CustomEdge2.vue'
import CustomLabel from './CustomLabel.vue'
import Flow, {
import {
Flow,
MiniMap,
Controls,
Background,
Expand Down
3 changes: 2 additions & 1 deletion examples/Empty/EmptyExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { CSSProperties } from 'vue'
import Flow, {
import {
Flow,
MiniMap,
Controls,
Background,
Expand Down
2 changes: 1 addition & 1 deletion examples/Hidden/HiddenExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import Flow, { MiniMap, Controls, Connection, Edge, Elements, addEdge } from '~/index'
import { Flow, MiniMap, Controls, Connection, Edge, Elements, addEdge } from '~/index'
const initialElements: Elements = [
{ id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 } },
Expand Down
3 changes: 2 additions & 1 deletion examples/Interaction/InteractionExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import Flow, {
import {
Flow,
addEdge,
MiniMap,
Controls,
Expand Down
3 changes: 2 additions & 1 deletion examples/Layouting/LayoutingExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import dagre from 'dagre'
import initialElements from './initial-elements'
import './layouting.css'
import Flow, {
import {
Flow,
Controls,
addEdge,
ConnectionMode,
Expand Down
2 changes: 1 addition & 1 deletion examples/MultiFlows/Flow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import Flow, { Background, Connection, Elements, Edge, removeElements, addEdge } from '~/index'
import { Flow, Background, Connection, Elements, Edge, removeElements, addEdge } from '~/index'
const initialElements: Elements = [
{ id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, className: 'light' },
{ id: '2', data: { label: 'Node 2' }, position: { x: 100, y: 100 }, className: 'light' },
Expand Down
2 changes: 1 addition & 1 deletion examples/NodeTypeChange/NodeTypeChangeExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { CSSProperties } from 'vue'
import Flow, { addEdge, Connection, Edge, Elements, isEdge, FlowInstance, Position } from '~/index'
import { Flow, addEdge, Connection, Edge, Elements, isEdge, FlowInstance, Position } from '~/index'
const initialElements: Elements = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/NodeTypesIdChange/NodeTypesIdChangeExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { CSSProperties } from 'vue'
import NodeA from './NodeA.vue'
import NodeB from './NodeB.vue'
import Flow, { Elements, Position, NodeType, Connection, Edge, addEdge } from '~/index'
import { Flow, Elements, Position, NodeType, Connection, Edge, addEdge } from '~/index'
const initialElements: Elements = [
{
Expand Down
3 changes: 2 additions & 1 deletion examples/Overview/Overview.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { CSSProperties } from 'vue'
import Flow, {
import {
Flow,
removeElements,
addEdge,
MiniMap,
Expand Down
3 changes: 2 additions & 1 deletion examples/Provider/ProviderExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import Sidebar from './Sidebar.vue'
import Flow, {
import {
Flow,
addEdge,
removeElements,
Controls,
Expand Down
2 changes: 1 addition & 1 deletion examples/SaveRestore/SaveRestoreExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import Controls from './Controls.vue'
import Flow, { addEdge, Connection, Node, Edge, Elements, FlowInstance, removeElements } from '~/index'
import { Flow, addEdge, Connection, Node, Edge, Elements, FlowInstance, removeElements } from '~/index'
import './save.css'
Expand Down
3 changes: 2 additions & 1 deletion examples/Stress/StressExample.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import { CSSProperties } from 'vue'
import { getElements } from './utils'
import Flow, {
import {
Flow,
removeElements,
addEdge,
MiniMap,
Expand Down
2 changes: 1 addition & 1 deletion examples/Switch/SwitchExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import Flow, { removeElements, addEdge, Node, FlowElement, Elements, Connection, Edge } from '~/index'
import { Flow, removeElements, addEdge, Node, FlowElement, Elements, Connection, Edge } from '~/index'
const onNodeDragStop = (_: MouseEvent, node: Node) => console.log('drag stop', node)
const onElementClick = (_: MouseEvent, element: FlowElement) => console.log('click', element)
Expand Down
3 changes: 2 additions & 1 deletion examples/Unidirectional/UnidirectionalExample.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import CustomNode from './CustomNode.vue'
import Flow, {
import {
Flow,
NodeType,
addEdge,
useZoomPanHelper,
Expand Down
3 changes: 2 additions & 1 deletion examples/UpdatableEdge/UpdatableEdgeExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import Flow, {
import {
Flow,
Controls,
updateEdge,
addEdge,
Expand Down
2 changes: 1 addition & 1 deletion examples/UpdateNode/UpdateNodeExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import Flow, { Elements } from '~/index'
import { Flow, Elements } from '~/index'
import './updatenode.css'
Expand Down
3 changes: 2 additions & 1 deletion examples/UpdateNodeInternals/UpdateNodeInternalsExample.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import { CSSProperties } from 'vue'
import CustomNode from './CustomNode.vue'
import Flow, {
import {
Flow,
NodeType,
addEdge,
useZoomPanHelper,
Expand Down
3 changes: 2 additions & 1 deletion examples/Validation/ValidationExample.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts" setup>
import CustomInput from './CustomInput.vue'
import CustomNode from './CustomNode.vue'
import Flow, {
import {
Flow,
addEdge,
Handle,
Connection,
Expand Down
3 changes: 2 additions & 1 deletion examples/ZoomPanHelper/ZoomPanHelperExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import Flow, {
import {
Flow,
removeElements,
addEdge,
Background,
Expand Down
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,24 @@
"exports": {
".": {
"import": "./dist/vue-flow.es.js",
"require": "./dist/vue-flow.umd.js"
"require": "./dist/vue-flow.cjs.js"
},
"./*": "./*"
},
"main": "./dist/vue-flow.umd.js",
"main": "./dist/vue-flow.cjs.js",
"types": "./dist/index.d.ts",
"module": "./dist/vue-flow.es.js",
"unpkg": "./dist/vue-flow.umd.js",
"jsdelivr": "./dist/vue-flow.umd.js",
"unpkg": "./dist/vue-flow.iife.js",
"jsdelivr": "./dist/vue-flow.iife.js",
"files": [
"dist"
],
"scripts": {
"dev": "vue-tsc --noEmit && vite",
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly",
"serve": "vite preview",
"prepublishOnly": "pnpm build",
"prepublishOnly": "yarn build",
"test": "exit 0;",
"lint:js": "eslint --ext \".js,.jsx,.ts,.tsx\" --fix --ignore-path .gitignore .",
"lint": "pnpm lint:js"
"lint": "yarn lint:js"
},
"dependencies": {
"@braks/revue-draggable": "0.2.5",
Expand All @@ -40,30 +38,29 @@
"d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0",
"fast-deep-equal": "^3.1.3",
"pinia": "^2.0.0-rc.14",
"ssr-window": "^4.0.0"
"pinia": "^2.0.0-rc.14"
},
"devDependencies": {
"@antfu/eslint-config": "^0.9.0",
"@rollup/plugin-replace": "^2.4.2",
"@vitejs/plugin-vue": "^1.9.3",
"@vue/compiler-sfc": "^3.2.21",
"autoprefixer": "^10.3.7",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.1",
"np": "^7.5.0",
"pnpm": "^6.18.0",
"postcss-nested": "^5.0.6",
"prettier": "^2.4.1",
"typescript": "^4.4.4",
"unplugin-auto-import": "^0.4.12",
"vite": "^2.6.10",
"vite-svg-loader": "^2.2.0",
"vue": "^3.2.20",
"vue": "^3.2.21",
"vue-tsc": "^0.28.7"
},
"peerDependencies": {
"vue": ">=3.0.5"
"vue": "^3.2.21"
},
"publishConfig": {
"access": "public",
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Edges/Edge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ const edgePos = computed(() =>
</script>
<template>
<g
v-if="!props.edge.isHidden && isVisible(edgePos)"
:class="[
'vue-flow__edge',
`vue-flow__edge-${props.edge.type || 'default'}`,
Expand All @@ -137,6 +136,7 @@ const edgePos = computed(() =>
@mouseleave="onEdgeMouseLeave"
>
<slot
v-if="!props.edge.isHidden && isVisible(edgePos)"
v-bind="{
id: props.edge.id,
source: props.edge.source,
Expand Down
4 changes: 1 addition & 3 deletions src/composables/useWindow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ssrWindow } from 'ssr-window'

export default (): Window & typeof globalThis & { chrome?: any } => {
if (typeof window !== 'undefined') return window
else return ssrWindow as any
else return {} as any
}

0 comments on commit 3931a59

Please sign in to comment.