2 Commits
Author SHA1 Message Date
timi b598967765 Merge pull request 'v1.0.2' (#4) from dev into master
Reviewed-on: #4
2026-11-07 17:48:21 +00:00
timi e213f2231c Merge pull request 'v1.0.1' (#3) from dev into master
Reviewed-on: #3
2026-11-06 09:32:25 +00:00
15 changed files with 64 additions and 137 deletions
+2 -2
View File
@@ -75,8 +75,8 @@ jobs:
- name: Ensure version not published
if: ${{ steps.version.outputs.publish == 'true' }}
run: |
if npm view "@timi/web@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
echo "FAIL: @timi/web@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
if npm view "timi-web@${{ steps.version.outputs.version }}" version > /dev/null 2>&1; then
echo "FAIL: timi-web@${{ steps.version.outputs.version }} 已存在于 nexus,请提升 package.json 版本"
exit 1
fi
echo "OK: 版本未占用"
+5 -5
View File
@@ -1,15 +1,15 @@
# @timi/web
# timi-web
Vue 3 通用组件库与工具库。业务 API、领域类型和用户状态由应用层自行提供。
Vue 3 通用组件库与工具库。业务 API、领域类型和用户状态位于 [timi-web-api](https://gitea.imyeyu.com/timi/timi-web-api)。
## 工具依赖
平台无关的 `Events`、`IOSize`、`MethodLocker`、`Prismjs`、`Text`、`Time`、`Toolkit` 和通用类型统一由 `@timi/ts` 提供。`@timi/web` 直接依赖并从入口转出这些能力,业务项目只依赖 `@timi/web` 时可以间接使用它们;Vue、DOM、浏览器文件和组件安装相关能力仍由 `@timi/web` 提供。
平台无关的 `Events`、`IOSize`、`MethodLocker`、`Prismjs`、`Text`、`Time`、`Toolkit` 和通用类型统一由 `timi-ts` 提供。`timi-web` 直接依赖并从入口转出这些能力,业务项目只依赖 `timi-web` 时可以间接使用它们;Vue、DOM、浏览器文件和组件安装相关能力仍由 `timi-web` 提供。
Web 专属方法使用 `WebToolkit`,通用方法使用 `@timi/ts` 导出的 `Toolkit`。
Web 专属方法使用 `WebToolkit`,通用方法使用 `timi-ts` 导出的 `Toolkit`。
```ts
import { Text, Toolkit } from "@timi/web";
import { Text, Toolkit } from "timi-web";
```
## 文档与演示
@@ -1,5 +1,5 @@
<template>
<div class="tui-demo tui-scroll-bar">
<div class="tui-demo">
<section class="stage">
<slot />
</section>
+12 -30
View File
@@ -1,15 +1,11 @@
{
"name": "@timi/web",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"name": "timi-web",
"main": "./dist/timi-web.umd.js",
"types": "./dist/src/index.d.ts",
"module": "./dist/timi-web.mjs",
"style": "./dist/timi-web.css",
"sideEffects": [
"**/*.css"
],
"private": false,
"version": "2.0.1",
"version": "1.0.2",
"license": "MIT",
"scripts": {
"dev": "pnpm run -C docs dev",
@@ -31,28 +27,14 @@
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./components": {
"types": "./dist/components/index.d.ts",
"import": "./dist/components/index.js"
},
"./components/background-effect/flower-fall": {
"types": "./dist/components/background-effect/flower-fall/index.d.ts",
"import": "./dist/components/background-effect/flower-fall/index.js"
},
"./components/*": {
"types": "./dist/components/*/index.d.ts",
"import": "./dist/components/*/index.js"
"types": "./dist/src/index.d.ts",
"import": "./dist/timi-web.mjs",
"require": "./dist/timi-web.umd.js"
},
"./editor": {
"types": "./dist/editor/index.d.ts",
"import": "./dist/editor/index.js"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"import": "./dist/utils/index.js"
"types": "./dist/src/editor/index.d.ts",
"import": "./dist/timi-web.mjs",
"require": "./dist/timi-web.umd.js"
},
"./style.css": "./dist/timi-web.css",
"./src/*": "./src/*"
@@ -61,7 +43,7 @@
"node": ">=20.0.0"
},
"dependencies": {
"@timi/ts": "^1.0.0",
"timi-ts": "^1.0.0",
"@tiptap/extension-code-block": "^3.22.5",
"@tiptap/extension-color": "^3.22.4",
"@tiptap/extension-image": "^3.22.4",
+9 -10
View File
@@ -11,9 +11,6 @@ importers:
'@marsio/vue-split-pane':
specifier: ^1.0.0
version: 1.0.0(typescript@5.9.3)
'@timi/ts':
specifier: ^1.0.0
version: 1.0.0
'@tiptap/extension-code-block':
specifier: ^3.22.5
version: 3.30.2(@tiptap/core@3.30.2(@tiptap/pm@3.30.2))(@tiptap/pm@3.30.2)
@@ -86,6 +83,9 @@ importers:
terser:
specifier: ^5.44.1
version: 5.44.1
timi-ts:
specifier: ^1.0.0
version: 1.0.0
devDependencies:
'@types/marked':
specifier: ^6.0.0
@@ -776,10 +776,6 @@ packages:
'@standard-schema/spec@1.1.0':
resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}
'@timi/ts@1.0.0':
resolution: {integrity: sha512-0NFi1+CnonZTcf73IeDdcd5Qoqnt/EdESI448wHfdbd5mk6gRqJNzb82z03SHOCJlIOiLUPvBgctAVLbB58V1A==}
engines: {node: '>=20.0.0'}
'@tiptap/core@3.30.2':
resolution: {integrity: sha512-QbZC/s1OOqcoUdkhIY16TjR/gCtR0qAk9e4bJwUqOJqZuv5ozqCL5hzWm22jjTPp6c6Ei2tPd6t30VwfIKW4lQ==}
peerDependencies:
@@ -1816,7 +1812,6 @@ packages:
image-size@0.5.5:
resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
engines: {node: '>=0.10.0'}
deprecated: Please migrate to image-size@2.x
hasBin: true
import-fresh@3.3.0:
@@ -2515,6 +2510,10 @@ packages:
engines: {node: '>=10'}
hasBin: true
timi-ts@1.0.0:
resolution: {integrity: sha512-MR9LJGH4/UEgzzrc1yVdxypTcoQRASt8xns2z5xNyoXr2e0kdXv8sjnuRshp3uZnOCU/pSks1LeLi9OvC2U/7g==}
engines: {node: '>=20.0.0'}
tinybench@2.9.0:
resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}
@@ -3401,8 +3400,6 @@ snapshots:
'@standard-schema/spec@1.1.0': {}
'@timi/ts@1.0.0': {}
'@tiptap/core@3.30.2(@tiptap/pm@3.30.2)':
dependencies:
'@tiptap/pm': 3.30.2
@@ -5214,6 +5211,8 @@ snapshots:
commander: 2.20.3
source-map-support: 0.5.21
timi-ts@1.0.0: {}
tinybench@2.9.0: {}
tinyexec@1.1.1: {}
+11 -21
View File
@@ -1,28 +1,18 @@
@import url(./variable);
.tui-scroll-bar {
.custom-scroll-bar *::-webkit-scrollbar {
width: 10px !important;
height: 10px !important;
background: #CFD2E0;
}
*::-webkit-scrollbar {
width: 10px !important;
height: 10px !important;
cursor: default;
background: #CFD2E0;
}
.custom-scroll-bar *::-webkit-scrollbar-corner {
background: #CFD2E0;
}
*::-webkit-scrollbar-corner {
background: #CFD2E0;
}
*::-webkit-scrollbar-thumb {
cursor: default;
background: #525870;
border-radius: 0 !important;
&:hover {
cursor: default;
background: #636981;
}
}
.custom-scroll-bar *::-webkit-scrollbar-thumb {
background: #525870;
border-radius: 0 !important;
}
*::selection {
@@ -6,7 +6,7 @@
<script lang="ts" setup>
import Resizer from "../../../utils/Resizer";
import { Toolkit } from "@timi/ts";
import { Toolkit } from "timi-ts";
defineOptions({
name: "BEFlowerFall"
+1 -1
View File
@@ -13,7 +13,7 @@
</template>
<script lang="ts" setup>
import { Toolkit } from "@timi/ts";
import { Toolkit } from "timi-ts";
defineOptions({
name: "Loading"
});
+1 -1
View File
@@ -12,7 +12,7 @@
</template>
<script lang="ts" setup>
import { Time } from "@timi/ts";
import { Time } from "timi-ts";
defineOptions({
name: "TimeLabel"
+1 -1
View File
@@ -1,6 +1,6 @@
import Prism from "prismjs";
// 平台组件会直接编译 src/editor,不能依赖 @timi/web 构建阶段的 Prism 插件注入语言。
// 平台组件会直接编译 src/editor,不能依赖 timi-web 构建阶段的 Prism 插件注入语言。
import "prismjs/components/prism-apacheconf";
import "prismjs/components/prism-bash";
import "prismjs/components/prism-css";
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { Text } from "@timi/ts";
import { Text } from "timi-ts";
describe("Text", () => {
describe("keyValue", () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { Time } from "@timi/ts";
import { Time } from "timi-ts";
describe("Time", () => {
describe("toShortTime", () => {
+3 -3
View File
@@ -13,7 +13,7 @@ export { default as VPopup } from "./directives/Popup";
export * from "./directives/Draggable";
export * from "./directives/Popup";
// 通过 @timi/web 间接提供 @timi/ts,业务项目无需重复声明公共工具入口。
// 通过 timi-web 间接提供 timi-ts,业务项目无需重复声明公共工具入口。
export {
Events,
IOSize,
@@ -25,11 +25,11 @@ export {
Time,
Toolkit,
UNITS
} from "@timi/ts";
} from "timi-ts";
export type {
Merge,
PickRequiredUnion,
PickNotRequiredUnion,
PrismjsProperties,
Unit
} from "@timi/ts";
} from "timi-ts";
+1 -1
View File
@@ -17,7 +17,7 @@
"DOM.Iterable"
],
"paths": {
"@timi/web": [
"timi-web": [
"./src/index.ts"
]
}
+14 -58
View File
@@ -1,5 +1,4 @@
import { existsSync, readdirSync, statSync } from "fs";
import { relative, resolve } from "path";
import { resolve } from "path";
import { Alias, defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import VueSetupExtend from "vite-plugin-vue-setup-extend";
@@ -10,43 +9,11 @@ import dts from "vite-plugin-dts";
const alias: Alias[] = [
{
find: /^@timi\/web(\/(es|lib))?$/,
find: /^timi-web(\/(es|lib))?$/,
replacement: resolve(__dirname, "./src/index.ts")
}
];
/**
* 递归收集组件入口,用于按组件导出。
* 例如 src/components/icon/index.ts -> components/icon/index
*/
function collectComponentEntries(dir: string, root: string): Record<string, string> {
const entries: Record<string, string> = {};
for (const name of readdirSync(dir)) {
const fullPath = resolve(dir, name);
if (!statSync(fullPath).isDirectory()) {
continue;
}
const indexPath = resolve(fullPath, "index.ts");
if (existsSync(indexPath)) {
const entryName = relative(root, indexPath)
.replace(/\\/g, "/")
.replace(/\.ts$/, "");
entries[entryName] = indexPath;
} else {
Object.assign(entries, collectComponentEntries(fullPath, root));
}
}
return entries;
}
const srcRoot = resolve(__dirname, "src");
const componentEntries = collectComponentEntries(resolve(srcRoot, "components"), srcRoot);
export default defineConfig({
server: {
port: 3003,
@@ -56,36 +23,22 @@ export default defineConfig({
alias
},
build: {
target: "es2017",
outDir: "dist",
lib: {
entry: {
index: resolve(srcRoot, "index.ts"),
"components/index": resolve(srcRoot, "components/index.ts"),
"editor/index": resolve(srcRoot, "editor/index.ts"),
"utils/index": resolve(srcRoot, "utils/index.ts"),
...componentEntries
},
formats: ["es"],
fileName: (_format, entryName) => `${entryName}.js`,
cssFileName: "timi-web"
entry: resolve(__dirname, "./src/index.ts"),
name: "TimiWeb",
fileName: "timi-web"
},
rollupOptions: {
external: [
"vue",
"@timi/ts",
"marked",
/^marked-/,
"prismjs",
/^prismjs\//,
/^@tiptap\//,
"@marsio/vue-split-pane"
"vue"
],
output: {
chunkFileNames: "chunks/[name]-[hash].js"
globals: {
vue: "Vue"
}
}
},
cssCodeSplit: false,
minify: "terser"
},
plugins: [
@@ -94,8 +47,11 @@ export default defineConfig({
}),
VueSetupExtend(),
dts({
// 按组件导出后,声明文件直接落在 dist/**,与 exports 的路径保持一致。
entryRoot: "src"
// package.json 的 types 与 exports 指向 dist/src/**。
// 不显式固定根目录时,插件会按 tsconfig include 推断公共根,
// include 一旦变化(例如移除 examples 目录)声明产物就会从
// dist/src/** 漂移到 dist/**,进而让所有引用本包类型的地方报错。
entryRoot: "."
}),
prismjsPlugin({
languages: [