@opentiny/tiny-engine-plugin-bridge 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import "./style.css";
2
- import { reactive as j, ref as T, watchEffect as Z, resolveComponent as m, openBlock as h, createElementBlock as L, createElementVNode as _, createVNode as s, withCtx as l, Fragment as te, renderList as ne, normalizeClass as oe, withModifiers as K, toDisplayString as k, computed as R, watch as ae, onMounted as se, createBlock as C, createTextVNode as A, withDirectives as re, vShow as le, createCommentVNode as U, nextTick as ce } from "vue";
3
- import { SearchEmpty as ie, PluginSetting as de, VueMonaco as pe, SvgButton as $, PluginPanel as ue } from "@opentiny/tiny-engine-common";
4
- import { getMetaApi as b, META_SERVICE as S, useCanvas as ee, useResource as N, useNotify as B, useModal as me, getMergeMeta as ge } from "@opentiny/tiny-engine-meta-register";
5
- import { isVsCodeEnv as ye } from "@opentiny/tiny-engine-common/js/environments";
6
- import { generateBridge as fe, generateUtil as _e } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
7
- import { Search as ve, Form as he, Input as Ee, Button as Re, FormItem as Ce, Checkbox as Ve, RadioGroup as be, Radio as Se } from "@opentiny/vue";
8
- import { iconSearch as xe } from "@opentiny/vue-icon";
9
- const Te = (n, t) => b(S.Http).get(`/app-center/api/apps/extension/list?app=${n}&category=${t}`), Ue = (n) => b(S.Http).post("/app-center/api/apps/extension/create", n), ke = (n) => b(S.Http).post("/app-center/api/apps/extension/update", n), Ne = (n) => b(S.Http).get(`/app-center/api/apps/extension/delete?${n}`), Be = (n) => {
10
- b(S.Http).get(`/app-center/api/apps/schema/${n}`).then((t) => {
11
- fe(t.bridge), _e(t.utils);
2
+ import { reactive as j, ref as k, watchEffect as Z, resolveComponent as m, openBlock as v, createElementBlock as A, createElementVNode as _, createVNode as s, withCtx as l, Fragment as ee, renderList as te, normalizeClass as ne, withModifiers as K, toDisplayString as U, computed as R, watch as oe, onMounted as ae, createBlock as C, createTextVNode as L, withDirectives as se, vShow as re, createCommentVNode as N, nextTick as le } from "vue";
3
+ import { SearchEmpty as ce, PluginSetting as ie, VueMonaco as de, SvgButton as $, PluginPanel as pe } from "@opentiny/tiny-engine-common";
4
+ import { getMetaApi as b, META_SERVICE as x, useResource as B, useNotify as V, useModal as ue, getMergeMeta as me } from "@opentiny/tiny-engine-meta-register";
5
+ import { isVsCodeEnv as ge } from "@opentiny/tiny-engine-common/js/environments";
6
+ import { generateBridge as ye, generateUtil as fe } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
7
+ import { Search as _e, Form as ve, Input as he, Button as Ee, FormItem as Re, Checkbox as Ce, RadioGroup as Ve, Radio as Se } from "@opentiny/vue";
8
+ import { iconSearch as be } from "@opentiny/vue-icon";
9
+ const xe = (n, t) => b(x.Http).get(`/app-center/api/apps/extension/list?app=${n}&category=${t}`), Te = (n) => b(x.Http).post("/app-center/api/apps/extension/create", n), ke = (n) => b(x.Http).post("/app-center/api/apps/extension/update", n), Ne = (n) => b(x.Http).get(`/app-center/api/apps/extension/delete?${n}`), Ue = (n) => {
10
+ b(x.Http).get(`/app-center/api/apps/schema/${n}`).then((t) => {
11
+ ye(t.bridge), fe(t.utils);
12
12
  });
13
- }, i = j({
13
+ }, c = j({
14
14
  actionType: "",
15
15
  type: "",
16
16
  category: "",
@@ -30,124 +30,137 @@ const Te = (n, t) => b(S.Http).get(`/app-center/api/apps/extension/list?app=${n}
30
30
  destructuring: !0,
31
31
  main: ""
32
32
  }
33
- }, Ie = {
33
+ }, Be = {
34
34
  name: "",
35
35
  type: "function",
36
36
  content: {
37
37
  type: "JSFunction",
38
38
  value: ""
39
39
  }
40
- }, V = {
40
+ }, S = {
41
41
  Util: "utils",
42
42
  Bridge: "bridge"
43
43
  }, F = {
44
44
  Npm: "npm",
45
45
  Function: "function"
46
- }, we = {
47
- [V.Util]: "新建工具类",
48
- [V.Bridge]: "新建桥接源"
46
+ }, Ie = {
47
+ [S.Util]: "新建工具类",
48
+ [S.Bridge]: "新建桥接源"
49
49
  }, I = {
50
50
  Read: "read",
51
51
  Edit: "edit"
52
- }, w = () => b(S.GlobalService).getBaseInfo().id, Oe = (n) => i.resourceNames[n], Ae = (n, t) => {
53
- i.resourceNames[n] = t;
52
+ }, w = () => b(x.GlobalService).getBaseInfo().id, we = (n) => c.resourceNames[n], Oe = (n, t) => {
53
+ c.resourceNames[n] = t;
54
54
  }, Le = (n) => {
55
55
  const t = w();
56
- return Te(t, n);
57
- }, Y = () => i.actionType, M = (n) => {
58
- i.actionType = n;
59
- }, Fe = () => i.resource, G = (n = Q) => {
60
- n || (n = i.category === F.Function ? Ie : Q), i.resource = n;
61
- }, P = () => i.type, X = (n) => {
62
- i.type = n;
56
+ return xe(t, n);
57
+ }, Y = () => c.actionType, M = (n) => {
58
+ c.actionType = n;
59
+ }, Ae = () => c.resource, G = (n = Q) => {
60
+ n || (n = c.category === F.Function ? Be : Q), c.resource = n;
61
+ }, P = () => c.type, X = (n) => {
62
+ c.type = n;
63
63
  }, H = (n) => {
64
- i.category = n;
65
- }, q = () => i.category, z = (...n) => {
66
- ye && Be(...n);
67
- }, Pe = (n, t, u) => {
68
- const { updateUtils: e } = ee().canvasApi.value;
69
- Y() === I.Edit ? (n.id = i.resource.id, ke(n).then((o) => {
70
- if (o) {
71
- const y = N().resState[n.category].findIndex((c) => c.name === o.name);
72
- N().resState[n.category][y] = o, e([o]), z(w()), B({
64
+ c.category = n;
65
+ }, q = () => c.category, z = (...n) => {
66
+ ge && Ue(...n);
67
+ }, Fe = (n, t, p) => {
68
+ Y() === I.Edit ? (n.id = c.resource.id, ke(n).then((e) => {
69
+ if (e) {
70
+ const o = B().appSchemaState[n.category].findIndex((y) => y.name === e.name);
71
+ if (o === -1) {
72
+ V({
73
+ type: "error",
74
+ message: "修改失败"
75
+ });
76
+ return;
77
+ }
78
+ B().appSchemaState[n.category][o] = e, z(w()), V({
73
79
  type: "success",
74
80
  message: "修改成功"
75
- }), u("refresh", i.type), i.refresh = !0, t();
81
+ }), p("refresh", c.type), c.refresh = !0, t();
76
82
  }
77
- })) : Ue(n).then((o) => {
78
- o && (N().resState[n.category].push(o), e([o]), z(w()), B({
83
+ })) : Te(n).then((e) => {
84
+ e && (B().appSchemaState[n.category].push(e), z(w()), V({
79
85
  type: "success",
80
86
  message: "创建成功"
81
- }), u("refresh", i.type), i.refresh = !0, t());
87
+ }), p("refresh", c.type), c.refresh = !0, t());
82
88
  });
83
- }, De = (n, t, u) => {
84
- var y;
85
- const e = `app=${w()}&id=${(y = i.resource) == null ? void 0 : y.id}`, { deleteUtils: o } = ee().canvasApi.value;
86
- Ne(e).then((c) => {
87
- if (c) {
88
- const f = N().resState[i.type].findIndex((v) => v.name === c.name);
89
- N().resState[i.type].splice(f, 1), o([c]), z(w()), B({
89
+ }, Pe = (n, t, p) => {
90
+ var o;
91
+ const e = `app=${w()}&id=${(o = c.resource) == null ? void 0 : o.id}`;
92
+ Ne(e).then((y) => {
93
+ if (y) {
94
+ const u = B().appSchemaState[c.type].findIndex((f) => f.name === y.name);
95
+ if (u === -1) {
96
+ V({
97
+ type: "error",
98
+ message: "删除失败"
99
+ });
100
+ return;
101
+ }
102
+ B().appSchemaState[c.type].splice(u, 1), z(w()), V({
90
103
  type: "success",
91
104
  message: "删除成功"
92
- }), u("refresh", i.type), i.refresh = !0, t();
105
+ }), p("refresh", c.type), c.refresh = !0, t();
93
106
  }
94
107
  });
95
108
  }, J = (n, t) => {
96
- const u = n.__vccOpts || n;
109
+ const p = n.__vccOpts || n;
97
110
  for (const [e, o] of t)
98
- u[e] = o;
99
- return u;
100
- }, Me = {
111
+ p[e] = o;
112
+ return p;
113
+ }, De = {
101
114
  components: {
102
- TinySearch: ve,
103
- TinyIconSearch: xe(),
104
- SearchEmpty: ie
115
+ TinySearch: _e,
116
+ TinyIconSearch: be(),
117
+ SearchEmpty: ce
105
118
  },
106
119
  props: {
107
120
  name: {
108
121
  type: String,
109
- default: V.Util
122
+ default: S.Util
110
123
  }
111
124
  },
112
125
  emits: ["open"],
113
126
  setup(n, { emit: t }) {
114
- const u = T([]), e = j({
127
+ const p = k([]), e = j({
115
128
  resourceList: [],
116
129
  activeIndex: -1,
117
130
  searchValue: ""
118
- }), o = (a = e.resourceList, d = e.searchValue) => a.filter((r) => r.name.toLowerCase().indexOf(d.toLowerCase()) > -1), y = async (a) => {
119
- e.resourceList = await Le(a), Ae(
131
+ }), o = (a = e.resourceList, i = e.searchValue) => a.filter((r) => r.name.toLowerCase().indexOf(i.toLowerCase()) > -1), y = async (a) => {
132
+ e.resourceList = await Le(a), Oe(
120
133
  a,
121
- Array.isArray(e.resourceList) ? e.resourceList.map((d) => d.name) : []
122
- ), u.value = o(e.resourceList);
134
+ Array.isArray(e.resourceList) ? e.resourceList.map((i) => i.name) : []
135
+ ), p.value = o(e.resourceList);
123
136
  };
124
137
  return Z(async () => {
125
138
  y(n.name);
126
139
  }), {
127
140
  state: e,
128
- list: u,
141
+ list: p,
129
142
  add: (a) => {
130
143
  M(""), X(n.name), G(""), H(a), t("open");
131
144
  },
132
- openRead: (a, d) => {
133
- e.activeIndex = d, G(a), M(I.Edit), t("open");
145
+ openRead: (a, i) => {
146
+ e.activeIndex = i, G(a), M(I.Edit), t("open");
134
147
  },
135
- openEdit: (a, d) => {
136
- e.activeIndex = d, G(a), M(I.Edit), X(n.name), H(a.type), t("open");
148
+ openEdit: (a, i) => {
149
+ e.activeIndex = i, G(a), M(I.Edit), X(n.name), H(a.type), t("open");
137
150
  },
138
151
  refresh: y,
139
152
  getType: P,
140
- RESOURCE_TYPE: V,
153
+ RESOURCE_TYPE: S,
141
154
  searchBridgeData: (a) => {
142
- u.value = o(e.resourceList, a);
155
+ p.value = o(e.resourceList, a);
143
156
  }
144
157
  };
145
158
  }
146
- }, Ge = { class: "manage-panel" }, qe = { class: "manage-panel-search" }, Ye = { class: "list" }, He = ["onClick"], ze = { class: "item-label" };
147
- function je(n, t, u, e, o, y) {
148
- const c = m("tiny-icon-search"), f = m("tiny-search"), v = m("svg-icon"), E = m("search-empty");
149
- return h(), L("div", Ge, [
150
- _("div", qe, [
159
+ }, Me = { class: "manage-panel" }, Ge = { class: "manage-panel-search" }, qe = { class: "list" }, Ye = ["onClick"], He = { class: "item-label" };
160
+ function ze(n, t, p, e, o, y) {
161
+ const u = m("tiny-icon-search"), f = m("tiny-search"), h = m("svg-icon"), E = m("search-empty");
162
+ return v(), A("div", Me, [
163
+ _("div", Ge, [
151
164
  s(f, {
152
165
  modelValue: e.state.searchValue,
153
166
  "onUpdate:modelValue": [
@@ -158,58 +171,58 @@ function je(n, t, u, e, o, y) {
158
171
  placeholder: "搜索"
159
172
  }, {
160
173
  prefix: l(() => [
161
- s(c)
174
+ s(u)
162
175
  ]),
163
176
  _: 1
164
177
  }, 8, ["modelValue", "onUpdate:modelValue"])
165
178
  ]),
166
- _("div", Ye, [
167
- (h(!0), L(te, null, ne(e.list, (a, d) => (h(), L("div", {
179
+ _("div", qe, [
180
+ (v(!0), A(ee, null, te(e.list, (a, i) => (v(), A("div", {
168
181
  key: a.name,
169
- class: oe(["list-item", d === e.state.activeIndex ? "active" : ""]),
170
- onClick: K((r) => e.openEdit(a, d), ["stop"])
182
+ class: ne(["list-item", i === e.state.activeIndex ? "active" : ""]),
183
+ onClick: K((r) => e.openEdit(a, i), ["stop"])
171
184
  }, [
172
- s(v, { name: "plugin-icon-sresources" }),
173
- _("div", ze, k(a.name), 1),
174
- s(v, {
185
+ s(h, { name: "plugin-icon-sresources" }),
186
+ _("div", He, U(a.name), 1),
187
+ s(h, {
175
188
  class: "setting-icon",
176
189
  name: "setting",
177
- onClick: K((r) => e.openEdit(a, d), ["stop"])
190
+ onClick: K((r) => e.openEdit(a, i), ["stop"])
178
191
  }, null, 8, ["onClick"])
179
- ], 10, He))), 128)),
192
+ ], 10, Ye))), 128)),
180
193
  s(E, {
181
194
  isShow: !e.list.length
182
195
  }, null, 8, ["isShow"])
183
196
  ])
184
197
  ]);
185
198
  }
186
- const Je = /* @__PURE__ */ J(Me, [["render", je], ["__scopeId", "data-v-f297beff"]]), W = T(!1), We = () => {
187
- W.value = !0, ce(() => window.dispatchEvent(new Event("resize")));
199
+ const je = /* @__PURE__ */ J(De, [["render", ze], ["__scopeId", "data-v-f297beff"]]), W = k(!1), Je = () => {
200
+ W.value = !0, le(() => window.dispatchEvent(new Event("resize")));
188
201
  }, D = () => {
189
202
  W.value = !1;
190
- }, Ke = {
203
+ }, We = {
191
204
  components: {
192
- TinyForm: he,
193
- TinyInput: Ee,
194
- TinyButton: Re,
195
- TinyFormItem: Ce,
196
- TinyCheckbox: Ve,
197
- PluginSetting: de,
198
- MonacoEditor: pe,
199
- TinyRadioGroup: be,
205
+ TinyForm: ve,
206
+ TinyInput: he,
207
+ TinyButton: Ee,
208
+ TinyFormItem: Re,
209
+ TinyCheckbox: Ce,
210
+ PluginSetting: ie,
211
+ MonacoEditor: de,
212
+ TinyRadioGroup: Ve,
200
213
  TinyRadio: Se,
201
214
  SvgButton: $
202
215
  },
203
216
  setup(n, { emit: t }) {
204
- const u = {
217
+ const p = {
205
218
  language: "javascript",
206
219
  mouseStyle: "default",
207
220
  minimap: { enabled: !1 },
208
221
  // 禁用滚动条边边一直显示的边框
209
222
  overviewRulerBorder: !1,
210
223
  renderLineHighlightOnlyWhenFocus: !0
211
- }, { confirm: e } = me(), o = j({
212
- resource: R(() => Fe()),
224
+ }, { confirm: e } = ue(), o = j({
225
+ resource: R(() => Ae()),
213
226
  name: "",
214
227
  value: "",
215
228
  content: {},
@@ -217,11 +230,11 @@ const Je = /* @__PURE__ */ J(Me, [["render", je], ["__scopeId", "data-v-f297beff
217
230
  category: R(() => q() === F.Npm),
218
231
  mode: R(() => {
219
232
  var r;
220
- return ((r = ge("engine.config")) == null ? void 0 : r.dslMode) !== "Vue";
233
+ return ((r = me("engine.config")) == null ? void 0 : r.dslMode) !== "Vue";
221
234
  }),
222
235
  isInstance: !1,
223
236
  title: R(() => {
224
- const r = Y() === I.Edit ? "编辑" : "添加", g = P() === V.Bridge ? "桥接源" : "工具类";
237
+ const r = Y() === I.Edit ? "编辑" : "添加", g = P() === S.Bridge ? "桥接源" : "工具类";
225
238
  return r + g;
226
239
  }),
227
240
  type: F.Npm
@@ -229,28 +242,28 @@ const Je = /* @__PURE__ */ J(Me, [["render", je], ["__scopeId", "data-v-f297beff
229
242
  const r = o.name || "name";
230
243
  let g = r;
231
244
  o.content.destructuring && (o.name && o.name === o.content.exportName ? g = `{ ${o.content.exportName || "exportName"} }` : g = `{ ${o.content.exportName || "exportName"} as ${r} }`);
232
- const x = `${o.content.package || "package"}${o.content.main || ""}`;
233
- return `import ${g} from '${x}'
245
+ const T = `${o.content.package || "package"}${o.content.main || ""}`;
246
+ return `import ${g} from '${T}'
234
247
  export { ${r} }`;
235
248
  });
236
249
  Z(() => {
237
250
  var r, g;
238
251
  o.name = o.resource.name, o.content = o.resource.content || {}, o.value = ((g = (r = o.resource) == null ? void 0 : r.content) == null ? void 0 : g.value) || "", o.type = q();
239
- }), ae(
252
+ }), oe(
240
253
  () => o.isInstance,
241
254
  (r) => {
242
255
  r || (o.content.instance = "");
243
256
  }
244
257
  );
245
- const c = T(null), f = T(null);
246
- return se(() => window.dispatchEvent(new Event("resize"))), {
258
+ const u = k(null), f = k(null);
259
+ return ae(() => window.dispatchEvent(new Event("resize"))), {
247
260
  rules: {
248
261
  name: [
249
262
  { required: !0, message: "必填", trigger: "change" },
250
263
  {
251
- validator: (r, g, x) => {
252
- const O = Oe(P());
253
- Array.isArray(O) && O.includes(g) ? x(new Error("资源名称已存在")) : x();
264
+ validator: (r, g, T) => {
265
+ const O = we(P());
266
+ Array.isArray(O) && O.includes(g) ? T(new Error("资源名称已存在")) : T();
254
267
  },
255
268
  trigger: "change"
256
269
  }
@@ -260,7 +273,7 @@ export { ${r} }`;
260
273
  "content.instanceName": { required: !0, message: "必填", trigger: "change" }
261
274
  },
262
275
  resourceForm: f,
263
- editor: c,
276
+ editor: u,
264
277
  state: o,
265
278
  codePreview: y,
266
279
  isOpen: W,
@@ -270,28 +283,28 @@ export { ${r} }`;
270
283
  category: P(),
271
284
  type: q(),
272
285
  name: o.name,
273
- app: b(S.GlobalService).getBaseInfo().id,
286
+ app: b(x.GlobalService).getBaseInfo().id,
274
287
  content: o.category ? o.content : {
275
288
  type: "JSFunction",
276
- value: c.value.getEditor().getValue()
289
+ value: u.value.getEditor().getValue()
277
290
  }
278
291
  };
279
292
  f.value.validate((g) => {
280
293
  if (!g) {
281
- B({
294
+ V({
282
295
  type: "error",
283
296
  message: "请检查必填项"
284
297
  });
285
298
  return;
286
299
  }
287
- if (!o.category && !c.value.getEditor().getValue()) {
288
- B({
300
+ if (!o.category && !u.value.getEditor().getValue()) {
301
+ V({
289
302
  type: "error",
290
303
  message: "function 内容必填"
291
304
  });
292
305
  return;
293
306
  }
294
- Pe(r, D, t);
307
+ Fe(r, D, t);
295
308
  });
296
309
  },
297
310
  deleteReSource: () => {
@@ -299,44 +312,44 @@ export { ${r} }`;
299
312
  title: "删除资源",
300
313
  message: "如果删除正在使用的资源,将无法正常预览页面,确认要删除吗?",
301
314
  exec: () => {
302
- De(o.name, D, t);
315
+ Pe(o.name, D, t);
303
316
  }
304
317
  });
305
318
  },
306
- options: u,
319
+ options: p,
307
320
  handleChangeType: (r) => {
308
321
  H(r);
309
322
  },
310
323
  RESOURCE_CATEGORY: F
311
324
  };
312
325
  }
313
- }, Qe = { class: "title-wrap" }, Xe = { class: "header-wrap" }, Ze = { class: "right-item" }, $e = { key: 2 }, et = { class: "code-preview" };
314
- function tt(n, t, u, e, o, y) {
315
- const c = m("tiny-button"), f = m("svg-button"), v = m("tiny-radio"), E = m("tiny-radio-group"), a = m("tiny-form-item"), d = m("tiny-input"), r = m("tiny-checkbox"), g = m("monaco-editor"), x = m("tiny-form"), O = m("plugin-setting");
316
- return e.isOpen ? (h(), C(O, { key: 0 }, {
326
+ }, Ke = { class: "title-wrap" }, Qe = { class: "header-wrap" }, Xe = { class: "right-item" }, Ze = { key: 2 }, $e = { class: "code-preview" };
327
+ function et(n, t, p, e, o, y) {
328
+ const u = m("tiny-button"), f = m("svg-button"), h = m("tiny-radio"), E = m("tiny-radio-group"), a = m("tiny-form-item"), i = m("tiny-input"), r = m("tiny-checkbox"), g = m("monaco-editor"), T = m("tiny-form"), O = m("plugin-setting");
329
+ return e.isOpen ? (v(), C(O, { key: 0 }, {
317
330
  title: l(() => [
318
- _("div", Qe, [
319
- _("span", null, k(e.state.title), 1)
331
+ _("div", Ke, [
332
+ _("span", null, U(e.state.title), 1)
320
333
  ])
321
334
  ]),
322
335
  header: l(() => [
323
- _("div", Xe, [
324
- s(c, {
336
+ _("div", Qe, [
337
+ s(u, {
325
338
  class: "save-btn",
326
339
  type: "primary",
327
340
  onClick: e.save
328
341
  }, {
329
342
  default: l(() => t[10] || (t[10] = [
330
- A("保存")
343
+ L("保存")
331
344
  ])),
332
345
  _: 1
333
346
  }, 8, ["onClick"]),
334
- re(s(f, {
347
+ se(s(f, {
335
348
  class: "delete-btn",
336
349
  name: "delete",
337
350
  onClick: e.deleteReSource
338
351
  }, null, 8, ["onClick"]), [
339
- [le, e.state.status]
352
+ [re, e.state.status]
340
353
  ]),
341
354
  s(f, {
342
355
  class: "close-btn",
@@ -346,7 +359,7 @@ function tt(n, t, u, e, o, y) {
346
359
  ])
347
360
  ]),
348
361
  content: l(() => [
349
- s(x, {
362
+ s(T, {
350
363
  ref: "resourceForm",
351
364
  class: "resource-form",
352
365
  rules: e.rules,
@@ -357,8 +370,8 @@ function tt(n, t, u, e, o, y) {
357
370
  "label-align": !0
358
371
  }, {
359
372
  default: l(() => [
360
- _("div", Ze, [
361
- e.state.status ? U("", !0) : (h(), C(a, {
373
+ _("div", Xe, [
374
+ e.state.status ? N("", !0) : (v(), C(a, {
362
375
  key: 0,
363
376
  label: "工具类型",
364
377
  prop: "type"
@@ -366,24 +379,24 @@ function tt(n, t, u, e, o, y) {
366
379
  default: l(() => [
367
380
  s(E, {
368
381
  modelValue: e.state.type,
369
- "onUpdate:modelValue": t[0] || (t[0] = (p) => e.state.type = p),
382
+ "onUpdate:modelValue": t[0] || (t[0] = (d) => e.state.type = d),
370
383
  class: "resource-type-radio-group",
371
384
  onChange: e.handleChangeType
372
385
  }, {
373
386
  default: l(() => [
374
- s(v, {
387
+ s(h, {
375
388
  label: e.RESOURCE_CATEGORY.Npm
376
389
  }, {
377
390
  default: l(() => [
378
- A(k(e.RESOURCE_CATEGORY.Npm), 1)
391
+ L(U(e.RESOURCE_CATEGORY.Npm), 1)
379
392
  ]),
380
393
  _: 1
381
394
  }, 8, ["label"]),
382
- s(v, {
395
+ s(h, {
383
396
  label: e.RESOURCE_CATEGORY.Function
384
397
  }, {
385
398
  default: l(() => [
386
- A(k(e.RESOURCE_CATEGORY.Function), 1)
399
+ L(U(e.RESOURCE_CATEGORY.Function), 1)
387
400
  ]),
388
401
  _: 1
389
402
  }, 8, ["label"])
@@ -393,29 +406,29 @@ function tt(n, t, u, e, o, y) {
393
406
  ]),
394
407
  _: 1
395
408
  })),
396
- e.state.status ? U("", !0) : (h(), C(a, {
409
+ e.state.status ? N("", !0) : (v(), C(a, {
397
410
  key: 1,
398
411
  label: "工具名称",
399
412
  prop: "name"
400
413
  }, {
401
414
  default: l(() => [
402
- s(d, {
415
+ s(i, {
403
416
  modelValue: e.state.name,
404
- "onUpdate:modelValue": t[1] || (t[1] = (p) => e.state.name = p),
417
+ "onUpdate:modelValue": t[1] || (t[1] = (d) => e.state.name = d),
405
418
  placeholder: "请输入工具类名称"
406
419
  }, null, 8, ["modelValue"])
407
420
  ]),
408
421
  _: 1
409
422
  })),
410
- e.state.category ? (h(), L("div", $e, [
423
+ e.state.category ? (v(), A("div", Ze, [
411
424
  s(a, {
412
425
  label: "npm包名",
413
426
  prop: "content.package"
414
427
  }, {
415
428
  default: l(() => [
416
- s(d, {
429
+ s(i, {
417
430
  modelValue: e.state.content.package,
418
- "onUpdate:modelValue": t[2] || (t[2] = (p) => e.state.content.package = p),
431
+ "onUpdate:modelValue": t[2] || (t[2] = (d) => e.state.content.package = d),
419
432
  placeholder: "请输入npm包名称"
420
433
  }, null, 8, ["modelValue"])
421
434
  ]),
@@ -426,9 +439,9 @@ function tt(n, t, u, e, o, y) {
426
439
  prop: "content.exportName"
427
440
  }, {
428
441
  default: l(() => [
429
- s(d, {
442
+ s(i, {
430
443
  modelValue: e.state.content.exportName,
431
- "onUpdate:modelValue": t[3] || (t[3] = (p) => e.state.content.exportName = p),
444
+ "onUpdate:modelValue": t[3] || (t[3] = (d) => e.state.content.exportName = d),
432
445
  placeholder: "请输入npm包的导出名称"
433
446
  }, null, 8, ["modelValue"])
434
447
  ]),
@@ -438,46 +451,46 @@ function tt(n, t, u, e, o, y) {
438
451
  default: l(() => [
439
452
  s(r, {
440
453
  modelValue: e.state.content.destructuring,
441
- "onUpdate:modelValue": t[4] || (t[4] = (p) => e.state.content.destructuring = p)
454
+ "onUpdate:modelValue": t[4] || (t[4] = (d) => e.state.content.destructuring = d)
442
455
  }, {
443
456
  default: l(() => t[11] || (t[11] = [
444
- A("解构npm包")
457
+ L("解构npm包")
445
458
  ])),
446
459
  _: 1
447
460
  }, 8, ["modelValue"])
448
461
  ]),
449
462
  _: 1
450
463
  }),
451
- e.state.mode ? (h(), C(a, {
464
+ e.state.mode ? (v(), C(a, {
452
465
  key: 0,
453
466
  label: "是否作为实例"
454
467
  }, {
455
468
  default: l(() => [
456
469
  s(r, {
457
470
  modelValue: e.state.isInstance,
458
- "onUpdate:modelValue": t[5] || (t[5] = (p) => e.state.isInstance = p)
471
+ "onUpdate:modelValue": t[5] || (t[5] = (d) => e.state.isInstance = d)
459
472
  }, null, 8, ["modelValue"])
460
473
  ]),
461
474
  _: 1
462
- })) : U("", !0),
463
- e.state.isInstance ? (h(), C(a, {
475
+ })) : N("", !0),
476
+ e.state.isInstance ? (v(), C(a, {
464
477
  key: 1,
465
478
  label: "实例名称",
466
479
  prop: "content.instanceName"
467
480
  }, {
468
481
  default: l(() => [
469
- s(d, {
482
+ s(i, {
470
483
  modelValue: e.state.content.instance,
471
- "onUpdate:modelValue": t[6] || (t[6] = (p) => e.state.content.instance = p)
484
+ "onUpdate:modelValue": t[6] || (t[6] = (d) => e.state.content.instance = d)
472
485
  }, null, 8, ["modelValue"])
473
486
  ]),
474
487
  _: 1
475
- })) : U("", !0),
488
+ })) : N("", !0),
476
489
  s(a, { label: "入口路径" }, {
477
490
  default: l(() => [
478
- s(d, {
491
+ s(i, {
479
492
  modelValue: e.state.content.main,
480
- "onUpdate:modelValue": t[7] || (t[7] = (p) => e.state.content.main = p),
493
+ "onUpdate:modelValue": t[7] || (t[7] = (d) => e.state.content.main = d),
481
494
  placeholder: "main"
482
495
  }, null, 8, ["modelValue"])
483
496
  ]),
@@ -485,9 +498,9 @@ function tt(n, t, u, e, o, y) {
485
498
  }),
486
499
  s(a, { label: "版本号" }, {
487
500
  default: l(() => [
488
- s(d, {
501
+ s(i, {
489
502
  modelValue: e.state.content.version,
490
- "onUpdate:modelValue": t[8] || (t[8] = (p) => e.state.content.version = p),
503
+ "onUpdate:modelValue": t[8] || (t[8] = (d) => e.state.content.version = d),
491
504
  placeholder: "latest"
492
505
  }, null, 8, ["modelValue"])
493
506
  ]),
@@ -500,9 +513,9 @@ function tt(n, t, u, e, o, y) {
500
513
  ], -1)
501
514
  ])),
502
515
  default: l(() => [
503
- s(d, {
516
+ s(i, {
504
517
  modelValue: e.state.content.cdnLink,
505
- "onUpdate:modelValue": t[9] || (t[9] = (p) => e.state.content.cdnLink = p),
518
+ "onUpdate:modelValue": t[9] || (t[9] = (d) => e.state.content.cdnLink = d),
506
519
  placeholder: "CDN"
507
520
  }, null, 8, ["modelValue"]),
508
521
  t[13] || (t[13] = _("div", { class: "tip" }, "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败", -1))
@@ -511,13 +524,13 @@ function tt(n, t, u, e, o, y) {
511
524
  }),
512
525
  s(a, { label: "生成utils.js代码预览" }, {
513
526
  default: l(() => [
514
- _("div", et, [
515
- _("pre", null, k(e.codePreview), 1)
527
+ _("div", $e, [
528
+ _("pre", null, U(e.codePreview), 1)
516
529
  ])
517
530
  ]),
518
531
  _: 1
519
532
  })
520
- ])) : (h(), C(g, {
533
+ ])) : (v(), C(g, {
521
534
  key: 3,
522
535
  ref: "editor",
523
536
  value: e.state.value,
@@ -530,44 +543,44 @@ function tt(n, t, u, e, o, y) {
530
543
  }, 8, ["rules", "model"])
531
544
  ]),
532
545
  _: 1
533
- })) : U("", !0);
546
+ })) : N("", !0);
534
547
  }
535
- const nt = /* @__PURE__ */ J(Ke, [["render", tt], ["__scopeId", "data-v-335043fc"]]), ot = {
548
+ const tt = /* @__PURE__ */ J(We, [["render", et], ["__scopeId", "data-v-0ab8a7ca"]]), nt = {
536
549
  components: {
537
- PluginPanel: ue,
550
+ PluginPanel: pe,
538
551
  SvgButton: $,
539
- BridgeManage: Je,
540
- BridgeSetting: nt
552
+ BridgeManage: je,
553
+ BridgeSetting: tt
541
554
  },
542
555
  setup() {
543
- const n = T(V.Util), t = T(null), u = R(() => we[n.value]);
556
+ const n = k(S.Util), t = k(null), p = R(() => Ie[n.value]);
544
557
  return {
545
- addResource: (c) => {
546
- n.value == t.value.add(c);
558
+ addResource: (u) => {
559
+ n.value == t.value.add(u);
547
560
  },
548
- RESOURCE_TYPE: V,
561
+ RESOURCE_TYPE: S,
549
562
  activedName: n,
550
563
  openBridgePanel: () => {
551
- We();
564
+ Je();
552
565
  },
553
566
  closePanel: D,
554
- refreshList: (c) => {
555
- c == t.value.refresh(c);
567
+ refreshList: (u) => {
568
+ u == t.value.refresh(u);
556
569
  },
557
570
  utilsRef: t,
558
- tips: u
571
+ tips: p
559
572
  };
560
573
  }
561
574
  };
562
- function at(n, t, u, e, o, y) {
563
- const c = m("svg-button"), f = m("bridge-manage"), v = m("bridge-setting"), E = m("plugin-panel");
564
- return h(), C(E, {
575
+ function ot(n, t, p, e, o, y) {
576
+ const u = m("svg-button"), f = m("bridge-manage"), h = m("bridge-setting"), E = m("plugin-panel");
577
+ return v(), C(E, {
565
578
  title: "资源管理",
566
579
  isCloseLeft: !1,
567
580
  onClose: e.closePanel
568
581
  }, {
569
582
  header: l(() => [
570
- s(c, {
583
+ s(u, {
571
584
  name: "add-utils",
572
585
  placement: "left",
573
586
  tips: e.tips,
@@ -580,21 +593,21 @@ function at(n, t, u, e, o, y) {
580
593
  name: e.RESOURCE_TYPE.Util,
581
594
  onOpen: e.openBridgePanel
582
595
  }, null, 8, ["name", "onOpen"]),
583
- s(v, { onRefresh: e.refreshList }, null, 8, ["onRefresh"])
596
+ s(h, { onRefresh: e.refreshList }, null, 8, ["onRefresh"])
584
597
  ]),
585
598
  _: 1
586
599
  }, 8, ["onClose"]);
587
600
  }
588
- const st = /* @__PURE__ */ J(ot, [["render", at], ["__scopeId", "data-v-c14cfd0a"]]), rt = {
601
+ const at = /* @__PURE__ */ J(nt, [["render", ot], ["__scopeId", "data-v-c14cfd0a"]]), st = {
589
602
  id: "engine.plugins.bridge",
590
603
  title: "资源管理",
591
604
  type: "plugins",
592
605
  align: "top",
593
606
  icon: "plugin-icon-sresources"
594
- }, yt = {
595
- ...rt,
596
- entry: st
607
+ }, gt = {
608
+ ...st,
609
+ entry: at
597
610
  };
598
611
  export {
599
- yt as default
612
+ gt as default
600
613
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .manage-panel[data-v-f297beff]{height:100%;display:flex;flex-direction:column;position:relative}.manage-panel .manage-panel-search[data-v-f297beff]{padding:0 12px 12px}.manage-panel .add-button[data-v-f297beff]{align-self:flex-end;margin:6px}.manage-panel .list[data-v-f297beff]{flex:1;border-top:1px solid var(--ti-lowcode-tabs-border-color);overflow:auto;padding:12px 0}.manage-panel .list-item[data-v-f297beff]{height:24px;line-height:24px;display:grid;grid-template-columns:16px 1fr auto;column-gap:8px;align-items:center;padding:0 12px;position:relative;color:var(--ti-lowcode-bridge-list-color);cursor:pointer;font-size:12px}.manage-panel .list-item[data-v-f297beff]:hover,.manage-panel .list-item.active[data-v-f297beff]{background:var(--ti-lowcode-bridge-list-bg)}.manage-panel .list-item:hover .setting-icon[data-v-f297beff],.manage-panel .list-item.active .setting-icon[data-v-f297beff]{display:block}.manage-panel .list-item .setting-icon[data-v-f297beff]{display:none;color:var(--ti-lowcode-toolbar-more-hover-color)}.plugin-setting[data-v-335043fc] .icon-wrap{margin-right:8px}.plugin-setting .resource-form .tip[data-v-335043fc]{font-size:11px;line-height:18px;margin-top:8px;color:var(--ti-lowcode-datasource-tip-color)}.plugin-setting .resource-form[data-v-335043fc] .tiny-form-item__label .cdn-tips-icon{margin-left:4px}.plugin-setting .title-wrap[data-v-335043fc]{font-size:12px;font-weight:700;color:var(--ti-lowcode-data-source-color)}.plugin-setting .title-wrap .help-link[data-v-335043fc]{display:inline-block;color:var(--ti-lowcode-common-primary-color);font-size:12px;margin-left:16px}.plugin-setting .title-wrap .help-link[data-v-335043fc]:hover{text-decoration:underline}.plugin-setting .header-wrap[data-v-335043fc]{display:flex;align-items:center;column-gap:6px}.plugin-setting .header-wrap .tiny-button[data-v-335043fc]{width:40px;padding:0;min-width:40px;margin-right:2px}.plugin-setting .monaco-editor[data-v-335043fc]{height:500px;margin-top:8px;border:1px solid var(--ti-lowcode-birdge-editor-border-color)}.plugin-setting .resource-form-footer[data-v-335043fc]{padding:12px 0 12px 80px}.plugin-setting .resource-form-footer .tiny-svg[data-v-335043fc]{margin-right:6px}.plugin-setting .resource-form-footer .del[data-v-335043fc]:hover{background-color:var(--ti-lowcode-delete-button-hover-bg)}.plugin-setting .cdn-label-wrap[data-v-335043fc]{display:flex;align-items:center}.code-preview[data-v-335043fc]{font-size:14px;line-height:20px;color:var(--ti-lowcode-birdge-code-preview-color);background-color:var(--ti-lowcode-birdge-code-preview-bg-color);border-radius:6px}.code-preview .pre-title[data-v-335043fc]{font-family:Microsoft YaHei}.code-preview>pre[data-v-335043fc]{margin:0;padding:8px 20px;font-family:Consolas,Courier New,monospace}[data-v-c14cfd0a] .tiny-button{border-radius:4px;height:24px;line-height:24px}
1
+ .manage-panel[data-v-f297beff]{height:100%;display:flex;flex-direction:column;position:relative}.manage-panel .manage-panel-search[data-v-f297beff]{padding:0 12px 12px}.manage-panel .add-button[data-v-f297beff]{align-self:flex-end;margin:6px}.manage-panel .list[data-v-f297beff]{flex:1;border-top:1px solid var(--ti-lowcode-tabs-border-color);overflow:auto;padding:12px 0}.manage-panel .list-item[data-v-f297beff]{height:24px;line-height:24px;display:grid;grid-template-columns:16px 1fr auto;column-gap:8px;align-items:center;padding:0 12px;position:relative;color:var(--ti-lowcode-bridge-list-color);cursor:pointer;font-size:12px}.manage-panel .list-item[data-v-f297beff]:hover,.manage-panel .list-item.active[data-v-f297beff]{background:var(--ti-lowcode-bridge-list-bg)}.manage-panel .list-item:hover .setting-icon[data-v-f297beff],.manage-panel .list-item.active .setting-icon[data-v-f297beff]{display:block}.manage-panel .list-item .setting-icon[data-v-f297beff]{display:none;color:var(--ti-lowcode-toolbar-more-hover-color)}.plugin-setting[data-v-0ab8a7ca] .icon-wrap{margin-right:8px}.plugin-setting .resource-form .tip[data-v-0ab8a7ca]{font-size:11px;line-height:18px;margin-top:8px;color:var(--ti-lowcode-datasource-tip-color)}.plugin-setting .resource-form[data-v-0ab8a7ca] .tiny-form-item__label .cdn-tips-icon{margin-left:4px}.plugin-setting .title-wrap[data-v-0ab8a7ca]{font-size:12px;font-weight:700;color:var(--te-common-text-primary)}.plugin-setting .title-wrap .help-link[data-v-0ab8a7ca]{display:inline-block;color:var(--ti-lowcode-common-primary-color);font-size:12px;margin-left:16px}.plugin-setting .title-wrap .help-link[data-v-0ab8a7ca]:hover{text-decoration:underline}.plugin-setting .header-wrap[data-v-0ab8a7ca]{display:flex;align-items:center;column-gap:6px}.plugin-setting .header-wrap .tiny-button[data-v-0ab8a7ca]{width:40px;padding:0;min-width:40px;margin-right:2px}.plugin-setting .monaco-editor[data-v-0ab8a7ca]{height:500px;margin-top:8px;border:1px solid var(--ti-lowcode-birdge-editor-border-color)}.plugin-setting .resource-form-footer[data-v-0ab8a7ca]{padding:12px 0 12px 80px}.plugin-setting .resource-form-footer .tiny-svg[data-v-0ab8a7ca]{margin-right:6px}.plugin-setting .resource-form-footer .del[data-v-0ab8a7ca]:hover{background-color:var(--ti-lowcode-delete-button-hover-bg)}.plugin-setting .cdn-label-wrap[data-v-0ab8a7ca]{display:flex;align-items:center}.code-preview[data-v-0ab8a7ca]{font-size:12px;line-height:20px;background:var(--te-common-bg-container);color:var(--te-common-text-weaken);border-radius:4px}.code-preview .pre-title[data-v-0ab8a7ca]{font-family:Microsoft YaHei}.code-preview>pre[data-v-0ab8a7ca]{margin:0;padding:8px 20px;font-family:Consolas,Courier New,monospace}[data-v-c14cfd0a] .tiny-button{border-radius:4px;height:24px;line-height:24px}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-plugin-bridge",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,11 +25,11 @@
25
25
  "license": "MIT",
26
26
  "homepage": "https://opentiny.design/tiny-engine",
27
27
  "dependencies": {
28
- "@opentiny/tiny-engine-common": "2.0.0",
29
- "@opentiny/tiny-engine-meta-register": "2.0.0"
28
+ "@opentiny/tiny-engine-common": "2.1.0",
29
+ "@opentiny/tiny-engine-meta-register": "2.1.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0",
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.1.0",
33
33
  "@vitejs/plugin-vue": "^5.1.2",
34
34
  "@vitejs/plugin-vue-jsx": "^4.0.1",
35
35
  "vite": "^5.4.2"
@@ -39,5 +39,5 @@
39
39
  "@opentiny/vue-icon": "^3.14.0",
40
40
  "vue": "^3.4.15"
41
41
  },
42
- "gitHead": "26b32b2236bb85d8113158fd1475884aa99a9657"
42
+ "gitHead": "faf3072c75ea5024689972e2a687916e084c156f"
43
43
  }