/** * rgui lane — pure helpers for folder-tree auto-fold. * * Design: TODO.md「folder tree の auto-fold — 動的空間の fold 規則」. * The fold ladder per directory, fine→coarse, chosen by the rg-merge rule * (finest representation whose cells stay ≥ 1rem on screen): * * list → grid (rows = index chunks, columns = kind buckets, heat cells) * → strip (too small for even one readable grid row) * * Everything here is pure geometry/classification — no I/O, no canvas — * so tree.ts can consume it from a single layout choke point and tests * can cover thresholds directly. */ /** always-available column vocabulary — the tree analog of dayparts */ export type KindBucket = "dir" | "code" | "data" | "doc" | "media" | "other"; export declare const KIND_ORDER: readonly KindBucket[]; /** short column captions for the pseudo-x-axis (like SMTWTFS) */ export declare const KIND_LABEL: Record; /** column base hues — identity rides on hue, magnitude on lightness */ export declare const KIND_COLOR: Record; /** classify an entry into its grid column */ export declare function kindOf(name: string, isDir: boolean): KindBucket; /** per-kind entry counts for one grid row (immediate entries only — * subtree aggregates are async decoration, never layout inputs) */ export declare function kindCounts(entries: readonly { name: string; isDir: boolean; }[]): Record; export interface SchemaMember { name: string; complete: boolean; children: readonly { name: string; isDir: boolean; }[]; } export interface SchemaColumn { name: string; support: number; votes: number; } export interface SchemaColumns { columns: readonly SchemaColumn[]; memberCount: number; } export interface SchemaRegistryColumn extends SchemaColumn { ghost: boolean; } export interface SchemaRegistry { columns: readonly SchemaRegistryColumn[]; memberCount: number; } export interface DetectSchemaOptions { maxColumns: number; minSupport: number; minMembers: number; } /** Detect a deterministic Jaccard cluster and its supported child names. */ export declare function detectSchema(members: readonly SchemaMember[], options: DetectSchemaOptions): SchemaColumns | null; /** Append-only column ordering for one consumer-owned epoch. */ export declare function updateSchemaRegistry(prev: SchemaRegistry | null, detected: SchemaColumns): SchemaRegistry; /** * one grid row covering entries [start, end) — indices into the CHILD * ORDER, so every row maps to a contiguous world span (hit-test relies * on this; the analog of decimal decade rows). */ export interface ChunkRow { start: number; end: number; label: string; } /** * split `names` (in child order) into ≤ maxRows near-equal contiguous * chunks. A single-entry chunk is labeled by its full name; a multi-entry * chunk by its first name + "…" — a position hint into the (possibly * unsorted) child order, where an "a–c" range would read backwards. */ export declare function chunkRows(names: readonly string[], maxRows: number): ChunkRow[]; export type TreeFoldMode = { mode: "list"; } | { mode: "grid"; rows: number; } | { mode: "strip"; }; /** * pick the finest readable representation for `childCount` entries in a * band of `bandPx` × `widthPx`. Each boundary has its own readability * unit so callers can apply hysteresis PER BOUNDARY (0.8×rem to stay in * the current mode, 1.25×rem to enter a finer one — list↔grid and * grid↔strip flap independently otherwise). `minShare` is the smallest * child's fraction of the band (defaults to equal shares): list mode * requires the SMALLEST child row readable, not the average. */ export declare function chooseTreeFold(childCount: number, bandPx: number, widthPx: number, listUnitPx: number, minShare?: number, gridUnitPx?: number, gridBandPx?: number): TreeFoldMode; /** * quantized structural weight from a byte size — log2 KB buckets so tiny * size fluctuations never move layout (a bucket jump is a real change). * Unknown size → 1 (equal share), the no-false-precision default. */ export declare function bucketWeight(bytes: number | undefined): number; /** normalize weights into interval shares summing to exactly 1 */ export declare function shareIntervals(weights: readonly number[]): number[]; /** * structural level per line, for zoom-progressive disclosure: level-0 lines * surface first, deeper levels as space grows. Markdown uses its native * heading ladder (# → 0, ## → 1, …; body text never surfaces early). * Everything else uses indentation — the cheap universal proxy for * structure — with the indent unit inferred from the file itself. * Blank lines and non-heading md lines get NO_LEVEL. */ export declare const NO_LEVEL = 99; export declare function contentLevels(lines: readonly string[], isMarkdown: boolean): number[]; /** * deepest structural level whose lines still fit the label budget — the * ≥1rem rule turned inward: reveal level L+1 only once every line of * level ≤ L+1 in the window can afford a readable label. */ export declare function discloseLevel(levels: readonly number[], i0: number, i1: number, budget: number): number; /** hand-rolled sRGB hex → OKLCH (cached; same math as timeline.ts) */ export declare function srgbToOklch(hex: string): { L: number; C: number; H: number; }; /** * heat-cell fill: base hue carries identity, an OKLCH lightness ramp on a * fixed log2 ladder (1,2,4,8,16+) carries magnitude — scrolling never * re-normalizes, and magnitude never rides on hue (CVD-safe). */ export declare function heatRampColor(baseHex: string, count: number, dark: boolean): string; //# sourceMappingURL=treefold.d.ts.map