sofie-engine 0.4.0

Screens: the template parser and renderer, and the component catalog.
Documentation
/* The framework's stylesheet: plain, readable defaults for catalog components. */
:root {
  color-scheme: light dark;
  --sofie-text: #1f2328;
  --sofie-muted: #59636e;
  --sofie-background: #ffffff;
  --sofie-surface: #f6f8fa;
  --sofie-border: #d1d9e0;
  --sofie-accent: #0969da;
  --sofie-accent-text: #ffffff;
  --sofie-danger: #cf222e;
  --sofie-danger-surface: #ffebe9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sofie-text: #e6edf3;
    --sofie-muted: #9198a1;
    --sofie-background: #0d1117;
    --sofie-surface: #151b23;
    --sofie-border: #3d444d;
    --sofie-accent: #4493f8;
    --sofie-accent-text: #0d1117;
    --sofie-danger: #f85149;
    --sofie-danger-surface: #25171c;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 72rem;
  padding: 1.5rem 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--sofie-text);
  background: var(--sofie-background);
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--sofie-accent);
}

section {
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--sofie-border);
}

th {
  font-weight: 600;
  background: var(--sofie-surface);
}

tbody tr:nth-child(even) {
  background: var(--sofie-surface);
}

.sofie-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.sofie-money {
  text-align: right;
}

td.sofie-actions {
  text-align: right;
  white-space: nowrap;
}

.sofie-actions > * + * {
  margin-left: 0.5rem;
}

.sofie-empty td {
  padding: 1.5rem 0.75rem;
  text-align: center;
  color: var(--sofie-muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 32rem;
  margin-bottom: 2rem;
}

form > button {
  align-self: flex-start;
}

.sofie-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sofie-field label {
  font-weight: 600;
}

.sofie-field input, .sofie-field select, .sofie-field textarea {
  font: inherit;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--sofie-border);
  border-radius: 0.375rem;
  color: var(--sofie-text);
  background: var(--sofie-background);
}

.sofie-field textarea {
  min-height: 6rem;
  resize: vertical;
}

.sofie-field input[type="checkbox"] {
  align-self: flex-start;
  width: 1.125rem;
  height: 1.125rem;
}

.sofie-field :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--sofie-accent);
  outline-offset: 1px;
}

.sofie-money-input,
.sofie-percentage-input,
.sofie-parts {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sofie-money-input input,
.sofie-percentage-input input {
  flex: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sofie-currency,
.sofie-unit {
  color: var(--sofie-muted);
}

/* The slot stays in the accessibility tree while empty, so a message put
   in it is announced. */
.sofie-field-error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--sofie-danger);
}

.sofie-field:has(.sofie-field-error:not(:empty)) :is(input, select, textarea),
.sofie-field [aria-invalid="true"] {
  border-color: var(--sofie-danger);
  background: var(--sofie-danger-surface);
}

button {
  font: inherit;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--sofie-accent);
  border-radius: 0.375rem;
  color: var(--sofie-accent-text);
  background: var(--sofie-accent);
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--sofie-accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#sofie-notice:not(:empty) {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--sofie-danger);
  border-radius: 0.375rem;
  background: var(--sofie-danger-surface);
}

#sofie-notice p {
  margin: 0;
}

.sofie-badge {
  display: inline-block;
  padding: 0 0.5rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--sofie-border);
  background: var(--sofie-surface);
}

.sofie-tone-info { border-color: var(--sofie-accent); color: var(--sofie-accent); }
.sofie-tone-success { border-color: #1a7f37; color: #1a7f37; }
.sofie-tone-warning { border-color: #9a6700; color: #9a6700; }
.sofie-tone-danger { border-color: var(--sofie-danger); color: var(--sofie-danger); background: var(--sofie-danger-surface); }

.sofie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.sofie-card {
  display: block;
  padding: 1rem;
  border: 1px solid var(--sofie-border);
  border-radius: 0.5rem;
  background: var(--sofie-surface);
  color: inherit;
  text-decoration: none;
}

a.sofie-card:hover, a.sofie-card:focus-visible {
  border-color: var(--sofie-accent);
}

.sofie-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.sofie-nav ul {
  display: flex;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.sofie-nav a[aria-current="page"] {
  font-weight: 600;
}

.sofie-filter, .sofie-pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0;
}