@abi-software/simulationvuer 0.6.5 → 0.7.0-vue-3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,77 +1,75 @@
1
- import { evaluateValue } from "./common.js";
2
-
3
- export function initialiseUi(parent) {
4
- // Initialise some output-related data.
5
-
6
- parent.simulationUiInfo.output.data.forEach((data) => {
7
- parent.simulationDataId[data.id] = data.name;
8
- });
9
-
10
- let index = -1;
11
-
12
- parent.simulationUiInfo.output.plots.forEach((outputPlot) => {
13
- ++index;
14
-
15
- parent.layout[index] = {
16
- margin: {
17
- t: 5,
18
- l: 55,
19
- r: 55,
20
- b: 90,
21
- pad: 4
22
- },
23
- dragmode: "pan",
24
- xaxis: {
25
- title: {
26
- text: outputPlot.xAxisTitle,
27
- font: {
28
- size: 10,
29
- },
30
- },
31
- },
32
- yaxis: {
33
- title: {
34
- text: outputPlot.yAxisTitle,
35
- font: {
36
- size: 10,
37
- },
38
- }
39
- },
40
- };
41
-
42
- parent.simulationData[index] = [{}];
43
- });
44
- }
45
-
46
- export function finaliseUi(parent) {
47
- // Finalise our UI, but only if we haven't already done so, we are mounted,
48
- // and we have some valid simulation UI information.
49
-
50
- if (!parent.hasFinalisedUi && parent.isMounted && parent.hasValidSimulationUiInfo) {
51
- // Configure the PlotVuer's.
52
-
53
- parent.$refs.output.classList.add("x" + parent.simulationUiInfo.output.plots.length);
54
-
55
- // Make sure that our UI is up to date.
56
-
57
- updateUi(parent);
58
-
59
- parent.hasFinalisedUi = true;
60
- }
61
- }
62
-
63
- export function updateUi(parent) {
64
- // Show/hide and enable/disable all the elements.
65
- // Note: we do this using $nextTick() to ensure that the UI has been fully
66
- // mounted.
67
-
68
- parent.$nextTick(() => {
69
- let index = -1;
70
-
71
- parent.simulationUiInfo.input.forEach((input) => {
72
- ++index;
73
-
74
- parent.$children[index].visible = (input.visible === undefined)?true:evaluateValue(parent, input.visible);
75
- });
76
- });
77
- }
1
+ import { evaluateValue } from "./common.js";
2
+
3
+ export function initialiseUi(parent) {
4
+ // Initialise some output-related data.
5
+
6
+ parent.simulationUiInfo.output.data.forEach((data) => {
7
+ parent.simulationDataId[data.id] = data.name;
8
+ });
9
+
10
+ let index = -1;
11
+
12
+ parent.simulationUiInfo.output.plots.forEach((outputPlot) => {
13
+ ++index;
14
+
15
+ parent.layout[index] = {
16
+ margin: {
17
+ t: 5,
18
+ l: 55,
19
+ r: 55,
20
+ b: 90,
21
+ pad: 4
22
+ },
23
+ dragmode: "pan",
24
+ xaxis: {
25
+ title: {
26
+ text: outputPlot.xAxisTitle,
27
+ font: {
28
+ size: 10,
29
+ },
30
+ },
31
+ },
32
+ yaxis: {
33
+ title: {
34
+ text: outputPlot.yAxisTitle,
35
+ font: {
36
+ size: 10,
37
+ },
38
+ }
39
+ },
40
+ };
41
+
42
+ parent.simulationData[index] = [{}];
43
+ });
44
+ }
45
+
46
+ export function finaliseUi(parent) {
47
+ // Finalise our UI, but only if we haven't already done so, we are mounted,
48
+ // and we have some valid simulation UI information.
49
+
50
+ if (!parent.hasFinalisedUi && parent.isMounted && parent.hasValidSimulationUiInfo) {
51
+ // Configure the PlotVuer's.
52
+
53
+ parent.$refs.output.classList.add("x" + parent.simulationUiInfo.output.plots.length);
54
+
55
+ // Make sure that our UI is up to date.
56
+
57
+ updateUi(parent);
58
+
59
+ parent.hasFinalisedUi = true;
60
+ }
61
+ }
62
+
63
+ export function updateUi(parent) {
64
+ // Show/hide and enable/disable all the elements.
65
+ // Note: we do this using $nextTick() to ensure that the UI has been fully
66
+ // mounted.
67
+ parent.$nextTick(() => {
68
+ let index = -1;
69
+
70
+ parent.simulationUiInfo.input.forEach((input) => {
71
+ ++index;
72
+ parent.$refs.simInput[index].visible = (input.visible === undefined)?true:evaluateValue(parent, input.visible);
73
+ });
74
+ });
75
+ }
@@ -0,0 +1,24 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // Generated by unplugin-vue-components
5
+ // Read more: https://github.com/vuejs/core/pull/3399
6
+ export {}
7
+
8
+ declare module 'vue' {
9
+ export interface GlobalComponents {
10
+ ElButton: typeof import('element-plus/es')['ElButton']
11
+ ElDivider: typeof import('element-plus/es')['ElDivider']
12
+ ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
13
+ ElOption: typeof import('element-plus/es')['ElOption']
14
+ ElSelect: typeof import('element-plus/es')['ElSelect']
15
+ ElSlider: typeof import('element-plus/es')['ElSlider']
16
+ RouterLink: typeof import('vue-router')['RouterLink']
17
+ RouterView: typeof import('vue-router')['RouterView']
18
+ SimulationVuer: typeof import('./components/SimulationVuer.vue')['default']
19
+ SimulationVuerInput: typeof import('./components/SimulationVuerInput.vue')['default']
20
+ }
21
+ export interface ComponentCustomProperties {
22
+ vLoading: typeof import('element-plus/es')['ElLoadingDirective']
23
+ }
24
+ }
package/src/main.js CHANGED
@@ -1,8 +1,20 @@
1
- import Vue from 'vue'
2
- import App from './App.vue'
3
-
4
- Vue.config.productionTip = false
5
-
6
- new Vue({
7
- render: h => h(App),
8
- }).$mount('#app')
1
+ import { createApp } from 'vue'
2
+ import * as VueRouter from 'vue-router'
3
+ import App from './App.vue'
4
+ import ElementPlus from 'element-plus'
5
+
6
+
7
+ const routes = [
8
+ { path: '/'},
9
+ ]
10
+
11
+ const router = VueRouter.createRouter({
12
+ // 4. Provide the history implementation to use. We are using the hash history for simplicity here.
13
+ history: VueRouter.createWebHashHistory(),
14
+ routes,
15
+ })
16
+
17
+ const app = createApp(App)
18
+ app.use(router)
19
+ app.use(ElementPlus)
20
+ app.mount('#app')
package/vite.config.js ADDED
@@ -0,0 +1,71 @@
1
+ import path from "path";
2
+ import { resolve } from "node:path";
3
+ const pathSrc = path.resolve(__dirname, "./src");
4
+ import { defineConfig } from 'vite'
5
+ import vue from '@vitejs/plugin-vue'
6
+ import Components from 'unplugin-vue-components/vite'
7
+ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
8
+
9
+ // https://vitejs.dev/config/
10
+ export default defineConfig(({ command, mode }) => {
11
+ const config = {
12
+ // css: {
13
+ // preprocessorOptions: {
14
+ // scss: {
15
+ // additionalData: `@use '${pathSrc}\\assets\\styles' as *;`
16
+ // },
17
+ // },
18
+ // },
19
+ plugins: [
20
+ vue(),
21
+ Components({
22
+ // allow auto load markdown components under `./src/components/`
23
+ extensions: ['vue', 'md'],
24
+ // allow auto import and register components used in markdown
25
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
26
+ resolvers: [
27
+ ElementPlusResolver({
28
+ importStyle: 'sass',
29
+ }),
30
+ ],
31
+ dts: 'src/components.d.ts',
32
+ }),
33
+
34
+ // https://github.com/antfu/unocss
35
+ // see unocss.config.ts for config
36
+ ],
37
+ build: {
38
+ lib: {
39
+ entry: path.resolve(__dirname, "./src/components/index.js"),
40
+ name: "SimulationVuer",
41
+ fileName: "simulationvuer",
42
+ },
43
+ rollupOptions: {
44
+ external: ["vue"],
45
+ output: {
46
+ globals: {
47
+ vue: "Vue",
48
+ },
49
+ },
50
+ },
51
+ },
52
+ resolve: {
53
+ alias: {
54
+ '~/': `${pathSrc}/`,
55
+ },
56
+ },
57
+ };
58
+
59
+ if (command === 'serve') {
60
+ config.server = {
61
+ port: 8081,
62
+ };
63
+ config.define = {
64
+ 'process.env.HTTP_PROXY': 8081,
65
+ global: 'globalThis',
66
+ // If you want to exposes all env variables, which is not recommended
67
+ // 'process.env': env
68
+ };
69
+ };
70
+ return config;
71
+ })
package/vue.config.js CHANGED
@@ -1,31 +1,31 @@
1
- const nodeExternals = require('webpack-node-externals');
2
-
3
- module.exports = {
4
- configureWebpack: config => {
5
- if (process.env.NODE_ENV === 'production') {
6
- config.externals = [ nodeExternals({allowlist: [/^element-ui/, "@abi-software/plotvuer"]}) ];
7
- }
8
- },
9
- chainWebpack: config => {
10
- const fontsRule = config.module.rule('fonts')
11
- fontsRule.uses.clear()
12
- config.module
13
- .rule('fonts')
14
- .test(/\.(ttf|otf|eot|woff|woff2)$/)
15
- .use('base64-inline-loader')
16
- .loader('base64-inline-loader')
17
- .tap(options => {
18
- // modify the options...
19
- return options
20
- })
21
- .end()
22
- },
23
- css: {
24
- //Import variables into all stylesheets.
25
- loaderOptions: {
26
- sass: {
27
- prependData: `@import '@/assets/styles';`
28
- }
29
- }
30
- }
31
- }
1
+ const nodeExternals = require('webpack-node-externals');
2
+
3
+ module.exports = {
4
+ configureWebpack: config => {
5
+ if (process.env.NODE_ENV === 'production') {
6
+ config.externals = [ nodeExternals({allowlist: [/^element-plus/, "@abi-software/plotvuer"]}) ];
7
+ }
8
+ },
9
+ chainWebpack: config => {
10
+ const fontsRule = config.module.rule('fonts')
11
+ fontsRule.uses.clear()
12
+ config.module
13
+ .rule('fonts')
14
+ .test(/\.(ttf|otf|eot|woff|woff2)$/)
15
+ .use('base64-inline-loader')
16
+ .loader('base64-inline-loader')
17
+ .tap(options => {
18
+ // modify the options...
19
+ return options
20
+ })
21
+ .end()
22
+ },
23
+ css: {
24
+ //Import variables into all stylesheets.
25
+ loaderOptions: {
26
+ sass: {
27
+ prependData: `@import '@/assets/styles';`
28
+ }
29
+ }
30
+ }
31
+ }
package/dist/demo.html DELETED
@@ -1,10 +0,0 @@
1
- <meta charset="utf-8">
2
- <title>simulationvuer demo</title>
3
- <script src="./simulationvuer.umd.js"></script>
4
-
5
- <link rel="stylesheet" href="./simulationvuer.css">
6
-
7
-
8
- <script>
9
- console.log(simulationvuer)
10
- </script>