Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- The personal page loads faster and costs the router less: its script and styles come compressed, stay in the browser until the next update, and the icon comes with the page instead of a request of its own - The page uses the system's own font (SF Pro on Apple devices, Segoe UI on Windows, Roboto on Android) instead of downloading one - The top of the page shows the server's name alone, so it fits on a phone - Text can be selected only where it is there to be copied (addresses, file names, the configuration), with the name field's own selection: a soft highlight with handles that glides after the pointer - Sheets scroll without a scrollbar - Red buttons (Remove) light up under the pointer, as the others do - Demo: "Demo" and GitHub are one button; on a phone it floats at the bottom of the screen, and switching scenarios no longer makes the edge fades jump
31 lines
940 B
TypeScript
31 lines
940 B
TypeScript
// Just enough of LuCI's E() and Node for modules that build elements, in Node.
|
|
|
|
class FakeNode {}
|
|
|
|
export class El extends FakeNode {
|
|
children: (El | string)[] = [];
|
|
constructor(
|
|
public tag: string,
|
|
public attrs: Record<string, unknown> = {},
|
|
children: (El | string)[] = [],
|
|
) {
|
|
super();
|
|
this.children = [...children];
|
|
}
|
|
appendChild<T extends El | string>(c: T): T {
|
|
this.children.push(c);
|
|
return c;
|
|
}
|
|
get textContent(): string {
|
|
return this.children.map((c) => (typeof c === 'string' ? c : c.textContent)).join('');
|
|
}
|
|
}
|
|
|
|
export const text = (nodes: unknown[]) => nodes.map((n) => (typeof n === 'string' ? n : (n as El).textContent)).join('');
|
|
|
|
export function installFakeDom() {
|
|
const g = globalThis as unknown as Record<string, unknown>;
|
|
g.Node = FakeNode;
|
|
g.window = { E: (tag: string, attrs: Record<string, unknown>, children: (El | string)[]) => new El(tag, attrs, children) };
|
|
}
|