Add PyPI package installer, file-tree context menu, and demos UI

Expose micropip installs from the menu, right-click actions on the file
tree, local folder/file open shortcuts, and browse demos/ alongside code/.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-14 22:34:55 +12:00
parent 8c45097ec5
commit 551c3d1efc
5 changed files with 1616 additions and 108 deletions

View File

@@ -138,6 +138,15 @@ button,
background: #f7fafc;
}
button.menu-item.menu-button {
border: none;
background: transparent;
width: 100%;
text-align: left;
font: inherit;
font-family: inherit;
}
.menu-checkbox input[type="checkbox"] {
margin: 0;
}
@@ -239,6 +248,63 @@ button,
padding: 0.5rem;
}
.file-tree-context-menu {
position: fixed;
z-index: 250;
min-width: 210px;
max-width: min(92vw, 300px);
background: #fff;
border: 1px solid #cbd5e0;
border-radius: 8px;
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
padding: 0.35rem 0;
font-size: 0.875rem;
color: #2d3748;
}
.file-tree-context-menu[hidden] {
display: none !important;
}
.file-tree-context-menu .file-tree-cm-note {
padding: 0.35rem 0.85rem 0.5rem;
font-size: 0.75rem;
color: #718096;
line-height: 1.35;
}
.file-tree-context-menu button {
display: block;
width: 100%;
text-align: left;
padding: 0.45rem 0.85rem;
border: none;
background: transparent;
cursor: pointer;
font: inherit;
color: inherit;
}
.file-tree-context-menu button:disabled {
opacity: 0.45;
cursor: not-allowed;
}
.file-tree-context-menu button:hover:not(:disabled) {
background: #edf2f7;
}
.file-tree-context-menu button.file-tree-cm-danger {
color: #c53030;
}
.file-tree-context-menu hr.file-tree-cm-sep {
height: 1px;
margin: 0.3rem 0.5rem;
background: #e2e8f0;
border: none;
}
.file-item {
padding: 0.5rem;
cursor: pointer;
@@ -1126,6 +1192,134 @@ button,
border-color: #2c5aa0;
}
.packages-modal-content {
width: min(440px, 92vw);
max-height: 85vh;
overflow-y: auto;
margin: 6% auto;
}
.packages-modal-hint {
font-size: 0.8rem;
color: #718096;
line-height: 1.45;
margin: 0 0 0.75rem;
}
.packages-field-label {
display: block;
font-size: 0.75rem;
font-weight: 600;
color: #64748b;
margin: 0.25rem 0 0.35rem;
}
.packages-pypi-info {
min-height: 1.2rem;
font-size: 0.85rem;
color: #334155;
margin: 0.15rem 0 0.5rem;
}
.packages-modal-actions-row {
margin-bottom: 0.65rem;
}
.packages-secondary-btn {
padding: 0.4rem 0.75rem;
border: 1px solid #cbd5e0;
background: #f8fafc;
color: #334155;
border-radius: 6px;
font-size: 0.8rem;
cursor: pointer;
}
.packages-secondary-btn:hover {
background: #edf2f7;
}
.packages-modal-status {
min-height: 1.25rem;
font-size: 0.85rem;
color: #2b6cb0;
margin-bottom: 0.5rem;
}
.packages-install-log {
max-height: 12rem;
overflow: auto;
margin: 0 0 0.65rem;
padding: 0.45rem 0.5rem;
font-size: 0.72rem;
line-height: 1.35;
color: #1e293b;
background: #f8fafc;
border: 1px solid #e2e8f0;
border-radius: 6px;
white-space: pre-wrap;
word-break: break-word;
}
.packages-saved-label {
font-size: 0.75rem;
font-weight: 600;
color: #64748b;
margin: 0 0 0.35rem;
}
.packages-saved-list {
list-style: none;
margin: 0 0 1rem;
padding: 0;
border: 1px solid #e2e8f0;
border-radius: 6px;
max-height: 10rem;
overflow-y: auto;
}
.packages-saved-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
padding: 0.4rem 0.55rem;
border-bottom: 1px solid #f1f5f9;
font-size: 0.85rem;
color: #2d3748;
}
.packages-saved-item:last-child {
border-bottom: none;
}
.packages-saved-item span {
word-break: break-all;
}
.packages-saved-empty {
padding: 0.55rem 0.65rem;
color: #94a3b8;
font-size: 0.85rem;
}
.packages-remove-btn {
flex-shrink: 0;
padding: 0.2rem 0.45rem;
font-size: 0.75rem;
border: 1px solid #e2e8f0;
background: white;
border-radius: 4px;
cursor: pointer;
color: #4a5568;
}
.packages-remove-btn:hover {
background: #fff5f5;
border-color: #feb2b2;
color: #c53030;
}
/* Desktop: hide the file browser when collapsed via the hamburger toggle. */
@media (min-width: 769px) {
.sidebar.is-collapsed {