@fangzhongya/vue-archive 0.0.72 → 0.0.73
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/packages/components/use/code.d.ts +17 -25
- package/dist/packages/components/use/edit.cjs +7 -7
- package/dist/packages/components/use/edit.js +14 -12
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.cjs +1 -1
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.d.ts +4 -1
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.js +49 -31
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.js +28 -21
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/editor.d.ts +5 -5
- package/dist/packages/components/use/retrie/input/editor/editor.js +11 -11
- package/dist/packages/components/use/retrie/input/editor/editor.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/input/editor/editor.vue.js +12 -9
- package/dist/packages/components/use/retrie/input/editor/init.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/init.d.ts +0 -3
- package/dist/packages/components/use/retrie/input/editor/init.js +11 -14
- package/dist/packages/components/use/retrie/input/index.d.ts +36 -0
- package/dist/packages/components/use/retrie/input/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/input/index.vue.js +22 -17
- package/package.json +4 -3
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default(): string;
|
|
19
|
-
};
|
|
20
|
-
}>> & Readonly<{
|
|
21
|
-
onRefresh?: ((...args: any[]) => any) | undefined;
|
|
22
|
-
}>, {
|
|
23
|
-
html: string;
|
|
24
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
25
|
-
export default _default;
|
|
1
|
+
import { ObjStr, ObjUnk } from '../../config';
|
|
2
|
+
import { SpecObjs, Spec } from '../../utils/index';
|
|
3
|
+
export declare function getHmtl(propsname: string, param: {
|
|
4
|
+
[key: string]: SpecObjs[];
|
|
5
|
+
}, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr, exposeText?: ObjUnk): Promise<string>;
|
|
6
|
+
export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string | Promise<string>;
|
|
7
|
+
type SelectsObj = {
|
|
8
|
+
label: string;
|
|
9
|
+
prop: unknown;
|
|
10
|
+
};
|
|
11
|
+
export declare function getSpecType(val: Spec): {
|
|
12
|
+
arr: SelectsObj[];
|
|
13
|
+
type: string;
|
|
14
|
+
dataType: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare function getDefaultValue(obj: Spec, is?: boolean): any;
|
|
17
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),_=require("./code.vue.cjs"),f=require("./retrie/input/index.vue.cjs");;/* empty css */const g=require("./effect.vue.cjs"),d=require("./util.cjs");function b(c){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const
|
|
2
|
-
${
|
|
1
|
+
"use strict";const e=require("vue"),_=require("./code.vue.cjs"),f=require("./retrie/input/index.vue.cjs");;/* empty css */const g=require("./effect.vue.cjs"),d=require("./util.cjs");function b(c){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(a,l,u.get?u:{enumerable:!0,get:()=>c[l]})}}return a.default=c,Object.freeze(a)}const h=b(e),j=e.defineComponent({props:{value:{type:Object},param:{type:Object}},data(){return{template:"",script:"",style:"",vueHtml:""}},setup(c){function a(s){const r=document.getElementsByTagName("head")[0],i="data-vite-dev-id",o=s+".css",p=r.querySelector(`style[${i}="${o}"]`);if(p)return p;{let t=document.createElement("style");return t.appendChild(document.createTextNode("")),t.setAttribute("type","text/css"),t.setAttribute(i,o),r.appendChild(t),t}}async function l(s,r="",i){const o=[],p=c.value?.name;let t="";Object.keys(h).forEach(y=>{r.includes(y+"(")&&o.push(y)}),o.length>0&&(t=`import { ${o.join(" , ")} } from 'vue';`);let m=`<template>
|
|
2
|
+
${s}
|
|
3
3
|
</template>`;m=await d.prettierHtml(m);let v=`${t}
|
|
4
4
|
export default {
|
|
5
5
|
setup(props, ctx) {
|
|
6
|
-
${
|
|
6
|
+
${r}
|
|
7
7
|
}
|
|
8
8
|
}`;return v=await d.prettierJs(v),`<!--${p}-->
|
|
9
9
|
${m}
|
|
@@ -11,8 +11,8 @@ ${m}
|
|
|
11
11
|
${v}
|
|
12
12
|
<\/script>
|
|
13
13
|
<style>
|
|
14
|
-
${
|
|
14
|
+
${i}
|
|
15
15
|
</style>
|
|
16
|
-
`}function u(r,
|
|
17
|
-
const { ${
|
|
18
|
-
${
|
|
16
|
+
`}function u(s,r,i){try{const o=Object.keys(h);return new Function("props","ctx","vue",` "use strict";
|
|
17
|
+
const { ${o.join(",")} } = vue;
|
|
18
|
+
${s}; `)(r,i,h)}catch(o){console.error("Code block execution failed:",o)}}const n=e.ref(null);return e.onMounted(()=>{n.value=a(c.value?.key)}),{getHmtlVue:l,getCodeBlock:u,style:n}},render(c,a,l,u,n){const s=l.value||{};let r="div";s.component?r=e.defineAsyncComponent(s.component):s.name&&(r=e.resolveComponent(s.name));const i={};i[s.name]=r;const o=async()=>{const t=await u.getHmtlVue(n.template,n.script,n.style);n.vueHtml=t},p=()=>{u.style.innerHTML=n.style,o()};return e.h("div",{class:"code-edit"},[e.h("div",{class:"edit-effect use"},[e.h(g,{class:"use-component"},{default:()=>e.h(e.defineComponent({components:i,setup(t,m){return u.getCodeBlock(n.script,t,m)},template:n.template||"<div></div>"}))}),e.h(_,{html:n.vueHtml,name:s.name+"_edit",onRefresh:o})]),e.h("div",{class:"edit-input"},[e.h("div",{class:"but-div",onClick:p},"运行"),e.h("div",{},[e.h("div",{},"template"),e.h("div",{},e.h(f,{format:"html",check:t=>t,options:[s.name],modelValue:n.template,"onUpdate:modelValue":async t=>{n.template=await d.prettierHtml(t)}}))]),e.h("div",{},[e.h("div",{},"script"),e.h("div",{},"setup(props, ctx)"),e.h("div",{},e.h(f,{format:"js",check:t=>t,options:["props","ctx"],modelValue:n.script,"onUpdate:modelValue":async t=>{n.script=await d.prettierJs(t)}}))]),e.h("div",{},[e.h("div",{},"style"),e.h("div",{},e.h(f,{format:"css",check:t=>t,modelValue:n.style,"onUpdate:modelValue":async t=>{n.style=await d.prettierCss(t)}}))])])])}});module.exports=j;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as d from "vue";
|
|
2
|
-
import { defineComponent as h, defineAsyncComponent as C, resolveComponent as g, h as t, ref as
|
|
3
|
-
import
|
|
2
|
+
import { defineComponent as h, defineAsyncComponent as C, resolveComponent as g, h as t, ref as x, onMounted as b } from "vue";
|
|
3
|
+
import j from "./code.vue.js";
|
|
4
4
|
import v from "./retrie/input/index.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import H from "./effect.vue.js";
|
|
@@ -25,7 +25,7 @@ const U = h({
|
|
|
25
25
|
vueHtml: ""
|
|
26
26
|
};
|
|
27
27
|
},
|
|
28
|
-
setup(
|
|
28
|
+
setup(a) {
|
|
29
29
|
function f(o) {
|
|
30
30
|
const c = document.getElementsByTagName("head")[0], r = "data-vite-dev-id", s = o + ".css", l = c.querySelector(`style[${r}="${s}"]`);
|
|
31
31
|
if (l)
|
|
@@ -35,8 +35,8 @@ const U = h({
|
|
|
35
35
|
return e.appendChild(document.createTextNode("")), e.setAttribute("type", "text/css"), e.setAttribute(r, s), c.appendChild(e), e;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function
|
|
39
|
-
const s = [], l =
|
|
38
|
+
async function u(o, c = "", r) {
|
|
39
|
+
const s = [], l = a.value?.name;
|
|
40
40
|
let e = "";
|
|
41
41
|
Object.keys(d).forEach((y) => {
|
|
42
42
|
c.includes(y + "(") && s.push(y);
|
|
@@ -76,17 +76,17 @@ ${r}
|
|
|
76
76
|
console.error("Code block execution failed:", s);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const n =
|
|
80
|
-
return
|
|
81
|
-
n.value = f(
|
|
79
|
+
const n = x(null);
|
|
80
|
+
return b(() => {
|
|
81
|
+
n.value = f(a.value?.key);
|
|
82
82
|
}), {
|
|
83
|
-
getHmtlVue:
|
|
83
|
+
getHmtlVue: u,
|
|
84
84
|
getCodeBlock: i,
|
|
85
85
|
style: n
|
|
86
86
|
};
|
|
87
87
|
},
|
|
88
|
-
render(
|
|
89
|
-
const o =
|
|
88
|
+
render(a, f, u, i, n) {
|
|
89
|
+
const o = u.value || {};
|
|
90
90
|
let c = "div";
|
|
91
91
|
o.component ? c = C(o.component) : o.name && (c = g(o.name));
|
|
92
92
|
const r = {};
|
|
@@ -134,7 +134,7 @@ ${r}
|
|
|
134
134
|
)
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
|
-
t(
|
|
137
|
+
t(j, {
|
|
138
138
|
html: n.vueHtml,
|
|
139
139
|
name: o.name + "_edit",
|
|
140
140
|
onRefresh: s
|
|
@@ -163,6 +163,7 @@ ${r}
|
|
|
163
163
|
t(v, {
|
|
164
164
|
format: "html",
|
|
165
165
|
check: (e) => e,
|
|
166
|
+
options: [o.name],
|
|
166
167
|
modelValue: n.template,
|
|
167
168
|
"onUpdate:modelValue": async (e) => {
|
|
168
169
|
n.template = await $(e);
|
|
@@ -179,6 +180,7 @@ ${r}
|
|
|
179
180
|
t(v, {
|
|
180
181
|
format: "js",
|
|
181
182
|
check: (e) => e,
|
|
183
|
+
options: ["props", "ctx"],
|
|
182
184
|
modelValue: n.script,
|
|
183
185
|
"onUpdate:modelValue": async (e) => {
|
|
184
186
|
n.script = await k(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@codemirror/view"),l=require("@codemirror/lang-javascript"),g=require("@codemirror/lang-html"),m=require("@codemirror/lang-json"),d=require("@codemirror/lang-css"),q=require("@codemirror/state"),E=require("codemirror"),S=require("@codemirror/autocomplete");function u(t){if(t){const e=t.map(n=>({label:n}));return n=>{let o=n.matchBefore(/\w*/);return!o||o.from==o.to&&!n.explicit?null:{from:o.from,options:e}}}return null}const s=(t,{onUpdate:e,onChange:c,onFocus:n,onBlur:o,value:a,options:f})=>(u(f),q.EditorState.create({doc:a,extensions:[...t,S.autocompletion({}),E.basicSetup,i.EditorView.updateListener.of(r=>{e&&e(r),r.docChanged&&c&&c(r.state.doc.toString(),r),r.focusChanged&&(r.view.hasFocus?n&&n(r):o&&o(r))})]}));function w(t,e){return new i.EditorView({state:s([l.javascript()],e),parent:t})}function J(t,e){return new i.EditorView({state:s([g.html()],e),parent:t})}function V(t,e){return new i.EditorView({state:s([m.json()],e),parent:t})}function b(t,e){return new i.EditorView({state:s([d.css()],e),parent:t})}exports.createEditorState=s;exports.getCss=b;exports.getHtml=J;exports.getJs=w;exports.getJson=V;exports.getOverride=u;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { EditorView, ViewUpdate } from '@codemirror/view';
|
|
2
2
|
import { EditorState, Extension, EditorStateConfig } from '@codemirror/state';
|
|
3
|
+
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
3
4
|
interface CreateStateOptions extends EditorStateConfig {
|
|
4
5
|
onChange?(doc: string, viewUpdate: ViewUpdate): void;
|
|
5
6
|
onUpdate?(viewUpdate: ViewUpdate): void;
|
|
6
7
|
onFocus?(viewUpdate: ViewUpdate): void;
|
|
7
8
|
onBlur?(viewUpdate: ViewUpdate): void;
|
|
8
9
|
value: string;
|
|
10
|
+
options?: string[];
|
|
9
11
|
}
|
|
10
|
-
export declare
|
|
12
|
+
export declare function getOverride(options?: string[]): ((context: CompletionContext) => CompletionResult | null) | null;
|
|
13
|
+
export declare const createEditorState: (extensions: Extension[], { onUpdate, onChange, onFocus, onBlur, value, options }: CreateStateOptions) => EditorState;
|
|
11
14
|
export declare function getJs(parent: Element, obj: CreateStateOptions): EditorView;
|
|
12
15
|
export declare function getHtml(parent: Element, obj: CreateStateOptions): EditorView;
|
|
13
16
|
export declare function getJson(parent: Element, obj: CreateStateOptions): EditorView;
|
|
@@ -1,56 +1,74 @@
|
|
|
1
|
-
import { EditorView as
|
|
1
|
+
import { EditorView as f } from "@codemirror/view";
|
|
2
2
|
import { javascript as c } from "@codemirror/lang-javascript";
|
|
3
|
-
import { html as
|
|
4
|
-
import { json as
|
|
5
|
-
import { css as
|
|
6
|
-
import { EditorState as
|
|
3
|
+
import { html as a } from "@codemirror/lang-html";
|
|
4
|
+
import { json as l } from "@codemirror/lang-json";
|
|
5
|
+
import { css as p } from "@codemirror/lang-css";
|
|
6
|
+
import { EditorState as g } from "@codemirror/state";
|
|
7
7
|
import { basicSetup as h } from "codemirror";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { autocompletion as S } from "@codemirror/autocomplete";
|
|
9
|
+
function d(t) {
|
|
10
|
+
if (t) {
|
|
11
|
+
const r = t.map((n) => ({
|
|
12
|
+
label: n
|
|
13
|
+
}));
|
|
14
|
+
return (n) => {
|
|
15
|
+
let e = n.matchBefore(/\w*/);
|
|
16
|
+
return !e || e.from == e.to && !n.explicit ? null : {
|
|
17
|
+
from: e.from,
|
|
18
|
+
options: r
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const i = (t, { onUpdate: r, onChange: m, onFocus: n, onBlur: e, value: s, options: u }) => (d(u), g.create({
|
|
25
|
+
doc: s,
|
|
10
26
|
extensions: [
|
|
11
|
-
...
|
|
27
|
+
...t,
|
|
28
|
+
S({}),
|
|
12
29
|
h,
|
|
13
|
-
|
|
14
|
-
|
|
30
|
+
f.updateListener.of((o) => {
|
|
31
|
+
r && r(o), o.docChanged && m && m(o.state.doc.toString(), o), o.focusChanged && (o.view.hasFocus ? n && n(o) : e && e(o));
|
|
15
32
|
})
|
|
16
33
|
]
|
|
17
|
-
});
|
|
18
|
-
function
|
|
19
|
-
return new
|
|
34
|
+
}));
|
|
35
|
+
function L(t, r) {
|
|
36
|
+
return new f({
|
|
20
37
|
// 状态
|
|
21
|
-
state: i([c()],
|
|
38
|
+
state: i([c()], r),
|
|
22
39
|
// 绑定元素
|
|
23
|
-
parent:
|
|
40
|
+
parent: t
|
|
24
41
|
});
|
|
25
42
|
}
|
|
26
|
-
function
|
|
27
|
-
return new
|
|
43
|
+
function O(t, r) {
|
|
44
|
+
return new f({
|
|
28
45
|
// 状态
|
|
29
|
-
state: i([
|
|
46
|
+
state: i([a()], r),
|
|
30
47
|
// 绑定元素
|
|
31
|
-
parent:
|
|
48
|
+
parent: t
|
|
32
49
|
});
|
|
33
50
|
}
|
|
34
|
-
function
|
|
35
|
-
return new
|
|
51
|
+
function V(t, r) {
|
|
52
|
+
return new f({
|
|
36
53
|
// 状态
|
|
37
|
-
state: i([
|
|
54
|
+
state: i([l()], r),
|
|
38
55
|
// 绑定元素
|
|
39
|
-
parent:
|
|
56
|
+
parent: t
|
|
40
57
|
});
|
|
41
58
|
}
|
|
42
|
-
function
|
|
43
|
-
return new
|
|
59
|
+
function k(t, r) {
|
|
60
|
+
return new f({
|
|
44
61
|
// 状态
|
|
45
|
-
state: i([
|
|
62
|
+
state: i([p()], r),
|
|
46
63
|
// 绑定元素
|
|
47
|
-
parent:
|
|
64
|
+
parent: t
|
|
48
65
|
});
|
|
49
66
|
}
|
|
50
67
|
export {
|
|
51
68
|
i as createEditorState,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
k as getCss,
|
|
70
|
+
O as getHtml,
|
|
71
|
+
L as getJs,
|
|
72
|
+
V as getJson,
|
|
73
|
+
d as getOverride
|
|
56
74
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),f=require("../../../../../directives/adjust/index.cjs"),
|
|
1
|
+
"use strict";const t=require("vue"),f=require("../../../../../directives/adjust/index.cjs"),i=require("./codemirror.cjs"),v={class:"codemirror-div"},p=t.defineComponent({__name:"codemirror",props:{modelValue:{type:String,default:`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
`},format:{type:String}},emits:["update:modelValue"],setup(
|
|
5
|
+
`},format:{type:String},options:{type:Array}},emits:["update:modelValue"],setup(c,{emit:u}){const e=c,m=u,n=t.ref(),r=t.ref();function a(o){const l=o.view.state.doc.toString().trim();l&&m("update:modelValue",l)}function d(){let o=e.modelValue,s=e.options;e.format==="js"||e.format==="ts"?r.value=i.getJs(n.value,{value:o,onBlur:a,options:s}):e.format==="css"||e.format==="scss"?r.value=i.getCss(n.value,{value:o,onBlur:a,options:s}):e.format==="html"||e.format==="vue"?r.value=i.getHtml(n.value,{value:o,onBlur:a,options:s}):e.format==="json"&&(r.value=i.getJson(n.value,{value:o,onBlur:a,options:s}))}return t.watch(()=>e.modelValue,()=>{r.value?.dispatch({changes:{from:0,to:r.value?.state.doc.length,insert:e.modelValue}})}),t.onMounted(()=>{d()}),(o,s)=>t.withDirectives((t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("div",{class:"codemirror-code",ref_key:"refText",ref:n},null,512)])),[[t.unref(f),{bottom:{}}]])}});module.exports=p;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as f, ref as
|
|
1
|
+
import { defineComponent as f, ref as n, watch as d, onMounted as v, withDirectives as p, createElementBlock as g, openBlock as _, createElementVNode as h, unref as V } from "vue";
|
|
2
2
|
import w from "../../../../../directives/adjust/index.js";
|
|
3
|
-
import { getJs as
|
|
4
|
-
const B = { class: "codemirror-div" },
|
|
3
|
+
import { getJs as y, getCss as x, getHtml as j, getJson as k } from "./codemirror.js";
|
|
4
|
+
const B = { class: "codemirror-div" }, J = /* @__PURE__ */ f({
|
|
5
5
|
__name: "codemirror",
|
|
6
6
|
props: {
|
|
7
7
|
modelValue: {
|
|
@@ -14,29 +14,36 @@ const B = { class: "codemirror-div" }, T = /* @__PURE__ */ f({
|
|
|
14
14
|
},
|
|
15
15
|
format: {
|
|
16
16
|
type: String
|
|
17
|
+
},
|
|
18
|
+
options: {
|
|
19
|
+
type: Array
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
emits: ["update:modelValue"],
|
|
20
|
-
setup(
|
|
21
|
-
const e =
|
|
23
|
+
setup(i, { emit: m }) {
|
|
24
|
+
const e = i, c = m, s = n(), o = n();
|
|
22
25
|
function a(t) {
|
|
23
|
-
const
|
|
24
|
-
|
|
26
|
+
const l = t.view.state.doc.toString().trim();
|
|
27
|
+
l && c("update:modelValue", l);
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
let t = e.modelValue;
|
|
28
|
-
e.format === "js" || e.format === "ts" ? o.value =
|
|
29
|
+
function u() {
|
|
30
|
+
let t = e.modelValue, r = e.options;
|
|
31
|
+
e.format === "js" || e.format === "ts" ? o.value = y(s.value, {
|
|
29
32
|
value: t,
|
|
30
|
-
onBlur: a
|
|
31
|
-
|
|
33
|
+
onBlur: a,
|
|
34
|
+
options: r
|
|
35
|
+
}) : e.format === "css" || e.format === "scss" ? o.value = x(s.value, {
|
|
32
36
|
value: t,
|
|
33
|
-
onBlur: a
|
|
34
|
-
|
|
37
|
+
onBlur: a,
|
|
38
|
+
options: r
|
|
39
|
+
}) : e.format === "html" || e.format === "vue" ? o.value = j(s.value, {
|
|
35
40
|
value: t,
|
|
36
|
-
onBlur: a
|
|
37
|
-
|
|
41
|
+
onBlur: a,
|
|
42
|
+
options: r
|
|
43
|
+
}) : e.format === "json" && (o.value = k(s.value, {
|
|
38
44
|
value: t,
|
|
39
|
-
onBlur: a
|
|
45
|
+
onBlur: a,
|
|
46
|
+
options: r
|
|
40
47
|
}));
|
|
41
48
|
}
|
|
42
49
|
return d(
|
|
@@ -51,12 +58,12 @@ const B = { class: "codemirror-div" }, T = /* @__PURE__ */ f({
|
|
|
51
58
|
});
|
|
52
59
|
}
|
|
53
60
|
), v(() => {
|
|
54
|
-
|
|
55
|
-
}), (t,
|
|
61
|
+
u();
|
|
62
|
+
}), (t, r) => p((_(), g("div", B, [
|
|
56
63
|
h("div", {
|
|
57
64
|
class: "codemirror-code",
|
|
58
65
|
ref_key: "refText",
|
|
59
|
-
ref:
|
|
66
|
+
ref: s
|
|
60
67
|
}, null, 512)
|
|
61
68
|
])), [
|
|
62
69
|
[V(w), {
|
|
@@ -66,5 +73,5 @@ const B = { class: "codemirror-div" }, T = /* @__PURE__ */ f({
|
|
|
66
73
|
}
|
|
67
74
|
});
|
|
68
75
|
export {
|
|
69
|
-
|
|
76
|
+
J as default
|
|
70
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("monaco-editor");function u(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,c.get?c:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=u(a),o={theme:"vs",value:""};function g(e,t){return r.editor.create(e,{...o,value:t,language:"typescript"})}function s(e,t){return r.editor.create(e,{...o,value:t,language:"html"})}function i(e,t){return r.editor.create(e,{...o,value:t,language:"json"})}function l(e,t){return r.editor.create(e,{...o,value:t,language:"css"})}exports.getCss=l;exports.getHtml=s;exports.getJs=g;exports.getJson=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function getJs(parent: HTMLElement, value: string): editor.IStandaloneCodeEditor;
|
|
3
|
-
export declare function getHtml(parent: HTMLElement, value: string): editor.IStandaloneCodeEditor;
|
|
4
|
-
export declare function getJson(parent: HTMLElement, value: string): editor.IStandaloneCodeEditor;
|
|
5
|
-
export declare function getCss(parent: HTMLElement, value: string): editor.IStandaloneCodeEditor;
|
|
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;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as n from "monaco-editor";
|
|
2
2
|
const r = {
|
|
3
3
|
theme: "vs",
|
|
4
4
|
value: ""
|
|
5
5
|
};
|
|
6
|
-
function
|
|
7
|
-
return n.create(e, {
|
|
6
|
+
function o(e, t) {
|
|
7
|
+
return n.editor.create(e, {
|
|
8
8
|
...r,
|
|
9
9
|
value: t,
|
|
10
10
|
language: "typescript"
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return n.create(e, {
|
|
13
|
+
function a(e, t) {
|
|
14
|
+
return n.editor.create(e, {
|
|
15
15
|
...r,
|
|
16
16
|
value: t,
|
|
17
17
|
language: "html"
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function c(e, t) {
|
|
21
|
-
return n.create(e, {
|
|
21
|
+
return n.editor.create(e, {
|
|
22
22
|
...r,
|
|
23
23
|
value: t,
|
|
24
24
|
language: "json"
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return n.create(e, {
|
|
27
|
+
function g(e, t) {
|
|
28
|
+
return n.editor.create(e, {
|
|
29
29
|
...r,
|
|
30
30
|
value: t,
|
|
31
31
|
language: "css"
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
g as getCss,
|
|
36
|
+
a as getHtml,
|
|
37
|
+
o as getJs,
|
|
38
38
|
c as getJson
|
|
39
39
|
};
|
|
@@ -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"),l=require("./editor.cjs"),d=require("./init.cjs"),v={class:"editor-div"},p=t.defineComponent({__name:"editor",props:{modelValue:{type:String,default:`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
`},format:{type:String}},emits:["update:modelValue"],setup(
|
|
5
|
+
`},format:{type:String},options:{type:Array}},emits:["update:modelValue"],setup(n,{emit:u}){const e=n,i=u,s=t.ref(),r=t.shallowRef();function c(){d.init();const o=e.modelValue;e.format==="js"||e.format==="ts"?r.value=l.getJs(s.value,o):e.format==="css"||e.format==="scss"?r.value=l.getCss(s.value,o):e.format==="html"||e.format==="vue"?r.value=l.getHtml(s.value,o):e.format==="json"&&(r.value=l.getJson(s.value,o))}function f(o){o&&i("update:modelValue",o)}return t.watch(()=>e.modelValue,()=>{r.value?.setValue(e.modelValue)}),t.onMounted(()=>{c(),r.value?.onDidBlurEditorText(o=>{if(r.value){const a=r.value.getValue();f(a)}})}),(o,a)=>t.withDirectives((t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("div",{class:"editor-code",ref_key:"refText",ref:s},null,512)])),[[t.unref(m),{bottom:{}}]])}});module.exports=p;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as m, ref as f, shallowRef as c, watch as d, onMounted as v, withDirectives as p, createElementBlock as V, openBlock as _, createElementVNode as g, unref as h } from "vue";
|
|
2
2
|
import x from "../../../../../directives/adjust/index.js";
|
|
3
|
-
import { getJs as
|
|
4
|
-
import { init as
|
|
5
|
-
const E = { class: "editor-div" },
|
|
3
|
+
import { getJs as y, getCss as B, getHtml as j, getJson as k } from "./editor.js";
|
|
4
|
+
import { init as w } from "./init.js";
|
|
5
|
+
const E = { class: "editor-div" }, J = /* @__PURE__ */ m({
|
|
6
6
|
__name: "editor",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {
|
|
@@ -15,17 +15,20 @@ const E = { class: "editor-div" }, S = /* @__PURE__ */ n({
|
|
|
15
15
|
},
|
|
16
16
|
format: {
|
|
17
17
|
type: String
|
|
18
|
+
},
|
|
19
|
+
options: {
|
|
20
|
+
type: Array
|
|
18
21
|
}
|
|
19
22
|
},
|
|
20
23
|
emits: ["update:modelValue"],
|
|
21
24
|
setup(r, { emit: s }) {
|
|
22
25
|
const e = r, u = s, l = f(), o = c();
|
|
23
26
|
function i() {
|
|
24
|
-
|
|
27
|
+
w();
|
|
25
28
|
const t = e.modelValue;
|
|
26
|
-
e.format === "js" || e.format === "ts" ? o.value =
|
|
29
|
+
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));
|
|
27
30
|
}
|
|
28
|
-
function
|
|
31
|
+
function n(t) {
|
|
29
32
|
t && u("update:modelValue", t);
|
|
30
33
|
}
|
|
31
34
|
return d(
|
|
@@ -37,7 +40,7 @@ const E = { class: "editor-div" }, S = /* @__PURE__ */ n({
|
|
|
37
40
|
i(), o.value?.onDidBlurEditorText((t) => {
|
|
38
41
|
if (o.value) {
|
|
39
42
|
const a = o.value.getValue();
|
|
40
|
-
|
|
43
|
+
n(a);
|
|
41
44
|
}
|
|
42
45
|
});
|
|
43
46
|
}), (t, a) => p((_(), V("div", E, [
|
|
@@ -54,5 +57,5 @@ const E = { class: "editor-div" }, S = /* @__PURE__ */ n({
|
|
|
54
57
|
}
|
|
55
58
|
});
|
|
56
59
|
export {
|
|
57
|
-
|
|
60
|
+
J as default
|
|
58
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("monaco-editor/esm/vs/editor/editor.main"),t=require("monaco-editor/esm/vs/editor/editor.worker?worker"),n=require("monaco-editor/esm/vs/language/json/json.worker?worker"),s=require("monaco-editor/esm/vs/language/css/css.worker?worker"),i=require("monaco-editor/esm/vs/language/html/html.worker?worker"),o=require("monaco-editor/esm/vs/language/typescript/ts.worker?worker");function c(){self.MonacoEnvironment={getWorker(u,r){return r==="json"?new n:r==="css"||r==="scss"||r==="less"?new s:r==="html"||r==="handlebars"||r==="razor"?new i:r==="typescript"||r==="javascript"?new o:new t}},e.languages.typescript.typescriptDefaults.setEagerModelSync(!0)}exports.init=c;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { languages as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
const n = e("editor/editor.worker"), c = e("language/json/json.worker"), i = e("language/css/css.worker"), u = e("language/html/html.worker"), k = e("language/typescript/ts.worker");
|
|
10
|
-
function p() {
|
|
1
|
+
import { languages as t } from "monaco-editor/esm/vs/editor/editor.main";
|
|
2
|
+
import o from "monaco-editor/esm/vs/editor/editor.worker?worker";
|
|
3
|
+
import e from "monaco-editor/esm/vs/language/json/json.worker?worker";
|
|
4
|
+
import n from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
5
|
+
import s from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
|
6
|
+
import i from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
|
7
|
+
function w() {
|
|
11
8
|
self.MonacoEnvironment = {
|
|
12
|
-
getWorker(
|
|
13
|
-
return r === "json" ?
|
|
9
|
+
getWorker(m, r) {
|
|
10
|
+
return r === "json" ? new e() : r === "css" || r === "scss" || r === "less" ? new n() : r === "html" || r === "handlebars" || r === "razor" ? new s() : r === "typescript" || r === "javascript" ? new i() : new o();
|
|
14
11
|
}
|
|
15
|
-
},
|
|
12
|
+
}, t.typescript.typescriptDefaults.setEagerModelSync(!0);
|
|
16
13
|
}
|
|
17
14
|
export {
|
|
18
|
-
|
|
15
|
+
w as init
|
|
19
16
|
};
|
|
@@ -7,6 +7,24 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
7
7
|
type: FunctionConstructor;
|
|
8
8
|
default(): string;
|
|
9
9
|
};
|
|
10
|
+
options: {
|
|
11
|
+
type: {
|
|
12
|
+
(arrayLength: number): string[];
|
|
13
|
+
(...items: string[]): string[];
|
|
14
|
+
new (arrayLength: number): string[];
|
|
15
|
+
new (...items: string[]): string[];
|
|
16
|
+
isArray(arg: any): arg is any[];
|
|
17
|
+
readonly prototype: any[];
|
|
18
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
19
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
20
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
21
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
22
|
+
of<T>(...items: T[]): T[];
|
|
23
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
24
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
25
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
10
28
|
format: {
|
|
11
29
|
type: StringConstructor;
|
|
12
30
|
default: string;
|
|
@@ -21,6 +39,24 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
21
39
|
type: FunctionConstructor;
|
|
22
40
|
default(): string;
|
|
23
41
|
};
|
|
42
|
+
options: {
|
|
43
|
+
type: {
|
|
44
|
+
(arrayLength: number): string[];
|
|
45
|
+
(...items: string[]): string[];
|
|
46
|
+
new (arrayLength: number): string[];
|
|
47
|
+
new (...items: string[]): string[];
|
|
48
|
+
isArray(arg: any): arg is any[];
|
|
49
|
+
readonly prototype: any[];
|
|
50
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
51
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
52
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
53
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
54
|
+
of<T>(...items: T[]): T[];
|
|
55
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
56
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
57
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
24
60
|
format: {
|
|
25
61
|
type: StringConstructor;
|
|
26
62
|
default: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),s=require("./text.vue.cjs");;/* empty css */const m=require("./codemirror/codemirror.vue.cjs");;/* empty css */const d=require("./editor/editor.vue.cjs");;/* empty css */const c=require("../../../../config.cjs"),_={class:"form-input"},v=e.defineComponent({__name:"index",props:{modelValue:{type:String},check:{type:Function,default(){return""}},options:{type:Array},format:{type:String,default:"js"}},emits:["update:modelValue"],setup(l,{emit:i}){const r=l,n=e.ref(c.getConfig("editortype")||0),p=i,t=e.computed({get(){return r.modelValue},set(a){p("update:modelValue",a)}});return(a,o)=>(e.openBlock(),e.createElementBlock("div",_,[n.value==1?(e.openBlock(),e.createBlock(m,{key:0,modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=u=>t.value=u),format:r.format,options:l.options},null,8,["modelValue","format","options"])):n.value==2?(e.openBlock(),e.createBlock(d,{key:1,modelValue:t.value,"onUpdate:modelValue":o[1]||(o[1]=u=>t.value=u),format:r.format,options:l.options},null,8,["modelValue","format","options"])):(e.openBlock(),e.createBlock(s,{key:2,modelValue:t.value,"onUpdate:modelValue":o[2]||(o[2]=u=>t.value=u)},null,8,["modelValue"]))]))}});module.exports=v;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as d, ref as s, computed as f, createElementBlock as V, openBlock as l, createBlock as n } from "vue";
|
|
2
2
|
import c from "./text.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import v from "./codemirror/codemirror.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import y from "./editor/editor.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { getConfig as
|
|
9
|
-
const
|
|
8
|
+
import { getConfig as k } from "../../../../config.js";
|
|
9
|
+
const g = { class: "form-input" }, A = /* @__PURE__ */ d({
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
12
12
|
modelValue: {
|
|
@@ -18,40 +18,45 @@ const k = { class: "form-input" }, E = /* @__PURE__ */ i({
|
|
|
18
18
|
return "";
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
+
options: {
|
|
22
|
+
type: Array
|
|
23
|
+
},
|
|
21
24
|
format: {
|
|
22
25
|
type: String,
|
|
23
26
|
default: "js"
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
emits: ["update:modelValue"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
30
|
+
setup(m, { emit: i }) {
|
|
31
|
+
const a = m, r = s(k("editortype") || 0), p = i, e = f({
|
|
29
32
|
get() {
|
|
30
|
-
return
|
|
33
|
+
return a.modelValue;
|
|
31
34
|
},
|
|
32
35
|
set(u) {
|
|
33
|
-
|
|
36
|
+
p("update:modelValue", u);
|
|
34
37
|
}
|
|
35
38
|
});
|
|
36
|
-
return (u,
|
|
37
|
-
r.value == 1 ? (l(),
|
|
39
|
+
return (u, o) => (l(), V("div", g, [
|
|
40
|
+
r.value == 1 ? (l(), n(v, {
|
|
38
41
|
key: 0,
|
|
39
42
|
modelValue: e.value,
|
|
40
|
-
"onUpdate:modelValue":
|
|
41
|
-
format:
|
|
42
|
-
|
|
43
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => e.value = t),
|
|
44
|
+
format: a.format,
|
|
45
|
+
options: m.options
|
|
46
|
+
}, null, 8, ["modelValue", "format", "options"])) : r.value == 2 ? (l(), n(y, {
|
|
43
47
|
key: 1,
|
|
44
48
|
modelValue: e.value,
|
|
45
|
-
"onUpdate:modelValue":
|
|
46
|
-
format:
|
|
47
|
-
|
|
49
|
+
"onUpdate:modelValue": o[1] || (o[1] = (t) => e.value = t),
|
|
50
|
+
format: a.format,
|
|
51
|
+
options: m.options
|
|
52
|
+
}, null, 8, ["modelValue", "format", "options"])) : (l(), n(c, {
|
|
48
53
|
key: 2,
|
|
49
54
|
modelValue: e.value,
|
|
50
|
-
"onUpdate:modelValue":
|
|
55
|
+
"onUpdate:modelValue": o[2] || (o[2] = (t) => e.value = t)
|
|
51
56
|
}, null, 8, ["modelValue"]))
|
|
52
57
|
]));
|
|
53
58
|
}
|
|
54
59
|
});
|
|
55
60
|
export {
|
|
56
|
-
|
|
61
|
+
A as default
|
|
57
62
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fangzhongya/vue-archive",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.73",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description ": "vue 组件注释生成文档",
|
|
7
7
|
"author": "fangzhongya ",
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"vue-tsc": "^3.0.5"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"prettier": "^3.6.2",
|
|
40
|
+
"@codemirror/autocomplete": "6.18.6",
|
|
42
41
|
"@codemirror/lang-css": "^6.3.1",
|
|
43
42
|
"@codemirror/lang-html": "^6.4.9",
|
|
44
43
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
@@ -49,6 +48,8 @@
|
|
|
49
48
|
"comment-parser": "^1.4.1",
|
|
50
49
|
"highlight.js": "^11.11.1",
|
|
51
50
|
"markdown-it": "^14.1.0",
|
|
51
|
+
"monaco-editor": "^0.52.2",
|
|
52
|
+
"prettier": "^3.6.2",
|
|
52
53
|
"vue": "^3.5.18"
|
|
53
54
|
},
|
|
54
55
|
"types": "./dist/packages/index.d.ts",
|