@slexisvn/mlfw 0.1.0 → 0.1.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/dist/index.browser.js +284 -0
- package/dist/index.node.js +428 -0
- package/package.json +9 -24
- package/dist/cli.js +0 -411
- package/dist/index.js +0 -207
- package/patches/terminal-kit+3.1.2.patch +0 -140
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
diff --git a/node_modules/terminal-kit/lib/inputField.js b/node_modules/terminal-kit/lib/inputField.js
|
|
2
|
-
index ace59eb..89524a6 100644
|
|
3
|
-
--- a/node_modules/terminal-kit/lib/inputField.js
|
|
4
|
-
+++ b/node_modules/terminal-kit/lib/inputField.js
|
|
5
|
-
@@ -494,12 +494,16 @@ module.exports = function inputField( options , callback ) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var autoCompleteHint = () => {
|
|
9
|
-
- // The cursor should be at the end ATM
|
|
10
|
-
- if ( ! dynamic.autoComplete || ! dynamic.autoCompleteHint || offset < inputs[ inputIndex ].length ) {
|
|
11
|
-
+ if ( ! dynamic.autoComplete || ! dynamic.autoCompleteHint ) {
|
|
12
|
-
return ;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
- var autoCompleted , inputText = inputs[ inputIndex ].join( '' ) ;
|
|
16
|
-
+ var atEnd = offset >= inputs[ inputIndex ].length ;
|
|
17
|
-
+ var inputText = atEnd
|
|
18
|
-
+ ? inputs[ inputIndex ].join( '' )
|
|
19
|
-
+ : inputs[ inputIndex ].slice( 0 , offset ).join( '' ) ;
|
|
20
|
-
+
|
|
21
|
-
+ var autoCompleted ;
|
|
22
|
-
|
|
23
|
-
var finishCompletion = () => {
|
|
24
|
-
if ( Array.isArray( autoCompleted ) ) { return ; }
|
|
25
|
-
@@ -508,8 +512,18 @@ module.exports = function inputField( options , callback ) {
|
|
26
|
-
.slice( 0 , options.maxLength - inputs[ inputIndex ].length ) ;
|
|
27
|
-
|
|
28
|
-
computeAllCoordinate() ;
|
|
29
|
-
- this.moveTo( end.x , end.y ) ; // computeAllCoordinate() can add some newline
|
|
30
|
-
- dynamic.hintStyle.noFormat( hint.join( '' ) ) ;
|
|
31
|
-
+ if ( atEnd ) {
|
|
32
|
-
+ this.moveTo( end.x , end.y ) ;
|
|
33
|
-
+ dynamic.hintStyle.noFormat( hint.join( '' ) ) ;
|
|
34
|
-
+ }
|
|
35
|
-
+ else {
|
|
36
|
-
+ this.moveTo( cursor.x , cursor.y ) ;
|
|
37
|
-
+ this.saveCursor() ;
|
|
38
|
-
+ dynamic.style.noFormat.eraseLineAfter( '' ) ;
|
|
39
|
-
+ dynamic.hintStyle.noFormat( hint.join( '' ) ) ;
|
|
40
|
-
+ var rightPart = inputs[ inputIndex ].slice( offset ).join( '' ) ;
|
|
41
|
-
+ dynamic.style.noFormat( rightPart ) ;
|
|
42
|
-
+ }
|
|
43
|
-
this.moveTo( cursor.x , cursor.y ) ;
|
|
44
|
-
} ;
|
|
45
|
-
|
|
46
|
-
@@ -568,6 +582,32 @@ module.exports = function inputField( options , callback ) {
|
|
47
|
-
|
|
48
|
-
if ( inputs[ inputIndex ].length >= options.maxLength ) { return ; }
|
|
49
|
-
|
|
50
|
-
+ if ( options.autoClosePairs ) {
|
|
51
|
-
+ var closePair = options.autoClosePairs[ key ] ;
|
|
52
|
-
+ var closingPairs = Object.values( options.autoClosePairs ) ;
|
|
53
|
-
+
|
|
54
|
-
+ if ( closingPairs.includes( key ) && inputs[ inputIndex ][ offset ] === key ) {
|
|
55
|
-
+ offset ++ ;
|
|
56
|
-
+ if ( echo ) {
|
|
57
|
-
+ computeAllCoordinate() ;
|
|
58
|
-
+ redraw() ;
|
|
59
|
-
+ if ( dynamic.autoCompleteHint ) { autoCompleteHint() ; }
|
|
60
|
-
+ }
|
|
61
|
-
+ return ;
|
|
62
|
-
+ }
|
|
63
|
-
+
|
|
64
|
-
+ if ( closePair ) {
|
|
65
|
-
+ inputs[ inputIndex ].splice( offset , 0 , key , closePair ) ;
|
|
66
|
-
+ offset ++ ;
|
|
67
|
-
+ if ( echo ) {
|
|
68
|
-
+ computeAllCoordinate() ;
|
|
69
|
-
+ redraw() ;
|
|
70
|
-
+ if ( dynamic.autoCompleteHint ) { autoCompleteHint() ; }
|
|
71
|
-
+ }
|
|
72
|
-
+ return ;
|
|
73
|
-
+ }
|
|
74
|
-
+ }
|
|
75
|
-
+
|
|
76
|
-
// Insert version
|
|
77
|
-
//inputs[ inputIndex ] = inputs[ inputIndex ].slice( 0 , offset ) + key + inputs[ inputIndex ].slice( offset ) ;
|
|
78
|
-
inputs[ inputIndex ].splice( offset , 0 , key ) ;
|
|
79
|
-
@@ -609,6 +649,9 @@ module.exports = function inputField( options , callback ) {
|
|
80
|
-
case 'backDelete' :
|
|
81
|
-
if ( inputs[ inputIndex ].length && offset > 0 ) {
|
|
82
|
-
charToDelete = inputs[ inputIndex ][ offset - 1 ] ;
|
|
83
|
-
+ if ( options.autoClosePairs && options.autoClosePairs[ charToDelete ] === inputs[ inputIndex ][ offset ] ) {
|
|
84
|
-
+ inputs[ inputIndex ].splice( offset , 1 ) ;
|
|
85
|
-
+ }
|
|
86
|
-
inputs[ inputIndex ].splice( offset - 1 , 1 ) ;
|
|
87
|
-
offset -- ;
|
|
88
|
-
|
|
89
|
-
@@ -633,6 +676,7 @@ module.exports = function inputField( options , callback ) {
|
|
90
|
-
this.left( 1 ) ;
|
|
91
|
-
this.delete( 1 ) ;
|
|
92
|
-
}
|
|
93
|
-
+ if ( dynamic.autoCompleteHint ) { autoCompleteHint() ; }
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
@@ -688,31 +732,29 @@ module.exports = function inputField( options , callback ) {
|
|
98
|
-
|
|
99
|
-
case 'backward' :
|
|
100
|
-
if ( inputs[ inputIndex ].length && offset > 0 ) {
|
|
101
|
-
- if ( dynamic.autoCompleteHint && offset === inputs[ inputIndex ].length ) {
|
|
102
|
-
- clearHint() ;
|
|
103
|
-
- }
|
|
104
|
-
-
|
|
105
|
-
+ clearHint() ;
|
|
106
|
-
offset -- ;
|
|
107
|
-
|
|
108
|
-
if ( echo ) {
|
|
109
|
-
computeAllCoordinate() ;
|
|
110
|
-
- this.moveTo( cursor.x , cursor.y ) ;
|
|
111
|
-
+ redraw() ;
|
|
112
|
-
}
|
|
113
|
-
+
|
|
114
|
-
+ if ( dynamic.autoCompleteHint ) { autoCompleteHint() ; }
|
|
115
|
-
}
|
|
116
|
-
break ;
|
|
117
|
-
|
|
118
|
-
case 'forward' :
|
|
119
|
-
if ( inputs[ inputIndex ].length && offset < inputs[ inputIndex ].length ) {
|
|
120
|
-
+ clearHint() ;
|
|
121
|
-
offset ++ ;
|
|
122
|
-
|
|
123
|
-
if ( echo ) {
|
|
124
|
-
computeAllCoordinate() ;
|
|
125
|
-
- this.moveTo( cursor.x , cursor.y ) ;
|
|
126
|
-
+ redraw() ;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
- if ( dynamic.autoCompleteHint && offset === inputs[ inputIndex ].length ) {
|
|
130
|
-
- autoCompleteHint() ;
|
|
131
|
-
- }
|
|
132
|
-
+ if ( dynamic.autoCompleteHint ) { autoCompleteHint() ; }
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
break ;
|
|
136
|
-
@@ -1066,4 +1108,3 @@ module.exports = function inputField( options , callback ) {
|
|
137
|
-
|
|
138
|
-
return controller ;
|
|
139
|
-
} ;
|
|
140
|
-
-
|