mm
This commit is contained in:
0
packages/bookmark-sync/package.json
Normal file
0
packages/bookmark-sync/package.json
Normal file
27
packages/bookmark-sync/src/nodes/bookmark-node.ts
Normal file
27
packages/bookmark-sync/src/nodes/bookmark-node.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
39
packages/bookmark-sync/src/nodes/folder-node.ts
Normal file
39
packages/bookmark-sync/src/nodes/folder-node.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
17
packages/bookmark-sync/src/service/Server.ts
Normal file
17
packages/bookmark-sync/src/service/Server.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
@@ -6,7 +6,7 @@
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"declaration": true,
|
||||
"types": ["node", "react"]
|
||||
"types": ["node", "react", "vite/client"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": [
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user