@fangzhongya/vue-archive 0.0.75 → 0.0.76
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/dist/node/init.cjs +2 -4
- package/dist/node/init.js +0 -2
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.d.ts +0 -41
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/editor.d.ts +53 -4
- package/dist/packages/components/use/retrie/input/editor/editor.js +68 -20
- package/dist/packages/components/use/retrie/input/editor/editor.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/input/editor/editor.vue.js +7 -7
- package/package.json +1 -1
package/dist/node/init.cjs
CHANGED
|
@@ -33,8 +33,7 @@ __export(init_exports, {
|
|
|
33
33
|
init: () => init
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(init_exports);
|
|
36
|
-
var import_editor = require("monaco-editor/esm/vs/editor/editor.
|
|
37
|
-
var import_editor2 = __toESM(require("monaco-editor/esm/vs/editor/editor.worker?worker"), 1);
|
|
36
|
+
var import_editor = __toESM(require("monaco-editor/esm/vs/editor/editor.worker?worker"), 1);
|
|
38
37
|
var import_json = __toESM(require("monaco-editor/esm/vs/language/json/json.worker?worker"), 1);
|
|
39
38
|
var import_css = __toESM(require("monaco-editor/esm/vs/language/css/css.worker?worker"), 1);
|
|
40
39
|
var import_html = __toESM(require("monaco-editor/esm/vs/language/html/html.worker?worker"), 1);
|
|
@@ -54,10 +53,9 @@ function init() {
|
|
|
54
53
|
if (label === "typescript" || label === "javascript") {
|
|
55
54
|
return new import_ts.default();
|
|
56
55
|
}
|
|
57
|
-
return new
|
|
56
|
+
return new import_editor.default();
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
|
-
import_editor.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
61
59
|
}
|
|
62
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
61
|
0 && (module.exports = {
|
package/dist/node/init.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// packages/node/init.ts
|
|
2
|
-
import { languages } from "monaco-editor/esm/vs/editor/editor.main";
|
|
3
2
|
import editorWorker from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
|
4
3
|
import jsonWorker from "monaco-editor/esm/vs/language/json/json.worker?worker";
|
|
5
4
|
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
@@ -23,7 +22,6 @@ function init() {
|
|
|
23
22
|
return new editorWorker();
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
|
-
languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
27
25
|
}
|
|
28
26
|
export {
|
|
29
27
|
init
|
|
@@ -16,44 +16,3 @@ export declare function getHtml(parent: Element, obj: CreateStateOptions): Edito
|
|
|
16
16
|
export declare function getJson(parent: Element, obj: CreateStateOptions): EditorView;
|
|
17
17
|
export declare function getCss(parent: Element, obj: CreateStateOptions): EditorView;
|
|
18
18
|
export {};
|
|
19
|
-
>): Promise<T[]>;
|
|
20
|
-
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
21
|
-
readonly [Symbol.species]: ArrayConstructor;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
25
|
-
"update:modelValue": (...args: any[]) => void;
|
|
26
|
-
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
27
|
-
modelValue: {
|
|
28
|
-
type: StringConstructor;
|
|
29
|
-
default: string;
|
|
30
|
-
};
|
|
31
|
-
format: {
|
|
32
|
-
type: StringConstructor;
|
|
33
|
-
};
|
|
34
|
-
options: {
|
|
35
|
-
type: {
|
|
36
|
-
(arrayLength: number): string[];
|
|
37
|
-
(...items: string[]): string[];
|
|
38
|
-
new (arrayLength: number): string[];
|
|
39
|
-
new (...items: string[]): string[];
|
|
40
|
-
isArray(arg: any): arg is any[];
|
|
41
|
-
readonly prototype: any[];
|
|
42
|
-
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
43
|
-
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
44
|
-
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
45
|
-
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
46
|
-
of<T>(...items: T[]): T[];
|
|
47
|
-
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
48
|
-
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
49
|
-
readonly [Symbol.species]: ArrayConstructor;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
}>> & Readonly<{
|
|
53
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
54
|
-
}>, {
|
|
55
|
-
modelValue: string;
|
|
56
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
57
|
-
refText: HTMLDivElement;
|
|
58
|
-
}, HTMLDivElement>;
|
|
59
|
-
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("monaco-editor"),i=require("monaco-editor/esm/vs/editor/editor.api"),u=require("vue");function l(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=l(c),g=l(u),a={theme:"vs",value:""},m=(e=[])=>({provideCompletionItems:(r,t)=>({suggestions:e.map(o=>({label:o,kind:n.languages.CompletionItemKind.Text,insertText:"<"+o+">${1:}</"+o+">",insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,detail:o+"组件",range:new n.Range(t.lineNumber,t.column-1,t.lineNumber,t.column)}))}),triggerCharacters:["<","$"]});function p(e){return["props","ctx"].includes(e)?e+".${1:}":e+"(${1:})"}const d=(e=[])=>(e&&e.length>0&&(e=["props","ctx",...Object.keys(g)]),{provideCompletionItems:(r,t)=>({suggestions:e.map(o=>({label:o,kind:n.languages.CompletionItemKind.Text,insertText:p(o),insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,detail:o+"方法",range:new n.Range(t.lineNumber,t.column-1,t.lineNumber,t.column)}))}),triggerCharacters:["$"]});function f(e,r,t){i.languages.typescript.typescriptDefaults.setEagerModelSync(!0);const s=d(t);return i.languages.registerCompletionItemProvider("typescript",s),n.editor.create(e,{...a,value:r,language:"typescript"})}function b(e,r,t){const s=m(t);return i.languages.registerCompletionItemProvider("html",s),n.editor.create(e,{...a,value:r,language:"html"})}function v(e,r,t){return n.editor.create(e,{...a,value:r,language:"json"})}function I(e,r,t){return n.editor.create(e,{...a,value:r,language:"css"})}exports.getCss=I;exports.getHtml=b;exports.getJs=f;exports.getJson=v;
|
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
import * as monaco from 'monaco-editor';
|
|
2
|
-
export declare function getJs(parent: HTMLElement, value: string): monaco.editor.IStandaloneCodeEditor;
|
|
3
|
-
export declare function getHtml(parent: HTMLElement, value: string): monaco.editor.IStandaloneCodeEditor;
|
|
4
|
-
export declare function getJson(parent: HTMLElement, value: string): monaco.editor.IStandaloneCodeEditor;
|
|
5
|
-
export declare function getCss(parent: HTMLElement, value: string): monaco.editor.IStandaloneCodeEditor;
|
|
2
|
+
export declare function getJs(parent: HTMLElement, value: string, options?: string[]): monaco.editor.IStandaloneCodeEditor;
|
|
3
|
+
export declare function getHtml(parent: HTMLElement, value: string, options?: string[]): monaco.editor.IStandaloneCodeEditor;
|
|
4
|
+
export declare function getJson(parent: HTMLElement, value: string, options?: string[]): monaco.editor.IStandaloneCodeEditor;
|
|
5
|
+
export declare function getCss(parent: HTMLElement, value: string, options?: string[]): monaco.editor.IStandaloneCodeEditor;
|
|
6
|
+
...items: string[]): string[];
|
|
7
|
+
isArray(arg: any): arg is any[];
|
|
8
|
+
readonly prototype: any[];
|
|
9
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
10
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
11
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
12
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
13
|
+
of<T>(...items: T[]): T[];
|
|
14
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
15
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
16
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
20
|
+
"update:modelValue": (...args: any[]) => void;
|
|
21
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
22
|
+
modelValue: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
format: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
};
|
|
29
|
+
options: {
|
|
30
|
+
type: {
|
|
31
|
+
(arrayLength: number): string[];
|
|
32
|
+
(...items: string[]): string[];
|
|
33
|
+
new (arrayLength: number): string[];
|
|
34
|
+
new (...items: string[]): string[];
|
|
35
|
+
isArray(arg: any): arg is any[];
|
|
36
|
+
readonly prototype: any[];
|
|
37
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
38
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
39
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
40
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
41
|
+
of<T>(...items: T[]): T[];
|
|
42
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
43
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
44
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}>> & Readonly<{
|
|
48
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
49
|
+
}>, {
|
|
50
|
+
modelValue: string;
|
|
51
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
52
|
+
refText: HTMLDivElement;
|
|
53
|
+
}, HTMLDivElement>;
|
|
54
|
+
export default _default;
|
|
@@ -1,39 +1,87 @@
|
|
|
1
1
|
import * as n from "monaco-editor";
|
|
2
|
-
|
|
2
|
+
import { languages as l } from "monaco-editor/esm/vs/editor/editor.api";
|
|
3
|
+
import * as a from "vue";
|
|
4
|
+
const i = {
|
|
3
5
|
theme: "vs",
|
|
4
6
|
value: ""
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
}, m = (e = []) => ({
|
|
8
|
+
provideCompletionItems: (r, t) => ({ suggestions: e.map((o) => ({
|
|
9
|
+
label: o,
|
|
10
|
+
// 显示名称
|
|
11
|
+
kind: n.languages.CompletionItemKind.Text,
|
|
12
|
+
// 图标类型
|
|
13
|
+
insertText: "<" + o + ">${1:}</" + o + ">",
|
|
14
|
+
//`<${s}>$</${s}>`, // 插入的文本(支持代码片段)
|
|
15
|
+
insertTextRules: n.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
16
|
+
detail: o + "组件",
|
|
17
|
+
// 描述
|
|
18
|
+
range: new n.Range(
|
|
19
|
+
// 定义替换范围(可选)
|
|
20
|
+
t.lineNumber,
|
|
21
|
+
t.column - 1,
|
|
22
|
+
t.lineNumber,
|
|
23
|
+
t.column
|
|
24
|
+
)
|
|
25
|
+
})) }),
|
|
26
|
+
triggerCharacters: ["<", "$"]
|
|
27
|
+
});
|
|
28
|
+
function u(e) {
|
|
29
|
+
return ["props", "ctx"].includes(e) ? e + ".${1:}" : e + "(${1:})";
|
|
30
|
+
}
|
|
31
|
+
const c = (e = []) => (e && e.length > 0 && (e = ["props", "ctx", ...Object.keys(a)]), {
|
|
32
|
+
provideCompletionItems: (r, t) => ({ suggestions: e.map((o) => ({
|
|
33
|
+
label: o,
|
|
34
|
+
// 显示名称
|
|
35
|
+
kind: n.languages.CompletionItemKind.Text,
|
|
36
|
+
// 图标类型
|
|
37
|
+
insertText: u(o),
|
|
38
|
+
insertTextRules: n.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
|
39
|
+
detail: o + "方法",
|
|
40
|
+
// 描述
|
|
41
|
+
range: new n.Range(
|
|
42
|
+
// 定义替换范围(可选)
|
|
43
|
+
t.lineNumber,
|
|
44
|
+
t.column - 1,
|
|
45
|
+
t.lineNumber,
|
|
46
|
+
t.column
|
|
47
|
+
)
|
|
48
|
+
})) }),
|
|
49
|
+
triggerCharacters: ["$"]
|
|
50
|
+
});
|
|
51
|
+
function p(e, r, t) {
|
|
52
|
+
l.typescript.typescriptDefaults.setEagerModelSync(!0);
|
|
53
|
+
const s = c(t);
|
|
54
|
+
return l.registerCompletionItemProvider("typescript", s), n.editor.create(e, {
|
|
55
|
+
...i,
|
|
56
|
+
value: r,
|
|
10
57
|
language: "typescript"
|
|
11
58
|
});
|
|
12
59
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
60
|
+
function d(e, r, t) {
|
|
61
|
+
const s = m(t);
|
|
62
|
+
return l.registerCompletionItemProvider("html", s), n.editor.create(e, {
|
|
63
|
+
...i,
|
|
64
|
+
value: r,
|
|
17
65
|
language: "html"
|
|
18
66
|
});
|
|
19
67
|
}
|
|
20
|
-
function
|
|
68
|
+
function I(e, r, t) {
|
|
21
69
|
return n.editor.create(e, {
|
|
22
|
-
...
|
|
23
|
-
value:
|
|
70
|
+
...i,
|
|
71
|
+
value: r,
|
|
24
72
|
language: "json"
|
|
25
73
|
});
|
|
26
74
|
}
|
|
27
|
-
function
|
|
75
|
+
function f(e, r, t) {
|
|
28
76
|
return n.editor.create(e, {
|
|
29
|
-
...
|
|
30
|
-
value:
|
|
77
|
+
...i,
|
|
78
|
+
value: r,
|
|
31
79
|
language: "css"
|
|
32
80
|
});
|
|
33
81
|
}
|
|
34
82
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
83
|
+
f as getCss,
|
|
84
|
+
d as getHtml,
|
|
85
|
+
p as getJs,
|
|
86
|
+
I as getJson
|
|
39
87
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),m=require("../../../../../directives/adjust/index.cjs"),
|
|
1
|
+
"use strict";const t=require("vue"),m=require("../../../../../directives/adjust/index.cjs"),a=require("./editor.cjs"),d={class:"editor-div"},v=t.defineComponent({__name:"editor",props:{modelValue:{type:String,default:`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
`},format:{type:String},options:{type:Array}},emits:["update:modelValue"],setup(
|
|
5
|
+
`},format:{type:String},options:{type:Array}},emits:["update:modelValue"],setup(n,{emit:u}){const e=n,i=u,l=t.ref(),s=t.shallowRef();function c(){const o=e.modelValue,r=e.options;e.format==="js"||e.format==="ts"?s.value=a.getJs(l.value,o,r):e.format==="css"||e.format==="scss"?s.value=a.getCss(l.value,o):e.format==="html"||e.format==="vue"?s.value=a.getHtml(l.value,o,r):e.format==="json"&&(s.value=a.getJson(l.value,o))}function f(o){o&&i("update:modelValue",o)}return t.watch(()=>e.modelValue,()=>{s.value?.setValue(e.modelValue)}),t.onMounted(()=>{c(),s.value?.onDidBlurEditorText(o=>{if(s.value){const r=s.value.getValue();f(r)}})}),(o,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("div",d,[t.createElementVNode("div",{class:"editor-code",ref_key:"refText",ref:l},null,512)])),[[t.unref(m),{bottom:{}}]])}});module.exports=v;
|
|
@@ -20,14 +20,14 @@ const w = { class: "editor-div" }, C = /* @__PURE__ */ m({
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
emits: ["update:modelValue"],
|
|
23
|
-
setup(
|
|
24
|
-
const e =
|
|
25
|
-
function
|
|
26
|
-
const t = e.modelValue;
|
|
27
|
-
e.format === "js" || e.format === "ts" ? o.value = y(l.value, t) : e.format === "css" || e.format === "scss" ? o.value = B(l.value, t) : e.format === "html" || e.format === "vue" ? o.value = j(l.value, t) : e.format === "json" && (o.value = k(l.value, t));
|
|
23
|
+
setup(s, { emit: r }) {
|
|
24
|
+
const e = s, n = r, l = f(), o = c();
|
|
25
|
+
function u() {
|
|
26
|
+
const t = e.modelValue, a = e.options;
|
|
27
|
+
e.format === "js" || e.format === "ts" ? o.value = y(l.value, t, a) : e.format === "css" || e.format === "scss" ? o.value = B(l.value, t) : e.format === "html" || e.format === "vue" ? o.value = j(l.value, t, a) : e.format === "json" && (o.value = k(l.value, t));
|
|
28
28
|
}
|
|
29
29
|
function i(t) {
|
|
30
|
-
t &&
|
|
30
|
+
t && n("update:modelValue", t);
|
|
31
31
|
}
|
|
32
32
|
return d(
|
|
33
33
|
() => e.modelValue,
|
|
@@ -35,7 +35,7 @@ const w = { class: "editor-div" }, C = /* @__PURE__ */ m({
|
|
|
35
35
|
o.value?.setValue(e.modelValue);
|
|
36
36
|
}
|
|
37
37
|
), v(() => {
|
|
38
|
-
|
|
38
|
+
u(), o.value?.onDidBlurEditorText((t) => {
|
|
39
39
|
if (o.value) {
|
|
40
40
|
const a = o.value.getValue();
|
|
41
41
|
i(a);
|