fluentd-ui 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (287) hide show
  1. data/ChangeLog +9 -0
  2. data/Gemfile.lock +47 -44
  3. data/README.md +4 -4
  4. data/app/assets/javascripts/vue/in_tail_format.js +7 -2
  5. data/app/assets/stylesheets/common.css.scss +16 -0
  6. data/app/controllers/concerns/setting_history_concern.rb +6 -0
  7. data/app/controllers/fluentd/settings_controller.rb +37 -8
  8. data/app/models/fluent_gem.rb +6 -3
  9. data/app/models/fluentd/agent.rb +1 -0
  10. data/app/models/fluentd/agent/common.rb +4 -0
  11. data/app/models/fluentd/agent/fluentd_gem.rb +9 -13
  12. data/app/models/fluentd/agent/local_common.rb +23 -0
  13. data/app/models/fluentd/agent/td_agent.rb +4 -0
  14. data/app/models/fluentd/agent/td_agent/macosx.rb +0 -4
  15. data/app/models/fluentd/agent/td_agent/unix.rb +0 -4
  16. data/app/views/fluentd/settings/edit.html.haml +1 -3
  17. data/app/views/fluentd/settings/histories/show.html.haml +10 -0
  18. data/app/views/fluentd/settings/running_backup/show.html.haml +11 -0
  19. data/app/views/shared/settings/_diff.html.erb +21 -0
  20. data/circle.yml +5 -0
  21. data/config/application.rb +1 -0
  22. data/config/locales/translation_en.yml +7 -0
  23. data/config/locales/translation_ja.yml +7 -0
  24. data/fluentd-ui.gemspec +1 -0
  25. data/lib/fluentd-ui.rb +5 -1
  26. data/lib/fluentd-ui/version.rb +1 -1
  27. data/spec/features/fluentd/setting/histories_spec.rb +23 -1
  28. data/spec/features/fluentd/setting/running_backup_spec.rb +22 -1
  29. data/spec/models/fluentd/agent/local_common_spec.rb +4 -2
  30. data/spec/models/fluentd/agent_spec.rb +1 -48
  31. data/spec/models/plugin_spec.rb +2 -2
  32. data/spec/spec_helper.rb +10 -0
  33. data/spec/support/fluentd_agent_common_behavior.rb +53 -0
  34. data/vendor/assets/javascripts/bower/.gitignore +10 -0
  35. data/vendor/assets/javascripts/bower/vue/.bower.json +4 -4
  36. data/vendor/assets/javascripts/bower/vue/bower.json +17 -0
  37. data/vendor/assets/javascripts/bower/vue/dist/vue.js +329 -198
  38. data/vendor/assets/javascripts/bower/vue/dist/vue.min.js +3 -3
  39. metadata +107 -291
  40. checksums.yaml +0 -7
  41. data/vendor/assets/javascripts/bower/codemirror/AUTHORS +0 -423
  42. data/vendor/assets/javascripts/bower/codemirror/CONTRIBUTING.md +0 -76
  43. data/vendor/assets/javascripts/bower/codemirror/LICENSE +0 -19
  44. data/vendor/assets/javascripts/bower/codemirror/README.md +0 -11
  45. data/vendor/assets/javascripts/bower/codemirror/addon/comment/comment.js +0 -183
  46. data/vendor/assets/javascripts/bower/codemirror/addon/comment/continuecomment.js +0 -85
  47. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.css +0 -32
  48. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.js +0 -155
  49. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.css +0 -6
  50. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.js +0 -41
  51. data/vendor/assets/javascripts/bower/codemirror/addon/display/panel.js +0 -94
  52. data/vendor/assets/javascripts/bower/codemirror/addon/display/placeholder.js +0 -58
  53. data/vendor/assets/javascripts/bower/codemirror/addon/display/rulers.js +0 -64
  54. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closebrackets.js +0 -159
  55. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closetag.js +0 -159
  56. data/vendor/assets/javascripts/bower/codemirror/addon/edit/continuelist.js +0 -51
  57. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchbrackets.js +0 -120
  58. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchtags.js +0 -66
  59. data/vendor/assets/javascripts/bower/codemirror/addon/edit/trailingspace.js +0 -27
  60. data/vendor/assets/javascripts/bower/codemirror/addon/fold/brace-fold.js +0 -105
  61. data/vendor/assets/javascripts/bower/codemirror/addon/fold/comment-fold.js +0 -57
  62. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldcode.js +0 -145
  63. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.css +0 -20
  64. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.js +0 -134
  65. data/vendor/assets/javascripts/bower/codemirror/addon/fold/indent-fold.js +0 -44
  66. data/vendor/assets/javascripts/bower/codemirror/addon/fold/markdown-fold.js +0 -49
  67. data/vendor/assets/javascripts/bower/codemirror/addon/fold/xml-fold.js +0 -182
  68. data/vendor/assets/javascripts/bower/codemirror/addon/hint/anyword-hint.js +0 -41
  69. data/vendor/assets/javascripts/bower/codemirror/addon/hint/css-hint.js +0 -56
  70. data/vendor/assets/javascripts/bower/codemirror/addon/hint/html-hint.js +0 -348
  71. data/vendor/assets/javascripts/bower/codemirror/addon/hint/javascript-hint.js +0 -146
  72. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.css +0 -38
  73. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.js +0 -389
  74. data/vendor/assets/javascripts/bower/codemirror/addon/hint/sql-hint.js +0 -197
  75. data/vendor/assets/javascripts/bower/codemirror/addon/hint/xml-hint.js +0 -110
  76. data/vendor/assets/javascripts/bower/codemirror/addon/lint/coffeescript-lint.js +0 -41
  77. data/vendor/assets/javascripts/bower/codemirror/addon/lint/css-lint.js +0 -35
  78. data/vendor/assets/javascripts/bower/codemirror/addon/lint/javascript-lint.js +0 -136
  79. data/vendor/assets/javascripts/bower/codemirror/addon/lint/json-lint.js +0 -31
  80. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.css +0 -73
  81. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.js +0 -204
  82. data/vendor/assets/javascripts/bower/codemirror/addon/lint/yaml-lint.js +0 -28
  83. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.css +0 -112
  84. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.js +0 -643
  85. data/vendor/assets/javascripts/bower/codemirror/addon/mode/loadmode.js +0 -64
  86. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex.js +0 -118
  87. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex_test.js +0 -33
  88. data/vendor/assets/javascripts/bower/codemirror/addon/mode/overlay.js +0 -85
  89. data/vendor/assets/javascripts/bower/codemirror/addon/mode/simple.js +0 -213
  90. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/colorize.js +0 -40
  91. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode-standalone.js +0 -157
  92. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.js +0 -72
  93. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.node.js +0 -120
  94. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/annotatescrollbar.js +0 -76
  95. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/scrollpastend.js +0 -46
  96. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.css +0 -66
  97. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.js +0 -139
  98. data/vendor/assets/javascripts/bower/codemirror/addon/search/match-highlighter.js +0 -128
  99. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.css +0 -8
  100. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.js +0 -90
  101. data/vendor/assets/javascripts/bower/codemirror/addon/search/search.js +0 -164
  102. data/vendor/assets/javascripts/bower/codemirror/addon/search/searchcursor.js +0 -189
  103. data/vendor/assets/javascripts/bower/codemirror/addon/selection/active-line.js +0 -71
  104. data/vendor/assets/javascripts/bower/codemirror/addon/selection/mark-selection.js +0 -118
  105. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.css +0 -86
  106. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.js +0 -670
  107. data/vendor/assets/javascripts/bower/codemirror/addon/tern/worker.js +0 -44
  108. data/vendor/assets/javascripts/bower/codemirror/addon/wrap/hardwrap.js +0 -139
  109. data/vendor/assets/javascripts/bower/codemirror/keymap/emacs.js +0 -411
  110. data/vendor/assets/javascripts/bower/codemirror/keymap/sublime.js +0 -540
  111. data/vendor/assets/javascripts/bower/codemirror/keymap/vim.js +0 -4901
  112. data/vendor/assets/javascripts/bower/codemirror/mode/apl/apl.js +0 -175
  113. data/vendor/assets/javascripts/bower/codemirror/mode/asterisk/asterisk.js +0 -198
  114. data/vendor/assets/javascripts/bower/codemirror/mode/clike/clike.js +0 -489
  115. data/vendor/assets/javascripts/bower/codemirror/mode/clike/scala.html +0 -767
  116. data/vendor/assets/javascripts/bower/codemirror/mode/clojure/clojure.js +0 -243
  117. data/vendor/assets/javascripts/bower/codemirror/mode/cobol/cobol.js +0 -255
  118. data/vendor/assets/javascripts/bower/codemirror/mode/coffeescript/coffeescript.js +0 -369
  119. data/vendor/assets/javascripts/bower/codemirror/mode/commonlisp/commonlisp.js +0 -122
  120. data/vendor/assets/javascripts/bower/codemirror/mode/css/css.js +0 -717
  121. data/vendor/assets/javascripts/bower/codemirror/mode/css/less.html +0 -152
  122. data/vendor/assets/javascripts/bower/codemirror/mode/css/less_test.js +0 -51
  123. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss.html +0 -157
  124. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss_test.js +0 -110
  125. data/vendor/assets/javascripts/bower/codemirror/mode/css/test.js +0 -135
  126. data/vendor/assets/javascripts/bower/codemirror/mode/cypher/cypher.js +0 -146
  127. data/vendor/assets/javascripts/bower/codemirror/mode/d/d.js +0 -218
  128. data/vendor/assets/javascripts/bower/codemirror/mode/dart/dart.js +0 -50
  129. data/vendor/assets/javascripts/bower/codemirror/mode/diff/diff.js +0 -47
  130. data/vendor/assets/javascripts/bower/codemirror/mode/django/django.js +0 -67
  131. data/vendor/assets/javascripts/bower/codemirror/mode/dockerfile/dockerfile.js +0 -76
  132. data/vendor/assets/javascripts/bower/codemirror/mode/dtd/dtd.js +0 -142
  133. data/vendor/assets/javascripts/bower/codemirror/mode/dylan/dylan.js +0 -299
  134. data/vendor/assets/javascripts/bower/codemirror/mode/ebnf/ebnf.js +0 -195
  135. data/vendor/assets/javascripts/bower/codemirror/mode/ecl/ecl.js +0 -207
  136. data/vendor/assets/javascripts/bower/codemirror/mode/eiffel/eiffel.js +0 -162
  137. data/vendor/assets/javascripts/bower/codemirror/mode/erlang/erlang.js +0 -622
  138. data/vendor/assets/javascripts/bower/codemirror/mode/fortran/fortran.js +0 -188
  139. data/vendor/assets/javascripts/bower/codemirror/mode/gas/gas.js +0 -345
  140. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/gfm.js +0 -123
  141. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/test.js +0 -213
  142. data/vendor/assets/javascripts/bower/codemirror/mode/gherkin/gherkin.js +0 -178
  143. data/vendor/assets/javascripts/bower/codemirror/mode/go/go.js +0 -184
  144. data/vendor/assets/javascripts/bower/codemirror/mode/groovy/groovy.js +0 -226
  145. data/vendor/assets/javascripts/bower/codemirror/mode/haml/haml.js +0 -159
  146. data/vendor/assets/javascripts/bower/codemirror/mode/haml/test.js +0 -97
  147. data/vendor/assets/javascripts/bower/codemirror/mode/haskell/haskell.js +0 -267
  148. data/vendor/assets/javascripts/bower/codemirror/mode/haxe/haxe.js +0 -518
  149. data/vendor/assets/javascripts/bower/codemirror/mode/htmlembedded/htmlembedded.js +0 -86
  150. data/vendor/assets/javascripts/bower/codemirror/mode/htmlmixed/htmlmixed.js +0 -121
  151. data/vendor/assets/javascripts/bower/codemirror/mode/http/http.js +0 -113
  152. data/vendor/assets/javascripts/bower/codemirror/mode/idl/idl.js +0 -290
  153. data/vendor/assets/javascripts/bower/codemirror/mode/jade/jade.js +0 -590
  154. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/javascript.js +0 -686
  155. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/json-ld.html +0 -72
  156. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/test.js +0 -200
  157. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/typescript.html +0 -61
  158. data/vendor/assets/javascripts/bower/codemirror/mode/jinja2/jinja2.js +0 -142
  159. data/vendor/assets/javascripts/bower/codemirror/mode/julia/julia.js +0 -301
  160. data/vendor/assets/javascripts/bower/codemirror/mode/kotlin/kotlin.js +0 -280
  161. data/vendor/assets/javascripts/bower/codemirror/mode/livescript/livescript.js +0 -280
  162. data/vendor/assets/javascripts/bower/codemirror/mode/lua/lua.js +0 -159
  163. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/markdown.js +0 -765
  164. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/test.js +0 -754
  165. data/vendor/assets/javascripts/bower/codemirror/mode/meta.js +0 -165
  166. data/vendor/assets/javascripts/bower/codemirror/mode/mirc/mirc.js +0 -193
  167. data/vendor/assets/javascripts/bower/codemirror/mode/mllike/mllike.js +0 -205
  168. data/vendor/assets/javascripts/bower/codemirror/mode/modelica/modelica.js +0 -245
  169. data/vendor/assets/javascripts/bower/codemirror/mode/nginx/nginx.js +0 -178
  170. data/vendor/assets/javascripts/bower/codemirror/mode/ntriples/ntriples.js +0 -186
  171. data/vendor/assets/javascripts/bower/codemirror/mode/octave/octave.js +0 -135
  172. data/vendor/assets/javascripts/bower/codemirror/mode/pascal/pascal.js +0 -109
  173. data/vendor/assets/javascripts/bower/codemirror/mode/pegjs/pegjs.js +0 -114
  174. data/vendor/assets/javascripts/bower/codemirror/mode/perl/perl.js +0 -832
  175. data/vendor/assets/javascripts/bower/codemirror/mode/php/php.js +0 -226
  176. data/vendor/assets/javascripts/bower/codemirror/mode/php/test.js +0 -154
  177. data/vendor/assets/javascripts/bower/codemirror/mode/pig/pig.js +0 -188
  178. data/vendor/assets/javascripts/bower/codemirror/mode/properties/properties.js +0 -78
  179. data/vendor/assets/javascripts/bower/codemirror/mode/puppet/puppet.js +0 -220
  180. data/vendor/assets/javascripts/bower/codemirror/mode/python/python.js +0 -359
  181. data/vendor/assets/javascripts/bower/codemirror/mode/q/q.js +0 -139
  182. data/vendor/assets/javascripts/bower/codemirror/mode/r/r.js +0 -162
  183. data/vendor/assets/javascripts/bower/codemirror/mode/rpm/rpm.js +0 -101
  184. data/vendor/assets/javascripts/bower/codemirror/mode/rst/rst.js +0 -557
  185. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/ruby.js +0 -285
  186. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/test.js +0 -14
  187. data/vendor/assets/javascripts/bower/codemirror/mode/rust/rust.js +0 -451
  188. data/vendor/assets/javascripts/bower/codemirror/mode/sass/sass.js +0 -327
  189. data/vendor/assets/javascripts/bower/codemirror/mode/scheme/scheme.js +0 -248
  190. data/vendor/assets/javascripts/bower/codemirror/mode/shell/shell.js +0 -139
  191. data/vendor/assets/javascripts/bower/codemirror/mode/shell/test.js +0 -58
  192. data/vendor/assets/javascripts/bower/codemirror/mode/sieve/sieve.js +0 -193
  193. data/vendor/assets/javascripts/bower/codemirror/mode/slim/slim.js +0 -575
  194. data/vendor/assets/javascripts/bower/codemirror/mode/slim/test.js +0 -96
  195. data/vendor/assets/javascripts/bower/codemirror/mode/smalltalk/smalltalk.js +0 -168
  196. data/vendor/assets/javascripts/bower/codemirror/mode/smarty/smarty.js +0 -221
  197. data/vendor/assets/javascripts/bower/codemirror/mode/smartymixed/smartymixed.js +0 -197
  198. data/vendor/assets/javascripts/bower/codemirror/mode/solr/solr.js +0 -104
  199. data/vendor/assets/javascripts/bower/codemirror/mode/soy/soy.js +0 -198
  200. data/vendor/assets/javascripts/bower/codemirror/mode/sparql/sparql.js +0 -174
  201. data/vendor/assets/javascripts/bower/codemirror/mode/spreadsheet/spreadsheet.js +0 -109
  202. data/vendor/assets/javascripts/bower/codemirror/mode/sql/sql.js +0 -391
  203. data/vendor/assets/javascripts/bower/codemirror/mode/stex/stex.js +0 -251
  204. data/vendor/assets/javascripts/bower/codemirror/mode/stex/test.js +0 -123
  205. data/vendor/assets/javascripts/bower/codemirror/mode/tcl/tcl.js +0 -147
  206. data/vendor/assets/javascripts/bower/codemirror/mode/textile/test.js +0 -417
  207. data/vendor/assets/javascripts/bower/codemirror/mode/textile/textile.js +0 -469
  208. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.css +0 -14
  209. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.js +0 -369
  210. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.css +0 -26
  211. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.js +0 -323
  212. data/vendor/assets/javascripts/bower/codemirror/mode/toml/toml.js +0 -88
  213. data/vendor/assets/javascripts/bower/codemirror/mode/tornado/tornado.js +0 -68
  214. data/vendor/assets/javascripts/bower/codemirror/mode/turtle/turtle.js +0 -162
  215. data/vendor/assets/javascripts/bower/codemirror/mode/vb/vb.js +0 -274
  216. data/vendor/assets/javascripts/bower/codemirror/mode/vbscript/vbscript.js +0 -350
  217. data/vendor/assets/javascripts/bower/codemirror/mode/velocity/velocity.js +0 -201
  218. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/test.js +0 -273
  219. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/verilog.js +0 -364
  220. data/vendor/assets/javascripts/bower/codemirror/mode/xml/test.js +0 -51
  221. data/vendor/assets/javascripts/bower/codemirror/mode/xml/xml.js +0 -384
  222. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/test.js +0 -67
  223. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/xquery.js +0 -447
  224. data/vendor/assets/javascripts/bower/codemirror/mode/yaml/yaml.js +0 -117
  225. data/vendor/assets/javascripts/bower/codemirror/mode/z80/z80.js +0 -100
  226. data/vendor/assets/javascripts/bower/vue/LICENSE +0 -21
  227. data/vendor/assets/javascripts/bower/vue/src/api/child.js +0 -53
  228. data/vendor/assets/javascripts/bower/vue/src/api/data.js +0 -161
  229. data/vendor/assets/javascripts/bower/vue/src/api/dom.js +0 -211
  230. data/vendor/assets/javascripts/bower/vue/src/api/events.js +0 -176
  231. data/vendor/assets/javascripts/bower/vue/src/api/global.js +0 -146
  232. data/vendor/assets/javascripts/bower/vue/src/api/lifecycle.js +0 -72
  233. data/vendor/assets/javascripts/bower/vue/src/batcher.js +0 -65
  234. data/vendor/assets/javascripts/bower/vue/src/cache.js +0 -112
  235. data/vendor/assets/javascripts/bower/vue/src/compiler/compile.js +0 -549
  236. data/vendor/assets/javascripts/bower/vue/src/compiler/transclude.js +0 -146
  237. data/vendor/assets/javascripts/bower/vue/src/config.js +0 -79
  238. data/vendor/assets/javascripts/bower/vue/src/directive.js +0 -219
  239. data/vendor/assets/javascripts/bower/vue/src/directives/attr.js +0 -32
  240. data/vendor/assets/javascripts/bower/vue/src/directives/class.js +0 -18
  241. data/vendor/assets/javascripts/bower/vue/src/directives/cloak.js +0 -12
  242. data/vendor/assets/javascripts/bower/vue/src/directives/component.js +0 -196
  243. data/vendor/assets/javascripts/bower/vue/src/directives/el.js +0 -13
  244. data/vendor/assets/javascripts/bower/vue/src/directives/html.js +0 -38
  245. data/vendor/assets/javascripts/bower/vue/src/directives/if.js +0 -87
  246. data/vendor/assets/javascripts/bower/vue/src/directives/index.js +0 -22
  247. data/vendor/assets/javascripts/bower/vue/src/directives/model/checkbox.js +0 -25
  248. data/vendor/assets/javascripts/bower/vue/src/directives/model/default.js +0 -123
  249. data/vendor/assets/javascripts/bower/vue/src/directives/model/index.js +0 -56
  250. data/vendor/assets/javascripts/bower/vue/src/directives/model/radio.js +0 -26
  251. data/vendor/assets/javascripts/bower/vue/src/directives/model/select.js +0 -166
  252. data/vendor/assets/javascripts/bower/vue/src/directives/on.js +0 -59
  253. data/vendor/assets/javascripts/bower/vue/src/directives/partial.js +0 -44
  254. data/vendor/assets/javascripts/bower/vue/src/directives/ref.js +0 -24
  255. data/vendor/assets/javascripts/bower/vue/src/directives/repeat.js +0 -503
  256. data/vendor/assets/javascripts/bower/vue/src/directives/show.js +0 -8
  257. data/vendor/assets/javascripts/bower/vue/src/directives/style.js +0 -58
  258. data/vendor/assets/javascripts/bower/vue/src/directives/text.js +0 -15
  259. data/vendor/assets/javascripts/bower/vue/src/directives/transition.js +0 -12
  260. data/vendor/assets/javascripts/bower/vue/src/directives/with.js +0 -47
  261. data/vendor/assets/javascripts/bower/vue/src/filters/array-filters.js +0 -87
  262. data/vendor/assets/javascripts/bower/vue/src/filters/index.js +0 -135
  263. data/vendor/assets/javascripts/bower/vue/src/instance/compile.js +0 -179
  264. data/vendor/assets/javascripts/bower/vue/src/instance/events.js +0 -122
  265. data/vendor/assets/javascripts/bower/vue/src/instance/init.js +0 -76
  266. data/vendor/assets/javascripts/bower/vue/src/instance/scope.js +0 -217
  267. data/vendor/assets/javascripts/bower/vue/src/observer/array.js +0 -90
  268. data/vendor/assets/javascripts/bower/vue/src/observer/dep.js +0 -50
  269. data/vendor/assets/javascripts/bower/vue/src/observer/index.js +0 -235
  270. data/vendor/assets/javascripts/bower/vue/src/observer/object.js +0 -66
  271. data/vendor/assets/javascripts/bower/vue/src/parsers/directive.js +0 -159
  272. data/vendor/assets/javascripts/bower/vue/src/parsers/expression.js +0 -226
  273. data/vendor/assets/javascripts/bower/vue/src/parsers/path.js +0 -300
  274. data/vendor/assets/javascripts/bower/vue/src/parsers/template.js +0 -248
  275. data/vendor/assets/javascripts/bower/vue/src/parsers/text.js +0 -178
  276. data/vendor/assets/javascripts/bower/vue/src/transition/css.js +0 -189
  277. data/vendor/assets/javascripts/bower/vue/src/transition/index.js +0 -151
  278. data/vendor/assets/javascripts/bower/vue/src/transition/js.js +0 -43
  279. data/vendor/assets/javascripts/bower/vue/src/util/debug.js +0 -50
  280. data/vendor/assets/javascripts/bower/vue/src/util/dom.js +0 -197
  281. data/vendor/assets/javascripts/bower/vue/src/util/env.js +0 -74
  282. data/vendor/assets/javascripts/bower/vue/src/util/filter.js +0 -72
  283. data/vendor/assets/javascripts/bower/vue/src/util/index.js +0 -8
  284. data/vendor/assets/javascripts/bower/vue/src/util/lang.js +0 -175
  285. data/vendor/assets/javascripts/bower/vue/src/util/merge-option.js +0 -255
  286. data/vendor/assets/javascripts/bower/vue/src/vue.js +0 -84
  287. data/vendor/assets/javascripts/bower/vue/src/watcher.js +0 -240
@@ -1,86 +0,0 @@
1
- .CodeMirror-Tern-completion {
2
- padding-left: 22px;
3
- position: relative;
4
- }
5
- .CodeMirror-Tern-completion:before {
6
- position: absolute;
7
- left: 2px;
8
- bottom: 2px;
9
- border-radius: 50%;
10
- font-size: 12px;
11
- font-weight: bold;
12
- height: 15px;
13
- width: 15px;
14
- line-height: 16px;
15
- text-align: center;
16
- color: white;
17
- -moz-box-sizing: border-box;
18
- box-sizing: border-box;
19
- }
20
- .CodeMirror-Tern-completion-unknown:before {
21
- content: "?";
22
- background: #4bb;
23
- }
24
- .CodeMirror-Tern-completion-object:before {
25
- content: "O";
26
- background: #77c;
27
- }
28
- .CodeMirror-Tern-completion-fn:before {
29
- content: "F";
30
- background: #7c7;
31
- }
32
- .CodeMirror-Tern-completion-array:before {
33
- content: "A";
34
- background: #c66;
35
- }
36
- .CodeMirror-Tern-completion-number:before {
37
- content: "1";
38
- background: #999;
39
- }
40
- .CodeMirror-Tern-completion-string:before {
41
- content: "S";
42
- background: #999;
43
- }
44
- .CodeMirror-Tern-completion-bool:before {
45
- content: "B";
46
- background: #999;
47
- }
48
-
49
- .CodeMirror-Tern-completion-guess {
50
- color: #999;
51
- }
52
-
53
- .CodeMirror-Tern-tooltip {
54
- border: 1px solid silver;
55
- border-radius: 3px;
56
- color: #444;
57
- padding: 2px 5px;
58
- font-size: 90%;
59
- font-family: monospace;
60
- background-color: white;
61
- white-space: pre-wrap;
62
-
63
- max-width: 40em;
64
- position: absolute;
65
- z-index: 10;
66
- -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
67
- -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
68
- box-shadow: 2px 3px 5px rgba(0,0,0,.2);
69
-
70
- transition: opacity 1s;
71
- -moz-transition: opacity 1s;
72
- -webkit-transition: opacity 1s;
73
- -o-transition: opacity 1s;
74
- -ms-transition: opacity 1s;
75
- }
76
-
77
- .CodeMirror-Tern-hint-doc {
78
- max-width: 25em;
79
- margin-top: -3px;
80
- }
81
-
82
- .CodeMirror-Tern-fname { color: black; }
83
- .CodeMirror-Tern-farg { color: #70a; }
84
- .CodeMirror-Tern-farg-current { text-decoration: underline; }
85
- .CodeMirror-Tern-type { color: #07c; }
86
- .CodeMirror-Tern-fhint-guess { opacity: .7; }
@@ -1,670 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Glue code between CodeMirror and Tern.
5
- //
6
- // Create a CodeMirror.TernServer to wrap an actual Tern server,
7
- // register open documents (CodeMirror.Doc instances) with it, and
8
- // call its methods to activate the assisting functions that Tern
9
- // provides.
10
- //
11
- // Options supported (all optional):
12
- // * defs: An array of JSON definition data structures.
13
- // * plugins: An object mapping plugin names to configuration
14
- // options.
15
- // * getFile: A function(name, c) that can be used to access files in
16
- // the project that haven't been loaded yet. Simply do c(null) to
17
- // indicate that a file is not available.
18
- // * fileFilter: A function(value, docName, doc) that will be applied
19
- // to documents before passing them on to Tern.
20
- // * switchToDoc: A function(name, doc) that should, when providing a
21
- // multi-file view, switch the view or focus to the named file.
22
- // * showError: A function(editor, message) that can be used to
23
- // override the way errors are displayed.
24
- // * completionTip: Customize the content in tooltips for completions.
25
- // Is passed a single argument—the completion's data as returned by
26
- // Tern—and may return a string, DOM node, or null to indicate that
27
- // no tip should be shown. By default the docstring is shown.
28
- // * typeTip: Like completionTip, but for the tooltips shown for type
29
- // queries.
30
- // * responseFilter: A function(doc, query, request, error, data) that
31
- // will be applied to the Tern responses before treating them
32
- //
33
- //
34
- // It is possible to run the Tern server in a web worker by specifying
35
- // these additional options:
36
- // * useWorker: Set to true to enable web worker mode. You'll probably
37
- // want to feature detect the actual value you use here, for example
38
- // !!window.Worker.
39
- // * workerScript: The main script of the worker. Point this to
40
- // wherever you are hosting worker.js from this directory.
41
- // * workerDeps: An array of paths pointing (relative to workerScript)
42
- // to the Acorn and Tern libraries and any Tern plugins you want to
43
- // load. Or, if you minified those into a single script and included
44
- // them in the workerScript, simply leave this undefined.
45
-
46
- (function(mod) {
47
- if (typeof exports == "object" && typeof module == "object") // CommonJS
48
- mod(require("../../lib/codemirror"));
49
- else if (typeof define == "function" && define.amd) // AMD
50
- define(["../../lib/codemirror"], mod);
51
- else // Plain browser env
52
- mod(CodeMirror);
53
- })(function(CodeMirror) {
54
- "use strict";
55
- // declare global: tern
56
-
57
- CodeMirror.TernServer = function(options) {
58
- var self = this;
59
- this.options = options || {};
60
- var plugins = this.options.plugins || (this.options.plugins = {});
61
- if (!plugins.doc_comment) plugins.doc_comment = true;
62
- if (this.options.useWorker) {
63
- this.server = new WorkerServer(this);
64
- } else {
65
- this.server = new tern.Server({
66
- getFile: function(name, c) { return getFile(self, name, c); },
67
- async: true,
68
- defs: this.options.defs || [],
69
- plugins: plugins
70
- });
71
- }
72
- this.docs = Object.create(null);
73
- this.trackChange = function(doc, change) { trackChange(self, doc, change); };
74
-
75
- this.cachedArgHints = null;
76
- this.activeArgHints = null;
77
- this.jumpStack = [];
78
-
79
- this.getHint = function(cm, c) { return hint(self, cm, c); };
80
- this.getHint.async = true;
81
- };
82
-
83
- CodeMirror.TernServer.prototype = {
84
- addDoc: function(name, doc) {
85
- var data = {doc: doc, name: name, changed: null};
86
- this.server.addFile(name, docValue(this, data));
87
- CodeMirror.on(doc, "change", this.trackChange);
88
- return this.docs[name] = data;
89
- },
90
-
91
- delDoc: function(id) {
92
- var found = resolveDoc(this, id);
93
- if (!found) return;
94
- CodeMirror.off(found.doc, "change", this.trackChange);
95
- delete this.docs[found.name];
96
- this.server.delFile(found.name);
97
- },
98
-
99
- hideDoc: function(id) {
100
- closeArgHints(this);
101
- var found = resolveDoc(this, id);
102
- if (found && found.changed) sendDoc(this, found);
103
- },
104
-
105
- complete: function(cm) {
106
- cm.showHint({hint: this.getHint});
107
- },
108
-
109
- showType: function(cm, pos, c) { showContextInfo(this, cm, pos, "type", c); },
110
-
111
- showDocs: function(cm, pos, c) { showContextInfo(this, cm, pos, "documentation", c); },
112
-
113
- updateArgHints: function(cm) { updateArgHints(this, cm); },
114
-
115
- jumpToDef: function(cm) { jumpToDef(this, cm); },
116
-
117
- jumpBack: function(cm) { jumpBack(this, cm); },
118
-
119
- rename: function(cm) { rename(this, cm); },
120
-
121
- selectName: function(cm) { selectName(this, cm); },
122
-
123
- request: function (cm, query, c, pos) {
124
- var self = this;
125
- var doc = findDoc(this, cm.getDoc());
126
- var request = buildRequest(this, doc, query, pos);
127
-
128
- this.server.request(request, function (error, data) {
129
- if (!error && self.options.responseFilter)
130
- data = self.options.responseFilter(doc, query, request, error, data);
131
- c(error, data);
132
- });
133
- }
134
- };
135
-
136
- var Pos = CodeMirror.Pos;
137
- var cls = "CodeMirror-Tern-";
138
- var bigDoc = 250;
139
-
140
- function getFile(ts, name, c) {
141
- var buf = ts.docs[name];
142
- if (buf)
143
- c(docValue(ts, buf));
144
- else if (ts.options.getFile)
145
- ts.options.getFile(name, c);
146
- else
147
- c(null);
148
- }
149
-
150
- function findDoc(ts, doc, name) {
151
- for (var n in ts.docs) {
152
- var cur = ts.docs[n];
153
- if (cur.doc == doc) return cur;
154
- }
155
- if (!name) for (var i = 0;; ++i) {
156
- n = "[doc" + (i || "") + "]";
157
- if (!ts.docs[n]) { name = n; break; }
158
- }
159
- return ts.addDoc(name, doc);
160
- }
161
-
162
- function resolveDoc(ts, id) {
163
- if (typeof id == "string") return ts.docs[id];
164
- if (id instanceof CodeMirror) id = id.getDoc();
165
- if (id instanceof CodeMirror.Doc) return findDoc(ts, id);
166
- }
167
-
168
- function trackChange(ts, doc, change) {
169
- var data = findDoc(ts, doc);
170
-
171
- var argHints = ts.cachedArgHints;
172
- if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0)
173
- ts.cachedArgHints = null;
174
-
175
- var changed = data.changed;
176
- if (changed == null)
177
- data.changed = changed = {from: change.from.line, to: change.from.line};
178
- var end = change.from.line + (change.text.length - 1);
179
- if (change.from.line < changed.to) changed.to = changed.to - (change.to.line - end);
180
- if (end >= changed.to) changed.to = end + 1;
181
- if (changed.from > change.from.line) changed.from = change.from.line;
182
-
183
- if (doc.lineCount() > bigDoc && change.to - changed.from > 100) setTimeout(function() {
184
- if (data.changed && data.changed.to - data.changed.from > 100) sendDoc(ts, data);
185
- }, 200);
186
- }
187
-
188
- function sendDoc(ts, doc) {
189
- ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) {
190
- if (error) window.console.error(error);
191
- else doc.changed = null;
192
- });
193
- }
194
-
195
- // Completion
196
-
197
- function hint(ts, cm, c) {
198
- ts.request(cm, {type: "completions", types: true, docs: true, urls: true}, function(error, data) {
199
- if (error) return showError(ts, cm, error);
200
- var completions = [], after = "";
201
- var from = data.start, to = data.end;
202
- if (cm.getRange(Pos(from.line, from.ch - 2), from) == "[\"" &&
203
- cm.getRange(to, Pos(to.line, to.ch + 2)) != "\"]")
204
- after = "\"]";
205
-
206
- for (var i = 0; i < data.completions.length; ++i) {
207
- var completion = data.completions[i], className = typeToIcon(completion.type);
208
- if (data.guess) className += " " + cls + "guess";
209
- completions.push({text: completion.name + after,
210
- displayText: completion.name,
211
- className: className,
212
- data: completion});
213
- }
214
-
215
- var obj = {from: from, to: to, list: completions};
216
- var tooltip = null;
217
- CodeMirror.on(obj, "close", function() { remove(tooltip); });
218
- CodeMirror.on(obj, "update", function() { remove(tooltip); });
219
- CodeMirror.on(obj, "select", function(cur, node) {
220
- remove(tooltip);
221
- var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc;
222
- if (content) {
223
- tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset,
224
- node.getBoundingClientRect().top + window.pageYOffset, content);
225
- tooltip.className += " " + cls + "hint-doc";
226
- }
227
- });
228
- c(obj);
229
- });
230
- }
231
-
232
- function typeToIcon(type) {
233
- var suffix;
234
- if (type == "?") suffix = "unknown";
235
- else if (type == "number" || type == "string" || type == "bool") suffix = type;
236
- else if (/^fn\(/.test(type)) suffix = "fn";
237
- else if (/^\[/.test(type)) suffix = "array";
238
- else suffix = "object";
239
- return cls + "completion " + cls + "completion-" + suffix;
240
- }
241
-
242
- // Type queries
243
-
244
- function showContextInfo(ts, cm, pos, queryName, c) {
245
- ts.request(cm, queryName, function(error, data) {
246
- if (error) return showError(ts, cm, error);
247
- if (ts.options.typeTip) {
248
- var tip = ts.options.typeTip(data);
249
- } else {
250
- var tip = elt("span", null, elt("strong", null, data.type || "not found"));
251
- if (data.doc)
252
- tip.appendChild(document.createTextNode(" — " + data.doc));
253
- if (data.url) {
254
- tip.appendChild(document.createTextNode(" "));
255
- tip.appendChild(elt("a", null, "[docs]")).href = data.url;
256
- }
257
- }
258
- tempTooltip(cm, tip);
259
- if (c) c();
260
- }, pos);
261
- }
262
-
263
- // Maintaining argument hints
264
-
265
- function updateArgHints(ts, cm) {
266
- closeArgHints(ts);
267
-
268
- if (cm.somethingSelected()) return;
269
- var state = cm.getTokenAt(cm.getCursor()).state;
270
- var inner = CodeMirror.innerMode(cm.getMode(), state);
271
- if (inner.mode.name != "javascript") return;
272
- var lex = inner.state.lexical;
273
- if (lex.info != "call") return;
274
-
275
- var ch, argPos = lex.pos || 0, tabSize = cm.getOption("tabSize");
276
- for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) {
277
- var str = cm.getLine(line), extra = 0;
278
- for (var pos = 0;;) {
279
- var tab = str.indexOf("\t", pos);
280
- if (tab == -1) break;
281
- extra += tabSize - (tab + extra) % tabSize - 1;
282
- pos = tab + 1;
283
- }
284
- ch = lex.column - extra;
285
- if (str.charAt(ch) == "(") {found = true; break;}
286
- }
287
- if (!found) return;
288
-
289
- var start = Pos(line, ch);
290
- var cache = ts.cachedArgHints;
291
- if (cache && cache.doc == cm.getDoc() && cmpPos(start, cache.start) == 0)
292
- return showArgHints(ts, cm, argPos);
293
-
294
- ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
295
- if (error || !data.type || !(/^fn\(/).test(data.type)) return;
296
- ts.cachedArgHints = {
297
- start: pos,
298
- type: parseFnType(data.type),
299
- name: data.exprName || data.name || "fn",
300
- guess: data.guess,
301
- doc: cm.getDoc()
302
- };
303
- showArgHints(ts, cm, argPos);
304
- });
305
- }
306
-
307
- function showArgHints(ts, cm, pos) {
308
- closeArgHints(ts);
309
-
310
- var cache = ts.cachedArgHints, tp = cache.type;
311
- var tip = elt("span", cache.guess ? cls + "fhint-guess" : null,
312
- elt("span", cls + "fname", cache.name), "(");
313
- for (var i = 0; i < tp.args.length; ++i) {
314
- if (i) tip.appendChild(document.createTextNode(", "));
315
- var arg = tp.args[i];
316
- tip.appendChild(elt("span", cls + "farg" + (i == pos ? " " + cls + "farg-current" : ""), arg.name || "?"));
317
- if (arg.type != "?") {
318
- tip.appendChild(document.createTextNode(":\u00a0"));
319
- tip.appendChild(elt("span", cls + "type", arg.type));
320
- }
321
- }
322
- tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")"));
323
- if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype));
324
- var place = cm.cursorCoords(null, "page");
325
- ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip);
326
- }
327
-
328
- function parseFnType(text) {
329
- var args = [], pos = 3;
330
-
331
- function skipMatching(upto) {
332
- var depth = 0, start = pos;
333
- for (;;) {
334
- var next = text.charAt(pos);
335
- if (upto.test(next) && !depth) return text.slice(start, pos);
336
- if (/[{\[\(]/.test(next)) ++depth;
337
- else if (/[}\]\)]/.test(next)) --depth;
338
- ++pos;
339
- }
340
- }
341
-
342
- // Parse arguments
343
- if (text.charAt(pos) != ")") for (;;) {
344
- var name = text.slice(pos).match(/^([^, \(\[\{]+): /);
345
- if (name) {
346
- pos += name[0].length;
347
- name = name[1];
348
- }
349
- args.push({name: name, type: skipMatching(/[\),]/)});
350
- if (text.charAt(pos) == ")") break;
351
- pos += 2;
352
- }
353
-
354
- var rettype = text.slice(pos).match(/^\) -> (.*)$/);
355
-
356
- return {args: args, rettype: rettype && rettype[1]};
357
- }
358
-
359
- // Moving to the definition of something
360
-
361
- function jumpToDef(ts, cm) {
362
- function inner(varName) {
363
- var req = {type: "definition", variable: varName || null};
364
- var doc = findDoc(ts, cm.getDoc());
365
- ts.server.request(buildRequest(ts, doc, req), function(error, data) {
366
- if (error) return showError(ts, cm, error);
367
- if (!data.file && data.url) { window.open(data.url); return; }
368
-
369
- if (data.file) {
370
- var localDoc = ts.docs[data.file], found;
371
- if (localDoc && (found = findContext(localDoc.doc, data))) {
372
- ts.jumpStack.push({file: doc.name,
373
- start: cm.getCursor("from"),
374
- end: cm.getCursor("to")});
375
- moveTo(ts, doc, localDoc, found.start, found.end);
376
- return;
377
- }
378
- }
379
- showError(ts, cm, "Could not find a definition.");
380
- });
381
- }
382
-
383
- if (!atInterestingExpression(cm))
384
- dialog(cm, "Jump to variable", function(name) { if (name) inner(name); });
385
- else
386
- inner();
387
- }
388
-
389
- function jumpBack(ts, cm) {
390
- var pos = ts.jumpStack.pop(), doc = pos && ts.docs[pos.file];
391
- if (!doc) return;
392
- moveTo(ts, findDoc(ts, cm.getDoc()), doc, pos.start, pos.end);
393
- }
394
-
395
- function moveTo(ts, curDoc, doc, start, end) {
396
- doc.doc.setSelection(start, end);
397
- if (curDoc != doc && ts.options.switchToDoc) {
398
- closeArgHints(ts);
399
- ts.options.switchToDoc(doc.name, doc.doc);
400
- }
401
- }
402
-
403
- // The {line,ch} representation of positions makes this rather awkward.
404
- function findContext(doc, data) {
405
- var before = data.context.slice(0, data.contextOffset).split("\n");
406
- var startLine = data.start.line - (before.length - 1);
407
- var start = Pos(startLine, (before.length == 1 ? data.start.ch : doc.getLine(startLine).length) - before[0].length);
408
-
409
- var text = doc.getLine(startLine).slice(start.ch);
410
- for (var cur = startLine + 1; cur < doc.lineCount() && text.length < data.context.length; ++cur)
411
- text += "\n" + doc.getLine(cur);
412
- if (text.slice(0, data.context.length) == data.context) return data;
413
-
414
- var cursor = doc.getSearchCursor(data.context, 0, false);
415
- var nearest, nearestDist = Infinity;
416
- while (cursor.findNext()) {
417
- var from = cursor.from(), dist = Math.abs(from.line - start.line) * 10000;
418
- if (!dist) dist = Math.abs(from.ch - start.ch);
419
- if (dist < nearestDist) { nearest = from; nearestDist = dist; }
420
- }
421
- if (!nearest) return null;
422
-
423
- if (before.length == 1)
424
- nearest.ch += before[0].length;
425
- else
426
- nearest = Pos(nearest.line + (before.length - 1), before[before.length - 1].length);
427
- if (data.start.line == data.end.line)
428
- var end = Pos(nearest.line, nearest.ch + (data.end.ch - data.start.ch));
429
- else
430
- var end = Pos(nearest.line + (data.end.line - data.start.line), data.end.ch);
431
- return {start: nearest, end: end};
432
- }
433
-
434
- function atInterestingExpression(cm) {
435
- var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos);
436
- if (tok.start < pos.ch && (tok.type == "comment" || tok.type == "string")) return false;
437
- return /\w/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
438
- }
439
-
440
- // Variable renaming
441
-
442
- function rename(ts, cm) {
443
- var token = cm.getTokenAt(cm.getCursor());
444
- if (!/\w/.test(token.string)) return showError(ts, cm, "Not at a variable");
445
- dialog(cm, "New name for " + token.string, function(newName) {
446
- ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) {
447
- if (error) return showError(ts, cm, error);
448
- applyChanges(ts, data.changes);
449
- });
450
- });
451
- }
452
-
453
- function selectName(ts, cm) {
454
- var name = findDoc(ts, cm.doc).name;
455
- ts.request(cm, {type: "refs"}, function(error, data) {
456
- if (error) return showError(ts, cm, error);
457
- var ranges = [], cur = 0;
458
- for (var i = 0; i < data.refs.length; i++) {
459
- var ref = data.refs[i];
460
- if (ref.file == name) {
461
- ranges.push({anchor: ref.start, head: ref.end});
462
- if (cmpPos(cur, ref.start) >= 0 && cmpPos(cur, ref.end) <= 0)
463
- cur = ranges.length - 1;
464
- }
465
- }
466
- cm.setSelections(ranges, cur);
467
- });
468
- }
469
-
470
- var nextChangeOrig = 0;
471
- function applyChanges(ts, changes) {
472
- var perFile = Object.create(null);
473
- for (var i = 0; i < changes.length; ++i) {
474
- var ch = changes[i];
475
- (perFile[ch.file] || (perFile[ch.file] = [])).push(ch);
476
- }
477
- for (var file in perFile) {
478
- var known = ts.docs[file], chs = perFile[file];;
479
- if (!known) continue;
480
- chs.sort(function(a, b) { return cmpPos(b.start, a.start); });
481
- var origin = "*rename" + (++nextChangeOrig);
482
- for (var i = 0; i < chs.length; ++i) {
483
- var ch = chs[i];
484
- known.doc.replaceRange(ch.text, ch.start, ch.end, origin);
485
- }
486
- }
487
- }
488
-
489
- // Generic request-building helper
490
-
491
- function buildRequest(ts, doc, query, pos) {
492
- var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
493
- if (!allowFragments) delete query.fullDocs;
494
- if (typeof query == "string") query = {type: query};
495
- query.lineCharPositions = true;
496
- if (query.end == null) {
497
- query.end = pos || doc.doc.getCursor("end");
498
- if (doc.doc.somethingSelected())
499
- query.start = doc.doc.getCursor("start");
500
- }
501
- var startPos = query.start || query.end;
502
-
503
- if (doc.changed) {
504
- if (doc.doc.lineCount() > bigDoc && allowFragments !== false &&
505
- doc.changed.to - doc.changed.from < 100 &&
506
- doc.changed.from <= startPos.line && doc.changed.to > query.end.line) {
507
- files.push(getFragmentAround(doc, startPos, query.end));
508
- query.file = "#0";
509
- var offsetLines = files[0].offsetLines;
510
- if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch);
511
- query.end = Pos(query.end.line - offsetLines, query.end.ch);
512
- } else {
513
- files.push({type: "full",
514
- name: doc.name,
515
- text: docValue(ts, doc)});
516
- query.file = doc.name;
517
- doc.changed = null;
518
- }
519
- } else {
520
- query.file = doc.name;
521
- }
522
- for (var name in ts.docs) {
523
- var cur = ts.docs[name];
524
- if (cur.changed && cur != doc) {
525
- files.push({type: "full", name: cur.name, text: docValue(ts, cur)});
526
- cur.changed = null;
527
- }
528
- }
529
-
530
- return {query: query, files: files};
531
- }
532
-
533
- function getFragmentAround(data, start, end) {
534
- var doc = data.doc;
535
- var minIndent = null, minLine = null, endLine, tabSize = 4;
536
- for (var p = start.line - 1, min = Math.max(0, p - 50); p >= min; --p) {
537
- var line = doc.getLine(p), fn = line.search(/\bfunction\b/);
538
- if (fn < 0) continue;
539
- var indent = CodeMirror.countColumn(line, null, tabSize);
540
- if (minIndent != null && minIndent <= indent) continue;
541
- minIndent = indent;
542
- minLine = p;
543
- }
544
- if (minLine == null) minLine = min;
545
- var max = Math.min(doc.lastLine(), end.line + 20);
546
- if (minIndent == null || minIndent == CodeMirror.countColumn(doc.getLine(start.line), null, tabSize))
547
- endLine = max;
548
- else for (endLine = end.line + 1; endLine < max; ++endLine) {
549
- var indent = CodeMirror.countColumn(doc.getLine(endLine), null, tabSize);
550
- if (indent <= minIndent) break;
551
- }
552
- var from = Pos(minLine, 0);
553
-
554
- return {type: "part",
555
- name: data.name,
556
- offsetLines: from.line,
557
- text: doc.getRange(from, Pos(endLine, 0))};
558
- }
559
-
560
- // Generic utilities
561
-
562
- var cmpPos = CodeMirror.cmpPos;
563
-
564
- function elt(tagname, cls /*, ... elts*/) {
565
- var e = document.createElement(tagname);
566
- if (cls) e.className = cls;
567
- for (var i = 2; i < arguments.length; ++i) {
568
- var elt = arguments[i];
569
- if (typeof elt == "string") elt = document.createTextNode(elt);
570
- e.appendChild(elt);
571
- }
572
- return e;
573
- }
574
-
575
- function dialog(cm, text, f) {
576
- if (cm.openDialog)
577
- cm.openDialog(text + ": <input type=text>", f);
578
- else
579
- f(prompt(text, ""));
580
- }
581
-
582
- // Tooltips
583
-
584
- function tempTooltip(cm, content) {
585
- var where = cm.cursorCoords();
586
- var tip = makeTooltip(where.right + 1, where.bottom, content);
587
- function clear() {
588
- if (!tip.parentNode) return;
589
- cm.off("cursorActivity", clear);
590
- fadeOut(tip);
591
- }
592
- setTimeout(clear, 1700);
593
- cm.on("cursorActivity", clear);
594
- }
595
-
596
- function makeTooltip(x, y, content) {
597
- var node = elt("div", cls + "tooltip", content);
598
- node.style.left = x + "px";
599
- node.style.top = y + "px";
600
- document.body.appendChild(node);
601
- return node;
602
- }
603
-
604
- function remove(node) {
605
- var p = node && node.parentNode;
606
- if (p) p.removeChild(node);
607
- }
608
-
609
- function fadeOut(tooltip) {
610
- tooltip.style.opacity = "0";
611
- setTimeout(function() { remove(tooltip); }, 1100);
612
- }
613
-
614
- function showError(ts, cm, msg) {
615
- if (ts.options.showError)
616
- ts.options.showError(cm, msg);
617
- else
618
- tempTooltip(cm, String(msg));
619
- }
620
-
621
- function closeArgHints(ts) {
622
- if (ts.activeArgHints) { remove(ts.activeArgHints); ts.activeArgHints = null; }
623
- }
624
-
625
- function docValue(ts, doc) {
626
- var val = doc.doc.getValue();
627
- if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc);
628
- return val;
629
- }
630
-
631
- // Worker wrapper
632
-
633
- function WorkerServer(ts) {
634
- var worker = new Worker(ts.options.workerScript);
635
- worker.postMessage({type: "init",
636
- defs: ts.options.defs,
637
- plugins: ts.options.plugins,
638
- scripts: ts.options.workerDeps});
639
- var msgId = 0, pending = {};
640
-
641
- function send(data, c) {
642
- if (c) {
643
- data.id = ++msgId;
644
- pending[msgId] = c;
645
- }
646
- worker.postMessage(data);
647
- }
648
- worker.onmessage = function(e) {
649
- var data = e.data;
650
- if (data.type == "getFile") {
651
- getFile(ts, data.name, function(err, text) {
652
- send({type: "getFile", err: String(err), text: text, id: data.id});
653
- });
654
- } else if (data.type == "debug") {
655
- window.console.log(data.message);
656
- } else if (data.id && pending[data.id]) {
657
- pending[data.id](data.err, data.body);
658
- delete pending[data.id];
659
- }
660
- };
661
- worker.onerror = function(e) {
662
- for (var id in pending) pending[id](e);
663
- pending = {};
664
- };
665
-
666
- this.addFile = function(name, text) { send({type: "add", name: name, text: text}); };
667
- this.delFile = function(name) { send({type: "del", name: name}); };
668
- this.request = function(body, c) { send({type: "req", body: body}, c); };
669
- }
670
- });