DriftBanner.svelte 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!--
  2. "This file changed on disk after the last index sync."
  3. One block, said the same way on every screen that can say it (design spec:
  4. paper-2 fill, hairline rule, ⚠ in ink-3, 12.5px ink-2). Deliberately NOT
  5. amber: amber is the untested badge's colour and nothing else's, and a warning
  6. that borrows it makes two unrelated things look like the same kind of problem.
  7. Deliberately not a modal either — the screen underneath is still mostly true,
  8. and interrupting to say so would be the overclaim.
  9. The caller supplies the tail of the sentence, because what follows the dash is
  10. the only part that differs: what this particular screen did about it.
  11. -->
  12. <script lang="ts">
  13. import type { Snippet } from 'svelte';
  14. interface Props {
  15. /** Project-relative path, shown in mono. */
  16. file: string;
  17. /** The rest of the sentence: what this screen is showing instead. */
  18. children: Snippet;
  19. }
  20. let { file, children }: Props = $props();
  21. </script>
  22. <div class="drift" role="status">
  23. <span class="glyph" aria-hidden="true">⚠</span>
  24. <span class="body"><code>{file}</code> changed on disk after the last index sync — {@render children()}</span>
  25. </div>
  26. <style>
  27. .drift {
  28. display: grid;
  29. grid-template-columns: 16px 1fr;
  30. gap: 6px;
  31. align-items: start;
  32. padding: 8px 12px;
  33. border: 1px solid var(--rule-soft);
  34. background: var(--paper-2);
  35. color: var(--ink-2);
  36. font-size: 12.5px;
  37. line-height: 1.5;
  38. }
  39. .glyph {
  40. color: var(--ink-3);
  41. font-size: 12px;
  42. line-height: 1.55;
  43. }
  44. .body :global(code) {
  45. font-family: var(--mono);
  46. font-size: 12px;
  47. color: var(--ink);
  48. }
  49. .body :global(button) {
  50. background: none;
  51. border: 0;
  52. padding: 0;
  53. color: var(--accent);
  54. font: inherit;
  55. cursor: pointer;
  56. text-decoration: underline;
  57. text-decoration-color: var(--accent-line);
  58. text-underline-offset: 3px;
  59. }
  60. .body :global(a) {
  61. color: var(--accent);
  62. text-decoration: underline;
  63. text-decoration-color: var(--accent-line);
  64. text-underline-offset: 3px;
  65. }
  66. </style>