diff --git a/visions/ui/.gitignore b/visions/ui/.gitignore deleted file mode 100644 index a547bf3..0000000 --- a/visions/ui/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? diff --git a/visions/ui/README.md b/visions/ui/README.md deleted file mode 100644 index 74872fd..0000000 --- a/visions/ui/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/visions/ui/Taskfile.yml b/visions/ui/Taskfile.yml deleted file mode 100644 index dddd16f..0000000 --- a/visions/ui/Taskfile.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3" - -tasks: - fmt: - cmds: - - npm run fmt - - build: - cmds: - - npm install - - npx tsc --watch - - test: - cmds: - # - cd ../visions-types && task build - - npm install - - npm run test diff --git a/visions/ui/eslint.config.js b/visions/ui/eslint.config.js deleted file mode 100644 index af78dac..0000000 --- a/visions/ui/eslint.config.js +++ /dev/null @@ -1,29 +0,0 @@ -import js from "@eslint/js"; -import globals from "globals"; -import reactHooks from "eslint-plugin-react-hooks"; -import reactRefresh from "eslint-plugin-react-refresh"; -import tseslint from "typescript-eslint"; -import eslintConfigPrettier from "eslint-config-prettier"; - -export default tseslint.config( - { ignores: ["dist"] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended, eslintConfigPrettier], - files: ["**/*.{ts,tsx}"], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - "react-hooks": reactHooks, - "react-refresh": reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - "react-refresh/only-export-components": [ - "warn", - { allowConstantExport: true }, - ], - }, - }, -); diff --git a/visions/ui/index.html b/visions/ui/index.html deleted file mode 100644 index 9fdc22d..0000000 --- a/visions/ui/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - My first web component with typescript - - - - - - diff --git a/visions/ui/package-lock.json b/visions/ui/package-lock.json deleted file mode 100644 index 3479d7d..0000000 --- a/visions/ui/package-lock.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "ui", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "ui", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "lit": "^3.2.1", - "visions-client": "file:../client", - "visions-types": "file:../types" - }, - "devDependencies": { - "typescript": "^5.7.3" - } - }, - "../client": { - "name": "visions-client", - "version": "0.0.1", - "license": "ISC", - "dependencies": { - "visions-types": "file:../types" - }, - "devDependencies": { - "@types/jest": "^29.5.14", - "jest": "^29.7.0", - "prettier": "^3.5.1", - "ts-jest": "^29.2.5", - "typescript": "^5.7.3" - } - }, - "../types": { - "name": "visions-types", - "version": "0.0.1", - "license": "ISC", - "dependencies": { - "typescript": "^5.7.3" - } - }, - "node_modules/@lit-labs/ssr-dom-shim": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.3.0.tgz", - "integrity": "sha512-nQIWonJ6eFAvUUrSlwyHDm/aE8PBDu5kRpL0vHMg6K8fK3Diq1xdPjTnsJSwxABhaZ+5eBi1btQB5ShUTKo4nQ==" - }, - "node_modules/@lit/reactive-element": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.4.tgz", - "integrity": "sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ==", - "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.2.0" - } - }, - "node_modules/@types/trusted-types": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", - "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" - }, - "node_modules/lit": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/lit/-/lit-3.2.1.tgz", - "integrity": "sha512-1BBa1E/z0O9ye5fZprPtdqnc0BFzxIxTTOO/tQFmyC/hj1O3jL4TfmLBw0WEwjAokdLwpclkvGgDJwTIh0/22w==", - "dependencies": { - "@lit/reactive-element": "^2.0.4", - "lit-element": "^4.1.0", - "lit-html": "^3.2.0" - } - }, - "node_modules/lit-element": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.1.1.tgz", - "integrity": "sha512-HO9Tkkh34QkTeUmEdNYhMT8hzLid7YlMlATSi1q4q17HE5d9mrrEHJ/o8O2D0cMi182zK1F3v7x0PWFjrhXFew==", - "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.2.0", - "@lit/reactive-element": "^2.0.4", - "lit-html": "^3.2.0" - } - }, - "node_modules/lit-html": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.2.1.tgz", - "integrity": "sha512-qI/3lziaPMSKsrwlxH/xMgikhQ0EGOX2ICU73Bi/YHFvz2j/yMCIrw4+puF2IpQ4+upd3EWbvnHM9+PnJn48YA==", - "dependencies": { - "@types/trusted-types": "^2.0.2" - } - }, - "node_modules/typescript": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", - "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/visions-client": { - "resolved": "../client", - "link": true - }, - "node_modules/visions-types": { - "resolved": "../types", - "link": true - } - } -} diff --git a/visions/ui/package.json b/visions/ui/package.json deleted file mode 100644 index 514374a..0000000 --- a/visions/ui/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ui", - "version": "1.0.0", - "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.", - "main": "eslint.config.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "typescript": "^5.7.3" - }, - "dependencies": { - "lit": "^3.2.1", - "visions-client": "file:../client", - "visions-types": "file:../types" - } -} diff --git a/visions/ui/src/app-component.ts b/visions/ui/src/app-component.ts deleted file mode 100644 index e3a4ed0..0000000 --- a/visions/ui/src/app-component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {html, css, LitElement} from 'lit'; -import {customElement, property} from 'lit/decorators.js'; - -export class SimpleGreeting extends LitElement { - static styles = css`p { color: blue }`; - name: String; - - static properties = { - name: { type: String } - }; - - constructor() { - super(); - this.name = 'Somebody'; - } - - render() { - return html`

Hello, ${this.name}!

`; - } -} - diff --git a/visions/ui/src/state.ts b/visions/ui/src/state.ts deleted file mode 100644 index 93b5a60..0000000 --- a/visions/ui/src/state.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Client } from 'visions-client' - -export type AuthState = - | { type: 'unauthed' } - | { type: 'authed'; sessionId: string } - -export type State = { - auth: AuthState -} - -export const initialState = (): State => ({ - auth: { type: 'unauthed' }, -}) - -export const sessionId = (state: State): string | undefined => { - if (state.auth.type === 'authed') { - return state.auth.sessionId - } else { - return undefined - } -} - -export type Action = { type: 'set-auth'; content: AuthState } - -export const reducer = (state: State, action: Action) => { - switch (action.type) { - case 'set-auth': { - return { ...state, auth: action.content } - } - default: { - return state - } - } -} - -export class Controller { - client: Client - state: State - - constructor( - client: Client, - state: State, - ) { - this.client = client - this.state = state - } - - // On any request, there are four options. - // The request succeeds. No problem. - // The request succeeds, but the user needs to reset their password. - // The action fails. - // The HTTP request itself fails. - async auth(username: string, password: string) { - let response = await this.client.auth(username, password) - switch (response.status) { - case 'ok': { - /* - this.dispatch({ - type: 'set-auth', - content: { - type: 'authed', - sessionId: response.content.content, - }, - }) - */ - return - } - } - } -} diff --git a/visions/ui/tsconfig.json b/visions/ui/tsconfig.json deleted file mode 100644 index caec80a..0000000 --- a/visions/ui/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "es6", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "declaration": true, - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src" - } -}