Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

3.6 KB
Raw Blame
/* SPDX-License-Identifier: MIT
   Copyright (c) 2026 The Bento authors
   The Cell section of the properties panel — the controls panels.css has no
   shape for, and nothing else. Everything that CAN be a `.dp-row` is one: two
   stylesheets describing the same row is how a panel starts to look like two
   panels.

   THE CORNERS COME FROM panels.css, not from the app's --radius: --dp-radius
   is declared on `.dp-panel`, so a control here uses the same number the field
   above it does, by construction rather than by copying. */

/* ————— the number-format sample —————
   A value, printed the way the chosen format prints it. It is an ANSWER, not a
   control, so it draws no box: the bordered "Shows as" field it replaces read
   as a third format control beside the preset and the pattern. Monospace-
   tabular, so changing the decimals moves the digits you are looking at rather
   than the whole string. */
.dc-sample {
  min-width: 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* the cell is empty, so this is an EXAMPLE — it must not read as the cell's value */
.dc-sample-eg { color: var(--muted); font-style: italic; }

/* ————— colour, with an off state —————
   `<input type="color">` always holds a colour, so "no colour" cannot be said
   by the swatch — it used to paint its FALLBACK (a grey ink, a cream fill) at
   40% under a faint slash, and an unformatted cell read as formatted in review.
   So an unset well is EMPTY: the swatch is painted transparent and the well
   shows only the field's own fill, struck through. The × is the off switch. */
.dc-colour {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;                          /* the control column */
  min-width: 0;
}
/* The box is THE FIELD's colour well (styles.css); this only sizes. */
.dc-colour input[type='color'] {
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}
.dc-colour input[type='color']:disabled { cursor: default; opacity: 0.5; }

/* Not set: an EMPTY well. `!important` because the engine paints the swatch
   from the input's value with a style of its own, and only an important author
   declaration outranks it. */
.dc-colour-off input[type='color'] {
  /* an IMAGE over the field's own fill: the `background` shorthand would
     reset the fill to transparent along with drawing the strike */
  background-image:
    linear-gradient(to top right,
      transparent calc(50% - 0.75px), var(--muted) 50%, transparent calc(50% + 0.75px));
}
.dc-colour-off input[type='color']::-webkit-color-swatch {
  background: transparent !important;
  border-color: transparent;
}
.dc-colour-off input[type='color']::-moz-color-swatch {
  background: transparent !important;
  border-color: transparent;
}

.dc-clear {
  flex: none;
  width: 20px;
  height: var(--dp-row, 26px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--dp-radius);
  background: var(--surface);
  color: var(--muted);
  font: 13px/1 inherit;
  cursor: pointer;
}
.dc-clear:hover:not(:disabled) { color: var(--ink); border-color: var(--line-strong); }
.dc-clear:disabled { opacity: 0.35; cursor: default; }

/* The currency symbol is one or two glyphs; the full control width for `£`
   reads as a field that wants a sentence. It narrows from the START of the
   control column, so its left edge is still the panel's one control line —
   a narrow field that shrank from the right would break the column it is
   trying to sit politely inside. */
.dp-row input.dp-narrow { width: 56px; justify-self: start; }