统一模型库前端基础依赖

This commit is contained in:
zhangshun
2026-05-29 11:21:15 +08:00
parent 771e290fb9
commit 71496de8e3
9 changed files with 29015 additions and 75 deletions

View File

@@ -11,13 +11,12 @@
"dependencies": {
"jquery": "^3.7.1",
"jstree": "^3.3.17",
"three": "^0.184.0",
"w2ui": "^2.0.0"
"three": "^0.183.2"
},
"devDependencies": {
"@types/jquery": "^3.5.32",
"@types/jstree": "^3.3.46",
"@types/three": "^0.184.1",
"@types/three": "^0.183.0",
"@vitejs/plugin-basic-ssl": "^1.2.0",
"typescript": "^5.7.2",
"vite": "^6.0.7"

View File

@@ -1,5 +1,5 @@
import "jstree/dist/themes/default/style.min.css";
import "w2ui/w2ui-2.0.min.css";
import "./vendor/w2ui/w2ui.css";
import "./styles/base.css";
import { api } from "./services/api";
import { getToken, setCurrentUser, setSession, clearSession } from "./services/authState";

View File

@@ -1,4 +1,4 @@
import { w2layout, w2ui } from "w2ui";
import { w2layout, w2ui } from "../../vendor/w2ui";
import { getCurrentUser, clearSession } from "../../services/authState";
import { loadFolders } from "./modules/folders";
import { bindModelActions } from "./modules/models";

View File

@@ -1,4 +1,4 @@
import { w2popup } from "w2ui";
import { w2popup } from "../../../vendor/w2ui";
import type { Object3D, PerspectiveCamera, Scene, Texture, WebGLRenderer } from "three";
import type { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
import type { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";

View File

@@ -1,4 +1,4 @@
import { w2alert, w2confirm, w2popup } from "w2ui";
import { w2alert, w2confirm, w2popup } from "../vendor/w2ui";
type PopupActionEvent = {
detail: {

53
web/src/vendor/w2ui.ts vendored Normal file
View File

@@ -0,0 +1,53 @@
// 与主程序 src/publicJs/w2ui 保持同步的模型库本地副本,这里只做类型适配。
// @ts-expect-error w2ui 本地 JS 暂无配套 d.ts运行时由 Vite 正常打包。
import * as w2uiLocal from "./w2ui/w2ui.es6.js";
type W2EventHandler = (event: unknown) => void;
type W2EventHost = {
on(eventName: string, handler: W2EventHandler): W2EventHost;
};
type W2Popup = {
open(options: {
title?: string;
width?: number;
height?: number;
modal?: boolean;
body?: string;
actions?: Record<string, () => void | Promise<void>>;
}): {
self: W2EventHost;
};
close(): void;
};
type W2LayoutOptions = {
name: string;
padding?: number;
panels: Array<{
type: "left" | "right" | "top" | "bottom" | "main" | "preview";
size?: number | string;
minSize?: number;
maxSize?: number | false;
resizable?: boolean;
overflow?: string;
html?: string;
}>;
};
type W2Layout = {
render(target: HTMLElement): void;
destroy(): void;
};
const local = w2uiLocal as Record<string, unknown>;
export const w2popup = local.w2popup as W2Popup;
export const w2layout = local.w2layout as new (options: W2LayoutOptions) => W2Layout;
export const w2ui = local.w2ui as Record<string, { destroy?: () => void } | undefined>;
export const w2alert = local.w2alert as (message: string, title?: string) => unknown;
export const w2confirm = local.w2confirm as (
message: string | { msg: string; title?: string; yes?: string; no?: string },
title?: string,
callback?: (action: string) => void
) => unknown;

4250
web/src/vendor/w2ui/w2ui.css vendored Normal file

File diff suppressed because one or more lines are too long

24634
web/src/vendor/w2ui/w2ui.es6.js vendored Normal file

File diff suppressed because it is too large Load Diff