@@ -166,6 +166,12 @@ const props = defineProps({
166
166
type: Array
167
167
},
168
168
169
+ font: {
170
+ default: ' ' ,
171
+ required: false ,
172
+ type: String
173
+ },
174
+
169
175
helpText: {
170
176
default: null ,
171
177
required: false ,
@@ -271,12 +277,6 @@ const props = defineProps({
271
277
default: ' ' ,
272
278
required: false ,
273
279
type: String
274
- },
275
-
276
- font: {
277
- default: undefined ,
278
- required: false ,
279
- type: String
280
280
}
281
281
})
282
282
@@ -306,22 +306,21 @@ const local = reactive({
306
306
historyPosition: props .historyPosition ,
307
307
isFullscreen: props .isFullscreen ,
308
308
prompt: props .prompt ,
309
- query: props .query ,
310
- font: props .font
309
+ query: props .query
311
310
})
312
311
// Signals like SIGINT or SIGKILL
313
312
const signals = reactive (newEventBus ())
314
313
// Reactive terminal state
315
314
const terminal = computed (() => ({
316
315
cursorPosition: local .cursorPosition ,
317
316
dispatchedQueries: local .dispatchedQueries ,
317
+ font: props .font ,
318
318
history: local .history ,
319
319
historyPosition: local .historyPosition ,
320
320
invert: props .invert ,
321
321
isFullscreen: local .isFullscreen ,
322
322
prompt: local .prompt ,
323
- query: local .query ,
324
- font: local .font
323
+ query: local .query
325
324
}))
326
325
327
326
// Provided commands as programs. It takes the keys of the commands object
@@ -378,7 +377,7 @@ const appendToHistory = (...components) => {
378
377
// Parses the query, looks for a user given command and appends the resulting
379
378
// component to the history
380
379
const dispatch = async query => {
381
- // Call given interpreter to execute arbitrary code, if given
380
+ // Call optional interpreter to execute arbitrary code
382
381
if (isFunction (props .interpreter )) {
383
382
props .interpreter (query)
384
383
return
@@ -413,7 +412,7 @@ const dispatch = async query => {
413
412
// instantly to history
414
413
// TODO Find a better way to find out the name
415
414
if (eq (get (command, ' __name' ), ' VueCommandQuery' )) {
416
- appendToHistory (command )
415
+ exit ( )
417
416
return
418
417
}
419
418
@@ -435,9 +434,9 @@ const dispatch = async query => {
435
434
})
436
435
appendToHistory (markRaw (component))
437
436
}
438
- // Tear down component and execute final steps
437
+ // Tear down component, execute final steps and return a new query
439
438
const exit = () => {
440
- // TODO Does order matter?
439
+ // TODO: Does order matter?
441
440
appendToHistory (createQuery ())
442
441
setCursorPosition (0 )
443
442
setFullscreen (false )
@@ -522,7 +521,7 @@ onMounted(() => {
522
521
523
522
// Scroll to bottom if history changes
524
523
const resizeObsever = new ResizeObserver (() => {
525
- // TODO Only scroll to bottom if user scrolled to bottom before
524
+ // TODO: Only scroll to bottom if user scrolled to bottom before
526
525
vueCommandHistoryRef .value .scrollTop = vueCommandHistoryRef .value .scrollHeight
527
526
})
528
527
for (const vueCommandHistoryEntry of vueCommandHistoryRef .value .children ) {
0 commit comments