various css optimizations
All checks were successful
/ depoly (push) Successful in 1m18s

This commit is contained in:
thislight 2024-10-30 13:22:00 +08:00
parent b7531864d2
commit 9e97f9b611
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E
4 changed files with 9 additions and 17 deletions

View file

@ -168,6 +168,8 @@ const Home: ParentComponent = (props) => {
padding: 0 16px; padding: 0 16px;
scroll-snap-align: center; scroll-snap-align: center;
overscroll-behavior-block: none; overscroll-behavior-block: none;
contain: strict;
contain-intrinsic-size: 100% 100%;
@media (max-width: 600px) { @media (max-width: 600px) {
padding: 0; padding: 0;
@ -186,6 +188,10 @@ const Home: ParentComponent = (props) => {
padding-left: var(--safe-area-inset-left, 0); padding-left: var(--safe-area-inset-left, 0);
padding-right: var(--safe-area-inset-right, 0); padding-right: var(--safe-area-inset-right, 0);
& > * {
content-visibility: auto;
}
@media (max-width: 600px) { @media (max-width: 600px) {
grid-auto-columns: 100%; grid-auto-columns: 100%;
} }

View file

@ -5,18 +5,15 @@ import {
ErrorBoundary, ErrorBoundary,
type Ref, type Ref,
createSelector, createSelector,
createRenderEffect,
} from "solid-js"; } from "solid-js";
import { type mastodon } from "masto"; import { type mastodon } from "masto";
import { vibrate } from "../platform/hardware"; import { vibrate } from "../platform/hardware";
import Thread from "./Thread.jsx"; import Thread from "./Thread.jsx";
import { useDefaultSession } from "../masto/clients"; import { useDefaultSession } from "../masto/clients";
import { useHeroSignal, useHeroSource } from "../platform/anim"; import { useHeroSource } from "../platform/anim";
import { HERO as BOTTOM_SHEET_HERO } from "../material/BottomSheet"; import { HERO as BOTTOM_SHEET_HERO } from "../material/BottomSheet";
import { setCache as setTootBottomSheetCache } from "./TootBottomSheet"; import { setCache as setTootBottomSheetCache } from "./TootBottomSheet";
import { useNavigate } from "@solidjs/router"; import { useNavigate } from "@solidjs/router";
import { createElementSize } from "@solid-primitives/resize-observer";
import "./toot-list.css"
const TootList: Component<{ const TootList: Component<{
ref?: Ref<HTMLDivElement>; ref?: Ref<HTMLDivElement>;
@ -113,22 +110,13 @@ const TootList: Component<{
openFullScreenToot(status, element, true); openFullScreenToot(status, element, true);
}; };
const listenElementHeight = (
e: HTMLElement,
updateHeight: (height: number) => void,
) => {
const size = createElementSize(e);
createRenderEffect(() => updateHeight(size.height));
};
return ( return (
<ErrorBoundary <ErrorBoundary
fallback={(err, reset) => { fallback={(err, reset) => {
return <p>Oops: {String(err)}</p>; return <p>Oops: {String(err)}</p>;
}} }}
> >
<div ref={props.ref}> <div ref={props.ref} class="toot-list">
<For each={props.threads}> <For each={props.threads}>
{(itemId, index) => { {(itemId, index) => {
const path = props.onUnknownThread(itemId)!; const path = props.onUnknownThread(itemId)!;

View file

@ -1,3 +0,0 @@
.toot-list * {
content-visibility: auto;
}

View file

@ -243,6 +243,7 @@
border: 1px solid var(--tutu-color-surface-d); border: 1px solid var(--tutu-color-surface-d);
transition: outline-width 60ms var(--tutu-anim-curve-std), border-color 60ms var(--tutu-anim-curve-std); transition: outline-width 60ms var(--tutu-anim-curve-std), border-color 60ms var(--tutu-anim-curve-std);
contain: strict; contain: strict;
content-visibility: auto;
&:hover, &:hover,
&:focus-visible { &:focus-visible {