From 2829f8a92d92644718c85060fa8951fe1c9489dc Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 5 Dec 2022 19:57:02 +0100 Subject: [PATCH] feat: add toolbar pkg Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/toolbar/README.md | 1 + packages/toolbar/package.json | 44 +++++++++++++++++++++++++++++++++ packages/toolbar/src/index.ts | 1 + packages/toolbar/src/types.ts | 8 ++++++ packages/toolbar/tsconfig.json | 31 +++++++++++++++++++++++ packages/toolbar/vite.config.ts | 32 ++++++++++++++++++++++++ 6 files changed, 117 insertions(+) create mode 100644 packages/toolbar/README.md create mode 100644 packages/toolbar/package.json create mode 100644 packages/toolbar/src/index.ts create mode 100644 packages/toolbar/src/types.ts create mode 100644 packages/toolbar/tsconfig.json create mode 100644 packages/toolbar/vite.config.ts diff --git a/packages/toolbar/README.md b/packages/toolbar/README.md new file mode 100644 index 00000000..b09ed2f6 --- /dev/null +++ b/packages/toolbar/README.md @@ -0,0 +1 @@ +# Vue Flow: Toolbar Component diff --git a/packages/toolbar/package.json b/packages/toolbar/package.json new file mode 100644 index 00000000..d7414df9 --- /dev/null +++ b/packages/toolbar/package.json @@ -0,0 +1,44 @@ +{ + "name": "@vue-flow/toolbar", + "version": "0.0.1", + "private": false, + "license": "MIT", + "author": "Burak Cakmakoglu<78412429+bcakmakoglu@users.noreply.github.com>", + "repository": { + "type": "git", + "url": "git+https://github.com/bcakmakoglu/vue-flow/packages/plugins/toolbar" + }, + "homepage": "https://github.com/bcakmakoglu/vue-flow#readme", + "bugs": { + "url": "https://github.com/bcakmakoglu/vue-flow/issues" + }, + "main": "./dist/vue-flow-plugin-toolbar.js", + "module": "./dist/vue-flow-toolbar.mjs", + "types": "./dist/index.d.ts", + "unpkg": "./dist/vue-flow-toolbar.iife.js", + "jsdelivr": "./dist/vue-flow-toolbar.iife.js", + "files": [ + "dist" + ], + "sideEffects": false, + "scripts": { + "build": "vite build", + "types": "tsc && shx rm -rf tmp", + "lint": "eslint --ext \".js,.jsx,.ts,.tsx\" --fix --ignore-path ../../../.gitignore .", + "lint:dist": "eslint --ext \".ts,.tsx\" -c .eslintrc.js --fix ./dist", + "test": "exit 0" + }, + "peerDependencies": { + "@vue-flow/core": "^1.0.0", + "vue": "^3.2.37" + }, + "dependencies": {}, + "devDependencies": { + "@vue-flow/core": "workspace:*", + "vite": "^3.2.2" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + } +} diff --git a/packages/toolbar/src/index.ts b/packages/toolbar/src/index.ts new file mode 100644 index 00000000..c9f6f047 --- /dev/null +++ b/packages/toolbar/src/index.ts @@ -0,0 +1 @@ +export * from './types' diff --git a/packages/toolbar/src/types.ts b/packages/toolbar/src/types.ts new file mode 100644 index 00000000..a6b99717 --- /dev/null +++ b/packages/toolbar/src/types.ts @@ -0,0 +1,8 @@ +import type dagre from 'dagre' + +export type Direction = 'TB' | 'BT' | 'LR' | 'RL' + +export interface UseDagreState { + layout: (direction: Direction) => void + dagreGraph: dagre.graphlib.Graph +} diff --git a/packages/toolbar/tsconfig.json b/packages/toolbar/tsconfig.json new file mode 100644 index 00000000..e9fd0ac1 --- /dev/null +++ b/packages/toolbar/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "module": "ESNext", + "target": "es2017", + "lib": [ + "DOM", + "ESNext" + ], + "strict": true, + "esModuleInterop": true, + "incremental": false, + "skipLibCheck": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "noUnusedLocals": false, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationDir": "./dist", + "emitDeclarationOnly": true, + "types": [], + }, + "include": [ + "./src", + ], + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/toolbar/vite.config.ts b/packages/toolbar/vite.config.ts new file mode 100644 index 00000000..55fa6755 --- /dev/null +++ b/packages/toolbar/vite.config.ts @@ -0,0 +1,32 @@ +import { resolve } from 'path' +import { defineConfig } from 'vite' + +// https://vitejs.dev/config/ +export default defineConfig({ + resolve: { + extensions: ['.ts', '.vue'], + }, + build: { + emptyOutDir: false, + lib: { + formats: ['es', 'cjs', 'iife'], + entry: resolve(__dirname, 'src/index.ts'), + fileName: 'vue-flow-toolbar', + name: 'vueFlowToolbar', + }, + rollupOptions: { + // make sure to externalize deps that shouldn't be bundled + // into your library + external: ['vue', '@vue-flow/core'], + output: { + dir: './dist', + // Provide global variables to use in the UMD build + // for externalized deps + globals: { + 'vue': 'Vue', + '@vue-flow/core': 'VueFlow', + }, + }, + }, + }, +})