Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: various restructuring (changed components to use index.ts rather than component name)

Rich Turner675090eaac36
diff --git a/ui/component/core/README.md b/ui/component/core/README.md
index 59e95a25c..f8c2e955a 100644
--- a/ui/component/core/README.md
+++ b/ui/component/core/README.md
@@ -1,4 +1,4 @@
-# or-core
+# @openremote/core
> ${DESCRIPTION}
diff --git a/ui/component/core/package.json b/ui/component/core/package.json
index eb1ead21d..5a73970b9 100644
--- a/ui/component/core/package.json
+++ b/ui/component/core/package.json
@@ -2,8 +2,8 @@
"name": "@openremote/core",
"version": "1.0.0",
"description": "OpenRemote 3.x Core",
- "main": "dist/core.js",
- "types": "src/core.ts",
+ "main": "dist/index.js",
+ "types": "src/index.ts",
"scripts": {
"build": "npx tsc",
"test": "echo \"No tests\" && exit 0"
diff --git a/ui/component/core/src/core.ts b/ui/component/core/src/index.ts
similarity index 100%
rename from ui/component/core/src/core.ts
rename to ui/component/core/src/index.ts
diff --git a/ui/component/core/tsconfig.json b/ui/component/core/tsconfig.json
index 604040278..9a2a007ff 100644
--- a/ui/component/core/tsconfig.json
+++ b/ui/component/core/tsconfig.json
@@ -1,11 +1,6 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "strict": true,
- "module": "es6",
- "target": "es2015",
- "declaration": true,
- "sourceMap": true,
- "moduleResolution": "node"
+ "outDir": "./dist/"
}
}
\ No newline at end of file
diff --git a/ui/component/model/build.gradle b/ui/component/model/build.gradle
index 78085a98e..9b46e7407 100644
--- a/ui/component/model/build.gradle
+++ b/ui/component/model/build.gradle
@@ -42,7 +42,7 @@ generateTypeScript {
]
optionalProperties = "all" // TODO: cleanup model to be more explicit about optional params
mapEnum = cz.habarta.typescript.generator.EnumMapping.asEnum
- outputFile = "build/model.d.ts"
+ outputFile = "dist/index.d.ts"
outputKind = "module"
}
diff --git a/ui/component/model/package.json b/ui/component/model/package.json
index 0d0b01662..5d19c20fa 100644
--- a/ui/component/model/package.json
+++ b/ui/component/model/package.json
@@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "",
"description": "OpenRemote 3.x Model Types",
- "types": "build/model.d.ts",
+ "types": "dist/index.d.ts",
"scripts": {
"build": "exit 0",
"test": "echo \"No tests\" && exit 0"
@@ -13,5 +13,8 @@
"dependencies": {},
"devDependencies": {
"typescript": "^3.1.6"
- }
+ },
+ "files": [
+ "dist"
+ ]
}
diff --git a/ui/component/model/tsconfig.json b/ui/component/model/tsconfig.json
deleted file mode 100644
index 604040278..000000000
--- a/ui/component/model/tsconfig.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "compilerOptions": {
- "outDir": "./dist/",
- "strict": true,
- "module": "es6",
- "target": "es2015",
- "declaration": true,
- "sourceMap": true,
- "moduleResolution": "node"
- }
-}
\ No newline at end of file
diff --git a/ui/component/or-map/@types/mapbox.js.d.ts b/ui/component/or-map/@types/mapbox.js.d.ts
deleted file mode 100644
index 95bdbc260..000000000
--- a/ui/component/or-map/@types/mapbox.js.d.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import {LngLatBoundsLike, LngLatLike} from "mapbox-gl";
-
-export = L
-export as namespace L;
-
-declare namespace L {
- export namespace mapbox {
- export class Map {
- constructor(element: string | Element, tilejson: object, options?: MapOptions);
- }
-
- export interface MapOptions {
- boxZoom?: boolean;
- center?: LngLatLike;
- maxBounds?: LngLatBoundsLike;
- maxZoom?: number;
- minZoom?: number;
- }
- }
-}
\ No newline at end of file
diff --git a/ui/component/or-map/package.json b/ui/component/or-map/package.json
index db524eb35..82a3603aa 100644
--- a/ui/component/or-map/package.json
+++ b/ui/component/or-map/package.json
@@ -2,8 +2,8 @@
"name": "@openremote/or-map",
"version": "1.0.0",
"description": "Displays s vector or raster mapx",
- "main": "build/or-map.js",
- "types": "src/or-map.ts",
+ "main": "dist/index.js",
+ "types": "src/index.ts",
"scripts": {
"build": "npx tsc",
"test": "echo \"No tests\" && exit 0"
diff --git a/ui/component/or-map/src/@types/mapbox.js/index.d.ts b/ui/component/or-map/src/@types/mapbox.js/index.d.ts
new file mode 100644
index 000000000..25664035c
--- /dev/null
+++ b/ui/component/or-map/src/@types/mapbox.js/index.d.ts
@@ -0,0 +1,20 @@
+declare module 'mapbox.js' {
+ import {LngLatBoundsLike, LngLatLike} from "mapbox-gl";
+
+ export namespace L {
+ export namespace mapbox {
+ export class map {
+ constructor(element: string | Element, tilejson: object, options?: MapOptions);
+ }
+
+ export interface MapOptions {
+ zoom: number,
+ boxZoom?: boolean;
+ center?: LngLatLike;
+ maxBounds?: LngLatBoundsLike;
+ maxZoom?: number;
+ minZoom?: number;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ui/component/or-map/src/or-map.ts b/ui/component/or-map/src/index.ts
similarity index 93%
rename from ui/component/or-map/src/or-map.ts
rename to ui/component/or-map/src/index.ts
index f854e8052..9f48a6190 100644
--- a/ui/component/or-map/src/or-map.ts
+++ b/ui/component/or-map/src/index.ts
@@ -5,7 +5,7 @@ import {customElement, property} from '@polymer/decorators';
import rest from "@openremote/rest";
import {OrMapMarker} from "@openremote/or-map-marker";
import {Map, MapboxOptions, Style as MapboxStyle} from "mapbox-gl";
-import L from "mapbox.js";
+import {L} from "mapbox.js";
export enum Type {
VECTOR = "VECTOR",
@@ -23,8 +23,8 @@ export class OrMap extends PolymerElement {
protected _map?: Map;
protected static _mapboxGlStyle?: any;
protected static _mapboxJsStyle?: any;
+ protected _loaded: boolean = false;
protected _observer?: FlattenedNodesObserver;
- protected _loaded: boolean;
static get template() {
return html`
@@ -97,7 +97,7 @@ export class OrMap extends PolymerElement {
}
if (this.shadowRoot) {
- const mapElement: HTMLElement | null = this.shadowRoot.getElementById('map');
+ const mapElement: HTMLElement = this.shadowRoot.getElementById('map')!;
if (this.type === Type.RASTER) {
if (!OrMap._mapboxJsStyle) {
@@ -111,11 +111,10 @@ export class OrMap extends PolymerElement {
style.textContent = OrMap._mapboxJsStyle.default.toString();
this.shadowRoot.appendChild(style);
- const map: typeof import("mapbox.js") = await import("mapbox.js");
const settingsResponse = await rest.api.MapResource.getSettingsJs();
const settings = <any> settingsResponse.data;
- const options: L.mapbox.MapOptionsJs = {
- zoom: settings.zoom+1, // JS zoom is out by one compared to GL
+ const options: L.mapbox.MapOptions = {
+ zoom: <number>settings.zoom+1, // JS zoom is out by one compared to GL
minZoom: settings.minZoom || 0,
maxZoom: settings.maxZoom || 22,
boxZoom: settings.boxZoom || false,
diff --git a/ui/component/or-map/tsconfig.json b/ui/component/or-map/tsconfig.json
index 97cea101f..9a2a007ff 100644
--- a/ui/component/or-map/tsconfig.json
+++ b/ui/component/or-map/tsconfig.json
@@ -1,19 +1,6 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "target": "es5",
- "module": "esNext",
- "moduleResolution": "node",
- "lib": [
- "dom",
- "es2015",
- "es2017",
- "es5",
- "es2015.promise",
- "es2016.array.include"
- ],
- "strict": false,
- "experimentalDecorators": true,
- "allowSyntheticDefaultImports": true
+ "outDir": "./dist/"
}
}
\ No newline at end of file
diff --git a/ui/component/or-map/tslint.json b/ui/component/or-map/tslint.json
deleted file mode 100644
index 846fa2dfc..000000000
--- a/ui/component/or-map/tslint.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "defaultSeverity": "error",
- "extends": "tslint:recommended",
- "rules": {
- "interface-name" : [true, "never-prefix"],
- "variable-name": [false],
- "trailing-comma": [false],
- "no-trailing-whitespace": [false],
- "no-console": [false]
- }
-}
\ No newline at end of file
diff --git a/ui/component/rest/package.json b/ui/component/rest/package.json
index 748239695..f14986ef3 100644
--- a/ui/component/rest/package.json
+++ b/ui/component/rest/package.json
@@ -2,8 +2,8 @@
"name": "@openremote/rest",
"version": "1.0.0",
"description": "OpenRemote 3.x REST API",
- "main": "dist/src/rest.js",
- "types": "src/rest.ts",
+ "main": "dist/src/index.js",
+ "types": "src/index.ts",
"scripts": {
"build": "npx tsc",
"test": "echo \"No tests\" && exit 0"
@@ -16,7 +16,11 @@
"axios": "^0.18.0"
},
"devDependencies": {
- "typescript": "^3.1.6",
- "tslint": "^5.11.0"
- }
+ "@types/es6-promise": "^3.3.0",
+ "tslint": "^5.11.0",
+ "typescript": "^3.1.6"
+ },
+ "files": [
+ "dist"
+ ]
}
diff --git a/ui/component/rest/src/rest.ts b/ui/component/rest/src/index.ts
similarity index 100%
rename from ui/component/rest/src/rest.ts
rename to ui/component/rest/src/index.ts
diff --git a/ui/component/rest/tsconfig.json b/ui/component/rest/tsconfig.json
index 604040278..21a52eafc 100644
--- a/ui/component/rest/tsconfig.json
+++ b/ui/component/rest/tsconfig.json
@@ -1,11 +1,9 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "strict": true,
- "module": "es6",
- "target": "es2015",
- "declaration": true,
- "sourceMap": true,
- "moduleResolution": "node"
- }
+ "outDir": "./dist/"
+ },
+ "files": [
+ "src/index.ts"
+ ]
}
\ No newline at end of file
diff --git a/ui/component/rest/tslint.json b/ui/component/rest/tslint.json
deleted file mode 100644
index 846fa2dfc..000000000
--- a/ui/component/rest/tslint.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "defaultSeverity": "error",
- "extends": "tslint:recommended",
- "rules": {
- "interface-name" : [true, "never-prefix"],
- "variable-name": [false],
- "trailing-comma": [false],
- "no-trailing-whitespace": [false],
- "no-console": [false]
- }
-}
\ No newline at end of file
diff --git a/ui/demo/demo-core/src/index.ts b/ui/demo/demo-core/src/index.ts
index 97a84b449..4c80f194f 100644
--- a/ui/demo/demo-core/src/index.ts
+++ b/ui/demo/demo-core/src/index.ts
@@ -2,8 +2,6 @@ import {html, render} from "lit-html";
import {when} from "lit-html/directives/when";
import openremote, {Auth, Manager} from "@openremote/core";
-
-
let loggedInTemplate = (openremote:Manager) => html `<span>Welcome ${openremote.username}</span> (<a href="${openremote.getLogoutUrl()}">logout</a>)`;
let loggedOutTemplate = (openremote:Manager) => html `<span>Please <a href="${openremote.getLoginUrl()}">login</a>`;
diff --git a/ui/demo/demo-core/tsconfig.json b/ui/demo/demo-core/tsconfig.json
index 08df12e77..9a2a007ff 100644
--- a/ui/demo/demo-core/tsconfig.json
+++ b/ui/demo/demo-core/tsconfig.json
@@ -1,10 +1,6 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "strict": true,
- "module": "es6",
- "target": "es2015",
- "sourceMap": true,
- "moduleResolution": "node"
+ "outDir": "./dist/"
}
}
\ No newline at end of file
diff --git a/ui/demo/demo-or-map/tsconfig.json b/ui/demo/demo-or-map/tsconfig.json
index 97cea101f..9a2a007ff 100644
--- a/ui/demo/demo-or-map/tsconfig.json
+++ b/ui/demo/demo-or-map/tsconfig.json
@@ -1,19 +1,6 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "target": "es5",
- "module": "esNext",
- "moduleResolution": "node",
- "lib": [
- "dom",
- "es2015",
- "es2017",
- "es5",
- "es2015.promise",
- "es2016.array.include"
- ],
- "strict": false,
- "experimentalDecorators": true,
- "allowSyntheticDefaultImports": true
+ "outDir": "./dist/"
}
}
\ No newline at end of file
diff --git a/ui/demo/demo-rest/tsconfig.json b/ui/demo/demo-rest/tsconfig.json
index 08df12e77..9a2a007ff 100644
--- a/ui/demo/demo-rest/tsconfig.json
+++ b/ui/demo/demo-rest/tsconfig.json
@@ -1,10 +1,6 @@
{
+ "extends": "../../tsconfig",
"compilerOptions": {
- "outDir": "./dist/",
- "strict": true,
- "module": "es6",
- "target": "es2015",
- "sourceMap": true,
- "moduleResolution": "node"
+ "outDir": "./dist/"
}
}
\ No newline at end of file
diff --git a/ui/tsconfig.json b/ui/tsconfig.json
new file mode 100644
index 000000000..48c418032
--- /dev/null
+++ b/ui/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compileOnSave": true,
+ "compilerOptions": {
+ "target": "es5",
+ "module": "esNext",
+ "moduleResolution": "node",
+ "lib": [
+ "dom",
+ "es2015",
+ "es2017",
+ "es5",
+ "es2015.promise",
+ "es2016.array.include"
+ ],
+ "noEmitOnError": true,
+ "strict": true,
+ "declaration": true,
+ "sourceMap": true,
+ "experimentalDecorators": true,
+ "allowSyntheticDefaultImports": true
+ }
+}
\ No newline at end of file
diff --git a/ui/component/core/tslint.json b/ui/tslint.json
similarity index 100%
rename from ui/component/core/tslint.json
rename to ui/tslint.json