Release 0.16.0: new look, search, remove files, easier deploy
Release / release (push) Successful in 4m33s
Release / release (push) Successful in 4m33s
- Dot-matrix "Creation of Adam" page banners behind a floating menu, glass cards and tables, library header with live stats, table toolbar with pagination, Cmd/Ctrl+K search across models, endpoints, runs, tags, settings and actions. - Remove single files from a model (selection + disk, via a worker job). - Containers start as root to prepare folders and drop to PUID:PGID; AUTH_SECRET is generated when unset; sandbox runs as nobody; KANAME_IMAGE and image docs in the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6bcb514e6
commit
5becfc47a0
53 files changed
+1869
-468
No files matched your search
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef } from "react";
|
||||
import { ADAM_DOTS, ADAM_H, ADAM_W } from "./adam-dots";
|
||||
|
||||
const SPACING = 6; // CSS px between dot centres
|
||||
const levels = Uint8Array.from(ADAM_DOTS, (c) => parseInt(c, 16));
|
||||
|
||||
/**
|
||||
* The Creation of Adam as a dot matrix. `view` is the horizontal slice of the painting (0–1) that
|
||||
* fills the box (at least covering it), placed so `focus` (the hands) lands at `anchor` (x, y as
|
||||
* fractions of the box) as far as the painting's edges allow. Dots use the element's text color; bright parts of the painting get big dots in
|
||||
* dark mode, dark parts in light mode, so it reads as the painting either way.
|
||||
*/
|
||||
export function DotPainting({
|
||||
className,
|
||||
view = 0.7,
|
||||
focus = [0.48, 0.42],
|
||||
anchor = [0.68, 0.5],
|
||||
}: {
|
||||
className?: string;
|
||||
view?: number;
|
||||
focus?: [number, number];
|
||||
anchor?: [number, number];
|
||||
}) {
|
||||
const ref = useRef<HTMLCanvasElement>(null);
|
||||
|
||||
const [fx, fy] = focus;
|
||||
const [ax, ay] = anchor;
|
||||
useEffect(() => {
|
||||
const canvas = ref.current;
|
||||
if (!canvas) return;
|
||||
const draw = () => {
|
||||
const { width, height } = canvas.getBoundingClientRect();
|
||||
if (!width || !height) return;
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
canvas.width = Math.round(width * dpr);
|
||||
canvas.height = Math.round(height * dpr);
|
||||
const g = canvas.getContext("2d")!;
|
||||
g.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
g.clearRect(0, 0, width, height);
|
||||
g.fillStyle = getComputedStyle(canvas).color;
|
||||
const dark = document.documentElement.classList.contains("dark");
|
||||
// CSS px per grid cell: `view` of the painting's width fills the box (at least covering it).
|
||||
const scale = Math.max(width / (view * ADAM_W), height / ADAM_H);
|
||||
const offX = ax * width - fx * ADAM_W * scale;
|
||||
const offY = ay * height - fy * ADAM_H * scale;
|
||||
const clampOff = (o: number, box: number, size: number) => Math.min(0, Math.max(box - size, o));
|
||||
const ox = clampOff(offX, width, ADAM_W * scale);
|
||||
const oy = clampOff(offY, height, ADAM_H * scale);
|
||||
const maxR = SPACING * 0.48;
|
||||
for (let y = SPACING / 2; y < height; y += SPACING) {
|
||||
const iy = Math.min(ADAM_H - 1, Math.max(0, Math.floor((y - oy) / scale)));
|
||||
for (let x = SPACING / 2; x < width; x += SPACING) {
|
||||
const ix = Math.min(ADAM_W - 1, Math.max(0, Math.floor((x - ox) / scale)));
|
||||
const v = levels[iy * ADAM_W + ix] / 15;
|
||||
const r = maxR * (dark ? v : 1 - v);
|
||||
if (r < 0.35) continue;
|
||||
g.beginPath();
|
||||
g.arc(x, y, r, 0, Math.PI * 2);
|
||||
g.fill();
|
||||
}
|
||||
}
|
||||
};
|
||||
draw();
|
||||
const resize = new ResizeObserver(draw);
|
||||
resize.observe(canvas);
|
||||
// next-themes switches the class on <html>.
|
||||
const theme = new MutationObserver(draw);
|
||||
theme.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
|
||||
return () => {
|
||||
resize.disconnect();
|
||||
theme.disconnect();
|
||||
};
|
||||
}, [view, fx, fy, ax, ay]);
|
||||
|
||||
return <canvas ref={ref} aria-hidden className={className} />;
|
||||
}
|
||||
Reference in new issue
Block a user