-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathNotebookCellSelection.css
More file actions
215 lines (173 loc) · 8.57 KB
/
NotebookCellSelection.css
File metadata and controls
215 lines (173 loc) · 8.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2025 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/
/*
* Notebook Cell Selection and Border Styles
*
* This CSS file defines the border and selection styles for notebook cells.
* Borders change color based on cell states (selected, editing, hover)
* while maintaining a consistent width to prevent layout shifts.
*
* It also includes styles for assistant cell highlight animations used when AI modifies cells.
*/
/* === Code Cells: Editor + Footer Container === */
.positron-notebook-editor-section {
border: 1px solid var(--vscode-positronNotebook-border-color);
border-radius: var(--vscode-positronNotebook-cell-radius);
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-bottom: none; /* Footer connects seamlessly to outputs below */
}
.positron-notebook-code-cell .positron-notebook-editor-container {
overflow: hidden; /* Clip editor content to rounded corners */
border-radius: var(--vscode-positronNotebook-cell-radius);
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
/* === Code Cells: Outputs Container === */
.positron-notebook-code-cell .positron-notebook-cell-outputs {
border: 1px solid var(--vscode-positronNotebook-border-color);
border-top: none;
/* Seamlessly connect the output border to the code cell editor+footer */
border-radius: var(--vscode-positronNotebook-cell-radius);
border-top-left-radius: 0;
border-top-right-radius: 0;
overflow: hidden;
}
/* === Selection States: Selected === */
.positron-notebook-cell.selected .positron-notebook-editor-section,
.positron-notebook-code-cell.selected .positron-notebook-cell-outputs {
border-color: var(--vscode-focusBorder);
}
/* === Selection States: Editing === */
.positron-notebook-cell.editing .positron-notebook-editor-section,
.positron-notebook-code-cell.editing .positron-notebook-cell-outputs {
border-color: var(--vscode-focusBorder);
}
/* === Selection States: Hover (when not selected/editing) === */
/* Use .sortable-cell:hover so hovering the drag handle also triggers the cell outline */
.sortable-cell:hover > .positron-notebook-cell:not(.selected):not(.editing) .positron-notebook-editor-section,
.sortable-cell:hover > .positron-notebook-code-cell:not(.selected):not(.editing) .positron-notebook-cell-outputs {
border-color: var(--vscode-editorWidget-border);
}
/* === Special Case: Code Cells with No Outputs === */
.positron-notebook-code-cell:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section {
border-radius: var(--vscode-positronNotebook-cell-radius);
border-bottom: 1px solid var(--vscode-positronNotebook-border-color);
}
/* Make bottom border of code cell footer transparent when there are no outputs to avoid double border while maintaining static height */
.positron-notebook-code-cell:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-code-cell-footer {
border-bottom-color: transparent;
}
/* When footer is collapsed (cell hasn't been run) and no outputs, editor container needs bottom radius */
.positron-notebook-code-cell:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section:has(.positron-notebook-code-cell-footer.collapsed) .positron-notebook-editor-container {
border-bottom-left-radius: var(--vscode-positronNotebook-cell-radius);
border-bottom-right-radius: var(--vscode-positronNotebook-cell-radius);
transition: border-bottom-left-radius 150ms ease-out, border-bottom-right-radius 150ms ease-out;
}
/* Update the border color for code cells with no outputs based on the selection state */
.positron-notebook-cell.selected:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section,
.positron-notebook-cell.editing:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section {
border-bottom-color: var(--vscode-focusBorder);
}
.sortable-cell:hover > .positron-notebook-cell:not(.selected):not(.editing):has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section {
border-bottom-color: var(--vscode-editorWidget-border);
}
/* === Raw Cells: Editor Only (no footer or outputs) === */
.positron-notebook-raw-cell .positron-notebook-editor-section {
border-bottom: 1px solid var(--vscode-positronNotebook-border-color);
border-radius: var(--vscode-positronNotebook-cell-radius);
}
.positron-notebook-raw-cell .positron-notebook-editor-container {
overflow: hidden;
border-radius: var(--vscode-positronNotebook-cell-radius);
}
/* === Markdown Cells: Editor (when shown) === */
.positron-notebook-markdown-cell .positron-notebook-editor-container:not(.editor-hidden) {
border: 1px solid var(--vscode-positronNotebook-border-color);
border-radius: var(--vscode-positronNotebook-cell-radius);
overflow: hidden;
}
.positron-notebook-cell.selected .positron-notebook-editor-container:not(.editor-hidden),
.positron-notebook-cell.editing .positron-notebook-editor-container:not(.editor-hidden) {
border-color: var(--vscode-focusBorder);
}
.sortable-cell:hover > .positron-notebook-cell:not(.selected):not(.editing) .positron-notebook-editor-container:not(.editor-hidden) {
border-color: var(--vscode-editorWidget-border);
}
/* === Markdown Cells: Rendered Content (when editor hidden) === */
/* Base border style that is transparent to prevent layout shift on hover */
.positron-notebook-markdown-cell .positron-notebook-cell-outputs {
border: 1px solid transparent;
border-radius: var(--vscode-positronNotebook-cell-radius);
}
/* Show border when selected or editing */
.positron-notebook-markdown-cell.selected .positron-notebook-cell-outputs,
.positron-notebook-markdown-cell.editing .positron-notebook-cell-outputs {
border-color: var(--vscode-focusBorder);
}
/* Show border on hover */
.sortable-cell:hover > .positron-notebook-markdown-cell:not(.selected):not(.editing) .positron-notebook-cell-outputs {
border-color: var(--vscode-editorWidget-border);
}
/* Empty markdown cell always shows dashed border */
.positron-notebook-markdown-cell .positron-notebook-cell-outputs:has(.empty-output-msg) {
border-style: dashed;
border-color: var(--vscode-positronNotebook-border-color);
}
/* Assistant cell highlight animation - used when AI modifies cells */
.positron-notebook-cell.assistant-highlight {
position: relative;
}
.positron-notebook-cell.assistant-highlight::after {
content: "";
position: absolute;
inset: 0;
background-color: var(--vscode-button-background);
border-radius: var(--vscode-positronNotebook-cell-radius);
pointer-events: none;
/* Must be higher than cell content (action bar is z-index: 10) to be visible as overlay */
z-index: 15;
opacity: 0;
animation: assistant-flash 1.5s ease-in-out;
animation-fill-mode: forwards;
}
@keyframes assistant-flash {
0%, 100% { opacity: 0; }
25%, 75% { opacity: 0.2; }
}
/* Operation-specific highlight colors - all use the same animation */
.positron-notebook-cell.assistant-highlight.assistant-highlight-add::after {
background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
}
.positron-notebook-cell.assistant-highlight.assistant-highlight-modify::after {
background-color: var(--vscode-button-background);
}
/* Note: Delete animation moved to sentinel implementation in Phase 5 */
/* High contrast theme variants - use border instead of background overlay */
.hc-black .positron-notebook-cell.assistant-highlight::after,
.hc-light .positron-notebook-cell.assistant-highlight::after {
background-color: transparent;
border: 2px solid var(--vscode-focusBorder);
animation: assistant-flash-hc 1.5s ease-in-out;
animation-fill-mode: forwards;
}
.hc-black .positron-notebook-cell.assistant-highlight.assistant-highlight-add::after,
.hc-light .positron-notebook-cell.assistant-highlight.assistant-highlight-add::after {
border-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-editorOverviewRuler-addedForeground));
}
@keyframes assistant-flash-hc {
0%, 100% { opacity: 0; }
25%, 75% { opacity: 1; }
}
/* Accessibility - disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
.positron-notebook-cell.assistant-highlight::after {
animation: none;
opacity: 0;
}
.positron-notebook-code-cell:has(.positron-notebook-outputs-section.no-outputs) .positron-notebook-editor-section:has(.positron-notebook-code-cell-footer.collapsed) .positron-notebook-editor-container {
transition: none;
}
}