@devries-cameron20 / t3code Mirror · read-only / commits / 49b0f9683c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 03:00 UTC

perf(web): HTML renders drop the loading skeleton (#21480)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>

maria committed Oct 19, 2026 at 04:15 UTC 49b0f9683c27f62ceefb8b9d45768d069ed50833
8 files changed +10 -330
apps/server/src/htmlRender/HtmlRender.test.ts
-1
@@ -446,7 +446,6 @@ describe("HtmlRender", () => {
446 expect(reference.heights).toEqual(
447 HTML_RENDER_MEASURE_WIDTHS.map((width) => [width, Math.ceil(width / 2)]),
448 );
449 - expect(reference.outline).toBe("m0,0,182,91,1");
449 }).pipe(Effect.provide(layerHtmlRender(executable)));
450 }),
451 30_000,
apps/server/src/htmlRender/HtmlRender.ts
+4 -5
@@ -345,7 +345,7 @@ const make = Effect.gen(function* () {
345 Effect.gen(function* () {
346 const executable = yield* previewBrowser.installed;
347 if (Option.isNone(executable)) return undefined;
348 - const { heights, outline } = yield* launching(executable.value, (noSandbox) =>
348 + const heights = yield* launching(executable.value, (noSandbox) =>
349 HeadlessChrome.measureHtmlHeights({
350 executable: executable.value,
351 noSandbox,
@@ -364,7 +364,7 @@ const make = Effect.gen(function* () {
364 ),
365 }),
366 );
367 - return { heights: heights.toSorted(([left], [right]) => left - right), outline };
367 + return heights.toSorted(([left], [right]) => left - right);
368 }).pipe(
369 Effect.catch((cause) =>
370 Effect.logWarning("Could not measure an HTML render; publishing it without heights.", {
@@ -405,7 +405,7 @@ const make = Effect.gen(function* () {
405 if (attachmentId === null || filePath === null) {
406 return yield* new HtmlRenderStoreError({ cause: new Error("Invalid thread id.") });
407 }
408 - const measured = yield* fileSystem.writeFileString(filePath, html).pipe(
408 + const heights = yield* fileSystem.writeFileString(filePath, html).pipe(
409 Effect.mapError((cause) => new HtmlRenderStoreError({ cause })),
410 Effect.andThen(measure(html)),
411 // Only the returned reference lets thread deletion find the page, so a
@@ -416,8 +416,7 @@ const make = Effect.gen(function* () {
416 attachmentId,
417 title: input.title.trim().slice(0, HTML_RENDER_MAX_TITLE_LENGTH) || "HTML",
418 height: clampHtmlRenderHeight(input.height),
419 - ...(measured === undefined ? {} : { heights: measured.heights }),
420 - ...(measured?.outline === undefined ? {} : { outline: measured.outline }),
419 + ...(heights === undefined ? {} : { heights }),
420 } satisfies HtmlRenderReference;
421 });
422
apps/server/src/htmlRender/headlessChrome.ts
+3 -118
@@ -9,11 +9,6 @@ import * as Schema from "effect/Schema";
9 import * as Stream from "effect/Stream";
10 import * as ChildProcess from "effect/process/ChildProcess";
11 import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
12 -import {
13 - encodeHtmlRenderOutline,
14 - HTML_RENDER_COLUMN_WIDTH,
15 - HTML_RENDER_OUTLINE_MAX_BOXES,
16 -} from "@t3tools/shared/htmlRender";
12
13 import { publicProxy } from "./publicProxy.ts";
14
@@ -164,84 +159,6 @@ const SETTLE_EXPRESSION =
159 const MEASURE_EXPRESSION =
160 "(() => { const root = document.documentElement; return root.scrollHeight > root.clientHeight ? root.scrollHeight : root.getBoundingClientRect().height; })()";
161
167 -const OUTLINE_MAX_VISITS = 2_000;
168 -const OUTLINE_EXPRESSION = `(() => {
169 - const boxes = [], detail = ${HTML_RENDER_OUTLINE_MAX_BOXES - 12}, max = ${HTML_RENDER_OUTLINE_MAX_BOXES};
170 - const media = "canvas,svg,img,video,picture,iframe,object,embed,input,select,textarea,button";
171 - const pageBackground = getComputedStyle(document.documentElement).backgroundColor;
172 - const filled = (s) => (s.backgroundColor !== "rgba(0, 0, 0, 0)" && s.backgroundColor !== pageBackground) || s.backgroundImage !== "none" || parseFloat(s.borderTopWidth) + parseFloat(s.borderBottomWidth) + parseFloat(s.borderLeftWidth) > 0;
173 - const add = (kind, r, lines) => boxes.push([kind, r.left + scrollX, r.top + scrollY, r.width, r.height, lines]);
174 - const lineCount = (s, r) => Math.max(1, Math.round(r.height / (parseFloat(s.lineHeight) || parseFloat(s.fontSize) * 1.5 || 20)));
175 - // Text's own extent, so a short heading in a wide block stays short.
176 - const addText = (el, s, r) => {
177 - const range = document.createRange();
178 - range.selectNodeContents(el);
179 - const t = range.getBoundingClientRect();
180 - const box = t.width >= 2 && t.height >= 2 ? t : r;
181 - add("text", box, lineCount(s, box));
182 - };
183 - // Visits are capped too, so a huge generated DOM costs no more than a page.
184 - let full = false, visits = 0;
185 - // Whether an element holds text of its own, looking at its first few children only.
186 - const hasOwnText = (el) => {
187 - let n = el.firstChild;
188 - for (let i = 0; n && i < 64; n = n.nextSibling, i++) if (n.nodeType === 3 && n.data.trim() !== "") return true;
189 - return false;
190 - };
191 - const walk = (parent, ps) => {
192 - for (const el of parent.childNodes) {
193 - // The last slot is kept for whatever the outline has no room left for.
194 - if (boxes.length >= max - 1 || ++visits > ${OUTLINE_MAX_VISITS}) { full = true; return; }
195 - // Bare text only reaches here under body or a display: contents element.
196 - if (el.nodeType === 3) {
197 - if (el.data.trim() === "") continue;
198 - const range = document.createRange();
199 - range.selectNodeContents(el);
200 - const t = range.getBoundingClientRect();
201 - if (t.width >= 2 && t.height >= 2) add("text", t, lineCount(ps, t));
202 - continue;
203 - }
204 - if (el.nodeType !== 1) continue;
205 - const s = getComputedStyle(el);
206 - if (s.display === "none" || s.visibility === "hidden" || s.opacity === "0") continue;
207 - if (s.display === "contents") { walk(el, s); continue; }
208 - const r = el.getBoundingClientRect();
209 - // A zero-size box can still show positioned children, unless it clips them.
210 - if (r.width < 2 || r.height < 2) { if (s.overflow === "visible") walk(el, s); continue; }
211 - const tag = el.localName;
212 - if (el.matches(media)) { add("media", r, 1); continue; }
213 - if (tag === "table") { add("table", r, el.rows.length); continue; }
214 - const text = hasOwnText(el);
215 - if (boxes.length >= detail) { if (el.querySelector(media) || (!text && !el.firstElementChild)) add("media", r, 1); else addText(el, s, r); continue; }
216 - if (text) { addText(el, s, r); continue; }
217 - if (el.children.length === 0) { if (filled(s)) add("media", r, 1); continue; }
218 - walk(el, s);
219 - }
220 - };
221 - walk(document.body, getComputedStyle(document.body));
222 - if (full) {
223 - const top = Math.max(0, ...boxes.map((b) => b[2] + b[4]));
224 - const root = document.documentElement;
225 - const rest = (root.scrollHeight > root.clientHeight ? root.scrollHeight : root.getBoundingClientRect().height) - top;
226 - if (rest >= 8) boxes.push(["text", 0, top, document.documentElement.clientWidth, rest, Math.max(1, Math.round(rest / 28))]);
227 - }
228 - return boxes;
229 -})()`;
230 -const Outlined = Schema.Struct({
231 - result: Schema.Struct({
232 - value: Schema.Array(
233 - Schema.Tuple([
234 - Schema.Literals(["text", "media", "table"]),
235 - Schema.Finite,
236 - Schema.Finite,
237 - Schema.Finite,
238 - Schema.Finite,
239 - Schema.Finite,
240 - ]),
241 - ),
242 - }),
243 -});
244 -
162 const Ignored = Schema.Unknown;
163 const Navigation = Schema.Struct({ errorText: Schema.optional(Schema.String) });
164 const Measured = Schema.Struct({ result: Schema.Struct({ value: Schema.Finite }) });
@@ -601,27 +518,7 @@ const launchBrowser = Effect.fnUntraced(function* (input: {
518 Effect.ignore,
519 );
520
604 - const outline = send(
605 - "Runtime.evaluate",
606 - { expression: OUTLINE_EXPRESSION, returnByValue: true },
607 - Outlined,
608 - sessionId,
609 - ).pipe(
610 - Effect.map(({ result }) =>
611 - encodeHtmlRenderOutline(
612 - result.value.map(([kind, x, y, boxWidth, height, lines]) => ({
613 - kind,
614 - x,
615 - y,
616 - width: boxWidth,
617 - height,
618 - lines,
619 - })),
620 - ),
621 - ),
622 - );
623 -
624 - return { load, outline, screenshot, consoleMessages, close };
521 + return { load, screenshot, consoleMessages, close };
522 });
523
524 return { openPage };
@@ -692,27 +589,15 @@ export const measureHtmlHeights = Effect.fn("headlessChrome.measureHtmlHeights")
589 profileDirectory: path.join(directory, "profile"),
590 });
591 const body = pageBody(input.html);
695 - let outline: string | undefined;
696 - const heights = yield* Effect.forEach(
592 + return yield* Effect.forEach(
593 input.widths,
594 (width) =>
595 browser.openPage(width).pipe(
596 Effect.flatMap((page) =>
701 - page.load(body, input.urlFragment).pipe(
702 - Effect.tap(() =>
703 - width === HTML_RENDER_COLUMN_WIDTH
704 - ? page.outline.pipe(
705 - Effect.tap((value) => Effect.sync(() => (outline = value))),
706 - Effect.ignore,
707 - )
708 - : Effect.void,
709 - ),
710 - Effect.ensuring(page.close),
711 - ),
597 + page.load(body, input.urlFragment).pipe(Effect.ensuring(page.close)),
598 ),
599 Effect.map((height) => [width, height] as const),
600 ),
601 { concurrency: MEASURE_CONCURRENCY },
602 );
717 - return { heights, outline };
603 }, Effect.scoped);
apps/server/src/mcp/toolkits/html/tools.ts
-1
@@ -88,7 +88,6 @@ const HtmlRenderTool = Tool.make(HTML_RENDER_TOOL_NAME, {
88 title: Schema.String,
89 height: Schema.Number,
90 heights: Schema.optional(Schema.Array(Schema.Tuple([Schema.Int, Schema.Int]))),
91 - outline: Schema.optional(Schema.String),
91 }),
92 message: Schema.String,
93 }),
apps/web/src/components/chat/HtmlRenderFrame.tsx
+2 -90
@@ -3,19 +3,15 @@ import {
3 HTML_RENDER_COLUMN_WIDTH,
4 htmlRenderFileName,
5 htmlRenderFrameHeight,
6 - htmlRenderOutlineBoxes,
7 - type HtmlRenderOutlineBox,
6 type HtmlRenderReference,
7 } from "@t3tools/shared/htmlRender";
8 import { Maximize2Icon } from "lucide-react";
9 import { useEffect, useLayoutEffect, useRef, useState } from "react";
10
11 import { useAssetUrlRefresh, useAssetUrlState } from "~/assets/assetUrls";
14 -import { cn } from "~/lib/utils";
12
13 import { HtmlRenderDocument } from "../files/BrowserDocumentFrame";
14 import { Button } from "../ui/button";
18 -import { Skeleton } from "../ui/skeleton";
15 import { toastManager } from "../ui/toast";
16 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
17 import { HtmlRenderDialog } from "./HtmlRenderDialog";
@@ -58,12 +54,6 @@ export function HtmlRenderFrame(props: {
54 const [src, setSrc] = useState<string | null>(null);
55 const srcExpiresAt = useRef(0);
56 const [expandedSrc, setExpandedSrc] = useState<string | null>(null);
61 - const [ready, setReady] = useState(false);
62 - const showPage = () => setReady(true);
63 - const fitPage = (contentHeight: number) => {
64 - setContentHeight(contentHeight);
65 - setReady(true);
66 - };
57 const { onFullscreenChange } = props;
58 useEffect(() => {
59 if (expandedSrc === null) return;
@@ -101,25 +91,14 @@ export function HtmlRenderFrame(props: {
91
92 return (
93 <div ref={boxRef} className="group/html-render relative" style={{ height }}>
104 - {!ready && !failed ? (
105 - <HtmlRenderSkeleton
106 - title={title}
107 - height={height}
108 - outline={htmlRenderOutlineBoxes(props.htmlRender, width)}
109 - />
110 - ) : null}
94 {src !== null ? (
95 <>
96 <HtmlRenderDocument
97 src={src}
98 title={title}
99 threadRef={props.threadRef}
117 - className={cn(
118 - "block size-full motion-safe:transition-opacity motion-safe:duration-200",
119 - !ready && "opacity-0",
120 - )}
121 - onContentHeight={fitPage}
122 - onLoad={showPage}
100 + className="block size-full"
101 + onContentHeight={setContentHeight}
102 onFullscreenChange={onFullscreenChange}
103 />
104 <div className="absolute end-2 top-2 flex gap-1 opacity-0 transition-opacity duration-150 focus-within:opacity-100 group-hover/html-render:opacity-100 pointer-coarse:opacity-100">
@@ -168,70 +147,3 @@ export function HtmlRenderFrame(props: {
147 </div>
148 );
149 }
171 -
172 -const SKELETON_SECTION_HEIGHT = 264;
173 -
174 -const OUTLINE_BOX_CLASS = {
175 - media: "rounded-lg bg-muted-foreground/15",
176 - text: "",
177 - table: "",
178 -} as const;
179 -
180 -const OUTLINE_BAR = "color-mix(in srgb, var(--color-muted-foreground) 15%, transparent)";
181 -
182 -function outlineBoxStyle(box: HtmlRenderOutlineBox): React.CSSProperties {
183 - const style: React.CSSProperties = {
184 - left: box.x,
185 - top: box.y,
186 - width: box.width,
187 - height: box.height,
188 - };
189 - if (box.kind !== "text" && box.kind !== "table") return style;
190 - const step = box.height / box.lines;
191 - const bar = Math.min(box.kind === "table" ? 12 : 10, step * 0.6);
192 - const start = (step - bar) / 2;
193 - return {
194 - ...style,
195 - backgroundImage: `repeating-linear-gradient(to bottom, transparent 0 ${start}px, ${OUTLINE_BAR} ${start}px ${start + bar}px, transparent ${start + bar}px ${step}px)`,
196 - };
197 -}
198 -
199 -function HtmlRenderSkeleton(props: {
200 - readonly title: string;
201 - readonly height: number;
202 - readonly outline: ReadonlyArray<HtmlRenderOutlineBox>;
203 -}) {
204 - if (props.outline.length > 0) {
205 - return (
206 - <div
207 - role="status"
208 - aria-label={`Loading ${props.title}`}
209 - className="pointer-events-none absolute inset-0 overflow-hidden motion-safe:animate-skeleton"
210 - >
211 - {props.outline.map((box) => (
212 - <div
213 - key={`${box.kind}:${box.x}:${box.y}:${box.width}:${box.height}`}
214 - className={cn("absolute", OUTLINE_BOX_CLASS[box.kind])}
215 - style={outlineBoxStyle(box)}
216 - />
217 - ))}
218 - </div>
219 - );
220 - }
221 - const sections = Math.ceil(props.height / SKELETON_SECTION_HEIGHT);
222 - return (
223 - <div
224 - role="status"
225 - aria-label={`Loading ${props.title}`}
226 - className="pointer-events-none absolute inset-0 flex flex-col gap-6 overflow-hidden pt-1"
227 - >
228 - {Array.from({ length: sections }, (_, index) => (
229 - <div key={index} className="flex shrink-0 flex-col gap-2">
230 - <Skeleton className="h-4 w-2/5" />
231 - <Skeleton className="h-3 w-3/5" />
232 - <Skeleton shape="card" className="mt-2 h-40 w-full" />
233 - </div>
234 - ))}
235 - </div>
236 - );
237 -}
apps/web/src/components/files/BrowserDocumentFrame.tsx
-3
@@ -115,8 +115,6 @@ export function HtmlRenderDocument(props: {
115 readonly onContentHeight?: (height: number) => void;
116 /** Reports the image viewer opening and closing, so a virtualized row can stay mounted. */
117 readonly onFullscreenChange?: ((fullscreen: boolean) => void) | undefined;
118 - /** Called when the page has loaded. */
119 - readonly onLoad?: () => void;
118 }) {
119 const theme = useHtmlRenderTheme();
120 const frameRef = useRef<HTMLIFrameElement>(null);
@@ -300,7 +298,6 @@ export function HtmlRenderDocument(props: {
298 // Covers a theme change that landed while the page was loading.
299 postTheme();
300 postShortcuts();
303 - props.onLoad?.();
301 }}
302 // A frame whose color scheme differs from its document's paints an opaque
303 // canvas, so the blank document a frame starts with would flash white in
packages/shared/src/htmlRender.test.ts
-47
@@ -1,10 +1,8 @@
1 import { describe, expect, it } from "vite-plus/test";
2
3 import {
4 - encodeHtmlRenderOutline,
4 HTML_RENDER_MAX_HEIGHT,
5 htmlRenderFrameHeight,
7 - htmlRenderOutlineBoxes,
6 htmlRenderReferencesEqual,
7 htmlRenderTheme,
8 htmlRenderThemeFragment,
@@ -290,48 +288,3 @@ describe("htmlRenderFrameHeight", () => {
288 expect(htmlRenderReferencesEqual(measured, { ...copy, heights: [[390, 1290]] })).toBe(false);
289 });
290 });
293 -
294 -describe("htmlRenderOutlineBoxes", () => {
295 - const outline = encodeHtmlRenderOutline([
296 - { kind: "text", x: 0, y: 0, width: 300, height: 40, lines: 2 },
297 - { kind: "media", x: 0, y: 48, width: 728, height: 300, lines: 1 },
298 - { kind: "media", x: 2, y: 2, width: 0, height: 10, lines: 1 },
299 - ]);
300 - const outlined = readHtmlRenderReference({
301 - ...reference,
302 - heights: [
303 - [364, 1600],
304 - [728, 800],
305 - ],
306 - outline,
307 - })!;
308 -
309 - it("round-trips through a tool result and stretches to the client's width and height", () => {
310 - expect(outline).toBe("t0,0,75,10,2;m0,12,182,75,1");
311 - expect(htmlRenderOutlineBoxes(outlined, 728)).toEqual([
312 - { kind: "text", x: 0, y: 0, width: 300, height: 40, lines: 2 },
313 - { kind: "media", x: 0, y: 48, width: 728, height: 300, lines: 1 },
314 - ]);
315 - expect(htmlRenderOutlineBoxes(outlined, 364)[1]).toEqual({
316 - kind: "media",
317 - x: 0,
318 - y: 96,
319 - width: 364,
320 - height: 600,
321 - lines: 1,
322 - });
323 - });
324 -
325 - it("drops a malformed or unmeasured outline", () => {
326 - expect(readHtmlRenderReference({ ...outlined, outline: "x1,2" })?.outline).toBeUndefined();
327 - expect(
328 - readHtmlRenderReference({ ...outlined, outline: "t0,0,10,10,0" })?.outline,
329 - ).toBeUndefined();
330 - expect(
331 - readHtmlRenderReference({ ...outlined, outline: "m0,0,0,10,1" })?.outline,
332 - ).toBeUndefined();
333 - expect(readHtmlRenderReference({ ...reference, outline })?.outline).toBeUndefined();
334 - expect(htmlRenderOutlineBoxes(reference, 728)).toEqual([]);
335 - expect(htmlRenderReferencesEqual(outlined, { ...outlined, outline: "m0,0,1,1,1" })).toBe(false);
336 - });
337 -});
packages/shared/src/htmlRender.ts
+1 -65
@@ -16,7 +16,6 @@ export interface HtmlRenderReference {
16 readonly title: string;
17 readonly height: number;
18 readonly heights?: ReadonlyArray<readonly [width: number, height: number]>;
19 - readonly outline?: string;
19 }
20
21 export const HTML_RENDER_MEASURE_WIDTHS = [320, 375, 430, 520, 640, 728, 860, 1000, 1144] as const;
@@ -47,7 +46,7 @@ function readMeasuredHeights(value: unknown) {
46
47 export function readHtmlRenderReference(value: unknown): HtmlRenderReference | undefined {
48 if (typeof value !== "object" || value === null) return undefined;
50 - const { attachmentId, title, height, heights, outline } = value as Record<string, unknown>;
49 + const { attachmentId, title, height, heights } = value as Record<string, unknown>;
50 if (
51 typeof attachmentId !== "string" ||
52 attachmentId.length === 0 ||
@@ -64,9 +63,6 @@ export function readHtmlRenderReference(value: unknown): HtmlRenderReference | u
63 title: title.trim().slice(0, HTML_RENDER_MAX_TITLE_LENGTH) || "HTML",
64 height: clampHtmlRenderHeight(height),
65 ...(measured === undefined ? {} : { heights: measured }),
67 - ...(measured !== undefined && typeof outline === "string" && OUTLINE_PATTERN.test(outline)
68 - ? { outline }
69 - : {}),
66 };
67 }
68
@@ -75,7 +71,6 @@ export function htmlRenderReferencesEqual(left: HtmlRenderReference, right: Html
71 left.attachmentId === right.attachmentId &&
72 left.title === right.title &&
73 left.height === right.height &&
78 - left.outline === right.outline &&
74 (left.heights ?? []).length === (right.heights ?? []).length &&
75 (left.heights ?? []).every(
76 ([width, height], index) =>
@@ -113,65 +108,6 @@ export function htmlRenderFrameHeight(
108 return clampHtmlRenderHeight(Math.min(cap, contentHeight ?? measuredHeight(heights, width)));
109 }
110
116 -export interface HtmlRenderOutlineBox {
117 - readonly kind: "text" | "media" | "table";
118 - readonly x: number;
119 - readonly y: number;
120 - readonly width: number;
121 - readonly height: number;
122 - readonly lines: number;
123 -}
124 -
125 -const OUTLINE_KINDS = { t: "text", m: "media", g: "table" } as const;
126 -const OUTLINE_LETTERS = { text: "t", media: "m", table: "g" } as const;
127 -const OUTLINE_UNIT = 4;
128 -export const HTML_RENDER_OUTLINE_MAX_BOXES = 48;
129 -const OUTLINE_BOX = "[tmg]\\d{1,4},\\d{1,4},[1-9]\\d{0,3},[1-9]\\d{0,3},[1-9]\\d{0,2}";
130 -const OUTLINE_PATTERN = new RegExp(
131 - `^${OUTLINE_BOX}(?:;${OUTLINE_BOX}){0,${HTML_RENDER_OUTLINE_MAX_BOXES - 1}}$`,
132 -);
133 -
134 -export function encodeHtmlRenderOutline(
135 - boxes: ReadonlyArray<HtmlRenderOutlineBox>,
136 -): string | undefined {
137 - const unit = (value: number) => Math.min(9_999, Math.max(0, Math.round(value / OUTLINE_UNIT)));
138 - const encoded = boxes
139 - .slice(0, HTML_RENDER_OUTLINE_MAX_BOXES)
140 - .flatMap((box) =>
141 - unit(box.width) > 0 && unit(box.height) > 0
142 - ? [
143 - `${OUTLINE_LETTERS[box.kind]}${unit(box.x)},${unit(box.y)},${unit(box.width)},${unit(box.height)},${Math.min(999, Math.max(1, Math.round(box.lines)))}`,
144 - ]
145 - : [],
146 - )
147 - .join(";");
148 - return encoded === "" ? undefined : encoded;
149 -}
150 -
151 -export function htmlRenderOutlineBoxes(
152 - reference: HtmlRenderReference,
153 - width: number,
154 -): ReadonlyArray<HtmlRenderOutlineBox> {
155 - const heights = reference.heights;
156 - if (reference.outline === undefined || heights === undefined || heights.length === 0) return [];
157 - const scaleX = width / HTML_RENDER_COLUMN_WIDTH;
158 - const scaleY = measuredHeight(heights, width) / measuredHeight(heights, HTML_RENDER_COLUMN_WIDTH);
159 - return reference.outline.split(";").map((entry) => {
160 - const [x = 0, y = 0, boxWidth = 0, boxHeight = 0, lines = 1] = entry
161 - .slice(1)
162 - .split(",")
163 - .map(Number);
164 - return {
165 - kind: OUTLINE_KINDS[entry[0] as keyof typeof OUTLINE_KINDS],
166 - x: x * OUTLINE_UNIT * scaleX,
167 - y: y * OUTLINE_UNIT * scaleY,
168 - width: boxWidth * OUTLINE_UNIT * scaleX,
169 - height: boxHeight * OUTLINE_UNIT * scaleY,
170 - lines,
171 - };
172 - });
173 -}
174 -
111 export function htmlRenderFileName(title: string) {
112 const name = title
113 .replace(/[\\/:*?"<>|\p{Cc}]+/gu, " ")