@qodalis/vue-cli 2.0.0-beta.2 → 2.0.0-beta.20
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/README.md +230 -12
- package/dist/index.d.mts +354 -0
- package/dist/index.d.ts +354 -0
- package/dist/index.js +653 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +658 -0
- package/dist/index.mjs.map +1 -0
- package/dist/package.json +52 -0
- package/dist/styles.css +8 -0
- package/package.json +7 -6
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
// src/Cli.ts
|
|
2
|
+
import {
|
|
3
|
+
defineComponent as defineComponent2,
|
|
4
|
+
ref,
|
|
5
|
+
onMounted,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
h,
|
|
8
|
+
inject
|
|
9
|
+
} from "vue";
|
|
10
|
+
import { createCliEngine, resolveCliHostConfig } from "@qodalis/cli";
|
|
11
|
+
|
|
12
|
+
// src/cliInjection.ts
|
|
13
|
+
var CliInjectionKey = /* @__PURE__ */ Symbol("qodalis-cli");
|
|
14
|
+
|
|
15
|
+
// src/CliConfigProvider.ts
|
|
16
|
+
import { defineComponent, provide } from "vue";
|
|
17
|
+
var CliConfigKey = /* @__PURE__ */ Symbol("qodalis-cli-config");
|
|
18
|
+
var CliConfigProvider = defineComponent({
|
|
19
|
+
name: "CliConfigProvider",
|
|
20
|
+
props: {
|
|
21
|
+
modules: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: void 0
|
|
24
|
+
},
|
|
25
|
+
processors: {
|
|
26
|
+
type: Array,
|
|
27
|
+
default: void 0
|
|
28
|
+
},
|
|
29
|
+
options: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
services: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default: void 0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setup(props, { slots }) {
|
|
39
|
+
provide(CliConfigKey, {
|
|
40
|
+
modules: props.modules,
|
|
41
|
+
processors: props.processors,
|
|
42
|
+
options: props.options,
|
|
43
|
+
services: props.services
|
|
44
|
+
});
|
|
45
|
+
return () => slots.default?.();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/Cli.ts
|
|
50
|
+
var Cli = defineComponent2({
|
|
51
|
+
name: "Cli",
|
|
52
|
+
props: {
|
|
53
|
+
modules: {
|
|
54
|
+
type: Array,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
processors: {
|
|
58
|
+
type: Array,
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
options: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
services: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
69
|
+
snapshot: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
style: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: void 0
|
|
76
|
+
},
|
|
77
|
+
class: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: void 0
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
emits: ["ready"],
|
|
83
|
+
setup(props, { emit }) {
|
|
84
|
+
const containerRef = ref(null);
|
|
85
|
+
const ctx = inject(CliInjectionKey, null);
|
|
86
|
+
const config = inject(CliConfigKey, null);
|
|
87
|
+
let engine = null;
|
|
88
|
+
if (ctx) {
|
|
89
|
+
return () => null;
|
|
90
|
+
}
|
|
91
|
+
const hostConfig = resolveCliHostConfig(props, config);
|
|
92
|
+
onMounted(async () => {
|
|
93
|
+
if (!containerRef.value) return;
|
|
94
|
+
engine = createCliEngine(containerRef.value, { ...hostConfig, snapshot: props.snapshot, framework: "Vue" });
|
|
95
|
+
await engine.start();
|
|
96
|
+
emit("ready", engine);
|
|
97
|
+
});
|
|
98
|
+
onBeforeUnmount(() => {
|
|
99
|
+
engine?.destroy();
|
|
100
|
+
engine = null;
|
|
101
|
+
});
|
|
102
|
+
return () => h("div", {
|
|
103
|
+
ref: containerRef,
|
|
104
|
+
style: { height: "100%", ...props.style },
|
|
105
|
+
class: props.class
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// src/CliPanel.ts
|
|
111
|
+
import { defineComponent as defineComponent3, computed, inject as inject2, watch, h as h2, onBeforeUnmount as onBeforeUnmount2, onMounted as onMounted2, shallowRef, Fragment } from "vue";
|
|
112
|
+
import {
|
|
113
|
+
CliPanelController,
|
|
114
|
+
CLOSE_GLYPH,
|
|
115
|
+
CLOSE_ICON,
|
|
116
|
+
HIDE_ICON,
|
|
117
|
+
HIDE_TAB_TERMINAL_ICON,
|
|
118
|
+
MAXIMIZE_ICON,
|
|
119
|
+
PANEL_LABELS,
|
|
120
|
+
RESTORE_ICON,
|
|
121
|
+
TERMINAL_ICON,
|
|
122
|
+
collapseChevronIcon,
|
|
123
|
+
contextMenuItems,
|
|
124
|
+
contextMenuStyle,
|
|
125
|
+
glowLineClass,
|
|
126
|
+
handleRenameKey,
|
|
127
|
+
hideTabChevronIcon,
|
|
128
|
+
joinClasses,
|
|
129
|
+
mergeCliOptions,
|
|
130
|
+
openStatusDropdown,
|
|
131
|
+
paneClass,
|
|
132
|
+
paneStyle,
|
|
133
|
+
panelTabClass,
|
|
134
|
+
panelTabDotClass,
|
|
135
|
+
panelWrapperClass,
|
|
136
|
+
panelWrapperStyle,
|
|
137
|
+
panesContainerClass,
|
|
138
|
+
panesContainerWidth,
|
|
139
|
+
positionIcon,
|
|
140
|
+
positionOptions,
|
|
141
|
+
resolveCliHostConfig as resolveCliHostConfig2,
|
|
142
|
+
runContextMenuAction,
|
|
143
|
+
statusIndicators,
|
|
144
|
+
svgAttrs
|
|
145
|
+
} from "@qodalis/cli";
|
|
146
|
+
var PANEL_REF_METHODS = [
|
|
147
|
+
"open",
|
|
148
|
+
"collapse",
|
|
149
|
+
"toggleCollapse",
|
|
150
|
+
"hide",
|
|
151
|
+
"unhide",
|
|
152
|
+
"toggleHide",
|
|
153
|
+
"close",
|
|
154
|
+
"maximize",
|
|
155
|
+
"restore",
|
|
156
|
+
"toggleMaximize",
|
|
157
|
+
"resize",
|
|
158
|
+
"setPosition",
|
|
159
|
+
"addTab",
|
|
160
|
+
"closeTab",
|
|
161
|
+
"selectTab",
|
|
162
|
+
"renameTab",
|
|
163
|
+
"splitPane",
|
|
164
|
+
"closePane",
|
|
165
|
+
"getEngine",
|
|
166
|
+
"getState"
|
|
167
|
+
];
|
|
168
|
+
function icon(svg, className) {
|
|
169
|
+
return h2("svg", { class: className, ...svgAttrs(svg) }, svg.shapes.map((shape) => h2(shape.tag, shape.attrs)));
|
|
170
|
+
}
|
|
171
|
+
var stop = (e) => e.stopPropagation();
|
|
172
|
+
var CliPanel = defineComponent3({
|
|
173
|
+
name: "CliPanel",
|
|
174
|
+
props: {
|
|
175
|
+
options: { type: Object, default: void 0 },
|
|
176
|
+
modules: { type: Array, default: void 0 },
|
|
177
|
+
processors: { type: Array, default: void 0 },
|
|
178
|
+
services: { type: Object, default: void 0 },
|
|
179
|
+
onClose: { type: Function, default: void 0 },
|
|
180
|
+
collapsed: { type: Boolean, default: void 0 },
|
|
181
|
+
hidden: { type: Boolean, default: void 0 },
|
|
182
|
+
maximized: { type: Boolean, default: void 0 },
|
|
183
|
+
activeTabId: { type: Number, default: void 0 },
|
|
184
|
+
position: { type: String, default: void 0 },
|
|
185
|
+
height: { type: Number, default: void 0 },
|
|
186
|
+
width: { type: Number, default: void 0 },
|
|
187
|
+
style: { type: Object, default: void 0 },
|
|
188
|
+
class: { type: String, default: void 0 }
|
|
189
|
+
},
|
|
190
|
+
emits: [
|
|
191
|
+
"update:collapsed",
|
|
192
|
+
"update:hidden",
|
|
193
|
+
"update:maximized",
|
|
194
|
+
"update:activeTabId",
|
|
195
|
+
"update:position",
|
|
196
|
+
"update:height",
|
|
197
|
+
"update:width",
|
|
198
|
+
"close",
|
|
199
|
+
"tab-added",
|
|
200
|
+
"tab-closed",
|
|
201
|
+
"pane-split",
|
|
202
|
+
"pane-closed"
|
|
203
|
+
],
|
|
204
|
+
setup(props, { expose, emit }) {
|
|
205
|
+
const config = inject2(CliConfigKey, null);
|
|
206
|
+
const mergedOptions = computed(() => mergeCliOptions(props.options, config?.options));
|
|
207
|
+
const hostConfig = computed(() => resolveCliHostConfig2(props, config));
|
|
208
|
+
const controlled = () => ({
|
|
209
|
+
collapsed: props.collapsed,
|
|
210
|
+
hidden: props.hidden,
|
|
211
|
+
maximized: props.maximized,
|
|
212
|
+
activeTabId: props.activeTabId,
|
|
213
|
+
position: props.position,
|
|
214
|
+
height: props.height,
|
|
215
|
+
width: props.width
|
|
216
|
+
});
|
|
217
|
+
const controller = new CliPanelController({
|
|
218
|
+
config: mergedOptions.value,
|
|
219
|
+
controlled: controlled(),
|
|
220
|
+
callbacks: {
|
|
221
|
+
onCollapsedChange: (v) => emit("update:collapsed", v),
|
|
222
|
+
onHiddenChange: (v) => emit("update:hidden", v),
|
|
223
|
+
onMaximizedChange: (v) => emit("update:maximized", v),
|
|
224
|
+
onActiveTabIdChange: (v) => emit("update:activeTabId", v),
|
|
225
|
+
onPositionChange: (v) => emit("update:position", v),
|
|
226
|
+
onHeightChange: (v) => emit("update:height", v),
|
|
227
|
+
onWidthChange: (v) => emit("update:width", v),
|
|
228
|
+
onClose: () => {
|
|
229
|
+
emit("close");
|
|
230
|
+
props.onClose?.();
|
|
231
|
+
},
|
|
232
|
+
onTabAdded: (e) => emit("tab-added", e),
|
|
233
|
+
onTabClosed: (e) => emit("tab-closed", e),
|
|
234
|
+
onPaneSplit: (e) => emit("pane-split", e),
|
|
235
|
+
onPaneClosed: (e) => emit("pane-closed", e)
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const state = shallowRef(controller.getSnapshot());
|
|
239
|
+
const unsubscribe = controller.subscribe(() => {
|
|
240
|
+
state.value = controller.getSnapshot();
|
|
241
|
+
});
|
|
242
|
+
watch(controlled, (values) => controller.setControlled(values));
|
|
243
|
+
watch(mergedOptions, (options) => controller.setOptions(options));
|
|
244
|
+
const root = shallowRef(null);
|
|
245
|
+
onMounted2(() => controller.setRootElement(root.value));
|
|
246
|
+
onBeforeUnmount2(() => {
|
|
247
|
+
unsubscribe();
|
|
248
|
+
controller.destroy();
|
|
249
|
+
});
|
|
250
|
+
const exposed = {};
|
|
251
|
+
for (const method of PANEL_REF_METHODS) {
|
|
252
|
+
exposed[method] = controller[method].bind(controller);
|
|
253
|
+
}
|
|
254
|
+
expose(exposed);
|
|
255
|
+
const openDropdown = (e, dropdown) => {
|
|
256
|
+
if (!dropdown) return;
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
const anchor = e.currentTarget;
|
|
259
|
+
if (dropdown === "services") controller.toggleServicesDropdown(anchor);
|
|
260
|
+
else controller.toggleServersDropdown(anchor);
|
|
261
|
+
};
|
|
262
|
+
const renderHeader = (s) => {
|
|
263
|
+
const indicators = statusIndicators(s);
|
|
264
|
+
return h2("div", { class: "cli-panel-header" }, [
|
|
265
|
+
h2(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
class: "cli-panel-resize-bar",
|
|
269
|
+
onMousedown: (e) => {
|
|
270
|
+
if (!s.resizable) return;
|
|
271
|
+
e.preventDefault();
|
|
272
|
+
controller.startPanelResize(e.clientX, e.clientY);
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
[h2("div", { class: "cli-panel-resize-grip" })]
|
|
276
|
+
),
|
|
277
|
+
h2("div", { class: "cli-panel-header-content" }, [
|
|
278
|
+
h2("p", { class: "cli-panel-title" }, [h2("span", { class: "cli-panel-title-icon" }, [icon(TERMINAL_ICON)]), PANEL_LABELS.title]),
|
|
279
|
+
s.showStatusIndicators ? h2(
|
|
280
|
+
"div",
|
|
281
|
+
{ class: "cli-panel-status-indicators" },
|
|
282
|
+
indicators.map(
|
|
283
|
+
(item) => h2(
|
|
284
|
+
"span",
|
|
285
|
+
{
|
|
286
|
+
key: item.key,
|
|
287
|
+
class: joinClasses("cli-panel-status-item", item.itemClass),
|
|
288
|
+
onClick: item.dropdown ? (e) => openDropdown(e, item.dropdown) : void 0
|
|
289
|
+
},
|
|
290
|
+
[
|
|
291
|
+
item.dotClass ? h2("span", { class: `cli-panel-status-dot ${item.dotClass}` }) : null,
|
|
292
|
+
item.icon ? h2("span", { class: joinClasses("cli-panel-status-icon", item.iconClass) }, item.icon) : null,
|
|
293
|
+
h2("span", { class: "cli-panel-status-label" }, item.label)
|
|
294
|
+
]
|
|
295
|
+
)
|
|
296
|
+
)
|
|
297
|
+
) : null,
|
|
298
|
+
// Compact indicators for left/right positions (CSS controls visibility).
|
|
299
|
+
h2(
|
|
300
|
+
"div",
|
|
301
|
+
{ class: "cli-panel-status-indicators-compact" },
|
|
302
|
+
indicators.map(
|
|
303
|
+
(item) => h2(
|
|
304
|
+
"span",
|
|
305
|
+
{
|
|
306
|
+
key: item.key,
|
|
307
|
+
class: joinClasses("cli-panel-status-compact-item", item.compactClass),
|
|
308
|
+
title: item.title,
|
|
309
|
+
onClick: item.dropdown ? (e) => openDropdown(e, item.dropdown) : void 0
|
|
310
|
+
},
|
|
311
|
+
[
|
|
312
|
+
item.compactDotClass ? h2("span", { class: item.compactDotClass }) : null,
|
|
313
|
+
item.dotClass ? h2("span", { class: `cli-panel-status-dot ${item.dotClass}` }) : null,
|
|
314
|
+
item.icon ? h2("span", { class: joinClasses("cli-panel-status-icon", item.iconClass) }, item.icon) : null
|
|
315
|
+
]
|
|
316
|
+
)
|
|
317
|
+
)
|
|
318
|
+
),
|
|
319
|
+
h2("div", { class: "cli-panel-action-buttons" }, [
|
|
320
|
+
h2("div", { class: "cli-panel-btn-position-wrapper", onClick: stop }, [
|
|
321
|
+
h2(
|
|
322
|
+
"button",
|
|
323
|
+
{
|
|
324
|
+
class: "cli-panel-btn cli-panel-btn-position",
|
|
325
|
+
title: PANEL_LABELS.movePanel,
|
|
326
|
+
onClick: () => controller.togglePositionDropdown()
|
|
327
|
+
},
|
|
328
|
+
[icon(positionIcon(s.position))]
|
|
329
|
+
),
|
|
330
|
+
s.positionDropdownOpen ? h2(
|
|
331
|
+
"div",
|
|
332
|
+
{ class: "cli-panel-position-dropdown" },
|
|
333
|
+
positionOptions(s).map(
|
|
334
|
+
(opt) => h2(
|
|
335
|
+
"button",
|
|
336
|
+
{ key: opt.position, class: opt.className, onClick: () => controller.setPosition(opt.position) },
|
|
337
|
+
[icon(positionIcon(opt.position, 16)), opt.label]
|
|
338
|
+
)
|
|
339
|
+
)
|
|
340
|
+
) : null
|
|
341
|
+
]),
|
|
342
|
+
s.hideable ? h2("button", { class: "cli-panel-btn cli-panel-btn-hide", title: PANEL_LABELS.hide, onClick: () => controller.hide() }, [icon(HIDE_ICON)]) : null,
|
|
343
|
+
h2(
|
|
344
|
+
"button",
|
|
345
|
+
{
|
|
346
|
+
class: "cli-panel-btn",
|
|
347
|
+
title: s.maximized ? PANEL_LABELS.restore : PANEL_LABELS.maximize,
|
|
348
|
+
disabled: s.collapsed,
|
|
349
|
+
onClick: () => controller.toggleMaximize()
|
|
350
|
+
},
|
|
351
|
+
[icon(s.maximized ? RESTORE_ICON : MAXIMIZE_ICON)]
|
|
352
|
+
),
|
|
353
|
+
h2(
|
|
354
|
+
"button",
|
|
355
|
+
{
|
|
356
|
+
class: "cli-panel-btn",
|
|
357
|
+
title: s.collapsed ? PANEL_LABELS.expand : PANEL_LABELS.collapse,
|
|
358
|
+
onClick: () => controller.toggle()
|
|
359
|
+
},
|
|
360
|
+
[icon(collapseChevronIcon(s.position, s.collapsed))]
|
|
361
|
+
),
|
|
362
|
+
s.closable ? h2("button", { class: "cli-panel-btn cli-panel-btn-close", title: PANEL_LABELS.close, onClick: () => controller.close() }, [icon(CLOSE_ICON)]) : null
|
|
363
|
+
])
|
|
364
|
+
]),
|
|
365
|
+
h2("div", { class: glowLineClass(s) })
|
|
366
|
+
]);
|
|
367
|
+
};
|
|
368
|
+
const renderTabs = (s) => h2("div", { class: "cli-panel-tabs" }, [
|
|
369
|
+
h2(
|
|
370
|
+
"ul",
|
|
371
|
+
{ class: "cli-panel-tab-list" },
|
|
372
|
+
s.tabs.map(
|
|
373
|
+
(tab) => h2(
|
|
374
|
+
"li",
|
|
375
|
+
{
|
|
376
|
+
key: tab.id,
|
|
377
|
+
class: panelTabClass(s, tab),
|
|
378
|
+
onClick: () => controller.selectTab(tab.id),
|
|
379
|
+
onDblclick: () => controller.startRename(tab.id),
|
|
380
|
+
onContextmenu: (e) => {
|
|
381
|
+
e.preventDefault();
|
|
382
|
+
e.stopPropagation();
|
|
383
|
+
controller.openContextMenu(tab.id, e.clientX, e.clientY);
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
tab.isEditing ? [
|
|
387
|
+
h2("input", {
|
|
388
|
+
class: "cli-panel-tab-rename-input",
|
|
389
|
+
type: "text",
|
|
390
|
+
value: tab.title,
|
|
391
|
+
onVnodeMounted: (vnode) => {
|
|
392
|
+
const input = vnode.el;
|
|
393
|
+
input.focus();
|
|
394
|
+
input.select();
|
|
395
|
+
},
|
|
396
|
+
onKeydown: (e) => handleRenameKey(controller, tab.id, e.key, e.target.value),
|
|
397
|
+
onBlur: (e) => controller.commitRename(tab.id, e.target.value),
|
|
398
|
+
onClick: stop,
|
|
399
|
+
onDblclick: stop
|
|
400
|
+
})
|
|
401
|
+
] : [
|
|
402
|
+
h2("span", { class: panelTabDotClass(s, tab) }),
|
|
403
|
+
h2("span", { class: "cli-panel-tab-title" }, tab.title),
|
|
404
|
+
h2(
|
|
405
|
+
"button",
|
|
406
|
+
{
|
|
407
|
+
class: "cli-panel-tab-close-btn",
|
|
408
|
+
title: PANEL_LABELS.closeTab,
|
|
409
|
+
onClick: (e) => {
|
|
410
|
+
e.stopPropagation();
|
|
411
|
+
controller.closeTab(tab.id);
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
CLOSE_GLYPH
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
)
|
|
418
|
+
)
|
|
419
|
+
),
|
|
420
|
+
h2("button", { class: "cli-panel-add-tab", title: PANEL_LABELS.newTerminal, onClick: () => controller.addTab() }, "+")
|
|
421
|
+
]);
|
|
422
|
+
const renderInstances = (s) => h2(
|
|
423
|
+
"div",
|
|
424
|
+
{ class: "cli-panel-instances" },
|
|
425
|
+
s.tabs.map(
|
|
426
|
+
(tab) => h2("div", { key: tab.id, class: "cli-panel-instance", style: { display: tab.id === s.activeTabId ? void 0 : "none" } }, [
|
|
427
|
+
h2(
|
|
428
|
+
"div",
|
|
429
|
+
{ class: panesContainerClass(s) },
|
|
430
|
+
tab.panes.flatMap((pane, i) => [
|
|
431
|
+
i > 0 ? h2(
|
|
432
|
+
"div",
|
|
433
|
+
{
|
|
434
|
+
key: `divider-${pane.id}`,
|
|
435
|
+
class: "cli-panel-pane-divider",
|
|
436
|
+
onMousedown: (e) => {
|
|
437
|
+
e.preventDefault();
|
|
438
|
+
controller.startPaneResize(tab.id, i - 1, e.clientX, panesContainerWidth(e.target));
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
[h2("div", { class: "cli-panel-pane-divider-grip" })]
|
|
442
|
+
) : null,
|
|
443
|
+
h2(
|
|
444
|
+
"div",
|
|
445
|
+
{
|
|
446
|
+
key: pane.id,
|
|
447
|
+
class: paneClass(s, tab.id, pane.id),
|
|
448
|
+
style: paneStyle(pane.widthPercent),
|
|
449
|
+
onClick: () => controller.activatePane(tab.id, pane.id)
|
|
450
|
+
},
|
|
451
|
+
[
|
|
452
|
+
tab.panes.length > 1 ? h2(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
class: "cli-panel-pane-close-btn",
|
|
456
|
+
title: PANEL_LABELS.closePane,
|
|
457
|
+
onClick: (e) => {
|
|
458
|
+
e.stopPropagation();
|
|
459
|
+
controller.closePane(pane.id);
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
CLOSE_GLYPH
|
|
463
|
+
) : null,
|
|
464
|
+
h2(Cli, {
|
|
465
|
+
options: mergedOptions.value,
|
|
466
|
+
modules: hostConfig.value.modules,
|
|
467
|
+
processors: hostConfig.value.processors,
|
|
468
|
+
services: hostConfig.value.services,
|
|
469
|
+
snapshot: pane.snapshot,
|
|
470
|
+
style: { height: "100%" },
|
|
471
|
+
onReady: (engine) => controller.registerEngine(tab.id, pane.id, engine)
|
|
472
|
+
})
|
|
473
|
+
]
|
|
474
|
+
)
|
|
475
|
+
])
|
|
476
|
+
)
|
|
477
|
+
])
|
|
478
|
+
)
|
|
479
|
+
);
|
|
480
|
+
const renderContextMenu = (s) => h2(
|
|
481
|
+
"div",
|
|
482
|
+
{ class: "cli-panel-context-menu", style: contextMenuStyle(s), onClick: stop },
|
|
483
|
+
contextMenuItems(s).flatMap((item) => [
|
|
484
|
+
item.separatorBefore ? h2("div", { class: "cli-panel-context-menu-separator" }) : null,
|
|
485
|
+
h2(
|
|
486
|
+
"button",
|
|
487
|
+
{
|
|
488
|
+
class: joinClasses("cli-panel-context-menu-item", item.destructive && "destructive"),
|
|
489
|
+
disabled: item.disabled,
|
|
490
|
+
onClick: () => runContextMenuAction(controller, item.action)
|
|
491
|
+
},
|
|
492
|
+
item.label
|
|
493
|
+
)
|
|
494
|
+
])
|
|
495
|
+
);
|
|
496
|
+
const renderStatusDropdown = (s) => {
|
|
497
|
+
const dropdown = openStatusDropdown(s);
|
|
498
|
+
if (!dropdown) return null;
|
|
499
|
+
return h2("div", { class: "cli-panel-services-dropdown", style: dropdown.style, onClick: stop }, [
|
|
500
|
+
h2("div", { class: "cli-panel-services-dropdown-header" }, dropdown.header),
|
|
501
|
+
h2(
|
|
502
|
+
"div",
|
|
503
|
+
{ class: "cli-panel-services-dropdown-list" },
|
|
504
|
+
dropdown.rows.map(
|
|
505
|
+
(row) => h2("div", { key: row.key, class: "cli-panel-services-dropdown-item" }, [
|
|
506
|
+
h2("span", { class: row.dotClass }),
|
|
507
|
+
h2("div", { class: "cli-panel-svc-info" }, [
|
|
508
|
+
h2("span", { class: "cli-panel-svc-name" }, row.name),
|
|
509
|
+
row.description ? h2("span", { class: "cli-panel-svc-desc" }, row.description) : null
|
|
510
|
+
]),
|
|
511
|
+
dropdown.kind === "servers" ? h2("div", { class: "cli-panel-srv-meta" }, [
|
|
512
|
+
h2("span", { class: "cli-panel-svc-status" }, row.status),
|
|
513
|
+
...row.meta.map((m) => h2("span", { key: m, class: "cli-panel-svc-desc" }, m))
|
|
514
|
+
]) : h2("span", { class: "cli-panel-svc-status" }, row.status)
|
|
515
|
+
])
|
|
516
|
+
)
|
|
517
|
+
),
|
|
518
|
+
dropdown.rows.length === 0 ? h2("div", { class: "cli-panel-services-dropdown-empty" }, dropdown.emptyText) : null
|
|
519
|
+
]);
|
|
520
|
+
};
|
|
521
|
+
return () => {
|
|
522
|
+
const s = state.value;
|
|
523
|
+
if (!s.visible) return null;
|
|
524
|
+
return h2(Fragment, [
|
|
525
|
+
s.hidden ? h2(
|
|
526
|
+
"button",
|
|
527
|
+
{
|
|
528
|
+
class: "cli-panel-hide-tab",
|
|
529
|
+
"data-position": s.position,
|
|
530
|
+
"data-hide-align": s.hideAlignment,
|
|
531
|
+
style: s.themeStyles,
|
|
532
|
+
title: PANEL_LABELS.showCli,
|
|
533
|
+
onClick: () => controller.unhide()
|
|
534
|
+
},
|
|
535
|
+
[
|
|
536
|
+
icon(HIDE_TAB_TERMINAL_ICON, "cli-panel-hide-tab-icon"),
|
|
537
|
+
h2("span", { class: "cli-panel-hide-tab-label" }, PANEL_LABELS.title),
|
|
538
|
+
icon(hideTabChevronIcon(s.position), "cli-panel-hide-tab-arrow")
|
|
539
|
+
]
|
|
540
|
+
) : null,
|
|
541
|
+
h2(
|
|
542
|
+
"div",
|
|
543
|
+
{
|
|
544
|
+
ref: root,
|
|
545
|
+
class: panelWrapperClass(s, props.class),
|
|
546
|
+
style: { ...panelWrapperStyle(s), ...props.style },
|
|
547
|
+
"data-position": s.position,
|
|
548
|
+
"data-resizable": String(s.resizable),
|
|
549
|
+
"data-closable": String(s.closable),
|
|
550
|
+
"data-hideable": String(s.hideable)
|
|
551
|
+
},
|
|
552
|
+
[
|
|
553
|
+
renderHeader(s),
|
|
554
|
+
s.initialized ? h2("div", { class: "cli-panel-content", style: s.collapsed ? { display: "none" } : void 0 }, [
|
|
555
|
+
renderTabs(s),
|
|
556
|
+
renderInstances(s)
|
|
557
|
+
]) : null
|
|
558
|
+
]
|
|
559
|
+
),
|
|
560
|
+
s.contextMenu.visible ? renderContextMenu(s) : null,
|
|
561
|
+
renderStatusDropdown(s)
|
|
562
|
+
]);
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// src/CliProvider.ts
|
|
568
|
+
import { defineComponent as defineComponent4, ref as ref2, h as h3, provide as provide2 } from "vue";
|
|
569
|
+
|
|
570
|
+
// src/useCliEngine.ts
|
|
571
|
+
import { onMounted as onMounted3, onBeforeUnmount as onBeforeUnmount3, shallowRef as shallowRef2 } from "vue";
|
|
572
|
+
import { createCliEngine as createCliEngine2 } from "@qodalis/cli";
|
|
573
|
+
function useCliEngine(containerRef, config) {
|
|
574
|
+
const engine = shallowRef2(null);
|
|
575
|
+
onMounted3(async () => {
|
|
576
|
+
if (!containerRef.value) return;
|
|
577
|
+
const e = createCliEngine2(containerRef.value, { ...config, framework: "Vue" });
|
|
578
|
+
await e.start();
|
|
579
|
+
engine.value = e;
|
|
580
|
+
});
|
|
581
|
+
onBeforeUnmount3(() => {
|
|
582
|
+
engine.value?.destroy();
|
|
583
|
+
engine.value = null;
|
|
584
|
+
});
|
|
585
|
+
return engine;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/CliProvider.ts
|
|
589
|
+
var CliProvider = defineComponent4({
|
|
590
|
+
name: "CliProvider",
|
|
591
|
+
props: {
|
|
592
|
+
modules: {
|
|
593
|
+
type: Array,
|
|
594
|
+
default: void 0
|
|
595
|
+
},
|
|
596
|
+
processors: {
|
|
597
|
+
type: Array,
|
|
598
|
+
default: void 0
|
|
599
|
+
},
|
|
600
|
+
options: {
|
|
601
|
+
type: Object,
|
|
602
|
+
default: void 0
|
|
603
|
+
},
|
|
604
|
+
services: {
|
|
605
|
+
type: Object,
|
|
606
|
+
default: void 0
|
|
607
|
+
},
|
|
608
|
+
style: {
|
|
609
|
+
type: Object,
|
|
610
|
+
default: void 0
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
emits: ["ready"],
|
|
614
|
+
setup(props, { slots, emit }) {
|
|
615
|
+
const containerRef = ref2(null);
|
|
616
|
+
const engine = useCliEngine(containerRef, {
|
|
617
|
+
modules: props.modules,
|
|
618
|
+
processors: props.processors,
|
|
619
|
+
options: props.options,
|
|
620
|
+
services: props.services
|
|
621
|
+
});
|
|
622
|
+
provide2(CliInjectionKey, { engine });
|
|
623
|
+
return () => h3("div", { style: { height: "100%" } }, [
|
|
624
|
+
h3("div", {
|
|
625
|
+
ref: containerRef,
|
|
626
|
+
style: { height: "100%", ...props.style }
|
|
627
|
+
}),
|
|
628
|
+
slots.default?.()
|
|
629
|
+
]);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
// src/useCli.ts
|
|
634
|
+
import { inject as inject3 } from "vue";
|
|
635
|
+
function useCli() {
|
|
636
|
+
const ctx = inject3(CliInjectionKey);
|
|
637
|
+
if (!ctx) {
|
|
638
|
+
throw new Error(
|
|
639
|
+
"useCli() must be used inside a <CliProvider> component"
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
return ctx;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// src/index.ts
|
|
646
|
+
import { CliEngine as CliEngine4 } from "@qodalis/cli";
|
|
647
|
+
export {
|
|
648
|
+
Cli,
|
|
649
|
+
CliConfigKey,
|
|
650
|
+
CliConfigProvider,
|
|
651
|
+
CliEngine4 as CliEngine,
|
|
652
|
+
CliInjectionKey,
|
|
653
|
+
CliPanel,
|
|
654
|
+
CliProvider,
|
|
655
|
+
useCli,
|
|
656
|
+
useCliEngine
|
|
657
|
+
};
|
|
658
|
+
//# sourceMappingURL=index.mjs.map
|