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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EditorProps, EditorExposed } from '../types/editor';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExposed, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
"update:modelValue": (value: string) => any;
|
|
4
|
+
change: (value: string) => any;
|
|
5
|
+
save: () => any;
|
|
6
|
+
focus: () => any;
|
|
7
|
+
blur: () => any;
|
|
8
|
+
drop: (files: File[]) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<EditorProps> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
11
|
+
onChange?: ((value: string) => any) | undefined;
|
|
12
|
+
onSave?: (() => any) | undefined;
|
|
13
|
+
onFocus?: (() => any) | undefined;
|
|
14
|
+
onBlur?: (() => any) | undefined;
|
|
15
|
+
onDrop?: ((files: File[]) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
modelValue: string;
|
|
18
|
+
language: string;
|
|
19
|
+
lineNumbers: boolean;
|
|
20
|
+
hybridMarkdown: boolean;
|
|
21
|
+
vimMode: boolean;
|
|
22
|
+
locale: string | import("..").CustomLocale;
|
|
23
|
+
theme: "light" | "dark";
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
//# sourceMappingURL=UnaEditor.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnaEditor.vue.d.ts","sourceRoot":"","sources":["../../../src/components/UnaEditor.vue"],"names":[],"mappings":"AA0EA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0FlE,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;6EAKhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
import type { EditorProps } from '../types/editor';
|
|
4
|
+
export declare function useEditor(container: Ref<HTMLElement | undefined>, props: EditorProps, emit: {
|
|
5
|
+
(e: 'update:modelValue', value: string): void;
|
|
6
|
+
(e: 'change', value: string): void;
|
|
7
|
+
(e: 'save'): void;
|
|
8
|
+
(e: 'focus'): void;
|
|
9
|
+
(e: 'blur'): void;
|
|
10
|
+
(e: 'drop', files: File[]): void;
|
|
11
|
+
}): {
|
|
12
|
+
editorView: Ref<EditorView | undefined, EditorView | undefined>;
|
|
13
|
+
focus: () => void;
|
|
14
|
+
getSelection: () => string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../../../src/composables/useEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAsD,MAAM,kBAAkB,CAAC;AAMlG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAmCnD,wBAAgB,SAAS,CACvB,SAAS,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,EACvC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE;IACJ,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;CAClC;;;wBA4NwB,MAAM;EAYhC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export declare function useFullscreen(container: Ref<HTMLElement | undefined>): {
|
|
3
|
+
isFullscreen: Ref<boolean, boolean>;
|
|
4
|
+
fullscreenMode: Ref<"browser" | "screen" | null, "browser" | "screen" | null>;
|
|
5
|
+
toggleFullscreen: (mode?: "browser" | "screen") => Promise<void>;
|
|
6
|
+
exitFullscreen: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=useFullscreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFullscreen.d.ts","sourceRoot":"","sources":["../../../src/composables/useFullscreen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEhE,wBAAgB,aAAa,CAAC,SAAS,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC;;;8BAK7B,SAAS,GAAG,QAAQ;;EAoE3D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { type Extension } from '@codemirror/state';
|
|
3
|
+
export declare function moveHybridCursorVertically(view: EditorView, direction: -1 | 1): boolean;
|
|
4
|
+
export declare function createHybridMarkdownExtensions(): Extension;
|
|
5
|
+
//# sourceMappingURL=hybridMarkdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hybridMarkdown.d.ts","sourceRoot":"","sources":["../../../src/extensions/hybridMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAkC,MAAM,kBAAkB,CAAC;AAE1F,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AA6RzD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAqCvF;AAgLD,wBAAgB,8BAA8B,IAAI,SAAS,CAsB1D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const version = "0.1.0";
|
|
2
|
+
export { default as UnaEditor } from './components/UnaEditor.vue';
|
|
3
|
+
export type { EditorProps, EditorEvents, EditorExposed, CustomLocale, Locale, } from './types/editor';
|
|
4
|
+
export { locales, defaultLocale, defineLocale, zhCN, enUS } from './locales';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGlE,YAAY,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,MAAM,GACP,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-US.d.ts","sourceRoot":"","sources":["../../../src/locales/en-US.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import zhCN from './zh-CN';
|
|
2
|
+
import enUS from './en-US';
|
|
3
|
+
import type { CustomLocale } from '../types/editor';
|
|
4
|
+
export declare const locales: {
|
|
5
|
+
'zh-CN': {
|
|
6
|
+
placeholder: string;
|
|
7
|
+
fullscreen: string;
|
|
8
|
+
exitFullscreen: string;
|
|
9
|
+
};
|
|
10
|
+
'en-US': {
|
|
11
|
+
placeholder: string;
|
|
12
|
+
fullscreen: string;
|
|
13
|
+
exitFullscreen: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const defaultLocale = "zh-CN";
|
|
17
|
+
export declare function defineLocale(locale: Record<string, string>): CustomLocale;
|
|
18
|
+
export { zhCN, enUS };
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locales/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,OAAO;;;;;;;;;;;CAGnB,CAAC;AAEF,eAAO,MAAM,aAAa,UAAU,CAAC;AAGrC,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAEzE;AAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh-CN.d.ts","sourceRoot":"","sources":["../../../src/locales/zh-CN.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface EditorProps {
|
|
2
|
+
modelValue: string;
|
|
3
|
+
language?: string;
|
|
4
|
+
lineNumbers?: boolean;
|
|
5
|
+
hybridMarkdown?: boolean;
|
|
6
|
+
vimMode?: boolean;
|
|
7
|
+
locale?: string | CustomLocale;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
theme?: 'light' | 'dark';
|
|
12
|
+
}
|
|
13
|
+
export interface EditorEvents {
|
|
14
|
+
'update:modelValue': (value: string) => void;
|
|
15
|
+
change: (value: string) => void;
|
|
16
|
+
save: () => void;
|
|
17
|
+
focus: () => void;
|
|
18
|
+
blur: () => void;
|
|
19
|
+
drop: (files: File[]) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface EditorExposed {
|
|
22
|
+
focus: () => void;
|
|
23
|
+
getSelection: () => string;
|
|
24
|
+
toggleFullscreen: (mode?: 'browser' | 'screen') => void;
|
|
25
|
+
exitFullscreen: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface CustomLocale {
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
}
|
|
30
|
+
export type Locale = 'zh-CN' | 'en-US' | CustomLocale;
|
|
31
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/types/edit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[data-v-ecb3a052]{position:fixed;inset:0;z-index:9999;background:#fff}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "una-editor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightweight & high-performance Vue 3 editor powered by CodeMirror 6. Supports Hybrid Markdown and Vim mode.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "concurrently \"pnpm:dev:lib\" \"pnpm:dev:playground\" --names \"lib,playground\" --prefix-colors \"cyan,magenta\"",
|
|
21
|
+
"dev:lib": "vite build --watch",
|
|
22
|
+
"dev:playground": "pnpm --filter una-editor-playground dev",
|
|
23
|
+
"build": "vite build && pnpm build:types",
|
|
24
|
+
"build:types": "vue-tsc -p tsconfig.json",
|
|
25
|
+
"build:playground": "pnpm --filter una-editor-playground build",
|
|
26
|
+
"test": "vitest",
|
|
27
|
+
"test:run": "vitest --run",
|
|
28
|
+
"test:ui": "vitest --ui",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"lint:fix": "eslint . --fix",
|
|
31
|
+
"format": "prettier --write .",
|
|
32
|
+
"format:check": "prettier --check .",
|
|
33
|
+
"typecheck": "vue-tsc --noEmit",
|
|
34
|
+
"check": "pnpm typecheck && pnpm lint && pnpm test:run"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vue": "^3.5.25"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@eslint/js": "^10.0.1",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
42
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
43
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
44
|
+
"@vue/test-utils": "^2.4.6",
|
|
45
|
+
"concurrently": "^9.2.1",
|
|
46
|
+
"eslint": "^10.0.3",
|
|
47
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
48
|
+
"jsdom": "^28.1.0",
|
|
49
|
+
"prettier": "^3.8.1",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"typescript-eslint": "^8.56.1",
|
|
52
|
+
"vite": "^7.3.1",
|
|
53
|
+
"vitest": "^4.0.18",
|
|
54
|
+
"vue": "^3.5.29",
|
|
55
|
+
"vue-tsc": "^3.2.5"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [
|
|
58
|
+
"vue",
|
|
59
|
+
"vue3",
|
|
60
|
+
"editor",
|
|
61
|
+
"codemirror",
|
|
62
|
+
"codemirror6",
|
|
63
|
+
"markdown"
|
|
64
|
+
],
|
|
65
|
+
"author": "Charles Tang <charlestang@foxmail.com>",
|
|
66
|
+
"license": "MIT",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "git",
|
|
69
|
+
"url": "git+https://github.com/charlestang/UnaEditor.git"
|
|
70
|
+
},
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/charlestang/UnaEditor/issues"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "https://charlestang.github.io/UnaEditor/",
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@codemirror/commands": "^6.10.2",
|
|
77
|
+
"@codemirror/lang-markdown": "^6.5.0",
|
|
78
|
+
"@codemirror/language": "^6.12.2",
|
|
79
|
+
"@codemirror/search": "^6.6.0",
|
|
80
|
+
"@codemirror/state": "^6.5.4",
|
|
81
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
82
|
+
"@codemirror/view": "^6.39.16",
|
|
83
|
+
"@replit/codemirror-vim": "^6.3.0"
|
|
84
|
+
}
|
|
85
|
+
}
|