Map visible

This commit is contained in:
Julien Lengrand-Lambert
2022-07-08 16:11:30 +02:00
parent bde286bf78
commit 809d4373fa
20 changed files with 628 additions and 1527 deletions

4
.gitignore vendored
View File

@@ -33,4 +33,6 @@ out/
/.nb-gradle/
### VS Code ###
.vscode/
.vscode/
src/main/js/pluckr-app-ts

View File

@@ -10,7 +10,7 @@
To get started:
```sh
```bash
npm init @open-wc
# requires node 10 & npm 6 or higher
```
@@ -22,9 +22,10 @@ npm init @open-wc
- `build` builds your app and outputs it in your `dist` directory
- `test` runs your test suite with Web Test Runner
- `lint` runs the linter for your project
- `format` fixes linting and formatting errors
## Tooling configs
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
If you customize the configuration a lot, you can consider moving them to individual files.
If you customize the configuration a lot, you can consider moving them to individual files.

View File

@@ -0,0 +1,29 @@
<svg
width="244px"
height="244px"
viewBox="0 0 244 244"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<defs>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
<stop stop-color="#9B00FF" offset="0%"></stop>
<stop stop-color="#0077FF" offset="100%"></stop>
</linearGradient>
</defs>
<g
id="Page-1"
stroke="none"
stroke-width="1"
fill="none"
fill-rule="evenodd"
>
<path
d="M205.639259,176.936244 C207.430887,174.217233 209.093339,171.405629 210.617884,168.510161 M215.112174,158.724316 C216.385153,155.50304 217.495621,152.199852 218.433474,148.824851 M220.655293,138.874185 C221.231935,135.482212 221.637704,132.03207 221.863435,128.532919 M222,118.131039 C221.860539,114.466419 221.523806,110.85231 221.000113,107.299021 M218.885321,96.8583653 C218.001583,93.4468963 216.942225,90.1061026 215.717466,86.8461994 M211.549484,77.3039459 C209.957339,74.1238901 208.200597,71.0404957 206.290425,68.0649233 M200.180513,59.5598295 C181.848457,36.6639805 153.655709,22 122.036748,22 C66.7879774,22 22,66.771525 22,122 C22,177.228475 66.7879774,222 122.036748,222 C152.914668,222 180.52509,208.015313 198.875424,186.036326"
id="Shape"
stroke="url(#linearGradient-1)"
stroke-width="42.0804674"
></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -22,7 +22,7 @@
<body>
<pluckr-app></pluckr-app>
<script type="module" src="./out-tsc/src/pluckr-app.js"></script>
<script type="module" src="./src/pluckr-app.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -5,16 +5,18 @@
"author": "pluckr-app",
"version": "0.0.0",
"scripts": {
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
"build": "rimraf dist && tsc && rollup -c rollup.config.js && npm run analyze -- --exclude dist && npm run dist",
"dist": "rimraf ../../resources/dist && cp -rf dist ../../resources/dist",
"lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.js\" --check --ignore-path .gitignore",
"format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.js\" --write --ignore-path .gitignore",
"build": "rimraf dist && rollup -c rollup.config.js && npm run analyze -- --exclude dist; npm run dist",
"dist": "rimraf ../../resources/dist/; cp -rf dist ../../resources/",
"start:build": "web-dev-server --root-dir dist --app-index index.html --open",
"analyze": "cem analyze --litelement",
"start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\""
"start": "web-dev-server"
},
"dependencies": {
"lit": "^2.0.2"
"leaflet": "^1.8.0",
"lit": "^2.0.2",
"mapbox-gl": "^2.9.1"
},
"devDependencies": {
"@babel/preset-env": "^7.16.4",
@@ -23,13 +25,10 @@
"@open-wc/eslint-config": "^4.3.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@web/dev-server": "^0.1.28",
"@web/rollup-plugin-html": "^1.10.1",
"@web/rollup-plugin-import-meta-assets": "^1.0.7",
"babel-plugin-template-html-minifier": "^4.1.0",
"concurrently": "^5.3.0",
"deepmerge": "^4.2.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
@@ -39,33 +38,13 @@
"rimraf": "^3.0.2",
"rollup": "^2.60.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-workbox": "^6.2.0",
"tslib": "^2.3.1",
"typescript": "^4.5.2"
"rollup-plugin-workbox": "^6.2.0"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"@open-wc",
"prettier"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error"
],
"import/no-unresolved": "off",
"import/extensions": [
"error",
"always",
{
"ignorePackages": true
}
]
}
]
},
"prettier": {
"singleQuote": true,
@@ -77,7 +56,7 @@
}
},
"lint-staged": {
"*.ts": [
"*.js": [
"eslint --fix",
"prettier --write"
]

View File

@@ -68,7 +68,6 @@ export default {
}),
/** Create and inject a service worker */
generateSW({
globIgnores: ['polyfills/*.js', 'nomodule-*.js'],
navigateFallback: '/index.html',
// where to output the generated sw
swDest: path.join('dist', 'sw.js'),
@@ -78,7 +77,6 @@ export default {
globPatterns: ['**/*.{html,js,css,webmanifest}'],
skipWaiting: true,
clientsClaim: true,
runtimeCaching: [{ urlPattern: 'polyfills/*.js', handler: 'CacheFirst' }],
}),
],
};

View File

@@ -0,0 +1,78 @@
import { LitElement, html, css } from 'lit';
import {
map as createMap,
tileLayer,
} from '../node_modules/leaflet/dist/leaflet-src.esm.js';
export class PluckrApp extends LitElement {
static get properties() {
return {
title: { type: String },
};
}
static get styles() {
return css`
:host {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
font-size: calc(10px + 2vmin);
color: #1a2b42;
max-width: 960px;
margin: 0 auto;
text-align: center;
background-color: var(--pluckr-app-background-color);
}
main {
flex-grow: 1;
}
#map {
height: 1096px;
width: 1096px;
}
`;
}
constructor() {
super();
this.title = 'My app';
}
firstUpdated(_changedProperties) {
super.firstUpdated(_changedProperties);
const map = createMap(this.renderRoot.querySelector('#map')).setView(
[51.505, -0.09],
13
);
tileLayer(
'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiamxlbmdyYW5kIiwiYSI6ImNsNWM3YTl3YjBla3ozYm8yMHo3NTRtbHkifQ.mhHRpOn0v-v59tXbvEYnlQ',
{
maxZoom: 19,
attribution:
'© <a href="https://www.mapbox.com/contribute/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}
).addTo(map);
}
render() {
return html`
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"
integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ=="
crossorigin=""
/>
<main>
<h1>${this.title}</h1>
<div id="map"></div>
</main>
`;
}
}

View File

@@ -0,0 +1,3 @@
import { PluckrApp } from './PluckrApp.js';
customElements.define('pluckr-app', PluckrApp);

View File

@@ -1,35 +0,0 @@
import { LitElement, html, css } from 'lit';
import { customElement, property } from 'lit/decorators.js';
@customElement('pluckr-app')
export class PluckrApp extends LitElement {
@property({ type: String }) title = 'My app';
static styles = css`
:host {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
font-size: calc(10px + 2vmin);
color: #1a2b42;
max-width: 960px;
margin: 0 auto;
text-align: center;
background-color: var(--pluckr-app-background-color);
}
main {
flex-grow: 1;
}
`;
render() {
return html`
<main>
<h1>${this.title}</h1>
</main>
`;
}
}

View File

@@ -1,20 +0,0 @@
{
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": ["es2017", "dom"],
"strict": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"importHelpers": true,
"outDir": "out-tsc",
"sourceMap": true,
"inlineSources": true,
"rootDir": "./",
"incremental": true
},
"include": ["**/*.ts"]
}

View File

@@ -6,13 +6,10 @@ import io.ktor.server.application.*
import io.ktor.server.http.content.*
import io.ktor.server.response.*
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.transactions.transaction
fun Application.configureRouting(database: Database) {
val controller = Controller(database)
// Starting point for a Ktor app:
routing {
get("/trees") {
@@ -23,10 +20,10 @@ fun Application.configureRouting(database: Database) {
call.respondText("Hello the World!")
}
// static("/") {
// staticBasePackage = "dist"
// defaultResource("index.html")
// resources(".")
// }
static("/") {
staticBasePackage = "dist"
defaultResource("index.html")
resources(".")
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta name="Description" content="Put your description here."><base href="/"><style>body,html{margin:0;padding:0;font-family:sans-serif;background-color:#ededed}</style><title>pluckr-app</title></head><body><pluckr-app></pluckr-app><script type="module" src="./2722f596.js"></script><script inject-service-worker="">"serviceWorker"in navigator&&window.addEventListener("load",(function(){navigator.serviceWorker.register("sw.js").then((function(){console.log('ServiceWorker registered from "sw.js".')})).catch((function(e){console.log("ServiceWorker registration failed: ",e)}))}))</script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><meta name="Description" content="Put your description here."><base href="/"><style>body,html{margin:0;padding:0;font-family:sans-serif;background-color:#ededed}</style><title>pluckr-app</title></head><body><pluckr-app></pluckr-app><script type="module" src="./82c400b6.js"></script><script inject-service-worker="">"serviceWorker"in navigator&&window.addEventListener("load",(function(){navigator.serviceWorker.register("sw.js").then((function(){console.log('ServiceWorker registered from "sw.js".')})).catch((function(e){console.log("ServiceWorker registration failed: ",e)}))}))</script></body></html>

View File

@@ -1,2 +1,2 @@
if(!self.define){let e,t={};const i=(i,n)=>(i=new URL(i+".js",n).href,t[i]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=t,document.head.appendChild(e)}else e=i,importScripts(i),t()})).then((()=>{let e=t[i];if(!e)throw new Error(`Module ${i} didnt register its module`);return e})));self.define=(n,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(t[r])return;let s={};const l=e=>i(e,r),f={module:{uri:r},exports:s,require:l};t[r]=Promise.all(n.map((e=>f[e]||l(e)))).then((e=>(o(...e),s)))}}define(["./workbox-2266476f"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"2722f596.js",revision:"8ce3bf82f431564098d054ed2792250d"},{url:"index.html",revision:"cea8e24c26f2dd07ebcf554120f94673"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")}));
if(!self.define){let e,t={};const i=(i,n)=>(i=new URL(i+".js",n).href,t[i]||new Promise((t=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=t,document.head.appendChild(e)}else e=i,importScripts(i),t()})).then((()=>{let e=t[i];if(!e)throw new Error(`Module ${i} didnt register its module`);return e})));self.define=(n,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(t[r])return;let s={};const c=e=>i(e,r),l={module:{uri:r},exports:s,require:c};t[r]=Promise.all(n.map((e=>l[e]||c(e)))).then((e=>(o(...e),s)))}}define(["./workbox-a953cab6"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"82c400b6.js",revision:"47503359e3b0ed061ae17604929a9c8f"},{url:"index.html",revision:"4e25e5c2ee2bc960e99a0c73e7cf0f2c"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html")))}));
//# sourceMappingURL=sw.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"sw.js","sources":["../../../../../../../../private/var/folders/4b/jjn7wslx5fl1r5npk147_9b80000gn/T/1891e144a4ec80f40d0033007409695b/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"2722f596.js\",\n \"revision\": \"8ce3bf82f431564098d054ed2792250d\"\n },\n {\n \"url\": \"index.html\",\n \"revision\": \"cea8e24c26f2dd07ebcf554120f94673\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"0nBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,aACPC,SAAY,qCAEb,IAE0BC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
{"version":3,"file":"sw.js","sources":["../../../../../../../../private/var/folders/4b/jjn7wslx5fl1r5npk147_9b80000gn/T/6df2bf3055c4641c9c682e5d4ce907a4/sw.js"],"sourcesContent":["import {clientsClaim as workbox_core_clientsClaim} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {registerRoute as workbox_routing_registerRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-routing/registerRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/Users/julienlengrand-lambert/Developer/pluckr/src/main/js/pluckr-app/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"82c400b6.js\",\n \"revision\": \"47503359e3b0ed061ae17604929a9c8f\"\n },\n {\n \"url\": \"index.html\",\n \"revision\": \"4e25e5c2ee2bc960e99a0c73e7cf0f2c\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","NavigationRoute","workbox_precaching_createHandlerBoundToURL"],"mappings":"0nBAuBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,aACPC,SAAY,qCAEb,IAE0BC,EAAAC,cAAC,IAAIC,EAAJC,gBAAoCC,0BAA2C"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long