@suds-cli/viewport 0.0.1-alpha.0 → 0.1.0-alpha.2
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/README.md +2 -0
- package/dist/index.cjs +308 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{viewport-untrimmed.d.ts → index.d.cts} +131 -135
- package/dist/index.d.ts +131 -4
- package/dist/index.js +302 -3
- package/dist/index.js.map +1 -1
- package/package.json +29 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/keymap.d.ts +0 -19
- package/dist/keymap.d.ts.map +0 -1
- package/dist/keymap.js +0 -14
- package/dist/keymap.js.map +0 -1
- package/dist/messages.d.ts +0 -22
- package/dist/messages.d.ts.map +0 -1
- package/dist/messages.js +0 -29
- package/dist/messages.js.map +0 -1
- package/dist/model.d.ts +0 -89
- package/dist/model.d.ts.map +0 -1
- package/dist/model.js +0 -287
- package/dist/model.js.map +0 -1
- package/dist/viewport-alpha.d.ts +0 -135
- package/dist/viewport-beta.d.ts +0 -135
- package/dist/viewport-public.d.ts +0 -135
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { Binding } from '@suds-cli/key';
|
|
2
|
-
import { Cmd } from '@suds-cli/tea';
|
|
3
|
-
import { Msg } from '@suds-cli/tea';
|
|
4
|
-
import { Style } from '@suds-cli/chapstick';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Pager-like default key bindings.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare const defaultKeyMap: ViewportKeyMap;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Viewport scrolled notification.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export declare class ScrollMsg {
|
|
17
|
-
readonly percent: number;
|
|
18
|
-
readonly topLine: number;
|
|
19
|
-
readonly _tag = "viewport-scroll";
|
|
20
|
-
constructor(percent: number, topLine: number);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Sync viewport lines when content changes.
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export declare class SyncMsg {
|
|
28
|
-
readonly lines: string[];
|
|
29
|
-
readonly topLine: number;
|
|
30
|
-
readonly bottomLine: number;
|
|
31
|
-
readonly _tag = "viewport-sync";
|
|
32
|
-
constructor(lines: string[], topLine: number, bottomLine: number);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Key bindings for viewport navigation.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export declare interface ViewportKeyMap {
|
|
40
|
-
pageDown: Binding;
|
|
41
|
-
pageUp: Binding;
|
|
42
|
-
halfPageDown: Binding;
|
|
43
|
-
halfPageUp: Binding;
|
|
44
|
-
down: Binding;
|
|
45
|
-
up: Binding;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Scrollable window onto a list of lines.
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
export declare class ViewportModel {
|
|
53
|
-
readonly width: number;
|
|
54
|
-
readonly height: number;
|
|
55
|
-
readonly keyMap: ViewportKeyMap;
|
|
56
|
-
readonly mouseWheelEnabled: boolean;
|
|
57
|
-
readonly mouseWheelDelta: number;
|
|
58
|
-
readonly yOffset: number;
|
|
59
|
-
readonly lines: string[];
|
|
60
|
-
readonly style: Style;
|
|
61
|
-
private constructor();
|
|
62
|
-
/** Create a new viewport with defaults. */
|
|
63
|
-
static new(options?: ViewportOptions): ViewportModel;
|
|
64
|
-
/** Split string content into lines and store it. */
|
|
65
|
-
setContent(content: string): ViewportModel;
|
|
66
|
-
/** Replace content with a line array. Y offset is clamped if needed. */
|
|
67
|
-
setContentLines(lines: string[]): ViewportModel;
|
|
68
|
-
/** Change width. */
|
|
69
|
-
setWidth(width: number): ViewportModel;
|
|
70
|
-
/** Change height (and clamp offset if new height is smaller). */
|
|
71
|
-
setHeight(height: number): ViewportModel;
|
|
72
|
-
/** Scroll upward by the given number of lines. */
|
|
73
|
-
scrollUp(lines: number): ViewportModel;
|
|
74
|
-
/** Scroll downward by the given number of lines. */
|
|
75
|
-
scrollDown(lines: number): ViewportModel;
|
|
76
|
-
/** Jump to the top. */
|
|
77
|
-
scrollToTop(): ViewportModel;
|
|
78
|
-
/** Jump to the bottom. */
|
|
79
|
-
scrollToBottom(): ViewportModel;
|
|
80
|
-
/** Get or set scroll percentage (0-1). */
|
|
81
|
-
scrollPercent(): number;
|
|
82
|
-
scrollPercent(percent: number): ViewportModel;
|
|
83
|
-
/** True when Y offset is at the top. */
|
|
84
|
-
atTop(): boolean;
|
|
85
|
-
/** True when Y offset is at the bottom. */
|
|
86
|
-
atBottom(): boolean;
|
|
87
|
-
/** Number of visible lines (without padding). */
|
|
88
|
-
visibleLineCount(): number;
|
|
89
|
-
/** Total number of content lines. */
|
|
90
|
-
totalLineCount(): number;
|
|
91
|
-
/** Move up by n lines (default: 1). */
|
|
92
|
-
lineUp(n?: number): ViewportModel;
|
|
93
|
-
/** Move down by n lines (default: 1). */
|
|
94
|
-
lineDown(n?: number): ViewportModel;
|
|
95
|
-
/** Move up by half the viewport height. */
|
|
96
|
-
halfViewUp(): ViewportModel;
|
|
97
|
-
/** Move down by half the viewport height. */
|
|
98
|
-
halfViewDown(): ViewportModel;
|
|
99
|
-
/** Move up by one viewport height. */
|
|
100
|
-
viewUp(): ViewportModel;
|
|
101
|
-
/** Move down by one viewport height. */
|
|
102
|
-
viewDown(): ViewportModel;
|
|
103
|
-
/** Go to a specific line (0-based). Optionally center it. */
|
|
104
|
-
gotoLine(line: number, centered?: boolean): ViewportModel;
|
|
105
|
-
/** Tea init hook (no-op). */
|
|
106
|
-
init(): Cmd<Msg>;
|
|
107
|
-
/** Handle key + mouse scrolling. */
|
|
108
|
-
update(msg: Msg): [ViewportModel, Cmd<Msg>];
|
|
109
|
-
/** Render the visible window as a string (padded to height). */
|
|
110
|
-
view(): string;
|
|
111
|
-
/** Build a SyncMsg for high-level renderers. */
|
|
112
|
-
sync(): Cmd<Msg>;
|
|
113
|
-
private handleKey;
|
|
114
|
-
private handleMouse;
|
|
115
|
-
private visibleLines;
|
|
116
|
-
private maxYOffset;
|
|
117
|
-
private clampOffset;
|
|
118
|
-
private with;
|
|
119
|
-
private scrollCmdIfChanged;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Options for creating a viewport.
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
126
|
-
export declare interface ViewportOptions {
|
|
127
|
-
width?: number;
|
|
128
|
-
height?: number;
|
|
129
|
-
keyMap?: ViewportKeyMap;
|
|
130
|
-
mouseWheelEnabled?: boolean;
|
|
131
|
-
mouseWheelDelta?: number;
|
|
132
|
-
style?: Style;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export { }
|