view src/style.ts @ 128:5a1a79f54779

big rewrite
author drewp@bigasterisk.com
date Fri, 05 May 2023 21:26:36 -0700
parents src/render/style.ts@3cdbbd913f1d
children 3ce355e4f388
line wrap: on
line source

import { css } from "lit";

export function addFontToRootPage() {
  const content = `
  @font-face {
    font-family: 'Allerta';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(https://fonts.gstatic.com/s/allerta/v11/TwMO-IAHRlkbx940YnYXTQ.ttf) format('truetype');
  }`;

  if (!document.getElementById("allerta-style")) {
    var head = document.head || document.getElementsByTagName("head")[0],
      style = document.createElement("style");
    style.id = "allerta-style";
    style.type = "text/css";
    style.innerText = content;
    head.appendChild(style);
  }
}

export const pageStyle = css`
  a {
    color: #b1b1fd;
    text-shadow: 1px 1px 0px rgba(4, 0, 255, 0.58);
    text-decoration-color: rgba(0, 0, 119, 0.078);
  }
  body.rdfBrowsePage {
    background: #000;
    color: #fff;
    font-size: 12px;
  }

  /*
  for my pages serving rdf data, not necessarily part of browse/
  */
  .served-resources {
    margin-top: 4em;
    padding-top: 1em;
    border-top: 1px solid #808080;
  }
  .served-resources a {
    padding-right: 2em;
  }
`;

export const streamedGraphStyle =   css`
:host {
  display: inline-block;
  min-width: 30em;
  padding: 0 0 0 1em;
  border: 1px solid #808080;
  background: #000;
  color: #fff;
  font-family: 'Allerta', sans-serif;

    display: flex;
    flex-direction: column;
    padding: 2px 0;
  
}
.isCurrent {
  font-weight: bold;
  font-size: 167%;
  display: inline-block;
  height: 1.4em;
  vertical-align: middle;
}
.isCurrent-true {
  color: green;
}
.isCurrent-false {
  color: orange;
}
`;

export const graphViewStyle = css`
  section {
    padding: 4px;
  }
  .spoGrid {
    display: flex;
    flex-direction: column;
  }
  .subject,
  .predicate {
    display: flex;
    align-items: baseline;
  }
  .predicate,
  .object {
    margin-left: 5px;
  }
  .literal {
    display: inline-block;
    margin: 3px;
    padding: 4px;
  }
  .literalType {
    vertical-align: super;
    font-size: 80%;
  }
  .resource {
    display: inline-block;
    margin: 2px;
    padding: 1px 6px;
  }
  .predicate > a::before {
    padding-right: 2px;
    content: "━";
    font-weight: bolder;
    font-size: 125%;
  }
  .predicate > a::after {
    content: "🠪";
  }
  table.typeBlock {
    border-collapse: collapse;
  }
  table.typeBlock td {
    white-space: nowrap;
  }
  table tr:nth-child(even) td:nth-child(even) {
    background: #1a191c;
  }
  table tr:nth-child(even) td:nth-child(odd) {
    background: #181719;
  }
  table tr:nth-child(odd) td:nth-child(even) {
    background: #201e22;
  }
  table tr:nth-child(odd) td:nth-child(odd) {
    background: #1e1c1e;
  }
  table td,
  table th {
    vertical-align: top;
  }
  table.typeBlock td .literal {
    padding-top: 1px;
    padding-bottom: 1px;
  }
  .typeBlockScroll {
    overflow-x: auto;
    max-width: 100%;
  }
  /* ------------------ */
  :host {
    background: #000;
    color: #fff;
    font-family: "Allerta", sans-serif;
  }
  section {
    border: 1px solid #808080;
  }
  .subject {
    border-top: 1px solid #2f2f2f;
  }
  .literal {
    border: 1px solid #808080;
    border-radius: 9px;
    font-size: 115%;
    font-family: monospace;
  }
  .subject > .node {
    border: 2px solid #448d44;
  }
  .resource {
    border-radius: 6px;
    background: #add8e6;
  }
  .predicate > a {
    color: #e49dfb;
  }
  .comment {
    color: #008000;
  }
  table.typeBlock th {
    border: 2px #333 outset;
    background: #1f1f1f;
  }
  table.typeBlock td {
    border: 2px #4a4a4a outset;
    background: #2b2b2b;
  }
`;