This commit is contained in:
2026-04-27 19:17:02 +08:00
parent 9947701fc4
commit 14828597db
88 changed files with 1897 additions and 274 deletions

View File

View File

@@ -0,0 +1,27 @@
export type VersionVector = {
deviceId: string; // 一个手机可能会有多个浏览器登录,通常一个浏览器被称为一个设备
};
export interface IBookmarkNode {
id: string;
title: string;
parentId: string | null;
rename(title: string): void;
}
export class BookmarkNode implements IBookmarkNode {
id: string;
title: string;
parentId: string | null;
constructor(id: string, title: string) {
this.id = id;
this.title = title;
this.parentId = null;
}
rename(title: string) {
this.title = title;
}
}

View File

@@ -0,0 +1,39 @@
import { BookmarkNode } from "./bookmark-node";
export interface IFolderNode {
id: string;
title: string;
parentId: string | null;
bookmarkNode: BookmarkNode[];
addBookmarkNode(node: BookmarkNode): void;
rename(title: string): void;
}
export class FolderNode implements IFolderNode {
id: string;
title: string;
parentId: string | null;
bookmarkNode: BookmarkNode[];
constructor(
id: string,
title: string,
parentId: string | null = null,
bookmarkNode: BookmarkNode[],
) {
this.id = id;
this.title = title;
this.parentId = parentId;
this.bookmarkNode = bookmarkNode;
}
addBookmarkNode(node: BookmarkNode): void {
this.bookmarkNode.push(node);
node.parentId = this.id;
}
rename(title: string) {
this.title = title;
}
}

View File

@@ -0,0 +1,17 @@
export class Server {
serverUrl: string;
constructor(serverUrl: string) {
this.serverUrl = serverUrl;
}
login(email: string, password: string) {
const result = false;
return result;
}
logout(email: string, password: string) {
const result = false;
return result;
}
}

View File

@@ -1,5 +1,5 @@
{
"name": "@defgov/ui",
"name": "defgov-ui-web",
"version": "0.0.0",
"private": true,
"type": "module",
@@ -27,6 +27,7 @@
"gen-index": "ts-node scripts/generate-index.ts && ts-node scripts/generate-index-css.ts"
},
"devDependencies": {
"@tailwindcss/vite": "^4.2.4",
"@types/node": "^25.6.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",

View File

@@ -6,7 +6,7 @@
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"types": ["node", "react"]
"types": ["node", "react", "vite/client"]
},
"include": ["src"],
"exclude": [

View File

@@ -3,12 +3,13 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import dts from "vite-plugin-dts";
import path from "path";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
plugins: [
react(),
tailwindcss(),
dts({
rollupTypes: true,
include: ["src"],
}),
],
@@ -20,15 +21,15 @@ export default defineConfig({
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
name: "DefgovUI",
formats: ["es", "umd"],
name: "DefgovUIWeb",
formats: ["es"],
fileName: (format) => {
return `index.${format}.js`;
},
},
rollupOptions: {
external: ["react", "react-dom", "react/jsx-runtime"],
external: ["react", "react-dom"],
output: {
globals: {
react: "React",
@@ -38,7 +39,6 @@ export default defineConfig({
},
sourcemap: true,
minify: "esbuild",
cssCodeSplit: true,
},
});