chore: using ts aliases

This commit is contained in:
2025-07-18 14:59:24 +01:00
parent 459c8e1c4e
commit c6ad67345e
18 changed files with 185 additions and 126 deletions

View File

@ -4,39 +4,40 @@
"": {
"name": "haystack",
"dependencies": {
"@kobalte/core": "^0.13.9",
"@kobalte/core": "^0.13.10",
"@kobalte/tailwindcss": "^0.9.0",
"@solidjs/router": "^0.15.3",
"@tabler/icons-solidjs": "^3.30.0",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-dialog": "~2",
"@tauri-apps/plugin-fs": "~2",
"@tabler/icons-solidjs": "^3.34.0",
"@tauri-apps/api": "^2.6.0",
"@tauri-apps/plugin-dialog": "~2.3.0",
"@tauri-apps/plugin-fs": "~2.4.0",
"@tauri-apps/plugin-http": "2.4.3",
"@tauri-apps/plugin-log": "~2",
"@tauri-apps/plugin-opener": "^2",
"@tauri-apps/plugin-log": "~2.6.0",
"@tauri-apps/plugin-opener": "^2.4.0",
"@tauri-apps/plugin-os": "2.2.1",
"clsx": "^2.1.1",
"fuse.js": "^7.1.0",
"jwt-decode": "^4.0.0",
"solid-js": "^1.9.3",
"solid-js": "^1.9.7",
"solid-markdown": "^2.0.14",
"solid-motionone": "^1.0.3",
"solid-motionone": "^1.0.4",
"solidjs-markdown": "^0.2.0",
"tailwind-scrollbar-hide": "^2.0.0",
"tauri-plugin-ios-shared-token-api": "file:../tauri-plugin-ios-shared-token",
"tauri-plugin-sharetarget-api": "^0.1.6",
"valibot": "^1.0.0-rc.2",
"valibot": "^1.1.0",
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@tauri-apps/cli": "^2.5.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.5.3",
"postcss-cli": "^11.0.0",
"@tauri-apps/cli": "^2.6.2",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.6",
"postcss-cli": "^11.0.1",
"tailwindcss": "3.4.0",
"typescript": "~5.6.2",
"vite": "^6.0.3",
"vite-plugin-solid": "^2.11.0",
"typescript": "~5.6.3",
"vite": "^6.3.5",
"vite-plugin-solid": "^2.11.7",
"vite-tsconfig-paths": "^5.1.4",
},
},
},
@ -451,6 +452,8 @@
"globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="],
"globrex": ["globrex@0.1.2", "", {}, "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="],
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
@ -719,6 +722,8 @@
"ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="],
"tsconfck": ["tsconfck@3.1.6", "", { "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"], "bin": { "tsconfck": "bin/tsconfck.js" } }, "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w=="],
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"typescript": ["typescript@5.6.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw=="],
@ -757,6 +762,8 @@
"vite-plugin-solid": ["vite-plugin-solid@2.11.7", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-5TgK1RnE449g0Ryxb9BXqem89RSy7fE8XGVCo+Gw84IHgPuPVP7nYNP6WBVAaY/0xw+OqfdQee+kusL0y3XYNg=="],
"vite-tsconfig-paths": ["vite-tsconfig-paths@5.1.4", "", { "dependencies": { "debug": "^4.1.1", "globrex": "^0.1.2", "tsconfck": "^3.0.3" }, "peerDependencies": { "vite": "*" }, "optionalPeers": ["vite"] }, "sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w=="],
"vitefu": ["vitefu@1.0.6", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["vite"] }, "sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA=="],
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],

View File

@ -46,6 +46,7 @@
"tailwindcss": "3.4.0",
"typescript": "~5.6.3",
"vite": "^6.3.5",
"vite-plugin-solid": "^2.11.7"
"vite-plugin-solid": "^2.11.7",
"vite-tsconfig-paths": "^5.1.4"
}
}

View File

@ -3,10 +3,6 @@ import { type Component, type ParentProps } from "solid-js";
import { Login } from "./Login";
import { ProtectedRoute } from "./ProtectedRoute";
import { Settings } from "./Settings";
import { SearchImageContextProvider } from "./contexts/SearchImageContext";
import { Image } from "./Image";
import { WithEntityDialog } from "./WithEntityDialog";
import { Gallery } from "./gallery";
import {
IconArrowLeft,
IconHome,
@ -14,8 +10,9 @@ import {
IconSearch,
} from "@tabler/icons-solidjs";
import { Entity } from "./Entity";
import { FrontPage } from "./front";
import { onAndroidMount } from "./mobile";
import { FrontPage, Gallery, ImagePage } from "./pages";
import { SearchImageContextProvider } from "@contexts/SearchImageContext";
const AppWrapper: Component<ParentProps> = (props) => {
return (
@ -59,16 +56,14 @@ export const App = () => {
<Route path="/" component={ProtectedRoute}>
<Route path="/" component={WithDock}>
<Route path="/" component={WithEntityDialog}>
<Route path="/" component={FrontPage} />
<Route path="/image/:imageId" component={Image} />
<Route path="/image/:imageId" component={ImagePage} />
<Route path="/entity/:entityId" component={Entity} />
<Route path="/gallery/:entity" component={Gallery} />
</Route>
<Route path="/settings" component={Settings} />
</Route>
</Route>
</Route>
<Route path="*" component={() => <Navigate href="/" />} />
</Router>
</SearchImageContextProvider>

View File

@ -1,8 +1,8 @@
import { ImageComponent } from "@components/image";
import { ConcreteItemModal } from "@components/item-modal/ItemModal";
import { useSearchImageContext } from "@contexts/SearchImageContext";
import { useParams } from "@solidjs/router";
import { Component, For, Show } from "solid-js";
import { ConcreteItemModal } from "./components/item-modal/ItemModal";
import { useSearchImageContext } from "./contexts/SearchImageContext";
import { ImageComponent } from "./components/image";
export const Entity: Component = () => {
const params = useParams<{ entityId: string }>();

View File

@ -1,34 +0,0 @@
import {
type Component,
type ParentProps,
Show,
createContext,
createSignal,
useContext,
} from "solid-js";
import { ItemModal } from "./components/item-modal/ItemModal";
import type { UserImage } from "./network";
const EntityDialogContext = createContext<
(image: UserImage | undefined) => void
>(() => {});
export const useSetEntity = () => useContext(EntityDialogContext);
export const WithEntityDialog: Component<ParentProps> = (props) => {
const [selectedEntity, setSelectedEntity] = createSignal<UserImage>();
return (
<EntityDialogContext.Provider value={setSelectedEntity}>
<Show when={selectedEntity()}>
{(entity) => (
<ItemModal
item={entity()}
onClose={() => setSelectedEntity(undefined)}
/>
)}
</Show>
{props.children}
</EntityDialogContext.Provider>
);
};

View File

@ -1,6 +1,6 @@
import { Component, For } from "solid-js";
import { useSearchImageContext } from "../contexts/SearchImageContext";
import { ImageComponent } from "../components/image";
import { ImageComponent } from "@components/image";
import { useSearchImageContext } from "@contexts/SearchImageContext";
export const Recent: Component = () => {
const { userImages } = useSearchImageContext();

View File

@ -1,9 +1,9 @@
import { Component, For } from "solid-js";
import { A } from "@solidjs/router";
import {
SearchImageStore,
useSearchImageContext,
} from "../contexts/SearchImageContext";
import { A } from "@solidjs/router";
} from "@contexts/SearchImageContext";
// TODO: lots of stuff to do with Entities, this could be seperated into a centralized place.
const CategoryColor: Record<

View File

@ -1,8 +1,8 @@
import { Component, For, Show } from "solid-js";
import { useParams } from "@solidjs/router";
import { union, literal, safeParse, InferOutput, parse } from "valibot";
import { useSearchImageContext } from "../contexts/SearchImageContext";
import { SearchCard } from "../components/search-card/SearchCard";
import { useSearchImageContext } from "@contexts/SearchImageContext";
import { SearchCard } from "@components/search-card/SearchCard";
const entityValidator = union([
literal("event"),

View File

@ -1,10 +1,10 @@
import { SearchCard } from "@components/search-card/SearchCard";
import { useSearchImageContext } from "@contexts/SearchImageContext";
import { base, UserImage } from "@network/index";
import { useParams } from "@solidjs/router";
import { For, Show, type Component } from "solid-js";
import { base, type UserImage } from "./network";
import { useSearchImageContext } from "./contexts/SearchImageContext";
import { SearchCard } from "./components/search-card/SearchCard";
export const Image: Component = () => {
export const ImagePage: Component = () => {
const { imageId } = useParams<{ imageId: string }>();
const { imagesWithProperties } = useSearchImageContext();

View File

@ -0,0 +1,3 @@
export * from "./front";
export * from "./gallery";
export * from "./image";

View File

@ -19,7 +19,12 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"paths": {
"@components/*": ["./src/components/*"],
"@network/*": ["./src/network/*"],
"@contexts/*": ["./src/contexts/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"root":["./src/App.tsx","./src/Entity.tsx","./src/Login.tsx","./src/ProtectedRoute.tsx","./src/Settings.tsx","./src/index.tsx","./src/vite-env.d.ts","./src/components/image/index.tsx","./src/components/item-modal/ItemModal.tsx","./src/components/search-card/SearchCard.tsx","./src/components/search-card/SearchCardContact.tsx","./src/components/search-card/SearchCardEvent.tsx","./src/components/search-card/SearchCardLocation.tsx","./src/components/search-card/SearchCardNote.tsx","./src/components/search-card/SearchCardReceipt.tsx","./src/components/search-card/SearchCardWebsite.tsx","./src/components/shortcuts/ShortcutItem.tsx","./src/components/shortcuts/Shortcuts.tsx","./src/components/shortcuts/hooks/useShortcutEditor.ts","./src/components/shortcuts/utils/formatKey.ts","./src/components/shortcuts/utils/isModifierKey.ts","./src/components/shortcuts/utils/normalizeKey.ts","./src/components/shortcuts/utils/sortKeys.ts","./src/contexts/SearchImageContext.tsx","./src/mobile/android.ts","./src/mobile/index.ts","./src/network/index.ts","./src/network/sampleData.ts","./src/network/types.ts","./src/notifications/ProcessingImages.tsx","./src/notifications/index.ts","./src/pages/index.ts","./src/pages/front/Recent.tsx","./src/pages/front/gallery.tsx","./src/pages/front/index.tsx","./src/pages/front/page.tsx","./src/pages/gallery/index.tsx","./src/pages/image/index.tsx","./src/utils/getCardSize.ts","./src/utils/groupPropertiesWithImage.ts"],"errors":true,"version":"5.9.0-dev"}

2
frontend/vite.config.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const _default: import("vite").UserConfig & Promise<import("vite").UserConfig> & import("vite").UserConfigFnObject & import("vite").UserConfigFnPromise & import("vite").UserConfigFn;
export default _default;

77
frontend/vite.config.js Normal file
View File

@ -0,0 +1,77 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import { defineConfig } from "vite";
import solid from "vite-plugin-solid";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import tsconfigPaths from "vite-tsconfig-paths";
// @ts-expect-error process is a nodejs global
var host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig(function () { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, ({
plugins: [solid(), tsconfigPaths()],
css: {
postcss: {
plugins: [tailwindcss, autoprefixer],
},
},
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
//
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: "ws",
host: host,
port: 1421,
}
: undefined,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"],
},
},
})];
});
}); });

View File

@ -2,13 +2,14 @@ import { defineConfig } from "vite";
import solid from "vite-plugin-solid";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import tsconfigPaths from "vite-tsconfig-paths";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
// https://vitejs.dev/config/
export default defineConfig(async () => ({
plugins: [solid()],
plugins: [solid(), tsconfigPaths()],
css: {
postcss: {
plugins: [tailwindcss, autoprefixer],