From c354ad696b72307437031746c2ed77b02cf905c9 Mon Sep 17 00:00:00 2001 From: James Williams <42288565+jamesgeorgewilliams@users.noreply.github.com> Date: Mon, 25 Jul 2022 12:25:55 +0200 Subject: [PATCH 1/3] vue: add vue 2 src code (#4) --- README.md | 6 +-- package.json | 15 ++++--- src/App.vue | 110 ++++++++++++++++++++++----------------------- src/main.ts | 8 +++- src/shims-tsx.d.ts | 13 ++++++ src/shims-vue.d.ts | 6 +-- 6 files changed, 87 insertions(+), 71 deletions(-) create mode 100644 src/shims-tsx.d.ts diff --git a/README.md b/README.md index cb8f876..a60d48c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# rappid-tutorial-vue3 +# joint-plus-tutorial-vue2 -This git repository is intended for instructional purposes. It is the source code that accompanies a Rappid blog post "Integration with Vue" which can be found [here](https://resources.jointjs.com/tutorial/vue-ts). +This git repository is intended for instructional purposes. It is the Vue version 2 source code that accompanies a JointJS+ blog post "Integration with Vue" which can be found [here](https://resources.jointjs.com/tutorial/vue-ts). ### Prerequisites -To run the following code, you will need a [Rappid license](https://www.jointjs.com/license) that comes with the Rappid installable package file `rappid.tgz`. +To run the following code, you will need a [JointJS+ license](https://www.jointjs.com/license) that comes with the JointJS+ installable package file `rappid.tgz`. ### Dependencies diff --git a/package.json b/package.json index 03dcf80..415dcc7 100644 --- a/package.json +++ b/package.json @@ -9,18 +9,19 @@ "dependencies": { "@clientio/rappid": "file:rappid.tgz", "core-js": "^3.6.5", - "vue": "^3.0.0", - "vue-class-component": "^8.0.0-0" + "vue": "^2.6.11", + "vue-class-component": "^7.2.3", + "vue-property-decorator": "^9.1.2" }, "devDependencies": { "@types/backbone": "latest", "@types/jquery": "latest", - "@vue/cli-plugin-babel": "~4.5.0", - "@vue/cli-plugin-typescript": "~4.5.0", - "@vue/cli-service": "~4.5.0", - "@vue/compiler-sfc": "^3.0.0", + "@vue/cli-plugin-babel": "~4.5.13", + "@vue/cli-plugin-typescript": "~4.5.13", + "@vue/cli-service": "~4.5.13", "sass": "^1.26.5", "sass-loader": "^8.0.2", - "typescript": "~4.1.5" + "typescript": "~4.1.5", + "vue-template-compiler": "^2.6.11" } } diff --git a/src/App.vue b/src/App.vue index eca765d..707b69a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,80 +1,80 @@ diff --git a/src/main.ts b/src/main.ts index 01433bc..63eb05f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,8 @@ -import { createApp } from 'vue' +import Vue from 'vue' import App from './App.vue' -createApp(App).mount('#app') +Vue.config.productionTip = false + +new Vue({ + render: h => h(App), +}).$mount('#app') diff --git a/src/shims-tsx.d.ts b/src/shims-tsx.d.ts new file mode 100644 index 0000000..c656c68 --- /dev/null +++ b/src/shims-tsx.d.ts @@ -0,0 +1,13 @@ +import Vue, { VNode } from 'vue' + +declare global { + namespace JSX { + // tslint:disable no-empty-interface + interface Element extends VNode {} + // tslint:disable no-empty-interface + interface ElementClass extends Vue {} + interface IntrinsicElements { + [elem: string]: any + } + } +} diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 3804a43..d9f24fa 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1,6 +1,4 @@ -/* eslint-disable */ declare module '*.vue' { - import type { DefineComponent } from 'vue' - const component: DefineComponent<{}, {}, any> - export default component + import Vue from 'vue' + export default Vue } From d83b5634e14f47fee6e4803accf12a0dfe74b668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kan=C4=9Bra?= Date: Thu, 25 Jul 2024 17:49:52 +0200 Subject: [PATCH 2/3] chore: update rappid imports and configure webpack to handle mjs files --- .gitignore | 4 ++-- README.md | 10 +++++----- package.json | 4 ++-- src/App.vue | 16 ++++++++-------- vue.config.js | 14 ++++++++++++++ 5 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 vue.config.js diff --git a/.gitignore b/.gitignore index 06bbfd2..507a33a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,5 @@ pnpm-debug.log* *.sln *.sw? -# rappid -rappid.tgz +# joint-plus +joint-plus.tgz diff --git a/README.md b/README.md index a60d48c..45aafee 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This git repository is intended for instructional purposes. It is the Vue versio ### Prerequisites -To run the following code, you will need a [JointJS+ license](https://www.jointjs.com/license) that comes with the JointJS+ installable package file `rappid.tgz`. +To run the following code, you will need a [JointJS+ license](https://www.jointjs.com/license) that comes with the JointJS+ installable package file `joint-plus.tgz`. ### Dependencies @@ -18,16 +18,16 @@ Make sure you have the following dependencies installed on your system: Clone this repository. ``` -git clone git@github.com:clientIO/rappid-tutorial-vue3.git +git clone git@github.com:clientIO/joint-plus-tutorial-vue.git ``` -Change into the `rappid-tutorial-vue3` directory. +Change into the `joint-plus-tutorial-vue` directory. ``` -cd rappid-tutorial-vue3 +cd joint-plus-tutorial-vue3 ``` -For this tutorial, you need to place your own `rappid.tgz` file in the root directory. +For this tutorial, you need to place your own `joint-plus.tgz` file in the root directory. When that is completed, you can install the dependencies. diff --git a/package.json b/package.json index 415dcc7..48c48ab 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rappid-tutorial-vue3", + "name": "joint-plus-tutorial-vue2", "version": "0.1.0", "private": true, "scripts": { @@ -7,7 +7,7 @@ "build": "vue-cli-service build" }, "dependencies": { - "@clientio/rappid": "file:rappid.tgz", + "@joint/plus": "file:joint-plus.tgz", "core-js": "^3.6.5", "vue": "^2.6.11", "vue-class-component": "^7.2.3", diff --git a/src/App.vue b/src/App.vue index 707b69a..131e9d7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..e2b15cb --- /dev/null +++ b/vue.config.js @@ -0,0 +1,14 @@ +module.exports = { + configureWebpack: { + module: { + rules: [ + { + test: /\.m?js$/, + use: { + loader: 'babel-loader', + } + } + ] + } + } +} From 6872139fc907af471df680b4e861c39fb7c9f136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kan=C4=9Bra?= Date: Thu, 25 Jul 2024 17:54:19 +0200 Subject: [PATCH 3/3] chore: update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45aafee..e2c5fdc 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ git clone git@github.com:clientIO/joint-plus-tutorial-vue.git Change into the `joint-plus-tutorial-vue` directory. ``` -cd joint-plus-tutorial-vue3 +cd joint-plus-tutorial-vue ``` For this tutorial, you need to place your own `joint-plus.tgz` file in the root directory.