Cleanup, bigger layout and other changes.
This commit is contained in:
parent
272a3bd61e
commit
9bb3740b61
301
calendar.css
301
calendar.css
@ -1,87 +1,82 @@
|
||||
/* ===============================
|
||||
LIGHT MODE (default) — colors only
|
||||
=============================== */
|
||||
/* Color tokens */
|
||||
:root {
|
||||
--bg: #f6f7fb;
|
||||
--panel: #ffffff;
|
||||
--panel: #fff;
|
||||
--today: #f83;
|
||||
--ink: #111;
|
||||
--ink-rgb: 17, 17, 17;
|
||||
--muted: #888;
|
||||
--weekend: #888;
|
||||
--firstday: #000;
|
||||
--select: #aaf;
|
||||
--label-bg: #fafbfe;
|
||||
--label-bg-rgb: 250, 251, 254;
|
||||
}
|
||||
|
||||
/* WINTER — cool gray-blue hue, light-dark-light */
|
||||
.cell.dec { background: hsl(220 20% 95%) } /* light */
|
||||
.cell.jan { background: hsl(220 20% 88%) } /* dark */
|
||||
.cell.feb { background: hsl(220 20% 95%) } /* light */
|
||||
/* Prevent text selection in calendar */
|
||||
#calendar-viewport, #calendar-content, .week-row, .cell,
|
||||
.calendar-header, .week-label, .month-name-label,
|
||||
.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 */
|
||||
.cell.mar { background: hsl(125 60% 88%) } /* dark */
|
||||
.cell.apr { background: hsl(125 60% 95%) } /* light */
|
||||
.cell.may { background: hsl(125 60% 88%) } /* dark */
|
||||
/* Month tints (light) */
|
||||
.cell.dec { background: hsl(220 20% 95%) }
|
||||
.cell.jan { background: hsl(220 20% 88%) }
|
||||
.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 */
|
||||
.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
|
||||
=============================== */
|
||||
/* Color tokens (dark) */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: radial-gradient(1200px 800px at 20% -10%, #1c2130 0%, #0c0f16 35%, #0a0b11 100%);
|
||||
--panel: #111318;
|
||||
--today: #f83;
|
||||
--ink: #ddd;
|
||||
--ink-rgb: 221, 221, 221;
|
||||
--muted: #888;
|
||||
--weekend: #999;
|
||||
--firstday: #fff;
|
||||
--select: #44f;
|
||||
--label-bg: #1a1d25;
|
||||
--label-bg-rgb: 26, 29, 37;
|
||||
}
|
||||
|
||||
/* WINTER — cool gray-blue hue, light-dark-li666ght */
|
||||
.cell.dec { background: hsl(220 20% 22%) } /* light */
|
||||
.cell.jan { background: hsl(220 20% 16%) } /* dark */
|
||||
.cell.feb { background: hsl(220 20% 22%) } /* light */
|
||||
|
||||
/* SPRING — fresh green hue, dark-light-dark */
|
||||
.cell.mar { background: hsl(125 40% 18%) } /* dark */
|
||||
.cell.apr { background: hsl(125 40% 26%) } /* light */
|
||||
.cell.may { background: hsl(125 40% 18%) } /* dark */
|
||||
|
||||
/* SUMMER — golden yellow-brown hue, light-dark-light */
|
||||
.cell.jun { background: hsl(45 70% 24%) } /* light */
|
||||
.cell.jul { background: hsl(45 70% 18%) } /* dark */
|
||||
.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 */
|
||||
/* Month tints (dark) */
|
||||
.cell.dec { background: hsl(220 20% 22%) }
|
||||
.cell.jan { background: hsl(220 20% 16%) }
|
||||
.cell.feb { background: hsl(220 20% 22%) }
|
||||
.cell.mar { background: hsl(125 40% 18%) }
|
||||
.cell.apr { background: hsl(125 40% 26%) }
|
||||
.cell.may { background: hsl(125 40% 18%) }
|
||||
.cell.jun { background: hsl(45 70% 24%) }
|
||||
.cell.jul { background: hsl(45 70% 18%) }
|
||||
.cell.aug { background: hsl(45 70% 24%) }
|
||||
.cell.sep { background: hsl(18 70% 18%) }
|
||||
.cell.oct { background: hsl(18 70% 26%) }
|
||||
.cell.nov { background: hsl(18 70% 18%) }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ===============================
|
||||
Base layout & typography (mode-agnostic)
|
||||
=============================== */
|
||||
/* Layout & typography */
|
||||
:root {
|
||||
--gap: 0;
|
||||
--row-h: 2.2em;
|
||||
--w-label: 3em;
|
||||
--w-cell: 3em;
|
||||
--overlay-w: 3rem; /* extra right-side strip for month labels */
|
||||
--week-row-h: 4em;
|
||||
--label-w: 4em;
|
||||
--cell-w: 6em;
|
||||
--cell-h: 6em;
|
||||
--overlay-w: 3rem;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box }
|
||||
@ -95,13 +90,13 @@ body {
|
||||
|
||||
.wrap {
|
||||
width: fit-content;
|
||||
max-width: none;
|
||||
margin: 2rem auto;
|
||||
background: var(--panel);
|
||||
height: calc(100vh - 4rem);
|
||||
display: flex;
|
||||
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 {
|
||||
@ -115,59 +110,22 @@ header {
|
||||
.header-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.date-input {
|
||||
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;
|
||||
.today-date {
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.today-button:hover {
|
||||
opacity: 0.8;
|
||||
.today-date::first-line {
|
||||
color: var(--today);
|
||||
}
|
||||
.today-button:hover { opacity: .8 }
|
||||
|
||||
.calendar-header {
|
||||
display: grid;
|
||||
grid-template-columns: var(--w-label) repeat(7, var(--w-cell)) var(--overlay-w);
|
||||
gap: 0;
|
||||
grid-template-columns: var(--label-w) repeat(7, var(--cell-w)) var(--overlay-w);
|
||||
border-bottom: .1em solid var(--muted);
|
||||
align-items: last baseline;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@ -184,143 +142,116 @@ header {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
flex: 0 0 auto;
|
||||
width: calc(var(--w-label) + 7 * var(--w-cell) + var(--overlay-w));
|
||||
/* Hide scrollbar */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
.calendar-viewport::-webkit-scrollbar {
|
||||
display: none; /* Chrome/Safari/Webkit */
|
||||
width: calc(var(--label-w) + 7 * var(--cell-w) + var(--overlay-w));
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.calendar-viewport::-webkit-scrollbar { display: none }
|
||||
|
||||
.jogwheel-viewport {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
inset: 0 0 0 auto;
|
||||
width: var(--overlay-w);
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
/* Hide scrollbar */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
z-index: 20; /* Above calendar content and labels */
|
||||
scrollbar-width: none;
|
||||
z-index: 20;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.jogwheel-viewport::-webkit-scrollbar { display: none }
|
||||
|
||||
.jogwheel-viewport::-webkit-scrollbar {
|
||||
display: none; /* Chrome/Safari/Webkit */
|
||||
}
|
||||
.jogwheel-content { position: relative; width: 100% }
|
||||
|
||||
.jogwheel-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.calendar-content {
|
||||
position: relative;
|
||||
}
|
||||
.calendar-content { position: relative }
|
||||
|
||||
.week-row {
|
||||
display: grid;
|
||||
grid-template-columns: var(--w-label) repeat(7, var(--w-cell)) var(--overlay-w);
|
||||
gap: 0;
|
||||
grid-template-columns: var(--label-w) repeat(7, var(--cell-w)) var(--overlay-w);
|
||||
position: relative;
|
||||
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 .week-label { height: var(--week-row-h); }
|
||||
.week-row .week-label { height: var(--cell-h) }
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
header h1 { margin: 0; font-size: 1rem }
|
||||
|
||||
.dow-label,
|
||||
.week-label {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: var(--w-label);
|
||||
width: var(--label-w);
|
||||
height: var(--row-h);
|
||||
color: var(--muted);
|
||||
cursor: ns-resize;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.dow {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.dow { text-transform: uppercase; }
|
||||
.cell {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: var(--w-cell);
|
||||
width: var(--cell-w);
|
||||
height: var(--row-h);
|
||||
font-weight: 700;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 1px transparent;
|
||||
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) }
|
||||
.firstday { color: var(--firstday); text-shadow: 0 0 .1em var(--ink) }
|
||||
.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; }
|
||||
.firstday { color: var(--firstday); text-shadow: 0 0 .1em rgba(var(--ink-rgb), .5) }
|
||||
|
||||
.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;
|
||||
color: var(--panel) !important;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
.range-start h1,
|
||||
.range-end h1,
|
||||
.range-middle h1,
|
||||
.range-single h1 {
|
||||
background: transparent !important;
|
||||
color: var(--panel) !important;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
|
||||
.cell {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cell h1 {
|
||||
cursor: inherit !important; /* Inherit cursor from parent cell */
|
||||
padding: 0.25em;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: .25em;
|
||||
margin: 0;
|
||||
border-radius: 0.25rem;
|
||||
transition: background-color 0.15s ease;
|
||||
transition: background-color .15s ease;
|
||||
font-size: 1em;
|
||||
}
|
||||
.cell h1:hover {
|
||||
background: var(--muted);
|
||||
color: var(--panel);
|
||||
}
|
||||
.cell:hover h1 { text-shadow: 0 0 .2em; }
|
||||
|
||||
/* ===============================
|
||||
JOGWHEEL MONTH LABELS
|
||||
=============================== */
|
||||
/* Month labels in jogwheel column */
|
||||
.month-name-label {
|
||||
grid-column: -2 / -1; /* last overlay column */
|
||||
grid-column: -2 / -1;
|
||||
font-size: 2em;
|
||||
font-weight: 700;
|
||||
color: var(--muted);
|
||||
display: flex;
|
||||
align-items: center; /* center in container */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
z-index: 15;
|
||||
|
1028
calendar.js
1028
calendar.js
File diff suppressed because it is too large
Load Diff
@ -9,10 +9,10 @@
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<header>
|
||||
<h1 id="title">Infinite Calendar</h1>
|
||||
<h1 id="title">Calendar</h1>
|
||||
<div class="header-controls">
|
||||
<input type="text" id="selected-date" class="date-input" placeholder="Select a date..." readonly>
|
||||
<button id="go-to-today" class="today-button">Today</button>
|
||||
<label>Selection: <input type="text" id="selected-date" class="date-input" readonly></label>
|
||||
<div id="today-date" class="today-date"></div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="calendar-header" id="calendar-header"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user