file-tree.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. :root {
  2. --file-tree-item-hover-bg: var(--bg-dark-secondary);
  3. --file-tree-item-selected-bg: var(--bg-accent-01);
  4. --file-tree-item-color: var(--content-primary-dark);
  5. --file-tree-bg: var(--bg-dark-tertiary);
  6. --file-tree-item-selected-color: var(--content-primary-dark);
  7. --file-tree-line-height: 2.05;
  8. }
  9. @include theme('light') {
  10. --file-tree-item-hover-bg: var(--bg-light-tertiary);
  11. --file-tree-item-color: var(--content-secondary);
  12. --file-tree-bg: var(--bg-light-primary);
  13. --file-tree-item-selected-color: var(--bg-light-primary);
  14. }
  15. .ide-react-file-tree-panel {
  16. display: flex;
  17. flex-direction: column;
  18. // Prevent the file tree expanding beyond the boundary of the panel
  19. .file-tree {
  20. width: 100%;
  21. }
  22. }
  23. .context-menu {
  24. position: fixed;
  25. z-index: 100;
  26. }
  27. .editor-sidebar {
  28. background-color: var(--file-tree-bg);
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. @mixin fake-full-width-bg($bg-color) {
  33. &::before {
  34. content: '\00a0';
  35. position: absolute;
  36. width: 9999px;
  37. left: -9999px;
  38. background-color: $bg-color;
  39. }
  40. }
  41. .file-tree {
  42. display: flex !important; // To work around jQuery layout's inline styles
  43. flex-direction: column;
  44. height: 100%;
  45. > file-tree-root,
  46. .file-tree-inner {
  47. position: relative;
  48. display: flex;
  49. flex-direction: column;
  50. flex-grow: 1;
  51. overflow-y: auto;
  52. width: inherit;
  53. height: inherit;
  54. &.no-toolbar {
  55. top: 0;
  56. }
  57. }
  58. // TODO; Consolidate with "Project files" in Overleaf
  59. h3 {
  60. font-size: 1rem;
  61. border-bottom: 1px solid var(--border-primary);
  62. padding-bottom: var(--spacing-02);
  63. margin: var(--spacing-05);
  64. }
  65. &-history {
  66. .entity-name {
  67. padding-left: var(--spacing-03);
  68. &.deleted {
  69. text-decoration: line-through;
  70. }
  71. }
  72. .loading {
  73. padding-left: var(--spacing-03);
  74. color: var(--content-primary-dark);
  75. .material-symbols {
  76. color: var(--content-primary-dark);
  77. }
  78. }
  79. }
  80. ul.file-tree-list {
  81. margin: 0;
  82. overflow: hidden auto;
  83. height: 100%;
  84. flex-grow: 1;
  85. position: relative;
  86. .entity > ul,
  87. ul[role='tree'] {
  88. margin-left: var(--spacing-08);
  89. }
  90. &::after {
  91. content: '';
  92. display: block;
  93. min-height: var(--spacing-08);
  94. }
  95. li {
  96. line-height: var(--file-tree-line-height);
  97. position: relative;
  98. &:focus {
  99. outline: none;
  100. }
  101. .entity {
  102. user-select: none;
  103. &:focus {
  104. outline: none;
  105. }
  106. }
  107. .entity > .entity-name > button {
  108. background-color: transparent;
  109. border: 0;
  110. padding: 0;
  111. &:focus {
  112. outline: none;
  113. }
  114. &.item-name-button {
  115. color: inherit;
  116. width: 100%;
  117. overflow: hidden;
  118. text-overflow: ellipsis;
  119. text-align: left;
  120. padding-right: var(--spacing-09);
  121. white-space: pre;
  122. }
  123. }
  124. .entity-name {
  125. color: var(--file-tree-item-color);
  126. cursor: pointer;
  127. white-space: nowrap;
  128. overflow: hidden;
  129. text-overflow: ellipsis;
  130. &.entity-name-react {
  131. text-overflow: clip;
  132. }
  133. &:focus {
  134. outline: none;
  135. }
  136. background-color: transparent;
  137. @include fake-full-width-bg(transparent);
  138. &:hover {
  139. background-color: var(--file-tree-item-hover-bg);
  140. // When the entity is a subfolder, the DOM element is "indented" via margin-left. This makes the
  141. // element not fill the entire file-tree width (as it's spaced from the left-hand side via margin)
  142. // and, in consequence, the background gets clipped. The ::before pseudo-selector is used to fill
  143. // the empty space.
  144. @include fake-full-width-bg(var(--file-tree-item-hover-bg));
  145. }
  146. input {
  147. line-height: 1.6;
  148. }
  149. .entity-menu-toggle > .material-symbols {
  150. color: var(--content-primary-dark);
  151. vertical-align: middle;
  152. }
  153. }
  154. .material-symbols {
  155. color: var(--content-disabled);
  156. &.file-tree-icon {
  157. margin-right: var(--spacing-02);
  158. margin-left: var(--spacing-04);
  159. vertical-align: sub;
  160. &.linked-file-icon {
  161. position: relative;
  162. left: -2px;
  163. + .linked-file-highlight {
  164. color: inherit;
  165. position: relative;
  166. top: 4px;
  167. width: 0;
  168. left: -5px;
  169. font-size: 12px;
  170. }
  171. }
  172. }
  173. &.file-tree-folder-icon {
  174. margin-right: var(--spacing-02);
  175. vertical-align: sub;
  176. }
  177. &.file-tree-expand-icon {
  178. margin-left: var(--spacing-04);
  179. vertical-align: sub;
  180. }
  181. }
  182. .material-symbols.folder-open,
  183. .material-symbols.fa-folder {
  184. color: var(--content-disabled);
  185. }
  186. .material-symbols.toggle {
  187. width: 24px;
  188. padding: var(--spacing-03);
  189. font-size: var(--font-size-03);
  190. color: var(--content-disabled);
  191. }
  192. .file-tree-dropdown-toggle {
  193. display: flex;
  194. align-items: center;
  195. color: var(--content-primary-dark);
  196. line-height: 1.6;
  197. font-size: var(--font-size-05);
  198. padding: 0 var(--font-size-02) 0 var(--font-size-04);
  199. &:hover,
  200. &:focus {
  201. text-decoration: none;
  202. }
  203. &::before {
  204. content: '\00B7\00B7\00B7';
  205. transform: rotate(90deg);
  206. letter-spacing: 0.5px;
  207. }
  208. }
  209. &.multi-selected {
  210. > .entity {
  211. > .entity-name {
  212. > div > .material-symbols,
  213. > button > .material-symbols,
  214. > .material-symbols,
  215. .entity-menu-toggle .material-symbols {
  216. color: var(--content-primary-dark);
  217. }
  218. > .material-symbols.linked-file-highlight {
  219. color: var(--bg-info-01);
  220. }
  221. @include fake-full-width-bg(var(--bg-info-01));
  222. color: var(--content-primary-dark);
  223. font-weight: bold;
  224. background-color: var(--bg-info-01);
  225. &:hover {
  226. background-color: var(--bg-info-02);
  227. @include fake-full-width-bg(var(--bg-info-02));
  228. }
  229. }
  230. }
  231. }
  232. .menu-button {
  233. position: absolute;
  234. right: 0;
  235. top: 3px;
  236. }
  237. .rename-input {
  238. display: block;
  239. position: absolute;
  240. top: 1px;
  241. left: 32px;
  242. right: 32px;
  243. color: var(--content-primary);
  244. input {
  245. width: 100%;
  246. }
  247. }
  248. > .entity > .entity-name {
  249. .entity-menu-toggle {
  250. display: none;
  251. }
  252. }
  253. .entity-limit-hit {
  254. line-height: var(--file-tree-line-height);
  255. color: var(--file-tree-item-color);
  256. margin-left: var(--spacing-05);
  257. white-space: nowrap;
  258. overflow: hidden;
  259. text-overflow: ellipsis;
  260. }
  261. .entity-limit-hit-message {
  262. font-style: italic;
  263. }
  264. .material-symbols .entity-limit-hit-tooltip-trigger {
  265. margin-left: var(spacing-03);
  266. cursor: pointer;
  267. }
  268. }
  269. }
  270. &:not(.multi-selected) {
  271. ul.file-tree-list li.selected {
  272. > .entity {
  273. > .entity-name {
  274. background-color: var(--file-tree-item-selected-bg);
  275. color: var(--file-tree-item-selected-color);
  276. > div > .material-symbols,
  277. > button > .material-symbols,
  278. > .material-symbols,
  279. .entity-menu-toggle .material-symbols {
  280. color: var(--file-tree-item-selected-color);
  281. }
  282. > .material-symbols.linked-file-highlight {
  283. color: var(--bg-info-01);
  284. }
  285. @include fake-full-width-bg(var(--file-tree-item-selected-bg));
  286. font-weight: bold;
  287. padding-right: var(--spacing-09);
  288. .entity-menu-toggle {
  289. display: inline-block;
  290. background-color: transparent;
  291. box-shadow: none;
  292. border: 0;
  293. padding-right: var(--spacing-02);
  294. padding-left: var(--spacing-02);
  295. }
  296. }
  297. }
  298. }
  299. }
  300. // while dragging, the previously selected item gets no highlight
  301. ul.file-tree-list.file-tree-dragging li.selected .entity .entity-name {
  302. @include fake-full-width-bg(transparent);
  303. font-weight: normal;
  304. background-color: transparent;
  305. color: var(--file-tree-item-color);
  306. .material-symbols {
  307. color: var(--content-disabled) !important;
  308. }
  309. }
  310. // the items being dragged get the full "hover" colour
  311. ul.file-tree-list.file-tree-dragging
  312. li
  313. .entity.file-tree-entity-dragging
  314. .entity-name {
  315. background-color: fade(var(--file-tree-item-hover-bg), 90%);
  316. @include fake-full-width-bg(fade(var(--file-tree-item-hover-bg), 90%));
  317. color: var(--file-tree-item-color);
  318. .material-symbols {
  319. color: var(--content-disabled) !important;
  320. }
  321. }
  322. // the drop target gets the "selected" colour
  323. ul.file-tree-list.file-tree-dragging
  324. li.dnd-droppable-hover
  325. .entity
  326. .entity-name {
  327. background-color: var(--file-tree-item-selected-bg);
  328. @include fake-full-width-bg(var(--file-tree-item-selected-bg));
  329. color: var(--file-tree-item-selected-color);
  330. .material-symbols {
  331. color: var(--file-tree-item-selected-color) !important;
  332. }
  333. }
  334. .dnd-draggable-preview-layer {
  335. position: absolute;
  336. pointer-events: none;
  337. z-index: 100;
  338. width: 100%;
  339. height: 100%;
  340. overflow: hidden;
  341. &.dnd-droppable-hover {
  342. border: 3px solid var(--file-tree-item-selected-bg);
  343. }
  344. }
  345. .dnd-draggable-preview-item {
  346. color: var(--file-tree-item-selected-color);
  347. background-color: fade(var(--file-tree-item-selected-bg), 60%);
  348. width: 75%;
  349. padding-left: var(--spacing-08);
  350. line-height: 2.05;
  351. overflow: hidden;
  352. text-overflow: ellipsis;
  353. white-space: nowrap;
  354. }
  355. .disconnected-overlay {
  356. background-color: var(--file-tree-bg);
  357. position: absolute;
  358. top: 0;
  359. left: 0;
  360. width: 100%;
  361. height: 100%;
  362. z-index: 10;
  363. opacity: 0.5;
  364. cursor: wait;
  365. }
  366. }
  367. .modal-new-file {
  368. padding: 0;
  369. table {
  370. width: 100%;
  371. table-layout: fixed;
  372. td {
  373. vertical-align: top;
  374. }
  375. }
  376. .toggle-file-type-button {
  377. font-size: 80%;
  378. margin-top: calc(var(--spacing-05) * -1);
  379. .btn {
  380. display: inline-block;
  381. padding: 0;
  382. vertical-align: baseline;
  383. font-size: inherit;
  384. }
  385. .btn:focus-within {
  386. outline: none;
  387. text-decoration: none;
  388. }
  389. }
  390. }
  391. .modal-new-file-list {
  392. background-color: var(--bg-light-secondary);
  393. width: 220px;
  394. ul {
  395. li {
  396. /* old modal (a) */
  397. a {
  398. color: var(--content-secondary);
  399. padding: var(--spacing-03);
  400. display: block;
  401. text-decoration: none;
  402. }
  403. /* new modal (button) */
  404. .btn {
  405. color: var(--content-secondary);
  406. padding: var(--spacing-03);
  407. }
  408. .btn:hover {
  409. text-decoration: none;
  410. }
  411. .btn:focus {
  412. outline: none;
  413. text-decoration: none;
  414. background-color: white;
  415. }
  416. }
  417. li.active {
  418. background-color: white;
  419. /* old modal (a) */
  420. a {
  421. color: var(--link-ui);
  422. }
  423. /* new modal (button) */
  424. .btn {
  425. color: var(--link-ui);
  426. text-decoration: none;
  427. }
  428. }
  429. li:hover {
  430. background-color: white;
  431. }
  432. }
  433. }
  434. .file-tree-error {
  435. text-align: center;
  436. color: var(--content-secondary-dark);
  437. padding: 20px;
  438. }
  439. .file-tree-modal-alert {
  440. margin-top: var(--spacing-06);
  441. }
  442. .btn.modal-new-file-mode {
  443. justify-content: left;
  444. text-align: left;
  445. text-decoration: none;
  446. width: 100%;
  447. }
  448. .modal-new-file-body {
  449. padding: 20px;
  450. padding-top: var(--spacing-03);
  451. }
  452. .modal-new-file-body-upload {
  453. padding-top: 20px;
  454. }
  455. .modal-new-file-body-conflict {
  456. background-color: var(--bg-danger-03);
  457. border: 1px dashed var(--border-danger);
  458. min-height: 400px;
  459. border-radius: 3px;
  460. color: var(--content-primary);
  461. display: flex;
  462. flex-direction: column;
  463. justify-content: center;
  464. padding: var(--spacing-05);
  465. }
  466. .modal-footer {
  467. .approaching-file-limit {
  468. font-weight: bold;
  469. }
  470. .at-file-limit {
  471. text-align: left;
  472. }
  473. }
  474. /* stylelint-disable selector-class-pattern */
  475. .modal-new-file-body-upload .uppy-Root {
  476. font-family: inherit;
  477. }
  478. .modal-new-file-body-upload .uppy-Dashboard {
  479. .uppy-Dashboard-inner {
  480. border: none;
  481. }
  482. .uppy-Dashboard-dropFilesHereHint {
  483. inset: 0;
  484. }
  485. .uppy-Dashboard-AddFiles {
  486. margin: 0;
  487. border: 1px dashed var(--border-primary);
  488. height: 100%;
  489. .uppy-Dashboard-AddFiles-title {
  490. font-size: inherit;
  491. }
  492. }
  493. .uppy-Dashboard-AddFiles-title {
  494. width: 26em; // sized to create a wrap between the sentences
  495. max-width: 100%;
  496. }
  497. }