Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

2.4 KB
Raw Blame
/**
 * The graph surface. The canvas is sized by the derived layout and centred in the scroll area, so
 * the chain stays put as steps are added or removed.
 */

.portal-graph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1rem;
  /* Grows with the chain up to whatever the page gives it, then scrolls rather than pushing the
     inspector out of reach. A short chain still hugs its content, so there is no empty canvas. */
  max-height: 100%;
  overflow: auto;
  /* The canvas must sit below the node cards on the surface ladder so they read as raised off it in
     both themes. --c-surface-sunken is the only rung darker than --c-surface in light *and* dark;
     the legacy --color-bg-subtle collapsed into the page in dark, and --c-bg-raised is lighter than
     the cards in light. */
  background: var(--c-surface-sunken);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--radius-nav);
}

/* Sits beside the wire it is describing. Absolute, so appearing mid-drag moves nothing. */
.portal-graph__drag-hint {
  position: absolute;
  margin: 0;
  /* `left` is the column centre; clear the wire's hit area before the text starts. */
  transform: translate(1.75rem, -50%);
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--c-accent-fg, var(--c-primary));
  pointer-events: none;
}

/* transform has no logical form, so mirror it by hand: in RTL the hint clears the wire on the other
   side rather than reaching back across it onto the chain. */
[dir="rtl"] .portal-graph__drag-hint {
  transform: translate(-1.75rem, -50%);
}

/* What follows the cursor when several steps are dragged at once: a copy of each card, stacked, so
   the drag shows what is actually moving rather than only the card that was grabbed. Cloned nodes
   keep their own styling; they are inert copies, hence no pointer events. */
.portal-graph__drag-preview {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  pointer-events: none;
}

.portal-graph__drag-preview .portal-graph-node {
  opacity: 0.9;
}

.portal-graph__canvas {
  position: relative;
  flex: none;
}

/* Nodes are placed by the layout; the slot carries the position, the card fills it. */
.portal-graph__slot {
  position: absolute;
  display: flex;
}

.portal-graph__slot > * {
  flex: 1;
  min-width: 0;
}

.portal-graph__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--c-text-subtle);
  text-align: center;
}