Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
23332e7
WIP: Command palette
somebody1234 Jul 18, 2025
47d43f5
Initial command palette implementation
somebody1234 Jul 28, 2025
96f1367
[CommandPalette] Adjust appearance
somebody1234 Jul 29, 2025
32d05f8
[CommandPalette] Properly reactive query
somebody1234 Jul 29, 2025
50a7b4f
[CommandPalette] Add icons
somebody1234 Jul 29, 2025
c0c2e06
[CommandPalette] Prevent opening CB when running command from Command…
somebody1234 Jul 29, 2025
6a253ba
[ts] Fix lockfile
somebody1234 Jul 29, 2025
5396d95
[CommandPalette] Remove handlers for Project View
somebody1234 Jul 29, 2025
be480a9
[CommandPalette] Show keybinds
somebody1234 Jul 29, 2025
80bbece
[CommandPalette] Adjust markup
somebody1234 Jul 29, 2025
fd20727
[CommandPalette] Adjust markup; hide when in Project View
somebody1234 Jul 29, 2025
f1d93e4
[CommandPalette] Add entries for settings pages
somebody1234 Jul 29, 2025
6507186
[CommandPalette] Address CR
somebody1234 Jul 30, 2025
e94af0e
[Changelog] Add entry
somebody1234 Jul 30, 2025
8288068
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Jul 30, 2025
90a79d1
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Aug 4, 2025
f34d4db
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Aug 7, 2025
294e0a8
Partially address CR
somebody1234 Aug 7, 2025
2cd283c
[CommandPalette] Group actions; remove duplicate entries
somebody1234 Aug 8, 2025
1d22cab
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Aug 8, 2025
b81afa8
[Settings/Billing] Use correct text
somebody1234 Aug 8, 2025
69e73bd
Fix
somebody1234 Aug 8, 2025
7580643
pnpm dedupe
somebody1234 Aug 8, 2025
67aa86c
oops
somebody1234 Aug 9, 2025
4c638b4
[CommandPalette] Add arrow keys for navigation
somebody1234 Aug 11, 2025
8a5f5a7
Navigate back to drive when selecting Drive context menu entries
somebody1234 Aug 19, 2025
1ee1dc7
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Aug 19, 2025
7867c88
Remove `motion-v`
somebody1234 Aug 19, 2025
8d919ef
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Sep 2, 2025
7f1b61a
Fix errors
somebody1234 Sep 2, 2025
972f52c
Merge branch 'develop' into wip/sb/command-palette
mergify[bot] Sep 5, 2025
75de8ca
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Sep 5, 2025
2066b66
Fix integration tests
somebody1234 Sep 5, 2025
64b46bb
Merge branch 'develop' into wip/sb/command-palette
somebody1234 Sep 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
- [Graph is not moved when showing/resizing side panels.][13557]
- [Add "Invite" button to the top bar when using a team or higher plan][13522]
- ["Welcome Project" is automatically opened for new users][13479]
- [Project and Setting tab may be now closed with shortcut][13498][13604]. On
Windows/Linux <kbd>Ctrl</kbd>+<kbd>W</kbd> or <kbd>Ctrl</kbd> + <kbd>F4</kbd>;
on macOS: <kbd>⌘</kbd> + <kbd>W</kbd>.
- [Project and Setting tab may be now closed with shortcut][13498]
(reimplemented in [13604][13604]). On Windows/Linux
<kbd>Ctrl</kbd>+<kbd>W</kbd> or <kbd>Ctrl</kbd> + <kbd>F4</kbd>; on macOS:
<kbd>⌘</kbd> + <kbd>W</kbd>.
Comment on lines +55 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I thought I fixed it in one of the commits, but it seems it got lost…

- [Command Palette to search for arbitrary actions][13658]

[12774]: https://github.com/enso-org/enso/pull/12774
[12778]: https://github.com/enso-org/enso/pull/12778
Expand Down Expand Up @@ -66,6 +68,7 @@
[13479]: https://github.com/enso-org/enso/pull/13479
[13498]: https://github.com/enso-org/enso/pull/13498
[13604]: https://github.com/enso-org/enso/pull/13604
[13658]: https://github.com/enso-org/enso/pull/13658

#### Enso Standard Library

Expand Down
11 changes: 10 additions & 1 deletion app/common/src/text/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@
"rootFolderColumnName": "Root folder",
"pathColumnName": "Location",
"hideDevtools": "Hide Devtools",
"ensoDevtoolsShortcut": "Enso Devtools",
"toggleEnsoDevtoolsShortcut": "Toggle Enso Devtools",
"settingsShortcut": "Settings",
"closeTabShortcut": "Close Tab",
"openShortcut": "Open",
Expand Down Expand Up @@ -863,6 +863,15 @@
"goForwardShortcut": "Go Forward",
"upgradePlanShortcut": "Upgrade Plan",
"aboutThisAppShortcut": "About Enso",
"goToAccountSettingsShortcut": "Account Settings",
"goToOrganizationSettingsShortcut": "Organization Settings",
"goToLocalSettingsShortcut": "Local Settings",
"goToBillingAndPlansSettingsShortcut": "Billing and Plans Settings",
"goToMembersSettingsShortcut": "Members Settings",
"goToUserGroupsSettingsShortcut": "User Groups Settings",
"goToKeyboardShortcutsSettingsShortcut": "Keyboard Shortcuts Settings",
"goToActivityLogSettingsShortcut": "Activity Log Settings",
"toggleCommandPaletteShortcut": "Toggle Command Palette",
"moveToTrashShortcut": "Move To Trash",
"moveAllToTrashShortcut": "Move All To Trash",
"deleteForeverShortcut": "Delete Forever",
Expand Down
1 change: 1 addition & 0 deletions app/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"dotenv": "^16.4.7",
"enso-common": "workspace:*",
"events": "^3.3.0",
"fuzzysort": "3.1.0",
"framer-motion": "11.3.0",
"hash-sum": "^2.0.0",
"idb-keyval": "^6.2.1",
Expand Down
27 changes: 9 additions & 18 deletions app/gui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,15 @@ const { globalEventRegistry } = provideGlobalEventRegistry()
useEvent(window, 'keydown', bindingsHandlers)
useEvent(globalEventRegistry, 'pointerdown', (e) => interaction.handlePointerDown(e))

const platformClass = (() => {
switch (platform()) {
case Platform.windows:
return 'onWindows'
case Platform.macOS:
return 'onMacOs'
case Platform.linux:
return 'onLinux'
case Platform.windowsPhone:
return 'onWindowsPhone'
case Platform.iPhoneOS:
return 'onIPhoneOs'
case Platform.android:
return 'onAndroid'
default:
return undefined
}
})()
const platformClass = {
[Platform.windows]: 'onWindows',
[Platform.macOS]: 'onMacOs',
[Platform.linux]: 'onLinux',
[Platform.windowsPhone]: 'onWindowsPhone',
[Platform.iPhoneOS]: 'onIPhoneOs',
[Platform.android]: 'onAndroid',
[Platform.unknown]: undefined,
}[platform()]

onMounted(() => {
if (config.params.window.vibrancy) {
Expand Down
3 changes: 3 additions & 0 deletions app/gui/src/components/AppContainer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { Dashboard as DashboardReact, type DashboardProps } from '#/pages/dashboard/Dashboard'
import { EnsoPath } from '#/services/Backend'
import CommandPalette from '$/components/CommandPalette.vue'
import { useBackends } from '$/providers/backends'
import { provideContainerData } from '$/providers/container'
import { provideOpenedProjects } from '$/providers/openedProjects'
Expand Down Expand Up @@ -59,8 +60,10 @@ const openedProjectsStore = provideOpenedProjects()
provideAsyncResources(openedProjectsStore)
provideContainerData()
</script>

<template>
<div class="TabView">
<CommandPalette />
<ContainerDataProviderForReact>
<Dashboard v-bind="props" />
</ContainerDataProviderForReact>
Expand Down
223 changes: 223 additions & 0 deletions app/gui/src/components/CommandPalette.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<script setup lang="ts">
import KeyboardShortcutReact from '#/pages/dashboard/components/KeyboardShortcut'
import { unsetModal } from '#/providers/ModalProvider'
import * as objects from '#/utilities/object'
import { useActionsStore, type Action } from '$/providers/actions'
import { useContainerData } from '$/providers/container'
import { commandPaletteBindings } from '@/bindings'
import SvgIcon from '@/components/SvgIcon.vue'
import { useEvent } from '@/composables/events'
import { registerHandlers } from '@/providers/action'
import { injectInteractionHandler } from '@/providers/interactionHandler'
import { reactComponent } from '@/util/react'
import { AnimatePresence, motion } from 'motion-v'
import { computed, ref, watchEffect } from 'vue'

const KeyboardShortcut = reactComponent(KeyboardShortcutReact)

const { findActions } = useActionsStore()
const containerData = useContainerData()
const interaction = injectInteractionHandler()

const visible = ref(false)
const query = ref('')
const input = ref<HTMLInputElement | null>(null)

const actionHandlers = registerHandlers({
'commandPalette.open': {
action: () => {
if (containerData.tab !== 'drive' && containerData.tab !== 'settings') return
visible.value = true
},
},
})

watchEffect(() => {
if (!input.value) return
if (visible.value) {
unsetModal()
input.value.focus()
interaction.setCurrent({
cancel() {
visible.value = false
},
end() {
visible.value = false
},
})
} else {
input.value.blur()
query.value = ''
}
})

useEvent(
window,
'keydown',
commandPaletteBindings.handler(
objects.mapEntries(
commandPaletteBindings.bindings,
(actionName) => actionHandlers[actionName].action,
),
),
)

function trigger(action: Action | undefined) {
if (!action) return
visible.value = false
action.doAction()
}

const actions = computed(() => findActions(query))
</script>

<template>
<AnimatePresence>
<motion.div
v-if="visible"
class="CommandPalette"
:initial="{ opacity: 0, y: '-100px' }"
:animate="{ opacity: 1, y: '0' }"
:exit="{ opacity: 0, y: '-100px' }"
@click.stop="visible = false"
@keydown.enter.stop
>
<div class="container" @click.stop>
<input
ref="input"
v-model="query"
type="text"
placeholder="Search actions..."
@keydown.enter.prevent="trigger(actions[0])"
/>
<div class="scroll-container">
<ul>
<li v-for="(action, i) in actions" :key="i">
<button @click="trigger(action)">
<SvgIcon v-if="action.icon" :name="action.icon" class="icon" />
<div v-else class="icon-placeholder"></div>
<!-- eslint-disable vue/no-v-html -->
<span class="entry-content" v-html="action.highlighted.name"></span>
<!-- eslint-enable -->
<div class="shortcuts">
<KeyboardShortcut
v-for="(shortcut, j) in action.shortcuts"
:key="j"
:shortcut="shortcut"
/>
</div>
</button>
</li>
<li v-if="!actions.length" class="disabled">No actions found</li>
</ul>
</div>
</div>
</motion.div>
</AnimatePresence>
</template>

<style scoped>
.CommandPalette {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
cursor: pointer;
font-size: 14px;
color: var(--color-text);
max-height: 100vh;

&::before {
content: '';
position: absolute;
inset: 0;
top: -100px;
height: calc(100% + 200px);
background: var(--color-dim);
}
}

.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: var(--color-app-bg);
border-radius: var(--radius-default);
backdrop-filter: blur(8px);
cursor: default;
padding: 1em;
display: flex;
flex-flow: column nowrap;
gap: 1em;
max-width: 32em;
}

.scroll-container {
overflow-y: auto;
height: 20em;
width: 100%;
padding-right: 0.5em;
}

input {
background: none;
width: calc(100% + 2em);
margin: 0 -1em;
padding: 0 2em 0.5em 2em;
border-bottom: 0.1px solid rgb(0 0 0 / 0.2);
}

button {
display: flex;
gap: 0.75em;
align-items: center;
}

.icon,
.icon-placeholder {
display: inline-block;
color: var(--color-text);
}

.icon-placeholder {
width: 1em;
}

.entry-content {
margin-right: auto;
}

.shortcuts {
display: flex;
gap: 0.5em;
color: var(--color-text-secondary);
}

li {
color: var(--color-primary);
border-radius: var(--radius-default);
padding: 0.2em 1em;

&:focus-within {
background-color: var(--color-menu-entry-selected-bg);
}

&:not(.disabled):hover {
background-color: var(--color-menu-entry-hover-bg);
}

button {
width: 100%;
text-align: left;
border-radius: var(--radius-default);
}
}

:deep(.highlighted) {
color: var(--color-text);
font-weight: bold;
}
</style>
Loading
Loading