treefmt: apply prettier
Pure `nix fmt` output from the commit before this one — no hand edits. 203 files: 52 md, 42 tsx, 32 js, 32 css, 21 ts, 13 html, 8 json, 3 mjs. Reproduce with `nix develop -c nix fmt` on the parent commit; the result should be byte-identical to this tree. None of the 13 `.prettierignore` entries appears here — verified by intersecting the changed-file list against the ignore file, with a control proving the intersection finds a match when one exists.
This commit is contained in:
parent
5d24bedd60
commit
39b95c2ede
203 changed files with 10090 additions and 6085 deletions
|
|
@ -4,27 +4,27 @@
|
|||
// `'default'` (everything else) — two is enough for every real caller
|
||||
// so far; a third reading gets added the day something needs it, not
|
||||
// speculatively.
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './Button.css';
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./Button.css";
|
||||
|
||||
export type ButtonVariant = 'primary' | 'default';
|
||||
export type ButtonVariant = "primary" | "default";
|
||||
|
||||
export function Button({
|
||||
variant = 'default',
|
||||
type = 'button',
|
||||
variant = "default",
|
||||
type = "button",
|
||||
disabled,
|
||||
onClick,
|
||||
children,
|
||||
}: {
|
||||
variant?: ButtonVariant;
|
||||
type?: 'button' | 'submit';
|
||||
type?: "button" | "submit";
|
||||
disabled?: boolean;
|
||||
onClick?: (e: Event) => void;
|
||||
children: ComponentChildren;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
class={'ui-button ui-button-' + variant}
|
||||
class={"ui-button ui-button-" + variant}
|
||||
type={type}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
// from its former life as a standalone route — reusing that unchanged
|
||||
// is simpler and lower-risk than re-deriving a modal-specific layout
|
||||
// for content mara has already reviewed).
|
||||
import { useEffect, useRef } from 'preact/hooks';
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './Dialog.css';
|
||||
import { useEffect, useRef } from "preact/hooks";
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./Dialog.css";
|
||||
|
||||
export function Dialog({
|
||||
open,
|
||||
|
|
@ -50,8 +50,8 @@ export function Dialog({
|
|||
function handleClose() {
|
||||
onClose();
|
||||
}
|
||||
el.addEventListener('close', handleClose);
|
||||
return () => el.removeEventListener('close', handleClose);
|
||||
el.addEventListener("close", handleClose);
|
||||
return () => el.removeEventListener("close", handleClose);
|
||||
}, [onClose]);
|
||||
|
||||
return (
|
||||
|
|
@ -67,7 +67,12 @@ export function Dialog({
|
|||
if (e.target === ref.current) onClose();
|
||||
}}
|
||||
>
|
||||
<button type="button" class="ui-dialog-close" aria-label="close" onClick={onClose}>
|
||||
<button
|
||||
type="button"
|
||||
class="ui-dialog-close"
|
||||
aria-label="close"
|
||||
onClick={onClose}
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
<div class="ui-dialog-body">{children}</div>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
// don't each reinvent the label/spacing chrome; a bare labelled `<div>`
|
||||
// wrapper has no independent identity worth a `/components` entry of
|
||||
// its own.
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './FormField.css';
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./FormField.css";
|
||||
|
||||
export function FormField({
|
||||
label,
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
// hardcoding. `aria-hidden` — decorative only, the title text still
|
||||
// carries the actual label, so this never becomes a second source of
|
||||
// truth an assistive-tech user has to parse.
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './Panel.css';
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./Panel.css";
|
||||
|
||||
export function Panel({
|
||||
title,
|
||||
|
|
|
|||
|
|
@ -25,19 +25,19 @@
|
|||
// own fetch callback, and it's the CALLER's job to make sure that
|
||||
// callback doesn't clobber an input the operator is mid-edit on — this
|
||||
// hook only decides *when* to call it.
|
||||
import { useEffect, useRef } from 'preact/hooks';
|
||||
import './RefreshInterval.css';
|
||||
import { useEffect, useRef } from "preact/hooks";
|
||||
import "./RefreshInterval.css";
|
||||
|
||||
// `null` means "off" throughout this module — no separate boolean, so
|
||||
// there's exactly one way to represent "not polling".
|
||||
export type RefreshIntervalMs = number | null;
|
||||
|
||||
const PRESETS: { value: RefreshIntervalMs; label: string }[] = [
|
||||
{ value: null, label: 'off' },
|
||||
{ value: 5_000, label: '5s' },
|
||||
{ value: 10_000, label: '10s' },
|
||||
{ value: 30_000, label: '30s' },
|
||||
{ value: 60_000, label: '1m' },
|
||||
{ value: null, label: "off" },
|
||||
{ value: 5_000, label: "5s" },
|
||||
{ value: 10_000, label: "10s" },
|
||||
{ value: 30_000, label: "30s" },
|
||||
{ value: 60_000, label: "1m" },
|
||||
];
|
||||
|
||||
export function RefreshIntervalPicker({
|
||||
|
|
@ -94,7 +94,10 @@ export function RefreshIntervalPicker({
|
|||
// should default its own `intervalMs` state to a real cadence, not
|
||||
// `null`, and add a separate mount effect only if it genuinely wants
|
||||
// "off" to still mean "load once."
|
||||
export function useRefreshInterval(intervalMs: RefreshIntervalMs, onTick: () => void) {
|
||||
export function useRefreshInterval(
|
||||
intervalMs: RefreshIntervalMs,
|
||||
onTick: () => void,
|
||||
) {
|
||||
// Always-current via a ref rather than a `useEffect` dependency:
|
||||
// callers pass an inline closure that's a new value every render, and
|
||||
// depending on it directly would re-arm the timer (losing whatever's
|
||||
|
|
@ -118,15 +121,15 @@ export function useRefreshInterval(intervalMs: RefreshIntervalMs, onTick: () =>
|
|||
id = undefined;
|
||||
};
|
||||
|
||||
if (document.visibilityState === 'visible') start();
|
||||
if (document.visibilityState === "visible") start();
|
||||
const onVisibility = () => {
|
||||
if (document.visibilityState === 'visible') start();
|
||||
if (document.visibilityState === "visible") start();
|
||||
else stop();
|
||||
};
|
||||
document.addEventListener('visibilitychange', onVisibility);
|
||||
document.addEventListener("visibilitychange", onVisibility);
|
||||
return () => {
|
||||
stop();
|
||||
document.removeEventListener('visibilitychange', onVisibility);
|
||||
document.removeEventListener("visibilitychange", onVisibility);
|
||||
};
|
||||
}, [intervalMs]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
// running for no visible benefit, same instinct as the dashboard
|
||||
// package's matrix-rain effect — and resyncs immediately on becoming
|
||||
// visible again instead of waiting out the rest of a stale interval.
|
||||
import { useEffect, useState } from 'preact/hooks';
|
||||
import { fmtAgo } from '../../util.js';
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { fmtAgo } from "../../util.js";
|
||||
|
||||
// Cheap at the handful of rows/chips this renders for today, and coarse
|
||||
// enough to be correct without visibly ticking every frame — the same
|
||||
|
|
@ -31,15 +31,15 @@ export function RelativeTime({ epochMs }: { epochMs: number }) {
|
|||
id = undefined;
|
||||
};
|
||||
|
||||
if (document.visibilityState === 'visible') start();
|
||||
if (document.visibilityState === "visible") start();
|
||||
const onVisibility = () => {
|
||||
if (document.visibilityState === 'visible') start();
|
||||
if (document.visibilityState === "visible") start();
|
||||
else stop();
|
||||
};
|
||||
document.addEventListener('visibilitychange', onVisibility);
|
||||
document.addEventListener("visibilitychange", onVisibility);
|
||||
return () => {
|
||||
stop();
|
||||
document.removeEventListener('visibilitychange', onVisibility);
|
||||
document.removeEventListener("visibilitychange", onVisibility);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
// value/label pairs, not `ComponentChildren` — every real caller so far
|
||||
// has flat string options, and generic children would need a second
|
||||
// primitive (`SelectField.Option`) for zero real benefit today.
|
||||
import { FormField } from '../form-field/FormField.js';
|
||||
import { FormField } from "../form-field/FormField.js";
|
||||
|
||||
export interface SelectOption {
|
||||
value: string;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// a `<table>` doesn't shrink below its content's natural width on its
|
||||
// own, so without this the page itself would break, not just look
|
||||
// cramped.
|
||||
import type { ComponentChildren } from 'preact';
|
||||
import './Table.css';
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./Table.css";
|
||||
|
||||
export interface TableColumn<T> {
|
||||
key: string;
|
||||
|
|
@ -30,7 +30,7 @@ export interface TableColumn<T> {
|
|||
* sortable header renders is `aria-hidden` and carries no information
|
||||
* on its own.
|
||||
*/
|
||||
ariaSort?: 'ascending' | 'descending' | 'none';
|
||||
ariaSort?: "ascending" | "descending" | "none";
|
||||
}
|
||||
|
||||
export function Table<T>({
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
// of hand-rolling its own label/input pair. No textarea/multi-line
|
||||
// mode — promote that the day a real caller needs one, same "don't
|
||||
// build ahead of a caller" rule the rest of `ui/` follows.
|
||||
import { FormField } from '../form-field/FormField.js';
|
||||
import { FormField } from "../form-field/FormField.js";
|
||||
|
||||
export function TextField({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
onInput,
|
||||
type = 'text',
|
||||
type = "text",
|
||||
pattern,
|
||||
title,
|
||||
required,
|
||||
|
|
|
|||
Loading…
Reference in a new issue