@fangzhongya/vue-archive 0.0.77 → 0.0.79
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/index.css +1 -1
- package/dist/packages/components/use/retrie/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/index.vue.js +12 -12
- package/dist/packages/components/use/retrie/input/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/input/index.vue.js +16 -24
- package/dist/packages/components/use/set-props.d.ts +1 -1
- package/dist/packages/components/use/set-props.vue.cjs +1 -1
- package/dist/packages/components/use/set-props.vue.js +21 -24
- package/package.json +6 -6
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.cjs +0 -1
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.js +0 -74
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.cjs +0 -5
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.js +0 -77
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue3.cjs +0 -1
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue3.js +0 -5
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.form-input-text{padding:10px;height:160px;width:100%;box-sizing:border-box}.
|
|
1
|
+
.form-input-text{padding:10px;height:160px;width:100%;box-sizing:border-box}.editor-div{padding:10px;height:160px;background-color:#eee}.editor-div .editor-code{height:100%;width:100%;min-height:80px;background-color:#fff}.form-input{font-size:16px}.form-select{position:relative;font-size:16px}.form-select .form-select-input{padding:10px;width:100%;font-size:16px;box-sizing:border-box}.form-select .form-select-box{position:absolute;width:100%;z-index:100;background-color:#000;text-align:center}.form-select .form-select-box .form-select-list-div{border:1px solid #000000}.form-select .form-select-box .form-select-list-div .form-select-list-li{background-color:#e9e9e9;padding:10px;cursor:pointer;border-bottom:1px solid #000000}.form-select{position:relative}.form-select .form-select-box{position:absolute;background-color:#fff;text-align:center}.form-select .form-select-box .form-select-list-div{border:1px solid #fff}.form-select .form-select-box .form-select-list-div .form-select-list-li{padding:10px;border-bottom:1px solid #eee}.form-select .form-select-box .form-select-list-div .form-select-list-li:last-child{border:0}.form-select .form-select-box .form-select-list-div .form-select-list-li.active{color:#0051ff}.form-boolean{display:flex;font-size:16px;padding:10px}.form-boolean .form-boolean-div{margin-right:10px}.form-string{font-size:16px}.form-string .form-string-text{padding:10px;width:100%;box-sizing:border-box}.form-number{font-size:16px}.form-number .form-number-input{padding:10px;width:100%;box-sizing:border-box}.set-emit .set-emit-li{padding:10px}.set-emit .set-emit-name{font-size:18px;padding:5px 0}.set-emit .set-emit-value{font-size:16px;background-color:azure}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
|
|
2
2
|
Theme: StackOverflow Light
|
|
3
3
|
Description: Light theme as used on stackoverflow.com
|
|
4
4
|
Author: stackoverflow.com
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),m=require("./any/index.vue.cjs"),y=require("./form/index.vue.cjs"),_={class:"com-retrie"},k={key:0,class:"com-retrie-label"},f=e.defineComponent({__name:"index",props:{name:String,selects:{type:Object,default(){return{}}},list:{type:Array,default(){return[]}},refresh:{type:Number,default:0},modelValue:{type:null,default(){return{}}},queryName:{type:String,default:"执行"},defaultQuery:{type:Boolean}},emits:["query"],setup(c,{emit:i}){const l=c,p=i,n=e.ref({}),o=e.ref({});function u(r,s,t){n.value[r]=s,o.value[r]=t}function a(){p("query",n.value,o.value)}return e.watch(()=>l.modelValue,()=>{n.value={},o.value={},e.nextTick(()=>{a()})},{immediate:!0}),(r,s)=>(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.list,(t,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"com-retrie-li"},[t.label?(e.openBlock(),e.createElementBlock("label",k,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),!t.type||t.type=="any"?(e.openBlock(),e.createBlock(m,{key:1,config:t,selects:l.selects,modelValue:l.modelValue[t.prop],onChange:u},null,8,["config","selects","modelValue"])):(e.openBlock(),e.createBlock(y,{key:2,config:t,selects:l.selects,modelValue:l.modelValue[t.prop],onChange:u},null,8,["config","selects","modelValue"]))]))),128))
|
|
1
|
+
"use strict";const e=require("vue"),m=require("./any/index.vue.cjs"),y=require("./form/index.vue.cjs"),_={class:"com-retrie"},k={key:0,class:"com-retrie-label"},f=e.defineComponent({__name:"index",props:{name:String,selects:{type:Object,default(){return{}}},list:{type:Array,default(){return[]}},refresh:{type:Number,default:0},modelValue:{type:null,default(){return{}}},queryName:{type:String,default:"执行"},defaultQuery:{type:Boolean}},emits:["query"],setup(c,{emit:i}){const l=c,p=i,n=e.ref({}),o=e.ref({});function u(r,s,t){n.value[r]=s,o.value[r]=t}function a(){p("query",n.value,o.value)}return e.watch(()=>l.modelValue,()=>{n.value={},o.value={},e.nextTick(()=>{a()})},{immediate:!0}),(r,s)=>(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",{class:"but-div com-retrie-but",onClick:e.withModifiers(a,["stop"])},[e.createElementVNode("span",null,e.toDisplayString(c.queryName),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.list,(t,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"com-retrie-li"},[t.label?(e.openBlock(),e.createElementBlock("label",k,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),!t.type||t.type=="any"?(e.openBlock(),e.createBlock(m,{key:1,config:t,selects:l.selects,modelValue:l.modelValue[t.prop],onChange:u},null,8,["config","selects","modelValue"])):(e.openBlock(),e.createBlock(y,{key:2,config:t,selects:l.selects,modelValue:l.modelValue[t.prop],onChange:u},null,8,["config","selects","modelValue"]))]))),128))]))}});module.exports=f;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as k, ref as m, watch as V, nextTick as g, createElementBlock as r, openBlock as l, createElementVNode as d,
|
|
1
|
+
import { defineComponent as k, ref as m, watch as V, nextTick as g, createElementBlock as r, openBlock as l, createElementVNode as d, withModifiers as b, toDisplayString as f, Fragment as h, renderList as x, createCommentVNode as C, createBlock as p } from "vue";
|
|
2
2
|
import N from "./any/index.vue.js";
|
|
3
3
|
import q from "./form/index.vue.js";
|
|
4
4
|
const B = { class: "com-retrie" }, S = {
|
|
@@ -70,31 +70,31 @@ const B = { class: "com-retrie" }, S = {
|
|
|
70
70
|
immediate: !0
|
|
71
71
|
}
|
|
72
72
|
), (n, i) => (l(), r("div", B, [
|
|
73
|
-
(
|
|
73
|
+
d("div", {
|
|
74
|
+
class: "but-div com-retrie-but",
|
|
75
|
+
onClick: b(s, ["stop"])
|
|
76
|
+
}, [
|
|
77
|
+
d("span", null, f(u.queryName), 1)
|
|
78
|
+
]),
|
|
79
|
+
(l(!0), r(h, null, x(t.list, (e, _) => (l(), r("div", {
|
|
74
80
|
key: _,
|
|
75
81
|
class: "com-retrie-li"
|
|
76
82
|
}, [
|
|
77
|
-
e.label ? (l(), r("label", S,
|
|
78
|
-
!e.type || e.type == "any" ? (l(),
|
|
83
|
+
e.label ? (l(), r("label", S, f(e.label), 1)) : C("", !0),
|
|
84
|
+
!e.type || e.type == "any" ? (l(), p(N, {
|
|
79
85
|
key: 1,
|
|
80
86
|
config: e,
|
|
81
87
|
selects: t.selects,
|
|
82
88
|
modelValue: t.modelValue[e.prop],
|
|
83
89
|
onChange: c
|
|
84
|
-
}, null, 8, ["config", "selects", "modelValue"])) : (l(),
|
|
90
|
+
}, null, 8, ["config", "selects", "modelValue"])) : (l(), p(q, {
|
|
85
91
|
key: 2,
|
|
86
92
|
config: e,
|
|
87
93
|
selects: t.selects,
|
|
88
94
|
modelValue: t.modelValue[e.prop],
|
|
89
95
|
onChange: c
|
|
90
96
|
}, null, 8, ["config", "selects", "modelValue"]))
|
|
91
|
-
]))), 128))
|
|
92
|
-
d("div", {
|
|
93
|
-
class: "but-div com-retrie-but",
|
|
94
|
-
onClick: C(s, ["stop"])
|
|
95
|
-
}, [
|
|
96
|
-
d("span", null, p(u.queryName), 1)
|
|
97
|
-
])
|
|
97
|
+
]))), 128))
|
|
98
98
|
]));
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),i=require("./text.vue.cjs");;/* empty css */const c=require("./editor/editor.vue.cjs");;/* empty css */const d=require("../../../../config.cjs"),m={class:"form-input"},_=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:a}){const r=l,s=e.ref(d.getConfig("editortype")||0),p=a,t=e.computed({get(){return r.modelValue},set(n){p("update:modelValue",n)}});return(n,o)=>(e.openBlock(),e.createElementBlock("div",m,[s.value==2?(e.openBlock(),e.createBlock(c,{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"])):(e.openBlock(),e.createBlock(i,{key:1,modelValue:t.value,"onUpdate:modelValue":o[1]||(o[1]=u=>t.value=u)},null,8,["modelValue"]))]))}});module.exports=_;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { defineComponent as d, ref as s, computed as f, createElementBlock as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as d, ref as s, computed as f, createElementBlock as c, openBlock as l, createBlock as r } from "vue";
|
|
2
|
+
import V from "./text.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import v from "./codemirror/codemirror.vue.js";
|
|
5
|
-
/* empty css */
|
|
6
4
|
import y from "./editor/editor.vue.js";
|
|
7
5
|
/* empty css */
|
|
8
|
-
import { getConfig as
|
|
9
|
-
const
|
|
6
|
+
import { getConfig as v } from "../../../../config.js";
|
|
7
|
+
const k = { class: "form-input" }, U = /* @__PURE__ */ d({
|
|
10
8
|
__name: "index",
|
|
11
9
|
props: {
|
|
12
10
|
modelValue: {
|
|
@@ -27,36 +25,30 @@ const g = { class: "form-input" }, A = /* @__PURE__ */ d({
|
|
|
27
25
|
}
|
|
28
26
|
},
|
|
29
27
|
emits: ["update:modelValue"],
|
|
30
|
-
setup(m, { emit:
|
|
31
|
-
const
|
|
28
|
+
setup(m, { emit: u }) {
|
|
29
|
+
const n = m, p = s(v("editortype") || 0), i = u, e = f({
|
|
32
30
|
get() {
|
|
33
|
-
return
|
|
31
|
+
return n.modelValue;
|
|
34
32
|
},
|
|
35
|
-
set(
|
|
36
|
-
|
|
33
|
+
set(a) {
|
|
34
|
+
i("update:modelValue", a);
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
|
-
return (
|
|
40
|
-
|
|
37
|
+
return (a, t) => (l(), c("div", k, [
|
|
38
|
+
p.value == 2 ? (l(), r(y, {
|
|
41
39
|
key: 0,
|
|
42
40
|
modelValue: e.value,
|
|
43
|
-
"onUpdate:modelValue":
|
|
44
|
-
format:
|
|
41
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => e.value = o),
|
|
42
|
+
format: n.format,
|
|
45
43
|
options: m.options
|
|
46
|
-
}, null, 8, ["modelValue", "format", "options"])) :
|
|
44
|
+
}, null, 8, ["modelValue", "format", "options"])) : (l(), r(V, {
|
|
47
45
|
key: 1,
|
|
48
46
|
modelValue: e.value,
|
|
49
|
-
"onUpdate:modelValue":
|
|
50
|
-
format: a.format,
|
|
51
|
-
options: m.options
|
|
52
|
-
}, null, 8, ["modelValue", "format", "options"])) : (l(), n(c, {
|
|
53
|
-
key: 2,
|
|
54
|
-
modelValue: e.value,
|
|
55
|
-
"onUpdate:modelValue": o[2] || (o[2] = (t) => e.value = t)
|
|
47
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => e.value = o)
|
|
56
48
|
}, null, 8, ["modelValue"]))
|
|
57
49
|
]));
|
|
58
50
|
}
|
|
59
51
|
});
|
|
60
52
|
export {
|
|
61
|
-
|
|
53
|
+
U as default
|
|
62
54
|
};
|
|
@@ -40,5 +40,5 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
40
40
|
};
|
|
41
41
|
}>> & Readonly<{
|
|
42
42
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
43
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {},
|
|
43
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
44
44
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),T=require("./retrie/index.vue.cjs");;/* empty css */const o=require("./code.cjs"),
|
|
1
|
+
"use strict";const s=require("vue"),T=require("./retrie/index.vue.cjs");;/* empty css */const o=require("./code.cjs"),x={class:"set-props"},j=s.defineComponent({__name:"set-props",props:{name:String,list:Array},emits:["change"],setup(i,{emit:p}){const r=i,f=p,a=s.ref({}),m=s.ref(0),l=s.ref({}),c=s.ref([]);function _(){l.value={};const n=[];r.list?.forEach(t=>{let e=t.name;if(!e.includes(".")&&(e=(e.split("/")[0]||"").trim(),e)){const b=o.getDefaultValue(t,!1);l.value[e]=b;const{arr:g,type:v,dataType:V}=o.getSpecType(t);a.value[e]=g;let q={label:d(e,t),prop:e,type:v,dataType:V,select:e};n.push(q)}}),c.value=n}function d(n,t){let e=n+": { "+(t.type||"any")+" } "+t.description;return t.default&&(e+=" 默认值="+t.default),t.selectable&&(e+=" 可选值="+t.selectable),e}function h(n,t){let e=Object.assign({},n);f("change",e,t)}let u;function y(){clearTimeout(u),u=setTimeout(()=>{_()},400)}return s.watch(()=>r.name,()=>{c.value=[],y()},{immediate:!0}),(n,t)=>(s.openBlock(),s.createElementBlock("div",x,[s.createVNode(T,{refresh:m.value,modelValue:l.value,selects:a.value,list:c.value,name:r.name,onQuery:h},null,8,["refresh","modelValue","selects","list","name"])]))}});module.exports=j;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { defineComponent as T, ref as
|
|
1
|
+
import { defineComponent as T, ref as l, watch as j, createElementBlock as k, openBlock as x, createVNode as B } from "vue";
|
|
2
2
|
import E from "./retrie/index.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import { getDefaultValue as
|
|
5
|
-
const
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "set-props"
|
|
8
|
-
}, R = /* @__PURE__ */ T({
|
|
4
|
+
import { getDefaultValue as S, getSpecType as w } from "./code.js";
|
|
5
|
+
const A = { class: "set-props" }, Q = /* @__PURE__ */ T({
|
|
9
6
|
__name: "set-props",
|
|
10
7
|
props: {
|
|
11
8
|
name: String,
|
|
@@ -13,17 +10,17 @@ const w = {
|
|
|
13
10
|
},
|
|
14
11
|
emits: ["change"],
|
|
15
12
|
setup(i, { emit: u }) {
|
|
16
|
-
const
|
|
13
|
+
const n = i, m = u, r = l({}), p = l(0), a = l({}), o = l([]);
|
|
17
14
|
function f() {
|
|
18
|
-
|
|
15
|
+
a.value = {};
|
|
19
16
|
const s = [];
|
|
20
|
-
|
|
17
|
+
n.list?.forEach((t) => {
|
|
21
18
|
let e = t.name;
|
|
22
19
|
if (!e.includes(".") && (e = (e.split("/")[0] || "").trim(), e)) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const { arr:
|
|
26
|
-
r.value[e] =
|
|
20
|
+
const b = S(t, !1);
|
|
21
|
+
a.value[e] = b;
|
|
22
|
+
const { arr: y, type: g, dataType: V } = w(t);
|
|
23
|
+
r.value[e] = y;
|
|
27
24
|
let v = {
|
|
28
25
|
label: d(e, t),
|
|
29
26
|
prop: e,
|
|
@@ -33,7 +30,7 @@ const w = {
|
|
|
33
30
|
};
|
|
34
31
|
s.push(v);
|
|
35
32
|
}
|
|
36
|
-
}),
|
|
33
|
+
}), o.value = s;
|
|
37
34
|
}
|
|
38
35
|
function d(s, t) {
|
|
39
36
|
let e = s + ": { " + (t.type || "any") + " } " + t.description;
|
|
@@ -49,26 +46,26 @@ const w = {
|
|
|
49
46
|
f();
|
|
50
47
|
}, 400);
|
|
51
48
|
}
|
|
52
|
-
return
|
|
53
|
-
() =>
|
|
49
|
+
return j(
|
|
50
|
+
() => n.name,
|
|
54
51
|
() => {
|
|
55
|
-
|
|
52
|
+
o.value = [], _();
|
|
56
53
|
},
|
|
57
54
|
{
|
|
58
55
|
immediate: !0
|
|
59
56
|
}
|
|
60
|
-
), (s, t) =>
|
|
61
|
-
|
|
57
|
+
), (s, t) => (x(), k("div", A, [
|
|
58
|
+
B(E, {
|
|
62
59
|
refresh: p.value,
|
|
63
|
-
modelValue:
|
|
60
|
+
modelValue: a.value,
|
|
64
61
|
selects: r.value,
|
|
65
|
-
list:
|
|
66
|
-
name:
|
|
62
|
+
list: o.value,
|
|
63
|
+
name: n.name,
|
|
67
64
|
onQuery: h
|
|
68
65
|
}, null, 8, ["refresh", "modelValue", "selects", "list", "name"])
|
|
69
|
-
]))
|
|
66
|
+
]));
|
|
70
67
|
}
|
|
71
68
|
});
|
|
72
69
|
export {
|
|
73
|
-
|
|
70
|
+
Q as default
|
|
74
71
|
};
|
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.79",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description ": "vue 组件注释生成文档",
|
|
7
7
|
"author": "fangzhongya ",
|
|
@@ -30,13 +30,11 @@
|
|
|
30
30
|
"tsup": "^8.5.0",
|
|
31
31
|
"typescript": "^5.9.2",
|
|
32
32
|
"unplugin-vue-components": "^29.0.0",
|
|
33
|
-
"vite": "^7.1.
|
|
33
|
+
"vite": "^7.1.3",
|
|
34
34
|
"vite-plugin-dts": "4.5.4",
|
|
35
35
|
"vitest": "^3.2.4",
|
|
36
36
|
"vue-router": "^4.5.1",
|
|
37
|
-
"vue-tsc": "^3.0.5"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
37
|
+
"vue-tsc": "^3.0.5",
|
|
40
38
|
"@codemirror/autocomplete": "6.18.6",
|
|
41
39
|
"@codemirror/lang-css": "^6.3.1",
|
|
42
40
|
"@codemirror/lang-html": "^6.4.9",
|
|
@@ -44,7 +42,9 @@
|
|
|
44
42
|
"@codemirror/lang-json": "^6.0.2",
|
|
45
43
|
"@codemirror/state": "^6.5.2",
|
|
46
44
|
"@codemirror/view": "^6.38.1",
|
|
47
|
-
"codemirror": "^6.0.2"
|
|
45
|
+
"codemirror": "^6.0.2"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
48
|
"comment-parser": "^1.4.1",
|
|
49
49
|
"highlight.js": "^11.11.1",
|
|
50
50
|
"markdown-it": "^14.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
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,74 +0,0 @@
|
|
|
1
|
-
import { EditorView as f } from "@codemirror/view";
|
|
2
|
-
import { javascript as c } from "@codemirror/lang-javascript";
|
|
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
|
-
import { basicSetup as h } from "codemirror";
|
|
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,
|
|
26
|
-
extensions: [
|
|
27
|
-
...t,
|
|
28
|
-
S({}),
|
|
29
|
-
h,
|
|
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));
|
|
32
|
-
})
|
|
33
|
-
]
|
|
34
|
-
}));
|
|
35
|
-
function L(t, r) {
|
|
36
|
-
return new f({
|
|
37
|
-
// 状态
|
|
38
|
-
state: i([c()], r),
|
|
39
|
-
// 绑定元素
|
|
40
|
-
parent: t
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function O(t, r) {
|
|
44
|
-
return new f({
|
|
45
|
-
// 状态
|
|
46
|
-
state: i([a()], r),
|
|
47
|
-
// 绑定元素
|
|
48
|
-
parent: t
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function V(t, r) {
|
|
52
|
-
return new f({
|
|
53
|
-
// 状态
|
|
54
|
-
state: i([l()], r),
|
|
55
|
-
// 绑定元素
|
|
56
|
-
parent: t
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function k(t, r) {
|
|
60
|
-
return new f({
|
|
61
|
-
// 状态
|
|
62
|
-
state: i([p()], r),
|
|
63
|
-
// 绑定元素
|
|
64
|
-
parent: t
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
export {
|
|
68
|
-
i as createEditorState,
|
|
69
|
-
k as getCss,
|
|
70
|
-
O as getHtml,
|
|
71
|
-
L as getJs,
|
|
72
|
-
V as getJson,
|
|
73
|
-
d as getOverride
|
|
74
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,77 +0,0 @@
|
|
|
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
|
-
import w from "../../../../../directives/adjust/index.js";
|
|
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
|
-
__name: "codemirror",
|
|
6
|
-
props: {
|
|
7
|
-
modelValue: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: `
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`
|
|
14
|
-
},
|
|
15
|
-
format: {
|
|
16
|
-
type: String
|
|
17
|
-
},
|
|
18
|
-
options: {
|
|
19
|
-
type: Array
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
emits: ["update:modelValue"],
|
|
23
|
-
setup(i, { emit: m }) {
|
|
24
|
-
const e = i, c = m, s = n(), o = n();
|
|
25
|
-
function a(t) {
|
|
26
|
-
const l = t.view.state.doc.toString().trim();
|
|
27
|
-
l && c("update:modelValue", l);
|
|
28
|
-
}
|
|
29
|
-
function u() {
|
|
30
|
-
let t = e.modelValue, r = e.options;
|
|
31
|
-
e.format === "js" || e.format === "ts" ? o.value = y(s.value, {
|
|
32
|
-
value: t,
|
|
33
|
-
onBlur: a,
|
|
34
|
-
options: r
|
|
35
|
-
}) : e.format === "css" || e.format === "scss" ? o.value = x(s.value, {
|
|
36
|
-
value: t,
|
|
37
|
-
onBlur: a,
|
|
38
|
-
options: r
|
|
39
|
-
}) : e.format === "html" || e.format === "vue" ? o.value = j(s.value, {
|
|
40
|
-
value: t,
|
|
41
|
-
onBlur: a,
|
|
42
|
-
options: r
|
|
43
|
-
}) : e.format === "json" && (o.value = k(s.value, {
|
|
44
|
-
value: t,
|
|
45
|
-
onBlur: a,
|
|
46
|
-
options: r
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
return d(
|
|
50
|
-
() => e.modelValue,
|
|
51
|
-
() => {
|
|
52
|
-
o.value?.dispatch({
|
|
53
|
-
changes: {
|
|
54
|
-
from: 0,
|
|
55
|
-
to: o.value?.state.doc.length,
|
|
56
|
-
insert: e.modelValue
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
), v(() => {
|
|
61
|
-
u();
|
|
62
|
-
}), (t, r) => p((_(), g("div", B, [
|
|
63
|
-
h("div", {
|
|
64
|
-
class: "codemirror-code",
|
|
65
|
-
ref_key: "refText",
|
|
66
|
-
ref: s
|
|
67
|
-
}, null, 512)
|
|
68
|
-
])), [
|
|
69
|
-
[V(w), {
|
|
70
|
-
bottom: {}
|
|
71
|
-
}]
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
export {
|
|
76
|
-
J as default
|
|
77
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./codemirror.vue.cjs");;/* empty css */module.exports=e;
|