Use pure CSS

This commit is contained in:
Magnus Åhall 2025-11-29 09:33:42 +01:00
parent 989542be91
commit 40a68d6ad0
6 changed files with 402 additions and 304 deletions

View file

@ -1,16 +1 @@
CREATE TABLE public.node_history ( DROP INDEX public.node_uuid_idx;
id serial4 NOT NULL,
user_id int4 NOT NULL,
uuid bpchar(36) NOT NULL,
parents varchar[] NULL,
created timestamptz NOT NULL,
updated timestamptz NOT NULL,
name varchar(256) NOT NULL,
"content" text NOT NULL,
content_encrypted text NOT NULL,
markdown bool DEFAULT false NOT NULL,
client bpchar(36) DEFAULT ''::bpchar NOT NULL,
CONSTRAINT node_history_pk PRIMARY KEY (id),
CONSTRAINT node_history_user_fk FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE RESTRICT ON UPDATE RESTRICT
);
CREATE INDEX node_history_uuid_idx ON public.node USING btree (uuid);

View file

@ -1,37 +1,44 @@
@import "theme.css";
#app { #app {
display: grid; display: grid;
justify-items: center; justify-items: center;
margin-top: 128px; margin-top: 128px;
} }
#logo { #logo {
margin-bottom: 48px; margin-bottom: 48px;
} }
#box { #box {
display: grid; display: grid;
grid-gap: 16px 0; grid-gap: 16px 0;
justify-items: center; justify-items: center;
width: 300px; width: 300px;
padding: 48px 0px; padding: 48px 0px;
background-color: #fff; background-color: #fff;
box-shadow: 0px 20px 52px -33px rgba(0, 0, 0, 0.75); box-shadow: 0px 20px 52px -33px rgba(0,0,0,0.75);
border-left: 8px solid #666; border-left: 8px solid var(--color3);
}
#box input { input {
padding: 4px 8px; padding: 4px 8px;
font-size: 1em; font-size: 1em;
width: calc(100% - 64px); width: calc(100% - 64px);
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
} }
#box button {
padding: 6px 16px; button {
font-size: 1em; padding: 6px 16px;
border-radius: 4px; font-size: 1em;
border: none; border-radius: 4px;
background-color: #fe5f55; border: none;
color: #fff; background-color: var(--color1);
} color: #fff;
#box #error { }
color: #c33;
margin-top: 16px; #error {
color: #c33;
margin-top: 16px;
}
} }

View file

@ -1,23 +1,29 @@
@import "theme.css";
html { html {
box-sizing: border-box; box-sizing: border-box;
background: #efede8; background: var(--color2);
font-family: "Liberation Mono", monospace; font-family: "Liberation Mono", monospace;
font-size: 14px; font-size: 14px;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
body { body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
*, *,
*:before, *:before,
*:after { *:after {
box-sizing: inherit; box-sizing: inherit;
} }
*:focus { *:focus {
outline: none; outline: none;
} }
[onClick] { [onClick] {
cursor: pointer; cursor: pointer;
} }

View file

@ -1,276 +1,369 @@
@import "theme.css";
html { html {
background-color: #fff; background-color: #fff;
} }
#notes2 { #notes2 {
min-height: 100vh; min-height: 100vh;
display: grid;
grid-template-areas: "tree crumbs" "tree sync" "tree name" "tree content" "tree blank"; display: grid;
grid-template-columns: min-content 1fr; grid-template-areas:
grid-template-rows: 48px 56px 48px min-content 1fr; "tree crumbs"
} "tree sync"
@media only screen and (max-width: 600px) { "tree name"
#notes2 { "tree content"
grid-template-areas: "crumbs" "sync" "name" "content" "blank"; /*
grid-template-columns: 1fr; "tree checklist"
} "tree schedule"
#notes2 #tree { "tree files"
display: none; */
} "tree blank"
;
grid-template-columns: min-content 1fr;
grid-template-rows:
48px
56px
48px
min-content
1fr;
@media only screen and (max-width: 600px) {
grid-template-areas:
"crumbs"
"sync"
"name"
"content"
/*
"checklist"
"schedule"
"files"
*/
"blank"
;
grid-template-columns: 1fr;
#tree {
display: none;
}
}
} }
#tree { #tree {
grid-area: tree; grid-area: tree;
display: grid; display: grid;
padding: 16px 0px 16px 16px; padding: 16px 0px 16px 16px;
color: #ddd; color: #ddd;
z-index: 100; z-index: 100; /* Over crumbs shadow */
border-left: 2px solid #333; border-left: 2px solid #333;
}
#tree:focus { &:focus {
border-left: 2px solid #FE5F55; border-left: 2px solid #FE5F55;
} }
#tree #logo {
display: grid; #logo {
position: relative; display: grid;
justify-items: center; position: relative;
margin-top: 8px; justify-items: center;
margin-bottom: 8px; margin-top: 8px;
margin-left: 24px; margin-bottom: 8px;
margin-right: 24px; margin-left: 24px;
cursor: pointer; margin-right: 24px;
} cursor: pointer;
#tree #logo img {
width: 128px; img {
left: -20px; width: 128px;
} left: -20px;
#tree .icons {
display: flex; }
justify-content: center; }
margin-bottom: 32px;
gap: 8px; .icons {
} display: flex;
#tree .node { justify-content: center;
display: grid; margin-bottom: 32px;
grid-template-columns: 24px min-content; gap: 8px;
grid-template-rows: min-content 1fr; }
margin-top: 12px;
} .node {
#tree .node .expand-toggle { display: grid;
user-select: none; grid-template-columns: 24px min-content;
} grid-template-rows:
#tree .node .expand-toggle img { min-content
width: 16px; 1fr;
height: 16px; margin-top: 12px;
}
#tree .node .name {
white-space: nowrap; .expand-toggle {
cursor: pointer; user-select: none;
user-select: none; img {
} width: 16px;
#tree .node .name:hover { height: 16px;
color: #fe5f55; }
} }
#tree .node .name.selected {
color: #fe5f55; .name {
font-weight: bold; white-space: nowrap;
} cursor: pointer;
#tree .node .children { user-select: none;
padding-left: 24px;
margin-left: 8px; &:hover {
border-left: 1px solid #444; color: var(--color1);
grid-column: 1 / -1; }
} &.selected {
#tree .node .children.collapsed { color: var(--color1);
display: none; font-weight: bold;
}
}
.children {
padding-left: 24px;
margin-left: 8px;
border-left: 1px solid #444;
grid-column: 1 / -1;
&.collapsed {
display: none;
}
}
}
} }
#tree-nodes { #tree-nodes {
padding: 16px 32px; padding: 16px 32px;
background-color: #333; background-color: #333;
border-radius: 8px; border-radius: 8px;
box-shadow: 5px 5px 10px -5px rgba(0, 0, 0, 0.75); box-shadow: 5px 5px 10px -5px rgba(0,0,0,0.75);
} }
#crumbs { #crumbs {
grid-area: crumbs; grid-area: crumbs;
display: grid; display: grid;
align-items: start; align-items: start;
justify-items: center; justify-items: center;
margin: 16px 16px; margin: 16px 16px;
}
#crumbs .crumbs { .crumbs {
display: flex; background: #e4e4e4;
flex-wrap: wrap; display: flex;
padding: 8px 16px; flex-wrap: wrap;
background: #e4e4e4; padding: 8px 16px;
color: #333; background: #e4e4e4;
border-bottom-left-radius: 5px; color: #333;
border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;
} border-bottom-right-radius: 5px;
#crumbs .crumbs.node-modified {
background-color: #fe5f55; &.node-modified {
color: #efede8; background-color: var(--color1);
} color: var(--color2);
#crumbs .crumbs.node-modified .crumb:after { .crumb:after {
color: #efede8; color: var(--color2);
} }
#crumbs .crumbs .crumb { }
margin-right: 8px;
cursor: pointer; .crumb {
user-select: none; margin-right: 8px;
-webkit-tap-highlight-color: transparent; cursor: pointer;
} user-select: none;
#crumbs .crumbs .crumb a { -webkit-tap-highlight-color: transparent;
text-decoration: none;
color: inherit; a {
} text-decoration: none;
#crumbs .crumbs .crumb:after { color: inherit;
content: "•"; }
margin-left: 8px; }
color: #fe5f55;
} .crumb:after {
#crumbs .crumbs .crumb:last-child { content: "•";
margin-right: 0; margin-left: 8px;
} color: var(--color1)
#crumbs .crumbs .crumb:last-child:after { }
content: '';
margin-left: 0px; .crumb:last-child {
margin-right: 0;
}
.crumb:last-child:after {
content: '';
margin-left: 0px;
}
}
} }
#sync-progress { #sync-progress {
grid-area: sync; grid-area: sync;
display: grid; display: grid;
justify-items: center; justify-items: center;
width: 100%;
height: 56px; width: 100%;
position: relative; height: 56px;
} position: relative;
#sync-progress progress {
width: 100%; progress {
padding: 0 7px; width: 100%;
max-width: 900px; padding: 0 7px;
height: 16px; max-width: 900px;
border-radius: 4px; height: 16px;
} border-radius: 4px;
#sync-progress progress[value]::-webkit-progress-bar { }
background-color: #eee;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset; progress[value]::-webkit-progress-bar {
border-radius: 4px; background-color: #eee;
} box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset;
#sync-progress progress[value]::-moz-progress-bar { border-radius: 4px;
background-color: #eee; }
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset;
border-radius: 4px; progress[value]::-moz-progress-bar {
} background-color: #eee;
#sync-progress progress[value]::-webkit-progress-value { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset;
background: #ba5f59; border-radius: 4px;
background: linear-gradient(180deg, #ba5f59 0%, #fe5f55 50%, #ba5f59 100%); }
border-radius: 4px;
} progress[value]::-webkit-progress-value {
#sync-progress progress[value]::-moz-progress-value { background: rgb(186,95,89);
background: #ba5f59; background: linear-gradient(180deg, rgba(186,95,89,1) 0%, rgba(254,95,85,1) 50%, rgba(186,95,89,1) 100%);
background: linear-gradient(180deg, #ba5f59 0%, #fe5f55 50%, #ba5f59 100%); border-radius: 4px;
border-radius: 4px; }
}
#sync-progress .count { /* TODO: style the progress value for Firefox */
width: min-content; progress[value]::-moz-progress-value {
white-space: nowrap; background: rgb(186,95,89);
margin-top: 0px; background: linear-gradient(180deg, rgba(186,95,89,1) 0%, rgba(254,95,85,1) 50%, rgba(186,95,89,1) 100%);
color: #888; border-radius: 4px;
position: absolute; }
top: 22px;
} .count {
#sync-progress.hidden { width: min-content;
visibility: hidden; white-space: nowrap;
opacity: 0; margin-top: 0px;
transition: visibility 0s 500ms, opacity 500ms linear; color: #888;
position: absolute;
top: 22px;
}
&.hidden {
visibility: hidden;
opacity: 0;
transition: visibility 0s 500ms, opacity 500ms linear;
}
} }
#name { #name {
color: #333; color: #333;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
font-size: 1.15em; font-size: 1.15em;
margin-top: 0px; margin-top: 0px;
margin-bottom: 16px; margin-bottom: 16px;
} }
/* ============================================================= * /* ============================================================= *
* Textarea replicates the height of an element expanding height * * Textarea replicates the height of an element expanding height *
* ============================================================= */ * ============================================================= */
.grow-wrap { .grow-wrap {
/* easy way to plop the elements on top of each other and have them both sized based on the tallest one's height */ /* easy way to plop the elements on top of each other and have them both sized based on the tallest one's height */
display: grid; display: grid;
grid-area: content; grid-area: content;
font-size: 1em; font-size: 1.0em;
} }
.grow-wrap::after { .grow-wrap::after {
/* Note the weird space! Needed to preventy jumpy behavior */ /* Note the weird space! Needed to preventy jumpy behavior */
content: attr(data-replicated-value) " "; content: attr(data-replicated-value) " ";
/* This is how textarea text behaves */
width: calc(100% - 32px); /* This is how textarea text behaves */
max-width: 900px; width: calc(100% - 32px);
white-space: pre-wrap; max-width: 900px;
word-wrap: break-word; white-space: pre-wrap;
background: rgba(0, 255, 255, 0.5); word-wrap: break-word;
justify-self: center; background: rgba(0, 255, 255, 0.5);
/* Hidden from view, clicks, and screen readers */ justify-self: center;
visibility: hidden;
/* Hidden from view, clicks, and screen readers */
visibility: hidden;
} }
.grow-wrap > textarea { .grow-wrap > textarea {
/* You could leave this, but after a user resizes, then it ruins the auto sizing */ /* You could leave this, but after a user resizes, then it ruins the auto sizing */
resize: none; resize: none;
/* Firefox shows scrollbar on growth, you can hide like this. */
overflow: hidden; /* Firefox shows scrollbar on growth, you can hide like this. */
overflow: hidden;
} }
.grow-wrap > textarea, .grow-wrap > textarea,
.grow-wrap::after { .grow-wrap::after {
/* Identical styling required!! */ /* Identical styling required!! */
padding: 0.5rem; padding: 0.5rem;
font: inherit; font: inherit;
/* Place on top of each other */
grid-area: 1 / 1 / 2 / 2; /* Place on top of each other */
grid-area: 1 / 1 / 2 / 2;
} }
/* ============================================================= */ /* ============================================================= */
#node-content { #node-content {
justify-self: center; justify-self: center;
word-wrap: break-word; word-wrap: break-word;
font-family: monospace; font-family: monospace;
color: #333; color: #333;
width: calc(100% - 32px); width: calc(100% - 32px);
max-width: 900px; max-width: 900px;
resize: none; resize: none;
border: none; border: none;
outline: none; outline: none;
}
#node-content:invalid { &:invalid {
background: #f5f5f5; background: #f5f5f5;
padding-top: 16px; padding-top: 16px;
}
} }
#blank { #blank {
grid-area: blank; grid-area: blank;
height: 32px; height: 32px;
} }
dialog.op::backdrop {
background: rgba(0, 0, 0, 0.5); dialog.op {
&::backdrop {
background: rgba(0, 0, 0, 0.5);
}
.header {
font-weight: bold;
margin-top: 16px;
&:first-child {
margin-top: 0px;
}
}
} }
dialog.op .header {
font-weight: bold; #op-search {
margin-top: 16px; .results {
} display: grid;
dialog.op .header:first-child { grid-template-columns: min-content min-content;
margin-top: 0px; grid-gap: 6px 16px;
}
#op-search .results { div {
display: grid; white-space: nowrap;
grid-template-columns: min-content min-content; }
grid-gap: 6px 16px;
}
#op-search .results div { .ancestors {
white-space: nowrap; display: flex;
}
#op-search .results .ancestors { .ancestor::after {
display: flex; content: ">";
} margin: 0px 8px;
#op-search .results .ancestors .ancestor::after { color: #a00;
content: ">"; }
margin: 0px 8px;
color: #a00; .ancestor:last-child::after {
} content: "";
#op-search .results .ancestors .ancestor:last-child::after { }
content: ""; }
}
} }

View file

@ -0,0 +1,5 @@
:root {
--color1: #fe5f55;
--color2: #efede8;
--color3: #666;
}

View file

@ -1,3 +1,5 @@
@color1: #fe5f55; :root {
@color2: #efede8; --color1: #fe5f55;
@color3: #666; --color2: #efede8;
--color3: #666;
}