Compare commits

..

No commits in common. "8f32aef17d6ec81b38cfa95da5875ea3e1151240" and "1a865da6561e8fac9c5cde0383f4a2203eea14f0" have entirely different histories.

27 changed files with 2364 additions and 2592 deletions

View file

@ -2,19 +2,15 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/javascript-node // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/javascript-node
{ {
"name": "Advent22 UI", "name": "Advent22 UI",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:4-20-trixie", "image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:1-18-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
"features": { "features": {
"ghcr.io/devcontainers/features/git-lfs:1": {},
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": { "ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"packages": "git-flow" "packages": "git-flow, git-lfs"
}, },
"ghcr.io/devcontainers-extra/features/vue-cli:2": {} "ghcr.io/devcontainers-extra/features/vue-cli:2": {}
}, },
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {
// Configure properties specific to VS Code. // Configure properties specific to VS Code.
@ -33,16 +29,11 @@
] ]
} }
}, },
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Use 'postStartCommand' to run commands after the container is started.
"postStartCommand": "npx --yes update-browserslist-db@latest && yarn install --production false"
// Use 'forwardPorts' to make a list of ports inside the container available locally. // Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [], // "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "postCreateCommand": "yarn install",
// "remoteUser": "root" "postStartCommand": "yarn install --production false",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
} }

View file

@ -30,9 +30,6 @@ module.exports = {
env: { env: {
mocha: true, mocha: true,
}, },
rules: {
"@typescript-eslint/no-unused-expressions": "off",
}
}, },
], ],
}; };

View file

@ -1,23 +1,21 @@
{ {
"[scss][vue][typescript][javascript][json][jsonc][jsonl]": { "editor.formatOnSave": true,
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"[typescript]": {
"[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.formatOnSave": false, },
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.organizeImports": "explicit" "source.organizeImports": "explicit"
}, },
"git.closeDiffOnOperation": true, "git.closeDiffOnOperation": true,
"editor.formatOnSave": true,
"editor.tabSize": 2, "editor.tabSize": 2,
"sass.disableAutoIndent": true, "sass.disableAutoIndent": true,
"sass.format.convert": false, "sass.format.convert": false,
"sass.format.deleteWhitespace": true, "sass.format.deleteWhitespace": true,
"volar.inlayHints.eventArgumentInInlineHandlers": false
"prettier.trailingComma": "all",
} }

View file

@ -1,5 +1,3 @@
{ {
"presets": [ "presets": ["@vue/cli-plugin-babel/preset"]
"@vue/cli-plugin-babel/preset"
]
} }

View file

@ -3,44 +3,46 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve --host 0.0.0.0 --port 8080",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit", "test:unit": "vue-cli-service test:unit",
"test:unit-watch": "vue-cli-service test:unit --watch", "test:unit-watch": "vue-cli-service test:unit --watch",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint"
"ui": "vue ui --host 0.0.0.0 --headless"
}, },
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-svg-core": "^7.2.0", "@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^7.2.0", "@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/vue-fontawesome": "^3.1.3", "@fortawesome/vue-fontawesome": "^3.0.8",
"@types/chai": "^5.2.3", "@types/chai": "^4.3.17",
"@types/luxon": "^3.7.1", "@types/luxon": "^3.4.2",
"@types/mocha": "^10.0.10", "@types/mocha": "^10.0.7",
"@typescript-eslint/eslint-plugin": "^8.55.0", "@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^8.55.0", "@typescript-eslint/parser": "^7.3.1",
"@vue/cli-plugin-babel": "^5.0.9", "@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "^5.0.9", "@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-typescript": "^5.0.9", "@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-plugin-unit-mocha": "^5.0.9", "@vue/cli-plugin-unit-mocha": "~5.0.0",
"@vue/cli-service": "^5.0.9", "@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^13.0.0", "@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.8.1",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.13.5", "axios": "^1.7.3",
"bulma": "^1.0.4", "bulma": "^1.0.2",
"bulma-toast": "2.4.3", "bulma-toast": "2.4.3",
"chai": "^6.2.2", "chai": "^5.1.1",
"core-js": "^3.48.0", "core-js": "^3.38.0",
"eslint": "^8.57.1", "eslint": "^8.57.0",
"eslint-plugin-vue": "^9.33.0", "eslint-plugin-vue": "^9.27.0",
"luxon": "^3.7.2", "luxon": "^3.5.0",
"pinia": "^3.0.4", "pinia": "^2.2.1",
"sass": "~1.94.3", "sass": "^1.77.8",
"sass-loader": "^16.0.0", "sass-loader": "^16.0.0",
"typescript": "^5.9.3", "typescript": "~5.5.4",
"vue": "^3.5.25", "vue": "^3.5.25",
"vue-cli-plugin-webpack-bundle-analyzer": "^4.0.0" "vue-class-component": "^8.0.0-0"
},
"dependencies": {},
"prettier": {
"trailingComma": "all"
} }
} }

View file

@ -12,7 +12,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { APIError } from "@/lib/api_error"; import { APIError } from "@/lib/api_error";
import type { Credentials } from "@/lib/model"; import { Credentials } from "@/lib/model";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import { ref } from "vue"; import { ref } from "vue";

View file

@ -49,15 +49,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { API } from "@/lib/api"; import { API } from "@/lib/api";
import { APIError } from "@/lib/api_error"; import { APIError } from "@/lib/api_error";
import { type VueLike, name_door, unwrap_loading } from "@/lib/helpers"; import { VueLike, name_door, unwrap_loading } from "@/lib/helpers";
import type { ImageData } from "@/lib/model"; import { ImageData } from "@/lib/model";
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import { onBeforeUnmount } from "vue"; import { onBeforeUnmount } from "vue";
import MultiModal, { type HMultiModal } from "./MultiModal.vue"; import MultiModal, { HMultiModal } from "./MultiModal.vue";
import BulmaButton from "./bulma/Button.vue"; import BulmaButton from "./bulma/Button.vue";
import BulmaToast, { type HBulmaToast } from "./bulma/Toast.vue"; import BulmaToast, { HBulmaToast } from "./bulma/Toast.vue";
import CalendarDoor from "./calendar/CalendarDoor.vue"; import CalendarDoor from "./calendar/CalendarDoor.vue";
import ThouCanvas from "./calendar/ThouCanvas.vue"; import ThouCanvas from "./calendar/ThouCanvas.vue";

View file

@ -16,7 +16,7 @@
ref="username_input" ref="username_input"
class="input" class="input"
type="text" type="text"
v-model="creds.username" v-model="creds[0]"
/> />
</div> </div>
</div> </div>
@ -24,7 +24,7 @@
<div class="field"> <div class="field">
<label class="label">Passwort</label> <label class="label">Passwort</label>
<div class="control"> <div class="control">
<input class="input" type="password" v-model="creds.password" /> <input class="input" type="password" v-model="creds[1]" />
</div> </div>
</div> </div>
</section> </section>
@ -49,7 +49,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { wait_for } from "@/lib/helpers"; import { wait_for } from "@/lib/helpers";
import type { Credentials } from "@/lib/model"; import { Credentials } from "@/lib/model";
import { onBeforeUnmount, onMounted, ref, useTemplateRef } from "vue"; import { onBeforeUnmount, onMounted, ref, useTemplateRef } from "vue";
import BulmaButton from "./bulma/Button.vue"; import BulmaButton from "./bulma/Button.vue";
@ -60,10 +60,7 @@ const emit = defineEmits<{
(event: "cancel"): void; (event: "cancel"): void;
}>(); }>();
const creds = ref<Credentials>({ const creds = ref<Credentials>(["", ""]);
username: "",
password: "",
});
function submit(): void { function submit(): void {
emit("submit", creds.value); emit("submit", creds.value);

View file

@ -48,10 +48,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { API } from "@/lib/api"; import { API } from "@/lib/api";
import { name_door, objForEach } from "@/lib/helpers"; import { name_door, objForEach } from "@/lib/helpers";
import type { ImageData, NumStrDict } from "@/lib/model"; import { ImageData, NumStrDict } from "@/lib/model";
import { ref } from "vue"; import { ref } from "vue";
import MultiModal, { type HMultiModal } from "../MultiModal.vue"; import MultiModal, { HMultiModal } from "../MultiModal.vue";
import BulmaButton from "../bulma/Button.vue"; import BulmaButton from "../bulma/Button.vue";
import BulmaDrawer from "../bulma/Drawer.vue"; import BulmaDrawer from "../bulma/Drawer.vue";

View file

@ -191,7 +191,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { API } from "@/lib/api"; import { API } from "@/lib/api";
import type { AdminConfigModel, Credentials, DoorSaved } from "@/lib/model"; import { AdminConfigModel, Credentials, DoorSaved } from "@/lib/model";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { ref } from "vue"; import { ref } from "vue";

View file

@ -71,11 +71,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { API } from "@/lib/api"; import { API } from "@/lib/api";
import { APIError } from "@/lib/api_error"; import { APIError } from "@/lib/api_error";
import type { DoorSaved } from "@/lib/model"; import { DoorSaved } from "@/lib/model";
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { toast } from "bulma-toast"; import { toast } from "bulma-toast";
import { ref } from "vue"; import { ref } from "vue";
import type { BCStep } from "../bulma/Breadcrumbs.vue"; import { BCStep } from "../bulma/Breadcrumbs.vue";
import Calendar from "../Calendar.vue"; import Calendar from "../Calendar.vue";
import BulmaBreadcrumbs from "../bulma/Breadcrumbs.vue"; import BulmaBreadcrumbs from "../bulma/Breadcrumbs.vue";

View file

@ -58,19 +58,10 @@ const state = ref<"closed" | "loading" | "ok" | "err">("closed");
const is_open = computed(() => state.value !== "closed"); const is_open = computed(() => state.value !== "closed");
async function toggle(): Promise<void> { async function toggle(): Promise<void> {
switch (state.value) { if (is_open.value) {
case "closed":
// start opening when closed
await load();
break;
case "loading":
// don't toggle when loading
break;
default:
state.value = "closed"; state.value = "closed";
break; } else {
await load();
} }
} }

View file

@ -8,7 +8,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type Options as ToastOptions, toast } from "bulma-toast"; import { Options as ToastOptions, toast } from "bulma-toast";
import { onMounted, useTemplateRef } from "vue"; import { onMounted, useTemplateRef } from "vue";
export type HBulmaToast = { export type HBulmaToast = {

View file

@ -17,7 +17,7 @@
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import type { VueLike } from "@/lib/helpers"; import { VueLike } from "@/lib/helpers";
import SVGRect from "./SVGRect.vue"; import SVGRect from "./SVGRect.vue";
const store = advent22Store(); const store = advent22Store();

View file

@ -20,7 +20,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type VueLike, unwrap_loading } from "@/lib/helpers"; import { VueLike, unwrap_loading } from "@/lib/helpers";
import { Rectangle } from "@/lib/rects/rectangle"; import { Rectangle } from "@/lib/rects/rectangle";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";
import { computed } from "vue"; import { computed } from "vue";

View file

@ -29,7 +29,7 @@ import { Rectangle } from "@/lib/rects/rectangle";
import { Vector2D } from "@/lib/rects/vector2d"; import { Vector2D } from "@/lib/rects/vector2d";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import type { VueLike } from "@/lib/helpers"; import { VueLike } from "@/lib/helpers";
import CalendarDoor from "../calendar/CalendarDoor.vue"; import CalendarDoor from "../calendar/CalendarDoor.vue";
import SVGRect from "../calendar/SVGRect.vue"; import SVGRect from "../calendar/SVGRect.vue";
import ThouCanvas from "../calendar/ThouCanvas.vue"; import ThouCanvas from "../calendar/ThouCanvas.vue";

View file

@ -24,7 +24,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type VueLike, unwrap_loading } from "@/lib/helpers"; import { VueLike, unwrap_loading } from "@/lib/helpers";
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";

View file

@ -16,7 +16,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type VueLike, unwrap_loading } from "@/lib/helpers"; import { VueLike, unwrap_loading } from "@/lib/helpers";
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { advent22Store } from "@/lib/store"; import { advent22Store } from "@/lib/store";

View file

@ -26,7 +26,7 @@
import { Door } from "@/lib/rects/door"; import { Door } from "@/lib/rects/door";
import { ref, useTemplateRef } from "vue"; import { ref, useTemplateRef } from "vue";
import { type VueLike, unwrap_vuelike, wait_for } from "@/lib/helpers"; import { VueLike, unwrap_vuelike, wait_for } from "@/lib/helpers";
import SVGRect from "../calendar/SVGRect.vue"; import SVGRect from "../calendar/SVGRect.vue";
const model = defineModel<VueLike<Door>>({ required: true }); const model = defineModel<VueLike<Door>>({ required: true });

View file

@ -1,10 +1,9 @@
import type { import axios, {
AxiosBasicCredentials, AxiosBasicCredentials,
AxiosRequestConfig, type AxiosRequestConfig,
Method, type Method,
RawAxiosRequestHeaders, type RawAxiosRequestHeaders,
} from "axios"; } from "axios";
import axios from "axios";
import { APIError } from "./api_error"; import { APIError } from "./api_error";
interface Params { interface Params {
@ -22,8 +21,7 @@ export class API {
return `${window.location.protocol}//${window.location.host}/api`; return `${window.location.protocol}//${window.location.host}/api`;
} else if (process.env.NODE_ENV !== "development") { } else if (process.env.NODE_ENV !== "development") {
// not in prouction or development mode // not in prouction or development mode
// eslint-disable-next-line no-console console.warn("Unexpected NODE_ENV value");
console.warn("Unexpected NODE_ENV value: ", process.env.NODE_ENV);
} }
// in development mode, return "proto://hostname:8000/api" // in development mode, return "proto://hostname:8000/api"
@ -84,7 +82,6 @@ export class API {
const response = await this.axios.request<T>(this.get_axios_config(p)); const response = await this.axios.request<T>(this.get_axios_config(p));
return response.data; return response.data;
} catch (reason) { } catch (reason) {
// eslint-disable-next-line no-console
console.error(`Failed to query ${p.endpoint}: ${reason}`); console.error(`Failed to query ${p.endpoint}: ${reason}`);
throw new APIError(reason, p.endpoint); throw new APIError(reason, p.endpoint);
} }

View file

@ -1,4 +1,4 @@
import { nextTick, type UnwrapRef } from "vue"; import { nextTick, UnwrapRef } from "vue";
import { APIError } from "./api_error"; import { APIError } from "./api_error";
export function objForEach<T>( export function objForEach<T>(
@ -42,7 +42,6 @@ export function handle_error(error: unknown): void {
if (error instanceof APIError) { if (error instanceof APIError) {
error.alert(); error.alert();
} else { } else {
// eslint-disable-next-line no-console
console.error(error); console.error(error);
} }
} }

View file

@ -1,5 +1,5 @@
import { type VueLike, unwrap_vuelike } from "../helpers"; import { VueLike, unwrap_vuelike } from "../helpers";
import type { DoorSaved } from "../model"; import { DoorSaved } from "../model";
import { Rectangle } from "./rectangle"; import { Rectangle } from "./rectangle";
import { Vector2D } from "./vector2d"; import { Vector2D } from "./vector2d";

View file

@ -1,7 +1,7 @@
import { acceptHMRUpdate, defineStore } from "pinia"; import { acceptHMRUpdate, defineStore } from "pinia";
import { API } from "./api"; import { API } from "./api";
import type { Loading } from "./helpers"; import { Loading } from "./helpers";
import type { Credentials, DoorSaved, ImageData, SiteConfigModel } from "./model"; import { Credentials, DoorSaved, ImageData, SiteConfigModel } from "./model";
import { Door } from "./rects/door"; import { Door } from "./rects/door";
declare global { declare global {
@ -20,7 +20,9 @@ type State = {
next_door_target: number | null; next_door_target: number | null;
}; };
export const advent22Store = defineStore("advent22", { export const advent22Store = defineStore({
id: "advent22",
state: (): State => ({ state: (): State => ({
on_initialized: [], on_initialized: [],
is_touch_device: is_touch_device:
@ -62,7 +64,7 @@ export const advent22Store = defineStore("advent22", {
link.href = favicon.data_url; link.href = favicon.data_url;
if (link.parentElement === null) if (link.parentElement === null)
document.getElementsByTagName("head")[0]!.appendChild(link); document.getElementsByTagName("head")[0].appendChild(link);
} catch {} } catch {}
try { try {

View file

@ -20,4 +20,4 @@
// main imports // main imports
//============== //==============
@forward "animate.css/animate"; @import "animate.css/animate";

View file

@ -1,33 +1,30 @@
{ {
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": { "compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"moduleResolution": "node",
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": [ "skipLibCheck": true,
"es2020", "esModuleInterop": true,
"dom", "allowSyntheticDefaultImports": true,
"dom.iterable", "forceConsistentCasingInFileNames": true,
"es2022.object", "useDefineForClassFields": true,
"es2023.array", "sourceMap": true,
],
// "moduleResolution": "node",
// "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"types": [ "types": ["webpack-env", "mocha", "chai"],
"webpack-env",
"mocha",
"chai",
],
"paths": { "paths": {
"@/*": [ "@/*": ["src/*"]
"src/*",
]
}, },
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
}, },
"include": [ "include": [
"src/**/*.vue",
"src/**/*.ts", "src/**/*.ts",
// "src/**/*.tsx", "src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts", "tests/**/*.ts",
// "tests/**/*.tsx", "tests/**/*.tsx"
], ],
"exclude": ["node_modules"]
} }

View file

@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const { defineConfig } = require("@vue/cli-service"); const { defineConfig } = require("@vue/cli-service");
const webpack = require("webpack"); const webpack = require("webpack");
module.exports = defineConfig({ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
devServer: { devServer: {
host: "0.0.0.0", host: "localhost",
}, },
pages: { pages: {
index: { index: {

File diff suppressed because it is too large Load diff