envio 3.0.0-alpha.3 → 3.0.0-alpha.5
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 -2
- package/evm.schema.json +0 -1
- package/index.d.ts +333 -2
- package/index.js +4 -0
- package/package.json +13 -6
- package/rescript.json +4 -1
- package/src/ChainFetcher.res +25 -1
- package/src/ChainFetcher.res.mjs +19 -1
- package/src/Config.res +212 -19
- package/src/Config.res.mjs +228 -29
- package/src/{Indexer.res → Ctx.res} +1 -1
- package/src/Ecosystem.res +2 -2
- package/src/Ecosystem.res.mjs +1 -1
- package/src/Envio.gen.ts +1 -1
- package/src/Envio.res +1 -1
- package/src/EventProcessing.res +18 -18
- package/src/EventProcessing.res.mjs +14 -14
- package/src/GlobalState.res +29 -35
- package/src/GlobalState.res.mjs +47 -47
- package/src/GlobalStateManager.res +68 -0
- package/src/GlobalStateManager.res.mjs +75 -0
- package/src/GlobalStateManager.resi +7 -0
- package/src/Internal.res +41 -1
- package/src/LogSelection.res +33 -27
- package/src/LogSelection.res.mjs +6 -0
- package/src/Main.res +342 -0
- package/src/Main.res.mjs +289 -0
- package/src/PgStorage.gen.ts +10 -0
- package/src/PgStorage.res +24 -2
- package/src/PgStorage.res.d.mts +5 -0
- package/src/PgStorage.res.mjs +22 -1
- package/src/Types.ts +1 -1
- package/src/UserContext.res +0 -1
- package/src/UserContext.res.mjs +0 -2
- package/src/Utils.res +28 -0
- package/src/Utils.res.mjs +18 -0
- package/src/bindings/ClickHouse.res +31 -1
- package/src/bindings/ClickHouse.res.mjs +27 -1
- package/src/bindings/Ethers.res +27 -67
- package/src/bindings/Ethers.res.mjs +18 -70
- package/src/bindings/Postgres.gen.ts +8 -0
- package/src/bindings/Postgres.res +3 -0
- package/src/bindings/Postgres.res.d.mts +5 -0
- package/src/bindings/RescriptMocha.res +123 -0
- package/src/bindings/RescriptMocha.res.mjs +18 -0
- package/src/bindings/Yargs.res +8 -0
- package/src/bindings/Yargs.res.mjs +2 -0
- package/src/sources/FuelSDK.res +4 -3
- package/src/sources/HyperSyncHeightStream.res +28 -110
- package/src/sources/HyperSyncHeightStream.res.mjs +30 -63
- package/src/sources/HyperSyncSource.res +11 -13
- package/src/sources/HyperSyncSource.res.mjs +20 -20
- package/src/sources/Rpc.res +43 -0
- package/src/sources/Rpc.res.mjs +31 -0
- package/src/sources/RpcSource.res +9 -4
- package/src/sources/RpcSource.res.mjs +9 -4
- package/src/sources/Source.res +1 -0
- package/src/sources/SourceManager.res +164 -81
- package/src/sources/SourceManager.res.mjs +146 -83
- package/src/sources/{Solana.res → Svm.res} +4 -4
- package/src/sources/{Solana.res.mjs → Svm.res.mjs} +4 -4
- package/src/tui/Tui.res +266 -0
- package/src/tui/Tui.res.mjs +342 -0
- package/src/tui/bindings/Ink.res +376 -0
- package/src/tui/bindings/Ink.res.mjs +75 -0
- package/src/tui/bindings/Style.res +123 -0
- package/src/tui/bindings/Style.res.mjs +2 -0
- package/src/tui/components/BufferedProgressBar.res +40 -0
- package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
- package/src/tui/components/CustomHooks.res +114 -0
- package/src/tui/components/CustomHooks.res.mjs +162 -0
- package/src/tui/components/Messages.res +41 -0
- package/src/tui/components/Messages.res.mjs +75 -0
- package/src/tui/components/SyncETA.res +193 -0
- package/src/tui/components/SyncETA.res.mjs +269 -0
- package/src/tui/components/TuiData.res +46 -0
- package/src/tui/components/TuiData.res.mjs +29 -0
- package/src/bindings/Ethers.gen.ts +0 -14
- /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
open Style
|
|
2
|
+
|
|
3
|
+
type instance = {
|
|
4
|
+
rerender: React.element => unit,
|
|
5
|
+
unmount: unit => unit,
|
|
6
|
+
waitUntilExit: unit => promise<unit>,
|
|
7
|
+
clear: unit => unit,
|
|
8
|
+
}
|
|
9
|
+
type readableStream
|
|
10
|
+
type writableStream
|
|
11
|
+
type options = {
|
|
12
|
+
stdout?: writableStream,
|
|
13
|
+
stdin?: readableStream,
|
|
14
|
+
exitOnCtrlC?: bool,
|
|
15
|
+
patchConsole?: bool,
|
|
16
|
+
debug?: bool,
|
|
17
|
+
}
|
|
18
|
+
@module("ink")
|
|
19
|
+
external renderInternal: (React.element, ~options: option<options>) => instance = "render"
|
|
20
|
+
|
|
21
|
+
let render = (~options=?, element) => {
|
|
22
|
+
renderInternal(element, ~options)
|
|
23
|
+
}
|
|
24
|
+
type measurement = {width: int, height: int}
|
|
25
|
+
|
|
26
|
+
@module("ink")
|
|
27
|
+
external measureElement: React.ref<'a> => measurement = "measureElement"
|
|
28
|
+
|
|
29
|
+
module Text = {
|
|
30
|
+
type wrapOptions =
|
|
31
|
+
| @as("wrap") Wrap
|
|
32
|
+
| @as("truncate") Truncate
|
|
33
|
+
| @as("truncate-start") TruncateStart
|
|
34
|
+
| @as("truncate-middle") TruncateMiddle
|
|
35
|
+
| @as("truncate-end") TruncateEnd
|
|
36
|
+
@module("ink") @react.component
|
|
37
|
+
external make: (
|
|
38
|
+
~children: React.element,
|
|
39
|
+
~color: chalkTheme=?,
|
|
40
|
+
~backgroundColor: chalkTheme=?,
|
|
41
|
+
~dimColor: bool=?,
|
|
42
|
+
~bold: bool=?,
|
|
43
|
+
~italic: bool=?,
|
|
44
|
+
~underline: bool=?,
|
|
45
|
+
~strikethrough: bool=?,
|
|
46
|
+
~inverse: bool=?,
|
|
47
|
+
~wrap: wrapOptions=?,
|
|
48
|
+
) => React.element = "Text"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module Box = {
|
|
52
|
+
@module("ink") @react.component
|
|
53
|
+
external make: (
|
|
54
|
+
~children: React.element=?,
|
|
55
|
+
~width: numOrStr=?,
|
|
56
|
+
~height: numOrStr=?,
|
|
57
|
+
~minWidth: int=?,
|
|
58
|
+
~minHeight: int=?,
|
|
59
|
+
~padding: int=?,
|
|
60
|
+
~paddingTop: int=?,
|
|
61
|
+
~paddingBottom: int=?,
|
|
62
|
+
~paddingLeft: int=?,
|
|
63
|
+
~paddingRight: int=?,
|
|
64
|
+
~paddingX: int=?,
|
|
65
|
+
~paddingY: int=?,
|
|
66
|
+
~margin: int=?,
|
|
67
|
+
~marginTop: int=?,
|
|
68
|
+
~marginBottom: int=?,
|
|
69
|
+
~marginLeft: int=?,
|
|
70
|
+
~marginRight: int=?,
|
|
71
|
+
~marginX: int=?,
|
|
72
|
+
~marginY: int=?,
|
|
73
|
+
~gap: int=?,
|
|
74
|
+
~rowGap: int=?,
|
|
75
|
+
~flexGrow: int=?,
|
|
76
|
+
~flexShrink: int=?,
|
|
77
|
+
~flexBasis: numOrStr=?,
|
|
78
|
+
~flexDirection: flexDirection=?,
|
|
79
|
+
~flexWrap: flexDirection=?,
|
|
80
|
+
~alignItems: alignItems=?,
|
|
81
|
+
~alignSelf: alignSelf=?,
|
|
82
|
+
~justifyContent: justifyContent=?,
|
|
83
|
+
~display: display=?,
|
|
84
|
+
~overflow: overflow=?,
|
|
85
|
+
~overflowX: overflow=?,
|
|
86
|
+
~overflowY: overflow=?,
|
|
87
|
+
~borderStyle: borderStyle=?,
|
|
88
|
+
~borderColor: chalkTheme=?,
|
|
89
|
+
~borderTopColor: chalkTheme=?,
|
|
90
|
+
~borderRightColor: chalkTheme=?,
|
|
91
|
+
~borderBottomColor: chalkTheme=?,
|
|
92
|
+
~borderLeftColor: chalkTheme=?,
|
|
93
|
+
~borderDimColor: bool=?,
|
|
94
|
+
~borderTopDimColor: bool=?,
|
|
95
|
+
~borderRightDimColor: bool=?,
|
|
96
|
+
~borderBottomDimColor: bool=?,
|
|
97
|
+
~borderLeftDimColor: bool=?,
|
|
98
|
+
~borderTop: bool=?,
|
|
99
|
+
~borderRight: bool=?,
|
|
100
|
+
~borderBottom: bool=?,
|
|
101
|
+
~borderLeft: bool=?,
|
|
102
|
+
) => React.element = "Box"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module Newline = {
|
|
106
|
+
/**
|
|
107
|
+
Adds one or more newline characters. Must be used within <Text> components.
|
|
108
|
+
|
|
109
|
+
*/
|
|
110
|
+
@react.component
|
|
111
|
+
let make = () => <Text> {" "->React.string} </Text>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module Spacer = {
|
|
115
|
+
/**
|
|
116
|
+
A flexible space that expands along the major axis of its containing layout. It's useful as a shortcut for filling all the available spaces between elements.
|
|
117
|
+
|
|
118
|
+
For example, using <Spacer> in a <Box> with default flex direction (row) will position "Left" on the left side and will push "Right" to the right side.
|
|
119
|
+
*/
|
|
120
|
+
@module("ink")
|
|
121
|
+
@react.component
|
|
122
|
+
external make: unit => React.element = "Spacer"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
module Static = {
|
|
126
|
+
/**
|
|
127
|
+
<Static> component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs - things that are not changing after they're rendered (hence the name "Static").
|
|
128
|
+
|
|
129
|
+
It's preferred to use <Static> for use cases like these, when you can't know or control the amount of items that need to be rendered.
|
|
130
|
+
*/
|
|
131
|
+
@module("ink")
|
|
132
|
+
@react.component
|
|
133
|
+
external make: (
|
|
134
|
+
~children: ('a, int) => React.element,
|
|
135
|
+
~items: array<'a>,
|
|
136
|
+
~style: styles=?,
|
|
137
|
+
) => React.element = "Static"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
module Transform = {
|
|
141
|
+
/**
|
|
142
|
+
Transform a string representation of React components before they are written to output. For example, you might want to apply a gradient to text, add a clickable link or create some text effects. These use cases can't accept React nodes as input, they are expecting a string. That's what <Transform> component does, it gives you an output string of its child components and lets you transform it in any way.
|
|
143
|
+
|
|
144
|
+
Note: <Transform> must be applied only to <Text> children components and shouldn't change the dimensions of the output, otherwise layout will be incorrect.
|
|
145
|
+
*/
|
|
146
|
+
type outputLine = string
|
|
147
|
+
type index = int
|
|
148
|
+
@module("ink") @react.component
|
|
149
|
+
external make: (
|
|
150
|
+
~children: string,
|
|
151
|
+
~tranform: (outputLine, index) => string,
|
|
152
|
+
~index: int=?,
|
|
153
|
+
) => React.element = "Transform"
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module Hooks = {
|
|
157
|
+
type key = {
|
|
158
|
+
leftArrow: bool,
|
|
159
|
+
rightArrow: bool,
|
|
160
|
+
upArrow: bool,
|
|
161
|
+
downArrow: bool,
|
|
162
|
+
return: bool,
|
|
163
|
+
escape: bool,
|
|
164
|
+
ctrl: bool,
|
|
165
|
+
shift: bool,
|
|
166
|
+
tab: bool,
|
|
167
|
+
backspace: bool,
|
|
168
|
+
delete: bool,
|
|
169
|
+
pageDown: bool,
|
|
170
|
+
pageUp: bool,
|
|
171
|
+
meta: bool,
|
|
172
|
+
enter: bool,
|
|
173
|
+
}
|
|
174
|
+
type input = string
|
|
175
|
+
type inputHandler = (input, key) => unit
|
|
176
|
+
type options = {isActive?: bool}
|
|
177
|
+
|
|
178
|
+
@module("ink") external useInput: (inputHandler, ~options: options=?) => unit = "useInput"
|
|
179
|
+
|
|
180
|
+
type app = {exit: (~err: exn=?) => unit}
|
|
181
|
+
@module("ink") external useApp: unit => app = "useApp"
|
|
182
|
+
|
|
183
|
+
type stdin = {
|
|
184
|
+
stdin: readableStream,
|
|
185
|
+
isRawModeSupported: bool,
|
|
186
|
+
setRawMode: bool => unit,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@module("ink") external useStdin: unit => stdin = "useStdin"
|
|
190
|
+
|
|
191
|
+
type stdout = {
|
|
192
|
+
stdout: writableStream,
|
|
193
|
+
write: string => unit,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@module("ink") external useStdout: unit => stdout = "useStdout"
|
|
197
|
+
|
|
198
|
+
type stderr = {
|
|
199
|
+
stderr: writableStream,
|
|
200
|
+
write: string => unit,
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@module("ink") external useStderr: unit => stderr = "useStderr"
|
|
204
|
+
|
|
205
|
+
type focusOptions = {autoFocus?: bool, isActive?: bool, id?: string}
|
|
206
|
+
type focus = {isFocused: bool}
|
|
207
|
+
@module("ink") external useFocus: (~options: focusOptions=?) => focus = "useFocus"
|
|
208
|
+
|
|
209
|
+
type focusManager = {
|
|
210
|
+
enableFocus: unit => unit,
|
|
211
|
+
disableFocus: unit => unit,
|
|
212
|
+
focusNext: unit => unit,
|
|
213
|
+
focusPrevious: unit => unit,
|
|
214
|
+
focusId: string => unit,
|
|
215
|
+
}
|
|
216
|
+
@module("ink")
|
|
217
|
+
external useFocusManager: unit => focusManager = "useFocusManager"
|
|
218
|
+
|
|
219
|
+
@get external getColumns: writableStream => int = "columns"
|
|
220
|
+
@send external on: (writableStream, @as("resize") _, unit => unit) => unit = "on"
|
|
221
|
+
@send external off: (writableStream, @as("resize") _, unit => unit) => unit = "off"
|
|
222
|
+
|
|
223
|
+
let useStdoutColumns = () => {
|
|
224
|
+
let {stdout} = useStdout()
|
|
225
|
+
let (columns, setColumns) = React.useState(() => stdout->getColumns)
|
|
226
|
+
|
|
227
|
+
React.useEffect1(() => {
|
|
228
|
+
let handler = () => setColumns(_ => stdout->getColumns)
|
|
229
|
+
stdout->on(handler)
|
|
230
|
+
Some(() => stdout->off(handler))
|
|
231
|
+
}, [stdout])
|
|
232
|
+
|
|
233
|
+
columns
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
module BigText = {
|
|
238
|
+
type font =
|
|
239
|
+
| @as("block") Block
|
|
240
|
+
| @as("slick") Slick
|
|
241
|
+
| @as("tiny") Tiny
|
|
242
|
+
| @as("grid") Grid
|
|
243
|
+
| @as("pallet") Pallet
|
|
244
|
+
| @as("shade") Shade
|
|
245
|
+
| @as("simple") Simple
|
|
246
|
+
| @as("simpleBlock") SimpleBlock
|
|
247
|
+
| @as("3d") D3
|
|
248
|
+
| @as("simple3d") Simple3D
|
|
249
|
+
| @as("chrome") Chrome
|
|
250
|
+
| @as("huge") Huge
|
|
251
|
+
type align =
|
|
252
|
+
| @as("left") Left
|
|
253
|
+
| @as("center") Center
|
|
254
|
+
| @as("right") Right
|
|
255
|
+
type backgroundColor =
|
|
256
|
+
| @as("transparent") Transparent
|
|
257
|
+
| @as("black") Black
|
|
258
|
+
| @as("red") Red
|
|
259
|
+
| @as("green") Green
|
|
260
|
+
| @as("yellow") Yellow
|
|
261
|
+
| @as("blue") Blue
|
|
262
|
+
| @as("magenta") Magenta
|
|
263
|
+
| @as("cyan") Cyan
|
|
264
|
+
| @as("white") White
|
|
265
|
+
|
|
266
|
+
type color = | ...chalkTheme | @as("system") System
|
|
267
|
+
@module("ink-big-text") @react.component
|
|
268
|
+
external make: (
|
|
269
|
+
~text: string,
|
|
270
|
+
~font: font=?, //default block
|
|
271
|
+
~align: align=?, //default left
|
|
272
|
+
~colors: array<color>=?, //default [system]
|
|
273
|
+
~backgroundColor: backgroundColor=?, //default transparent
|
|
274
|
+
~letterSpacing: int=?, //default 1
|
|
275
|
+
~lineHeight: int=?, //default 1
|
|
276
|
+
~space: bool=?, //default true
|
|
277
|
+
~maxLength: int=?,
|
|
278
|
+
) => React.element = "default"
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
module Spinner = {
|
|
282
|
+
type typeOption =
|
|
283
|
+
| @as("dots") Dots
|
|
284
|
+
| @as("dots2") Dots2
|
|
285
|
+
| @as("dots3") Dots3
|
|
286
|
+
| @as("dots4") Dots4
|
|
287
|
+
| @as("dots5") Dots5
|
|
288
|
+
| @as("dots6") Dots6
|
|
289
|
+
| @as("dots7") Dots7
|
|
290
|
+
| @as("dots8") Dots8
|
|
291
|
+
| @as("dots9") Dots9
|
|
292
|
+
| @as("dots10") Dots10
|
|
293
|
+
| @as("dots11") Dots11
|
|
294
|
+
| @as("dots12") Dots12
|
|
295
|
+
| @as("dots13") Dots13
|
|
296
|
+
| @as("dots8Bit") Dots8Bit
|
|
297
|
+
| @as("sand") Sand
|
|
298
|
+
| @as("line") Line
|
|
299
|
+
| @as("line2") Line2
|
|
300
|
+
| @as("pipe") Pipe
|
|
301
|
+
| @as("simpleDots") SimpleDots
|
|
302
|
+
| @as("simpleDotsScrolling") SimpleDotsScrolling
|
|
303
|
+
| @as("star") Star
|
|
304
|
+
| @as("star2") Star2
|
|
305
|
+
| @as("flip") Flip
|
|
306
|
+
| @as("hamburger") Hamburger
|
|
307
|
+
| @as("growVertical") GrowVertical
|
|
308
|
+
| @as("growHorizontal") GrowHorizontal
|
|
309
|
+
| @as("balloon") Balloon
|
|
310
|
+
| @as("balloon2") Balloon2
|
|
311
|
+
| @as("noise") Noise
|
|
312
|
+
| @as("bounce") Bounce
|
|
313
|
+
| @as("boxBounce") BoxBounce
|
|
314
|
+
| @as("boxBounce2") BoxBounce2
|
|
315
|
+
| @as("triangle") Triangle
|
|
316
|
+
| @as("binary") Binary
|
|
317
|
+
| @as("arc") Arc
|
|
318
|
+
| @as("circle") Circle
|
|
319
|
+
| @as("squareCorners") SquareCorners
|
|
320
|
+
| @as("circleQuarters") CircleQuarters
|
|
321
|
+
| @as("circleHalves") CircleHalves
|
|
322
|
+
| @as("squish") Squish
|
|
323
|
+
| @as("toggle") Toggle
|
|
324
|
+
| @as("toggle2") Toggle2
|
|
325
|
+
| @as("toggle3") Toggle3
|
|
326
|
+
| @as("toggle4") Toggle4
|
|
327
|
+
| @as("toggle5") Toggle5
|
|
328
|
+
| @as("toggle6") Toggle6
|
|
329
|
+
| @as("toggle7") Toggle7
|
|
330
|
+
| @as("toggle8") Toggle8
|
|
331
|
+
| @as("toggle9") Toggle9
|
|
332
|
+
| @as("toggle10") Toggle10
|
|
333
|
+
| @as("toggle11") Toggle11
|
|
334
|
+
| @as("toggle12") Toggle12
|
|
335
|
+
| @as("toggle13") Toggle13
|
|
336
|
+
| @as("arrow") Arrow
|
|
337
|
+
| @as("arrow2") Arrow2
|
|
338
|
+
| @as("arrow3") Arrow3
|
|
339
|
+
| @as("bouncingBar") BouncingBar
|
|
340
|
+
| @as("bouncingBall") BouncingBall
|
|
341
|
+
| @as("smiley") Smiley
|
|
342
|
+
| @as("monkey") Monkey
|
|
343
|
+
| @as("hearts") Hearts
|
|
344
|
+
| @as("clock") Clock
|
|
345
|
+
| @as("earth") Earth
|
|
346
|
+
| @as("material") Material
|
|
347
|
+
| @as("moon") Moon
|
|
348
|
+
| @as("runner") Runner
|
|
349
|
+
| @as("pong") Pong
|
|
350
|
+
| @as("shark") Shark
|
|
351
|
+
| @as("dqpb") Dqpb
|
|
352
|
+
| @as("weather") Weather
|
|
353
|
+
| @as("christmas") Christmas
|
|
354
|
+
| @as("grenade") Grenade
|
|
355
|
+
| @as("point") Point
|
|
356
|
+
| @as("layer") Layer
|
|
357
|
+
| @as("betaWave") BetaWave
|
|
358
|
+
| @as("fingerDance") FingerDance
|
|
359
|
+
| @as("fistBump") FistBump
|
|
360
|
+
| @as("soccerHeader") SoccerHeader
|
|
361
|
+
| @as("mindblown") Mindblown
|
|
362
|
+
| @as("speaker") Speaker
|
|
363
|
+
| @as("orangePulse") OrangePulse
|
|
364
|
+
| @as("bluePulse") BluePulse
|
|
365
|
+
| @as("orangeBluePulse") OrangeBluePulse
|
|
366
|
+
| @as("timeTravel") TimeTravel
|
|
367
|
+
| @as("aesthetic") Aesthetic
|
|
368
|
+
| @as("dwarfFortress") DwarfFortress
|
|
369
|
+
@module("ink-spinner") @react.component
|
|
370
|
+
external make: (@as("type") ~type_: typeOption=?) => React.element = "default"
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
module Table = {
|
|
374
|
+
@module("ink-table") @react.component
|
|
375
|
+
external make: (~head: array<string>, ~rows: array<array<string>>) => React.element = "Table"
|
|
376
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as $$Ink from "ink";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import * as JsxRuntime from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
function render(options, element) {
|
|
8
|
+
return $$Ink.render(element, options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var $$Text = {};
|
|
12
|
+
|
|
13
|
+
var Box = {};
|
|
14
|
+
|
|
15
|
+
function Ink$Newline(props) {
|
|
16
|
+
return JsxRuntime.jsx($$Ink.Text, {
|
|
17
|
+
children: " "
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var Newline = {
|
|
22
|
+
make: Ink$Newline
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var Spacer = {};
|
|
26
|
+
|
|
27
|
+
var Static = {};
|
|
28
|
+
|
|
29
|
+
var Transform = {};
|
|
30
|
+
|
|
31
|
+
function useStdoutColumns() {
|
|
32
|
+
var match = $$Ink.useStdout();
|
|
33
|
+
var stdout = match.stdout;
|
|
34
|
+
var match$1 = React.useState(function () {
|
|
35
|
+
return stdout.columns;
|
|
36
|
+
});
|
|
37
|
+
var setColumns = match$1[1];
|
|
38
|
+
React.useEffect((function () {
|
|
39
|
+
var handler = function () {
|
|
40
|
+
setColumns(function (param) {
|
|
41
|
+
return stdout.columns;
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
stdout.on("resize", handler);
|
|
45
|
+
return (function () {
|
|
46
|
+
stdout.off("resize", handler);
|
|
47
|
+
});
|
|
48
|
+
}), [stdout]);
|
|
49
|
+
return match$1[0];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var Hooks = {
|
|
53
|
+
useStdoutColumns: useStdoutColumns
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var BigText = {};
|
|
57
|
+
|
|
58
|
+
var Spinner = {};
|
|
59
|
+
|
|
60
|
+
var Table = {};
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
render ,
|
|
64
|
+
$$Text ,
|
|
65
|
+
Box ,
|
|
66
|
+
Newline ,
|
|
67
|
+
Spacer ,
|
|
68
|
+
Static ,
|
|
69
|
+
Transform ,
|
|
70
|
+
Hooks ,
|
|
71
|
+
BigText ,
|
|
72
|
+
Spinner ,
|
|
73
|
+
Table ,
|
|
74
|
+
}
|
|
75
|
+
/* ink Not a pure module */
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
type chalkTheme =
|
|
2
|
+
| @as("#9860E5") Primary
|
|
3
|
+
| @as("#FFBB2F") Secondary
|
|
4
|
+
| @as("#6CBFEE") Info
|
|
5
|
+
| @as("#FF8269") Danger
|
|
6
|
+
| @as("#3B8C3D") Success
|
|
7
|
+
| @as("white") White
|
|
8
|
+
| @as("gray") Gray
|
|
9
|
+
|
|
10
|
+
@unboxed type numOrStr = Num(int) | Str(string)
|
|
11
|
+
|
|
12
|
+
type textWrap =
|
|
13
|
+
| @as("wrap") Wrap
|
|
14
|
+
| @as("end") End
|
|
15
|
+
| @as("middle") Middle
|
|
16
|
+
| @as("truncate-end") TruncateEnd
|
|
17
|
+
| @as("truncate") Truncate
|
|
18
|
+
| @as("truncate-middle") TruncateMiddle
|
|
19
|
+
| @as("truncate-start") TruncateStart
|
|
20
|
+
|
|
21
|
+
type position =
|
|
22
|
+
| @as("absolute") Absolute
|
|
23
|
+
| @as("relative") Relative
|
|
24
|
+
|
|
25
|
+
type flexDirection =
|
|
26
|
+
| @as("row") Row
|
|
27
|
+
| @as("column") Column
|
|
28
|
+
| @as("row-reverse") RowReverse
|
|
29
|
+
| @as("column-reverse") ColumnReverse
|
|
30
|
+
|
|
31
|
+
type flexWrap =
|
|
32
|
+
| @as("nowrap") NoWrap
|
|
33
|
+
| @as("wrap") Wrap
|
|
34
|
+
| @as("wrap-reverse") WrapReverse
|
|
35
|
+
|
|
36
|
+
type alignItems =
|
|
37
|
+
| @as("flex-start") FlexStart
|
|
38
|
+
| @as("center") Center
|
|
39
|
+
| @as("flex-end") FlexEnd
|
|
40
|
+
| @as("stretch") Stretch
|
|
41
|
+
|
|
42
|
+
type alignSelf =
|
|
43
|
+
| @as("flex-start") FlexStartSelf
|
|
44
|
+
| @as("center") CenterSelf
|
|
45
|
+
| @as("flex-end") FlexEndSelf
|
|
46
|
+
| @as("auto") Auto
|
|
47
|
+
|
|
48
|
+
type justifyContent =
|
|
49
|
+
| @as("flex-start") JustifyFlexStart
|
|
50
|
+
| @as("flex-end") JustifyFlexEnd
|
|
51
|
+
| @as("space-between") SpaceBetween
|
|
52
|
+
| @as("space-around") SpaceAround
|
|
53
|
+
| @as("center") JustifyCenter
|
|
54
|
+
|
|
55
|
+
type display =
|
|
56
|
+
| @as("flex") Flex
|
|
57
|
+
| @as("none") None
|
|
58
|
+
|
|
59
|
+
type overflow =
|
|
60
|
+
| @as("visible") Visible
|
|
61
|
+
| @as("hidden") Hidden
|
|
62
|
+
|
|
63
|
+
type borderStyle =
|
|
64
|
+
| @as("single") Single
|
|
65
|
+
| @as("double") Double
|
|
66
|
+
| @as("round") Round
|
|
67
|
+
| @as("bold") Bold
|
|
68
|
+
| @as("singleDouble") SingleDouble
|
|
69
|
+
| @as("doubleSingle") DoubleSingle
|
|
70
|
+
| @as("classic") Classic
|
|
71
|
+
|
|
72
|
+
type styles = {
|
|
73
|
+
textWrap?: textWrap,
|
|
74
|
+
position?: position,
|
|
75
|
+
columnGap?: int,
|
|
76
|
+
rowGap?: int,
|
|
77
|
+
gap?: int,
|
|
78
|
+
margin?: int,
|
|
79
|
+
marginX?: int,
|
|
80
|
+
marginY?: int,
|
|
81
|
+
marginTop?: int,
|
|
82
|
+
marginBottom?: int,
|
|
83
|
+
marginLeft?: int,
|
|
84
|
+
marginRight?: int,
|
|
85
|
+
padding?: int,
|
|
86
|
+
paddingX?: int,
|
|
87
|
+
paddingY?: int,
|
|
88
|
+
paddingTop?: int,
|
|
89
|
+
paddingBottom?: int,
|
|
90
|
+
paddingLeft?: int,
|
|
91
|
+
paddingRight?: int,
|
|
92
|
+
flexGrow?: int,
|
|
93
|
+
flexShrink?: int,
|
|
94
|
+
flexDirection?: flexDirection,
|
|
95
|
+
flexBasis?: numOrStr,
|
|
96
|
+
flexWrap?: flexWrap,
|
|
97
|
+
alignItems?: alignItems,
|
|
98
|
+
alignSelf?: alignSelf,
|
|
99
|
+
justifyContent?: justifyContent,
|
|
100
|
+
width?: numOrStr,
|
|
101
|
+
height?: numOrStr,
|
|
102
|
+
minWidth?: numOrStr,
|
|
103
|
+
minHeight?: numOrStr,
|
|
104
|
+
display?: display,
|
|
105
|
+
borderStyle?: borderStyle,
|
|
106
|
+
borderTop?: bool,
|
|
107
|
+
borderBottom?: bool,
|
|
108
|
+
borderLeft?: bool,
|
|
109
|
+
borderRight?: bool,
|
|
110
|
+
borderColor?: chalkTheme,
|
|
111
|
+
borderTopColor?: chalkTheme,
|
|
112
|
+
borderBottomColor?: chalkTheme,
|
|
113
|
+
borderLeftColor?: chalkTheme,
|
|
114
|
+
borderRightColor?: chalkTheme,
|
|
115
|
+
borderDimColor?: bool,
|
|
116
|
+
borderTopDimColor?: bool,
|
|
117
|
+
borderBottomDimColor?: bool,
|
|
118
|
+
borderLeftDimColor?: bool,
|
|
119
|
+
borderRightDimColor?: bool,
|
|
120
|
+
overflow?: overflow,
|
|
121
|
+
overflowX?: overflow,
|
|
122
|
+
overflowY?: overflow,
|
|
123
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
open Ink
|
|
2
|
+
open Belt
|
|
3
|
+
@react.component
|
|
4
|
+
let make = (~loaded, ~buffered=?, ~outOf, ~barWidth=36, ~loadingColor=Style.Secondary) => {
|
|
5
|
+
let maxCount = barWidth
|
|
6
|
+
|
|
7
|
+
let loadedFraction = loaded->Int.toFloat /. outOf->Int.toFloat
|
|
8
|
+
let loadedCount = Pervasives.min(
|
|
9
|
+
Js.Math.floor_float(maxCount->Js.Int.toFloat *. loadedFraction)->Belt.Float.toInt,
|
|
10
|
+
maxCount,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
let bufferedCount = buffered->Option.mapWithDefault(loadedCount, buffered => {
|
|
14
|
+
let bufferedFraction = buffered->Int.toFloat /. outOf->Int.toFloat
|
|
15
|
+
Pervasives.min(
|
|
16
|
+
Js.Math.floor_float(maxCount->Js.Int.toFloat *. bufferedFraction)->Belt.Float.toInt,
|
|
17
|
+
maxCount,
|
|
18
|
+
)
|
|
19
|
+
})
|
|
20
|
+
let loadedFraction = loadedFraction > 0.0 ? loadedFraction : 0.0
|
|
21
|
+
let loadedPercentageStr = (loadedFraction *. 100.)->Int.fromFloat->Int.toString ++ "% "
|
|
22
|
+
|
|
23
|
+
let loadedPercentageStrCount = loadedPercentageStr->String.length
|
|
24
|
+
let loadedSpaces = Pervasives.max(loadedCount - loadedPercentageStrCount, 0)
|
|
25
|
+
let loadedCount = Pervasives.max(loadedCount, loadedPercentageStrCount)
|
|
26
|
+
let bufferedCount = Pervasives.max(bufferedCount, loadedCount)
|
|
27
|
+
|
|
28
|
+
<Box>
|
|
29
|
+
<Text backgroundColor={loadingColor} color={Gray}>
|
|
30
|
+
<Text> {" "->Js.String2.repeat(loadedSpaces)->React.string} </Text>
|
|
31
|
+
<Text> {loadedPercentageStr->React.string} </Text>
|
|
32
|
+
</Text>
|
|
33
|
+
<Text backgroundColor={Gray}>
|
|
34
|
+
{" "->Js.String2.repeat(bufferedCount - loadedCount)->React.string}
|
|
35
|
+
</Text>
|
|
36
|
+
<Text backgroundColor={White}>
|
|
37
|
+
{" "->Js.String2.repeat(maxCount - bufferedCount)->React.string}
|
|
38
|
+
</Text>
|
|
39
|
+
</Box>
|
|
40
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as $$Ink from "ink";
|
|
4
|
+
import * as Caml from "rescript/lib/es6/caml.js";
|
|
5
|
+
import * as Belt_Option from "rescript/lib/es6/belt_Option.js";
|
|
6
|
+
import * as JsxRuntime from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
function BufferedProgressBar(props) {
|
|
9
|
+
var __loadingColor = props.loadingColor;
|
|
10
|
+
var __barWidth = props.barWidth;
|
|
11
|
+
var outOf = props.outOf;
|
|
12
|
+
var barWidth = __barWidth !== undefined ? __barWidth : 36;
|
|
13
|
+
var loadingColor = __loadingColor !== undefined ? __loadingColor : "#FFBB2F";
|
|
14
|
+
var loadedFraction = props.loaded / outOf;
|
|
15
|
+
var loadedCount = Caml.int_min(Math.floor(barWidth * loadedFraction) | 0, barWidth);
|
|
16
|
+
var bufferedCount = Belt_Option.mapWithDefault(props.buffered, loadedCount, (function (buffered) {
|
|
17
|
+
var bufferedFraction = buffered / outOf;
|
|
18
|
+
return Caml.int_min(Math.floor(barWidth * bufferedFraction) | 0, barWidth);
|
|
19
|
+
}));
|
|
20
|
+
var loadedFraction$1 = loadedFraction > 0.0 ? loadedFraction : 0.0;
|
|
21
|
+
var loadedPercentageStr = String(loadedFraction$1 * 100 | 0) + "% ";
|
|
22
|
+
var loadedPercentageStrCount = loadedPercentageStr.length;
|
|
23
|
+
var loadedSpaces = Caml.int_max(loadedCount - loadedPercentageStrCount | 0, 0);
|
|
24
|
+
var loadedCount$1 = loadedCount > loadedPercentageStrCount ? loadedCount : loadedPercentageStrCount;
|
|
25
|
+
var bufferedCount$1 = bufferedCount > loadedCount$1 ? bufferedCount : loadedCount$1;
|
|
26
|
+
return JsxRuntime.jsxs($$Ink.Box, {
|
|
27
|
+
children: [
|
|
28
|
+
JsxRuntime.jsxs($$Ink.Text, {
|
|
29
|
+
children: [
|
|
30
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
31
|
+
children: " ".repeat(loadedSpaces)
|
|
32
|
+
}),
|
|
33
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
34
|
+
children: loadedPercentageStr
|
|
35
|
+
})
|
|
36
|
+
],
|
|
37
|
+
color: "gray",
|
|
38
|
+
backgroundColor: loadingColor
|
|
39
|
+
}),
|
|
40
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
41
|
+
children: " ".repeat(bufferedCount$1 - loadedCount$1 | 0),
|
|
42
|
+
backgroundColor: "gray"
|
|
43
|
+
}),
|
|
44
|
+
JsxRuntime.jsx($$Ink.Text, {
|
|
45
|
+
children: " ".repeat(barWidth - bufferedCount$1 | 0),
|
|
46
|
+
backgroundColor: "white"
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var make = BufferedProgressBar;
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
make ,
|
|
56
|
+
}
|
|
57
|
+
/* ink Not a pure module */
|