Cleanup, bigger layout and other changes.

This commit is contained in:
Leo Vasanko 2025-08-20 12:49:17 -06:00
parent 272a3bd61e
commit 9bb3740b61
3 changed files with 531 additions and 804 deletions

View File

@ -1,87 +1,82 @@
/* =============================== /* Color tokens */
LIGHT MODE (default) colors only
=============================== */
:root { :root {
--bg: #f6f7fb; --bg: #f6f7fb;
--panel: #ffffff; --panel: #fff;
--today: #f83;
--ink: #111; --ink: #111;
--ink-rgb: 17, 17, 17; --ink-rgb: 17, 17, 17;
--muted: #888; --muted: #888;
--weekend: #888; --weekend: #888;
--firstday: #000; --firstday: #000;
--select: #aaf;
--label-bg: #fafbfe; --label-bg: #fafbfe;
--label-bg-rgb: 250, 251, 254; --label-bg-rgb: 250, 251, 254;
} }
/* WINTER — cool gray-blue hue, light-dark-light */ /* Prevent text selection in calendar */
.cell.dec { background: hsl(220 20% 95%) } /* light */ #calendar-viewport, #calendar-content, .week-row, .cell,
.cell.jan { background: hsl(220 20% 88%) } /* dark */ .calendar-header, .week-label, .month-name-label,
.cell.feb { background: hsl(220 20% 95%) } /* light */ .calendar-container, .jogwheel-viewport, .jogwheel-content {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent;
}
/* SPRING — fresh green hue, dark-light-dark */ /* Month tints (light) */
.cell.mar { background: hsl(125 60% 88%) } /* dark */ .cell.dec { background: hsl(220 20% 95%) }
.cell.apr { background: hsl(125 60% 95%) } /* light */ .cell.jan { background: hsl(220 20% 88%) }
.cell.may { background: hsl(125 60% 88%) } /* dark */ .cell.feb { background: hsl(220 20% 95%) }
.cell.mar { background: hsl(125 60% 88%) }
.cell.apr { background: hsl(125 60% 95%) }
.cell.may { background: hsl(125 60% 88%) }
.cell.jun { background: hsl(45 85% 95%) }
.cell.jul { background: hsl(45 85% 88%) }
.cell.aug { background: hsl(45 85% 95%) }
.cell.sep { background: hsl(18 78% 88%) }
.cell.oct { background: hsl(18 78% 95%) }
.cell.nov { background: hsl(18 78% 88%) }
/* SUMMER — golden yellow-brown hue, light-dark-light */ /* Color tokens (dark) */
.cell.jun { background: hsl(45 85% 95%) } /* light */
.cell.jul { background: hsl(45 85% 88%) } /* dark */
.cell.aug { background: hsl(45 85% 95%) } /* light */
/* AUTUMN — red-orange hue, dark-light-dark */
.cell.sep { background: hsl(18 78% 88%) } /* dark */
.cell.oct { background: hsl(18 78% 95%) } /* light */
.cell.nov { background: hsl(18 78% 88%) } /* dark */
/* ===============================
DARK MODE colors only
=============================== */
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--bg: radial-gradient(1200px 800px at 20% -10%, #1c2130 0%, #0c0f16 35%, #0a0b11 100%); --bg: radial-gradient(1200px 800px at 20% -10%, #1c2130 0%, #0c0f16 35%, #0a0b11 100%);
--panel: #111318; --panel: #111318;
--today: #f83;
--ink: #ddd; --ink: #ddd;
--ink-rgb: 221, 221, 221; --ink-rgb: 221, 221, 221;
--muted: #888; --muted: #888;
--weekend: #999; --weekend: #999;
--firstday: #fff; --firstday: #fff;
--select: #44f;
--label-bg: #1a1d25; --label-bg: #1a1d25;
--label-bg-rgb: 26, 29, 37; --label-bg-rgb: 26, 29, 37;
} }
/* WINTER — cool gray-blue hue, light-dark-li666ght */ /* Month tints (dark) */
.cell.dec { background: hsl(220 20% 22%) } /* light */ .cell.dec { background: hsl(220 20% 22%) }
.cell.jan { background: hsl(220 20% 16%) } /* dark */ .cell.jan { background: hsl(220 20% 16%) }
.cell.feb { background: hsl(220 20% 22%) } /* light */ .cell.feb { background: hsl(220 20% 22%) }
.cell.mar { background: hsl(125 40% 18%) }
/* SPRING — fresh green hue, dark-light-dark */ .cell.apr { background: hsl(125 40% 26%) }
.cell.mar { background: hsl(125 40% 18%) } /* dark */ .cell.may { background: hsl(125 40% 18%) }
.cell.apr { background: hsl(125 40% 26%) } /* light */ .cell.jun { background: hsl(45 70% 24%) }
.cell.may { background: hsl(125 40% 18%) } /* dark */ .cell.jul { background: hsl(45 70% 18%) }
.cell.aug { background: hsl(45 70% 24%) }
/* SUMMER — golden yellow-brown hue, light-dark-light */ .cell.sep { background: hsl(18 70% 18%) }
.cell.jun { background: hsl(45 70% 24%) } /* light */ .cell.oct { background: hsl(18 70% 26%) }
.cell.jul { background: hsl(45 70% 18%) } /* dark */ .cell.nov { background: hsl(18 70% 18%) }
.cell.aug { background: hsl(45 70% 24%) } /* light */
/* AUTUMN — red-orange hue, dark-light-dark */
.cell.sep { background: hsl(18 70% 18%) } /* dark */
.cell.oct { background: hsl(18 70% 26%) } /* light */
.cell.nov { background: hsl(18 70% 18%) } /* dark */
} }
/* Layout & typography */
/* ===============================
Base layout & typography (mode-agnostic)
=============================== */
:root { :root {
--gap: 0;
--row-h: 2.2em; --row-h: 2.2em;
--w-label: 3em; --label-w: 4em;
--w-cell: 3em; --cell-w: 6em;
--overlay-w: 3rem; /* extra right-side strip for month labels */ --cell-h: 6em;
--week-row-h: 4em; --overlay-w: 3rem;
} }
* { box-sizing: border-box } * { box-sizing: border-box }
@ -95,13 +90,13 @@ body {
.wrap { .wrap {
width: fit-content; width: fit-content;
max-width: none;
margin: 2rem auto; margin: 2rem auto;
background: var(--panel); background: var(--panel);
height: calc(100vh - 4rem); height: calc(100vh - 4rem);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-width: calc(var(--w-label) + 7 * var(--w-cell) + 2.4rem); /* Account for padding */ min-width: calc(var(--label-w) + 7 * var(--cell-w) + 2.4rem);
white-space: pre-wrap;
} }
header { header {
@ -115,59 +110,22 @@ header {
.header-controls { .header-controls {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.75rem; gap: .75rem;
} }
.date-input { .today-date {
background: var(--panel);
color: var(--ink);
border: 1px solid var(--muted);
padding: 0.5em 0.75em;
border-radius: 0.25rem;
font-weight: 500;
font-size: 0.9rem;
min-width: 120px;
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
}
.date-input.clean-input {
background: transparent;
border: none;
padding: 0.5em 0;
color: var(--ink);
}
.date-input:focus {
outline: none;
border-color: var(--ink);
}
.date-input.clean-input:focus {
outline: none;
border: none;
}
.today-button {
background: var(--ink);
color: var(--panel);
border: none;
padding: 0.5em 1em;
border-radius: 0.25rem;
font-weight: 600;
font-size: 0.9rem;
cursor: pointer; cursor: pointer;
transition: opacity 0.2s ease;
} }
.today-date::first-line {
.today-button:hover { color: var(--today);
opacity: 0.8;
} }
.today-button:hover { opacity: .8 }
.calendar-header { .calendar-header {
display: grid; display: grid;
grid-template-columns: var(--w-label) repeat(7, var(--w-cell)) var(--overlay-w); grid-template-columns: var(--label-w) repeat(7, var(--cell-w)) var(--overlay-w);
gap: 0;
border-bottom: .1em solid var(--muted); border-bottom: .1em solid var(--muted);
align-items: last baseline;
flex-shrink: 0; flex-shrink: 0;
} }
@ -184,143 +142,116 @@ header {
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
flex: 0 0 auto; flex: 0 0 auto;
width: calc(var(--w-label) + 7 * var(--w-cell) + var(--overlay-w)); width: calc(var(--label-w) + 7 * var(--cell-w) + var(--overlay-w));
/* Hide scrollbar */ scrollbar-width: none;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE/Edge */
}
.calendar-viewport::-webkit-scrollbar {
display: none; /* Chrome/Safari/Webkit */
} }
.calendar-viewport::-webkit-scrollbar { display: none }
.jogwheel-viewport { .jogwheel-viewport {
position: absolute; position: absolute;
top: 0; inset: 0 0 0 auto;
right: 0;
bottom: 0;
width: var(--overlay-w); width: var(--overlay-w);
height: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
/* Hide scrollbar */ scrollbar-width: none;
scrollbar-width: none; /* Firefox */ z-index: 20;
-ms-overflow-style: none; /* IE/Edge */ cursor: ns-resize;
z-index: 20; /* Above calendar content and labels */
} }
.jogwheel-viewport::-webkit-scrollbar { display: none }
.jogwheel-viewport::-webkit-scrollbar { .jogwheel-content { position: relative; width: 100% }
display: none; /* Chrome/Safari/Webkit */
}
.jogwheel-content { .calendar-content { position: relative }
position: relative;
width: 100%;
background: transparent;
}
.calendar-content {
position: relative;
}
.week-row { .week-row {
display: grid; display: grid;
grid-template-columns: var(--w-label) repeat(7, var(--w-cell)) var(--overlay-w); grid-template-columns: var(--label-w) repeat(7, var(--cell-w)) var(--overlay-w);
gap: 0;
position: relative; position: relative;
overflow: visible; overflow: visible;
height: var(--week-row-h); height: var(--cell-h);
scroll-snap-align: start;
} }
/* Ensure children match the fixed week height */ /* Fixed heights for cells and labels */
.week-row .cell, .week-row .cell,
.week-row .week-label { height: var(--week-row-h); } .week-row .week-label { height: var(--cell-h) }
header h1 { header h1 { margin: 0; font-size: 1rem }
margin: 0;
font-size: 1rem;
}
.dow-label, .dow-label,
.week-label { .week-label {
display: grid; display: grid;
place-items: center; place-items: center;
width: var(--w-label); width: var(--label-w);
height: var(--row-h); height: var(--row-h);
color: var(--muted); color: var(--muted);
cursor: ns-resize;
font-size: 1.2em;
} }
.dow {
text-transform: uppercase; .dow { text-transform: uppercase; }
}
.cell { .cell {
display: grid; display: grid;
place-items: center; place-items: center;
width: var(--w-cell); width: var(--cell-w);
height: var(--row-h); height: var(--row-h);
font-weight: 700; font-weight: 700;
margin: 0;
padding: 0;
border: 1px transparent;
cursor: pointer; cursor: pointer;
transition: background-color 0.15s ease; transition: background-color .15s ease;
} }
.cell:hover {
background: rgba(var(--ink-rgb, 17, 17, 17), 0.1);
}
.weekend { color: var(--weekend) } .weekend { color: var(--weekend) }
.firstday { color: var(--firstday); text-shadow: 0 0 .1em var(--ink) } .firstday { color: var(--firstday); text-shadow: 0 0 .1em rgba(var(--ink-rgb), .5) }
.today h1 {
background: var(--ink) !important;
color: var(--panel) !important;
border-radius: 0.25rem;
font-weight: 700;
cursor: pointer;
}
.selected,
.range-start,
.range-end,
.range-middle,
.range-single { background: var(--weekend) !important; }
.selected h1 { .today h1 {
border-radius: 2em;
border: .2em dotted var(--today);
margin: -.2em;
}
/* Selection */
input {
background: transparent;
border: none;
color: var(--ink);
width: 11em;
}
label:has(input[value]) {
display: block;
}
.selected {
background: var(--select) !important;
}
.selected h1,
:is(.range-start,.range-end,.range-middle,.range-single) h1 {
background: transparent !important; background: transparent !important;
color: var(--panel) !important; color: var(--panel) !important;
font-weight: 700; font-weight: 700;
cursor: pointer;
} }
.range-start h1,
.range-end h1, .cell {
.range-middle h1, position: relative;
.range-single h1 {
background: transparent !important;
color: var(--panel) !important;
font-weight: 700;
cursor: pointer;
} }
.cell h1 { .cell h1 {
cursor: inherit !important; /* Inherit cursor from parent cell */ position: absolute;
padding: 0.25em; top: 0;
left: 0;
padding: .25em;
margin: 0; margin: 0;
border-radius: 0.25rem; transition: background-color .15s ease;
transition: background-color 0.15s ease;
font-size: 1em; font-size: 1em;
} }
.cell h1:hover { .cell:hover h1 { text-shadow: 0 0 .2em; }
background: var(--muted);
color: var(--panel);
}
/* =============================== /* Month labels in jogwheel column */
JOGWHEEL MONTH LABELS
=============================== */
.month-name-label { .month-name-label {
grid-column: -2 / -1; /* last overlay column */ grid-column: -2 / -1;
font-size: 2em; font-size: 2em;
font-weight: 700; font-weight: 700;
color: var(--muted); color: var(--muted);
display: flex; display: flex;
align-items: center; /* center in container */ align-items: center;
justify-content: center; justify-content: center;
pointer-events: none; pointer-events: none;
z-index: 15; z-index: 15;

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@
<body> <body>
<div class="wrap"> <div class="wrap">
<header> <header>
<h1 id="title">Infinite Calendar</h1> <h1 id="title">Calendar</h1>
<div class="header-controls"> <div class="header-controls">
<input type="text" id="selected-date" class="date-input" placeholder="Select a date..." readonly> <label>Selection: <input type="text" id="selected-date" class="date-input" readonly></label>
<button id="go-to-today" class="today-button">Today</button> <div id="today-date" class="today-date"></div>
</div> </div>
</header> </header>
<div class="calendar-header" id="calendar-header"></div> <div class="calendar-header" id="calendar-header"></div>