From ce0c60bd34c5ee05b91fcdeb8941340f6a5e14aa Mon Sep 17 00:00:00 2001 From: Julien Lengrand-Lambert Date: Fri, 8 Jul 2022 09:53:21 +0200 Subject: [PATCH] Serializes points --- build.gradle.kts | 5 +- .../js/pluckr-app/assets/open-wc-logo.svg | 29 ------- src/main/js/pluckr-app/src/PluckrApp.ts | 80 ------------------- src/main/js/pluckr-app/src/pluckr-app.ts | 36 ++++++++- src/main/kotlin/Controller.kt | 56 +++++++++++++ .../kotlin/nl/lengrand/pluckr/Application.kt | 11 ++- .../kotlin/nl/lengrand/pluckr/Database.kt | 19 +++-- .../nl/lengrand/pluckr/plugins/Routing.kt | 21 +++-- src/main/resources/dist/566ffb82.js | 35 -------- src/main/resources/dist/9529ee57.svg | 29 ------- src/main/resources/dist/index.html | 2 +- src/main/resources/dist/sw.js | 2 +- src/main/resources/dist/sw.js.map | 2 +- 13 files changed, 132 insertions(+), 195 deletions(-) delete mode 100644 src/main/js/pluckr-app/assets/open-wc-logo.svg delete mode 100644 src/main/js/pluckr-app/src/PluckrApp.ts create mode 100644 src/main/kotlin/Controller.kt delete mode 100644 src/main/resources/dist/566ffb82.js delete mode 100644 src/main/resources/dist/9529ee57.svg diff --git a/build.gradle.kts b/build.gradle.kts index 1013c2c..77f6f5e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ val exposedVersion: String by project plugins { application kotlin("jvm") version "1.7.0" + kotlin("plugin.serialization") version "1.6.21" } @@ -33,8 +34,10 @@ dependencies { implementation("org.jetbrains.exposed:exposed-core:$exposedVersion") implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion") implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion") + implementation("io.ktor:ktor-server-content-negotiation:$ktor_version") + implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version") implementation("org.postgresql:postgresql:42.3.6") - implementation("net.postgis:postgis-jdbc:2021.1.0") + implementation("net.postgis:postgis-jdbc:2021.1.0") testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version") diff --git a/src/main/js/pluckr-app/assets/open-wc-logo.svg b/src/main/js/pluckr-app/assets/open-wc-logo.svg deleted file mode 100644 index c3ec9a5..0000000 --- a/src/main/js/pluckr-app/assets/open-wc-logo.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/js/pluckr-app/src/PluckrApp.ts b/src/main/js/pluckr-app/src/PluckrApp.ts deleted file mode 100644 index 580fef7..0000000 --- a/src/main/js/pluckr-app/src/PluckrApp.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { LitElement, html, css } from 'lit'; -import { property } from 'lit/decorators.js'; - -const logo = new URL('../../assets/open-wc-logo.svg', import.meta.url).href; - -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; - } - - .logo { - margin-top: 36px; - animation: app-logo-spin infinite 20s linear; - } - - @keyframes app-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } - } - - .app-footer { - font-size: calc(12px + 0.5vmin); - align-items: center; - } - - .app-footer a { - margin-left: 5px; - } - `; - - render() { - return html` -
- -

${this.title}

- -

Edit src/PluckrApp.ts and save to reload.

- - Code examples - -
- - - `; - } -} diff --git a/src/main/js/pluckr-app/src/pluckr-app.ts b/src/main/js/pluckr-app/src/pluckr-app.ts index 527b17c..e099b22 100644 --- a/src/main/js/pluckr-app/src/pluckr-app.ts +++ b/src/main/js/pluckr-app/src/pluckr-app.ts @@ -1,3 +1,35 @@ -import { PluckrApp } from './PluckrApp.js'; +import { LitElement, html, css } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; -customElements.define('pluckr-app', PluckrApp); +@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` +
+

${this.title}

+
+ `; + } +} diff --git a/src/main/kotlin/Controller.kt b/src/main/kotlin/Controller.kt new file mode 100644 index 0000000..d2a0f76 --- /dev/null +++ b/src/main/kotlin/Controller.kt @@ -0,0 +1,56 @@ +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import net.postgis.jdbc.geometry.Point +import nl.lengrand.pluckr.Trees +import org.jetbrains.exposed.sql.Database +import org.jetbrains.exposed.sql.ResultRow +import org.jetbrains.exposed.sql.selectAll +import org.jetbrains.exposed.sql.transactions.transaction + +@Serializable +data class Tree( + val id: Int? = null, + val name: String, + val description: String?, + @Serializable(with = PointSerializer::class) + val location : Point +) + +object PointSerializer : KSerializer { + override val descriptor = PrimitiveSerialDescriptor("Point", PrimitiveKind.STRING) + + override fun deserialize(decoder: Decoder): Point { + return Point(decoder.decodeString()) + } + + override fun serialize(encoder: Encoder, value: Point) { + encoder.encodeString(value.toString()) + } + +} + + +private fun fromRow(it: ResultRow): Tree { + return Tree(it[Trees.id], it[Trees.name], it[Trees.description], it[Trees.location]) +} + +class Controller(private val database: Database) { + + fun getTrees() : ArrayList { + println("CALLED") + val trees : ArrayList = arrayListOf() + + transaction(database){ + Trees.selectAll().map { trees.add(fromRow(it)) } + } + + println(trees) + + return trees + } +} \ No newline at end of file diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index d91bb49..19b7df9 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -1,10 +1,13 @@ package nl.lengrand.pluckr +import io.ktor.serialization.kotlinx.json.* import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.metrics.micrometer.* import io.ktor.server.netty.* import io.ktor.server.plugins.callloging.* +import io.ktor.server.plugins.contentnegotiation.* +import kotlinx.serialization.json.Json import net.postgis.jdbc.geometry.Point import nl.lengrand.pluckr.plugins.* import org.jetbrains.exposed.sql.* @@ -14,6 +17,12 @@ fun Application.myapp(){ val database = initDb() + install(ContentNegotiation){ + json(Json { + prettyPrint = true + isLenient = true + }) + } install(CallLogging) install(MicrometerMetrics) @@ -52,7 +61,7 @@ fun main() { embeddedServer( Netty, module = Application::myapp, - port = 8080, + port = 9090, host = "0.0.0.0") .start(wait = true) } diff --git a/src/main/kotlin/nl/lengrand/pluckr/Database.kt b/src/main/kotlin/nl/lengrand/pluckr/Database.kt index 1dc350b..39ff823 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Database.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Database.kt @@ -10,10 +10,13 @@ import org.jetbrains.exposed.sql.Column import org.jetbrains.exposed.sql.ColumnType import org.jetbrains.exposed.sql.Table -object Trees : IntIdTable() { +object Trees : Table() { + val id = integer("id").autoIncrement() val name = varchar("name", 100) val description = text("description") val location = point("location") + + override val primaryKey = PrimaryKey(id) // name is optional here } fun Table.point(name: String, srid: Int = 4326): Column @@ -33,10 +36,10 @@ private class PointColumnType(val srid: Int = 4326): ColumnType() { } } -class Tree(id: EntityID) : IntEntity(id) { - companion object : IntEntityClass(Trees) - - var name by Trees.name - var description by Trees.description - var location by Trees.location -} \ No newline at end of file +//class Tree(id: EntityID) : IntEntity(id) { +// companion object : IntEntityClass(Trees) +// +// var name by Trees.name +// var description by Trees.description +// var location by Trees.location +//} \ No newline at end of file diff --git a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt index eb41f95..54c457b 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/plugins/Routing.kt @@ -1,25 +1,32 @@ package nl.lengrand.pluckr.plugins +import Controller import io.ktor.server.routing.* 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 { - static("/") { - staticBasePackage = "dist" - defaultResource("index.html") - resources(".") + + get("/trees") { + call.respond(controller.getTrees()) } get("/hello") { call.respondText("Hello the World!") } + +// static("/") { +// staticBasePackage = "dist" +// defaultResource("index.html") +// resources(".") +// } } - routing { - } -} +} \ No newline at end of file diff --git a/src/main/resources/dist/566ffb82.js b/src/main/resources/dist/566ffb82.js deleted file mode 100644 index c83b939..0000000 --- a/src/main/resources/dist/566ffb82.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),i=new WeakMap;class s{constructor(t,i,s){if(this._$cssResult$=!0,s!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let e=this.o;const s=this.t;if(t&&void 0===e){const t=void 0!==s&&1===s.length;t&&(e=i.get(s)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&i.set(s,e))}return e}toString(){return this.cssText}}const n=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const e of t.cssRules)i+=e.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,e))(i)})(t):t -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */;var o;const r=window.trustedTypes,l=r?r.emptyScript:"",h=window.reactiveElementPolyfillSupport,a={toAttribute(t,e){switch(e){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},c=(t,e)=>e!==t&&(e==e||t==t),d={attribute:!0,type:String,converter:a,reflect:!1,hasChanged:c};class p extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=d){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||d}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(n(t))}else void 0!==t&&e.push(n(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=d){var s,n;const o=this.constructor._$Ep(t,i);if(void 0!==o&&!0===i.reflect){const r=(null!==(n=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==n?n:a.toAttribute)(e,i.type);this._$El=t,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(t,e){var i,s;const n=this.constructor,o=n._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=n.getPropertyOptions(o),r=t.converter,l=null!==(s=null!==(i=null==r?void 0:r.fromAttribute)&&void 0!==i?i:"function"==typeof r?r:null)&&void 0!==s?s:a.fromAttribute;this._$El=o,this[o]=l(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||c)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}} -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -var u;p.finalized=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:p}),(null!==(o=globalThis.reactiveElementVersions)&&void 0!==o?o:globalThis.reactiveElementVersions=[]).push("1.3.3");const v=globalThis.trustedTypes,$=v?v.createPolicy("lit-html",{createHTML:t=>t}):void 0,_=`lit$${(Math.random()+"").slice(9)}$`,f="?"+_,g=`<${f}>`,m=document,y=(t="")=>m.createComment(t),A=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,b=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,S=/-->/g,w=/>/g,C=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,x=/'/g,P=/"/g,U=/^(?:script|style|textarea|title)$/i,k=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),H=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),O=new WeakMap,M=m.createTreeWalker(m,129,null,!1),R=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":"",r=b;for(let e=0;e"===h[0]?(r=null!=n?n:b,a=-1):void 0===h[1]?a=-2:(a=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?C:'"'===h[3]?P:x):r===P||r===x?r=C:r===S||r===w?r=b:(r=C,n=void 0);const d=r===C&&t[e+1].startsWith("/>")?" ":"";o+=r===b?i+g:a>=0?(s.push(l),i.slice(0,a)+"$lit$"+i.slice(a)+_+d):i+_+(-2===a?(s.push(void 0),e):d)}const l=o+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==$?$.createHTML(l):l,s]};class N{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[h,a]=R(t,e);if(this.el=N.createElement(h,i),M.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=M.nextNode())&&l.length0){s.textContent=v?v.emptyScript:"";for(let i=0;i{var e;return E(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}M(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==T&&A(this._$AH)?this._$AA.nextSibling.data=t:this.k(m.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.m(i);else{const t=new L(n,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=O.get(t.strings);return void 0===e&&O.set(t.strings,e=new N(t)),e}S(t){E(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new j(this.M(y()),this.M(y()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=z(this,t,e,0),o=!A(t)||t!==this._$AH&&t!==H,o&&(this._$AH=t);else{const s=t;let r,l;for(t=n[0],r=0;r{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new j(e.insertBefore(y(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return H}}F.finalized=!0,F._$litElement$=!0,null===(J=globalThis.litElementHydrateSupport)||void 0===J||J.call(globalThis,{LitElement:F});const G=globalThis.litElementPolyfillSupport;null==G||G({LitElement:F}),(null!==(Z=globalThis.litElementVersions)&&void 0!==Z?Z:globalThis.litElementVersions=[]).push("3.2.1"); -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -const Q=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}}; -/** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ -var X;null===(X=window.HTMLSlotElement)||void 0===X||X.prototype.assignedElements;const Y=new URL(new URL("9529ee57.svg",import.meta.url).href,import.meta.url).href;class tt extends F{constructor(){super(...arguments),this.title="My app"}render(){return k`

${this.title}

Edit src/PluckrApp.ts and save to reload.

Code examples
`}}tt.styles=((t,...i)=>{const n=1===t.length?t[0]:i.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new s(n,t,e)})`: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}.logo{margin-top:36px;animation:app-logo-spin infinite 20s linear}@keyframes app-logo-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}.app-footer{font-size:calc(12px + .5vmin);align-items:center}.app-footer a{margin-left:5px}`,function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);o>3&&r&&Object.defineProperty(e,i,r)}([function(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Q(t,e)}({type:String})],tt.prototype,"title",void 0),customElements.define("pluckr-app",tt); diff --git a/src/main/resources/dist/9529ee57.svg b/src/main/resources/dist/9529ee57.svg deleted file mode 100644 index c3ec9a5..0000000 --- a/src/main/resources/dist/9529ee57.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/dist/index.html b/src/main/resources/dist/index.html index a0ec650..c004570 100644 --- a/src/main/resources/dist/index.html +++ b/src/main/resources/dist/index.html @@ -1 +1 @@ -pluckr-app \ No newline at end of file +pluckr-app \ No newline at end of file diff --git a/src/main/resources/dist/sw.js b/src/main/resources/dist/sw.js index 874f9a3..64498e8 100644 --- a/src/main/resources/dist/sw.js +++ b/src/main/resources/dist/sw.js @@ -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} didn’t 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),c={module:{uri:r},exports:s,require:l};t[r]=Promise.all(n.map((e=>c[e]||l(e)))).then((e=>(o(...e),s)))}}define(["./workbox-2266476f"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"566ffb82.js",revision:"186b5ed7eabaef626f004fd1db2a8a69"},{url:"index.html",revision:"508c7b3c698de5e8cc1ba3976005cbad"}],{}),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} didn’t 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")})); //# sourceMappingURL=sw.js.map diff --git a/src/main/resources/dist/sw.js.map b/src/main/resources/dist/sw.js.map index 0fb8c93..178313c 100644 --- a/src/main/resources/dist/sw.js.map +++ b/src/main/resources/dist/sw.js.map @@ -1 +1 @@ -{"version":3,"file":"sw.js","sources":["../../../../../../../../private/var/folders/4b/jjn7wslx5fl1r5npk147_9b80000gn/T/23d22037cbe6f8dc8db70020678a981c/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\": \"566ffb82.js\",\n \"revision\": \"186b5ed7eabaef626f004fd1db2a8a69\"\n },\n {\n \"url\": \"index.html\",\n \"revision\": \"508c7b3c698de5e8cc1ba3976005cbad\"\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"} \ No newline at end of file +{"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"} \ No newline at end of file