una-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +105 -0
- package/README.md +105 -0
- package/dist/index.cjs +66 -0
- package/dist/index.mjs +25260 -0
- package/dist/types/components/UnaEditor.vue.d.ts +27 -0
- package/dist/types/components/UnaEditor.vue.d.ts.map +1 -0
- package/dist/types/composables/useEditor.d.ts +16 -0
- package/dist/types/composables/useEditor.d.ts.map +1 -0
- package/dist/types/composables/useFullscreen.d.ts +8 -0
- package/dist/types/composables/useFullscreen.d.ts.map +1 -0
- package/dist/types/extensions/hybridMarkdown.d.ts +5 -0
- package/dist/types/extensions/hybridMarkdown.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/locales/en-US.d.ts +7 -0
- package/dist/types/locales/en-US.d.ts.map +1 -0
- package/dist/types/locales/index.d.ts +19 -0
- package/dist/types/locales/index.d.ts.map +1 -0
- package/dist/types/locales/zh-CN.d.ts +7 -0
- package/dist/types/locales/zh-CN.d.ts.map +1 -0
- package/dist/types/types/editor.d.ts +31 -0
- package/dist/types/types/editor.d.ts.map +1 -0
- package/dist/una-editor.css +1 -0
- package/package.json +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Charles Tang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Una Editor
|
|
2
|
+
|
|
3
|
+
[English](./README.en.md) | [简体中文](./README.md)
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/una-editor)
|
|
6
|
+
[](https://github.com/charlestang/UnaEditor/blob/main/LICENSE)
|
|
7
|
+
[](https://vuejs.org/)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://vitejs.dev/)
|
|
10
|
+
[](https://codemirror.net/)
|
|
11
|
+
[](https://github.com/charlestang/UnaEditor/pulls)
|
|
12
|
+
|
|
13
|
+
A lightweight, high-performance Vue 3 editor component library based on CodeMirror 6.
|
|
14
|
+
|
|
15
|
+
[**Live Demo 🚀**](https://charlestang.github.io/UnaEditor/)
|
|
16
|
+
|
|
17
|
+
## ✨ Features
|
|
18
|
+
|
|
19
|
+
- 🚀 **Powered by CodeMirror 6**: Provides robust foundational editing capabilities and excellent performance.
|
|
20
|
+
- 🎨 **Vue 3 Friendly**: Built entirely with the Composition API, perfectly fitting the Vue ecosystem.
|
|
21
|
+
- 💪 **Type Safe**: 100% written in TypeScript with complete type inference.
|
|
22
|
+
- ⚡️ **Vite Driven**: Lightning-fast local development and build experience.
|
|
23
|
+
- 📝 **Hybrid Markdown Rendering**: Optional hybrid rendering mode offering instant preview of headings, emphasis, code blocks, etc., within the editor.
|
|
24
|
+
- ⌨️ **Vim Mode Support**: Built-in classic Vim modal editing and keybindings.
|
|
25
|
+
- 📦 **Dual Output Formats**: Supports both ESM and CommonJS.
|
|
26
|
+
|
|
27
|
+
## 📦 Installation
|
|
28
|
+
|
|
29
|
+
Using pnpm (recommended):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add una-editor
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or using npm / yarn:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install una-editor
|
|
39
|
+
# or
|
|
40
|
+
yarn add una-editor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🚀 Quick Start
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from 'vue';
|
|
48
|
+
import { UnaEditor } from 'una-editor';
|
|
49
|
+
|
|
50
|
+
const content = ref('# Hello Una Editor!');
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<UnaEditor v-model="content" :hybrid-markdown="true" :vim-mode="false" />
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 📖 API Documentation
|
|
59
|
+
|
|
60
|
+
For detailed information on component properties (Props), events (Events), exposed methods (Methods), etc., please refer to our **[API Reference](./docs/api.en.md)**.
|
|
61
|
+
|
|
62
|
+
## 🛠️ Local Development
|
|
63
|
+
|
|
64
|
+
After cloning the project, you can start the local development environment and Playground using the following commands:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Install dependencies
|
|
68
|
+
pnpm install
|
|
69
|
+
|
|
70
|
+
# Start local development and Playground
|
|
71
|
+
pnpm dev
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Visit `http://localhost:5173` to see the local debugging effect.
|
|
75
|
+
|
|
76
|
+
### Other Useful Commands
|
|
77
|
+
|
|
78
|
+
- `pnpm build`: Build production bundles (dist)
|
|
79
|
+
- `pnpm test`: Run Vitest unit tests
|
|
80
|
+
- `pnpm lint`: Run ESLint code checks
|
|
81
|
+
- `pnpm format`: Run Prettier code formatting
|
|
82
|
+
|
|
83
|
+
## 📁 Project Structure
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
una-editor/
|
|
87
|
+
├── src/ # Core component source code
|
|
88
|
+
├── playground/ # Local debugging environment (Vite App)
|
|
89
|
+
├── docs/ # Project documentation
|
|
90
|
+
├── test/ # Test files
|
|
91
|
+
├── dist/ # Build output directory
|
|
92
|
+
└── openspec/ # OpenSpec change and specification management
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 🤝 Contributing
|
|
96
|
+
|
|
97
|
+
Pull Requests and Issues discussing new features or bugs are highly welcome. Before submitting code, please ensure:
|
|
98
|
+
|
|
99
|
+
1. All checks pass by running `pnpm lint` and `pnpm test`.
|
|
100
|
+
2. Follow existing code formatting and [Conventional Commits](https://www.conventionalcommits.org/) message formats.
|
|
101
|
+
3. For major feature changes, please refer to the design specification process in the `openspec/` directory first.
|
|
102
|
+
|
|
103
|
+
## 📄 License
|
|
104
|
+
|
|
105
|
+
This project is open-sourced under the [MIT License](./LICENSE).
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Una Editor
|
|
2
|
+
|
|
3
|
+
[English](./README.en.md) | [简体中文](./README.md)
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/una-editor)
|
|
6
|
+
[](https://github.com/charlestang/UnaEditor/blob/main/LICENSE)
|
|
7
|
+
[](https://vuejs.org/)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://vitejs.dev/)
|
|
10
|
+
[](https://codemirror.net/)
|
|
11
|
+
[](https://github.com/charlestang/UnaEditor/pulls)
|
|
12
|
+
|
|
13
|
+
基于 CodeMirror 6 构建的轻量级、高性能 Vue 3 编辑器组件库。
|
|
14
|
+
|
|
15
|
+
[**在线演示 (Live Demo) 🚀**](https://charlestang.github.io/UnaEditor/)
|
|
16
|
+
|
|
17
|
+
## ✨ 特性
|
|
18
|
+
|
|
19
|
+
- 🚀 **基于 CodeMirror 6**:提供强大的底层编辑能力与优异的性能。
|
|
20
|
+
- 🎨 **Vue 3 友好**:完全基于 Composition API 构建,完美契合 Vue 生态。
|
|
21
|
+
- 💪 **类型安全**:100% TypeScript 编写,提供完整的类型推导。
|
|
22
|
+
- ⚡️ **Vite 驱动**:极速的本地开发与构建体验。
|
|
23
|
+
- 📝 **Hybrid Markdown 渲染**:可选的混合渲染模式,在编辑态即可获得标题、强调、代码块等元素的即时预览。
|
|
24
|
+
- ⌨️ **Vim 模式支持**:内置经典的 Vim 模态编辑与键位绑定。
|
|
25
|
+
- 📦 **双格式输出**:同时支持 ESM 和 CommonJS。
|
|
26
|
+
|
|
27
|
+
## 📦 安装
|
|
28
|
+
|
|
29
|
+
使用 pnpm (推荐):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add una-editor
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
或使用 npm / yarn:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install una-editor
|
|
39
|
+
# 或
|
|
40
|
+
yarn add una-editor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 🚀 快速开始
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from 'vue';
|
|
48
|
+
import { UnaEditor } from 'una-editor';
|
|
49
|
+
|
|
50
|
+
const content = ref('# Hello Una Editor!');
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<UnaEditor v-model="content" :hybrid-markdown="true" :vim-mode="false" />
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 📖 API 文档
|
|
59
|
+
|
|
60
|
+
关于详细的组件属性 (Props)、事件 (Events)、对外暴露的方法 (Methods) 等内容,请查阅我们的 **[API 手册](./docs/api.md)**。
|
|
61
|
+
|
|
62
|
+
## 🛠️ 本地开发
|
|
63
|
+
|
|
64
|
+
克隆项目后,你可以通过以下命令在本地启动开发环境和 Playground:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# 安装依赖
|
|
68
|
+
pnpm install
|
|
69
|
+
|
|
70
|
+
# 启动本地开发与 Playground
|
|
71
|
+
pnpm dev
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
访问 `http://localhost:5173` 即可查看本地调试效果。
|
|
75
|
+
|
|
76
|
+
### 其他常用命令
|
|
77
|
+
|
|
78
|
+
- `pnpm build`: 构建生产包 (dist)
|
|
79
|
+
- `pnpm test`: 运行 Vitest 单元测试
|
|
80
|
+
- `pnpm lint`: 运行 ESLint 代码检查
|
|
81
|
+
- `pnpm format`: 运行 Prettier 格式化代码
|
|
82
|
+
|
|
83
|
+
## 📁 项目结构
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
una-editor/
|
|
87
|
+
├── src/ # 组件核心源码
|
|
88
|
+
├── playground/ # 本地调试演示环境 (Vite App)
|
|
89
|
+
├── docs/ # 项目文档
|
|
90
|
+
├── test/ # 测试文件
|
|
91
|
+
├── dist/ # 构建输出目录
|
|
92
|
+
└── openspec/ # OpenSpec 变更与规范管理
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 🤝 参与贡献
|
|
96
|
+
|
|
97
|
+
欢迎提交 Pull Request 或开设 Issue 讨论新特性与 Bug。在提交代码前,请确保:
|
|
98
|
+
|
|
99
|
+
1. 运行 `pnpm lint` 和 `pnpm test` 通过所有检查。
|
|
100
|
+
2. 遵循现有的代码规范与 [Conventional Commits](https://www.conventionalcommits.org/) 提交信息格式。
|
|
101
|
+
3. 较大的功能变更,请先查阅 `openspec/` 目录下的设计规范流程。
|
|
102
|
+
|
|
103
|
+
## 📄 开源协议
|
|
104
|
+
|
|
105
|
+
本项目基于 [MIT License](./LICENSE) 开源。
|