locomotivecms 4.1.1 → 4.2.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +4 -3
- data/Rakefile +4 -0
- data/app/api/locomotive/api.rb +1 -1
- data/app/assets/config/locomotive_manifest.js +2 -0
- data/app/assets/javascripts/locomotive.js +2 -2
- data/app/assets/stylesheets/locomotive/account.scss +0 -1
- data/app/assets/stylesheets/locomotive/application.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_error.scss +0 -1
- data/app/assets/stylesheets/locomotive/live_editing_iframe.scss +0 -1
- data/app/controllers/locomotive/base_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/authorization_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
- data/app/controllers/locomotive/concerns/site_dispatcher_controller.rb +1 -1
- data/app/controllers/locomotive/errors_controller.rb +1 -1
- data/app/controllers/locomotive/my_account_controller.rb +1 -1
- data/app/controllers/locomotive/passwords_controller.rb +3 -1
- data/app/controllers/locomotive/registrations_controller.rb +3 -1
- data/app/controllers/locomotive/sessions_controller.rb +3 -1
- data/app/controllers/locomotive/sites_controller.rb +1 -1
- data/app/helpers/locomotive/base_helper.rb +2 -2
- data/app/helpers/locomotive/custom_fields_helper.rb +2 -2
- data/app/helpers/locomotive/shared/activities_helper.rb +1 -1
- data/app/inputs/locomotive/api_key_input.rb +1 -1
- data/app/mailers/locomotive/notifications.rb +1 -1
- data/app/models/locomotive/account.rb +1 -1
- data/app/models/locomotive/concerns/account/api_key.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/csv.rb +1 -1
- data/app/models/locomotive/concerns/content_entry/slug.rb +5 -5
- data/app/models/locomotive/concerns/content_type/entry_template.rb +3 -3
- data/app/models/locomotive/concerns/page/templatized.rb +1 -1
- data/app/models/locomotive/concerns/shared/json_attribute.rb +21 -2
- data/app/models/locomotive/concerns/site/routes.rb +1 -1
- data/app/models/locomotive/content_entry.rb +2 -2
- data/app/models/locomotive/page.rb +3 -3
- data/app/models/locomotive/section.rb +1 -1
- data/app/models/locomotive/snippet.rb +1 -1
- data/app/models/locomotive/translation.rb +1 -1
- data/app/services/locomotive/content_entry_import_service.rb +1 -1
- data/app/services/locomotive/content_entry_service.rb +2 -2
- data/app/services/locomotive/content_type_service.rb +13 -3
- data/app/services/locomotive/custom_field_service.rb +2 -2
- data/app/services/locomotive/editor_service.rb +1 -1
- data/app/uploaders/locomotive/base_uploader.rb +0 -10
- data/app/views/locomotive/dashboard/_activity.html.slim +1 -1
- data/app/views/locomotive/page_content/_edit.json.jbuilder +50 -0
- data/app/views/locomotive/page_content/edit.html.erb +1 -1
- data/app/views/locomotive/page_content/edit.json.jbuilder +52 -50
- data/config/initializers/devise.rb +5 -2
- data/lib/generators/locomotive/install/templates/locomotive.rb +0 -5
- data/lib/locomotive/action_controller/responder.rb +1 -1
- data/lib/locomotive/configuration.rb +2 -2
- data/lib/locomotive/dependencies.rb +0 -2
- data/lib/locomotive/engine.rb +14 -2
- data/lib/locomotive/mongoid/patches.rb +47 -65
- data/lib/locomotive/steam/services/api_entry_submission_service.rb +1 -0
- data/lib/locomotive/version.rb +1 -1
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/comment.js +203 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/comment/continuecomment.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/dialog/dialog.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/autorefresh.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/fullscreen.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/panel.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/placeholder.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/display/rulers.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closebrackets.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/closetag.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/continuelist.js +51 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchbrackets.js +120 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/matchtags.js +66 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/edit/trailingspace.js +27 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/brace-fold.js +105 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/comment-fold.js +59 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldcode.js +150 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/foldgutter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/indent-fold.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/markdown-fold.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/fold/xml-fold.js +182 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/anyword-hint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/css-hint.js +60 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/html-hint.js +348 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/javascript-hint.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/show-hint.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/sql-hint.js +271 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/hint/xml-hint.js +110 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/coffeescript-lint.js +41 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/css-lint.js +35 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/html-lint.js +46 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/javascript-lint.js +136 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/json-lint.js +31 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/lint.js +239 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/lint/yaml-lint.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/merge/merge.js +773 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/loadmode.js +64 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/multiplex.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/overlay.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/mode/simple.js +213 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/colorize.js +40 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode-standalone.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.js +72 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/runmode/runmode.node.js +179 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/annotatescrollbar.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/scrollpastend.js +48 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/scroll/simplescrollbars.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/jump-to-line.js +49 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/match-highlighter.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/matchesonscrollbar.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/search.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/search/searchcursor.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/active-line.js +74 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/mark-selection.js +118 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/selection/selection-pointer.js +98 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/tern.js +701 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/tern/worker.js +44 -0
- data/vendor/assets/javascripts/locomotive/codemirror/addons/wrap/hardwrap.js +144 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/emacs.js +412 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/sublime.js +580 -0
- data/vendor/assets/javascripts/locomotive/codemirror/keymaps/vim.js +5065 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/apl.js +174 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asciiarmor.js +73 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/asterisk.js +196 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clike.js +786 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/clojure.js +306 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cmake.js +97 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cobol.js +255 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/coffeescript.js +355 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/commonlisp.js +123 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/crystal.js +391 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/css.js +825 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/cypher.js +146 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/d.js +218 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dart.js +157 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/diff.js +47 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/django.js +356 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dockerfile.js +79 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dtd.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/dylan.js +344 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ebnf.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ecl.js +206 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/eiffel.js +160 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/elm.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/erlang.js +618 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/factor.js +83 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fcl.js +173 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/forth.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/fortran.js +188 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gas.js +345 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gfm.js +130 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/gherkin.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/go.js +185 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/groovy.js +230 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haml.js +161 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/handlebars.js +62 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js +43 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haskell.js +267 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/haxe.js +515 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlembedded.js +28 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/htmlmixed.js +152 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/http.js +113 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jade.js +590 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/javascript.js +748 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jinja2.js +142 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/jsx.js +147 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/julia.js +392 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/livescript.js +280 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/lua.js +159 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/markdown.js +797 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mathematica.js +176 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mirc.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mllike.js +205 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mscgen.js +169 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/mumps.js +148 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nginx.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/nsis.js +95 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ntriples.js +186 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/octave.js +135 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/oz.js +252 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pascal.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pegjs.js +114 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/perl.js +837 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/php.js +234 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/pig.js +178 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/properties.js +78 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/protobuf.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/puppet.js +220 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/python.js +340 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/q.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/r.js +164 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rpm.js +109 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rst.js +557 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ruby.js +285 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/rust.js +71 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sass.js +414 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/scheme.js +249 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/shell.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sieve.js +193 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/slim.js +575 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smalltalk.js +168 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/smarty.js +225 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/solr.js +104 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/soy.js +199 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sparql.js +180 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/spreadsheet.js +112 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/sql.js +413 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stex.js +251 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/stylus.js +769 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/swift.js +202 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tcl.js +139 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/textile.js +469 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiddlywiki.js +308 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tiki.js +312 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/toml.js +88 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/tornado.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/troff.js +84 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/turtle.js +162 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/twig.js +141 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vb.js +276 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vbscript.js +350 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/velocity.js +201 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/verilog.js +537 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/vue.js +69 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xml.js +394 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/xquery.js +437 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml-frontmatter.js +68 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/yaml.js +117 -0
- data/vendor/assets/javascripts/locomotive/codemirror/modes/z80.js +116 -0
- data/vendor/assets/javascripts/locomotive/codemirror.js +8922 -0
- data/vendor/assets/javascripts/locomotive/select2.js +436 -175
- data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +1346 -564
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/dialog/dialog.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/display/fullscreen.css +6 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/fold/foldgutter.css +20 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/hint/show-hint.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/lint/lint.css +73 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/merge/merge.css +113 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/scroll/simplescrollbars.css +66 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/search/matchesonscrollbar.css +8 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/addons/tern/tern.css +87 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiddlywiki.css +14 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/modes/tiki.css +26 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-day.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/3024-night.css +39 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/abcdef.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance-mobile.css +5 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ambiance.css +74 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/base16-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/blackboard.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/cobalt.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/colorforth.css +33 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/dracula.css +41 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/eclipse.css +23 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/elegant.css +13 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/erlang-dark.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/icecoder.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/lesser-dark.css +47 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/liquibyte.css +95 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/material.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mbo.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/mdn-like.css +46 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/midnight.css +45 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/monokai.css +36 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neat.css +12 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/neo.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/night.css +27 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-dark.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/paraiso-light.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/pastel-on-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/railscasts.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/rubyblue.css +25 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/seti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/solarized.css +169 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/the-matrix.css +30 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-bright.css +35 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/tomorrow-night-eighties.css +38 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/ttcn.css +64 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/twilight.css +32 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/vibrant-ink.css +34 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-dark.css +53 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/yeti.css +44 -0
- data/vendor/assets/stylesheets/locomotive/codemirror/themes/zenburn.css +37 -0
- data/vendor/assets/stylesheets/locomotive/codemirror.css +347 -0
- data/vendor/assets/stylesheets/locomotive/select2.css +3 -6
- metadata +349 -128
@@ -0,0 +1,748 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// TODO actually recognize syntax of TypeScript constructs
|
5
|
+
|
6
|
+
(function(mod) {
|
7
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8
|
+
mod(require("../../lib/codemirror"));
|
9
|
+
else if (typeof define == "function" && define.amd) // AMD
|
10
|
+
define(["../../lib/codemirror"], mod);
|
11
|
+
else // Plain browser env
|
12
|
+
mod(CodeMirror);
|
13
|
+
})(function(CodeMirror) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
function expressionAllowed(stream, state, backUp) {
|
17
|
+
return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
|
18
|
+
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
|
19
|
+
}
|
20
|
+
|
21
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
22
|
+
var indentUnit = config.indentUnit;
|
23
|
+
var statementIndent = parserConfig.statementIndent;
|
24
|
+
var jsonldMode = parserConfig.jsonld;
|
25
|
+
var jsonMode = parserConfig.json || jsonldMode;
|
26
|
+
var isTS = parserConfig.typescript;
|
27
|
+
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
28
|
+
|
29
|
+
// Tokenizer
|
30
|
+
|
31
|
+
var keywords = function(){
|
32
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
33
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
34
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
35
|
+
|
36
|
+
var jsKeywords = {
|
37
|
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
38
|
+
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
|
39
|
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
40
|
+
"function": kw("function"), "catch": kw("catch"),
|
41
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
42
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
43
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
44
|
+
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
45
|
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
46
|
+
"await": C, "async": kw("async")
|
47
|
+
};
|
48
|
+
|
49
|
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
50
|
+
if (isTS) {
|
51
|
+
var type = {type: "variable", style: "variable-3"};
|
52
|
+
var tsKeywords = {
|
53
|
+
// object-like things
|
54
|
+
"interface": kw("class"),
|
55
|
+
"implements": C,
|
56
|
+
"namespace": C,
|
57
|
+
"module": kw("module"),
|
58
|
+
"enum": kw("module"),
|
59
|
+
|
60
|
+
// scope modifiers
|
61
|
+
"public": kw("modifier"),
|
62
|
+
"private": kw("modifier"),
|
63
|
+
"protected": kw("modifier"),
|
64
|
+
"abstract": kw("modifier"),
|
65
|
+
|
66
|
+
// operators
|
67
|
+
"as": operator,
|
68
|
+
|
69
|
+
// types
|
70
|
+
"string": type, "number": type, "boolean": type, "any": type
|
71
|
+
};
|
72
|
+
|
73
|
+
for (var attr in tsKeywords) {
|
74
|
+
jsKeywords[attr] = tsKeywords[attr];
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
return jsKeywords;
|
79
|
+
}();
|
80
|
+
|
81
|
+
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
82
|
+
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
83
|
+
|
84
|
+
function readRegexp(stream) {
|
85
|
+
var escaped = false, next, inSet = false;
|
86
|
+
while ((next = stream.next()) != null) {
|
87
|
+
if (!escaped) {
|
88
|
+
if (next == "/" && !inSet) return;
|
89
|
+
if (next == "[") inSet = true;
|
90
|
+
else if (inSet && next == "]") inSet = false;
|
91
|
+
}
|
92
|
+
escaped = !escaped && next == "\\";
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
// Used as scratch variables to communicate multiple values without
|
97
|
+
// consing up tons of objects.
|
98
|
+
var type, content;
|
99
|
+
function ret(tp, style, cont) {
|
100
|
+
type = tp; content = cont;
|
101
|
+
return style;
|
102
|
+
}
|
103
|
+
function tokenBase(stream, state) {
|
104
|
+
var ch = stream.next();
|
105
|
+
if (ch == '"' || ch == "'") {
|
106
|
+
state.tokenize = tokenString(ch);
|
107
|
+
return state.tokenize(stream, state);
|
108
|
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
109
|
+
return ret("number", "number");
|
110
|
+
} else if (ch == "." && stream.match("..")) {
|
111
|
+
return ret("spread", "meta");
|
112
|
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
113
|
+
return ret(ch);
|
114
|
+
} else if (ch == "=" && stream.eat(">")) {
|
115
|
+
return ret("=>", "operator");
|
116
|
+
} else if (ch == "0" && stream.eat(/x/i)) {
|
117
|
+
stream.eatWhile(/[\da-f]/i);
|
118
|
+
return ret("number", "number");
|
119
|
+
} else if (ch == "0" && stream.eat(/o/i)) {
|
120
|
+
stream.eatWhile(/[0-7]/i);
|
121
|
+
return ret("number", "number");
|
122
|
+
} else if (ch == "0" && stream.eat(/b/i)) {
|
123
|
+
stream.eatWhile(/[01]/i);
|
124
|
+
return ret("number", "number");
|
125
|
+
} else if (/\d/.test(ch)) {
|
126
|
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
127
|
+
return ret("number", "number");
|
128
|
+
} else if (ch == "/") {
|
129
|
+
if (stream.eat("*")) {
|
130
|
+
state.tokenize = tokenComment;
|
131
|
+
return tokenComment(stream, state);
|
132
|
+
} else if (stream.eat("/")) {
|
133
|
+
stream.skipToEnd();
|
134
|
+
return ret("comment", "comment");
|
135
|
+
} else if (expressionAllowed(stream, state, 1)) {
|
136
|
+
readRegexp(stream);
|
137
|
+
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
138
|
+
return ret("regexp", "string-2");
|
139
|
+
} else {
|
140
|
+
stream.eatWhile(isOperatorChar);
|
141
|
+
return ret("operator", "operator", stream.current());
|
142
|
+
}
|
143
|
+
} else if (ch == "`") {
|
144
|
+
state.tokenize = tokenQuasi;
|
145
|
+
return tokenQuasi(stream, state);
|
146
|
+
} else if (ch == "#") {
|
147
|
+
stream.skipToEnd();
|
148
|
+
return ret("error", "error");
|
149
|
+
} else if (isOperatorChar.test(ch)) {
|
150
|
+
stream.eatWhile(isOperatorChar);
|
151
|
+
return ret("operator", "operator", stream.current());
|
152
|
+
} else if (wordRE.test(ch)) {
|
153
|
+
stream.eatWhile(wordRE);
|
154
|
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
155
|
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
156
|
+
ret("variable", "variable", word);
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
function tokenString(quote) {
|
161
|
+
return function(stream, state) {
|
162
|
+
var escaped = false, next;
|
163
|
+
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
164
|
+
state.tokenize = tokenBase;
|
165
|
+
return ret("jsonld-keyword", "meta");
|
166
|
+
}
|
167
|
+
while ((next = stream.next()) != null) {
|
168
|
+
if (next == quote && !escaped) break;
|
169
|
+
escaped = !escaped && next == "\\";
|
170
|
+
}
|
171
|
+
if (!escaped) state.tokenize = tokenBase;
|
172
|
+
return ret("string", "string");
|
173
|
+
};
|
174
|
+
}
|
175
|
+
|
176
|
+
function tokenComment(stream, state) {
|
177
|
+
var maybeEnd = false, ch;
|
178
|
+
while (ch = stream.next()) {
|
179
|
+
if (ch == "/" && maybeEnd) {
|
180
|
+
state.tokenize = tokenBase;
|
181
|
+
break;
|
182
|
+
}
|
183
|
+
maybeEnd = (ch == "*");
|
184
|
+
}
|
185
|
+
return ret("comment", "comment");
|
186
|
+
}
|
187
|
+
|
188
|
+
function tokenQuasi(stream, state) {
|
189
|
+
var escaped = false, next;
|
190
|
+
while ((next = stream.next()) != null) {
|
191
|
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
192
|
+
state.tokenize = tokenBase;
|
193
|
+
break;
|
194
|
+
}
|
195
|
+
escaped = !escaped && next == "\\";
|
196
|
+
}
|
197
|
+
return ret("quasi", "string-2", stream.current());
|
198
|
+
}
|
199
|
+
|
200
|
+
var brackets = "([{}])";
|
201
|
+
// This is a crude lookahead trick to try and notice that we're
|
202
|
+
// parsing the argument patterns for a fat-arrow function before we
|
203
|
+
// actually hit the arrow token. It only works if the arrow is on
|
204
|
+
// the same line as the arguments and there's no strange noise
|
205
|
+
// (comments) in between. Fallback is to only notice when we hit the
|
206
|
+
// arrow, and not declare the arguments as locals for the arrow
|
207
|
+
// body.
|
208
|
+
function findFatArrow(stream, state) {
|
209
|
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
210
|
+
var arrow = stream.string.indexOf("=>", stream.start);
|
211
|
+
if (arrow < 0) return;
|
212
|
+
|
213
|
+
var depth = 0, sawSomething = false;
|
214
|
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
215
|
+
var ch = stream.string.charAt(pos);
|
216
|
+
var bracket = brackets.indexOf(ch);
|
217
|
+
if (bracket >= 0 && bracket < 3) {
|
218
|
+
if (!depth) { ++pos; break; }
|
219
|
+
if (--depth == 0) break;
|
220
|
+
} else if (bracket >= 3 && bracket < 6) {
|
221
|
+
++depth;
|
222
|
+
} else if (wordRE.test(ch)) {
|
223
|
+
sawSomething = true;
|
224
|
+
} else if (/["'\/]/.test(ch)) {
|
225
|
+
return;
|
226
|
+
} else if (sawSomething && !depth) {
|
227
|
+
++pos;
|
228
|
+
break;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
232
|
+
}
|
233
|
+
|
234
|
+
// Parser
|
235
|
+
|
236
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
237
|
+
|
238
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
239
|
+
this.indented = indented;
|
240
|
+
this.column = column;
|
241
|
+
this.type = type;
|
242
|
+
this.prev = prev;
|
243
|
+
this.info = info;
|
244
|
+
if (align != null) this.align = align;
|
245
|
+
}
|
246
|
+
|
247
|
+
function inScope(state, varname) {
|
248
|
+
for (var v = state.localVars; v; v = v.next)
|
249
|
+
if (v.name == varname) return true;
|
250
|
+
for (var cx = state.context; cx; cx = cx.prev) {
|
251
|
+
for (var v = cx.vars; v; v = v.next)
|
252
|
+
if (v.name == varname) return true;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
function parseJS(state, style, type, content, stream) {
|
257
|
+
var cc = state.cc;
|
258
|
+
// Communicate our context to the combinators.
|
259
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
260
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
261
|
+
|
262
|
+
if (!state.lexical.hasOwnProperty("align"))
|
263
|
+
state.lexical.align = true;
|
264
|
+
|
265
|
+
while(true) {
|
266
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
267
|
+
if (combinator(type, content)) {
|
268
|
+
while(cc.length && cc[cc.length - 1].lex)
|
269
|
+
cc.pop()();
|
270
|
+
if (cx.marked) return cx.marked;
|
271
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
272
|
+
return style;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
// Combinator utils
|
278
|
+
|
279
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
280
|
+
function pass() {
|
281
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
282
|
+
}
|
283
|
+
function cont() {
|
284
|
+
pass.apply(null, arguments);
|
285
|
+
return true;
|
286
|
+
}
|
287
|
+
function register(varname) {
|
288
|
+
function inList(list) {
|
289
|
+
for (var v = list; v; v = v.next)
|
290
|
+
if (v.name == varname) return true;
|
291
|
+
return false;
|
292
|
+
}
|
293
|
+
var state = cx.state;
|
294
|
+
cx.marked = "def";
|
295
|
+
if (state.context) {
|
296
|
+
if (inList(state.localVars)) return;
|
297
|
+
state.localVars = {name: varname, next: state.localVars};
|
298
|
+
} else {
|
299
|
+
if (inList(state.globalVars)) return;
|
300
|
+
if (parserConfig.globalVars)
|
301
|
+
state.globalVars = {name: varname, next: state.globalVars};
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
// Combinators
|
306
|
+
|
307
|
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
308
|
+
function pushcontext() {
|
309
|
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
310
|
+
cx.state.localVars = defaultVars;
|
311
|
+
}
|
312
|
+
function popcontext() {
|
313
|
+
cx.state.localVars = cx.state.context.vars;
|
314
|
+
cx.state.context = cx.state.context.prev;
|
315
|
+
}
|
316
|
+
function pushlex(type, info) {
|
317
|
+
var result = function() {
|
318
|
+
var state = cx.state, indent = state.indented;
|
319
|
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
320
|
+
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
321
|
+
indent = outer.indented;
|
322
|
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
323
|
+
};
|
324
|
+
result.lex = true;
|
325
|
+
return result;
|
326
|
+
}
|
327
|
+
function poplex() {
|
328
|
+
var state = cx.state;
|
329
|
+
if (state.lexical.prev) {
|
330
|
+
if (state.lexical.type == ")")
|
331
|
+
state.indented = state.lexical.indented;
|
332
|
+
state.lexical = state.lexical.prev;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
poplex.lex = true;
|
336
|
+
|
337
|
+
function expect(wanted) {
|
338
|
+
function exp(type) {
|
339
|
+
if (type == wanted) return cont();
|
340
|
+
else if (wanted == ";") return pass();
|
341
|
+
else return cont(exp);
|
342
|
+
};
|
343
|
+
return exp;
|
344
|
+
}
|
345
|
+
|
346
|
+
function statement(type, value) {
|
347
|
+
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
348
|
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
349
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
350
|
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
351
|
+
if (type == ";") return cont();
|
352
|
+
if (type == "if") {
|
353
|
+
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
354
|
+
cx.state.cc.pop()();
|
355
|
+
return cont(pushlex("form"), expression, statement, poplex, maybeelse);
|
356
|
+
}
|
357
|
+
if (type == "function") return cont(functiondef);
|
358
|
+
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
359
|
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
360
|
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
361
|
+
block, poplex, poplex);
|
362
|
+
if (type == "case") return cont(expression, expect(":"));
|
363
|
+
if (type == "default") return cont(expect(":"));
|
364
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
365
|
+
statement, poplex, popcontext);
|
366
|
+
if (type == "class") return cont(pushlex("form"), className, poplex);
|
367
|
+
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
368
|
+
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
369
|
+
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
|
370
|
+
if (type == "async") return cont(statement)
|
371
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
372
|
+
}
|
373
|
+
function expression(type) {
|
374
|
+
return expressionInner(type, false);
|
375
|
+
}
|
376
|
+
function expressionNoComma(type) {
|
377
|
+
return expressionInner(type, true);
|
378
|
+
}
|
379
|
+
function expressionInner(type, noComma) {
|
380
|
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
381
|
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
382
|
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
383
|
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
384
|
+
}
|
385
|
+
|
386
|
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
387
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
388
|
+
if (type == "function") return cont(functiondef, maybeop);
|
389
|
+
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
390
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
|
391
|
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
392
|
+
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
393
|
+
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
394
|
+
if (type == "quasi") return pass(quasi, maybeop);
|
395
|
+
if (type == "new") return cont(maybeTarget(noComma));
|
396
|
+
return cont();
|
397
|
+
}
|
398
|
+
function maybeexpression(type) {
|
399
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
400
|
+
return pass(expression);
|
401
|
+
}
|
402
|
+
function maybeexpressionNoComma(type) {
|
403
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
404
|
+
return pass(expressionNoComma);
|
405
|
+
}
|
406
|
+
|
407
|
+
function maybeoperatorComma(type, value) {
|
408
|
+
if (type == ",") return cont(expression);
|
409
|
+
return maybeoperatorNoComma(type, value, false);
|
410
|
+
}
|
411
|
+
function maybeoperatorNoComma(type, value, noComma) {
|
412
|
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
413
|
+
var expr = noComma == false ? expression : expressionNoComma;
|
414
|
+
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
415
|
+
if (type == "operator") {
|
416
|
+
if (/\+\+|--/.test(value)) return cont(me);
|
417
|
+
if (value == "?") return cont(expression, expect(":"), expr);
|
418
|
+
return cont(expr);
|
419
|
+
}
|
420
|
+
if (type == "quasi") { return pass(quasi, me); }
|
421
|
+
if (type == ";") return;
|
422
|
+
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
423
|
+
if (type == ".") return cont(property, me);
|
424
|
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
425
|
+
}
|
426
|
+
function quasi(type, value) {
|
427
|
+
if (type != "quasi") return pass();
|
428
|
+
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
429
|
+
return cont(expression, continueQuasi);
|
430
|
+
}
|
431
|
+
function continueQuasi(type) {
|
432
|
+
if (type == "}") {
|
433
|
+
cx.marked = "string-2";
|
434
|
+
cx.state.tokenize = tokenQuasi;
|
435
|
+
return cont(quasi);
|
436
|
+
}
|
437
|
+
}
|
438
|
+
function arrowBody(type) {
|
439
|
+
findFatArrow(cx.stream, cx.state);
|
440
|
+
return pass(type == "{" ? statement : expression);
|
441
|
+
}
|
442
|
+
function arrowBodyNoComma(type) {
|
443
|
+
findFatArrow(cx.stream, cx.state);
|
444
|
+
return pass(type == "{" ? statement : expressionNoComma);
|
445
|
+
}
|
446
|
+
function maybeTarget(noComma) {
|
447
|
+
return function(type) {
|
448
|
+
if (type == ".") return cont(noComma ? targetNoComma : target);
|
449
|
+
else return pass(noComma ? expressionNoComma : expression);
|
450
|
+
};
|
451
|
+
}
|
452
|
+
function target(_, value) {
|
453
|
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
|
454
|
+
}
|
455
|
+
function targetNoComma(_, value) {
|
456
|
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
|
457
|
+
}
|
458
|
+
function maybelabel(type) {
|
459
|
+
if (type == ":") return cont(poplex, statement);
|
460
|
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
461
|
+
}
|
462
|
+
function property(type) {
|
463
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
464
|
+
}
|
465
|
+
function objprop(type, value) {
|
466
|
+
if (type == "variable" || cx.style == "keyword") {
|
467
|
+
cx.marked = "property";
|
468
|
+
if (value == "get" || value == "set") return cont(getterSetter);
|
469
|
+
return cont(afterprop);
|
470
|
+
} else if (type == "number" || type == "string") {
|
471
|
+
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
472
|
+
return cont(afterprop);
|
473
|
+
} else if (type == "jsonld-keyword") {
|
474
|
+
return cont(afterprop);
|
475
|
+
} else if (type == "modifier") {
|
476
|
+
return cont(objprop)
|
477
|
+
} else if (type == "[") {
|
478
|
+
return cont(expression, expect("]"), afterprop);
|
479
|
+
} else if (type == "spread") {
|
480
|
+
return cont(expression);
|
481
|
+
}
|
482
|
+
}
|
483
|
+
function getterSetter(type) {
|
484
|
+
if (type != "variable") return pass(afterprop);
|
485
|
+
cx.marked = "property";
|
486
|
+
return cont(functiondef);
|
487
|
+
}
|
488
|
+
function afterprop(type) {
|
489
|
+
if (type == ":") return cont(expressionNoComma);
|
490
|
+
if (type == "(") return pass(functiondef);
|
491
|
+
}
|
492
|
+
function commasep(what, end) {
|
493
|
+
function proceed(type, value) {
|
494
|
+
if (type == ",") {
|
495
|
+
var lex = cx.state.lexical;
|
496
|
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
497
|
+
return cont(what, proceed);
|
498
|
+
}
|
499
|
+
if (type == end || value == end) return cont();
|
500
|
+
return cont(expect(end));
|
501
|
+
}
|
502
|
+
return function(type, value) {
|
503
|
+
if (type == end || value == end) return cont();
|
504
|
+
return pass(what, proceed);
|
505
|
+
};
|
506
|
+
}
|
507
|
+
function contCommasep(what, end, info) {
|
508
|
+
for (var i = 3; i < arguments.length; i++)
|
509
|
+
cx.cc.push(arguments[i]);
|
510
|
+
return cont(pushlex(end, info), commasep(what, end), poplex);
|
511
|
+
}
|
512
|
+
function block(type) {
|
513
|
+
if (type == "}") return cont();
|
514
|
+
return pass(statement, block);
|
515
|
+
}
|
516
|
+
function maybetype(type) {
|
517
|
+
if (isTS && type == ":") return cont(typeexpr);
|
518
|
+
}
|
519
|
+
function maybedefault(_, value) {
|
520
|
+
if (value == "=") return cont(expressionNoComma);
|
521
|
+
}
|
522
|
+
function typeexpr(type) {
|
523
|
+
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
|
524
|
+
}
|
525
|
+
function afterType(type, value) {
|
526
|
+
if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
|
527
|
+
if (type == "[") return cont(expect("]"), afterType)
|
528
|
+
}
|
529
|
+
function vardef() {
|
530
|
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
531
|
+
}
|
532
|
+
function pattern(type, value) {
|
533
|
+
if (type == "modifier") return cont(pattern)
|
534
|
+
if (type == "variable") { register(value); return cont(); }
|
535
|
+
if (type == "spread") return cont(pattern);
|
536
|
+
if (type == "[") return contCommasep(pattern, "]");
|
537
|
+
if (type == "{") return contCommasep(proppattern, "}");
|
538
|
+
}
|
539
|
+
function proppattern(type, value) {
|
540
|
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
541
|
+
register(value);
|
542
|
+
return cont(maybeAssign);
|
543
|
+
}
|
544
|
+
if (type == "variable") cx.marked = "property";
|
545
|
+
if (type == "spread") return cont(pattern);
|
546
|
+
if (type == "}") return pass();
|
547
|
+
return cont(expect(":"), pattern, maybeAssign);
|
548
|
+
}
|
549
|
+
function maybeAssign(_type, value) {
|
550
|
+
if (value == "=") return cont(expressionNoComma);
|
551
|
+
}
|
552
|
+
function vardefCont(type) {
|
553
|
+
if (type == ",") return cont(vardef);
|
554
|
+
}
|
555
|
+
function maybeelse(type, value) {
|
556
|
+
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
557
|
+
}
|
558
|
+
function forspec(type) {
|
559
|
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
560
|
+
}
|
561
|
+
function forspec1(type) {
|
562
|
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
563
|
+
if (type == ";") return cont(forspec2);
|
564
|
+
if (type == "variable") return cont(formaybeinof);
|
565
|
+
return pass(expression, expect(";"), forspec2);
|
566
|
+
}
|
567
|
+
function formaybeinof(_type, value) {
|
568
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
569
|
+
return cont(maybeoperatorComma, forspec2);
|
570
|
+
}
|
571
|
+
function forspec2(type, value) {
|
572
|
+
if (type == ";") return cont(forspec3);
|
573
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
574
|
+
return pass(expression, expect(";"), forspec3);
|
575
|
+
}
|
576
|
+
function forspec3(type) {
|
577
|
+
if (type != ")") cont(expression);
|
578
|
+
}
|
579
|
+
function functiondef(type, value) {
|
580
|
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
581
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
582
|
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
583
|
+
}
|
584
|
+
function funarg(type) {
|
585
|
+
if (type == "spread") return cont(funarg);
|
586
|
+
return pass(pattern, maybetype, maybedefault);
|
587
|
+
}
|
588
|
+
function className(type, value) {
|
589
|
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
590
|
+
}
|
591
|
+
function classNameAfter(type, value) {
|
592
|
+
if (value == "extends") return cont(expression, classNameAfter);
|
593
|
+
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
594
|
+
}
|
595
|
+
function classBody(type, value) {
|
596
|
+
if (type == "variable" || cx.style == "keyword") {
|
597
|
+
if (value == "static") {
|
598
|
+
cx.marked = "keyword";
|
599
|
+
return cont(classBody);
|
600
|
+
}
|
601
|
+
cx.marked = "property";
|
602
|
+
if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
|
603
|
+
return cont(functiondef, classBody);
|
604
|
+
}
|
605
|
+
if (value == "*") {
|
606
|
+
cx.marked = "keyword";
|
607
|
+
return cont(classBody);
|
608
|
+
}
|
609
|
+
if (type == ";") return cont(classBody);
|
610
|
+
if (type == "}") return cont();
|
611
|
+
}
|
612
|
+
function classGetterSetter(type) {
|
613
|
+
if (type != "variable") return pass();
|
614
|
+
cx.marked = "property";
|
615
|
+
return cont();
|
616
|
+
}
|
617
|
+
function afterExport(_type, value) {
|
618
|
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
619
|
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
620
|
+
return pass(statement);
|
621
|
+
}
|
622
|
+
function afterImport(type) {
|
623
|
+
if (type == "string") return cont();
|
624
|
+
return pass(importSpec, maybeFrom);
|
625
|
+
}
|
626
|
+
function importSpec(type, value) {
|
627
|
+
if (type == "{") return contCommasep(importSpec, "}");
|
628
|
+
if (type == "variable") register(value);
|
629
|
+
if (value == "*") cx.marked = "keyword";
|
630
|
+
return cont(maybeAs);
|
631
|
+
}
|
632
|
+
function maybeAs(_type, value) {
|
633
|
+
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
|
634
|
+
}
|
635
|
+
function maybeFrom(_type, value) {
|
636
|
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
637
|
+
}
|
638
|
+
function arrayLiteral(type) {
|
639
|
+
if (type == "]") return cont();
|
640
|
+
return pass(expressionNoComma, maybeArrayComprehension);
|
641
|
+
}
|
642
|
+
function maybeArrayComprehension(type) {
|
643
|
+
if (type == "for") return pass(comprehension, expect("]"));
|
644
|
+
if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));
|
645
|
+
return pass(commasep(expressionNoComma, "]"));
|
646
|
+
}
|
647
|
+
function comprehension(type) {
|
648
|
+
if (type == "for") return cont(forspec, comprehension);
|
649
|
+
if (type == "if") return cont(expression, comprehension);
|
650
|
+
}
|
651
|
+
|
652
|
+
function isContinuedStatement(state, textAfter) {
|
653
|
+
return state.lastType == "operator" || state.lastType == "," ||
|
654
|
+
isOperatorChar.test(textAfter.charAt(0)) ||
|
655
|
+
/[,.]/.test(textAfter.charAt(0));
|
656
|
+
}
|
657
|
+
|
658
|
+
// Interface
|
659
|
+
|
660
|
+
return {
|
661
|
+
startState: function(basecolumn) {
|
662
|
+
var state = {
|
663
|
+
tokenize: tokenBase,
|
664
|
+
lastType: "sof",
|
665
|
+
cc: [],
|
666
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
667
|
+
localVars: parserConfig.localVars,
|
668
|
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
669
|
+
indented: basecolumn || 0
|
670
|
+
};
|
671
|
+
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
672
|
+
state.globalVars = parserConfig.globalVars;
|
673
|
+
return state;
|
674
|
+
},
|
675
|
+
|
676
|
+
token: function(stream, state) {
|
677
|
+
if (stream.sol()) {
|
678
|
+
if (!state.lexical.hasOwnProperty("align"))
|
679
|
+
state.lexical.align = false;
|
680
|
+
state.indented = stream.indentation();
|
681
|
+
findFatArrow(stream, state);
|
682
|
+
}
|
683
|
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
684
|
+
var style = state.tokenize(stream, state);
|
685
|
+
if (type == "comment") return style;
|
686
|
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
687
|
+
return parseJS(state, style, type, content, stream);
|
688
|
+
},
|
689
|
+
|
690
|
+
indent: function(state, textAfter) {
|
691
|
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
692
|
+
if (state.tokenize != tokenBase) return 0;
|
693
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
694
|
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
695
|
+
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
696
|
+
var c = state.cc[i];
|
697
|
+
if (c == poplex) lexical = lexical.prev;
|
698
|
+
else if (c != maybeelse) break;
|
699
|
+
}
|
700
|
+
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
701
|
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
702
|
+
lexical = lexical.prev;
|
703
|
+
var type = lexical.type, closing = firstChar == type;
|
704
|
+
|
705
|
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
706
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
707
|
+
else if (type == "form") return lexical.indented + indentUnit;
|
708
|
+
else if (type == "stat")
|
709
|
+
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
710
|
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
711
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
712
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
713
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
714
|
+
},
|
715
|
+
|
716
|
+
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
717
|
+
blockCommentStart: jsonMode ? null : "/*",
|
718
|
+
blockCommentEnd: jsonMode ? null : "*/",
|
719
|
+
lineComment: jsonMode ? null : "//",
|
720
|
+
fold: "brace",
|
721
|
+
closeBrackets: "()[]{}''\"\"``",
|
722
|
+
|
723
|
+
helperType: jsonMode ? "json" : "javascript",
|
724
|
+
jsonldMode: jsonldMode,
|
725
|
+
jsonMode: jsonMode,
|
726
|
+
|
727
|
+
expressionAllowed: expressionAllowed,
|
728
|
+
skipExpression: function(state) {
|
729
|
+
var top = state.cc[state.cc.length - 1]
|
730
|
+
if (top == expression || top == expressionNoComma) state.cc.pop()
|
731
|
+
}
|
732
|
+
};
|
733
|
+
});
|
734
|
+
|
735
|
+
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
736
|
+
|
737
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
738
|
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
739
|
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
740
|
+
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
741
|
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
742
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
743
|
+
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
744
|
+
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
745
|
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
746
|
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
747
|
+
|
748
|
+
});
|