ZDDC/shared/context-menu.css
ZDDC 94b2e29448 feat(browse): SPA overhaul — context menu, YAML editor, icons, hovercard, deep links, autofilter
Major upgrade to the browse tool's UX, plus a few shared modules other
tools can adopt.

User-facing:
- Right-click context menu on tree rows AND empty pane space. Traditional
  file-manager grouping (Open / Download / New / Rename-Delete / Copy /
  Tree ops / View). Items stay visible but disabled when not applicable
  so muscle memory carries. Generic shared/context-menu.js framework
  supports normal items, toggles, submenus, separators, danger styling.
- YAML editor for .yaml / .yml / .zddc files (CodeMirror 5 vendored at
  shared/vendor/codemirror-yaml.min.*). js-yaml lint on every change
  for parse errors. For .zddc cascade files, an additional schema-aware
  lint pass flags unknown keys, bad enum values, and wrong types.
- Per-row drag-drop upload using webkitGetAsEntry (folder uploads work
  recursively). Per-row drop indicator; doc-level overlay still fires
  for blank-space drops at drop_target scopes.
- New folder / New markdown file context-menu items (server mode).
  Rename + Delete with native confirm() dialog. File-API helpers
  removeNode / renameNode use the existing PUT/POST/DELETE endpoints.
- Hover info card with the row's full metadata (ZDDC fields + filesystem
  info + path/URL). Interactive — mouse into it, drag-select text,
  Ctrl/Cmd-C or right-click → Copy. 200ms grace before dismiss.
- Autofilter input at the top of the tree pane. Same grammar as
  archive's column filters (zddc.filter.parse / matches). Filters
  files; folders without matches collapse out. Non-matching folders
  force-open visually when descendants match, without mutating the
  user's actual expand state.
- Two-line ZDDC label: title-first, tracking/rev/status as monospace
  meta below. Icon column anchors to the title line. Chevron is a
  Lucide outline `chevron-right` SVG, rotated 90° on `.expanded`.
- File-type Lucide icon sprite (shared/icons.js — 16 outline glyphs,
  ~5 KB). PDF / Word / Spreadsheet / Slides / Image / Video / Audio /
  CAD / Web / Config / Code / Archive get distinct icons; folders
  tinted with --primary.
- Header wraps gracefully at narrow viewports (shared/base.css
  flex-wrap + title min-width:0 ellipsis). Body becomes flex column
  in browse so a wrapping header doesn't break #appMain height.
- Markdown editor opens in WYSIWYG mode by default. YAML front-matter
  + TOC sidebar reworked: flexbox layout (single visible resizer
  between FM and TOC), both bodies overflow:auto for X+Y scrollbars.
- `?file=<path>` deep links open browse pre-positioned at a specific
  file. Multi-segment paths walk into subdirectories on the way.
  Auto-flips Show hidden when a segment is dot/underscore-prefixed.
- Refresh + show-hidden toggle preserve expansion / selection /
  preview pinning. Path-keyed snapshot survives a re-fetched listing.
- "Add Local Directory" → "Use Local Directory" across the four tools
  that have it (browse, archive, classifier, +transmittal comment).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 12:12:42 -05:00

109 lines
2.4 KiB
CSS

/* shared/context-menu.css — generic styles for window.zddc.menu.
Mirrors the look-and-feel of native context menus: tight rows,
five-column grid (check | icon | label | accel | arrow), subtle
border + shadow, hover background from the shared --bg-hover token,
danger items tinted with --danger. */
.zddc-menu {
position: fixed;
z-index: 10000;
min-width: 12rem;
max-width: 22rem;
padding: 0.25rem 0;
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18),
0 2px 6px rgba(0, 0, 0, 0.10);
font-family: var(--font);
font-size: 0.85rem;
line-height: 1.2;
user-select: none;
/* Allow focus styles inside without leaking to the menu itself. */
outline: none;
}
.zddc-menu__sep {
height: 1px;
margin: 0.25rem 0;
background: var(--border);
}
.zddc-menu__item {
display: grid;
grid-template-columns: 1.1rem 1.25rem 1fr auto 0.9rem;
align-items: center;
gap: 0.35rem;
padding: 0.3rem 0.7rem;
cursor: pointer;
color: var(--text);
/* Suppress the focus ring on the row itself — hover/focus
background handles the cue. */
outline: none;
}
.zddc-menu__item:hover,
.zddc-menu__item:focus,
.zddc-menu__item:focus-visible {
background: var(--bg-hover);
}
.zddc-menu__item.is-disabled {
color: var(--text-muted);
cursor: default;
}
.zddc-menu__item.is-disabled:hover,
.zddc-menu__item.is-disabled:focus {
background: transparent;
}
.zddc-menu__item--danger {
color: var(--danger);
}
.zddc-menu__item--danger:hover,
.zddc-menu__item--danger:focus {
background: var(--danger);
color: var(--text-light);
}
.zddc-menu__check {
font-size: 0.9rem;
text-align: center;
color: var(--primary);
}
.zddc-menu__icon {
font-size: 0.95rem;
text-align: center;
}
.zddc-menu__label {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.zddc-menu__accel {
color: var(--text-muted);
font-size: 0.78rem;
font-variant-numeric: tabular-nums;
padding-left: 0.5rem;
}
.zddc-menu__item--danger .zddc-menu__accel {
color: inherit;
opacity: 0.85;
}
.zddc-menu__arrow {
color: var(--text-muted);
font-size: 0.7rem;
text-align: center;
}
.zddc-menu__item--has-sub .zddc-menu__arrow {
color: var(--text);
}