1
1
const chalk = require ( 'chalk' )
2
+
3
+ colorComment = comment => chalk . gray ( comment )
4
+
5
+ colorPrimitive = primitive => chalk . magentaBright ( primitive )
6
+
2
7
const SILENT = {
3
8
category : 'Global Config' ,
4
9
name : 'silent' ,
@@ -12,7 +17,7 @@ const OPTION_MERGE_STRATEGIES = {
12
17
name : 'optionMergeStrategies' ,
13
18
type : '{ [key: string]: Function }' ,
14
19
default : '{}' ,
15
- usage : `Vue.config.optionMergeStrategies._my_option = ${ chalk . magentaBright ( 'function' ) } (parent, child, vm) {
20
+ usage : `Vue.config.optionMergeStrategies._my_option = ${ chalk . magentaBright ( 'function' ) } (parent,child,vm){
16
21
${ chalk . magentaBright ( 'return' ) } child + 1
17
22
}
18
23
${ chalk . magentaBright ( 'const' ) } Profile = Vue.extend({
@@ -21,8 +26,8 @@ const OPTION_MERGE_STRATEGIES = {
21
26
// Profile.options._my_option = 2\n` ,
22
27
details : `Define custom merging strategies for options.
23
28
The merge strategy receives the value of that option defined
24
- on the parent and child instances as the first and second arguments, respectively.
25
- The context Vue instance is passed as the third argument.`
29
+ on the parent and child instances as the first and second arguments,
30
+ respectively. The context Vue instance is passed as the third argument.`
26
31
}
27
32
const DEVTOOLS = {
28
33
category : 'Global Config' ,
@@ -40,7 +45,7 @@ const ERROR_HANDLER = {
40
45
name : 'errorHandler' ,
41
46
type : 'Function' ,
42
47
default : 'undefined' ,
43
- usage : `Vue.config.errorHandler = ${ chalk . magentaBright ( 'function' ) } (err, vm, info) {
48
+ usage : `Vue.config.errorHandler = ${ chalk . magentaBright ( 'function' ) } (err,vm,info){
44
49
// handle error
45
50
// 'info' is a Vue-specific error info, e.g. which lifecycle hook
46
51
// the error was found in. Only available in 2.2.0+
@@ -61,31 +66,40 @@ const WARN_HANDLER = {
61
66
during development and is ignored in production.`
62
67
}
63
68
64
- /* const SILENT = {
69
+ const IGNORED_ELEMENTS = {
65
70
category : 'Global Config' ,
66
- name: '#silent',
67
- type: 'boolean',
68
- default: 'false',
69
- arguments: '',
70
- readOption: '',
71
- usage: `Vue.config.silent = ${chalk.magentaBright('true')}`,
72
- details: 'Suppress all Vue logs and warnings',
73
- example: ''
71
+ name : 'ignoredElements' ,
72
+ type : 'Array<string>' ,
73
+ usage : `Vue.config.ignoredElements = [
74
+ 'my-custom-web-component', 'another-web-component'
75
+ ]` ,
76
+ details : `Make Vue ignore custom elements defined outside of Vue
77
+ (e.g., using the Web Components APIs). Otherwise, it will throw
78
+ a warning about an ${ chalk . magentaBright ( 'Unknown custom element' ) } , assuming that you forgot to
79
+ register a global component or misspelled a component name.`
74
80
}
75
81
76
- const SILENT = {
82
+ const KEY_CODES = {
77
83
category : 'Global Config' ,
78
- name: '#silent',
79
- type: 'boolean',
80
- default: 'false',
81
- arguments: '',
82
- readOption: '',
83
- usage: `Vue.config.silent = ${chalk.magentaBright('true')}`,
84
- details: 'Suppress all Vue logs and warnings',
85
- example: ''
84
+ name : 'keyCodes' ,
85
+ type : '{ [key: string]: number | Array<number> }' ,
86
+ default : '{}' ,
87
+ usage : `Vue.config.keyCodes = {
88
+ v: ${ colorPrimitive ( '86' ) } ,
89
+ f1: ${ colorPrimitive ( '112' ) } ,
90
+ ${ colorComment ( "// camelCase won't work" ) }
91
+ mediaPlayPause: ${ colorPrimitive ( '179' ) } ,
92
+ ${ colorComment ( "// instead you can use kebab-case with double quotation marks" ) }
93
+ ${ chalk . green ( '"media-play-pause"' ) } : ${ colorPrimitive ( '179' ) } ,
94
+ up: ${ colorPrimitive ( '[38, 87]' ) }
95
+ }
96
+ ${ colorComment ( "// example" ) }
97
+ ${ chalk . blue ( '<input type=' ) } ${ chalk . green ( '"text"' ) } ${ chalk . blue ( '@keyup.media-play-pause=' ) } ${ chalk . green ( '"method"' ) } ${ chalk . blue ( '>' ) }
98
+ ` ,
99
+ details : 'Define custom key alias(es) for v-on.'
86
100
}
87
101
88
- const SILENT = {
102
+ /* const SILENT = {
89
103
category: 'Global Config',
90
104
name: '#silent',
91
105
type: 'boolean',
@@ -138,5 +152,7 @@ module.exports = {
138
152
OPTION_MERGE_STRATEGIES ,
139
153
DEVTOOLS ,
140
154
ERROR_HANDLER ,
141
- WARN_HANDLER
155
+ WARN_HANDLER ,
156
+ IGNORED_ELEMENTS ,
157
+ KEY_CODES
142
158
}
0 commit comments