@opentiny/tiny-engine-plugin-bridge 2.0.0-rc.4 → 2.1.0-rc.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/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 - present TinyEngine Authors.
4
- Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 - present TinyEngine Authors.
4
+ Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
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 h, createElementBlock as A, createElementVNode as f, createVNode as s, withCtx as c, Fragment as te, renderList as ne, normalizeClass as oe, withModifiers as K, toDisplayString as U, computed as R, watch as ae, onMounted as se, createBlock as C, createTextVNode as L, withDirectives as re, vShow as ce, createCommentVNode as N, nextTick as le, pushScopeId as ie, popScopeId as de } from "vue";
3
+ import { SearchEmpty as pe, PluginSetting as ue, VueMonaco as me, SvgButton as $, PluginPanel as ge } from "@opentiny/tiny-engine-common";
4
+ import { getMetaApi as b, META_SERVICE as x, useResource as I, useNotify as S, useModal as _e, getMergeMeta as ye } from "@opentiny/tiny-engine-meta-register";
5
+ import { isVsCodeEnv as fe } from "@opentiny/tiny-engine-common/js/environments";
6
+ import { generateBridge as he, generateUtil as ve } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
7
+ import { Search as Ee, Form as Re, Input as Ce, Button as Se, FormItem as Ve, Checkbox as be, RadioGroup as xe, Radio as Te } from "@opentiny/vue";
8
+ import { iconSearch as ke } from "@opentiny/vue-icon";
9
+ const Ne = (t, n) => b(x.Http).get(`/app-center/api/apps/extension/list?app=${t}&category=${n}`), Ue = (t) => b(x.Http).post("/app-center/api/apps/extension/create", t), Ie = (t) => b(x.Http).post("/app-center/api/apps/extension/update", t), we = (t) => b(x.Http).get(`/app-center/api/apps/extension/delete?${t}`), Be = (t) => {
10
+ b(x.Http).get(`/app-center/api/apps/schema/${t}`).then((n) => {
11
+ he(n.bridge), ve(n.utils);
12
12
  });
13
- }, i = j({
13
+ }, l = j({
14
14
  actionType: "",
15
15
  type: "",
16
16
  category: "",
@@ -30,7 +30,7 @@ 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
+ }, Oe = {
34
34
  name: "",
35
35
  type: "function",
36
36
  content: {
@@ -43,65 +43,78 @@ const Te = (n, t) => b(S.Http).get(`/app-center/api/apps/extension/list?app=${n}
43
43
  }, F = {
44
44
  Npm: "npm",
45
45
  Function: "function"
46
- }, we = {
46
+ }, Le = {
47
47
  [V.Util]: "新建工具类",
48
48
  [V.Bridge]: "新建桥接源"
49
- }, I = {
49
+ }, w = {
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;
54
- }, Le = (n) => {
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;
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({
52
+ }, B = () => b(x.GlobalService).getBaseInfo().id, Ae = (t) => l.resourceNames[t], Fe = (t, n) => {
53
+ l.resourceNames[t] = n;
54
+ }, Pe = (t) => {
55
+ const n = B();
56
+ return Ne(n, t);
57
+ }, Y = () => l.actionType, M = (t) => {
58
+ l.actionType = t;
59
+ }, De = () => l.resource, G = (t = Q) => {
60
+ t || (t = l.category === F.Function ? Oe : Q), l.resource = t;
61
+ }, P = () => l.type, X = (t) => {
62
+ l.type = t;
63
+ }, H = (t) => {
64
+ l.category = t;
65
+ }, q = () => l.category, z = (...t) => {
66
+ fe && Be(...t);
67
+ }, Me = (t, n, p) => {
68
+ Y() === w.Edit ? (t.id = l.resource.id, Ie(t).then((e) => {
69
+ if (e) {
70
+ const o = I().appSchemaState[t.category].findIndex((_) => _.name === e.name);
71
+ if (o === -1) {
72
+ S({
73
+ type: "error",
74
+ message: "修改失败"
75
+ });
76
+ return;
77
+ }
78
+ I().appSchemaState[t.category][o] = e, z(B()), S({
73
79
  type: "success",
74
80
  message: "修改成功"
75
- }), u("refresh", i.type), i.refresh = !0, t();
81
+ }), p("refresh", l.type), l.refresh = !0, n();
76
82
  }
77
- })) : Ue(n).then((o) => {
78
- o && (N().resState[n.category].push(o), e([o]), z(w()), B({
83
+ })) : Ue(t).then((e) => {
84
+ e && (I().appSchemaState[t.category].push(e), z(B()), S({
79
85
  type: "success",
80
86
  message: "创建成功"
81
- }), u("refresh", i.type), i.refresh = !0, t());
87
+ }), p("refresh", l.type), l.refresh = !0, n());
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
+ }, Ge = (t, n, p) => {
90
+ var o;
91
+ const e = `app=${B()}&id=${(o = l.resource) == null ? void 0 : o.id}`;
92
+ we(e).then((_) => {
93
+ if (_) {
94
+ const u = I().appSchemaState[l.type].findIndex((y) => y.name === _.name);
95
+ if (u === -1) {
96
+ S({
97
+ type: "error",
98
+ message: "删除失败"
99
+ });
100
+ return;
101
+ }
102
+ I().appSchemaState[l.type].splice(u, 1), z(B()), S({
90
103
  type: "success",
91
104
  message: "删除成功"
92
- }), u("refresh", i.type), i.refresh = !0, t();
105
+ }), p("refresh", l.type), l.refresh = !0, n();
93
106
  }
94
107
  });
95
- }, J = (n, t) => {
96
- const u = n.__vccOpts || n;
97
- for (const [e, o] of t)
98
- u[e] = o;
99
- return u;
100
- }, Me = {
108
+ }, J = (t, n) => {
109
+ const p = t.__vccOpts || t;
110
+ for (const [e, o] of n)
111
+ p[e] = o;
112
+ return p;
113
+ }, qe = {
101
114
  components: {
102
- TinySearch: ve,
103
- TinyIconSearch: xe(),
104
- SearchEmpty: ie
115
+ TinySearch: Ee,
116
+ TinyIconSearch: ke(),
117
+ SearchEmpty: pe
105
118
  },
106
119
  props: {
107
120
  name: {
@@ -110,127 +123,127 @@ const Te = (n, t) => b(S.Http).get(`/app-center/api/apps/extension/list?app=${n}
110
123
  }
111
124
  },
112
125
  emits: ["open"],
113
- setup(n, { emit: t }) {
114
- const u = T([]), e = j({
126
+ setup(t, { emit: n }) {
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), _ = async (a) => {
132
+ e.resourceList = await Pe(a), Fe(
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
- y(n.name);
138
+ _(t.name);
126
139
  }), {
127
140
  state: e,
128
- list: u,
141
+ list: p,
129
142
  add: (a) => {
130
- M(""), X(n.name), G(""), H(a), t("open");
143
+ M(""), X(t.name), G(""), H(a), n("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(w.Edit), n("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(w.Edit), X(t.name), H(a.type), n("open");
137
150
  },
138
- refresh: y,
151
+ refresh: _,
139
152
  getType: P,
140
153
  RESOURCE_TYPE: V,
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, [
151
- s(f, {
159
+ }, Ye = { class: "manage-panel" }, He = { class: "manage-panel-search" }, ze = { class: "list" }, je = ["onClick"], Je = { class: "item-label" };
160
+ function We(t, n, p, e, o, _) {
161
+ const u = m("tiny-icon-search"), y = m("tiny-search"), v = m("svg-icon"), E = m("search-empty");
162
+ return h(), A("div", Ye, [
163
+ f("div", He, [
164
+ s(y, {
152
165
  modelValue: e.state.searchValue,
153
166
  "onUpdate:modelValue": [
154
- t[0] || (t[0] = (a) => e.state.searchValue = a),
167
+ n[0] || (n[0] = (a) => e.state.searchValue = a),
155
168
  e.searchBridgeData
156
169
  ],
157
170
  clearable: "",
158
171
  placeholder: "搜索"
159
172
  }, {
160
- prefix: l(() => [
161
- s(c)
173
+ prefix: 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
+ f("div", ze, [
180
+ (h(!0), A(te, null, ne(e.list, (a, i) => (h(), 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: oe(["list-item", i === e.state.activeIndex ? "active" : ""]),
183
+ onClick: K((r) => e.openEdit(a, i), ["stop"])
171
184
  }, [
172
185
  s(v, { name: "plugin-icon-sresources" }),
173
- _("div", ze, k(a.name), 1),
186
+ f("div", Je, U(a.name), 1),
174
187
  s(v, {
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, je))), 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 Ke = /* @__PURE__ */ J(qe, [["render", We], ["__scopeId", "data-v-6da3d7ff"]]), W = k(!1), Qe = () => {
200
+ W.value = !0, le(() => window.dispatchEvent(new Event("resize")));
188
201
  }, D = () => {
189
202
  W.value = !1;
190
- }, Ke = {
203
+ }, Xe = {
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,
200
- TinyRadio: Se,
205
+ TinyForm: Re,
206
+ TinyInput: Ce,
207
+ TinyButton: Se,
208
+ TinyFormItem: Ve,
209
+ TinyCheckbox: be,
210
+ PluginSetting: ue,
211
+ MonacoEditor: me,
212
+ TinyRadioGroup: xe,
213
+ TinyRadio: Te,
201
214
  SvgButton: $
202
215
  },
203
- setup(n, { emit: t }) {
204
- const u = {
216
+ setup(t, { emit: n }) {
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 } = _e(), o = j({
225
+ resource: R(() => De()),
213
226
  name: "",
214
227
  value: "",
215
228
  content: {},
216
- status: R(() => Y() === I.Edit),
229
+ status: R(() => Y() === w.Edit),
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 = ye("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() === w.Edit ? "编辑" : "添加", g = P() === V.Bridge ? "桥接源" : "工具类";
225
238
  return r + g;
226
239
  }),
227
240
  type: F.Npm
228
- }), y = R(() => {
241
+ }), _ = R(() => {
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(() => {
@@ -242,15 +255,15 @@ export { ${r} }`;
242
255
  r || (o.content.instance = "");
243
256
  }
244
257
  );
245
- const c = T(null), f = T(null);
258
+ const u = k(null), y = k(null);
246
259
  return se(() => 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 = Ae(P());
266
+ Array.isArray(O) && O.includes(g) ? T(new Error("资源名称已存在")) : T();
254
267
  },
255
268
  trigger: "change"
256
269
  }
@@ -259,10 +272,10 @@ export { ${r} }`;
259
272
  "content.exportName": [{ required: !0, message: "必填", trigger: "change" }],
260
273
  "content.instanceName": { required: !0, message: "必填", trigger: "change" }
261
274
  },
262
- resourceForm: f,
263
- editor: c,
275
+ resourceForm: y,
276
+ editor: u,
264
277
  state: o,
265
- codePreview: y,
278
+ codePreview: _,
266
279
  isOpen: W,
267
280
  closePanel: D,
268
281
  save: () => {
@@ -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
- f.value.validate((g) => {
292
+ y.value.validate((g) => {
280
293
  if (!g) {
281
- B({
294
+ S({
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
+ S({
289
302
  type: "error",
290
303
  message: "function 内容必填"
291
304
  });
292
305
  return;
293
306
  }
294
- Pe(r, D, t);
307
+ Me(r, D, n);
295
308
  });
296
309
  },
297
310
  deleteReSource: () => {
@@ -299,54 +312,56 @@ export { ${r} }`;
299
312
  title: "删除资源",
300
313
  message: "如果删除正在使用的资源,将无法正常预览页面,确认要删除吗?",
301
314
  exec: () => {
302
- De(o.name, D, t);
315
+ Ge(o.name, D, n);
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");
326
+ }, ee = (t) => (ie("data-v-96189c8c"), t = t(), de(), t), Ze = { class: "title-wrap" }, $e = { class: "header-wrap" }, et = { class: "right-item" }, tt = { key: 2 }, nt = /* @__PURE__ */ ee(() => /* @__PURE__ */ f("div", { class: "cdn-label-wrap" }, [
327
+ /* @__PURE__ */ f("span", null, "CDN")
328
+ ], -1)), ot = /* @__PURE__ */ ee(() => /* @__PURE__ */ f("div", { class: "tip" }, "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败", -1)), at = { class: "code-preview" };
329
+ function st(t, n, p, e, o, _) {
330
+ const u = m("tiny-button"), y = m("svg-button"), v = 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");
316
331
  return e.isOpen ? (h(), C(O, { key: 0 }, {
317
- title: l(() => [
318
- _("div", Qe, [
319
- _("span", null, k(e.state.title), 1)
332
+ title: c(() => [
333
+ f("div", Ze, [
334
+ f("span", null, U(e.state.title), 1)
320
335
  ])
321
336
  ]),
322
- header: l(() => [
323
- _("div", Xe, [
324
- s(c, {
337
+ header: c(() => [
338
+ f("div", $e, [
339
+ s(u, {
325
340
  class: "save-btn",
326
341
  type: "primary",
327
342
  onClick: e.save
328
343
  }, {
329
- default: l(() => t[10] || (t[10] = [
330
- A("保存")
331
- ])),
344
+ default: c(() => [
345
+ L("保存")
346
+ ]),
332
347
  _: 1
333
348
  }, 8, ["onClick"]),
334
- re(s(f, {
349
+ re(s(y, {
335
350
  class: "delete-btn",
336
351
  name: "delete",
337
352
  onClick: e.deleteReSource
338
353
  }, null, 8, ["onClick"]), [
339
- [le, e.state.status]
354
+ [ce, e.state.status]
340
355
  ]),
341
- s(f, {
356
+ s(y, {
342
357
  class: "close-btn",
343
358
  name: "close",
344
359
  onClick: e.closePanel
345
360
  }, null, 8, ["onClick"])
346
361
  ])
347
362
  ]),
348
- content: l(() => [
349
- s(x, {
363
+ content: c(() => [
364
+ s(T, {
350
365
  ref: "resourceForm",
351
366
  class: "resource-form",
352
367
  rules: e.rules,
@@ -356,34 +371,34 @@ function tt(n, t, u, e, o, y) {
356
371
  "label-position": "top",
357
372
  "label-align": !0
358
373
  }, {
359
- default: l(() => [
360
- _("div", Ze, [
361
- e.state.status ? U("", !0) : (h(), C(a, {
374
+ default: c(() => [
375
+ f("div", et, [
376
+ e.state.status ? N("", !0) : (h(), C(a, {
362
377
  key: 0,
363
378
  label: "工具类型",
364
379
  prop: "type"
365
380
  }, {
366
- default: l(() => [
381
+ default: c(() => [
367
382
  s(E, {
368
383
  modelValue: e.state.type,
369
- "onUpdate:modelValue": t[0] || (t[0] = (p) => e.state.type = p),
384
+ "onUpdate:modelValue": n[0] || (n[0] = (d) => e.state.type = d),
370
385
  class: "resource-type-radio-group",
371
386
  onChange: e.handleChangeType
372
387
  }, {
373
- default: l(() => [
388
+ default: c(() => [
374
389
  s(v, {
375
390
  label: e.RESOURCE_CATEGORY.Npm
376
391
  }, {
377
- default: l(() => [
378
- A(k(e.RESOURCE_CATEGORY.Npm), 1)
392
+ default: c(() => [
393
+ L(U(e.RESOURCE_CATEGORY.Npm), 1)
379
394
  ]),
380
395
  _: 1
381
396
  }, 8, ["label"]),
382
397
  s(v, {
383
398
  label: e.RESOURCE_CATEGORY.Function
384
399
  }, {
385
- default: l(() => [
386
- A(k(e.RESOURCE_CATEGORY.Function), 1)
400
+ default: c(() => [
401
+ L(U(e.RESOURCE_CATEGORY.Function), 1)
387
402
  ]),
388
403
  _: 1
389
404
  }, 8, ["label"])
@@ -393,29 +408,29 @@ function tt(n, t, u, e, o, y) {
393
408
  ]),
394
409
  _: 1
395
410
  })),
396
- e.state.status ? U("", !0) : (h(), C(a, {
411
+ e.state.status ? N("", !0) : (h(), C(a, {
397
412
  key: 1,
398
413
  label: "工具名称",
399
414
  prop: "name"
400
415
  }, {
401
- default: l(() => [
402
- s(d, {
416
+ default: c(() => [
417
+ s(i, {
403
418
  modelValue: e.state.name,
404
- "onUpdate:modelValue": t[1] || (t[1] = (p) => e.state.name = p),
419
+ "onUpdate:modelValue": n[1] || (n[1] = (d) => e.state.name = d),
405
420
  placeholder: "请输入工具类名称"
406
421
  }, null, 8, ["modelValue"])
407
422
  ]),
408
423
  _: 1
409
424
  })),
410
- e.state.category ? (h(), L("div", $e, [
425
+ e.state.category ? (h(), A("div", tt, [
411
426
  s(a, {
412
427
  label: "npm包名",
413
428
  prop: "content.package"
414
429
  }, {
415
- default: l(() => [
416
- s(d, {
430
+ default: c(() => [
431
+ s(i, {
417
432
  modelValue: e.state.content.package,
418
- "onUpdate:modelValue": t[2] || (t[2] = (p) => e.state.content.package = p),
433
+ "onUpdate:modelValue": n[2] || (n[2] = (d) => e.state.content.package = d),
419
434
  placeholder: "请输入npm包名称"
420
435
  }, null, 8, ["modelValue"])
421
436
  ]),
@@ -425,24 +440,24 @@ function tt(n, t, u, e, o, y) {
425
440
  label: "npm包导出名",
426
441
  prop: "content.exportName"
427
442
  }, {
428
- default: l(() => [
429
- s(d, {
443
+ default: c(() => [
444
+ s(i, {
430
445
  modelValue: e.state.content.exportName,
431
- "onUpdate:modelValue": t[3] || (t[3] = (p) => e.state.content.exportName = p),
446
+ "onUpdate:modelValue": n[3] || (n[3] = (d) => e.state.content.exportName = d),
432
447
  placeholder: "请输入npm包的导出名称"
433
448
  }, null, 8, ["modelValue"])
434
449
  ]),
435
450
  _: 1
436
451
  }),
437
452
  s(a, { label: "" }, {
438
- default: l(() => [
453
+ default: c(() => [
439
454
  s(r, {
440
455
  modelValue: e.state.content.destructuring,
441
- "onUpdate:modelValue": t[4] || (t[4] = (p) => e.state.content.destructuring = p)
456
+ "onUpdate:modelValue": n[4] || (n[4] = (d) => e.state.content.destructuring = d)
442
457
  }, {
443
- default: l(() => t[11] || (t[11] = [
444
- A("解构npm包")
445
- ])),
458
+ default: c(() => [
459
+ L("解构npm包")
460
+ ]),
446
461
  _: 1
447
462
  }, 8, ["modelValue"])
448
463
  ]),
@@ -452,67 +467,65 @@ function tt(n, t, u, e, o, y) {
452
467
  key: 0,
453
468
  label: "是否作为实例"
454
469
  }, {
455
- default: l(() => [
470
+ default: c(() => [
456
471
  s(r, {
457
472
  modelValue: e.state.isInstance,
458
- "onUpdate:modelValue": t[5] || (t[5] = (p) => e.state.isInstance = p)
473
+ "onUpdate:modelValue": n[5] || (n[5] = (d) => e.state.isInstance = d)
459
474
  }, null, 8, ["modelValue"])
460
475
  ]),
461
476
  _: 1
462
- })) : U("", !0),
477
+ })) : N("", !0),
463
478
  e.state.isInstance ? (h(), C(a, {
464
479
  key: 1,
465
480
  label: "实例名称",
466
481
  prop: "content.instanceName"
467
482
  }, {
468
- default: l(() => [
469
- s(d, {
483
+ default: c(() => [
484
+ s(i, {
470
485
  modelValue: e.state.content.instance,
471
- "onUpdate:modelValue": t[6] || (t[6] = (p) => e.state.content.instance = p)
486
+ "onUpdate:modelValue": n[6] || (n[6] = (d) => e.state.content.instance = d)
472
487
  }, null, 8, ["modelValue"])
473
488
  ]),
474
489
  _: 1
475
- })) : U("", !0),
490
+ })) : N("", !0),
476
491
  s(a, { label: "入口路径" }, {
477
- default: l(() => [
478
- s(d, {
492
+ default: c(() => [
493
+ s(i, {
479
494
  modelValue: e.state.content.main,
480
- "onUpdate:modelValue": t[7] || (t[7] = (p) => e.state.content.main = p),
495
+ "onUpdate:modelValue": n[7] || (n[7] = (d) => e.state.content.main = d),
481
496
  placeholder: "main"
482
497
  }, null, 8, ["modelValue"])
483
498
  ]),
484
499
  _: 1
485
500
  }),
486
501
  s(a, { label: "版本号" }, {
487
- default: l(() => [
488
- s(d, {
502
+ default: c(() => [
503
+ s(i, {
489
504
  modelValue: e.state.content.version,
490
- "onUpdate:modelValue": t[8] || (t[8] = (p) => e.state.content.version = p),
505
+ "onUpdate:modelValue": n[8] || (n[8] = (d) => e.state.content.version = d),
491
506
  placeholder: "latest"
492
507
  }, null, 8, ["modelValue"])
493
508
  ]),
494
509
  _: 1
495
510
  }),
496
511
  s(a, null, {
497
- label: l(() => t[12] || (t[12] = [
498
- _("div", { class: "cdn-label-wrap" }, [
499
- _("span", null, "CDN")
500
- ], -1)
501
- ])),
502
- default: l(() => [
503
- s(d, {
512
+ label: c(() => [
513
+ nt
514
+ ]),
515
+ default: c(() => [
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": n[9] || (n[9] = (d) => e.state.content.cdnLink = d),
506
519
  placeholder: "CDN"
507
520
  }, null, 8, ["modelValue"]),
508
- t[13] || (t[13] = _("div", { class: "tip" }, "浏览器直接可用的生产包链接,请确保可用,否则可能会造成页面预览失败", -1))
521
+ ot
509
522
  ]),
510
523
  _: 1
511
524
  }),
512
525
  s(a, { label: "生成utils.js代码预览" }, {
513
- default: l(() => [
514
- _("div", et, [
515
- _("pre", null, k(e.codePreview), 1)
526
+ default: c(() => [
527
+ f("div", at, [
528
+ f("pre", null, U(e.codePreview), 1)
516
529
  ])
517
530
  ]),
518
531
  _: 1
@@ -530,52 +543,52 @@ 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 rt = /* @__PURE__ */ J(Xe, [["render", st], ["__scopeId", "data-v-96189c8c"]]), ct = {
536
549
  components: {
537
- PluginPanel: ue,
550
+ PluginPanel: ge,
538
551
  SvgButton: $,
539
- BridgeManage: Je,
540
- BridgeSetting: nt
552
+ BridgeManage: Ke,
553
+ BridgeSetting: rt
541
554
  },
542
555
  setup() {
543
- const n = T(V.Util), t = T(null), u = R(() => we[n.value]);
556
+ const t = k(V.Util), n = k(null), p = R(() => Le[t.value]);
544
557
  return {
545
- addResource: (c) => {
546
- n.value == t.value.add(c);
558
+ addResource: (u) => {
559
+ t.value == n.value.add(u);
547
560
  },
548
561
  RESOURCE_TYPE: V,
549
- activedName: n,
562
+ activedName: t,
550
563
  openBridgePanel: () => {
551
- We();
564
+ Qe();
552
565
  },
553
566
  closePanel: D,
554
- refreshList: (c) => {
555
- c == t.value.refresh(c);
567
+ refreshList: (u) => {
568
+ u == n.value.refresh(u);
556
569
  },
557
- utilsRef: t,
558
- tips: u
570
+ utilsRef: n,
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");
575
+ function lt(t, n, p, e, o, _) {
576
+ const u = m("svg-button"), y = m("bridge-manage"), v = m("bridge-setting"), E = m("plugin-panel");
564
577
  return h(), C(E, {
565
578
  title: "资源管理",
566
579
  isCloseLeft: !1,
567
580
  onClose: e.closePanel
568
581
  }, {
569
- header: l(() => [
570
- s(c, {
582
+ header: c(() => [
583
+ s(u, {
571
584
  name: "add-utils",
572
585
  placement: "left",
573
586
  tips: e.tips,
574
- onClick: t[0] || (t[0] = (a) => e.addResource("npm"))
587
+ onClick: n[0] || (n[0] = (a) => e.addResource("npm"))
575
588
  }, null, 8, ["tips"])
576
589
  ]),
577
- content: l(() => [
578
- s(f, {
590
+ content: c(() => [
591
+ s(y, {
579
592
  ref: "utilsRef",
580
593
  name: e.RESOURCE_TYPE.Util,
581
594
  onOpen: e.openBridgePanel
@@ -585,16 +598,16 @@ function at(n, t, u, e, o, y) {
585
598
  _: 1
586
599
  }, 8, ["onClose"]);
587
600
  }
588
- const st = /* @__PURE__ */ J(ot, [["render", at], ["__scopeId", "data-v-c14cfd0a"]]), rt = {
601
+ const it = /* @__PURE__ */ J(ct, [["render", lt], ["__scopeId", "data-v-1787cb11"]]), dt = {
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
+ }, vt = {
608
+ ...dt,
609
+ entry: it
597
610
  };
598
611
  export {
599
- yt as default
612
+ vt 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-6da3d7ff]{height:100%;display:flex;flex-direction:column;position:relative}.manage-panel .manage-panel-search[data-v-6da3d7ff]{padding:0 12px 12px}.manage-panel .add-button[data-v-6da3d7ff]{align-self:flex-end;margin:6px}.manage-panel .list[data-v-6da3d7ff]{flex:1;border-top:1px solid var(--ti-lowcode-tabs-border-color);overflow:auto;padding:12px 0}.manage-panel .list-item[data-v-6da3d7ff]{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-6da3d7ff]:hover,.manage-panel .list-item.active[data-v-6da3d7ff]{background:var(--ti-lowcode-bridge-list-bg)}.manage-panel .list-item:hover .setting-icon[data-v-6da3d7ff],.manage-panel .list-item.active .setting-icon[data-v-6da3d7ff]{display:block}.manage-panel .list-item .setting-icon[data-v-6da3d7ff]{display:none;color:var(--ti-lowcode-toolbar-more-hover-color)}.plugin-setting[data-v-96189c8c] .icon-wrap{margin-right:8px}.plugin-setting .resource-form .tip[data-v-96189c8c]{font-size:11px;line-height:18px;margin-top:8px;color:var(--ti-lowcode-datasource-tip-color)}.plugin-setting .resource-form[data-v-96189c8c] .tiny-form-item__label .cdn-tips-icon{margin-left:4px}.plugin-setting .title-wrap[data-v-96189c8c]{font-size:12px;font-weight:700;color:var(--te-common-text-primary)}.plugin-setting .title-wrap .help-link[data-v-96189c8c]{display:inline-block;color:var(--ti-lowcode-common-primary-color);font-size:12px;margin-left:16px}.plugin-setting .title-wrap .help-link[data-v-96189c8c]:hover{text-decoration:underline}.plugin-setting .header-wrap[data-v-96189c8c]{display:flex;align-items:center;column-gap:6px}.plugin-setting .header-wrap .tiny-button[data-v-96189c8c]{width:40px;padding:0;min-width:40px;margin-right:2px}.plugin-setting .monaco-editor[data-v-96189c8c]{height:500px;margin-top:8px;border:1px solid var(--ti-lowcode-birdge-editor-border-color)}.plugin-setting .resource-form-footer[data-v-96189c8c]{padding:12px 0 12px 80px}.plugin-setting .resource-form-footer .tiny-svg[data-v-96189c8c]{margin-right:6px}.plugin-setting .resource-form-footer .del[data-v-96189c8c]:hover{background-color:var(--ti-lowcode-delete-button-hover-bg)}.plugin-setting .cdn-label-wrap[data-v-96189c8c]{display:flex;align-items:center}.code-preview[data-v-96189c8c]{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-96189c8c]{font-family:Microsoft YaHei}.code-preview>pre[data-v-96189c8c]{margin:0;padding:8px 20px;font-family:Consolas,Courier New,monospace}[data-v-1787cb11] .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-rc.4",
3
+ "version": "2.1.0-rc.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-rc.4",
29
- "@opentiny/tiny-engine-meta-register": "2.0.0-rc.4"
28
+ "@opentiny/tiny-engine-common": "2.1.0-rc.0",
29
+ "@opentiny/tiny-engine-meta-register": "2.1.0-rc.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-rc.4",
32
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.1.0-rc.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": "dee65eb9fc7a102d9e5447d0cd3851600ef60054"
42
+ "gitHead": "71a3549d5f1d38d2ed3934ce83b722b11878aa7c"
43
43
  }