coneko-term 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/renderer.d.ts +11 -1
- package/dist/renderer.js +15 -3
- package/dist/terminal.d.ts +7 -0
- package/dist/terminal.js +7 -2
- package/dist/wasm/coneko_term_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function init(source?: WasmSource): Promise<void>;
|
|
|
12
12
|
/** coneko-term の版。`init()` のあとに呼ぶ。 */
|
|
13
13
|
export declare function version(): string;
|
|
14
14
|
export { CELL_STRIDE, CLUSTER_FLAG, Terminal, type ClipboardItem, type ClipboardLocation, type ClipboardReadError, type ClipboardReadRequest, type ClipboardWriteRequest, type ClipboardWriteStatus, type DndErrorName, type DndEvent, type DndLocation, type DndOperation, type DndOperations, type DragImage, type DropDataForm, type DropRequest, type FileTransferErrorName, type FileTransferEvent, type FileTransferFileType, type FileTransferListing, type FileTransferStart, type CursorState, type ExtraCursorState, type MouseInput, type ProgramKind, type ProgramState, type ProgramStatus, type ProgramStatusChange, type NotificationSupport, type TerminalNotification, type WheelInput, type Disposable, type RowView, type SizedInfo, type TerminalOptions, type Theme, } from "./terminal.js";
|
|
15
|
-
export { browserEnv, CanvasRenderer, Palette, SCROLLBAR_WIDTH, proposeDimensions, type CellSize, type FitInput, type RenderEnv, type RenderOptions, type RenderSource, } from "./renderer.js";
|
|
15
|
+
export { browserEnv, CanvasRenderer, Palette, SCROLLBAR_WIDTH, proposeDimensions, resolveScrollbarWidth, type CellSize, type FitInput, type RenderEnv, type RenderOptions, type RenderSource, } from "./renderer.js";
|
|
16
16
|
export { PLACEMENT_STRIDE, Z_UNDER_BACKGROUND, ImageCache, browserImageDecoder, parsePlacements, type DrawableImage, type ImageDecoder, type ImagePlacement, type ImageSource, } from "./images.js";
|
|
17
17
|
export { SelectionModel, type BufferPosition, type SelectionHost, type SelectionKind, type SelectionRange, } from "./selection.js";
|
|
18
18
|
export { bracketTextForPaste, evaluateKeyboardEvent, KITTY_DISAMBIGUATE, KITTY_REPORT_ALL_KEYS, KITTY_REPORT_ALTERNATE_KEYS, KITTY_REPORT_EVENT_TYPES, KITTY_REPORT_TEXT, prepareTextForTerminal, type KeyEventLike, type KeyEventType, type KeyResult, type KeyResultType, } from "./keyboard.js";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export function version() {
|
|
|
14
14
|
return wasmVersion();
|
|
15
15
|
}
|
|
16
16
|
export { CELL_STRIDE, CLUSTER_FLAG, Terminal, } from "./terminal.js";
|
|
17
|
-
export { browserEnv, CanvasRenderer, Palette, SCROLLBAR_WIDTH, proposeDimensions, } from "./renderer.js";
|
|
17
|
+
export { browserEnv, CanvasRenderer, Palette, SCROLLBAR_WIDTH, proposeDimensions, resolveScrollbarWidth, } from "./renderer.js";
|
|
18
18
|
export { PLACEMENT_STRIDE, Z_UNDER_BACKGROUND, ImageCache, browserImageDecoder, parsePlacements, } from "./images.js";
|
|
19
19
|
export { SelectionModel, } from "./selection.js";
|
|
20
20
|
export { bracketTextForPaste, evaluateKeyboardEvent, KITTY_DISAMBIGUATE, KITTY_REPORT_ALL_KEYS, KITTY_REPORT_ALTERNATE_KEYS, KITTY_REPORT_EVENT_TYPES, KITTY_REPORT_TEXT, prepareTextForTerminal, } from "./keyboard.js";
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type RowView } from "./terminal.js";
|
|
2
2
|
import { type ImageDecoder, type ImageSource } from "./images.js";
|
|
3
|
-
/**
|
|
3
|
+
/** スクロールバーの幅の既定(CSS ピクセル)。xterm.js 6.0.0 と同じ。`TerminalOptions.scrollbarWidth` で変えられる。 */
|
|
4
4
|
export declare const SCROLLBAR_WIDTH = 14;
|
|
5
|
+
/**
|
|
6
|
+
* 設定から使うスクロールバーの幅(CSS ピクセル)を決める。
|
|
7
|
+
* 未指定・負の数・数でない値は既定(`SCROLLBAR_WIDTH`)、`scrollback` が 0 のときは 0。
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveScrollbarWidth(options: {
|
|
10
|
+
scrollback?: number;
|
|
11
|
+
scrollbarWidth?: unknown;
|
|
12
|
+
}): number;
|
|
5
13
|
/** `fit` の計算に使う値。長さはすべて CSS ピクセル。 */
|
|
6
14
|
export interface FitInput {
|
|
7
15
|
/** 欄の中身の幅(padding を引いたもの)。 */
|
|
@@ -243,6 +251,8 @@ export declare class Scrollbar {
|
|
|
243
251
|
/** いまのドラッグを終える関数。 */
|
|
244
252
|
private endDrag?;
|
|
245
253
|
constructor(host: HTMLElement, api: {
|
|
254
|
+
/** 幅(CSS ピクセル)。0 なら出さない。 */
|
|
255
|
+
width: number;
|
|
246
256
|
/** 全部の行の数(スクロールバック + 画面)。 */
|
|
247
257
|
total(): number;
|
|
248
258
|
/** 画面の行の数。 */
|
package/dist/renderer.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { CELL_STRIDE, CLUSTER_FLAG, } from "./terminal.js";
|
|
2
2
|
import { ImageCache, Z_UNDER_BACKGROUND, browserImageDecoder, parsePlacements, } from "./images.js";
|
|
3
|
-
/**
|
|
3
|
+
/** スクロールバーの幅の既定(CSS ピクセル)。xterm.js 6.0.0 と同じ。`TerminalOptions.scrollbarWidth` で変えられる。 */
|
|
4
4
|
export const SCROLLBAR_WIDTH = 14;
|
|
5
|
+
/**
|
|
6
|
+
* 設定から使うスクロールバーの幅(CSS ピクセル)を決める。
|
|
7
|
+
* 未指定・負の数・数でない値は既定(`SCROLLBAR_WIDTH`)、`scrollback` が 0 のときは 0。
|
|
8
|
+
*/
|
|
9
|
+
export function resolveScrollbarWidth(options) {
|
|
10
|
+
if (options.scrollback === 0)
|
|
11
|
+
return 0;
|
|
12
|
+
const w = options.scrollbarWidth;
|
|
13
|
+
return typeof w === "number" && Number.isFinite(w) && w >= 0
|
|
14
|
+
? w
|
|
15
|
+
: SCROLLBAR_WIDTH;
|
|
16
|
+
}
|
|
5
17
|
/** カーソルが点滅する間隔(ミリ秒)。xterm.js 6.0.0 と同じ。 */
|
|
6
18
|
const BLINK_MS = 600;
|
|
7
19
|
/**
|
|
@@ -771,7 +783,7 @@ export class Scrollbar {
|
|
|
771
783
|
position: "absolute",
|
|
772
784
|
top: "0",
|
|
773
785
|
right: "0",
|
|
774
|
-
width: `${
|
|
786
|
+
width: `${api.width}px`,
|
|
775
787
|
display: "none",
|
|
776
788
|
userSelect: "none",
|
|
777
789
|
});
|
|
@@ -848,7 +860,7 @@ export class Scrollbar {
|
|
|
848
860
|
const total = this.api.total();
|
|
849
861
|
const rows = this.api.rows();
|
|
850
862
|
const scrollable = total - rows;
|
|
851
|
-
if (!enabled || scrollable <= 0 || heightPx <= 0) {
|
|
863
|
+
if (!enabled || this.api.width <= 0 || scrollable <= 0 || heightPx <= 0) {
|
|
852
864
|
this.track.style.display = "none";
|
|
853
865
|
return;
|
|
854
866
|
}
|
package/dist/terminal.d.ts
CHANGED
|
@@ -122,6 +122,11 @@ export interface TerminalOptions {
|
|
|
122
122
|
cursorBlink?: boolean;
|
|
123
123
|
/** スクロールバックの行数。既定は 1000。 */
|
|
124
124
|
scrollback?: number;
|
|
125
|
+
/**
|
|
126
|
+
* スクロールバーの幅(CSS ピクセル)。既定は `SCROLLBAR_WIDTH`(14)。
|
|
127
|
+
* 0 を渡すとスクロールバーを出さず、`fit()` も幅を引かない。負の数や数でない値は既定に戻す。
|
|
128
|
+
*/
|
|
129
|
+
scrollbarWidth?: number;
|
|
125
130
|
/** テーマ。 */
|
|
126
131
|
theme?: Theme;
|
|
127
132
|
/** ダブルクリックで単語を選ぶときの区切りの字。既定は xterm.js と同じ(空白と ``()[]{}',"`` )。 */
|
|
@@ -835,6 +840,8 @@ export declare class Terminal {
|
|
|
835
840
|
cols: number;
|
|
836
841
|
rows: number;
|
|
837
842
|
} | undefined;
|
|
843
|
+
/** 使うスクロールバーの幅(CSS ピクセル)。 */
|
|
844
|
+
private get scrollbarWidth();
|
|
838
845
|
/** フォーカスがあるか(`setFocused` か、要素のフォーカスで決まる)。 */
|
|
839
846
|
get isFocused(): boolean;
|
|
840
847
|
/** ウィンドウの代わりに、フォーカスを得た・失ったことを知らせる。 */
|
package/dist/terminal.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getMemory } from "./memory.js";
|
|
|
3
3
|
import { SelectionModel, } from "./selection.js";
|
|
4
4
|
import { CompositionHelper, KeyHandler, detectPlatform, } from "./input.js";
|
|
5
5
|
import { bracketTextForPaste, prepareTextForTerminal } from "./keyboard.js";
|
|
6
|
-
import { CanvasRenderer, Palette, Scrollbar,
|
|
6
|
+
import { CanvasRenderer, Palette, Scrollbar, resolveScrollbarWidth, proposeDimensions, } from "./renderer.js";
|
|
7
7
|
/** セル 1 つが使う `u32` の数。`RowView.cells` の並びは README を参照。 */
|
|
8
8
|
export const CELL_STRIDE = 7;
|
|
9
9
|
/** セルの字(並びの 0 番目)にこのビットが立っていたら、残りのビットが `RowView.cluster` の番号。 */
|
|
@@ -1170,9 +1170,13 @@ export class Terminal {
|
|
|
1170
1170
|
height,
|
|
1171
1171
|
cellWidth: cell.width,
|
|
1172
1172
|
cellHeight: cell.height,
|
|
1173
|
-
scrollbarWidth: this.
|
|
1173
|
+
scrollbarWidth: this.scrollbarWidth,
|
|
1174
1174
|
});
|
|
1175
1175
|
}
|
|
1176
|
+
/** 使うスクロールバーの幅(CSS ピクセル)。 */
|
|
1177
|
+
get scrollbarWidth() {
|
|
1178
|
+
return resolveScrollbarWidth(this.options);
|
|
1179
|
+
}
|
|
1176
1180
|
/** フォーカスがあるか(`setFocused` か、要素のフォーカスで決まる)。 */
|
|
1177
1181
|
get isFocused() {
|
|
1178
1182
|
return this.focused;
|
|
@@ -1213,6 +1217,7 @@ export class Terminal {
|
|
|
1213
1217
|
this.host = host;
|
|
1214
1218
|
this.syncPointerShape();
|
|
1215
1219
|
this.scrollbar = new Scrollbar(el, {
|
|
1220
|
+
width: this.scrollbarWidth,
|
|
1216
1221
|
total: () => this.scrollbackLength + this.rows,
|
|
1217
1222
|
rows: () => this.rows,
|
|
1218
1223
|
viewportY: () => this.viewportY,
|
|
Binary file
|