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