mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-13 17:43:59 +02:00
remove fps, improve icon css
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
<link rel="modulepreload" href="scripts/AppDatePicker.js" />
|
<link rel="modulepreload" href="scripts/AppDatePicker.js" />
|
||||||
<link rel="modulepreload" href="scripts/AppDraggable.js" />
|
<link rel="modulepreload" href="scripts/AppDraggable.js" />
|
||||||
<link rel="modulepreload" href="scripts/AppFlip.js" />
|
<link rel="modulepreload" href="scripts/AppFlip.js" />
|
||||||
<link rel="modulepreload" href="scripts/AppFps.js" />
|
|
||||||
<link rel="modulepreload" href="scripts/AppIcon.js" />
|
<link rel="modulepreload" href="scripts/AppIcon.js" />
|
||||||
<link rel="modulepreload" href="scripts/AppSortable.js" />
|
<link rel="modulepreload" href="scripts/AppSortable.js" />
|
||||||
<link rel="modulepreload" href="scripts/TodoApp.js" />
|
<link rel="modulepreload" href="scripts/TodoApp.js" />
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
/**
|
|
||||||
* @param {HTMLElement} el
|
|
||||||
*/
|
|
||||||
export function AppFps(el) {
|
|
||||||
const sampleSize = 20;
|
|
||||||
let times = [];
|
|
||||||
|
|
||||||
tick();
|
|
||||||
|
|
||||||
function tick() {
|
|
||||||
requestAnimationFrame(tick);
|
|
||||||
|
|
||||||
times.push(performance.now());
|
|
||||||
|
|
||||||
if (times.length <= sampleSize) return;
|
|
||||||
|
|
||||||
let min = Infinity;
|
|
||||||
let max = 0;
|
|
||||||
let sum = 0;
|
|
||||||
|
|
||||||
for (let i = 1; i < sampleSize + 1; ++i) {
|
|
||||||
const delta = times[i] - times[i - 1];
|
|
||||||
min = Math.min(min, delta);
|
|
||||||
max = Math.max(max, delta);
|
|
||||||
sum += delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fps = (sampleSize / sum) * 1000;
|
|
||||||
|
|
||||||
el.innerText = `${fps.toFixed(0)} fps (${min.toFixed(0)} ms - ${max.toFixed(
|
|
||||||
0,
|
|
||||||
)} ms)`;
|
|
||||||
|
|
||||||
times = [];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,6 +1,5 @@
|
|||||||
import { AppCollapsible } from './AppCollapsible.js';
|
import { AppCollapsible } from './AppCollapsible.js';
|
||||||
import { AppFlip } from './AppFlip.js';
|
import { AppFlip } from './AppFlip.js';
|
||||||
import { AppFps } from './AppFps.js';
|
|
||||||
import { AppIcon } from './AppIcon.js';
|
import { AppIcon } from './AppIcon.js';
|
||||||
import { TodoController } from './TodoController.js';
|
import { TodoController } from './TodoController.js';
|
||||||
import { TodoFrameCustom } from './TodoFrameCustom.js';
|
import { TodoFrameCustom } from './TodoFrameCustom.js';
|
||||||
@@ -15,8 +14,9 @@ export function TodoApp(el) {
|
|||||||
|
|
||||||
el.innerHTML = /* html */ `
|
el.innerHTML = /* html */ `
|
||||||
<header class="app-header">
|
<header class="app-header">
|
||||||
<h1 class="title">VANILLA TODO</h1>
|
<h1 class="title">
|
||||||
<p class="app-fps fps"></p>
|
VANILLA TODO
|
||||||
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="todo-frame -days"></div>
|
<div class="todo-frame -days"></div>
|
||||||
<div class="app-collapsible">
|
<div class="app-collapsible">
|
||||||
@@ -31,7 +31,7 @@ export function TodoApp(el) {
|
|||||||
</div>
|
</div>
|
||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
<p>
|
<p>
|
||||||
VANILLA TODO © 2020–2023 <a href="https://morrisbrodersen.de">Morris Brodersen</a>
|
VANILLA TODO © 2020–2024 <a href="https://morrisbrodersen.de">Morris Brodersen</a>
|
||||||
— A case study on viable techniques for vanilla web development.
|
— A case study on viable techniques for vanilla web development.
|
||||||
<a href="https://github.com/morris/vanilla-todo">About →</a>
|
<a href="https://github.com/morris/vanilla-todo">About →</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -47,7 +47,6 @@ export function TodoApp(el) {
|
|||||||
|
|
||||||
el.querySelectorAll('.app-collapsible').forEach(AppCollapsible);
|
el.querySelectorAll('.app-collapsible').forEach(AppCollapsible);
|
||||||
el.querySelectorAll('.app-icon').forEach(AppIcon);
|
el.querySelectorAll('.app-icon').forEach(AppIcon);
|
||||||
el.querySelectorAll('.app-fps').forEach(AppFps);
|
|
||||||
|
|
||||||
TodoFrameDays(el.querySelector('.todo-frame.-days'));
|
TodoFrameDays(el.querySelector('.todo-frame.-days'));
|
||||||
TodoFrameCustom(el.querySelector('.todo-frame.-custom'));
|
TodoFrameCustom(el.querySelector('.todo-frame.-custom'));
|
||||||
|
@@ -6,15 +6,7 @@
|
|||||||
.app-header > .title {
|
.app-header > .title {
|
||||||
color: var(--header-text);
|
color: var(--header-text);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
line-height: 1.25em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
text-align: center;
|
||||||
|
|
||||||
.app-header > .fps {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 20px;
|
|
||||||
margin: 0;
|
|
||||||
font-size: 0.8em;
|
|
||||||
line-height: 1.5em;
|
|
||||||
color: var(--header-text);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,18 @@
|
|||||||
.app-icon {
|
.app-icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: text-top;
|
vertical-align: baseline;
|
||||||
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-icon > svg {
|
.app-icon > svg {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
vertical-align: bottom;
|
vertical-align: middle;
|
||||||
fill: currentcolor;
|
fill: currentcolor;
|
||||||
transition: transform 0.1s ease-out;
|
transition: transform 0.1s ease-out;
|
||||||
|
position: relative;
|
||||||
|
top: -0.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-icon.-r180 > svg {
|
.app-icon.-r180 > svg {
|
||||||
|
Reference in New Issue
Block a user