Skip to content

lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server

JavaScript

feat: Add ripple effect, view transitions, staggered cell animations, and enhanced hover effects for improved UI dynamism.

Supun Lakmal7b7bb183f757
diff --git a/script.js b/script.js
index 09966fd..0a1714a 100644
--- a/script.js
+++ b/script.js
@@ -61,6 +61,33 @@ function cloneState(source) {
return JSON.parse(JSON.stringify(source));
}
+function createRipple(event) {
+ const button = event.target.closest("button");
+ if (!button) return;
+
+ const circle = document.createElement("span");
+ const diameter = Math.max(button.clientWidth, button.clientHeight);
+ const radius = diameter / 2;
+
+ const rect = button.getBoundingClientRect();
+
+ circle.style.width = circle.style.height = `${diameter}px`;
+ circle.style.left = `${event.clientX - rect.left - radius}px`;
+ circle.style.top = `${event.clientY - rect.top - radius}px`;
+ circle.classList.add("ripple");
+
+ const ripple = button.getElementsByClassName("ripple")[0];
+ if (ripple) {
+ ripple.remove();
+ }
+
+ button.appendChild(circle);
+
+ circle.addEventListener("animationend", () => {
+ circle.remove();
+ });
+}
+
function startOfDay(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
@@ -681,11 +708,34 @@ function updateViewButtons() {
function setView(view) {
if (!VALID_VIEWS.has(view)) return;
if (currentView === view) return;
- currentView = view;
- if (state && state.s) state.s.v = view;
- updateViewButtons();
- render();
- persistStateToHash();
+
+ const grid = ui.calendarGrid;
+ if (grid) {
+ grid.classList.add("view-animate-out");
+ grid.addEventListener("animationend", function handleExit() {
+ grid.classList.remove("view-animate-out");
+ grid.removeEventListener("animationend", handleExit);
+
+ currentView = view;
+ if (state && state.s) state.s.v = view;
+ updateViewButtons();
+ render();
+
+ grid.classList.add("view-animate-in");
+ grid.addEventListener("animationend", function handleEnter() {
+ grid.classList.remove("view-animate-in");
+ grid.removeEventListener("animationend", handleEnter);
+ }, { once: true });
+
+ persistStateToHash();
+ }, { once: true });
+ } else {
+ currentView = view;
+ if (state && state.s) state.s.v = view;
+ updateViewButtons();
+ render();
+ persistStateToHash();
+ }
}
function updateLockUI() {
@@ -833,6 +883,14 @@ function render() {
}
}
+ // Assign stagger indices to calendar cells
+ if (ui.calendarGrid) {
+ const cells = ui.calendarGrid.querySelectorAll(".day-cell, .time-cell, .mini-month, .agenda-event-item");
+ cells.forEach((cell, index) => {
+ cell.style.setProperty("--cell-index", index);
+ });
+ }
+
renderEventList();
renderTimezones();
updateUrlLength();
@@ -1508,6 +1566,12 @@ if (document.readyState === "loading") {
init();
}
+document.addEventListener("click", (e) => {
+ if (e.target.closest("button")) {
+ createRipple(e);
+ }
+});
+
/* --- PWA Service Worker Registration --- */
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
diff --git a/styles.css b/styles.css
index ed8f329..5fe8e8d 100644
--- a/styles.css
+++ b/styles.css
@@ -21,6 +21,7 @@
--focus-neutral: var(--text);
--shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.12);
--shadow-md: 0 2px 8px rgba(60, 64, 67, 0.16);
+ --shadow-lg: 0 4px 12px rgba(60, 64, 67, 0.2);
}
body[data-theme="dark"] {
@@ -64,6 +65,8 @@ body {
button {
font-family: inherit;
+ position: relative;
+ overflow: hidden;
}
.action-link {
@@ -587,11 +590,11 @@ button:disabled {
background: var(--panel);
box-shadow: var(--shadow-sm);
cursor: pointer;
- transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
+ transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.agenda-event-item:hover {
- transform: translateX(3px);
+ transform: translateY(-2px);
box-shadow: var(--shadow-md);
border-color: var(--border);
}
@@ -646,6 +649,8 @@ button:disabled {
cursor: pointer;
background: var(--panel);
transition: background 0.15s ease;
+ animation: cell-fade-in 0.4s ease backwards;
+ animation-delay: calc(var(--cell-index, 0) * 15ms);
}
.day-cell:hover {
@@ -685,6 +690,14 @@ button:disabled {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
+ transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
+ cursor: pointer;
+}
+
+.event-chip:hover {
+ transform: translateY(-2px);
+ box-shadow: var(--shadow-sm);
+ filter: brightness(1.1);
}
.event-chip .time {
@@ -2137,4 +2150,84 @@ body[data-theme="dark"] .app-launcher-menu {
}
}
+/* --- Micro-animations & Transitions --- */
+
+/* View Transitions */
+.calendar-grid.view-animate-in {
+ animation: view-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
+}
+
+.calendar-grid.view-animate-out {
+ animation: view-fade-out 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
+}
+
+@keyframes view-fade-in {
+ from { opacity: 0; transform: translateY(8px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+
+@keyframes view-fade-out {
+ from { opacity: 1; transform: translateY(0); }
+ to { opacity: 0; transform: translateY(-8px); }
+}
+
+/* Ripple Effect */
+.ripple {
+ position: absolute;
+ border-radius: 50%;
+ background: rgba(255, 255, 255, 0.35);
+ transform: scale(0);
+ animation: ripple-animation 0.6s linear;
+ pointer-events: none;
+}
+
+body[data-theme="dark"] .ripple {
+ background: rgba(255, 255, 255, 0.2);
+}
+
+@keyframes ripple-animation {
+ to {
+ transform: scale(4);
+ opacity: 0;
+ }
+}
+
+/* Stagger Animation */
+@keyframes cell-fade-in {
+ from {
+ opacity: 0;
+ transform: scale(0.96) translateY(10px);
+ }
+ to {
+ opacity: 1;
+ transform: scale(1) translateY(0);
+ }
+}
+
+/* Skeleton Loading */
+.skeleton {
+ background: linear-gradient(90deg, var(--panel-2) 25%, var(--border-soft) 50%, var(--panel-2) 75%);
+ background-size: 200% 100%;
+ animation: skeleton-shimmer 1.5s infinite;
+ border-radius: 4px;
+}
+
+@keyframes skeleton-shimmer {
+ to {
+ background-position: -200% 0;
+ }
+}
+
+/* Hover Lift for Cards */
+.side-card, .tz-card, .agenda-event-item, .event-item {
+ transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
+}
+
+.side-card:hover, .tz-card:hover, .event-item:hover {
+ transform: translateY(-3px);
+ box-shadow: var(--shadow-lg);
+ border-color: var(--border);
+}
+
+