@opentiny/tiny-robot 0.3.0-alpha.2 → 0.3.0-alpha.21

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/index3.js CHANGED
@@ -1,307 +1,161 @@
1
- import { A as B, s as C, d as k, a as _, p as $, b as A, c as O, f as D } from "./index6.js";
2
- import { createElementBlock as w, openBlock as f, createElementVNode as r, resolveComponent as I, mergeProps as j, createBlock as h, createCommentVNode as T, renderSlot as E, resolveDynamicComponent as L, normalizeClass as M, toDisplayString as U } from "vue";
3
- const z = ({ emit: e, props: t, state: n, designConfig: o }) => (u) => {
4
- var s, l;
5
- const i = B.filterUrl(t.href), d = 1e3;
6
- let a = d;
7
- t.resetTime !== d ? a = t.resetTime : a = (l = (s = o == null ? void 0 : o.props) == null ? void 0 : s.resetTime) != null ? l : t.resetTime, i ? location.href = i : t.nativeType === "button" && a > 0 && (n.disabled = !0, n.timer = window.setTimeout(() => {
8
- n.disabled = !1;
9
- }, a)), e("click", u);
10
- }, F = (e) => () => clearTimeout(e.timer), N = ["state", "handleClick"], G = (e, { computed: t, onBeforeUnmount: n, reactive: o, watch: u, inject: s }, { emit: l, parent: i, designConfig: d }) => {
11
- i.tinyForm = i.tinyForm || s("form", null);
12
- const a = o({
13
- timer: 0,
14
- disabled: e.disabled,
15
- plain: t(() => e.plain || (i.buttonGroup || {}).plain),
16
- round: t(() => {
17
- var c, y, g;
18
- return (g = (y = e.round) != null ? y : (c = d == null ? void 0 : d.props) == null ? void 0 : c.round) != null ? g : !1;
19
- }),
20
- formDisabled: t(() => (i.tinyForm || {}).disabled),
21
- buttonDisabled: t(
22
- () => e.disabled || a.disabled || (i.buttonGroup || {}).disabled || a.formDisabled
23
- )
24
- });
25
- u(
26
- () => e.disabled,
27
- (c) => {
28
- a.disabled = c;
29
- },
30
- { immediate: !0 }
31
- );
32
- const b = {
33
- state: a,
34
- clearTimer: F(a),
35
- handleClick: z({ emit: l, props: e, state: a, designConfig: d })
36
- };
37
- return n(b.clearTimer), b;
38
- };
39
- var H = {
40
- xmlns: "http://www.w3.org/2000/svg",
41
- viewBox: "0 0 32 32"
42
- }, V = /* @__PURE__ */ r(
43
- "defs",
44
- {
45
- fill: "none"
46
- },
47
- [/* @__PURE__ */ r("linearGradient", {
48
- id: "loading-shadow_svg__a",
49
- x1: "-1285.88",
50
- y1: "25.63",
51
- x2: "-1286.89",
52
- y2: "25.13",
53
- gradientTransform: "matrix(29.6 0 0 29.6 38096.4 -732.8)",
54
- gradientUnits: "userSpaceOnUse"
55
- }, [/* @__PURE__ */ r("stop", {
56
- offset: "0",
57
- "stop-color": "#191919",
58
- "stop-opacity": "0"
59
- }), /* @__PURE__ */ r("stop", {
60
- offset: "1",
61
- "stop-color": "#191919"
62
- })])],
63
- -1
64
- /* HOISTED */
65
- ), P = /* @__PURE__ */ r(
66
- "mask",
67
- {
68
- fill: "none",
69
- id: "loading-shadow_svg__b",
70
- "mask-type": "alpha",
71
- maskUnits: "userSpaceOnUse",
72
- x: "0",
73
- y: "0"
74
- },
75
- [/* @__PURE__ */ r("path", {
76
- fill: "url(#loading-shadow_svg__a)",
77
- d: "M16 1.2c1 0 1.8.8 1.8 1.8S17 4.8 16 4.8C9.8 4.8 4.8 9.8 4.8 16s5 11.2 11.2 11.2 11.2-5 11.2-11.2c0-1 .8-1.8 1.8-1.8s1.8.8 1.8 1.8c0 8.2-6.6 14.8-14.8 14.8S1.2 24.2 1.2 16 7.8 1.2 16 1.2Z"
78
- }, [/* @__PURE__ */ r("animateTransform", {
79
- attributeName: "transform",
80
- attributeType: "XML",
81
- type: "rotate",
82
- from: "0 16 16",
83
- to: "360 16 16",
84
- dur: "1s",
85
- repeatCount: "indefinite"
86
- })])],
87
- -1
88
- /* HOISTED */
89
- ), Z = /* @__PURE__ */ r(
90
- "g",
91
- {
92
- mask: "url(#loading-shadow_svg__b)"
93
- },
94
- [/* @__PURE__ */ r("path", {
95
- d: "M-.1 32H32V-.11H-.1V32Z",
96
- "fill-rule": "evenodd"
97
- })],
98
- -1
99
- /* HOISTED */
100
- ), R = [V, P, Z];
101
- function X(e, t) {
102
- return f(), w("svg", H, [].concat(R));
103
- }
104
- var Y = {
105
- render: X
106
- }, q = function() {
107
- return C({
108
- name: "IconLoadingShadow",
109
- component: Y
110
- })();
111
- };
112
- function J(e, t) {
113
- var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
114
- if (n) return (n = n.call(e)).next.bind(n);
115
- if (Array.isArray(e) || (n = K(e)) || t) {
116
- n && (e = n);
117
- var o = 0;
118
- return function() {
119
- return o >= e.length ? { done: !0 } : { done: !1, value: e[o++] };
120
- };
121
- }
122
- throw new TypeError(`Invalid attempt to iterate non-iterable instance.
123
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
124
- }
125
- function K(e, t) {
126
- if (e) {
127
- if (typeof e == "string") return S(e, t);
128
- var n = {}.toString.call(e).slice(8, -1);
129
- return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? S(e, t) : void 0;
130
- }
131
- }
132
- function S(e, t) {
133
- (t == null || t > e.length) && (t = e.length);
134
- for (var n = 0, o = Array(t); n < t; n++) o[n] = e[n];
135
- return o;
136
- }
137
- var Q = function(t, n) {
138
- for (var o = t.__vccOpts || t, u = J(n), s; !(s = u()).done; ) {
139
- var l = s.value, i = l[0], d = l[1];
140
- o[i] = d;
141
- }
142
- return o;
143
- }, W = k({
144
- emits: ["click"],
145
- props: [].concat($, ["type", "text", "size", "icon", "resetTime", "nativeType", "loading", "disabled", "plain", "autofocus", "round", "circle", "tabindex", "customClass", "ghost"]),
146
- components: {
147
- IconLoading: q()
148
- },
149
- setup: function(t, n) {
150
- return _({
151
- props: t,
152
- context: n,
153
- renderless: G,
154
- api: N
1
+ import { onMounted as U, nextTick as B, h as C, defineComponent as g, render as R, onBeforeUnmount as D, Teleport as W, computed as h, ref as E, createBlock as F, openBlock as _, Transition as j, normalizeProps as q, guardReactiveProps as L, withCtx as Z, createElementBlock as G, createCommentVNode as J, renderSlot as K, useSlots as Q, watch as X, useAttrs as Y, resolveDynamicComponent as ee, unref as S, mergeProps as k, createVNode as te } from "vue";
2
+ import { b as oe, a as re, e as ne } from "./index2.js";
3
+ import { t as u } from "./utils.js";
4
+ import { _ as N } from "./_plugin-vue_export-helper.js";
5
+ import { u as se } from "./useSlotRefs.js";
6
+ const pe = g({
7
+ setup: (r) => () => C(W, r.propsFactory(), r.vnodeFactory()),
8
+ props: ["propsFactory", "vnodeFactory"]
9
+ });
10
+ function ae(r, n) {
11
+ let e = null, t = null, s = !1;
12
+ U(() => {
13
+ B(() => {
14
+ s || (t = document.createElement("div"), e = C(pe, { propsFactory: r, vnodeFactory: n }), R(e, t));
155
15
  });
156
- }
157
- }), x = ["disabled", "autofocus", "type", "tabindex"];
158
- function ee(e, t, n, o, u, s) {
159
- var l = I("icon-loading");
160
- return f(), w("button", j({
161
- class: ["tiny-button", [e.type ? "tiny-button--" + e.type : "", e.size ? "tiny-button--" + e.size : "", {
162
- "is-disabled": e.state.buttonDisabled,
163
- "is-loading": e.loading,
164
- "is-plain": e.state.plain,
165
- "is-ghost": e.ghost,
166
- "is-round": e.state.round,
167
- "is-circle": e.circle,
168
- "is-icon": e.icon && !e.loading && (e.text || e.slots.default),
169
- "is-only-icon": e.icon && !e.loading && !(e.text || e.slots.default)
170
- }]],
171
- onClick: t[0] || (t[0] = function() {
172
- return e.handleClick && e.handleClick.apply(e, arguments);
173
- }),
174
- disabled: e.state.buttonDisabled || e.loading,
175
- autofocus: e.autofocus,
176
- type: e.nativeType,
177
- tabindex: e.tabindex
178
- }, e.a(e.$attrs, ["class", "style", "title", "id"], !0)), [e.loading ? (f(), h(l, {
179
- key: 0,
180
- class: "tiny-icon-loading tiny-svg-size"
181
- })) : T("v-if", !0), e.icon && !e.loading ? (f(), h(L(e.icon), {
182
- key: 1,
183
- class: M({
184
- "is-text": e.text || e.slots.default
185
- })
186
- }, null, 8, ["class"])) : T("v-if", !0), E(e.$slots, "default", {}, function() {
187
- return [r(
188
- "span",
189
- null,
190
- U(e.text),
191
- 1
192
- /* TEXT */
193
- )];
194
- })], 16, x);
16
+ }), D(() => {
17
+ s = !0, B(() => {
18
+ t && (R(null, t), t.remove(), e = null, t = null);
19
+ });
20
+ });
195
21
  }
196
- var m = /* @__PURE__ */ Q(W, [["render", ee]]);
197
- function v() {
198
- return v = Object.assign ? Object.assign.bind() : function(e) {
199
- for (var t = 1; t < arguments.length; t++) {
200
- var n = arguments[t];
201
- for (var o in n) ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
22
+ function ce(r, n) {
23
+ return h(() => {
24
+ var v;
25
+ if (n instanceof HTMLElement)
26
+ return n;
27
+ const e = n, t = oe(r), s = (v = t == null ? void 0 : t.getRootNode) == null ? void 0 : v.call(t), i = s instanceof ShadowRoot, d = i ? s : document.body;
28
+ if (e) {
29
+ if (!i && e === "body")
30
+ return document.body;
31
+ const f = d.querySelector(e);
32
+ if (f instanceof Node) return f;
202
33
  }
203
- return e;
204
- }, v.apply(null, arguments);
34
+ return d;
35
+ });
205
36
  }
206
- var te = function(t) {
207
- var n, o = typeof process == "object" ? (n = process.env) == null ? void 0 : n.TINY_MODE : null;
208
- return m;
209
- }, ne = v({}, D, {
210
- /** 展示按钮不同的状态,设置为text则展示为文本按钮。可取值为:'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text' */
211
- type: {
212
- type: String,
213
- default: "default"
214
- },
215
- /** 设置原生的tabindex属性 */
216
- tabindex: {
217
- type: String,
218
- default: "0"
219
- },
220
- /** 按钮左侧展示的图标,接收为Icon组件 */
221
- icon: {
222
- type: [Object, String],
223
- default: ""
224
- },
225
- /** 按钮显示的文本 */
226
- text: {
227
- type: String,
228
- default: ""
229
- },
230
- /** 设置按钮禁用时间,防止重复提交,单位毫秒 */
231
- resetTime: {
232
- type: Number,
233
- default: 1e3
234
- },
235
- /** 对应按钮原生 type 属性 */
236
- nativeType: {
237
- type: String,
238
- default: "button"
239
- },
240
- /** 当配置href后,点击按钮则更新 location.href 进行页面跳转 */
241
- href: {
242
- type: String,
243
- default: ""
244
- },
245
- /** 定义按钮尺寸 */
246
- size: {
247
- type: String,
248
- default: "",
249
- validator: function(t) {
250
- return ["large", "medium", "small", "mini", ""].includes(t);
251
- }
252
- },
253
- /** 是否圆角按钮 */
254
- round: {
255
- type: Boolean,
256
- default: void 0
257
- },
258
- /** 是否朴素按钮 */
259
- plain: Boolean,
260
- /** 是否圆形按钮 */
261
- circle: Boolean,
262
- /** 是否加载中状态 */
263
- loading: Boolean,
264
- /** 是否被禁用按钮 */
265
- disabled: Boolean,
266
- /** 是否默认聚焦 */
267
- autofocus: Boolean,
268
- /** 自定义类名, 仅 mobile-first 模板时有效 */
269
- customClass: {
270
- type: String,
271
- default: ""
272
- },
273
- /** 设置通栏按钮,宽度充满水平方向, 仅 mobile-first 模板时有效 */
274
- banner: {
275
- type: Boolean,
276
- default: !1
277
- },
278
- /** 是否幽灵按钮 */
279
- ghost: Boolean,
280
- /** 点击事件 */
281
- onClick: {
282
- type: Function
37
+ const ie = /* @__PURE__ */ g({
38
+ __name: "Popper",
39
+ props: {
40
+ show: { type: Boolean },
41
+ transitionProps: {}
42
+ },
43
+ setup(r, { expose: n }) {
44
+ const e = E(null);
45
+ return n({
46
+ popperRef: e
47
+ }), (t, s) => (_(), F(j, q(L(t.transitionProps)), {
48
+ default: Z(() => [
49
+ t.show ? (_(), G("div", {
50
+ key: 0,
51
+ class: "tr-base-popper",
52
+ ref_key: "popperRef",
53
+ ref: e
54
+ }, [
55
+ K(t.$slots, "default", {}, void 0, !0)
56
+ ], 512)) : J("", !0)
57
+ ]),
58
+ _: 3
59
+ }, 16));
283
60
  }
284
- }), p = k({
285
- name: O + "Button",
286
- inject: {
287
- buttonGroup: {
288
- default: ""
289
- }
290
- },
291
- props: ne,
292
- slots: Object,
293
- setup: function(t, n) {
294
- return A({
295
- props: t,
296
- context: n,
297
- template: te
61
+ }), le = /* @__PURE__ */ N(ie, [["__scopeId", "data-v-25c13ab7"]]), ue = /* @__PURE__ */ g({
62
+ inheritAttrs: !1,
63
+ __name: "index",
64
+ props: {
65
+ appendTo: {},
66
+ offset: {},
67
+ placement: {
68
+ default: "top-center"
69
+ },
70
+ preventOverflow: {
71
+ type: Boolean
72
+ },
73
+ show: {
74
+ type: Boolean
75
+ },
76
+ transitionProps: {},
77
+ triggerEvents: {}
78
+ },
79
+ setup(r, {
80
+ expose: n
81
+ }) {
82
+ const e = r, t = Q(), {
83
+ vnodes: s,
84
+ ref: i,
85
+ setRef: d
86
+ } = se(t.trigger), v = (o = {}) => {
87
+ const p = {};
88
+ for (const [c, a] of Object.entries(o))
89
+ /^on[A-Z]/.test(c) && typeof a == "function" && (p[c] = a);
90
+ return p;
91
+ }, f = E(null), b = h(() => {
92
+ var o;
93
+ return ((o = f.value) == null ? void 0 : o.popperRef) || null;
94
+ }), m = h(() => {
95
+ var o, p;
96
+ return typeof e.offset == "number" ? {
97
+ mainAxis: e.offset,
98
+ crossAxis: 0
99
+ } : {
100
+ mainAxis: ((o = e.offset) == null ? void 0 : o.mainAxis) ?? 0,
101
+ crossAxis: ((p = e.offset) == null ? void 0 : p.crossAxis) ?? 0
102
+ };
103
+ }), {
104
+ top: $,
105
+ bottom: O,
106
+ left: w,
107
+ right: V,
108
+ width: z,
109
+ update: A
110
+ } = re(i), {
111
+ width: y,
112
+ height: P
113
+ } = ne(b, void 0, {
114
+ box: "border-box"
115
+ }), H = h(() => {
116
+ const {
117
+ placement: o,
118
+ preventOverflow: p
119
+ } = e, c = {}, a = (l, x) => {
120
+ if (!p) {
121
+ c[l] = x;
122
+ return;
123
+ }
124
+ const T = u(l === "top" ? P.value : y.value);
125
+ l === "top" ? c[l] = `clamp(var(--tr-base-popper-min-top), ${x}, calc(var(--tr-base-popper-max-bottom) - ${T}))` : l === "left" && (c[l] = `clamp(var(--tr-base-popper-min-left), ${x}, calc(var(--tr-base-popper-max-right) - ${T}))`);
126
+ };
127
+ return o.includes("top") && a("top", u($.value - P.value - m.value.mainAxis)), o.includes("bottom") && a("top", u(O.value + m.value.mainAxis)), o.includes("left") && a("left", u(w.value + m.value.crossAxis)), o.includes("right") && a("left", u(V.value - y.value + m.value.crossAxis)), o.includes("center") && a("left", u(w.value + z.value / 2 - y.value / 2 + m.value.crossAxis)), c;
298
128
  });
129
+ X(() => e.show, (o) => {
130
+ o && A();
131
+ }, {
132
+ flush: "post"
133
+ });
134
+ const I = ce(i, e.appendTo), M = Y();
135
+ return ae(() => ({
136
+ to: I.value
137
+ }), () => te(le, k({
138
+ ref: f,
139
+ show: e.show,
140
+ transitionProps: e.transitionProps,
141
+ style: H.value
142
+ }, M), {
143
+ default: () => {
144
+ var o;
145
+ return [(o = t.content) == null ? void 0 : o.call(t)];
146
+ }
147
+ })), n({
148
+ triggerRef: i,
149
+ popperRef: b,
150
+ update: A
151
+ }), (o, p) => (_(), F(ee(S(s)[0]), k({
152
+ ref: S(d)
153
+ }, v(e.triggerEvents)), null, 16));
299
154
  }
300
- }), oe = "3.undefined";
301
- p.install = function(e) {
302
- e.component(p.name, p);
303
- };
304
- p.version = oe;
155
+ }), fe = /* @__PURE__ */ N(ue, [["__scopeId", "data-v-f1e25842"]]);
156
+ fe.name = "TrBasePopper";
305
157
  export {
306
- p as B
158
+ fe as B,
159
+ ae as c,
160
+ ce as u
307
161
  };
@@ -0,0 +1,212 @@
1
+ import { defineComponent as g, ref as b, useModel as k, watch as O, onUnmounted as R, createElementBlock as f, openBlock as v, createElementVNode as t, withDirectives as p, vModelText as _, createVNode as y, unref as D, createCommentVNode as $ } from "vue";
2
+ import { TinyRadioGroup as E } from "@opentiny/vue";
3
+ import { d as L } from "../index2.js";
4
+ import { _ as T } from "../_plugin-vue_export-helper.js";
5
+ const M = { class: "form-editor__container" }, S = { class: "form-editor__item" }, F = { class: "form-editor__item" }, I = { class: "form-editor__item" }, N = { class: "form-editor__item" }, H = { class: "form-editor__item" }, w = { class: "form-editor__item" }, A = ["src"], C = "https://res.hc-cdn.com/tinyui-design/1.1.0.20250526191525/home/images/tiny-ng.svg", P = /* @__PURE__ */ g({
6
+ __name: "FormEditor",
7
+ props: {
8
+ formData: { required: !0 },
9
+ formDataModifiers: {}
10
+ },
11
+ emits: ["update:formData"],
12
+ setup(i) {
13
+ const d = b(""), o = k(i, "formData"), s = [
14
+ { label: "streamableHttp", text: "流式HTTP(Streamable HTTP)" },
15
+ { label: "sse", text: "服务器发送事件(SSE)" }
16
+ ], { open: n, files: u } = L({
17
+ accept: "image/*",
18
+ // 只接受图片文件
19
+ multiple: !1
20
+ // 只允许选择单个文件
21
+ }), r = () => {
22
+ d.value && d.value !== C && (URL.revokeObjectURL(d.value), d.value = "");
23
+ };
24
+ O(u, (m) => {
25
+ if (m && m.length > 0) {
26
+ const e = m[0];
27
+ if (!e.type.startsWith("image/"))
28
+ return;
29
+ const a = 5 * 1024 * 1024;
30
+ if (e.size > a)
31
+ return;
32
+ r(), d.value = URL.createObjectURL(e), o.value.thumbnail = e;
33
+ }
34
+ });
35
+ const x = () => {
36
+ n();
37
+ };
38
+ return R(() => {
39
+ r();
40
+ }), (m, e) => (v(), f("form", M, [
41
+ t("div", S, [
42
+ e[5] || (e[5] = t("label", { class: "form-editor__label" }, "名称", -1)),
43
+ p(t("input", {
44
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => o.value.name = a),
45
+ class: "form-editor__input",
46
+ type: "text",
47
+ placeholder: "请输入插件名称"
48
+ }, null, 512), [
49
+ [_, o.value.name]
50
+ ])
51
+ ]),
52
+ t("div", F, [
53
+ e[6] || (e[6] = t("label", { class: "form-editor__label" }, "描述", -1)),
54
+ p(t("textarea", {
55
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => o.value.description = a),
56
+ class: "form-editor__textarea",
57
+ placeholder: "请输入插件描述"
58
+ }, null, 512), [
59
+ [_, o.value.description]
60
+ ])
61
+ ]),
62
+ t("div", I, [
63
+ e[7] || (e[7] = t("label", { class: "form-editor__label custom-label" }, "类型", -1)),
64
+ y(D(E), {
65
+ modelValue: o.value.type,
66
+ "onUpdate:modelValue": e[2] || (e[2] = (a) => o.value.type = a),
67
+ options: s,
68
+ class: "form-editor__radio-group"
69
+ }, null, 8, ["modelValue"])
70
+ ]),
71
+ t("div", N, [
72
+ e[8] || (e[8] = t("label", { class: "form-editor__label" }, "URL", -1)),
73
+ p(t("input", {
74
+ "onUpdate:modelValue": e[3] || (e[3] = (a) => o.value.url = a),
75
+ class: "form-editor__input",
76
+ type: "url",
77
+ placeholder: "请输入插件URL"
78
+ }, null, 512), [
79
+ [_, o.value.url]
80
+ ])
81
+ ]),
82
+ t("div", H, [
83
+ e[9] || (e[9] = t("label", { class: "form-editor__label" }, "请求头", -1)),
84
+ p(t("textarea", {
85
+ "onUpdate:modelValue": e[4] || (e[4] = (a) => o.value.headers = a),
86
+ class: "form-editor__textarea",
87
+ placeholder: "请输入请求头,格式为JSON"
88
+ }, null, 512), [
89
+ [_, o.value.headers]
90
+ ])
91
+ ]),
92
+ t("div", w, [
93
+ e[11] || (e[11] = t("label", { class: "form-editor__label custom-label" }, "缩略图", -1)),
94
+ t("div", {
95
+ class: "form-editor__file-upload",
96
+ onClick: x
97
+ }, [
98
+ t("img", {
99
+ src: d.value || C,
100
+ alt: "缩略图预览",
101
+ class: "form-editor__file-preview-image"
102
+ }, null, 8, A),
103
+ e[10] || (e[10] = t("div", { class: "form-editor__file-overlay" }, [
104
+ t("div", { class: "form-editor__file-icon" })
105
+ ], -1))
106
+ ])
107
+ ])
108
+ ]));
109
+ }
110
+ }), h = /* @__PURE__ */ T(P, [["__scopeId", "data-v-94f8726e"]]), j = { class: "code-editor__container" }, q = { class: "code-editor__section" }, z = { class: "code-editor__area" }, B = /* @__PURE__ */ g({
111
+ __name: "CodeEditor",
112
+ props: {
113
+ codeData: { required: !0 },
114
+ codeDataModifiers: {}
115
+ },
116
+ emits: ["update:codeData"],
117
+ setup(i) {
118
+ const d = k(i, "codeData");
119
+ return (o, s) => (v(), f("div", j, [
120
+ t("div", q, [
121
+ t("div", z, [
122
+ p(t("textarea", {
123
+ "onUpdate:modelValue": s[0] || (s[0] = (n) => d.value = n),
124
+ class: "code-editor__textarea",
125
+ placeholder: "请输入 JSON 配置..."
126
+ }, null, 512), [
127
+ [_, d.value]
128
+ ])
129
+ ])
130
+ ])
131
+ ]));
132
+ }
133
+ }), J = /* @__PURE__ */ T(B, [["__scopeId", "data-v-9907c109"]]), G = { class: "mcp-add-form" }, W = { class: "mcp-add-form__content" }, K = { class: "mcp-add-form__add-type" }, Q = { key: 0 }, X = { key: 1 }, Y = /* @__PURE__ */ g({
134
+ __name: "index",
135
+ props: {
136
+ addType: { default: "form" },
137
+ formData: {},
138
+ codeData: {}
139
+ },
140
+ emits: ["update:addType", "confirm", "cancel"],
141
+ setup(i, { emit: d }) {
142
+ const o = i, s = d, n = b(
143
+ o.formData || {
144
+ name: "",
145
+ description: "",
146
+ type: "streamableHttp",
147
+ url: "",
148
+ headers: "",
149
+ thumbnail: null
150
+ }
151
+ ), u = b(o.codeData || ""), r = b(o.addType), x = [
152
+ { label: "form", text: "表单添加" },
153
+ { label: "code", text: "代码添加" }
154
+ ], m = () => {
155
+ s("cancel");
156
+ }, e = () => {
157
+ r.value === "form" ? s("confirm", "form", n.value) : s("confirm", "code", u.value);
158
+ }, a = (V) => {
159
+ s("update:addType", V);
160
+ };
161
+ return (V, l) => (v(), f("div", G, [
162
+ t("div", W, [
163
+ t("div", K, [
164
+ l[3] || (l[3] = t("span", { class: "mcp-add-form__add-type-label" }, "添加方式", -1)),
165
+ y(D(E), {
166
+ modelValue: r.value,
167
+ "onUpdate:modelValue": [
168
+ l[0] || (l[0] = (c) => r.value = c),
169
+ a
170
+ ],
171
+ type: "button",
172
+ options: x
173
+ }, null, 8, ["modelValue"])
174
+ ]),
175
+ r.value === "form" ? (v(), f("div", Q, [
176
+ y(D(h), {
177
+ "form-data": n.value,
178
+ "onUpdate:formData": l[1] || (l[1] = (c) => n.value = c)
179
+ }, null, 8, ["form-data"])
180
+ ])) : $("", !0),
181
+ r.value === "code" ? (v(), f("div", X, [
182
+ y(D(J), {
183
+ "code-data": u.value,
184
+ "onUpdate:codeData": l[2] || (l[2] = (c) => u.value = c)
185
+ }, null, 8, ["code-data"])
186
+ ])) : $("", !0)
187
+ ]),
188
+ t("div", { class: "mcp-add-form__footer" }, [
189
+ t("div", {
190
+ class: "button cancel",
191
+ onClick: m
192
+ }, [...l[4] || (l[4] = [
193
+ t("span", null, "取消", -1)
194
+ ])]),
195
+ t("div", {
196
+ class: "button confirm",
197
+ onClick: e
198
+ }, [...l[5] || (l[5] = [
199
+ t("span", null, "确定", -1)
200
+ ])])
201
+ ])
202
+ ]));
203
+ }
204
+ }), U = /* @__PURE__ */ T(Y, [["__scopeId", "data-v-c4bac4dc"]]);
205
+ U.name = "TrMcpAddForm";
206
+ const Z = function(i) {
207
+ i.component(U.name, U);
208
+ };
209
+ U.install = Z;
210
+ export {
211
+ U as default
212
+ };