qword 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +2333 -0
- package/LICENSE +22 -0
- package/README.md +170 -0
- package/assets/font/DroidSansMono.eot +0 -0
- package/assets/font/DroidSansMono.woff +0 -0
- package/assets/font/DroidSansMono.woff2 +0 -0
- package/assets/index.html +24 -0
- package/assets/style.css +34 -0
- package/bin/dword.js +109 -0
- package/client/_clipboard.js +53 -0
- package/client/_init-socket.js +77 -0
- package/client/_on-save.js +38 -0
- package/client/codemirror/show-trailing.js +54 -0
- package/client/codemirror/use-soft-tabs.js +38 -0
- package/client/dword.js +717 -0
- package/client/loadremote.js +93 -0
- package/client/save.js +53 -0
- package/client/set-key-map.js +3 -0
- package/client/show-message.js +30 -0
- package/client/story.js +55 -0
- package/codemirror/codemirror.js +3 -0
- package/css/dword.css +20 -0
- package/dist/2b22a33a0a80bb926bbc.png +1 -0
- package/dist/8e9019bd86255ac9a618.png +1 -0
- package/dist/codemirror.js +2 -0
- package/dist/codemirror.js.map +1 -0
- package/dist/dword.js +2 -0
- package/dist/dword.js.map +1 -0
- package/dist-dev/2b22a33a0a80bb926bbc.png +1 -0
- package/dist-dev/8e9019bd86255ac9a618.png +1 -0
- package/dist-dev/codemirror.js +104 -0
- package/dist-dev/dword.js +960 -0
- package/img/dword.png +0 -0
- package/json/bin.json +4 -0
- package/json/edit.json +17 -0
- package/json/ext.json +12 -0
- package/json/modules.json +22 -0
- package/modules/cm-searchbox/ChangeLog +60 -0
- package/modules/cm-searchbox/LICENSE +21 -0
- package/modules/cm-searchbox/README.md +27 -0
- package/modules/cm-searchbox/img/searchbox.png +0 -0
- package/modules/cm-searchbox/lib/searchbox.js +679 -0
- package/modules/cm-searchbox/package.json +27 -0
- package/modules/cm-show-invisibles/ChangeLog +108 -0
- package/modules/cm-show-invisibles/LICENSE +21 -0
- package/modules/cm-show-invisibles/README.md +25 -0
- package/modules/cm-show-invisibles/lib/show-invisibles.js +131 -0
- package/modules/cm-show-invisibles/package.json +34 -0
- package/modules/codemirror/AUTHORS +992 -0
- package/modules/codemirror/CHANGELOG.md +2290 -0
- package/modules/codemirror/CONTRIBUTING.md +97 -0
- package/modules/codemirror/LICENSE +21 -0
- package/modules/codemirror/README.md +48 -0
- package/modules/codemirror/addon/comment/comment.js +211 -0
- package/modules/codemirror/addon/comment/continuecomment.js +114 -0
- package/modules/codemirror/addon/dialog/dialog.css +32 -0
- package/modules/codemirror/addon/dialog/dialog.js +163 -0
- package/modules/codemirror/addon/display/autorefresh.js +47 -0
- package/modules/codemirror/addon/display/fullscreen.css +6 -0
- package/modules/codemirror/addon/display/fullscreen.js +41 -0
- package/modules/codemirror/addon/display/panel.js +133 -0
- package/modules/codemirror/addon/display/placeholder.js +78 -0
- package/modules/codemirror/addon/display/rulers.js +51 -0
- package/modules/codemirror/addon/edit/closebrackets.js +201 -0
- package/modules/codemirror/addon/edit/closetag.js +185 -0
- package/modules/codemirror/addon/edit/continuelist.js +101 -0
- package/modules/codemirror/addon/edit/matchbrackets.js +160 -0
- package/modules/codemirror/addon/edit/matchtags.js +66 -0
- package/modules/codemirror/addon/edit/trailingspace.js +27 -0
- package/modules/codemirror/addon/fold/brace-fold.js +119 -0
- package/modules/codemirror/addon/fold/comment-fold.js +59 -0
- package/modules/codemirror/addon/fold/foldcode.js +159 -0
- package/modules/codemirror/addon/fold/foldgutter.css +20 -0
- package/modules/codemirror/addon/fold/foldgutter.js +169 -0
- package/modules/codemirror/addon/fold/indent-fold.js +48 -0
- package/modules/codemirror/addon/fold/markdown-fold.js +49 -0
- package/modules/codemirror/addon/fold/xml-fold.js +184 -0
- package/modules/codemirror/addon/hint/anyword-hint.js +41 -0
- package/modules/codemirror/addon/hint/css-hint.js +66 -0
- package/modules/codemirror/addon/hint/html-hint.js +351 -0
- package/modules/codemirror/addon/hint/javascript-hint.js +162 -0
- package/modules/codemirror/addon/hint/show-hint.css +37 -0
- package/modules/codemirror/addon/hint/show-hint.js +523 -0
- package/modules/codemirror/addon/hint/sql-hint.js +304 -0
- package/modules/codemirror/addon/hint/xml-hint.js +132 -0
- package/modules/codemirror/addon/lint/coffeescript-lint.js +47 -0
- package/modules/codemirror/addon/lint/css-lint.js +40 -0
- package/modules/codemirror/addon/lint/html-lint.js +59 -0
- package/modules/codemirror/addon/lint/javascript-lint.js +65 -0
- package/modules/codemirror/addon/lint/json-lint.js +40 -0
- package/modules/codemirror/addon/lint/lint.css +79 -0
- package/modules/codemirror/addon/lint/lint.js +288 -0
- package/modules/codemirror/addon/lint/yaml-lint.js +41 -0
- package/modules/codemirror/addon/merge/merge.css +119 -0
- package/modules/codemirror/addon/merge/merge.js +1018 -0
- package/modules/codemirror/addon/mode/loadmode.js +66 -0
- package/modules/codemirror/addon/mode/multiplex.js +136 -0
- package/modules/codemirror/addon/mode/multiplex_test.js +49 -0
- package/modules/codemirror/addon/mode/overlay.js +90 -0
- package/modules/codemirror/addon/mode/simple.js +216 -0
- package/modules/codemirror/addon/runmode/colorize.js +40 -0
- package/modules/codemirror/addon/runmode/runmode-standalone.js +334 -0
- package/modules/codemirror/addon/runmode/runmode.js +76 -0
- package/modules/codemirror/addon/runmode/runmode.node.js +329 -0
- package/modules/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/modules/codemirror/addon/scroll/scrollpastend.js +48 -0
- package/modules/codemirror/addon/scroll/simplescrollbars.css +66 -0
- package/modules/codemirror/addon/scroll/simplescrollbars.js +152 -0
- package/modules/codemirror/addon/search/jump-to-line.js +53 -0
- package/modules/codemirror/addon/search/match-highlighter.js +167 -0
- package/modules/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/modules/codemirror/addon/search/matchesonscrollbar.js +97 -0
- package/modules/codemirror/addon/search/search.js +295 -0
- package/modules/codemirror/addon/search/searchcursor.js +305 -0
- package/modules/codemirror/addon/selection/active-line.js +72 -0
- package/modules/codemirror/addon/selection/mark-selection.js +119 -0
- package/modules/codemirror/addon/selection/selection-pointer.js +98 -0
- package/modules/codemirror/addon/tern/tern.css +87 -0
- package/modules/codemirror/addon/tern/tern.js +756 -0
- package/modules/codemirror/addon/tern/worker.js +44 -0
- package/modules/codemirror/addon/wrap/hardwrap.js +160 -0
- package/modules/codemirror/bin/source-highlight +48 -0
- package/modules/codemirror/changes +3 -0
- package/modules/codemirror/changes.md +42 -0
- package/modules/codemirror/changes.txt +8 -0
- package/modules/codemirror/diff +781 -0
- package/modules/codemirror/dist/index.cjs +102 -0
- package/modules/codemirror/dist/index.d.cts +52 -0
- package/modules/codemirror/dist/index.d.ts +52 -0
- package/modules/codemirror/dist/index.js +96 -0
- package/modules/codemirror/keymap/emacs.js +545 -0
- package/modules/codemirror/keymap/sublime.js +720 -0
- package/modules/codemirror/keymap/vim.js +5978 -0
- package/modules/codemirror/lib/codemirror.css +344 -0
- package/modules/codemirror/lib/codemirror.js +9884 -0
- package/modules/codemirror/mode/apl/apl.js +174 -0
- package/modules/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- package/modules/codemirror/mode/asn.1/asn.1.js +204 -0
- package/modules/codemirror/mode/asterisk/asterisk.js +220 -0
- package/modules/codemirror/mode/brainfuck/brainfuck.js +85 -0
- package/modules/codemirror/mode/clike/clike.js +942 -0
- package/modules/codemirror/mode/clojure/clojure.js +293 -0
- package/modules/codemirror/mode/cmake/cmake.js +97 -0
- package/modules/codemirror/mode/cobol/cobol.js +255 -0
- package/modules/codemirror/mode/coffeescript/coffeescript.js +359 -0
- package/modules/codemirror/mode/commonlisp/commonlisp.js +125 -0
- package/modules/codemirror/mode/crystal/crystal.js +433 -0
- package/modules/codemirror/mode/css/css.js +862 -0
- package/modules/codemirror/mode/cypher/cypher.js +152 -0
- package/modules/codemirror/mode/d/d.js +223 -0
- package/modules/codemirror/mode/dart/dart.js +168 -0
- package/modules/codemirror/mode/diff/diff.js +47 -0
- package/modules/codemirror/mode/django/django.js +356 -0
- package/modules/codemirror/mode/dockerfile/dockerfile.js +211 -0
- package/modules/codemirror/mode/dtd/dtd.js +142 -0
- package/modules/codemirror/mode/dylan/dylan.js +352 -0
- package/modules/codemirror/mode/ebnf/ebnf.js +195 -0
- package/modules/codemirror/mode/ecl/ecl.js +206 -0
- package/modules/codemirror/mode/eiffel/eiffel.js +160 -0
- package/modules/codemirror/mode/elm/elm.js +245 -0
- package/modules/codemirror/mode/erlang/erlang.js +619 -0
- package/modules/codemirror/mode/factor/factor.js +85 -0
- package/modules/codemirror/mode/fcl/fcl.js +173 -0
- package/modules/codemirror/mode/forth/forth.js +180 -0
- package/modules/codemirror/mode/fortran/fortran.js +188 -0
- package/modules/codemirror/mode/gas/gas.js +355 -0
- package/modules/codemirror/mode/gfm/gfm.js +129 -0
- package/modules/codemirror/mode/gherkin/gherkin.js +194 -0
- package/modules/codemirror/mode/go/go.js +187 -0
- package/modules/codemirror/mode/groovy/groovy.js +245 -0
- package/modules/codemirror/mode/haml/haml.js +161 -0
- package/modules/codemirror/mode/handlebars/handlebars.js +70 -0
- package/modules/codemirror/mode/haskell/haskell.js +268 -0
- package/modules/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- package/modules/codemirror/mode/haxe/haxe.js +515 -0
- package/modules/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- package/modules/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/modules/codemirror/mode/http/http.js +113 -0
- package/modules/codemirror/mode/idl/idl.js +290 -0
- package/modules/codemirror/mode/javascript/javascript.js +960 -0
- package/modules/codemirror/mode/jinja2/jinja2.js +193 -0
- package/modules/codemirror/mode/jsx/jsx.js +149 -0
- package/modules/codemirror/mode/julia/julia.js +390 -0
- package/modules/codemirror/mode/livescript/livescript.js +280 -0
- package/modules/codemirror/mode/lua/lua.js +160 -0
- package/modules/codemirror/mode/markdown/markdown.js +886 -0
- package/modules/codemirror/mode/mathematica/mathematica.js +176 -0
- package/modules/codemirror/mode/mbox/mbox.js +129 -0
- package/modules/codemirror/mode/meta.js +221 -0
- package/modules/codemirror/mode/mirc/mirc.js +193 -0
- package/modules/codemirror/mode/mllike/mllike.js +359 -0
- package/modules/codemirror/mode/modelica/modelica.js +245 -0
- package/modules/codemirror/mode/mscgen/mscgen.js +175 -0
- package/modules/codemirror/mode/mumps/mumps.js +148 -0
- package/modules/codemirror/mode/nginx/nginx.js +178 -0
- package/modules/codemirror/mode/nsis/nsis.js +95 -0
- package/modules/codemirror/mode/ntriples/ntriples.js +195 -0
- package/modules/codemirror/mode/octave/octave.js +139 -0
- package/modules/codemirror/mode/oz/oz.js +252 -0
- package/modules/codemirror/mode/pascal/pascal.js +136 -0
- package/modules/codemirror/mode/pegjs/pegjs.js +111 -0
- package/modules/codemirror/mode/perl/perl.js +836 -0
- package/modules/codemirror/mode/php/php.js +234 -0
- package/modules/codemirror/mode/pig/pig.js +178 -0
- package/modules/codemirror/mode/powershell/powershell.js +398 -0
- package/modules/codemirror/mode/properties/properties.js +78 -0
- package/modules/codemirror/mode/protobuf/protobuf.js +72 -0
- package/modules/codemirror/mode/pug/pug.js +591 -0
- package/modules/codemirror/mode/puppet/puppet.js +220 -0
- package/modules/codemirror/mode/python/python.js +402 -0
- package/modules/codemirror/mode/q/q.js +139 -0
- package/modules/codemirror/mode/r/r.js +190 -0
- package/modules/codemirror/mode/rpm/changes/index.html +66 -0
- package/modules/codemirror/mode/rpm/rpm.js +109 -0
- package/modules/codemirror/mode/rst/rst.js +557 -0
- package/modules/codemirror/mode/ruby/ruby.js +303 -0
- package/modules/codemirror/mode/rust/rust.js +72 -0
- package/modules/codemirror/mode/sas/sas.js +303 -0
- package/modules/codemirror/mode/sass/sass.js +459 -0
- package/modules/codemirror/mode/scheme/scheme.js +284 -0
- package/modules/codemirror/mode/shell/shell.js +168 -0
- package/modules/codemirror/mode/sieve/sieve.js +193 -0
- package/modules/codemirror/mode/slim/slim.js +575 -0
- package/modules/codemirror/mode/smalltalk/smalltalk.js +168 -0
- package/modules/codemirror/mode/smarty/smarty.js +225 -0
- package/modules/codemirror/mode/solr/solr.js +104 -0
- package/modules/codemirror/mode/soy/soy.js +665 -0
- package/modules/codemirror/mode/sparql/sparql.js +184 -0
- package/modules/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- package/modules/codemirror/mode/sql/sql.js +529 -0
- package/modules/codemirror/mode/stex/stex.js +264 -0
- package/modules/codemirror/mode/stylus/stylus.js +775 -0
- package/modules/codemirror/mode/swift/swift.js +221 -0
- package/modules/codemirror/mode/tcl/tcl.js +140 -0
- package/modules/codemirror/mode/textile/textile.js +469 -0
- package/modules/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- package/modules/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- package/modules/codemirror/mode/tiki/tiki.css +26 -0
- package/modules/codemirror/mode/tiki/tiki.js +312 -0
- package/modules/codemirror/mode/toml/toml.js +88 -0
- package/modules/codemirror/mode/tornado/tornado.js +68 -0
- package/modules/codemirror/mode/troff/troff.js +84 -0
- package/modules/codemirror/mode/ttcn/ttcn.js +283 -0
- package/modules/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- package/modules/codemirror/mode/turtle/turtle.js +162 -0
- package/modules/codemirror/mode/twig/twig.js +141 -0
- package/modules/codemirror/mode/vb/vb.js +275 -0
- package/modules/codemirror/mode/vbscript/vbscript.js +350 -0
- package/modules/codemirror/mode/velocity/velocity.js +202 -0
- package/modules/codemirror/mode/verilog/verilog.js +781 -0
- package/modules/codemirror/mode/vhdl/vhdl.js +189 -0
- package/modules/codemirror/mode/vue/vue.js +77 -0
- package/modules/codemirror/mode/wast/wast.js +132 -0
- package/modules/codemirror/mode/webidl/webidl.js +195 -0
- package/modules/codemirror/mode/xml/xml.js +417 -0
- package/modules/codemirror/mode/xquery/xquery.js +448 -0
- package/modules/codemirror/mode/yacas/yacas.js +204 -0
- package/modules/codemirror/mode/yaml/yaml.js +120 -0
- package/modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
- package/modules/codemirror/mode/z80/z80.js +116 -0
- package/modules/codemirror/package.json +52 -0
- package/modules/codemirror/src/addon/runmode/codemirror-standalone.js +24 -0
- package/modules/codemirror/src/addon/runmode/codemirror.node.js +21 -0
- package/modules/codemirror/src/addon/runmode/runmode-standalone.js +2 -0
- package/modules/codemirror/src/addon/runmode/runmode.node.js +2 -0
- package/modules/codemirror/src/codemirror.js +3 -0
- package/modules/codemirror/src/display/Display.js +116 -0
- package/modules/codemirror/src/display/focus.js +50 -0
- package/modules/codemirror/src/display/gutters.js +44 -0
- package/modules/codemirror/src/display/highlight_worker.js +55 -0
- package/modules/codemirror/src/display/line_numbers.js +48 -0
- package/modules/codemirror/src/display/mode_state.js +22 -0
- package/modules/codemirror/src/display/operations.js +206 -0
- package/modules/codemirror/src/display/scroll_events.js +132 -0
- package/modules/codemirror/src/display/scrollbars.js +194 -0
- package/modules/codemirror/src/display/scrolling.js +186 -0
- package/modules/codemirror/src/display/selection.js +173 -0
- package/modules/codemirror/src/display/update_display.js +267 -0
- package/modules/codemirror/src/display/update_line.js +189 -0
- package/modules/codemirror/src/display/update_lines.js +82 -0
- package/modules/codemirror/src/display/view_tracking.js +153 -0
- package/modules/codemirror/src/edit/CodeMirror.js +217 -0
- package/modules/codemirror/src/edit/commands.js +178 -0
- package/modules/codemirror/src/edit/deleteNearSelection.js +30 -0
- package/modules/codemirror/src/edit/drop_events.js +130 -0
- package/modules/codemirror/src/edit/fromTextArea.js +61 -0
- package/modules/codemirror/src/edit/global_events.js +45 -0
- package/modules/codemirror/src/edit/key_events.js +163 -0
- package/modules/codemirror/src/edit/legacy.js +62 -0
- package/modules/codemirror/src/edit/main.js +69 -0
- package/modules/codemirror/src/edit/methods.js +555 -0
- package/modules/codemirror/src/edit/mouse_events.js +417 -0
- package/modules/codemirror/src/edit/options.js +194 -0
- package/modules/codemirror/src/edit/utils.js +7 -0
- package/modules/codemirror/src/input/#ContentEditableInput.js# +475 -0
- package/modules/codemirror/src/input/ContentEditableInput.js +546 -0
- package/modules/codemirror/src/input/TextareaInput.js +380 -0
- package/modules/codemirror/src/input/indent.js +71 -0
- package/modules/codemirror/src/input/input.js +134 -0
- package/modules/codemirror/src/input/keymap.js +147 -0
- package/modules/codemirror/src/input/keynames.js +17 -0
- package/modules/codemirror/src/input/movement.js +111 -0
- package/modules/codemirror/src/line/highlight.js +284 -0
- package/modules/codemirror/src/line/line_data.js +349 -0
- package/modules/codemirror/src/line/pos.js +40 -0
- package/modules/codemirror/src/line/saw_special_spans.js +10 -0
- package/modules/codemirror/src/line/spans.js +390 -0
- package/modules/codemirror/src/line/utils_line.js +85 -0
- package/modules/codemirror/src/measurement/position_measurement.js +702 -0
- package/modules/codemirror/src/measurement/widgets.js +26 -0
- package/modules/codemirror/src/model/Doc.js +436 -0
- package/modules/codemirror/src/model/change_measurement.js +61 -0
- package/modules/codemirror/src/model/changes.js +339 -0
- package/modules/codemirror/src/model/chunk.js +167 -0
- package/modules/codemirror/src/model/document_data.js +112 -0
- package/modules/codemirror/src/model/history.js +228 -0
- package/modules/codemirror/src/model/line_widget.js +78 -0
- package/modules/codemirror/src/model/mark_text.js +293 -0
- package/modules/codemirror/src/model/selection.js +84 -0
- package/modules/codemirror/src/model/selection_updates.js +216 -0
- package/modules/codemirror/src/modes.js +96 -0
- package/modules/codemirror/src/util/StringStream.js +90 -0
- package/modules/codemirror/src/util/bidi.js +215 -0
- package/modules/codemirror/src/util/browser.js +34 -0
- package/modules/codemirror/src/util/dom.js +111 -0
- package/modules/codemirror/src/util/event.js +103 -0
- package/modules/codemirror/src/util/feature_detection.js +84 -0
- package/modules/codemirror/src/util/misc.js +168 -0
- package/modules/codemirror/src/util/operation_group.js +72 -0
- package/modules/codemirror/theme/3024-day.css +41 -0
- package/modules/codemirror/theme/3024-night.css +39 -0
- package/modules/codemirror/theme/abbott.css +268 -0
- package/modules/codemirror/theme/abcdef.css +32 -0
- package/modules/codemirror/theme/ambiance-mobile.css +5 -0
- package/modules/codemirror/theme/ambiance.css +74 -0
- package/modules/codemirror/theme/ayu-dark.css +44 -0
- package/modules/codemirror/theme/ayu-mirage.css +45 -0
- package/modules/codemirror/theme/base16-dark.css +40 -0
- package/modules/codemirror/theme/base16-light.css +38 -0
- package/modules/codemirror/theme/bespin.css +34 -0
- package/modules/codemirror/theme/blackboard.css +32 -0
- package/modules/codemirror/theme/cobalt.css +25 -0
- package/modules/codemirror/theme/colorforth.css +33 -0
- package/modules/codemirror/theme/darcula.css +53 -0
- package/modules/codemirror/theme/dracula.css +40 -0
- package/modules/codemirror/theme/duotone-dark.css +35 -0
- package/modules/codemirror/theme/duotone-light.css +36 -0
- package/modules/codemirror/theme/eclipse.css +23 -0
- package/modules/codemirror/theme/elegant.css +13 -0
- package/modules/codemirror/theme/erlang-dark.css +34 -0
- package/modules/codemirror/theme/gruvbox-dark.css +39 -0
- package/modules/codemirror/theme/hopscotch.css +34 -0
- package/modules/codemirror/theme/icecoder.css +43 -0
- package/modules/codemirror/theme/idea.css +42 -0
- package/modules/codemirror/theme/isotope.css +34 -0
- package/modules/codemirror/theme/juejin.css +30 -0
- package/modules/codemirror/theme/lesser-dark.css +47 -0
- package/modules/codemirror/theme/liquibyte.css +95 -0
- package/modules/codemirror/theme/lucario.css +37 -0
- package/modules/codemirror/theme/material-darker.css +135 -0
- package/modules/codemirror/theme/material-ocean.css +141 -0
- package/modules/codemirror/theme/material-palenight.css +141 -0
- package/modules/codemirror/theme/material.css +141 -0
- package/modules/codemirror/theme/mbo.css +37 -0
- package/modules/codemirror/theme/mdn-like.css +46 -0
- package/modules/codemirror/theme/midnight.css +39 -0
- package/modules/codemirror/theme/monokai.css +41 -0
- package/modules/codemirror/theme/moxer.css +143 -0
- package/modules/codemirror/theme/neat.css +12 -0
- package/modules/codemirror/theme/neo.css +43 -0
- package/modules/codemirror/theme/night.css +27 -0
- package/modules/codemirror/theme/nord.css +42 -0
- package/modules/codemirror/theme/oceanic-next.css +46 -0
- package/modules/codemirror/theme/panda-syntax.css +85 -0
- package/modules/codemirror/theme/paraiso-dark.css +38 -0
- package/modules/codemirror/theme/paraiso-light.css +38 -0
- package/modules/codemirror/theme/pastel-on-dark.css +52 -0
- package/modules/codemirror/theme/railscasts.css +34 -0
- package/modules/codemirror/theme/rubyblue.css +25 -0
- package/modules/codemirror/theme/seti.css +44 -0
- package/modules/codemirror/theme/shadowfox.css +52 -0
- package/modules/codemirror/theme/solarized.css +165 -0
- package/modules/codemirror/theme/ssms.css +16 -0
- package/modules/codemirror/theme/the-matrix.css +30 -0
- package/modules/codemirror/theme/tomorrow-night-bright.css +35 -0
- package/modules/codemirror/theme/tomorrow-night-eighties.css +38 -0
- package/modules/codemirror/theme/ttcn.css +64 -0
- package/modules/codemirror/theme/twilight.css +32 -0
- package/modules/codemirror/theme/vibrant-ink.css +34 -0
- package/modules/codemirror/theme/xq-dark.css +53 -0
- package/modules/codemirror/theme/xq-light.css +43 -0
- package/modules/codemirror/theme/yeti.css +44 -0
- package/modules/codemirror/theme/yonce.css +59 -0
- package/modules/codemirror/theme/zenburn.css +37 -0
- package/modules/codemirror-emmet/README.md +56 -0
- package/modules/codemirror-emmet/dist/emmet.js +48661 -0
- package/modules/codemirror-emmet/dist/emmet.min.js +8 -0
- package/modules/codemirror-emmet/dist/emmetPlugin.js +840 -0
- package/modules/codemirror-emmet/dist/emmetPlugin.min.js +1 -0
- package/modules/codemirror-emmet/dist/index.html +46 -0
- package/modules/codemirror-emmet/editor.js +204 -0
- package/modules/codemirror-emmet/gulpfile.js +54 -0
- package/modules/codemirror-emmet/index.html +68 -0
- package/modules/codemirror-emmet/package.json +36 -0
- package/modules/codemirror-emmet/plugin.js +201 -0
- package/modules/codemirror-emmet/shim.js +19 -0
- package/modules/codemirror-emmet/vendor/almond.js +410 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.css +270 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/codemirror.js +7339 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/css.js +701 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/htmlmixed.js +117 -0
- package/modules/codemirror-emmet/vendor/codemirror/v4/xml.js +349 -0
- package/modules/jshint/README.md +114 -0
- package/modules/jshint/dist/jshint-rhino.js +32143 -0
- package/modules/jshint/dist/jshint.js +32141 -0
- package/modules/jshint/package.json +77 -0
- package/modules/loadremote/ChangeLog +23 -0
- package/modules/loadremote/LICENSE +21 -0
- package/modules/loadremote/README.md +53 -0
- package/modules/loadremote/lib/loadremote.js +147 -0
- package/modules/loadremote/package.json +26 -0
- package/package.json +107 -0
- package/server/edit.js +54 -0
- package/server/index.js +193 -0
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
(function (root, factory) {if (typeof define === "function" && define.amd) {define(factory);} else {root.emmetPlugin = factory();}}(this, function () {
|
|
2
|
+
/**
|
|
3
|
+
* almond 0.2.6 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
|
|
4
|
+
* Available via the MIT or new BSD license.
|
|
5
|
+
* see: http://github.com/jrburke/almond for details
|
|
6
|
+
*/
|
|
7
|
+
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
|
8
|
+
//be followed.
|
|
9
|
+
/*jslint sloppy: true */
|
|
10
|
+
/*global setTimeout: false */
|
|
11
|
+
|
|
12
|
+
var requirejs, require, define;
|
|
13
|
+
(function (undef) {
|
|
14
|
+
var main, req, makeMap, handlers,
|
|
15
|
+
defined = {},
|
|
16
|
+
waiting = {},
|
|
17
|
+
config = {},
|
|
18
|
+
defining = {},
|
|
19
|
+
hasOwn = Object.prototype.hasOwnProperty,
|
|
20
|
+
aps = [].slice;
|
|
21
|
+
|
|
22
|
+
function hasProp(obj, prop) {
|
|
23
|
+
return hasOwn.call(obj, prop);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Given a relative module name, like ./something, normalize it to
|
|
28
|
+
* a real name that can be mapped to a path.
|
|
29
|
+
* @param {String} name the relative name
|
|
30
|
+
* @param {String} baseName a real name that the name arg is relative
|
|
31
|
+
* to.
|
|
32
|
+
* @returns {String} normalized name
|
|
33
|
+
*/
|
|
34
|
+
function normalize(name, baseName) {
|
|
35
|
+
var nameParts, nameSegment, mapValue, foundMap,
|
|
36
|
+
foundI, foundStarMap, starI, i, j, part,
|
|
37
|
+
baseParts = baseName && baseName.split("/"),
|
|
38
|
+
map = config.map,
|
|
39
|
+
starMap = (map && map['*']) || {};
|
|
40
|
+
|
|
41
|
+
//Adjust any relative paths.
|
|
42
|
+
if (name && name.charAt(0) === ".") {
|
|
43
|
+
//If have a base name, try to normalize against it,
|
|
44
|
+
//otherwise, assume it is a top-level require that will
|
|
45
|
+
//be relative to baseUrl in the end.
|
|
46
|
+
if (baseName) {
|
|
47
|
+
//Convert baseName to array, and lop off the last part,
|
|
48
|
+
//so that . matches that "directory" and not name of the baseName's
|
|
49
|
+
//module. For instance, baseName of "one/two/three", maps to
|
|
50
|
+
//"one/two/three.js", but we want the directory, "one/two" for
|
|
51
|
+
//this normalization.
|
|
52
|
+
baseParts = baseParts.slice(0, baseParts.length - 1);
|
|
53
|
+
|
|
54
|
+
name = baseParts.concat(name.split("/"));
|
|
55
|
+
|
|
56
|
+
//start trimDots
|
|
57
|
+
for (i = 0; i < name.length; i += 1) {
|
|
58
|
+
part = name[i];
|
|
59
|
+
if (part === ".") {
|
|
60
|
+
name.splice(i, 1);
|
|
61
|
+
i -= 1;
|
|
62
|
+
} else if (part === "..") {
|
|
63
|
+
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
|
64
|
+
//End of the line. Keep at least one non-dot
|
|
65
|
+
//path segment at the front so it can be mapped
|
|
66
|
+
//correctly to disk. Otherwise, there is likely
|
|
67
|
+
//no path mapping for a path starting with '..'.
|
|
68
|
+
//This can still fail, but catches the most reasonable
|
|
69
|
+
//uses of ..
|
|
70
|
+
break;
|
|
71
|
+
} else if (i > 0) {
|
|
72
|
+
name.splice(i - 1, 2);
|
|
73
|
+
i -= 2;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//end trimDots
|
|
78
|
+
|
|
79
|
+
name = name.join("/");
|
|
80
|
+
} else if (name.indexOf('./') === 0) {
|
|
81
|
+
// No baseName, so this is ID is resolved relative
|
|
82
|
+
// to baseUrl, pull off the leading dot.
|
|
83
|
+
name = name.substring(2);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//Apply map config if available.
|
|
88
|
+
if ((baseParts || starMap) && map) {
|
|
89
|
+
nameParts = name.split('/');
|
|
90
|
+
|
|
91
|
+
for (i = nameParts.length; i > 0; i -= 1) {
|
|
92
|
+
nameSegment = nameParts.slice(0, i).join("/");
|
|
93
|
+
|
|
94
|
+
if (baseParts) {
|
|
95
|
+
//Find the longest baseName segment match in the config.
|
|
96
|
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
|
97
|
+
for (j = baseParts.length; j > 0; j -= 1) {
|
|
98
|
+
mapValue = map[baseParts.slice(0, j).join('/')];
|
|
99
|
+
|
|
100
|
+
//baseName segment has config, find if it has one for
|
|
101
|
+
//this name.
|
|
102
|
+
if (mapValue) {
|
|
103
|
+
mapValue = mapValue[nameSegment];
|
|
104
|
+
if (mapValue) {
|
|
105
|
+
//Match, update name to the new value.
|
|
106
|
+
foundMap = mapValue;
|
|
107
|
+
foundI = i;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (foundMap) {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//Check for a star map match, but just hold on to it,
|
|
119
|
+
//if there is a shorter segment match later in a matching
|
|
120
|
+
//config, then favor over this star map.
|
|
121
|
+
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
|
122
|
+
foundStarMap = starMap[nameSegment];
|
|
123
|
+
starI = i;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!foundMap && foundStarMap) {
|
|
128
|
+
foundMap = foundStarMap;
|
|
129
|
+
foundI = starI;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (foundMap) {
|
|
133
|
+
nameParts.splice(0, foundI, foundMap);
|
|
134
|
+
name = nameParts.join('/');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return name;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function makeRequire(relName, forceSync) {
|
|
142
|
+
return function () {
|
|
143
|
+
//A version of a require function that passes a moduleName
|
|
144
|
+
//value for items that may need to
|
|
145
|
+
//look up paths relative to the moduleName
|
|
146
|
+
return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function makeNormalize(relName) {
|
|
151
|
+
return function (name) {
|
|
152
|
+
return normalize(name, relName);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function makeLoad(depName) {
|
|
157
|
+
return function (value) {
|
|
158
|
+
defined[depName] = value;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function callDep(name) {
|
|
163
|
+
if (hasProp(waiting, name)) {
|
|
164
|
+
var args = waiting[name];
|
|
165
|
+
delete waiting[name];
|
|
166
|
+
defining[name] = true;
|
|
167
|
+
main.apply(undef, args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
|
171
|
+
throw new Error('No ' + name);
|
|
172
|
+
}
|
|
173
|
+
return defined[name];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//Turns a plugin!resource to [plugin, resource]
|
|
177
|
+
//with the plugin being undefined if the name
|
|
178
|
+
//did not have a plugin prefix.
|
|
179
|
+
function splitPrefix(name) {
|
|
180
|
+
var prefix,
|
|
181
|
+
index = name ? name.indexOf('!') : -1;
|
|
182
|
+
if (index > -1) {
|
|
183
|
+
prefix = name.substring(0, index);
|
|
184
|
+
name = name.substring(index + 1, name.length);
|
|
185
|
+
}
|
|
186
|
+
return [prefix, name];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Makes a name map, normalizing the name, and using a plugin
|
|
191
|
+
* for normalization if necessary. Grabs a ref to plugin
|
|
192
|
+
* too, as an optimization.
|
|
193
|
+
*/
|
|
194
|
+
makeMap = function (name, relName) {
|
|
195
|
+
var plugin,
|
|
196
|
+
parts = splitPrefix(name),
|
|
197
|
+
prefix = parts[0];
|
|
198
|
+
|
|
199
|
+
name = parts[1];
|
|
200
|
+
|
|
201
|
+
if (prefix) {
|
|
202
|
+
prefix = normalize(prefix, relName);
|
|
203
|
+
plugin = callDep(prefix);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//Normalize according
|
|
207
|
+
if (prefix) {
|
|
208
|
+
if (plugin && plugin.normalize) {
|
|
209
|
+
name = plugin.normalize(name, makeNormalize(relName));
|
|
210
|
+
} else {
|
|
211
|
+
name = normalize(name, relName);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
name = normalize(name, relName);
|
|
215
|
+
parts = splitPrefix(name);
|
|
216
|
+
prefix = parts[0];
|
|
217
|
+
name = parts[1];
|
|
218
|
+
if (prefix) {
|
|
219
|
+
plugin = callDep(prefix);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
//Using ridiculous property names for space reasons
|
|
224
|
+
return {
|
|
225
|
+
f: prefix ? prefix + '!' + name : name, //fullName
|
|
226
|
+
n: name,
|
|
227
|
+
pr: prefix,
|
|
228
|
+
p: plugin
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
function makeConfig(name) {
|
|
233
|
+
return function () {
|
|
234
|
+
return (config && config.config && config.config[name]) || {};
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
handlers = {
|
|
239
|
+
require: function (name) {
|
|
240
|
+
return makeRequire(name);
|
|
241
|
+
},
|
|
242
|
+
exports: function (name) {
|
|
243
|
+
var e = defined[name];
|
|
244
|
+
if (typeof e !== 'undefined') {
|
|
245
|
+
return e;
|
|
246
|
+
} else {
|
|
247
|
+
return (defined[name] = {});
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
module: function (name) {
|
|
251
|
+
return {
|
|
252
|
+
id: name,
|
|
253
|
+
uri: '',
|
|
254
|
+
exports: defined[name],
|
|
255
|
+
config: makeConfig(name)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
main = function (name, deps, callback, relName) {
|
|
261
|
+
var cjsModule, depName, ret, map, i,
|
|
262
|
+
args = [],
|
|
263
|
+
usingExports;
|
|
264
|
+
|
|
265
|
+
//Use name if no relName
|
|
266
|
+
relName = relName || name;
|
|
267
|
+
|
|
268
|
+
//Call the callback to define the module, if necessary.
|
|
269
|
+
if (typeof callback === 'function') {
|
|
270
|
+
|
|
271
|
+
//Pull out the defined dependencies and pass the ordered
|
|
272
|
+
//values to the callback.
|
|
273
|
+
//Default to [require, exports, module] if no deps
|
|
274
|
+
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
|
275
|
+
for (i = 0; i < deps.length; i += 1) {
|
|
276
|
+
map = makeMap(deps[i], relName);
|
|
277
|
+
depName = map.f;
|
|
278
|
+
|
|
279
|
+
//Fast path CommonJS standard dependencies.
|
|
280
|
+
if (depName === "require") {
|
|
281
|
+
args[i] = handlers.require(name);
|
|
282
|
+
} else if (depName === "exports") {
|
|
283
|
+
//CommonJS module spec 1.1
|
|
284
|
+
args[i] = handlers.exports(name);
|
|
285
|
+
usingExports = true;
|
|
286
|
+
} else if (depName === "module") {
|
|
287
|
+
//CommonJS module spec 1.1
|
|
288
|
+
cjsModule = args[i] = handlers.module(name);
|
|
289
|
+
} else if (hasProp(defined, depName) ||
|
|
290
|
+
hasProp(waiting, depName) ||
|
|
291
|
+
hasProp(defining, depName)) {
|
|
292
|
+
args[i] = callDep(depName);
|
|
293
|
+
} else if (map.p) {
|
|
294
|
+
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
|
295
|
+
args[i] = defined[depName];
|
|
296
|
+
} else {
|
|
297
|
+
throw new Error(name + ' missing ' + depName);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
ret = callback.apply(defined[name], args);
|
|
302
|
+
|
|
303
|
+
if (name) {
|
|
304
|
+
//If setting exports via "module" is in play,
|
|
305
|
+
//favor that over return value and exports. After that,
|
|
306
|
+
//favor a non-undefined return value over exports use.
|
|
307
|
+
if (cjsModule && cjsModule.exports !== undef &&
|
|
308
|
+
cjsModule.exports !== defined[name]) {
|
|
309
|
+
defined[name] = cjsModule.exports;
|
|
310
|
+
} else if (ret !== undef || !usingExports) {
|
|
311
|
+
//Use the return value from the function.
|
|
312
|
+
defined[name] = ret;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else if (name) {
|
|
316
|
+
//May just be an object definition for the module. Only
|
|
317
|
+
//worry about defining if have a module name.
|
|
318
|
+
defined[name] = callback;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
|
323
|
+
if (typeof deps === "string") {
|
|
324
|
+
if (handlers[deps]) {
|
|
325
|
+
//callback in this case is really relName
|
|
326
|
+
return handlers[deps](callback);
|
|
327
|
+
}
|
|
328
|
+
//Just return the module wanted. In this scenario, the
|
|
329
|
+
//deps arg is the module name, and second arg (if passed)
|
|
330
|
+
//is just the relName.
|
|
331
|
+
//Normalize module name, if it contains . or ..
|
|
332
|
+
return callDep(makeMap(deps, callback).f);
|
|
333
|
+
} else if (!deps.splice) {
|
|
334
|
+
//deps is a config object, not an array.
|
|
335
|
+
config = deps;
|
|
336
|
+
if (callback.splice) {
|
|
337
|
+
//callback is an array, which means it is a dependency list.
|
|
338
|
+
//Adjust args if there are dependencies
|
|
339
|
+
deps = callback;
|
|
340
|
+
callback = relName;
|
|
341
|
+
relName = null;
|
|
342
|
+
} else {
|
|
343
|
+
deps = undef;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
//Support require(['a'])
|
|
348
|
+
callback = callback || function () {};
|
|
349
|
+
|
|
350
|
+
//If relName is a function, it is an errback handler,
|
|
351
|
+
//so remove it.
|
|
352
|
+
if (typeof relName === 'function') {
|
|
353
|
+
relName = forceSync;
|
|
354
|
+
forceSync = alt;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
//Simulate async callback;
|
|
358
|
+
if (forceSync) {
|
|
359
|
+
main(undef, deps, callback, relName);
|
|
360
|
+
} else {
|
|
361
|
+
//Using a non-zero value because of concern for what old browsers
|
|
362
|
+
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
|
363
|
+
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
|
364
|
+
//If want a value immediately, use require('id') instead -- something
|
|
365
|
+
//that works in almond on the global level, but not guaranteed and
|
|
366
|
+
//unlikely to work in other AMD implementations.
|
|
367
|
+
setTimeout(function () {
|
|
368
|
+
main(undef, deps, callback, relName);
|
|
369
|
+
}, 4);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return req;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Just drops the config on the floor, but returns req in case
|
|
377
|
+
* the config return value is used.
|
|
378
|
+
*/
|
|
379
|
+
req.config = function (cfg) {
|
|
380
|
+
config = cfg;
|
|
381
|
+
if (config.deps) {
|
|
382
|
+
req(config.deps, config.callback);
|
|
383
|
+
}
|
|
384
|
+
return req;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Expose module registry for debugging and tooling
|
|
389
|
+
*/
|
|
390
|
+
requirejs._defined = defined;
|
|
391
|
+
|
|
392
|
+
define = function (name, deps, callback) {
|
|
393
|
+
|
|
394
|
+
//This module may not have dependencies
|
|
395
|
+
if (!deps.splice) {
|
|
396
|
+
//deps is not an array, so probably means
|
|
397
|
+
//an object literal or factory function for
|
|
398
|
+
//the value. Adjust args.
|
|
399
|
+
callback = deps;
|
|
400
|
+
deps = [];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
|
404
|
+
waiting[name] = [name, deps, callback];
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
define.amd = {
|
|
409
|
+
jQuery: true
|
|
410
|
+
};
|
|
411
|
+
}());
|
|
412
|
+
|
|
413
|
+
define("vendor/almond", function(){});
|
|
414
|
+
|
|
415
|
+
define('emmet/emmet', function() {
|
|
416
|
+
return emmet;
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
define('emmet/utils/common', function() {
|
|
420
|
+
return emmet.require('utils/common');
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
define('emmet/utils/action', function() {
|
|
424
|
+
return emmet.require('utils/action');
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
define('emmet/assets/resources', function() {
|
|
428
|
+
return emmet.require('assets/resources');
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
define('emmet/assets/tabStops', function() {
|
|
432
|
+
return emmet.require('assets/tabStops');
|
|
433
|
+
});
|
|
434
|
+
define("shim", function(){});
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Emmet Editor interface implementation for CodeMirror.
|
|
438
|
+
* Interface is optimized for multiple cursor usage: authors
|
|
439
|
+
* should run acttion multiple times and update `selectionIndex`
|
|
440
|
+
* property on each iteration.
|
|
441
|
+
*/
|
|
442
|
+
define('editor',['emmet/utils/common', 'emmet/utils/action', 'emmet/assets/resources', 'emmet/assets/tabStops'], function(utils, actionUtils, res, tabStops) {
|
|
443
|
+
/**
|
|
444
|
+
* Converts CM’s inner representation of character
|
|
445
|
+
* position (line, ch) to character index in text
|
|
446
|
+
* @param {CodeMirror} cm CodeMirror instance
|
|
447
|
+
* @param {Object} pos Position object
|
|
448
|
+
* @return {Number}
|
|
449
|
+
*/
|
|
450
|
+
function posToIndex(cm, pos) {
|
|
451
|
+
if (arguments.length > 2 && typeof pos !== 'object') {
|
|
452
|
+
pos = {line: arguments[1], ch: arguments[2]}
|
|
453
|
+
}
|
|
454
|
+
return cm.indexFromPos(pos);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Converts charater index in text to CM’s internal object representation
|
|
459
|
+
* @param {CodeMirror} cm CodeMirror instance
|
|
460
|
+
* @param {Number} ix Character index in CM document
|
|
461
|
+
* @return {Object}
|
|
462
|
+
*/
|
|
463
|
+
function indexToPos(cm, ix) {
|
|
464
|
+
return cm.posFromIndex(ix);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return {
|
|
468
|
+
context: null,
|
|
469
|
+
selectionIndex: 0,
|
|
470
|
+
modeMap: {
|
|
471
|
+
'text/html': 'html',
|
|
472
|
+
'application/xml': 'xml',
|
|
473
|
+
'text/xsl': 'xsl',
|
|
474
|
+
'text/css': 'css',
|
|
475
|
+
'text/x-less': 'less',
|
|
476
|
+
'text/x-scss': 'scss',
|
|
477
|
+
'text/x-sass': 'sass'
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
setupContext: function(ctx, selIndex) {
|
|
481
|
+
this.context = ctx;
|
|
482
|
+
this.selectionIndex = selIndex || 0;
|
|
483
|
+
var indentation = '\t';
|
|
484
|
+
if (!ctx.getOption('indentWithTabs')) {
|
|
485
|
+
indentation = utils.repeatString(' ', ctx.getOption('indentUnit'));
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
res.setVariable('indentation', indentation);
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Returns list of selections for current CodeMirror instance.
|
|
493
|
+
* @return {Array}
|
|
494
|
+
*/
|
|
495
|
+
selectionList: function() {
|
|
496
|
+
var cm = this.context;
|
|
497
|
+
return cm.listSelections().map(function(sel) {
|
|
498
|
+
var anchor = posToIndex(cm, sel.anchor);
|
|
499
|
+
var head = posToIndex(cm, sel.head);
|
|
500
|
+
|
|
501
|
+
return {
|
|
502
|
+
start: Math.min(anchor, head),
|
|
503
|
+
end: Math.max(anchor, head)
|
|
504
|
+
};
|
|
505
|
+
});
|
|
506
|
+
},
|
|
507
|
+
|
|
508
|
+
getCaretPos: function() {
|
|
509
|
+
return this.getSelectionRange().start;
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
setCaretPos: function(pos) {
|
|
513
|
+
this.createSelection(pos);
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Returns current selection range (for current selection index)
|
|
518
|
+
* @return {Object}
|
|
519
|
+
*/
|
|
520
|
+
getSelectionRange: function() {
|
|
521
|
+
return this.selectionList()[this.selectionIndex];
|
|
522
|
+
},
|
|
523
|
+
|
|
524
|
+
createSelection: function(start, end) {
|
|
525
|
+
if (typeof end == 'undefined') {
|
|
526
|
+
end = start;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var sels = this.selectionList();
|
|
530
|
+
var cm = this.context;
|
|
531
|
+
sels[this.selectionIndex] = {start: start, end: end};
|
|
532
|
+
this.context.setSelections(sels.map(function(sel) {
|
|
533
|
+
return {
|
|
534
|
+
head: indexToPos(cm, sel.start),
|
|
535
|
+
anchor: indexToPos(cm, sel.end)
|
|
536
|
+
};
|
|
537
|
+
}));
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Returns current selection
|
|
542
|
+
* @return {String}
|
|
543
|
+
*/
|
|
544
|
+
getSelection: function() {
|
|
545
|
+
var sel = this.getSelectionRange();
|
|
546
|
+
sel.start = indexToPos(this.context, sel.start);
|
|
547
|
+
sel.end = indexToPos(this.context, sel.end);
|
|
548
|
+
return this.context.getRange(sel.start, sel.end);
|
|
549
|
+
},
|
|
550
|
+
|
|
551
|
+
getCurrentLineRange: function() {
|
|
552
|
+
var caret = indexToPos(this.context, this.getCaretPos());
|
|
553
|
+
return {
|
|
554
|
+
start: posToIndex(this.context, caret.line, 0),
|
|
555
|
+
end: posToIndex(this.context, caret.line, this.context.getLine(caret.line).length)
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
getCurrentLine: function() {
|
|
560
|
+
var caret = indexToPos(this.context, this.getCaretPos());
|
|
561
|
+
return this.context.getLine(caret.line) || '';
|
|
562
|
+
},
|
|
563
|
+
|
|
564
|
+
replaceContent: function(value, start, end, noIndent) {
|
|
565
|
+
if (typeof end == 'undefined') {
|
|
566
|
+
end = (typeof start == 'undefined') ? this.getContent().length : start;
|
|
567
|
+
}
|
|
568
|
+
if (typeof start == 'undefined') {
|
|
569
|
+
start = 0;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// indent new value
|
|
573
|
+
if (!noIndent) {
|
|
574
|
+
value = utils.padString(value, utils.getLinePaddingFromPosition(this.getContent(), start));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// find new caret position
|
|
578
|
+
var tabstopData = tabStops.extract(value, {
|
|
579
|
+
escape: function(ch) {
|
|
580
|
+
return ch;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
value = tabstopData.text;
|
|
584
|
+
|
|
585
|
+
var firstTabStop = tabstopData.tabstops[0] || {start: value.length, end: value.length};
|
|
586
|
+
firstTabStop.start += start;
|
|
587
|
+
firstTabStop.end += start;
|
|
588
|
+
|
|
589
|
+
this.context.replaceRange(value, indexToPos(this.context, start), indexToPos(this.context, end));
|
|
590
|
+
this.createSelection(firstTabStop.start, firstTabStop.end);
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
getContent: function() {
|
|
594
|
+
return this.context.getValue();
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
getSyntax: function() {
|
|
598
|
+
var syntax = this.context.getOption('mode');
|
|
599
|
+
return this.modeMap[syntax] || actionUtils.detectSyntax(this, syntax);
|
|
600
|
+
},
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Returns current output profile name (@see emmet#setupProfile)
|
|
604
|
+
* @return {String}
|
|
605
|
+
*/
|
|
606
|
+
getProfileName: function() {
|
|
607
|
+
if (this.context.getOption('profile')) {
|
|
608
|
+
return this.context.getOption('profile');
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
return actionUtils.detectProfile(this);
|
|
612
|
+
},
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Ask user to enter something
|
|
616
|
+
* @param {String} title Dialog title
|
|
617
|
+
* @return {String} Entered data
|
|
618
|
+
*/
|
|
619
|
+
prompt: function(title) {
|
|
620
|
+
return prompt(title);
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Returns current editor's file path
|
|
625
|
+
* @return {String}
|
|
626
|
+
*/
|
|
627
|
+
getFilePath: function() {
|
|
628
|
+
return location.href;
|
|
629
|
+
},
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Check if current editor syntax is valid, e.g. is supported by Emmet
|
|
633
|
+
* @return {Boolean}
|
|
634
|
+
*/
|
|
635
|
+
isValidSyntax: function() {
|
|
636
|
+
return res.hasSyntax(this.getSyntax());
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
});
|
|
640
|
+
/**
|
|
641
|
+
* Emmet plugin for CodeMirror
|
|
642
|
+
*/
|
|
643
|
+
define('plugin',['./editor', 'emmet/emmet'], function(editor, emmet) {
|
|
644
|
+
var mac = /Mac/.test(navigator.platform);
|
|
645
|
+
var defaultKeymap = {
|
|
646
|
+
'Cmd-E': 'expand_abbreviation',
|
|
647
|
+
'Tab': 'expand_abbreviation_with_tab',
|
|
648
|
+
'Cmd-D': 'balance_outward',
|
|
649
|
+
'Shift-Cmd-D': 'balance_inward',
|
|
650
|
+
'Cmd-M': 'matching_pair',
|
|
651
|
+
'Shift-Cmd-A': 'wrap_with_abbreviation',
|
|
652
|
+
'Ctrl-Alt-Right': 'next_edit_point',
|
|
653
|
+
'Ctrl-Alt-Left': 'prev_edit_point',
|
|
654
|
+
'Cmd-L': 'select_line',
|
|
655
|
+
'Cmd-Shift-M': 'merge_lines',
|
|
656
|
+
'Cmd-/': 'toggle_comment',
|
|
657
|
+
'Cmd-J': 'split_join_tag',
|
|
658
|
+
'Cmd-K': 'remove_tag',
|
|
659
|
+
'Shift-Cmd-Y': 'evaluate_math_expression',
|
|
660
|
+
|
|
661
|
+
'Ctrl-Up': 'increment_number_by_1',
|
|
662
|
+
'Ctrl-Down': 'decrement_number_by_1',
|
|
663
|
+
'Ctrl-Alt-Up': 'increment_number_by_01',
|
|
664
|
+
'Ctrl-Alt-Down': 'decrement_number_by_01',
|
|
665
|
+
'Shift-Ctrl-Up': 'increment_number_by_10',
|
|
666
|
+
'Shift-Ctrl-Down': 'decrement_number_by_10',
|
|
667
|
+
|
|
668
|
+
'Shift-Cmd-.': 'select_next_item',
|
|
669
|
+
'Shift-Cmd-,': 'select_previous_item',
|
|
670
|
+
'Cmd-B': 'reflect_css_value',
|
|
671
|
+
|
|
672
|
+
'Enter': 'insert_formatted_line_break_only'
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// actions that should be performed in single selection mode
|
|
676
|
+
var singleSelectionActions = [
|
|
677
|
+
'prev_edit_point', 'next_edit_point', 'merge_lines',
|
|
678
|
+
'reflect_css_value', 'select_next_item', 'select_previous_item',
|
|
679
|
+
'wrap_with_abbreviation', 'update_tag', 'insert_formatted_line_break_only'
|
|
680
|
+
];
|
|
681
|
+
|
|
682
|
+
// add “profile” property to CodeMirror defaults so in won’t be lost
|
|
683
|
+
// then CM instance is instantiated with “profile” property
|
|
684
|
+
if (CodeMirror.defineOption) {
|
|
685
|
+
CodeMirror.defineOption('profile', 'html');
|
|
686
|
+
} else {
|
|
687
|
+
CodeMirror.defaults.profile = 'html';
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function noop() {
|
|
691
|
+
if (CodeMirror.version >= '3.1') {
|
|
692
|
+
return CodeMirror.Pass;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
throw CodeMirror.Pass;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Emmet action decorator: creates a command function
|
|
700
|
+
* for CodeMirror and executes Emmet action as single
|
|
701
|
+
* undo command
|
|
702
|
+
* @param {String} name Action name
|
|
703
|
+
* @return {Function}
|
|
704
|
+
*/
|
|
705
|
+
function actionDecorator(name) {
|
|
706
|
+
return function(cm) {
|
|
707
|
+
editor.setupContext(cm);
|
|
708
|
+
var result;
|
|
709
|
+
cm.operation(function() {
|
|
710
|
+
result = runAction(name, cm);
|
|
711
|
+
});
|
|
712
|
+
return result;
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Same as `actionDecorator()` but executes action
|
|
718
|
+
* with multiple selections
|
|
719
|
+
* @param {String} name Action name
|
|
720
|
+
* @return {Function}
|
|
721
|
+
*/
|
|
722
|
+
function multiSelectionActionDecorator(name) {
|
|
723
|
+
return function(cm) {
|
|
724
|
+
editor.setupContext(cm);
|
|
725
|
+
var selections = editor.selectionList();
|
|
726
|
+
var result = null;
|
|
727
|
+
cm.operation(function() {
|
|
728
|
+
for (var i = 0, il = selections.length; i < il; i++) {
|
|
729
|
+
editor.selectionIndex = i;
|
|
730
|
+
result = runAction(name, cm);
|
|
731
|
+
if (result === CodeMirror.Pass) {
|
|
732
|
+
break;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
return result;
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Runs Emmet action
|
|
742
|
+
* @param {String} name Action name
|
|
743
|
+
* @param {CodeMirror} cm CodeMirror instance
|
|
744
|
+
* @return {Boolean} Returns `true` if action is performed
|
|
745
|
+
* successfully
|
|
746
|
+
*/
|
|
747
|
+
function runAction(name, cm) {
|
|
748
|
+
if (name == 'expand_abbreviation_with_tab' && (cm.somethingSelected() || !editor.isValidSyntax())) {
|
|
749
|
+
// pass through Tab key handler if there's a selection
|
|
750
|
+
return noop();
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
var result = false;
|
|
754
|
+
try {
|
|
755
|
+
result = emmet.run(name, editor);
|
|
756
|
+
if (!result && name == 'insert_formatted_line_break_only') {
|
|
757
|
+
return noop();
|
|
758
|
+
}
|
|
759
|
+
} catch (e) {}
|
|
760
|
+
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function systemKeybinding(key) {
|
|
765
|
+
return !mac ? key.replace('Cmd', 'Ctrl') : key;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Adds given `key` as keybinding for Emmet `action`
|
|
770
|
+
* @param {String} key Keyboard shortcut
|
|
771
|
+
* @param {String} action Emmet action name
|
|
772
|
+
*/
|
|
773
|
+
function addKeybinding(key, action) {
|
|
774
|
+
key = systemKeybinding(key);
|
|
775
|
+
CodeMirror.keyMap['default'][key] = 'emmet.' + action;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// add actions and default keybindings
|
|
779
|
+
Object.keys(defaultKeymap).forEach(function(key) {
|
|
780
|
+
var action = defaultKeymap[key];
|
|
781
|
+
var cmCommand = 'emmet.' + action;
|
|
782
|
+
if (!CodeMirror.commands[cmCommand]) {
|
|
783
|
+
CodeMirror.commands[cmCommand] = ~singleSelectionActions.indexOf(action)
|
|
784
|
+
? actionDecorator(action)
|
|
785
|
+
: multiSelectionActionDecorator(action);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
addKeybinding(key, action);
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
return {
|
|
792
|
+
emmet: emmet,
|
|
793
|
+
editor: editor,
|
|
794
|
+
/**
|
|
795
|
+
* Adds new keybindings for Emmet action. The expected format
|
|
796
|
+
* of `keymap` object is the same as default `keymap`.
|
|
797
|
+
* @param {Object} keymap
|
|
798
|
+
*/
|
|
799
|
+
setKeymap: function(keymap) {
|
|
800
|
+
Object.keys(keymap).forEach(function(key) {
|
|
801
|
+
addKeybinding(key, keymap[key]);
|
|
802
|
+
});
|
|
803
|
+
},
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Clears all Emmet keybindings
|
|
807
|
+
*/
|
|
808
|
+
clearKeymap: function() {
|
|
809
|
+
var cmMap = CodeMirror.keyMap['default'];
|
|
810
|
+
var reEmmetAction = /^emmet\./;
|
|
811
|
+
Object.keys(cmMap).forEach(function(p) {
|
|
812
|
+
if (reEmmetAction.test(cmMap[p])) {
|
|
813
|
+
delete cmMap[p];
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
},
|
|
817
|
+
|
|
818
|
+
addKeybinding: addKeybinding,
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Removes given keybinding or any keybinging bound to
|
|
822
|
+
* given action name
|
|
823
|
+
* @param {String} name Either keybinding or Emmet action name
|
|
824
|
+
*/
|
|
825
|
+
removeKeybinding: function(name) {
|
|
826
|
+
name = systemKeybinding(name);
|
|
827
|
+
var cmMap = CodeMirror.keyMap['default'];
|
|
828
|
+
if (name in cmMap) {
|
|
829
|
+
delete cmMap[name];
|
|
830
|
+
} else {
|
|
831
|
+
name = 'emmet.' + name;
|
|
832
|
+
Object.keys(cmMap).forEach(function(p) {
|
|
833
|
+
if (cmMap[p] === name) {
|
|
834
|
+
delete cmMap[p];
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
};
|
|
840
|
+
});;return require('plugin');}));
|