chore(ts): use source import extensions

This commit is contained in:
Armin Ronacher
2026-05-20 00:04:03 +02:00
parent 06c6c324d7
commit ae9450dc51
259 changed files with 1483 additions and 1300 deletions

View File

@@ -1,5 +1,5 @@
import type { Component } from "../tui.js";
import { applyBackgroundToLine, visibleWidth } from "../utils.js";
import type { Component } from "../tui.ts";
import { applyBackgroundToLine, visibleWidth } from "../utils.ts";
type RenderCache = {
childLines: string[];

View File

@@ -1,5 +1,5 @@
import { getKeybindings } from "../keybindings.js";
import { Loader } from "./loader.js";
import { getKeybindings } from "../keybindings.ts";
import { Loader } from "./loader.ts";
/**
* Loader that can be cancelled with Escape.

View File

@@ -1,11 +1,11 @@
import type { AutocompleteProvider, AutocompleteSuggestions } from "../autocomplete.js";
import { getKeybindings } from "../keybindings.js";
import { decodePrintableKey, matchesKey } from "../keys.js";
import { KillRing } from "../kill-ring.js";
import { type Component, CURSOR_MARKER, type Focusable, type TUI } from "../tui.js";
import { UndoStack } from "../undo-stack.js";
import { getSegmenter, isPunctuationChar, isWhitespaceChar, truncateToWidth, visibleWidth } from "../utils.js";
import { SelectList, type SelectListLayoutOptions, type SelectListTheme } from "./select-list.js";
import type { AutocompleteProvider, AutocompleteSuggestions } from "../autocomplete.ts";
import { getKeybindings } from "../keybindings.ts";
import { decodePrintableKey, matchesKey } from "../keys.ts";
import { KillRing } from "../kill-ring.ts";
import { type Component, CURSOR_MARKER, type Focusable, type TUI } from "../tui.ts";
import { UndoStack } from "../undo-stack.ts";
import { getSegmenter, isPunctuationChar, isWhitespaceChar, truncateToWidth, visibleWidth } from "../utils.ts";
import { SelectList, type SelectListLayoutOptions, type SelectListTheme } from "./select-list.ts";
const baseSegmenter = getSegmenter();

View File

@@ -6,8 +6,8 @@ import {
type ImageDimensions,
imageFallback,
renderImage,
} from "../terminal-image.js";
import type { Component } from "../tui.js";
} from "../terminal-image.ts";
import type { Component } from "../tui.ts";
export interface ImageTheme {
fallbackColor: (str: string) => string;

View File

@@ -1,9 +1,9 @@
import { getKeybindings } from "../keybindings.js";
import { decodeKittyPrintable } from "../keys.js";
import { KillRing } from "../kill-ring.js";
import { type Component, CURSOR_MARKER, type Focusable } from "../tui.js";
import { UndoStack } from "../undo-stack.js";
import { getSegmenter, isPunctuationChar, isWhitespaceChar, sliceByColumn, visibleWidth } from "../utils.js";
import { getKeybindings } from "../keybindings.ts";
import { decodeKittyPrintable } from "../keys.ts";
import { KillRing } from "../kill-ring.ts";
import { type Component, CURSOR_MARKER, type Focusable } from "../tui.ts";
import { UndoStack } from "../undo-stack.ts";
import { getSegmenter, isPunctuationChar, isWhitespaceChar, sliceByColumn, visibleWidth } from "../utils.ts";
const segmenter = getSegmenter();

View File

@@ -1,5 +1,5 @@
import type { TUI } from "../tui.js";
import { Text } from "./text.js";
import type { TUI } from "../tui.ts";
import { Text } from "./text.ts";
export interface LoaderIndicatorOptions {
/** Animation frames. Use an empty array to hide the indicator. */
@@ -21,17 +21,23 @@ export class Loader extends Text {
private intervalId: NodeJS.Timeout | null = null;
private ui: TUI | null = null;
private renderIndicatorVerbatim = false;
private spinnerColorFn: (str: string) => string;
private messageColorFn: (str: string) => string;
private message: string = "Loading...";
constructor(
ui: TUI,
private spinnerColorFn: (str: string) => string,
private messageColorFn: (str: string) => string,
private message: string = "Loading...",
spinnerColorFn: (str: string) => string,
messageColorFn: (str: string) => string,
message: string = "Loading...",
indicator?: LoaderIndicatorOptions,
) {
super("", 1, 0);
this.ui = ui;
this.setIndicator(indicator);
this.spinnerColorFn = spinnerColorFn;
this.messageColorFn = messageColorFn;
this.message = message;
}
render(width: number): string[] {

View File

@@ -1,7 +1,7 @@
import { Marked, type Token, Tokenizer, type Tokens } from "marked";
import { getCapabilities, hyperlink, isImageLine } from "../terminal-image.js";
import type { Component } from "../tui.js";
import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils.js";
import { getCapabilities, hyperlink, isImageLine } from "../terminal-image.ts";
import type { Component } from "../tui.ts";
import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils.ts";
const STRICT_STRIKETHROUGH_REGEX = /^(~~)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/;

View File

@@ -1,6 +1,6 @@
import { getKeybindings } from "../keybindings.js";
import type { Component } from "../tui.js";
import { truncateToWidth, visibleWidth } from "../utils.js";
import { getKeybindings } from "../keybindings.ts";
import type { Component } from "../tui.ts";
import { truncateToWidth, visibleWidth } from "../utils.ts";
const DEFAULT_PRIMARY_COLUMN_WIDTH = 32;
const PRIMARY_COLUMN_GAP = 2;

View File

@@ -1,8 +1,8 @@
import { fuzzyFilter } from "../fuzzy.js";
import { getKeybindings } from "../keybindings.js";
import type { Component } from "../tui.js";
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.js";
import { Input } from "./input.js";
import { fuzzyFilter } from "../fuzzy.ts";
import { getKeybindings } from "../keybindings.ts";
import type { Component } from "../tui.ts";
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.ts";
import { Input } from "./input.ts";
export interface SettingItem {
/** Unique identifier for this setting */

View File

@@ -1,4 +1,4 @@
import type { Component } from "../tui.js";
import type { Component } from "../tui.ts";
/**
* Spacer component that renders empty lines

View File

@@ -1,5 +1,5 @@
import type { Component } from "../tui.js";
import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils.js";
import type { Component } from "../tui.ts";
import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils.ts";
/**
* Text component - displays multi-line text with word wrapping

View File

@@ -1,5 +1,5 @@
import type { Component } from "../tui.js";
import { truncateToWidth, visibleWidth } from "../utils.js";
import type { Component } from "../tui.ts";
import { truncateToWidth, visibleWidth } from "../utils.ts";
/**
* Text component that truncates to fit viewport width