Files
Docwell/Packages/editor/src/editor.css
T
tajniak81andClaude Opus 5.5 84043ba05b Add date mentions with reminders
- "@today", "@friday", "@2026-12-01" insert a date; "@remind friday"
  or the date's popover adds a reminder for the person who set it.
- docwell-server keeps a reminders row per person, date and time zone
  in step with each page and sends a "reminder" notification at 9:00
  on the day in that time zone (job notify.reminders). Dates already
  past when added do not notify.
- Exports write dates out; the web and phone inboxes show reminders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:55:46 +01:00

716 lines
16 KiB
CSS

/* SPDX-License-Identifier: AGPL-3.0-or-later */
@import "katex/dist/katex.min.css";
/* Tailwind classes used by the editor's own components (menus, find bar). */
@source "./";
/* Document styles for the Docwell editor, from the design system's Document
type scale. Uses tokens from @docwell/ui/theme.css. */
.dw-prose {
outline: none;
font-family: var(--font-sans);
font-size: var(--text-doc-body);
line-height: var(--text-doc-body--line-height);
color: var(--color-ink);
min-height: 12rem;
}
/* Paragraph blocks sit space-2 apart; a heading gets space-5 above it. */
.dw-prose > * + * {
margin-top: 8px;
}
.dw-prose > :is(h1, h2, h3) {
margin-top: 20px;
}
.dw-prose h1 {
font-family: var(--font-serif);
font-size: var(--text-doc-h1);
line-height: var(--text-doc-h1--line-height);
font-weight: 600;
}
.dw-prose h2 {
font-family: var(--font-serif);
font-size: var(--text-doc-h2);
line-height: var(--text-doc-h2--line-height);
font-weight: 600;
}
.dw-prose h3 {
font-size: var(--text-doc-h3);
line-height: var(--text-doc-h3--line-height);
font-weight: 600;
}
.dw-prose ul {
list-style: disc;
padding-left: 1.5rem;
}
.dw-prose ol {
list-style: decimal;
padding-left: 1.5rem;
}
.dw-prose a {
color: var(--color-accent);
text-decoration: underline;
text-underline-offset: 2px;
}
.dw-prose blockquote {
border-left: 3px solid var(--color-line);
padding-left: 1rem;
color: var(--color-ink-muted);
}
.dw-prose code {
font-family: var(--font-mono);
font-size: 0.9em;
background: var(--color-code-bg);
padding: 0.1em 0.3em;
border-radius: var(--radius-xs);
}
.dw-prose pre {
font-family: var(--font-mono);
font-size: var(--text-code);
line-height: var(--text-code--line-height);
background: var(--color-code-bg);
padding: 12px 16px;
border-radius: var(--radius-md);
overflow-x: auto;
}
.dw-prose pre code {
background: none;
padding: 0;
font-size: inherit;
}
.dw-prose hr {
border: none;
border-top: 1px solid var(--color-line);
margin: 24px 0;
}
.dw-prose ::selection {
background: var(--color-selection);
}
.dw-prose p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
color: var(--color-ink-faint);
float: left;
height: 0;
pointer-events: none;
}
.dw-prose img {
display: block;
max-width: 100%;
height: auto;
border-radius: var(--radius-md);
}
.dw-prose img.ProseMirror-selectednode,
.dw-prose .dw-file.ProseMirror-selectednode,
.dw-prose .ProseMirror-selectednode:is(.dw-mermaid, .dw-diagram, .dw-toc, .tiptap-mathematics-render) {
outline: 2px solid var(--color-focus-ring);
outline-offset: 2px;
}
/* A non-image attachment: a one-line download card. */
.dw-prose .dw-file {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
font-family: var(--font-sans);
font-size: var(--text-ui-md);
}
.dw-prose .dw-file__name {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dw-prose .dw-file__size {
color: var(--color-ink-muted);
font-size: var(--text-ui-sm);
}
/* Other editors' carets (CollaborationCaret's default render). */
.dw-prose .collaboration-carets__caret {
position: relative;
margin-left: -1px;
margin-right: -1px;
border-left: 1px solid;
border-right: 1px solid;
word-break: normal;
pointer-events: none;
}
.dw-prose .collaboration-carets__label {
position: absolute;
top: -1.4em;
left: -1px;
padding: 0.1rem 0.3rem;
border-radius: var(--radius-xs) var(--radius-xs) var(--radius-xs) 0;
font-family: var(--font-sans);
font-size: 12px;
font-weight: 600;
line-height: normal;
color: #fff;
white-space: nowrap;
user-select: none;
}
/* "@" mentions. */
.dw-prose .dw-mention {
border-radius: var(--radius-xs);
background: var(--color-accent-soft);
padding: 0 0.15em;
font-weight: 500;
white-space: nowrap;
}
/* Dates in the text; a reminder shows a bell, and one whose day has passed is muted. */
.dw-prose .dw-date {
display: inline-flex;
align-items: center;
gap: 0.2em;
border-radius: var(--radius-xs);
background: var(--color-surface-hover);
padding: 0 0.25em;
font-weight: 500;
white-space: nowrap;
cursor: default;
}
.dw-prose .dw-date svg {
flex-shrink: 0;
color: var(--color-ink-muted);
}
.dw-prose .dw-date.is-reminder {
background: var(--color-accent-soft);
}
.dw-prose .dw-date.is-past {
color: var(--color-ink-muted);
text-decoration: line-through;
}
.dw-prose[contenteditable="true"] .dw-date {
cursor: pointer;
}
.dw-date-pop {
position: fixed;
z-index: 60;
left: 0;
top: 0;
display: flex;
flex-direction: column;
gap: 8px;
width: 16rem;
max-width: calc(100vw - 16px);
padding: 10px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
box-shadow: var(--shadow-menu);
font-family: var(--font-sans);
font-size: var(--text-ui-sm);
color: var(--color-ink);
}
.dw-date-pop__check {
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
cursor: pointer;
}
.dw-date-pop__note {
margin: 0;
color: var(--color-ink-muted);
font-size: var(--text-ui-xs);
}
/* Commented text; the active comment's text stands out more. */
.dw-prose .dw-comment {
background: color-mix(in srgb, var(--color-warning-soft) 70%, transparent);
border-bottom: 2px solid color-mix(in srgb, var(--color-warning) 55%, transparent);
cursor: pointer;
}
.dw-prose .dw-comment.is-active {
background: var(--color-warning-soft);
border-bottom-color: var(--color-warning);
}
/* The "/" and "@" popups (suggestion.ts): the design system's slash menu,
drawn without a framework so every host can show it. */
.dw-suggest {
position: fixed;
z-index: 60;
left: 0;
top: 0;
width: 20rem;
max-width: calc(100vw - 16px);
max-height: 22rem;
overflow-y: auto;
padding: 4px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
box-shadow: var(--dw-shadow-menu);
font-family: var(--font-sans);
}
.dw-suggest__query {
padding: 8px 8px 4px;
font-family: var(--font-mono);
font-size: var(--text-ui-xs);
color: var(--color-ink-muted);
}
.dw-suggest__empty {
padding: 6px 8px;
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
.dw-suggest__item {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 8px;
border-radius: var(--radius-sm);
cursor: pointer;
}
.dw-suggest__item.is-active {
background: var(--color-surface-hover);
}
.dw-suggest__icon {
display: grid;
place-items: center;
flex-shrink: 0;
width: 36px;
height: 36px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink-muted);
}
.dw-suggest__text {
display: flex;
flex-direction: column;
min-width: 0;
}
.dw-suggest__label {
font-size: var(--text-ui-md);
font-weight: 500;
color: var(--color-ink);
}
.dw-suggest__desc {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: var(--text-ui-xs);
color: var(--color-ink-muted);
}
/* ---- Math (KaTeX) ---- */
.dw-prose .tiptap-mathematics-render {
cursor: default;
}
.dw-prose.ProseMirror[contenteditable="true"] .tiptap-mathematics-render {
cursor: pointer;
border-radius: var(--radius-xs);
}
.dw-prose.ProseMirror[contenteditable="true"] .tiptap-mathematics-render:hover {
background: var(--color-surface-hover);
}
.dw-prose [data-type="block-math"] {
display: block;
text-align: center;
padding: 8px 0;
overflow-x: auto;
}
/* ---- Mermaid ---- */
.dw-prose .dw-mermaid {
padding: 12px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
overflow-x: auto;
text-align: center;
}
.dw-prose.ProseMirror[contenteditable="true"] .dw-mermaid {
cursor: pointer;
}
.dw-prose .dw-mermaid svg {
max-width: 100%;
height: auto;
margin: 0 auto;
}
.dw-prose .dw-mermaid__source {
margin: 0;
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
text-align: left;
white-space: pre-wrap;
}
.dw-prose .dw-mermaid__body--error {
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
color: var(--color-danger);
text-align: left;
white-space: pre-wrap;
}
/* ---- Draw.io and Excalidraw drawings ---- */
.dw-prose .dw-diagram {
position: relative;
margin: 0;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: #fff;
overflow: hidden;
}
.dw-prose .dw-diagram__img {
display: block;
max-width: 100%;
margin: 0 auto;
border-radius: 0;
}
.dw-prose .dw-diagram__empty {
margin: 0;
padding: 32px 16px;
text-align: center;
font-family: var(--font-sans);
font-size: var(--text-ui-md);
color: var(--color-ink-muted);
background: var(--color-surface-raised);
cursor: pointer;
}
.dw-prose .dw-diagram__edit {
position: absolute;
top: 8px;
right: 8px;
padding: 2px 10px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface-raised);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-sm);
cursor: pointer;
opacity: 0;
transition: opacity 0.15s;
}
.dw-prose .dw-diagram:hover .dw-diagram__edit,
.dw-prose .dw-diagram__edit:focus-visible {
opacity: 1;
}
@media (hover: none) {
.dw-prose .dw-diagram__edit {
opacity: 1;
}
}
/* The full-screen layer for the Draw.io or Excalidraw editor. */
.dw-diagram-editor {
position: fixed;
inset: 0;
z-index: 100;
display: flex;
flex-direction: column;
background: var(--color-surface);
}
.dw-diagram-editor__frame {
flex: 1;
width: 100%;
border: 0;
}
.dw-diagram-editor__bar {
display: flex;
justify-content: flex-end;
gap: 8px;
padding: 8px 12px;
border-bottom: 1px solid var(--color-line);
}
.dw-diagram-editor__canvas {
flex: 1;
min-height: 0;
}
.dw-diagram-editor__status {
padding: 8px 12px;
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
/* ---- Table of contents ---- */
.dw-prose .dw-toc {
padding: 12px 16px;
border-left: 3px solid var(--color-line);
font-family: var(--font-sans);
font-size: var(--text-ui-md);
}
.dw-prose .dw-toc__title {
margin: 0 0 4px;
font-size: var(--text-ui-xs);
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--color-ink-muted);
}
.dw-prose .dw-toc__list {
list-style: none;
padding: 0;
margin: 0;
}
.dw-prose .dw-toc__list a {
color: var(--color-ink-muted);
text-decoration: none;
}
.dw-prose .dw-toc__list a:hover {
color: var(--color-ink);
text-decoration: underline;
}
.dw-prose .dw-toc__empty {
color: var(--color-ink-faint);
}
/* ---- Toggles ---- */
.dw-prose .dw-toggle {
display: flex;
gap: 4px;
align-items: flex-start;
}
.dw-prose .dw-toggle > button {
flex: none;
display: grid;
place-items: center;
width: 24px;
height: calc(var(--text-doc-body--line-height) * 1em);
border: none;
border-radius: var(--radius-xs);
background: none;
color: var(--color-ink-muted);
cursor: pointer;
}
.dw-prose .dw-toggle > button:hover {
background: var(--color-surface-hover);
color: var(--color-ink);
}
.dw-prose .dw-toggle > button::before {
content: "";
width: 0;
height: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 7px solid currentColor;
transition: transform 0.12s ease;
}
.dw-prose .dw-toggle.is-open > button::before {
transform: rotate(90deg);
}
.dw-prose .dw-toggle > div {
flex: 1;
min-width: 0;
}
.dw-prose .dw-toggle summary {
display: block;
list-style: none;
font-weight: 600;
}
.dw-prose .dw-toggle summary::-webkit-details-marker {
display: none;
}
.dw-prose .dw-toggle [data-type="detailsContent"] > * + * {
margin-top: 8px;
}
.dw-prose .dw-toggle [data-type="detailsContent"] {
margin-top: 4px;
}
.dw-prose .dw-toggle [data-type="detailsContent"][hidden] {
display: none;
}
/* ---- Embeds and link cards ---- */
.dw-prose .dw-embed {
margin: 0;
}
.dw-prose .dw-embed__frame {
display: block;
width: 100%;
aspect-ratio: 16 / 9;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-sunken);
}
.dw-prose .dw-embed[data-ratio="audio"] .dw-embed__frame {
aspect-ratio: auto;
height: 152px;
}
.dw-prose .dw-embed[data-ratio="tall"] .dw-embed__frame {
aspect-ratio: 4 / 5;
max-height: 80vh;
}
.dw-prose .dw-embed__caption {
margin-top: 4px;
font-family: var(--font-sans);
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
}
.dw-prose .dw-embed__caption a {
color: inherit;
}
.dw-prose .dw-linkcard {
display: flex;
align-items: stretch;
gap: 12px;
overflow: hidden;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
color: var(--color-ink);
text-decoration: none;
font-family: var(--font-sans);
}
.dw-prose .dw-linkcard:hover {
background: var(--color-surface-hover);
}
.dw-prose .dw-linkcard__text {
display: flex;
flex: 1;
min-width: 0;
flex-direction: column;
gap: 2px;
padding: 10px 14px;
}
.dw-prose .dw-linkcard__title {
font-size: var(--text-ui-md);
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dw-prose .dw-linkcard__desc {
font-size: var(--text-ui-sm);
color: var(--color-ink-muted);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.dw-prose .dw-linkcard__site {
font-size: var(--text-ui-xs);
color: var(--color-ink-faint);
}
.dw-prose .dw-linkcard__image {
flex: none;
width: 30%;
max-width: 200px;
max-height: 120px;
object-fit: cover;
}
.dw-prose .ProseMirror-selectednode:is(.dw-embed, .dw-linkcard) {
outline: 2px solid var(--color-focus-ring);
outline-offset: 2px;
border-radius: var(--radius-md);
}
/* ---- Block links ---- */
.dw-block-host {
position: relative;
}
.dw-block-handle {
position: absolute;
left: -30px;
display: grid;
place-items: center;
width: 22px;
height: 22px;
border: none;
border-radius: var(--radius-xs);
background: none;
color: var(--color-ink-faint);
cursor: pointer;
}
.dw-block-handle:hover {
background: var(--color-surface-hover);
color: var(--color-ink);
}
/* Phones have no margin to spare and no hover. */
@media (max-width: 640px), (hover: none) {
.dw-block-handle {
display: none;
}
}
/* ---- The floating source editor (math, Mermaid) ---- */
.dw-source {
position: absolute;
z-index: 60;
width: min(32rem, calc(100vw - 16px));
padding: 8px;
border: 1px solid var(--color-line);
border-radius: var(--radius-md);
background: var(--color-surface-raised);
box-shadow: var(--dw-shadow-menu);
}
.dw-source__field {
display: block;
width: 100%;
padding: 6px 8px;
border: 1px solid var(--color-line-strong);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-md);
resize: vertical;
}
.dw-source__field--mono {
font-family: var(--font-mono);
font-size: var(--text-ui-sm);
}
.dw-source__field:focus {
outline: 2px solid var(--color-focus-ring);
outline-offset: 1px;
}
.dw-source__actions {
display: flex;
gap: 6px;
margin-top: 8px;
}
.dw-source__btn {
padding: 3px 10px;
border: 1px solid var(--color-line);
border-radius: var(--radius-sm);
background: var(--color-surface);
color: var(--color-ink);
font: inherit;
font-size: var(--text-ui-sm);
cursor: pointer;
}
.dw-source__btn:hover {
background: var(--color-surface-hover);
}
.dw-source__btn--primary {
border-color: var(--color-primary);
background: var(--color-primary);
color: var(--color-on-primary);
}
.dw-source__btn--primary:hover {
background: var(--color-primary-hover);
}
.dw-source__btn--danger {
color: var(--color-danger);
}
/* Find in page: every match, and the one the bar is on. */
.dw-prose .dw-find {
background: color-mix(in srgb, var(--color-accent) 22%, transparent);
border-radius: 2px;
}
.dw-prose .dw-find-current {
background: color-mix(in srgb, var(--color-accent) 50%, transparent);
outline: 1px solid var(--color-accent);
}
/* The page's body font, chosen per page; headings follow it too. */
.dw-font-serif .dw-prose,
.dw-font-serif .dw-prose :is(h1, h2, h3) {
font-family: var(--font-serif);
}
.dw-font-mono .dw-prose,
.dw-font-mono .dw-prose :is(h1, h2, h3) {
font-family: var(--font-mono);
}