vuejs stuff

This commit is contained in:
BuckarooBanzay 2022-03-19 17:40:45 +01:00
parent e803dbe90c
commit 9371e1efb7
102 changed files with 566 additions and 150 deletions

View File

@ -1,32 +0,0 @@
html {
height: 100%;
margin: 0;
}
body {
height: 100%;
margin: 0;
}
#app {
height: 100%;
}
#title {
text-align: center;
}
.full-screen {
width: 100%;
height: 100%;
}
.leaflet-custom-display {
background: #fff;
padding: 5px;
}
.mapserver-label-icon {
margin-left: -100px !important;
margin-top: -100px !important;
}

View File

@ -2,12 +2,16 @@ package public
import "embed"
//go:embed js/* css/* pics/* index.html
//go:embed node_modules/vue/dist/vue.global.prod.js
//go:embed node_modules/vue-router/dist/vue-router.global.prod.js
//go:embed node_modules/@fortawesome/fontawesome-free/css/all.min.css
//go:embed node_modules/@fortawesome/fontawesome-free/webfonts/*
//go:embed node_modules/leaflet/dist/leaflet.js
//go:embed node_modules/leaflet/dist/leaflet.css
//go:embed node_modules/leaflet/dist/images
//go:embed node_modules/leaflet.awesome-markers/dist/leaflet.awesome-markers.css
//go:embed colors/*
//go:embed css/*
//go:embed pics/*
//go:embed sql/*
//go:embed webfonts/*
//go:embed *.html
//go:embed *.txt
//go:embed js/*
var Files embed.FS

View File

@ -5,11 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000">
<!-- styles -->
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/fontawesome.min.css"/>
<link rel="stylesheet" href="css/leaflet.css"/>
<link rel="stylesheet" href="css/leaflet.awesome-markers.css"/>
<!-- styles -->
<link rel="stylesheet" href="node_modules/bootswatch/dist/cyborg/bootstrap.min.css"/>
<link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-free/css/all.min.css"/>
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css"/>
<link rel="stylesheet" href="node_modules/leaflet.awesome-markers/dist/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="css/custom.css"/>
<title>Minetest Mapserver</title>
@ -21,10 +21,9 @@
</div>
<!-- libraries -->
<script src="js/lib/mithril.min.js"></script>
<script src="js/lib/leaflet.js"></script>
<script src="js/lib/leaflet.awesome-markers.js"></script>
<script src="js/lib/moment.min.js"></script>
<script src="node_modules/vue/dist/vue.global.prod.js"></script>
<script src="node_modules/vue-router/dist/vue-router.global.prod.js"></script>
<script src="node_modules/leaflet/dist/leaflet.js"></script>
<!-- main script -->
<script src="js/bundle.js" onerror="import('./js/main.js')"></script>

View File

@ -1,3 +1 @@
bundle.js
bundle-stats.js
lib/*

View File

@ -4,9 +4,9 @@
"esversion": 6,
"browser": true,
"globals": {
"L": true,
"m": true,
"THREE": true,
"console": true
"Vue": true,
"VueRouter": true,
"console": true,
"L": true
}
}

11
public/js/app.js Normal file
View File

@ -0,0 +1,11 @@
export default {
template: /*html*/`
<div>
<div class="container-fluid">
<br>
TODO: content
<router-view></router-view>
</div>
</div>
`
};

View File

@ -1,21 +1,13 @@
import { getConfig } from './api.js';
import App from './app.js';
import routes from './routes.js';
import wsChannel from './WebSocketChannel.js';
import config from './config.js';
import { hashCompat } from './compat.js';
import layerManager from './LayerManager.js';
// hash route compat
hashCompat();
getConfig()
.then(cfg => {
layerManager.setup(cfg.layers);
config.set(cfg);
wsChannel.connect();
m.route(document.getElementById("app"), "/map/0/12/0/0", routes);
})
.catch(e => {
document.getElementById("app").innerHTML = e;
// create router instance
const router = VueRouter.createRouter({
history: VueRouter.createWebHashHistory(),
routes: routes
});
// start vue
const app = Vue.createApp(App);
app.use(router);
app.mount("#app");

View File

@ -1,5 +1,5 @@
export default {
export default [{
input: 'main.js',
output: {
file :'bundle.js',
@ -7,4 +7,4 @@ export default {
sourcemap: true,
compact: true
}
};
}];

View File

@ -1,8 +1,6 @@
import Map from './components/Map.js';
import Search from './components/Search.js';
export default {
"/map/:layerId/:zoom/:lon/:lat": Map,
"/search/:query": Search
};
export default [{
path: "/", component: {
template: "<div>start</div>"
}
}];

32
public/old/css/custom.css Normal file
View File

@ -0,0 +1,32 @@
html {
height: 100%;
margin: 0;
}
body {
height: 100%;
margin: 0;
}
#app {
height: 100%;
}
#title {
text-align: center;
}
.full-screen {
width: 100%;
height: 100%;
}
.leaflet-custom-display {
background: #fff;
padding: 5px;
}
.mapserver-label-icon {
margin-left: -100px !important;
margin-top: -100px !important;
}

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 696 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -0,0 +1,3 @@
bundle.js
bundle-stats.js
lib/*

12
public/old/js/.jshintrc Normal file
View File

@ -0,0 +1,12 @@
{
"undef": true,
"unused": true,
"esversion": 6,
"browser": true,
"globals": {
"L": true,
"m": true,
"THREE": true,
"console": true
}
}

21
public/old/js/main.js Normal file
View File

@ -0,0 +1,21 @@
import { getConfig } from './api.js';
import routes from './routes.js';
import wsChannel from './WebSocketChannel.js';
import config from './config.js';
import { hashCompat } from './compat.js';
import layerManager from './LayerManager.js';
// hash route compat
hashCompat();
getConfig()
.then(cfg => {
layerManager.setup(cfg.layers);
config.set(cfg);
wsChannel.connect();
m.route(document.getElementById("app"), "/map/0/12/0/0", routes);
})
.catch(e => {
document.getElementById("app").innerHTML = e;
});

View File

@ -0,0 +1,10 @@
export default {
input: 'main.js',
output: {
file :'bundle.js',
format: 'iife',
sourcemap: true,
compact: true
}
};

8
public/old/js/routes.js Normal file
View File

@ -0,0 +1,8 @@
import Map from './components/Map.js';
import Search from './components/Search.js';
export default {
"/map/:layerId/:zoom/:lon/:lat": Map,
"/search/:query": Search
};

View File

Before

Width:  |  Height:  |  Size: 673 KiB

After

Width:  |  Height:  |  Size: 673 KiB

View File

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

View File

Before

Width:  |  Height:  |  Size: 786 KiB

After

Width:  |  Height:  |  Size: 786 KiB

Some files were not shown because too many files have changed in this diff Show More