upper to timi-ts

This commit is contained in:
Timi
2026-08-28 15:19:08 +08:00
parent f790122c01
commit ef71681bd5
45 changed files with 816 additions and 1018 deletions
+2
View File
@@ -0,0 +1,2 @@
/cache
/project.local.yml
+154
View File
@@ -0,0 +1,154 @@
# the name by which the project can be referenced within Serena
project_name: "timi-tdesign-pc"
# list of languages for which language servers are started; choose from:
# al bash clojure cpp csharp
# csharp_omnisharp dart elixir elm erlang
# fortran fsharp go groovy haskell
# haxe java julia kotlin lua
# markdown
# matlab nix pascal perl php
# php_phpactor powershell python python_jedi r
# rego ruby ruby_solargraph rust scala
# swift terraform toml typescript typescript_vts
# vue yaml zig
# (This list may be outdated. For the current list, see values of Language enum here:
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
# Note:
# - For C, use cpp
# - For JavaScript, use typescript
# - For Free Pascal/Lazarus, use pascal
# Special requirements:
# Some languages require additional setup/installations.
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
# When using multiple languages, the first language server that supports a given file will be used for that file.
# The first language is the default language and the respective language server will be used as a fallback.
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
languages:
- vue
# the encoding used by text files in the project
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
encoding: "utf-8"
# line ending convention to use when writing source files.
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
line_ending:
# The language backend to use for this project.
# If not set, the global setting from serena_config.yml is used.
# Valid values: LSP, JetBrains
# Note: the backend is fixed at startup. If a project with a different backend
# is activated post-init, an error will be returned.
language_backend:
# whether to use project's .gitignore files to ignore files
ignore_all_files_in_gitignore: true
# advanced configuration option allowing to configure language server-specific options.
# Maps the language key to the options.
# Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
# No documentation on options means no options are available.
ls_specific_settings: {}
# list of additional paths to ignore in this project.
# Same syntax as gitignore, so you can use * and **.
# Note: global ignored_paths from serena_config.yml are also applied additively.
ignored_paths: []
# whether the project is in read-only mode
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
# Added on 2025-04-18
read_only: false
# list of tool names to exclude.
# This extends the existing exclusions (e.g. from the global configuration)
#
# Below is the complete list of tools for convenience.
# To make sure you have the latest list of tools, and to view their descriptions,
# execute `uv run scripts/print_tool_overview.py`.
#
# * `activate_project`: Activates a project based on the project name or path.
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
# * `create_text_file`: Creates/overwrites a file in the project directory.
# * `delete_memory`: Delete a memory file. Should only happen if a user asks for it explicitly,
# for example by saying that the information retrieved from a memory file is no longer correct
# or no longer relevant for the project.
# * `edit_memory`: Replaces content matching a regular expression in a memory.
# * `execute_shell_command`: Executes a shell command.
# * `find_file`: Finds files in the given relative paths
# * `find_referencing_symbols`: Finds symbols that reference the given symbol using the language server backend
# * `find_symbol`: Performs a global (or local) search using the language server backend.
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
# * `initial_instructions`: Provides instructions Serena usage (i.e. the 'Serena Instructions Manual')
# for clients that do not read the initial instructions when the MCP server is connected.
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
# * `list_memories`: List available memories. Any memory can be read using the `read_memory` tool.
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
# * `read_file`: Reads a file within the project directory.
# * `read_memory`: Read the content of a memory file. This tool should only be used if the information
# is relevant to the current task. You can infer whether the information
# is relevant from the memory file name.
# You should not read the same memory file multiple times in the same conversation.
# * `rename_memory`: Renames or moves a memory. Moving between project and global scope is supported
# (e.g., renaming "global/foo" to "bar" moves it from global to project scope).
# * `rename_symbol`: Renames a symbol throughout the codebase using language server refactoring capabilities.
# For JB, we use a separate tool.
# * `replace_content`: Replaces content in a file (optionally using regular expressions).
# * `replace_symbol_body`: Replaces the full definition of a symbol using the language server backend.
# * `safe_delete_symbol`:
# * `search_for_pattern`: Performs a search for a pattern in the project.
# * `write_memory`: Write some information (utf-8-encoded) about this project that can be useful for future tasks to a memory in md format.
# The memory name should be meaningful.
excluded_tools: []
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
# This extends the existing inclusions (e.g. from the global configuration).
included_optional_tools: []
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
fixed_tools: []
# list of mode names to that are always to be included in the set of active modes
# The full set of modes to be activated is base_modes + default_modes.
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this setting overrides the global configuration.
# Set this to [] to disable base modes for this project.
# Set this to a list of mode names to always include the respective modes for this project.
base_modes:
# list of mode names that are to be activated by default.
# The full set of modes to be activated is base_modes + default_modes.
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
# This setting can, in turn, be overridden by CLI parameters (--mode).
default_modes:
# initial prompt for the project. It will always be given to the LLM upon activating the project
# (contrary to the memories, which are loaded on demand).
initial_prompt: ""
# time budget (seconds) per tool call for the retrieval of additional symbol information
# such as docstrings or parameter information.
# This overrides the corresponding setting in the global configuration; see the documentation there.
# If null or missing, use the setting from the global configuration.
symbol_info_budget:
# list of regex patterns which, when matched, mark a memory entry as read‑only.
# Extends the list from the global configuration, merging the two lists.
read_only_memory_patterns: []
# list of regex patterns for memories to completely ignore.
# Matching memories will not appear in list_memories or activate_project output
# and cannot be accessed via read_memory or write_memory.
# To access ignored memory files, use the read_file tool on the raw file path.
# Extends the list from the global configuration, merging the two lists.
# Example: ["_archive/.*", "_episodes/.*"]
ignored_memory_patterns: []
+32 -3
View File
@@ -1,5 +1,34 @@
# Vue 3 + TypeScript + Vite
# timi-tdesign-pc
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Vue 3 PC 端通用组件库,依赖 `timi-web` 提供基础组件和编辑器能力。
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
本包不依赖 `timi-web-api`。业务项目可以只安装本包使用通用组件;需要业务接口、领域类型或用户状态时,再单独安装 `timi-web-api`。
## 文章和通知组件
`ArticleEditor`、`ArticleView`、`NotifyEditor`、`NotifyView` 只约束对象的最小字段。`Article`、`Attachment` 和 `NotifyDetail` 支持携带业务自定义字段,不要求对象来自 `timi-web-api`。
上传和附件地址由业务项目通过回调注入:
```vue
<article-editor
:model-value="article"
:upload-image="uploadImage"
:upload-video="uploadVideo"
:resolve-attachment-url="resolveAttachmentUrl"
@update:model-value="article = $event"
/>
<article-view
:article="article"
:resolve-attachment-url="resolveAttachmentUrl"
/>
```
通知组件使用同样的 `uploadImage`、`uploadVideo` 和 `resolveAttachmentUrl` 回调。没有附件上传需求时,可以不传上传回调。
## 开发
```bash
pnpm install
pnpm run build
```
+1 -1
View File
@@ -54,7 +54,7 @@ import {
ArticleView
} from "timi-tdesign-pc";
import type { ArticleEditorExpose } from "timi-tdesign-pc";
import type { Article, ArticleContentType } from "timi-web/editor";
import type { Article, ArticleContentType } from "timi-tdesign-pc";
import { DEMO_ARTICLE_CONTENT, cloneArticle, uploadDemoMedia } from "../demo-data";
const contentTypeOptions: Array<{ label: string; value: ArticleContentType }> = [
+1 -1
View File
@@ -43,7 +43,7 @@ import {
NotifyView
} from "timi-tdesign-pc";
import type { NotifyEditorExpose } from "timi-tdesign-pc";
import type { NotifyDetail } from "timi-web/editor";
import type { NotifyDetail } from "timi-tdesign-pc";
import { cloneNotify, uploadDemoMedia } from "../demo-data";
const notifyValue = ref<NotifyDetail>(cloneNotify());
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Article, NotifyDetail, UploadResult } from "timi-web/editor";
import type { Article, NotifyDetail, UploadResult } from "timi-tdesign-pc";
/** 编辑器演示使用的固定内容,避免每个页面各自维护一份 HTML。 */
export const DEMO_ARTICLE_CONTENT = `<h2>跨平台编辑器</h2>
+1 -2
View File
@@ -3,8 +3,7 @@ import Root from "./Root.vue";
import TimiWebUI, { VPopup } from "timi-web";
import "timi-web/style.css";
import "~/assets/style/tencent-cloud.less";
import "~/assets/style/tencent-cloud-custom.less";
import "~/assets/style/tdesign-custom.less";
const app = createApp(Root);
app.use(TimiWebUI);
+4 -4
View File
@@ -1,9 +1,9 @@
{
"name": "timi-tdesign-pc",
"main": "./dist/timi-tdesign-pc.umd.js",
"types": "./dist/src/index.d.ts",
"types": "./dist/timi-tdesign-pc/src/index.d.ts",
"module": "./dist/timi-tdesign-pc.mjs",
"style": "./dist/style.css",
"style": "./dist/timi-tdesign-pc.css",
"private": false,
"version": "0.0.1",
"license": "MIT",
@@ -26,7 +26,7 @@
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"types": "./dist/timi-tdesign-pc/src/index.d.ts",
"import": "./dist/timi-tdesign-pc.mjs",
"require": "./dist/timi-tdesign-pc.umd.js"
},
@@ -37,7 +37,7 @@
},
"dependencies": {
"tdesign-vue-next": "^1.18.6",
"timi-web": "0.0.24",
"timi-web": "link:E:/WebProject/timi-web",
"vue": "^3.5.26"
},
"devDependencies": {
+4 -255
View File
@@ -12,8 +12,8 @@ importers:
specifier: ^1.18.6
version: 1.18.6(vue@3.5.26(typescript@5.9.3))
timi-web:
specifier: 0.0.24
version: 0.0.24(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))
specifier: link:E:/WebProject/timi-web
version: link:../timi-web
vue:
specifier: ^3.5.26
version: 3.5.26(typescript@5.9.3)
@@ -1462,15 +1462,6 @@ packages:
'@vue/component-compiler-utils@3.3.0':
resolution: {integrity: sha512-97sfH2mYNU+2PzGrmK2haqffDpVASuib9/w2/noxiFi31Z54hW+q3izKQXXQZSNhtiUpAI36uSuYepeBe4wpHQ==}
'@vue/devtools-api@7.7.10':
resolution: {integrity: sha512-KxtEpUOOpFz/qOGRrAwA36QF7DqIA+FXgCYit9mk9wjbaZt0sXOFz81ElOZtKA4HbWHUdwNjZHBFsFFyp5BZiA==}
'@vue/devtools-kit@7.7.10':
resolution: {integrity: sha512-3WNi2Kq4tbpVbmhml7RiphmAt0279oh3fKNeWMQIrltfX8Q91b4i5PL8DtyNKdwmcsGrV4fg+erwWOmD05CLIw==}
'@vue/devtools-shared@7.7.10':
resolution: {integrity: sha512-wOPslzB8vTvpxwdaOcR2qAbwmuSP0L+rhpoC6Cf56V3Jip+HWb7PQQXOUPgBNQARpXsbQX/+mvi8kKucmBGRwQ==}
'@vue/eslint-config-prettier@10.2.0':
resolution: {integrity: sha512-GL3YBLwv/+b86yHcNNfPJxOTtVFJ4Mbc9UU3zR+KVoG7SwGTjPT+32fXamscNumElhcpXW3mT0DgzS9w32S7Bw==}
peerDependencies:
@@ -1611,10 +1602,6 @@ packages:
resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==}
engines: {node: '>= 10.0.0'}
agent-base@6.0.2:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
engines: {node: '>= 6.0.0'}
ajv-draft-04@1.0.0:
resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==}
peerDependencies:
@@ -1718,9 +1705,6 @@ packages:
async@2.6.4:
resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==}
asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
at-least-node@1.0.0:
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==}
engines: {node: '>= 4.0.0'}
@@ -1732,9 +1716,6 @@ packages:
peerDependencies:
postcss: ^8.1.0
axios@1.18.0:
resolution: {integrity: sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==}
babel-loader@8.4.1:
resolution: {integrity: sha512-nXzRChX+Z1GoE6yWavBQg6jDslyFF3SDjl2paADuoQtQW10JqShJt62R6eJQ5m/pjJFDT8xgKIWSP85OY8eXeA==}
engines: {node: '>= 8.9'}
@@ -1781,9 +1762,6 @@ packages:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
birpc@2.9.0:
resolution: {integrity: sha512-KrayHS5pBi69Xi9JmvoqrIgYGDkD6mcSe/i6YKi3w5kekCLzrX4+nawcXqrj2tIp50Kw/mT/s3p+GVK0A0sKxw==}
bl@4.1.0:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
@@ -1937,10 +1915,6 @@ packages:
colorette@2.0.20:
resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}
combined-stream@1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
@@ -2169,10 +2143,6 @@ packages:
copy-anything@2.0.6:
resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==}
copy-anything@4.1.0:
resolution: {integrity: sha512-ufbM3smX/Jbnpk5wcQjzd1MgBpzmqfNETUAyZNrGwU9foRlyHoGzMMBBCRzEhQLBjZfFDE1W2ufPXX2vdWkV8Q==}
engines: {node: '>=18'}
copy-webpack-plugin@9.1.0:
resolution: {integrity: sha512-rxnR7PaGigJzhqETHGmAcxKnLZSR5u1Y3/bcIv/1FnqXedcL/E2ewK7ZCNrArJKCiSv8yVXhTqetJh8inDvfsA==}
engines: {node: '>= 12.13.0'}
@@ -2344,10 +2314,6 @@ packages:
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
engines: {node: '>= 0.4'}
delayed-stream@1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
depd@1.1.2:
resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==}
engines: {node: '>= 0.6'}
@@ -2472,10 +2438,6 @@ packages:
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
engines: {node: '>= 0.4'}
es-set-tostringtag@2.1.0:
resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==}
engines: {node: '>= 0.4'}
esbuild@0.27.2:
resolution: {integrity: sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==}
engines: {node: '>=18'}
@@ -2715,15 +2677,6 @@ packages:
flatted@3.3.3:
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
follow-redirects@1.15.11:
resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
follow-redirects@1.16.0:
resolution: {integrity: sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==}
engines: {node: '>=4.0'}
@@ -2733,10 +2686,6 @@ packages:
debug:
optional: true
form-data@4.0.5:
resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==}
engines: {node: '>= 6'}
forwarded@0.2.0:
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
engines: {node: '>= 0.6'}
@@ -2794,9 +2743,6 @@ packages:
resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
engines: {node: '>=10'}
github-slugger@2.0.0:
resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==}
glob-parent@5.1.2:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'}
@@ -2853,10 +2799,6 @@ packages:
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
engines: {node: '>= 0.4'}
has-tostringtag@1.0.2:
resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
engines: {node: '>= 0.4'}
hash-sum@1.0.2:
resolution: {integrity: sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==}
@@ -2874,9 +2816,6 @@ packages:
highlight.js@10.7.3:
resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==}
hookable@5.5.3:
resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==}
hosted-git-info@2.8.9:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
@@ -2940,10 +2879,6 @@ packages:
resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==}
engines: {node: '>=8.0.0'}
https-proxy-agent@5.0.1:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'}
human-signals@2.1.0:
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
engines: {node: '>=10.17.0'}
@@ -3284,26 +3219,6 @@ packages:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'}
marked-gfm-heading-id@4.1.4:
resolution: {integrity: sha512-CspnvVfHSkb/znqdPS4jUR8HtCjq3M/DnrsJCrfLBLvdrgbemmoINKpeWKQYkBiXAoBGejw0cV7xzqrPdup3WA==}
peerDependencies:
marked: '>=13 <19'
marked-highlight@2.2.4:
resolution: {integrity: sha512-PZxisNMJDduSjc0q6uvjsnqqHCXc9s0eyzxDO9sB1eNGJnd/H1/Fu+z6g/liC1dfJdFW4SftMwMlLvsBhUPrqQ==}
peerDependencies:
marked: '>=4 <19'
marked-mangle@1.1.13:
resolution: {integrity: sha512-phz1W/nYMr1T08Q7wqH2aj+PPiK85E69WQGfId+prvryfgjY/Idibx4YUvKaYMDV9rK1qo+/yC+Quu/3gdaBeA==}
peerDependencies:
marked: '>=4 <19'
marked@17.0.6:
resolution: {integrity: sha512-gB0gkNafnonOw0obSTEGZTT86IuhILt2Wfx0mWH/1Au83kybTayroZ/V6nS25mN7u8ASy+5fMhgB3XPNrOZdmA==}
engines: {node: '>= 20'}
hasBin: true
math-intrinsics@1.1.0:
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
engines: {node: '>= 0.4'}
@@ -3647,9 +3562,6 @@ packages:
pathe@2.0.3:
resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}
perfect-debounce@1.0.0:
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
picocolors@0.2.1:
resolution: {integrity: sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==}
@@ -3668,15 +3580,6 @@ packages:
resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==}
engines: {node: '>=6'}
pinia@3.0.4:
resolution: {integrity: sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==}
peerDependencies:
typescript: '>=4.5.0'
vue: ^3.5.11
peerDependenciesMeta:
typescript:
optional: true
pkg-dir@4.2.0:
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
engines: {node: '>=8'}
@@ -3926,10 +3829,6 @@ packages:
pretty-error@4.0.0:
resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==}
prismjs@1.30.0:
resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==}
engines: {node: '>=6'}
process-nextick-args@2.0.1:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
@@ -3943,10 +3842,6 @@ packages:
resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
engines: {node: '>= 0.10'}
proxy-from-env@2.1.0:
resolution: {integrity: sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==}
engines: {node: '>=10'}
prr@1.0.1:
resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==}
@@ -4074,9 +3969,6 @@ packages:
resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rimraf@3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
deprecated: Rimraf versions prior to v4 are no longer supported
@@ -4263,10 +4155,6 @@ packages:
resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==}
engines: {node: '>=6.0.0'}
speakingurl@14.0.1:
resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==}
engines: {node: '>=0.10.0'}
sprintf-js@1.0.3:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
@@ -4336,10 +4224,6 @@ packages:
peerDependencies:
postcss: ^8.2.15
superjson@2.2.6:
resolution: {integrity: sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==}
engines: {node: '>=16'}
supports-color@5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}
@@ -4420,10 +4304,6 @@ packages:
thunky@1.1.0:
resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==}
timi-web@0.0.24:
resolution: {integrity: sha512-qzcm72W9EE3BrYiUzc8a20J8xqxH17moEm/ovdijhRbIJtJUr81sslXFe2+OjNtx14meEIPJm3IfRooFzRswLg==}
engines: {node: '>=16.0.0'}
tinycolor2@1.6.0:
resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==}
@@ -6610,24 +6490,6 @@ snapshots:
- walrus
- whiskers
'@vue/devtools-api@7.7.10':
dependencies:
'@vue/devtools-kit': 7.7.10
'@vue/devtools-kit@7.7.10':
dependencies:
'@vue/devtools-shared': 7.7.10
birpc: 2.9.0
hookable: 5.5.3
mitt: 3.0.1
perfect-debounce: 1.0.0
speakingurl: 14.0.1
superjson: 2.2.6
'@vue/devtools-shared@7.7.10':
dependencies:
rfdc: 1.4.1
'@vue/eslint-config-prettier@10.2.0(@types/eslint@9.6.1)(eslint@9.39.2)(prettier@3.8.0)':
dependencies:
eslint: 9.39.2
@@ -6809,12 +6671,6 @@ snapshots:
address@1.2.2: {}
agent-base@6.0.2:
dependencies:
debug: 4.4.3
transitivePeerDependencies:
- supports-color
ajv-draft-04@1.0.0(ajv@8.13.0):
optionalDependencies:
ajv: 8.13.0
@@ -6907,8 +6763,6 @@ snapshots:
dependencies:
lodash: 4.17.21
asynckit@0.4.0: {}
at-least-node@1.0.0: {}
autoprefixer@10.4.20(postcss@8.5.6):
@@ -6921,16 +6775,6 @@ snapshots:
postcss: 8.5.6
postcss-value-parser: 4.2.0
axios@1.18.0:
dependencies:
follow-redirects: 1.16.0
form-data: 4.0.5
https-proxy-agent: 5.0.1
proxy-from-env: 2.1.0
transitivePeerDependencies:
- debug
- supports-color
babel-loader@8.4.1(@babel/core@7.26.9)(webpack@5.98.0):
dependencies:
'@babel/core': 7.26.9
@@ -6986,8 +6830,6 @@ snapshots:
binary-extensions@2.3.0: {}
birpc@2.9.0: {}
bl@4.1.0:
dependencies:
buffer: 5.7.1
@@ -7179,10 +7021,6 @@ snapshots:
colorette@2.0.20: {}
combined-stream@1.0.8:
dependencies:
delayed-stream: 1.0.0
commander@2.20.3: {}
commander@7.2.0: {}
@@ -7241,8 +7079,6 @@ snapshots:
dependencies:
is-what: 3.14.1
copy-anything@4.1.0: {}
copy-webpack-plugin@9.1.0(webpack@5.98.0):
dependencies:
fast-glob: 3.3.3
@@ -7423,8 +7259,6 @@ snapshots:
has-property-descriptors: 1.0.2
object-keys: 1.1.1
delayed-stream@1.0.0: {}
depd@1.1.2: {}
depd@2.0.0: {}
@@ -7532,13 +7366,6 @@ snapshots:
dependencies:
es-errors: 1.3.0
es-set-tostringtag@2.1.0:
dependencies:
es-errors: 1.3.0
get-intrinsic: 1.3.0
has-tostringtag: 1.0.2
hasown: 2.0.2
esbuild@0.27.2:
optionalDependencies:
'@esbuild/aix-ppc64': 0.27.2
@@ -7851,20 +7678,10 @@ snapshots:
flatted@3.3.3: {}
follow-redirects@1.15.11(debug@4.4.3):
follow-redirects@1.16.0(debug@4.4.3):
optionalDependencies:
debug: 4.4.3
follow-redirects@1.16.0: {}
form-data@4.0.5:
dependencies:
asynckit: 0.4.0
combined-stream: 1.0.8
es-set-tostringtag: 2.1.0
hasown: 2.0.2
mime-types: 2.1.35
forwarded@0.2.0: {}
fraction.js@4.3.7: {}
@@ -7921,8 +7738,6 @@ snapshots:
get-stream@6.0.1: {}
github-slugger@2.0.0: {}
glob-parent@5.1.2:
dependencies:
is-glob: 4.0.3
@@ -7975,10 +7790,6 @@ snapshots:
has-symbols@1.1.0: {}
has-tostringtag@1.0.2:
dependencies:
has-symbols: 1.1.0
hash-sum@1.0.2: {}
hash-sum@2.0.0: {}
@@ -7991,8 +7802,6 @@ snapshots:
highlight.js@10.7.3: {}
hookable@5.5.3: {}
hosted-git-info@2.8.9: {}
hpack.js@2.1.6:
@@ -8069,18 +7878,11 @@ snapshots:
http-proxy@1.18.1(debug@4.4.3):
dependencies:
eventemitter3: 4.0.7
follow-redirects: 1.15.11(debug@4.4.3)
follow-redirects: 1.16.0(debug@4.4.3)
requires-port: 1.0.0
transitivePeerDependencies:
- debug
https-proxy-agent@5.0.1:
dependencies:
agent-base: 6.0.2
debug: 4.4.3
transitivePeerDependencies:
- supports-color
human-signals@2.1.0: {}
iconv-lite@0.4.24:
@@ -8381,21 +8183,6 @@ snapshots:
dependencies:
semver: 6.3.1
marked-gfm-heading-id@4.1.4(marked@17.0.6):
dependencies:
github-slugger: 2.0.0
marked: 17.0.6
marked-highlight@2.2.4(marked@17.0.6):
dependencies:
marked: 17.0.6
marked-mangle@1.1.13(marked@17.0.6):
dependencies:
marked: 17.0.6
marked@17.0.6: {}
math-intrinsics@1.1.0: {}
mdn-data@2.0.14: {}
@@ -8702,8 +8489,6 @@ snapshots:
pathe@2.0.3: {}
perfect-debounce@1.0.0: {}
picocolors@0.2.1: {}
picocolors@1.1.1: {}
@@ -8715,13 +8500,6 @@ snapshots:
pify@4.0.1:
optional: true
pinia@3.0.4(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)):
dependencies:
'@vue/devtools-api': 7.7.10
vue: 3.5.26(typescript@5.9.3)
optionalDependencies:
typescript: 5.9.3
pkg-dir@4.2.0:
dependencies:
find-up: 4.1.0
@@ -8968,8 +8746,6 @@ snapshots:
lodash: 4.17.21
renderkid: 3.0.0
prismjs@1.30.0: {}
process-nextick-args@2.0.1: {}
progress-webpack-plugin@1.0.16(webpack@5.98.0):
@@ -8984,8 +8760,6 @@ snapshots:
forwarded: 0.2.0
ipaddr.js: 1.9.1
proxy-from-env@2.1.0: {}
prr@1.0.1:
optional: true
@@ -9121,8 +8895,6 @@ snapshots:
reusify@1.1.0: {}
rfdc@1.4.1: {}
rimraf@3.0.2:
dependencies:
glob: 7.2.3
@@ -9374,8 +9146,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
speakingurl@14.0.1: {}
sprintf-js@1.0.3: {}
ssri@8.0.1:
@@ -9435,10 +9205,6 @@ snapshots:
postcss: 8.5.6
postcss-selector-parser: 6.1.2
superjson@2.2.6:
dependencies:
copy-anything: 4.1.0
supports-color@5.5.0:
dependencies:
has-flag: 3.0.0
@@ -9528,23 +9294,6 @@ snapshots:
thunky@1.1.0: {}
timi-web@0.0.24(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)):
dependencies:
axios: 1.18.0
less: 4.5.1
marked: 17.0.6
marked-gfm-heading-id: 4.1.4(marked@17.0.6)
marked-highlight: 2.2.4(marked@17.0.6)
marked-mangle: 1.1.13(marked@17.0.6)
pinia: 3.0.4(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3))
prismjs: 1.30.0
terser: 5.46.1
transitivePeerDependencies:
- debug
- supports-color
- typescript
- vue
tinycolor2@1.6.0: {}
tinyglobby@0.2.15:
+6
View File
@@ -0,0 +1,6 @@
.t-table {
.t-table.t-size-s td {
padding: var(--td-comp-paddingTB-s);
}
}
-264
View File
@@ -1,264 +0,0 @@
/* TDesign 腾讯云样式附加修改 */
@popupShadowColor: rgba(0, 0, 0, .1);
@popupShadow: 3px 3px 0 @popupShadowColor;
.t-button {
cursor: var(--tui-cur-pointer) !important;
}
.t-card {
box-shadow: var(--tui-shadow) !important;
.t-card__title {
display: block;
}
.t-card__body,
.t-card__header {
margin: 14px 0;
padding: 0 16px;
}
}
.t-link {
cursor: var(--tui-cur-pointer) !important;
font-size: 100%;
}
.t-input .t-input__inner {
cursor: var(--tui-cur-text) !important;
}
.t-select .t-input__inner {
cursor: var(--tui-cur-default) !important;
}
.t-textarea__inner {
cursor: var(--tui-cur-text) !important;
word-wrap: normal;
}
.t-checkbox {
cursor: var(--tui-cur-pointer) !important;
}
.t-tabs {
.t-tabs__nav-item {
cursor: var(--tui-cur-pointer) !important;
}
}
.t-pagination {
font-size: 12px;
--td-comp-size-m: 28px;
.t-pagination__pager {
.t-pagination__number {
cursor: var(--tui-cur-pointer) !important;
&:hover {
z-index: 1;
}
&:not(:last-child) {
margin-right: -1px;
}
}
}
}
.t-breadcrumb {
.t-breadcrumb__item {
cursor: var(--tui--pointer);
.t-breadcrumb__inner-text {
cursor: var(--tui--pointer);
}
a {
color: inherit;
text-decoration: none;
}
&:last-child {
.t-breadcrumb__inner {
&:hover,
&:active {
color: var(--td-text-color-primary);
}
&:active {
animation: none;
}
}
.t-breadcrumb__inner-text {
cursor: var(--tui--default);
}
}
}
}
.t-list {
.t-list-item {
background: transparent;
&:last-child::after {
background: transparent;
}
}
}
.t-tree {
.t-tree__item,
.t-tree__icon,
.t-tree__label {
cursor: var(--tui--pointer) !important;
font-size: 100%;
}
.t-tree__label {
padding: 3px var(--td-comp-paddingLR-xs);
}
}
.t-timeline-item__wrapper {
.t-timeline-item__dot {
border: none;
width: 8px;
height: 8px;
margin: 2px 0 0 1px;
background: var(--td-brand-color);
border-radius: 0;
}
.t-timeline-item__tail {
border-left: 2px solid var(--td-component-border);
}
}
.t-layout {
background: transparent;
.t-layout__sider,
.t-layout__header,
.t-layout__content,
.t-layout__footer {
background: transparent;
}
}
.narrow-scrollbar {
&::-webkit-scrollbar {
cursor: var(--tui--default) !important;
}
&::-webkit-scrollbar-thumb {
border: none;
cursor: var(--tui--default);
background: #525870;
border-radius: 0;
}
}
.t-popup {
.t-popup__content {
outline: 1px solid var(--td-component-border);
box-shadow: @popupShadow;
}
.t-select-option {
cursor: var(--tui--pointer);
}
}
.t-popup[data-popper-placement^="left"] {
.t-popup__arrow {
right: calc(-9px / 2);
&::before {
box-shadow: inset -1px 0 0 var(--td-component-border), inset 0 1px 0 var(--td-component-border), 2px -2px 0 rgba(0, 0, 0, .08);
}
}
}
.t-popup[data-popper-placement^="right"] {
.t-popup__arrow {
left: calc(-10px / 2);
&::before {
box-shadow: inset 0 -1px 0 var(--td-component-border), inset 1px 0 0 var(--td-component-border);
}
}
}
.t-popup[data-popper-placement^="bottom"] {
&.t-select__dropdown .t-popup__content {
margin-top: 2px;
}
}
.t-dialog__ctx {
--td-mask-active: rgba(0, 0, 0, .2) !important;
.t-dialog {
background: rgba(255, 255, 255, .8);
box-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
backdrop-filter: blur(10px);
animation-duration: .3s !important;
-webkit-backdrop-filter: blur(10px);
animation-timing-function: cubic-bezier(.23, 1, .32, 1) !important;
}
}
.t-message {
outline: 1px solid var(--td-component-border) !important;
box-shadow: @popupShadow !important;
}
.t-dropdown {
border: none;
}
.t-avatar {
box-sizing: border-box;
}
.t-image-viewer {
.t-swiper-item {
overflow: hidden;
}
}
.t-menu {
.t-head-menu__inner {
height: var(--td-comp-size-xxl);
.t-menu__operations:not(:empty) {
height: var(--td-comp-size-xxl);
line-height: 1;
}
.t-menu__item {
height: 100%;
padding: 0 24px;
margin-left: 0;
&.t-is-active {
color: var(--td-text-color-anti);
background-color: var(--td-brand-color)
}
}
}
}
-380
View File
@@ -1,380 +0,0 @@
:root, :root[theme-mode="light"] {
--td-brand-color-1: #f2f3ff;
--td-brand-color-2: #d9e1ff;
--td-brand-color-3: #b5c7ff;
--td-brand-color-4: #8eabff;
--td-brand-color-5: #618dff;
--td-brand-color-6: #366ef4;
--td-brand-color-7: #0052d9;
--td-brand-color-8: #003cab;
--td-brand-color-9: #002a7c;
--td-brand-color-10: #001a57;
--td-warning-color-1: #fff1e9;
--td-warning-color-2: #ffd9c2;
--td-warning-color-3: #ffb98c;
--td-warning-color-4: #fa9550;
--td-warning-color-5: #e37318;
--td-warning-color-6: #be5a00;
--td-warning-color-7: #954500;
--td-warning-color-8: #713300;
--td-warning-color-9: #532300;
--td-warning-color-10: #3b1700;
--td-error-color-1: #fff0ed;
--td-error-color-2: #ffd8d2;
--td-error-color-3: #ffb9b0;
--td-error-color-4: #ff9285;
--td-error-color-5: #f6685d;
--td-error-color-6: #d54941;
--td-error-color-7: #ad352f;
--td-error-color-8: #881f1c;
--td-error-color-9: #68070a;
--td-error-color-10: #490002;
--td-success-color-1: #e3f9e9;
--td-success-color-2: #c6f3d7;
--td-success-color-3: #92dab2;
--td-success-color-4: #56c08d;
--td-success-color-5: #2ba471;
--td-success-color-6: #008858;
--td-success-color-7: #006c45;
--td-success-color-8: #005334;
--td-success-color-9: #003b23;
--td-success-color-10: #002515;
--td-gray-color-1: #f6f6f6;
--td-gray-color-2: #eeeceb;
--td-gray-color-3: #dddbdb;
--td-gray-color-4: #cac9c9;
--td-gray-color-5: #b6b6b6;
--td-gray-color-6: #a2a2a2;
--td-gray-color-7: #8f8f8f;
--td-gray-color-8: #7b7c7c;
--td-gray-color-9: #6a6b6b;
--td-gray-color-10: #585a5a;
--td-gray-color-11: #494a4a;
--td-gray-color-12: #3a3b3b;
--td-gray-color-13: #2c2e2e;
--td-gray-color-14: #202222;
--td-font-white-1: #fff;
--td-font-white-2: rgba(255, 255, 255, .55);
--td-font-white-3: rgba(255, 255, 255, .35);
--td-font-white-4: rgba(255, 255, 255, .22);
--td-font-gray-1: rgba(0, 0, 0, .9);
--td-font-gray-2: rgba(0, 0, 0, .6);
--td-font-gray-3: rgba(0, 0, 0, .4);
--td-font-gray-4: rgba(0, 0, 0, .26);
--td-brand-color: var(--td-brand-color-7);
--td-warning-color: var(--td-warning-color-5);
--td-error-color: var(--td-error-color-6);
--td-success-color: var(--td-success-color-5);
--td-brand-color-hover: var(--td-brand-color-6);
--td-brand-color-focus: var(--td-brand-color-2);
--td-brand-color-active: var(--td-brand-color-8);
--td-brand-color-disabled: var(--td-brand-color-3);
--td-brand-color-light: var(--td-brand-color-1);
--td-brand-color-light-hover: var(--td-brand-color-2);
--td-warning-color-hover: var(--td-warning-color-4);
--td-warning-color-focus: var(--td-warning-color-2);
--td-warning-color-active: var(--td-warning-color-6);
--td-warning-color-disabled: var(--td-warning-color-3);
--td-warning-color-light: var(--td-warning-color-1);
--td-warning-color-light-hover: var(--td-warning-color-2);
--td-error-color-hover: var(--td-error-color-5);
--td-error-color-focus: var(--td-error-color-2);
--td-error-color-active: var(--td-error-color-7);
--td-error-color-disabled: var(--td-error-color-3);
--td-error-color-light: var(--td-error-color-1);
--td-error-color-light-hover: var(--td-error-color-2);
--td-success-color-hover: var(--td-success-color-4);
--td-success-color-focus: var(--td-success-color-2);
--td-success-color-active: var(--td-success-color-6);
--td-success-color-disabled: var(--td-success-color-3);
--td-success-color-light: var(--td-success-color-1);
--td-success-color-light-hover: var(--td-success-color-2);
--td-mask-active: rgba(0, 0, 0, .6);
--td-mask-disabled: rgba(255, 255, 255, .6);
--td-bg-color-page: var(--td-gray-color-2);
--td-bg-color-container: #fff;
--td-bg-color-container-hover: var(--td-gray-color-1);
--td-bg-color-container-active: var(--td-gray-color-3);
--td-bg-color-container-select: #fff;
--td-bg-color-secondarycontainer: var(--td-gray-color-1);
--td-bg-color-secondarycontainer-hover: var(--td-gray-color-2);
--td-bg-color-secondarycontainer-active: var(--td-gray-color-4);
--td-bg-color-component: var(--td-gray-color-3);
--td-bg-color-component-hover: var(--td-gray-color-4);
--td-bg-color-component-active: var(--td-gray-color-6);
--td-bg-color-secondarycomponent: var(--td-gray-color-4);
--td-bg-color-secondarycomponent-hover: var(--td-gray-color-5);
--td-bg-color-secondarycomponent-active: var(--td-gray-color-6);
--td-bg-color-component-disabled: var(--td-gray-color-2);
--td-bg-color-specialcomponent: #fff;
--td-text-color-primary: var(--td-font-gray-1);
--td-text-color-secondary: var(--td-font-gray-2);
--td-text-color-placeholder: var(--td-font-gray-3);
--td-text-color-disabled: var(--td-font-gray-4);
--td-text-color-anti: #fff;
--td-text-color-brand: var(--td-brand-color-7);
--td-text-color-link: var(--td-brand-color-8);
--td-border-level-1-color: var(--td-gray-color-3);
--td-component-stroke: var(--td-gray-color-3);
--td-border-level-2-color: var(--td-gray-color-4);
--td-component-border: var(--td-gray-color-4);
--td-shadow-1: 0 1px 10px rgba(0, 0, 0, .05), 0 4px 5px rgba(0, 0, 0, .08), 0 2px 4px -1px rgba(0, 0, 0, .12);
--td-shadow-2: 0 3px 14px 2px rgba(0, 0, 0, .05), 0 8px 10px 1px rgba(0, 0, 0, .06), 0 5px 5px -3px rgba(0, 0, 0, .1);
--td-shadow-3: 0 6px 30px 5px rgba(0, 0, 0, .05), 0 16px 24px 2px rgba(0, 0, 0, .04), 0 8px 10px -5px rgba(0, 0, 0, .08);
--td-shadow-inset-top: inset 0 0.5px 0 #e7eaef;
--td-shadow-inset-right: inset 0.5px 0 0 #e7eaef;
--td-shadow-inset-bottom: inset 0 -0.5px 0 #e7eaef;
--td-table-shadow-color: rgba(0, 0, 0, .08);
--td-scrollbar-color: rgba(0, 0, 0, .1);
--td-scrollbar-hover-color: rgba(0, 0, 0, .3);
--td-scroll-track-color: #fff;
}
:root[theme-mode="dark"] {
--td-brand-color-1: #1b2f51;
--td-brand-color-2: #173463;
--td-brand-color-3: #143975;
--td-brand-color-4: #103d88;
--td-brand-color-5: #0d429a;
--td-brand-color-6: #054bbe;
--td-brand-color-7: #2667d4;
--td-brand-color-8: #4582e6;
--td-brand-color-9: #699ef5;
--td-brand-color-10: #96bbf8;
--td-warning-color-1: #3b1700;
--td-warning-color-2: #532300;
--td-warning-color-3: #713300;
--td-warning-color-4: #954500;
--td-warning-color-5: #be5a00;
--td-warning-color-6: #e37318;
--td-warning-color-7: #fa9550;
--td-warning-color-8: #ffb98c;
--td-warning-color-9: #ffd9c2;
--td-warning-color-10: #fff1e9;
--td-error-color-1: #490002;
--td-error-color-2: #68070a;
--td-error-color-3: #881f1c;
--td-error-color-4: #ad352f;
--td-error-color-5: #d54941;
--td-error-color-6: #f6685d;
--td-error-color-7: #ff9285;
--td-error-color-8: #ffb9b0;
--td-error-color-9: #ffd8d2;
--td-error-color-10: #fff0ed;
--td-success-color-1: #002515;
--td-success-color-2: #003b23;
--td-success-color-3: #005334;
--td-success-color-4: #006c45;
--td-success-color-5: #008858;
--td-success-color-6: #2ba471;
--td-success-color-7: #56c08d;
--td-success-color-8: #92dab2;
--td-success-color-9: #c6f3d7;
--td-success-color-10: #e3f9e9;
--td-gray-color-1: #f6f6f6;
--td-gray-color-2: #eeeceb;
--td-gray-color-3: #dddbdb;
--td-gray-color-4: #cac9c9;
--td-gray-color-5: #b6b6b6;
--td-gray-color-6: #a2a2a2;
--td-gray-color-7: #8f8f8f;
--td-gray-color-8: #7b7c7c;
--td-gray-color-9: #6a6b6b;
--td-gray-color-10: #585a5a;
--td-gray-color-11: #494a4a;
--td-gray-color-12: #3a3b3b;
--td-gray-color-13: #2c2e2e;
--td-gray-color-14: #202222;
--td-font-white-1: rgba(255, 255, 255, .9);
--td-font-white-2: rgba(255, 255, 255, .55);
--td-font-white-3: rgba(255, 255, 255, .35);
--td-font-white-4: rgba(255, 255, 255, .22);
--td-font-gray-1: rgba(0, 0, 0, .9);
--td-font-gray-2: rgba(0, 0, 0, .6);
--td-font-gray-3: rgba(0, 0, 0, .4);
--td-font-gray-4: rgba(0, 0, 0, .26);
--td-brand-color: var(--td-brand-color-8);
--td-warning-color: var(--td-warning-color-5);
--td-error-color: var(--td-error-color-6);
--td-success-color: var(--td-success-color-5);
--td-brand-color-hover: var(--td-brand-color-7);
--td-brand-color-focus: var(--td-brand-color-2);
--td-brand-color-active: var(--td-brand-color-9);
--td-brand-color-disabled: var(--td-brand-color-3);
--td-brand-color-light: var(--td-brand-color-1);
--td-brand-color-light-hover: var(--td-brand-color-2);
--td-warning-color-hover: var(--td-warning-color-4);
--td-warning-color-focus: var(--td-warning-color-2);
--td-warning-color-active: var(--td-warning-color-6);
--td-warning-color-disabled: var(--td-warning-color-3);
--td-warning-color-light: var(--td-warning-color-1);
--td-warning-color-light-hover: var(--td-warning-color-2);
--td-error-color-hover: var(--td-error-color-5);
--td-error-color-focus: var(--td-error-color-2);
--td-error-color-active: var(--td-error-color-7);
--td-error-color-disabled: var(--td-error-color-3);
--td-error-color-light: var(--td-error-color-1);
--td-error-color-light-hover: var(--td-error-color-2);
--td-success-color-hover: var(--td-success-color-4);
--td-success-color-focus: var(--td-success-color-2);
--td-success-color-active: var(--td-success-color-6);
--td-success-color-disabled: var(--td-success-color-3);
--td-success-color-light: var(--td-success-color-1);
--td-success-color-light-hover: var(--td-success-color-2);
--td-mask-active: rgba(0, 0, 0, .4);
--td-mask-disabled: rgba(0, 0, 0, .6);
--td-bg-color-page: var(--td-gray-color-14);
--td-bg-color-container: var(--td-gray-color-13);
--td-bg-color-container-hover: var(--td-gray-color-12);
--td-bg-color-container-active: var(--td-gray-color-10);
--td-bg-color-container-select: var(--td-gray-color-9);
--td-bg-color-secondarycontainer: var(--td-gray-color-12);
--td-bg-color-secondarycontainer-hover: var(--td-gray-color-11);
--td-bg-color-secondarycontainer-active: var(--td-gray-color-9);
--td-bg-color-component: var(--td-gray-color-11);
--td-bg-color-component-hover: var(--td-gray-color-10);
--td-bg-color-component-active: var(--td-gray-color-9);
--td-bg-color-secondarycomponent: var(--td-gray-color-10);
--td-bg-color-secondarycomponent-hover: var(--td-gray-color-9);
--td-bg-color-secondarycomponent-active: var(--td-gray-color-8);
--td-bg-color-component-disabled: var(--td-gray-color-12);
--td-bg-color-specialcomponent: transparent;
--td-text-color-primary: var(--td-font-white-1);
--td-text-color-secondary: var(--td-font-white-2);
--td-text-color-placeholder: var(--td-font-white-3);
--td-text-color-disabled: var(--td-font-white-4);
--td-text-color-anti: #fff;
--td-text-color-brand: var(--td-brand-color-8);
--td-text-color-link: var(--td-brand-color-8);
--td-border-level-1-color: var(--td-gray-color-11);
--td-component-stroke: var(--td-gray-color-11);
--td-border-level-2-color: var(--td-gray-color-9);
--td-component-border: var(--td-gray-color-9);
--td-shadow-1: 0 4px 6px rgba(0, 0, 0, .06), 0 1px 10px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .12);
--td-shadow-2: 0 8px 10px rgba(0, 0, 0, .12), 0 3px 14px rgba(0, 0, 0, .1), 0 5px 5px rgba(0, 0, 0, .16);
--td-shadow-3: 0 16px 24px rgba(0, 0, 0, .14), 0 6px 30px rgba(0, 0, 0, .12), 0 8px 10px rgba(0, 0, 0, .2);
--td-shadow-inset-top: inset 0 0.5px 0 #5e5e5e;
--td-shadow-inset-right: inset 0.5px 0 0 #5e5e5e;
--td-shadow-inset-bottom: inset 0 -0.5px 0 #5e5e5e;
--td-table-shadow-color: rgba(0, 0, 0, .55);
--td-scrollbar-color: rgba(255, 255, 255, .1);
--td-scrollbar-hover-color: rgba(255, 255, 255, .3);
--td-scroll-track-color: #333;
}
:root {
--td-font-family: var(--tui-font) !important;
--td-font-family-medium: var(--tui-font) !important;
--td-font-size-link-small: 12px;
--td-font-size-link-medium: 14px;
--td-font-size-link-large: 16px;
--td-font-size-mark-small: 12px;
--td-font-size-mark-medium: 14px;
--td-font-size-body-small: 12px;
--td-font-size-body-medium: 14px;
--td-font-size-body-large: 16px;
--td-font-size-title-small: 14px;
--td-font-size-title-medium: 16px;
--td-font-size-title-large: 18px;
--td-font-size-title-extraLarge: 20px;
--td-font-size-headline-small: 24px;
--td-font-size-headline-medium: 28px;
--td-font-size-headline-large: 36px;
--td-font-size-display-medium: 48px;
--td-font-size-display-large: 64px;
--td-line-height-link-small: 20px;
--td-line-height-link-medium: 22px;
--td-line-height-link-large: 24px;
--td-line-height-mark-small: 20px;
--td-line-height-mark-medium: 22px;
--td-line-height-body-small: 20px;
--td-line-height-body-medium: 22px;
--td-line-height-body-large: 24px;
--td-line-height-title-small: 22px;
--td-line-height-title-medium: 24px;
--td-line-height-title-large: 26px;
--td-line-height-title-extraLarge: 28px;
--td-line-height-headline-small: 32px;
--td-line-height-headline-medium: 36px;
--td-line-height-headline-large: 44px;
--td-line-height-display-medium: 56px;
--td-line-height-display-large: 72px;
--td-font-link-small: var(--td-font-size-link-small) / var(--td-line-height-link-small) var(--td-font-family);
--td-font-link-medium: var(--td-font-size-link-medium) / var(--td-line-height-link-medium) var(--td-font-family);
--td-font-link-large: var(--td-font-size-link-large) / var(--td-line-height-link-large) var(--td-font-family);
--td-font-mark-small: 600 var(--td-font-size-mark-small) / var(--td-line-height-mark-small) var(--td-font-family);
--td-font-mark-medium: 600 var(--td-font-size-mark-medium) / var(--td-line-height-mark-medium) var(--td-font-family);
--td-font-body-small: var(--td-font-size-body-small) / var(--td-line-height-body-small) var(--td-font-family);
--td-font-body-medium: var(--td-font-size-body-medium) / var(--td-line-height-body-medium) var(--td-font-family);
--td-font-body-large: var(--td-font-size-body-large) / var(--td-line-height-body-large) var(--td-font-family);
--td-font-title-small: 600 var(--td-font-size-title-small) / var(--td-line-height-title-small) var(--td-font-family);
--td-font-title-medium: 600 var(--td-font-size-title-medium) / var(--td-line-height-title-medium) var(--td-font-family);
--td-font-title-large: 600 var(--td-font-size-title-large) / var(--td-line-height-title-large) var(--td-font-family);
--td-font-headline-small: 600 var(--td-font-size-headline-small) / var(--td-line-height-headline-small) var(--td-font-family);
--td-font-headline-medium: 600 var(--td-font-size-headline-medium) / var(--td-line-height-headline-medium) var(--td-font-family);
--td-font-headline-large: 600 var(--td-font-size-headline-large) / var(--td-line-height-headline-large) var(--td-font-family);
--td-font-display-medium: 600 var(--td-font-size-display-medium) / var(--td-line-height-display-medium) var(--td-font-family);
--td-font-display-large: 600 var(--td-font-size-display-large) / var(--td-line-height-display-large) var(--td-font-family);
--td-radius-small: 0px !important;
--td-radius-default: 0px!important;
--td-radius-medium: 0px !important;;
--td-radius-large: 0px !important;;
--td-radius-extraLarge: 0px !important;;
--td-radius-round: 999px !important;;
--td-radius-circle: 50% !important;;
--td-size-1: 2px;
--td-size-2: 4px;
--td-size-3: 6px;
--td-size-4: 8px;
--td-size-5: 12px;
--td-size-6: 16px;
--td-size-7: 20px;
--td-size-8: 24px;
--td-size-9: 28px;
--td-size-10: 32px;
--td-size-11: 36px;
--td-size-12: 40px;
--td-size-13: 48px;
--td-size-14: 56px;
--td-size-15: 64px;
--td-size-16: 72px;
--td-comp-size-xxxs: var(--td-size-6);
--td-comp-size-xxs: var(--td-size-7);
--td-comp-size-xs: var(--td-size-8);
--td-comp-size-s: var(--td-size-9);
--td-comp-size-m: var(--td-size-10);
--td-comp-size-l: var(--td-size-11);
--td-comp-size-xl: var(--td-size-12);
--td-comp-size-xxl: var(--td-size-13);
--td-comp-size-xxxl: var(--td-size-14);
--td-comp-size-xxxxl: var(--td-size-15);
--td-comp-size-xxxxxl: var(--td-size-16);
--td-pop-padding-s: var(--td-size-2);
--td-pop-padding-m: var(--td-size-3);
--td-pop-padding-l: var(--td-size-4);
--td-pop-padding-xl: var(--td-size-5);
--td-pop-padding-xxl: var(--td-size-6);
--td-comp-paddingLR-xxs: var(--td-size-1);
--td-comp-paddingLR-xs: var(--td-size-2);
--td-comp-paddingLR-s: var(--td-size-4);
--td-comp-paddingLR-m: var(--td-size-5);
--td-comp-paddingLR-l: var(--td-size-6);
--td-comp-paddingLR-xl: var(--td-size-8);
--td-comp-paddingLR-xxl: var(--td-size-10);
--td-comp-paddingTB-xxs: var(--td-size-1);
--td-comp-paddingTB-xs: var(--td-size-2);
--td-comp-paddingTB-s: var(--td-size-4);
--td-comp-paddingTB-m: var(--td-size-5);
--td-comp-paddingTB-l: var(--td-size-6);
--td-comp-paddingTB-xl: var(--td-size-8);
--td-comp-paddingTB-xxl: var(--td-size-10);
--td-comp-margin-xxs: var(--td-size-1);
--td-comp-margin-xs: var(--td-size-2);
--td-comp-margin-s: var(--td-size-4);
--td-comp-margin-m: var(--td-size-5);
--td-comp-margin-l: var(--td-size-6);
--td-comp-margin-xl: var(--td-size-7);
--td-comp-margin-xxl: var(--td-size-8);
--td-comp-margin-xxxl: var(--td-size-10);
--td-comp-margin-xxxxl: var(--td-size-12);
}
+153
View File
@@ -0,0 +1,153 @@
import {
ATTACHMENT_ID_ATTR,
TEMP_FILE_ID_ATTR,
isLocalMediaId,
normalizeContent
} from "timi-web/editor";
import type { ArticleContentType, Attachment } from "./types";
/** 文章内容中附件和临时文件的标识前缀。 */
export const ATTACHMENT_ID_PREFIX = "attachment-id:";
export const TEMP_FILE_ID_PREFIX = "temp-file-id:";
const DEFAULT_ARTICLE_CONTENT_TYPE: ArticleContentType = "TIP_TAP";
const ARTICLE_CONTENT_TYPE_LIST: ArticleContentType[] = ["TEXT", "MARKDOWN", "TIP_TAP", "TIPTAP"];
/** 将未知正文类型归一化为组件支持的类型。 */
export function normalizeArticleContentType(contentType?: string): ArticleContentType {
if (!ARTICLE_CONTENT_TYPE_LIST.includes(contentType as ArticleContentType)) {
return DEFAULT_ARTICLE_CONTENT_TYPE;
}
return contentType === "TIPTAP" ? "TIP_TAP" : contentType as ArticleContentType;
}
/** 将空正文转换为空字符串。 */
export function normalizeRawArticleContent(content?: string): string {
return content || "";
}
/** 从媒体地址中读取附件 ID。 */
export function getAttachmentIdFromSrc(src?: string): string {
if (!src?.startsWith(ATTACHMENT_ID_PREFIX)) {
return "";
}
return src.slice(ATTACHMENT_ID_PREFIX.length);
}
/** 从媒体地址中读取临时文件 ID。 */
export function getTempFileIdFromSrc(src?: string): string {
if (!src?.startsWith(TEMP_FILE_ID_PREFIX)) {
return "";
}
return src.slice(TEMP_FILE_ID_PREFIX.length);
}
/** 构造带有附件 ID 的内部媒体地址。 */
function buildAttachmentIdSrc(attachmentId: string): string {
return `${ATTACHMENT_ID_PREFIX}${attachmentId}`;
}
/** 仅为本地预览地址保留预览元数据。 */
function buildAttachmentMetadata(src: string): Record<string, string> | undefined {
if (!src.startsWith("blob:")) {
return undefined;
}
return {
previewUrl: src
};
}
/** 过滤前端本地占位 ID。 */
function normalizeAttachmentTempFileId(tempFileId?: string): string | undefined {
if (!tempFileId || isLocalMediaId(tempFileId)) {
return undefined;
}
return tempFileId;
}
/** 从正文中提取媒体附件,返回组件需要的最小对象。 */
export function buildAttachmentListFromContent(content?: string, sourceList?: readonly Attachment[]): Attachment[] {
const rawContent = normalizeContent(content);
if (!rawContent) {
return [];
}
const parser = new DOMParser();
const doc = parser.parseFromString(rawContent, "text/html");
const sourceMap = new Map<string, Attachment>();
for (const item of sourceList || []) {
if (item.id) {
sourceMap.set(item.id, item);
}
if (item.tempFileId) {
sourceMap.set(item.tempFileId, item);
}
}
const attachmentMap = new Map<string, Attachment>();
for (const media of Array.from(doc.querySelectorAll("img, video"))) {
const src = media.getAttribute("src") || "";
const attachmentId = media.getAttribute(ATTACHMENT_ID_ATTR) || getAttachmentIdFromSrc(src);
const tempFileId = media.getAttribute(TEMP_FILE_ID_ATTR) || getTempFileIdFromSrc(src);
const key = attachmentId || tempFileId;
if (!key || attachmentMap.has(key)) {
continue;
}
const sourceAttachment = sourceMap.get(key);
const previewUrl = buildAttachmentMetadata(src);
attachmentMap.set(key, {
...(sourceAttachment || {}),
id: attachmentId || sourceAttachment?.id || key,
tempFileId: normalizeAttachmentTempFileId(tempFileId) || normalizeAttachmentTempFileId(sourceAttachment?.tempFileId),
name: media.getAttribute("title") || media.getAttribute("alt") || sourceAttachment?.name || "",
metadata: previewUrl || sourceAttachment?.metadata
});
}
return Array.from(attachmentMap.values());
}
/** 将媒体地址转换为组件统一的附件标识地址。 */
export function normalizeContentForStore(content?: string): string {
const rawContent = normalizeContent(content);
if (!rawContent) {
return "";
}
const parser = new DOMParser();
const doc = parser.parseFromString(rawContent, "text/html");
for (const media of Array.from(doc.querySelectorAll("img, video"))) {
const src = media.getAttribute("src") || "";
const attachmentId = media.getAttribute(ATTACHMENT_ID_ATTR) || getAttachmentIdFromSrc(src);
const tempFileId = media.getAttribute(TEMP_FILE_ID_ATTR) || getTempFileIdFromSrc(src);
const finalAttachmentId = attachmentId || tempFileId;
if (!finalAttachmentId) {
continue;
}
media.setAttribute(ATTACHMENT_ID_ATTR, finalAttachmentId);
media.removeAttribute(TEMP_FILE_ID_ATTR);
media.setAttribute("src", buildAttachmentIdSrc(finalAttachmentId));
}
return normalizeContent(doc.body.innerHTML);
}
/** 比较附件列表的通用字段,不比较对象引用。 */
export function sameAttachmentList(left?: readonly Attachment[], right?: readonly Attachment[]): boolean {
const leftList = left || [];
const rightList = right || [];
if (leftList.length !== rightList.length) {
return false;
}
for (let i = 0; i < leftList.length; i += 1) {
const leftItem = leftList[i];
const rightItem = rightList[i];
if (!rightItem || leftItem.id !== rightItem.id) {
return false;
}
if ((leftItem.tempFileId || "") !== (rightItem.tempFileId || "")) {
return false;
}
if ((leftItem.accessKey?.value || "") !== (rightItem.accessKey?.value || "")) {
return false;
}
}
return true;
}
+10 -3
View File
@@ -1,11 +1,18 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import type { Article } from "timi-web/editor";
import { WebToolkit } from "timi-web";
import type { Article } from "./types";
export type {
Article,
ArticleContentType,
Attachment,
UploadResult
} from "./types";
export type ArticleEditorExpose = {
submit: () => Promise<Article>;
getPendingMediaCount: () => number;
};
export const ArticleEditor = Toolkit.withInstall(view);
export const ArticleEditor = WebToolkit.withInstall(view);
export default ArticleEditor;
+25 -40
View File
@@ -24,23 +24,24 @@
</template>
<script lang="ts" setup>
import type { Article, ArticleContentType, Attachment, UploadResult } from "timi-web/editor";
import { AttachmentAPI } from "timi-web/editor";
import type { Article, ArticleContentType, Attachment, UploadResult } from "./types";
import { MarkdownEditor } from "timi-web";
import { TiptapEditor } from "../tiptap-editor";
import type { TiptapEditorExpose } from "../tiptap-editor";
import {
ATTACHMENT_ID_ATTR,
TEMP_FILE_ID_ATTR,
buildAttachmentListFromContent,
getAttachmentIdFromSrc,
getTempFileIdFromSrc,
normalizeArticleContentType,
normalizeContent,
normalizeContentForStore,
normalizeRawArticleContent,
sameAttachmentList
} from "timi-web/editor";
} from "./content";
import {
ATTACHMENT_ID_ATTR,
TEMP_FILE_ID_ATTR,
normalizeContent
} from "timi-web/editor";
defineOptions({
name: "ArticleEditor"
@@ -83,39 +84,18 @@ const attachmentMap = computed(() => {
return new Map((props.modelValue?.attachmentList || []).map(item => [item.id, item]));
});
async function defaultUploadImage(file: File) {
return defaultUploadMedia(file);
}
async function defaultUploadVideo(file: File) {
return defaultUploadMedia(file);
}
async function defaultUploadMedia(file: File) {
const tempFileList = await AttachmentAPI.upload([file]);
const tempFileId = tempFileList[0]?.id || "";
if (!tempFileId) {
throw new Error("上传临时文件失败");
}
return {
id: tempFileId,
url: AttachmentAPI.getTempReadURL(tempFileId),
name: file.name
};
}
async function handleUploadImage(file: File) {
if (props.uploadImage) {
return props.uploadImage(file);
if (!props.uploadImage) {
throw new Error("请为 ArticleEditor 配置 uploadImage");
}
return defaultUploadImage(file);
return await props.uploadImage(file);
}
async function handleUploadVideo(file: File) {
if (props.uploadVideo) {
return props.uploadVideo(file);
if (!props.uploadVideo) {
throw new Error("请为 ArticleEditor 配置 uploadVideo");
}
return defaultUploadVideo(file);
return await props.uploadVideo(file);
}
async function resolveAttachmentPreviewUrl(attachmentId: string) {
@@ -126,18 +106,20 @@ async function resolveAttachmentPreviewUrl(attachmentId: string) {
return customUrl;
}
}
const previewUrl = `${attachment?.metadata?.previewUrl || ""}`;
const previewUrl = typeof attachment?.metadata?.previewUrl === "string"
? attachment.metadata.previewUrl
: "";
if (previewUrl) {
return previewUrl;
}
return attachmentId ? AttachmentAPI.getReadURL(attachmentId) : "";
return attachment?.url || "";
}
async function resolveTempPreviewUrl(tempFileId: string) {
if (props.resolveTempUrl) {
return props.resolveTempUrl(tempFileId);
return await props.resolveTempUrl(tempFileId);
}
return AttachmentAPI.getTempReadURL(tempFileId);
return "";
}
async function convertContentForEditor(value?: string) {
@@ -158,7 +140,10 @@ async function convertContentForEditor(value?: string) {
if (tempFileId) {
media.setAttribute(TEMP_FILE_ID_ATTR, tempFileId);
media.setAttribute(ATTACHMENT_ID_ATTR, attachmentId || tempFileId);
media.setAttribute("src", await resolveTempPreviewUrl(tempFileId));
const previewUrl = await resolveTempPreviewUrl(tempFileId);
if (previewUrl) {
media.setAttribute("src", previewUrl);
}
continue;
}
if (!attachmentId) {
@@ -189,7 +174,7 @@ function buildStoredContent(content: string, currentContentType: ArticleContentT
function buildArticleAttachmentList(content: string, currentContentType: ArticleContentType) {
if (currentContentType === "TIP_TAP") {
return buildAttachmentListFromContent(content);
return buildAttachmentListFromContent(content, props.modelValue?.attachmentList);
}
return props.modelValue?.attachmentList || [];
}
@@ -263,7 +248,7 @@ watch(() => props.modelValue?.attachmentList, async (value) => {
if (sameAttachmentList(lastOutgoingAttachmentList.value, value)) {
return;
}
if (sameAttachmentList(buildAttachmentListFromContent(editorContent.value), value)) {
if (sameAttachmentList(buildAttachmentListFromContent(editorContent.value, value), value)) {
return;
}
const nextContent = await convertContentForEditor(props.modelValue?.content);
+26
View File
@@ -0,0 +1,26 @@
import type { UploadResult as EditorUploadResult } from "timi-web/editor";
/** 文章编辑器支持的正文类型。 */
export type ArticleContentType = "TEXT" | "MARKDOWN" | "TIP_TAP" | "TIPTAP";
/** 文章编辑器需要的附件最小结构,允许业务对象携带其他字段。 */
export type Attachment = {
[key: string]: any;
id?: string;
tempFileId?: string;
name?: string;
url?: string;
metadata?: Record<string, any>;
accessKey?: any;
};
/** 文章编辑器需要的文章最小结构,业务对象的其他字段会原样保留。 */
export type Article = {
[key: string]: any;
contentType?: any;
content?: string;
attachmentList?: Attachment[];
};
/** 媒体上传结果。 */
export type UploadResult = EditorUploadResult;
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const ArticleView = Toolkit.withInstall(view);
export const ArticleView = WebToolkit.withInstall(view);
export default ArticleView;
+7 -7
View File
@@ -13,17 +13,15 @@
</template>
<script lang="ts" setup>
import type { Article, Attachment } from "timi-web/editor";
import { AttachmentAPI } from "timi-web/editor";
import type { Article, Attachment } from "../article-editor/types";
import { MarkdownView } from "timi-web";
import { TiptapView } from "../tiptap-view";
import {
ATTACHMENT_ID_ATTR,
getAttachmentIdFromSrc,
normalizeArticleContentType,
normalizeContent,
normalizeRawArticleContent
} from "timi-web/editor";
} from "../article-editor/content";
import { ATTACHMENT_ID_ATTR, normalizeContent } from "timi-web/editor";
defineOptions({
name: "ArticleView"
@@ -69,11 +67,13 @@ async function buildAttachmentPreviewUrl(attachmentId: string) {
return customUrl;
}
}
const previewUrl = `${attachment?.metadata?.previewUrl || ""}`;
const previewUrl = typeof attachment?.metadata?.previewUrl === "string"
? attachment.metadata.previewUrl
: "";
if (previewUrl) {
return previewUrl;
}
return attachmentId ? AttachmentAPI.getReadURL(attachmentId) : "";
return attachment?.url || "";
}
async function buildRenderContent(content?: string) {
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const AuthorizeForm = Toolkit.withInstall(view);
export const AuthorizeForm = WebToolkit.withInstall(view);
export default AuthorizeForm;
+19 -2
View File
@@ -5,8 +5,18 @@
<t-tab-panel :value="Tab.REGISTER" label="注册" />
</t-tabs>
<div class="content">
<login v-if="tabValue == Tab.LOGIN" @login-success="onLoginSuccess" />
<register v-if="tabValue == Tab.REGISTER" @register-success="onRegisterSuccess" />
<login
v-if="tabValue == Tab.LOGIN"
:captcha="props.captcha"
:login="props.login"
@login-success="onLoginSuccess"
/>
<register
v-if="tabValue == Tab.REGISTER"
:captcha="props.captcha"
:register="props.register"
@register-success="onRegisterSuccess"
/>
</div>
</div>
</template>
@@ -15,6 +25,7 @@
import Login from "./login.vue";
import Register from "./register.vue";
import { Emits, useHandler } from "~/components/authorize-form/emits";
import type { CaptchaRequest, LoginHandler, RegisterHandler } from "./types";
import { ref } from "vue";
defineOptions({
@@ -29,6 +40,12 @@ enum Tab {
const emits = defineEmits<Emits>();
const { onLoginSuccess, onRegisterSuccess } = useHandler(emits);
const props = withDefaults(defineProps<{
captcha?: CaptchaRequest;
login?: LoginHandler;
register?: RegisterHandler;
}>(), {});
const tabValue = ref(Tab.LOGIN);
</script>
+30 -9
View File
@@ -6,10 +6,10 @@
<t-form-item label="密码" name="password">
<t-input type="password" v-model="loginRequest.data.password" placeholder="" />
</t-form-item>
<t-form-item label="验证码" name="captcha">
<t-form-item v-if="captcha" label="验证码" name="captcha">
<div class="captcha-box">
<t-input class="captcha" v-model="loginRequest.captcha" placeholder="" />
<captcha :api="CommonAPI.getCaptchaAPI()" :width="90" :height="28" />
<captcha :request="captcha" :width="90" :height="28" @update="onCaptchaUpdate" />
</div>
</t-form-item>
<div class="exec">
@@ -24,10 +24,22 @@
</template>
<script lang="ts" setup>
import { Captcha, CaptchaData, CommonAPI, LoginRequest, UserAPI } from "timi-web";
import { Captcha } from "timi-web";
import { Emits, useHandler } from "~/components/authorize-form/emits";
import type {
CaptchaData,
CaptchaRequest,
CaptchaResult,
LoginHandler,
LoginRequest
} from "./types";
import { MessagePlugin } from "tdesign-vue-next";
const props = defineProps<{
captcha?: CaptchaRequest;
login?: LoginHandler;
}>();
const rules = {
user: [
{
@@ -63,16 +75,25 @@ const loginRequest = reactive<CaptchaData<LoginRequest>>({
}
});
function onCaptchaUpdate(result: CaptchaResult) {
loginRequest.captchaId = result.id;
}
const doSubmit = async () => {
const login = props.login;
if (!login) {
MessagePlugin.error("未配置登录处理函数", 5E3);
return;
}
doSubmitting.value = true;
UserAPI.login(loginRequest).then(async (response) => {
// await userStore.updateToken(response);
try {
await login(loginRequest);
await onLoginSuccess();
} catch (error) {
MessagePlugin.error(String(error), 5E3);
} finally {
doSubmitting.value = false;
}).catch(msg => {
MessagePlugin.error(msg, 5E3);
doSubmitting.value = false;
});
}
};
</script>
+31 -10
View File
@@ -12,10 +12,10 @@
<t-form-item label="邮箱" name="email">
<t-input type="text" v-model="formData.data.email" placeholder="选填" />
</t-form-item>
<t-form-item label="验证码" name="captcha">
<t-form-item v-if="captcha" label="验证码" name="captcha">
<div class="captcha-box">
<t-input class="captcha" v-model="formData.captcha" placeholder="" />
<captcha :api="CommonAPI.getCaptchaAPI()" :width="90" :height="28" />
<captcha :request="captcha" :width="90" :height="28" @update="onCaptchaUpdate" />
</div>
</t-form-item>
<div class="exec">
@@ -30,9 +30,21 @@
</template>
<script lang="ts" setup>
import { Captcha, CaptchaData, CommonAPI, RegisterRequest, UserAPI } from "timi-web";
import { Captcha } from "timi-web";
import { FormRules, MessagePlugin, SubmitContext } from "tdesign-vue-next";
import { Emits, useHandler } from "~/components/authorize-form/emits";
import type {
CaptchaData,
CaptchaRequest,
CaptchaResult,
RegisterHandler,
RegisterRequest
} from "./types";
const props = defineProps<{
captcha?: CaptchaRequest;
register?: RegisterHandler;
}>();
type RegisterForm = {
rePassword: string;
@@ -54,6 +66,10 @@ const formData = reactive<CaptchaData<RegisterForm>>({
}
});
function onCaptchaUpdate(result: CaptchaResult) {
formData.captchaId = result.id;
}
const rules = {
name: [
{
@@ -94,20 +110,25 @@ const rules = {
]
} as FormRules;
const doSubmit = ({validateResult, e}: SubmitContext) => {
const doSubmit = async ({validateResult, e}: SubmitContext) => {
if (e) {
e.preventDefault();
}
if (validateResult === true) {
const register = props.register;
if (!register) {
MessagePlugin.error("未配置注册处理函数", 5E3);
return;
}
doSubmitting.value = true;
UserAPI.register({...formData}).then(async (response) => {
// await userStore.updateToken(response);
try {
await register(formData);
await onRegisterSuccess();
} catch (error) {
MessagePlugin.error(String(error), 5E3);
} finally {
doSubmitting.value = false;
}).catch(msg => {
MessagePlugin.error(msg, 5E3);
doSubmitting.value = false;
});
}
}
};
</script>
+34
View File
@@ -0,0 +1,34 @@
/** 带验证码的通用请求对象。 */
export type CaptchaData<T> = {
captchaId: string;
captcha: string;
data: T;
};
/** 登录表单数据。 */
export type LoginRequest = {
user: string;
password: string;
};
/** 注册表单数据。 */
export type RegisterRequest = {
name: string;
password: string;
email?: string;
};
/** 验证码展示数据。 */
export type CaptchaResult = {
id: string;
data: string;
};
/** 验证码请求函数。 */
export type CaptchaRequest = (width: number, height: number) => Promise<CaptchaResult>;
/** 登录处理函数。 */
export type LoginHandler = (request: CaptchaData<LoginRequest>) => Promise<unknown>;
/** 注册处理函数。 */
export type RegisterHandler = (request: CaptchaData<RegisterRequest>) => Promise<unknown>;
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
import "./style.less";
export type CodeEditorScrollState = {
@@ -21,5 +21,5 @@ export type CodeEditorExpose = {
textareaRef?: HTMLTextAreaElement;
};
export const CodeEditor = Toolkit.withInstall(view);
export const CodeEditor = WebToolkit.withInstall(view);
export default CodeEditor;
+44
View File
@@ -3,6 +3,7 @@ import AuthorizeForm from "~/components/authorize-form";
import RootLayout from "~/components/root-layout";
import UserProfile from "~/components/user-profile";
import UserProfilePopup from "~/components/user-profile/popup";
import UserLevel from "~/components/user-level";
import CodeEditor from "~/components/code-editor";
import TiptapEditor from "~/components/tiptap-editor";
import TiptapView from "~/components/tiptap-view";
@@ -16,6 +17,7 @@ export default [
AuthorizeForm,
UserProfile,
UserProfilePopup,
UserLevel,
CodeEditor,
TiptapEditor,
TiptapView,
@@ -30,6 +32,7 @@ export {
AuthorizeForm,
UserProfile,
UserProfilePopup,
UserLevel,
CodeEditor,
TiptapEditor,
TiptapView,
@@ -54,3 +57,44 @@ export type {
export type {
NotifyEditorExpose
} from "./notify-editor";
export type {
Article,
ArticleContentType,
Attachment,
UploadResult
} from "./article-editor";
export type {
NotifyContentType,
NotifyDetail
} from "./notify-editor";
export type {
CaptchaData,
CaptchaRequest,
CaptchaResult,
LoginHandler,
LoginRequest,
RegisterHandler,
RegisterRequest
} from "./authorize-form/types";
export {
ImageType
} from "./user-profile";
export type {
ImageTypeKey,
UserImageResolver,
UserProfileData,
UserView
} from "./user-profile";
export {
toUserLevel
} from "./user-level";
export type {
UserLevelInfo
} from "./user-level";
+6
View File
@@ -0,0 +1,6 @@
import type { NotifyContentType } from "./types";
/** 将未知通知正文类型归一化为组件支持的类型。 */
export function normalizeNotifyContentType(contentType?: string): NotifyContentType {
return contentType === "TEXT" ? "TEXT" : "TIP_TAP";
}
+5 -3
View File
@@ -1,11 +1,13 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import type { NotifyDetail } from "timi-web/editor";
import { WebToolkit } from "timi-web";
import type { NotifyDetail } from "./types";
export type { NotifyContentType, NotifyDetail } from "./types";
export type NotifyEditorExpose = {
submit: () => Promise<NotifyDetail>;
getPendingMediaCount: () => number;
};
export const NotifyEditor = Toolkit.withInstall(view);
export const NotifyEditor = WebToolkit.withInstall(view);
export default NotifyEditor;
+3 -2
View File
@@ -13,10 +13,11 @@
</template>
<script lang="ts" setup>
import type { Article, ArticleContentType, Attachment, NotifyDetail, UploadResult } from "timi-web/editor";
import type { Article, ArticleContentType, Attachment, UploadResult } from "../article-editor/types";
import type { NotifyDetail } from "./types";
import type { ArticleEditorExpose } from "../article-editor";
import { ArticleEditor } from "../article-editor";
import { normalizeNotifyContentType } from "timi-web/editor";
import { normalizeNotifyContentType } from "./content";
defineOptions({
name: "NotifyEditor"
+15
View File
@@ -0,0 +1,15 @@
import type { Article, Attachment } from "../article-editor/types";
/** 通知内容支持的正文类型。 */
export type NotifyContentType = "TEXT" | "TIP_TAP" | "TIPTAP";
/** 通知编辑器需要的通知最小结构。 */
export type NotifyDetail = {
[key: string]: any;
content?: string;
contentType?: string;
attachmentList?: Attachment[];
};
/** 通知内部复用文章编辑器的对象结构。 */
export type NotifyArticle = Article;
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const NotifyView = Toolkit.withInstall(view);
export const NotifyView = WebToolkit.withInstall(view);
export default NotifyView;
+3 -2
View File
@@ -7,9 +7,10 @@
</template>
<script lang="ts" setup>
import type { Article, ArticleContentType, Attachment, NotifyDetail } from "timi-web/editor";
import type { Article, ArticleContentType, Attachment } from "../article-editor/types";
import type { NotifyDetail } from "../notify-editor/types";
import { ArticleView } from "../article-view";
import { normalizeNotifyContentType } from "timi-web/editor";
import { normalizeNotifyContentType } from "../notify-editor/content";
defineOptions({
name: "NotifyView"
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const RootLayout = Toolkit.withInstall(view);
export const RootLayout = WebToolkit.withInstall(view);
export default RootLayout;
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
import type { TiptapEditorInstance } from "timi-web/editor";
export * from "timi-web/editor";
@@ -15,5 +15,5 @@ export type TiptapEditorExpose = {
editor?: TiptapEditorInstance;
};
export const TiptapEditor = Toolkit.withInstall(view);
export const TiptapEditor = WebToolkit.withInstall(view);
export default TiptapEditor;
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const TiptapView = Toolkit.withInstall(view);
export const TiptapView = WebToolkit.withInstall(view);
export default TiptapView;
Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

+42
View File
@@ -0,0 +1,42 @@
import view from "./index.vue";
import { WebToolkit } from "timi-web";
import type { UserLevelInfo } from "./types";
const LEVEL_EXP = [0, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
function toUserLevel(exp = 0): UserLevelInfo {
const currentExp = Math.max(0, exp);
let value = 0;
for (let index = 0; index < LEVEL_EXP.length; index++) {
if (LEVEL_EXP[index] > currentExp) {
break;
}
value = index;
}
const currentLevelExp = LEVEL_EXP[value];
const nextLevelExp = LEVEL_EXP[value + 1] || currentLevelExp;
const levelExp = nextLevelExp - currentLevelExp;
const percent = levelExp > 0
? Math.min(100, (currentExp - currentLevelExp) / levelExp * 100)
: 100;
return {
value,
percent,
nextLevelUp: Math.max(0, nextLevelExp - currentExp)
};
}
export const UserLevel = WebToolkit.withInstall(view);
export default UserLevel;
export {
toUserLevel
};
export type {
UserLevelInfo
} from "./types";
+25
View File
@@ -0,0 +1,25 @@
<template>
<div class="tui-user-level" />
</template>
<script lang="ts" setup>
defineOptions({
name: "UserLevel"
});
const props = withDefaults(defineProps<{
value: number;
}>(), {});
const { value } = toRefs(props);
const offset = computed(() => -9 * value.value + "px");
</script>
<style lang="less" scoped>
.tui-user-level {
width: 19px;
height: 9px;
background: url("./icon.png");
background-position-y: v-bind(offset);
}
</style>
+9
View File
@@ -0,0 +1,9 @@
type UserLevelInfo = {
value: number;
percent: number;
nextLevelUp: number;
};
export type {
UserLevelInfo
};
+11 -2
View File
@@ -1,5 +1,14 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const UserProfile = Toolkit.withInstall(view);
export const UserProfile = WebToolkit.withInstall(view);
export default UserProfile;
export { ImageType } from "./types";
export type {
ImageTypeKey,
UserImageResolver,
UserProfile as UserProfileData,
UserView
} from "./types";
+45 -7
View File
@@ -2,23 +2,23 @@
<div class="tui-user-profile">
<template v-if="user">
<img
:class="(<any>ImageType)[user.profile.wrapperType]"
:src="UserAPI.getWrapperURL(user.profile)"
:class="getImageClass(user.profile.wrapperType)"
:src="wrapperUrl"
width="320"
alt="背景"
/>
<img
class="avatar"
:class="(<any>ImageType)[user.profile.avatarType]"
:class="getImageClass(user.profile.avatarType)"
width="64"
height="64"
:src="UserAPI.getAvatarURL(user.profile)"
:src="avatarUrl"
alt="头像"
/>
<div class="info">
<div class="name">
<h3 class="value pink" v-text="user.name"></h3>
<user-level :value="Toolkit.toUserLevel(user.profile.exp).value" />
<user-level :value="toUserLevel(user.profile.exp).value" />
</div>
<template v-if="user.profile.sex">
<icon
@@ -43,17 +43,55 @@
</template>
<script lang="ts" setup>
import { Icon, ImageType, Toolkit, UserAPI, UserLevel, UserView } from "timi-web";
import { Icon } from "timi-web";
import { toUserLevel } from "../user-level";
import { ImageType } from "./types";
import type {
ImageTypeKey,
UserImageResolver,
UserView
} from "./types";
defineOptions({
name: "UserProfile"
});
const props = withDefaults(defineProps<{
user?: UserView,
user?: UserView;
resolveAvatarUrl?: UserImageResolver;
resolveWrapperUrl?: UserImageResolver;
}>(), {
});
const { user } = toRefs(props);
const wrapperUrl = ref("");
const avatarUrl = ref("");
async function updateImageUrls(value?: UserView) {
const profile = value?.profile;
wrapperUrl.value = profile?.wrapperUrl || "";
avatarUrl.value = profile?.avatarUrl || "";
if (!profile) {
return;
}
if (props.resolveWrapperUrl) {
wrapperUrl.value = await props.resolveWrapperUrl(profile) || wrapperUrl.value;
}
if (props.resolveAvatarUrl) {
avatarUrl.value = await props.resolveAvatarUrl(profile) || avatarUrl.value;
}
}
watch(() => props.user, async value => await updateImageUrls(value), {
deep: true,
immediate: true
});
function getImageClass(type?: string) {
return type && type in ImageType ? ImageType[type as ImageTypeKey] : "";
}
</script>
<style lang="less" scoped>
+2 -2
View File
@@ -1,5 +1,5 @@
import view from "./index.vue";
import { Toolkit } from "timi-web";
import { WebToolkit } from "timi-web";
export const UserProfilePopup = Toolkit.withInstall(view);
export const UserProfilePopup = WebToolkit.withInstall(view);
export default UserProfilePopup;
+44
View File
@@ -0,0 +1,44 @@
import type { Attachment } from "../article-editor/types";
const ImageType = {
"IR-AUTO": "ir-auto",
"IR-SMOOTH": "ir-smooth",
"IR-PIXELATED": "ir-pixelated",
AUTO: "ir-auto",
SMOOTH: "ir-smooth",
PIXELATED: "ir-pixelated"
} as const;
type ImageTypeKey = keyof typeof ImageType;
type UserProfile = {
avatarType?: string;
description?: string;
exp?: number;
sex?: number;
wrapperType?: string;
avatarUrl?: string;
wrapperUrl?: string;
attachmentList?: Attachment[];
};
type UserView = {
id?: string;
name: string;
profile: UserProfile;
};
type UserImageResolver = (
profile: UserProfile
) => string | undefined | Promise<string | undefined>;
export {
ImageType
};
export type {
ImageTypeKey,
UserImageResolver,
UserProfile,
UserView
};
+1 -2
View File
@@ -1,5 +1,4 @@
import "./assets/style/tencent-cloud.less";
import "./assets/style/tencent-cloud-custom.less";
import "./assets/style/tdesign-custom.less";
import { popupUserStore } from "./store/popupUser";
import "./components/tiptap-content.less";
import "timi-web/style.css";
+2 -1
View File
@@ -1,4 +1,5 @@
import { PopupConfig, PopupType, UserView } from "timi-web";
import { PopupConfig, PopupType } from "timi-web";
import type { UserView } from "~/components/user-profile/types";
const user = ref<UserView>();
+4 -1
View File
@@ -72,7 +72,10 @@ export default defineConfig({
include: [/\.vue$/, /\.md$/]
}),
VueSetupExtend(),
dts(),
dts({
pathsToAliases: false,
aliasesExclude: [/^timi-web\/editor$/]
}),
AutoImport({
imports: [
"vue"