diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed71bd0..8b8f959 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,14 +12,17 @@ env: IN_CI: "1" jobs: - basic: + build: timeout-minutes: 3 runs-on: ubuntu-24.04 name: Basic checks steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: lts/* + - name: Retrieve npm dependencies + run: npm ci - name: Build run: npm run build - name: Prettier @@ -28,3 +31,27 @@ jobs: run: npm run lint # - name: Api extractor # run: npm run api-extractor-check + + # - name: Setup Pages + # uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "dist" + + deploy: + needs: build + + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/eslint.config.js b/eslint.config.js index 00a5a85..228e491 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -22,6 +22,6 @@ export default tseslint.config( }, prettierConfig, { - ignores: ["lib/*"], + ignores: ["lib/*", "dist/*"], }, ); diff --git a/package-lock.json b/package-lock.json index 426d7bd..8031938 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { - "name": "gs-rd-nextgen-viewer", + "name": "@geoblocks/ngv", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "gs-rd-nextgen-viewer", + "name": "@geoblocks/ngv", "version": "1.0.0", - "license": "UNLICENSED", + "license": "BSD-3", "dependencies": { "@lit/context": "^1.1.2", "@microsoft/api-documenter": "7.25.10", diff --git a/src/apps/buildings/index.html b/src/apps/buildings/index.html index 7d2e4ad..27577d3 100644 --- a/src/apps/buildings/index.html +++ b/src/apps/buildings/index.html @@ -6,8 +6,10 @@ Revolutionary buildings app + - THIS IS A CRAZY BUILDINGS app + + diff --git a/src/apps/buildings/index.ts b/src/apps/buildings/index.ts index e69de29..43e1521 100644 --- a/src/apps/buildings/index.ts +++ b/src/apps/buildings/index.ts @@ -0,0 +1,54 @@ +import { LitElement, html } from "lit"; +import { customElement, state } from "lit/decorators.js"; + +import "../../structure/ngv-structure-app.js"; +import { INgvStructureApp } from "../../structure/ngv-structure-app.js"; + +// @ts-expect-error ?url parameter is a viteJS specificity +import logoUrl from "../../logo.svg?url"; + +@customElement("ngv-app-buildings") +export class NgvAppBuildings extends LitElement { + @state() + ngvStructureAppConfig: INgvStructureApp; + + constructor() { + super(); + // this.shadowRoot.adoptedStyleSheets.push(styles); + } + + protected firstUpdated(): void { + // simulate retrieving config from an external config file + setTimeout(() => { + this.ngvStructureAppConfig = { + header: { + languages: ["fr", "en", "it", "de"], + logo: logoUrl as string, + title: { + fr: "Ma super app", + en: "My super app", + de: "Meine supper app", + it: "Mia super app", + }, + }, + footer: { + contact: "me@example.com", + impressum: { + fr: "Bla bla FR impressim", + en: "Bla bla EN impressim", + de: "Bla bla DE impressim", + it: "Bla bla IT impressim", + }, + }, + }; + }, 200); + } + + render() { + return html` + + THIS IS A CRAZY BUILDINGS app + + `; + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..7b0db06 --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +export const ngv = {}; diff --git a/logo.svg b/src/logo.svg similarity index 100% rename from logo.svg rename to src/logo.svg diff --git a/src/structure/ngv-structure-app.ts b/src/structure/ngv-structure-app.ts new file mode 100644 index 0000000..d8495fa --- /dev/null +++ b/src/structure/ngv-structure-app.ts @@ -0,0 +1,61 @@ +import { LitElement, html } from "lit"; +import { customElement, property } from "lit/decorators.js"; + +// Fixme: this should be one of the supported language. +// Per application? +type Language = "en" | "it" | "fr" | "de"; + +export interface INgvStructureApp { + header: { + logo: string; + languages: Language[]; + title: Record; + }; + footer: { + impressum: Record; + contact: string; + }; +} + +/** + * This element structures the app using slots. + */ +@customElement("ngv-structure-app") +export class NgvStructureApp extends LitElement { + @property({ type: Object }) + config: INgvStructureApp; + + constructor() { + super(); + // this.shadowRoot.adoptedStyleSheets.push(styles); + } + + render() { + const { header, footer } = this.config; + return html` +
+ +
+ + +
+
+
+ +
+ + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "ngv-structure-app": NgvStructureApp; + } +}