├── .gitattributes
├── .gitignore
├── README.md
├── css
├── App.css
├── img
│ ├── ajax-loader.gif
│ ├── arrow.png
│ ├── file.gif
│ ├── folder-closed.gif
│ ├── folder.gif
│ ├── form.png
│ ├── glyphicons-halflings-white.png
│ ├── glyphicons-halflings.png
│ ├── icons
│ │ ├── Accordion.png
│ │ ├── AreaChart.png
│ │ ├── BarChart.png
│ │ ├── BubbleChart.png
│ │ ├── Button.png
│ │ ├── ButtonBar.png
│ │ ├── Canvas.png
│ │ ├── CheckBox.png
│ │ ├── ColorPicker.png
│ │ ├── ColumnChart.png
│ │ ├── ComboBox.png
│ │ ├── DataGrid.png
│ │ ├── DataGroup.png
│ │ ├── DateChooser.png
│ │ ├── DateField.png
│ │ ├── DividedBox.png
│ │ ├── DropDownList.png
│ │ ├── Form.png
│ │ ├── Group.png
│ │ ├── HBox.png
│ │ ├── HGroup.png
│ │ ├── HScrollBar.png
│ │ ├── HSlider.png
│ │ ├── Image.png
│ │ ├── Label.png
│ │ ├── LineChart.png
│ │ ├── LinkBar.png
│ │ ├── LinkButton.png
│ │ ├── List.png
│ │ ├── MenuBar.png
│ │ ├── NumericStepper.png
│ │ ├── Panel.png
│ │ ├── PieChart.png
│ │ ├── ProgressBar.png
│ │ ├── RadioButton.png
│ │ ├── RadioButtonGroup.png
│ │ ├── RichEditableText.png
│ │ ├── Spacer.png
│ │ ├── TabBar.png
│ │ ├── TextArea.png
│ │ ├── TextInput.png
│ │ ├── TitleWindow.png
│ │ ├── VBox.png
│ │ ├── VDividedBox.png
│ │ ├── VGroup.png
│ │ ├── VideoDisplay.png
│ │ └── VideoPlayer.png
│ ├── minus.gif
│ ├── plus.gif
│ ├── treeview-black-line.gif
│ ├── treeview-black.gif
│ ├── treeview-default-line.gif
│ ├── treeview-default.gif
│ ├── treeview-famfamfam-line.gif
│ ├── treeview-famfamfam.gif
│ ├── treeview-gray-line.gif
│ ├── treeview-gray.gif
│ ├── treeview-red-line.gif
│ └── treeview-red.gif
├── libs
│ ├── bootstrap.css
│ ├── bootstrapSwitch.css
│ ├── codemirror.css
│ ├── fuelux.css
│ ├── jquery.freetrans.css
│ ├── jquery.treeview.css
│ └── normalize.css
└── providers
│ └── flex.css
├── favicon.ico
├── index.html
├── js
├── App.js
├── App.min.js
├── libs
│ ├── Matrix.js
│ ├── addon
│ │ ├── comment
│ │ │ └── comment.js
│ │ ├── dialog
│ │ │ ├── dialog.css
│ │ │ └── dialog.js
│ │ ├── display
│ │ │ └── placeholder.js
│ │ ├── edit
│ │ │ ├── closebrackets.js
│ │ │ ├── closetag.js
│ │ │ ├── continuecomment.js
│ │ │ ├── continuelist.js
│ │ │ └── matchbrackets.js
│ │ ├── fold
│ │ │ ├── brace-fold.js
│ │ │ ├── foldcode.js
│ │ │ ├── indent-fold.js
│ │ │ └── xml-fold.js
│ │ ├── hint
│ │ │ ├── html-hint.js
│ │ │ ├── javascript-hint.js
│ │ │ ├── mxml-hint.js
│ │ │ ├── pig-hint.js
│ │ │ ├── python-hint.js
│ │ │ ├── show-hint.css
│ │ │ ├── show-hint.js
│ │ │ └── xml-hint.js
│ │ ├── lint
│ │ │ ├── javascript-lint.js
│ │ │ ├── json-lint.js
│ │ │ ├── lint.css
│ │ │ └── lint.js
│ │ ├── mode
│ │ │ ├── loadmode.js
│ │ │ ├── multiplex.js
│ │ │ └── overlay.js
│ │ ├── runmode
│ │ │ ├── colorize.js
│ │ │ ├── runmode-standalone.js
│ │ │ ├── runmode.js
│ │ │ └── runmode.node.js
│ │ ├── search
│ │ │ ├── match-highlighter.js
│ │ │ ├── search.js
│ │ │ └── searchcursor.js
│ │ └── selection
│ │ │ ├── active-line.js
│ │ │ └── mark-selection.js
│ ├── bootstrap.min.js
│ ├── bootstrapSwitch.js
│ ├── codemirror.js
│ ├── fuelux.js
│ ├── jquery-ui.js
│ ├── jquery.freetrans.js
│ ├── jquery.js
│ ├── jquery.treeview.js
│ ├── mode
│ │ ├── css
│ │ │ ├── css.js
│ │ │ ├── index.html
│ │ │ ├── scss.html
│ │ │ ├── scss_test.js
│ │ │ └── test.js
│ │ ├── haxe
│ │ │ ├── haxe.js
│ │ │ └── index.html
│ │ ├── htmlembedded
│ │ │ ├── htmlembedded.js
│ │ │ └── index.html
│ │ ├── htmlmixed
│ │ │ ├── htmlmixed.js
│ │ │ └── index.html
│ │ ├── http
│ │ │ ├── http.js
│ │ │ └── index.html
│ │ ├── javascript
│ │ │ ├── index.html
│ │ │ ├── javascript.js
│ │ │ └── typescript.html
│ │ ├── meta.js
│ │ ├── xml
│ │ │ ├── index.html
│ │ │ └── xml.js
│ │ ├── xquery
│ │ │ ├── LICENSE
│ │ │ ├── index.html
│ │ │ ├── test.js
│ │ │ └── xquery.js
│ │ └── yaml
│ │ │ ├── index.html
│ │ │ └── yaml.js
│ ├── theme
│ │ ├── ambiance-mobile.css
│ │ ├── ambiance.css
│ │ ├── blackboard.css
│ │ ├── cobalt.css
│ │ ├── eclipse.css
│ │ ├── elegant.css
│ │ ├── erlang-dark.css
│ │ ├── lesser-dark.css
│ │ ├── midnight.css
│ │ ├── monokai.css
│ │ ├── neat.css
│ │ ├── night.css
│ │ ├── rubyblue.css
│ │ ├── solarized.css
│ │ ├── twilight.css
│ │ ├── vibrant-ink.css
│ │ ├── xq-dark.css
│ │ └── xq-light.css
│ └── underscore-min.js
├── providers
│ └── flex-ui.js
└── ui
│ ├── flexui.html
│ └── properties.html
└── temp
├── TES
└── first-shot.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 | [Dd]ebug/
46 | [Rr]elease/
47 | *_i.c
48 | *_p.c
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.vspscc
63 | .builds
64 | *.dotCover
65 |
66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
67 | #packages/
68 |
69 | # Visual C++ cache files
70 | ipch/
71 | *.aps
72 | *.ncb
73 | *.opensdf
74 | *.sdf
75 |
76 | # Visual Studio profiler
77 | *.psess
78 | *.vsp
79 |
80 | # ReSharper is a .NET coding add-in
81 | _ReSharper*
82 |
83 | # Installshield output folder
84 | [Ee]xpress
85 |
86 | # DocProject is a documentation generator add-in
87 | DocProject/buildhelp/
88 | DocProject/Help/*.HxT
89 | DocProject/Help/*.HxC
90 | DocProject/Help/*.hhc
91 | DocProject/Help/*.hhk
92 | DocProject/Help/*.hhp
93 | DocProject/Help/Html2
94 | DocProject/Help/html
95 |
96 | # Click-Once directory
97 | publish
98 |
99 | # Others
100 | [Bb]in
101 | [Oo]bj
102 | sql
103 | TestResults
104 | *.Cache
105 | ClientBin
106 | stylecop.*
107 | ~$*
108 | *.dbmdl
109 | Generated_Code #added for RIA/Silverlight projects
110 |
111 | # Backup & report files from converting an old project file to a newer
112 | # Visual Studio version. Backup files are not needed, because we have git ;-)
113 | _UpgradeReport_Files/
114 | Backup*/
115 | UpgradeLog*.XML
116 |
117 |
118 |
119 | ############
120 | ## Windows
121 | ############
122 |
123 | # Windows image file caches
124 | Thumbs.db
125 |
126 | # Folder config file
127 | Desktop.ini
128 |
129 |
130 | #############
131 | ## Python
132 | #############
133 |
134 | *.py[co]
135 |
136 | # Packages
137 | *.egg
138 | *.egg-info
139 | dist
140 | build
141 | eggs
142 | parts
143 | bin
144 | var
145 | sdist
146 | develop-eggs
147 | .installed.cfg
148 |
149 | # Installer logs
150 | pip-log.txt
151 |
152 | # Unit test / coverage reports
153 | .coverage
154 | .tox
155 |
156 | #Translations
157 | *.mo
158 |
159 | #Mr Developer
160 | .mr.developer.cfg
161 |
162 | # Mac crap
163 | .DS_Store
164 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Apache Flex UI Builder
2 |
3 | #### Creating Flex UI with drag and drop, easy like in Flash Builder
4 |
5 | 
6 |
7 |
8 | Apache Flex UI Builder helps you to drag and drop components and also with the power of CodeMirror you
9 | can write your MXML directly in the browser, with auto complete with limited available
10 | Inspect properties, scale, change on the fly and generates mxml on every movement.
11 |
12 | After generating mxml, you can copy and paste directly on your IDE and be more productive.
13 |
14 | Since Flash Builder 4.7 doesn't support Design Mode, this project could help fullfill the gap left
15 | to Flex developers out there.
16 |
17 | ---
18 | # About Apache Flex
19 |
20 | Apache Flex is a open-source UI SDK that creates compeling and beautiful interfaces for Flash Player platform.
21 | Using state of art technology and used by Fortune's TOP 500 companies, Flex is the ultimate goal UI technology
22 | knwon today, creating not only UI but you can produce native Apps, Desktop Apps and Web Apps coding with MXML and
23 | actionscript.
24 |
25 | To know more about the project visit our [official website](http://flex.apache.org)
26 | ---
27 | Components that are capable of drag and drop in current release
28 |
29 | | Components |
30 | |---------------|
31 | | Panel |
32 | | ColorPicker |
33 | | DataGrid |
34 | | ComboBox |
35 | | Application |
36 | | NumericStepper|
37 | | Label |
38 | | TextArea |
39 | | TextInput |
40 | | Image |
41 |
42 | ---
43 | ## Questions
44 |
45 | ### What's main goal?
46 | Help Apache Flex developers keep up productivity specially the newbie developers arriving in the technology.
47 |
48 | ### Why not built with Flex?
49 | I tought on that in first place, but I wanted something more flexible that could build entirely on open technology
50 | and could run over mobile devices specially iOS devices, and some mockups could be build easly over touch devices
51 | runing directly into browser.
52 | It's hard to generate and transcode DOM elements into MXML, specially for child of N childs. Still pending on that.
53 |
54 | ### Does you have plan to keep updating project?
55 | Sure, but I've posted on github in hope of some help of your qualities that could plus the project forward.
56 |
57 | ## Releases
58 |
59 | 1.0 - Initial Commit to the entire flex community
60 |
61 | ## known issues
62 |
63 | .Draging a component into design area causes a position to 0x0 for first time
64 | .Scaling using drag controlers and selecting a component causes component to flick and jump.
65 | .Childs drags doesn't work on first release.
66 | .Reflection from source code to Design doesn't work, just design-> code generation.
67 |
68 |
69 | ## I want to Help!
70 |
71 | Please feel totally free to fork, clone and send yours pull requests here.
72 | I must be very thankfull for yours kind contributions.
73 |
74 | ## Author
75 |
76 | [Igor Costa](http://www.igorcosta.com)
77 | ##### Contact
78 |
79 | Find me at Twitter [@igorcosta](http://www.twitter.com/igorcosta)
80 |
--------------------------------------------------------------------------------
/css/App.css:
--------------------------------------------------------------------------------
1 | .dragg:hover{
2 | cursor: move;
3 | }
4 | .dragg {
5 | z-index: 9999;
6 | }
7 | .sidetab {
8 | padding-left: 10px;
9 | color:#000;
10 | position: relative;
11 | }
12 | #design{
13 |
14 | position:relative;
15 | background:#f8f8f8;
16 | overflow: auto;
17 | }
18 | .foreground{
19 | }
20 | #properties{
21 | display: block;
22 | position: absolute;
23 | width: 300px;
24 | height: 200px;
25 | background: white;
26 | z-index: 999999;
27 | top:30%;
28 | left:80%;
29 | box-shadow:0 1px 3px rgba(0,0,0,.4);
30 | border:1px solid #ccc;
31 | border-radius:3px;
32 | overflow: hidden;
33 | }
34 | #properties .row{
35 | margin-left:0px;
36 | padding-left: 10px;
37 | }
38 | #properties .form-horizontal{
39 | margin-top: 20px;
40 |
41 | }
42 | #properties .form-horizontal .control-label {
43 | float: left;
44 | width: 60px;
45 | padding-top: 5px;
46 | text-align: right;
47 | }
48 | #properties .form-horizontal .controls {
49 | margin-left: 80px;
50 | }
51 | #properties .prop_title{
52 | margin:0 0;
53 | padding:0 0;
54 | font-size: 14px;
55 | font-weight: 200;
56 | padding: 10px 0px 0px 15px;
57 | color:#fff;
58 | height: 30px;
59 | text-shadow:0 1px 0 rgba(0,0,0,.4);
60 | background-color: #1b1b1b;
61 | background-image: -moz-linear-gradient(top, #222222, #111111);
62 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#222222), to(#111111));
63 | background-image: -webkit-linear-gradient(top, #222222, #111111);
64 | background-image: -o-linear-gradient(top, #222222, #111111);
65 | background-image: linear-gradient(to bottom, #222222, #111111);
66 | background-repeat: repeat-x;
67 | border-color: #252525;
68 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff111111', GradientType=0);
69 | position:relative;
70 | }
71 | .scroller {
72 | overflow: scroll;
73 | width:auto;
74 | height: 400px;
75 | }
76 |
77 | .scroller::-webkit-scrollbar {
78 | width: 5px;
79 | height: 5px;
80 | }
81 | .scroller::-webkit-scrollbar-track {
82 | background-color: rgba(113,112,107,0.1);
83 | -webkit-border-radius: 5px;
84 | }
85 | .scroller::-webkit-scrollbar-thumb:vertical {
86 | background-color: rgba(0,0,0,.2);
87 | -webkit-border-radius: 6px;
88 | }
89 | .scroller::-webkit-scrollbar-thumb:vertical:hover,
90 | .scroller::-webkit-scrollbar-thumb:horizontal:hover {
91 | background: red;
92 | }
93 | .scroller::-webkit-scrollbar-thumb:horizontal {
94 | background-color: rgba(0,0,0,.2);
95 | -webkit-border-radius: 6px;
96 | }
--------------------------------------------------------------------------------
/css/img/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/ajax-loader.gif
--------------------------------------------------------------------------------
/css/img/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/arrow.png
--------------------------------------------------------------------------------
/css/img/file.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/file.gif
--------------------------------------------------------------------------------
/css/img/folder-closed.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/folder-closed.gif
--------------------------------------------------------------------------------
/css/img/folder.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/folder.gif
--------------------------------------------------------------------------------
/css/img/form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/form.png
--------------------------------------------------------------------------------
/css/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/css/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/css/img/icons/Accordion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Accordion.png
--------------------------------------------------------------------------------
/css/img/icons/AreaChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/AreaChart.png
--------------------------------------------------------------------------------
/css/img/icons/BarChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/BarChart.png
--------------------------------------------------------------------------------
/css/img/icons/BubbleChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/BubbleChart.png
--------------------------------------------------------------------------------
/css/img/icons/Button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Button.png
--------------------------------------------------------------------------------
/css/img/icons/ButtonBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/ButtonBar.png
--------------------------------------------------------------------------------
/css/img/icons/Canvas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Canvas.png
--------------------------------------------------------------------------------
/css/img/icons/CheckBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/CheckBox.png
--------------------------------------------------------------------------------
/css/img/icons/ColorPicker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/ColorPicker.png
--------------------------------------------------------------------------------
/css/img/icons/ColumnChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/ColumnChart.png
--------------------------------------------------------------------------------
/css/img/icons/ComboBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/ComboBox.png
--------------------------------------------------------------------------------
/css/img/icons/DataGrid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DataGrid.png
--------------------------------------------------------------------------------
/css/img/icons/DataGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DataGroup.png
--------------------------------------------------------------------------------
/css/img/icons/DateChooser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DateChooser.png
--------------------------------------------------------------------------------
/css/img/icons/DateField.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DateField.png
--------------------------------------------------------------------------------
/css/img/icons/DividedBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DividedBox.png
--------------------------------------------------------------------------------
/css/img/icons/DropDownList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/DropDownList.png
--------------------------------------------------------------------------------
/css/img/icons/Form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Form.png
--------------------------------------------------------------------------------
/css/img/icons/Group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Group.png
--------------------------------------------------------------------------------
/css/img/icons/HBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/HBox.png
--------------------------------------------------------------------------------
/css/img/icons/HGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/HGroup.png
--------------------------------------------------------------------------------
/css/img/icons/HScrollBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/HScrollBar.png
--------------------------------------------------------------------------------
/css/img/icons/HSlider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/HSlider.png
--------------------------------------------------------------------------------
/css/img/icons/Image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Image.png
--------------------------------------------------------------------------------
/css/img/icons/Label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Label.png
--------------------------------------------------------------------------------
/css/img/icons/LineChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/LineChart.png
--------------------------------------------------------------------------------
/css/img/icons/LinkBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/LinkBar.png
--------------------------------------------------------------------------------
/css/img/icons/LinkButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/LinkButton.png
--------------------------------------------------------------------------------
/css/img/icons/List.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/List.png
--------------------------------------------------------------------------------
/css/img/icons/MenuBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/MenuBar.png
--------------------------------------------------------------------------------
/css/img/icons/NumericStepper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/NumericStepper.png
--------------------------------------------------------------------------------
/css/img/icons/Panel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Panel.png
--------------------------------------------------------------------------------
/css/img/icons/PieChart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/PieChart.png
--------------------------------------------------------------------------------
/css/img/icons/ProgressBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/ProgressBar.png
--------------------------------------------------------------------------------
/css/img/icons/RadioButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/RadioButton.png
--------------------------------------------------------------------------------
/css/img/icons/RadioButtonGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/RadioButtonGroup.png
--------------------------------------------------------------------------------
/css/img/icons/RichEditableText.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/RichEditableText.png
--------------------------------------------------------------------------------
/css/img/icons/Spacer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/Spacer.png
--------------------------------------------------------------------------------
/css/img/icons/TabBar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/TabBar.png
--------------------------------------------------------------------------------
/css/img/icons/TextArea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/TextArea.png
--------------------------------------------------------------------------------
/css/img/icons/TextInput.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/TextInput.png
--------------------------------------------------------------------------------
/css/img/icons/TitleWindow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/TitleWindow.png
--------------------------------------------------------------------------------
/css/img/icons/VBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/VBox.png
--------------------------------------------------------------------------------
/css/img/icons/VDividedBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/VDividedBox.png
--------------------------------------------------------------------------------
/css/img/icons/VGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/VGroup.png
--------------------------------------------------------------------------------
/css/img/icons/VideoDisplay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/VideoDisplay.png
--------------------------------------------------------------------------------
/css/img/icons/VideoPlayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/icons/VideoPlayer.png
--------------------------------------------------------------------------------
/css/img/minus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/minus.gif
--------------------------------------------------------------------------------
/css/img/plus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/plus.gif
--------------------------------------------------------------------------------
/css/img/treeview-black-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-black-line.gif
--------------------------------------------------------------------------------
/css/img/treeview-black.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-black.gif
--------------------------------------------------------------------------------
/css/img/treeview-default-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-default-line.gif
--------------------------------------------------------------------------------
/css/img/treeview-default.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-default.gif
--------------------------------------------------------------------------------
/css/img/treeview-famfamfam-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-famfamfam-line.gif
--------------------------------------------------------------------------------
/css/img/treeview-famfamfam.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-famfamfam.gif
--------------------------------------------------------------------------------
/css/img/treeview-gray-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-gray-line.gif
--------------------------------------------------------------------------------
/css/img/treeview-gray.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-gray.gif
--------------------------------------------------------------------------------
/css/img/treeview-red-line.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-red-line.gif
--------------------------------------------------------------------------------
/css/img/treeview-red.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/css/img/treeview-red.gif
--------------------------------------------------------------------------------
/css/libs/jquery.freetrans.css:
--------------------------------------------------------------------------------
1 | .ft-container {
2 | position: absolute;
3 | user-select: none;
4 | -webkit-user-select: none;
5 | -moz-user-select: none;
6 | -o-user-select: none;
7 | }
8 |
9 | .ft-controls {
10 | position: absolute;
11 | width: 100%;
12 | height: 100%;
13 | border:1px solid #32B5FE;
14 | }
15 |
16 | .ft-scaler {
17 | position: absolute;
18 | width: 6px;
19 | height: 6px;
20 | margin-left: -4px;
21 | margin-top: -4px;
22 | background-color: #fff;
23 | border: 1px solid #32B5FE;
24 | }
25 |
26 | .ft-scaler-top {
27 | top: 0%;
28 | }
29 |
30 | .ft-scaler-mid {
31 | top: 50%;
32 | }
33 |
34 | .ft-scaler-bottom {
35 | top: 100%;
36 | }
37 |
38 | .ft-scaler-left {
39 | left: 0%;
40 | }
41 |
42 | .ft-scaler-center {
43 | left: 50%;
44 | }
45 |
46 | .ft-scaler-right {
47 | left: 100%;
48 | }
49 |
50 | .ft-bounds {
51 | position: absolute;
52 | border: 1px dashed #000;
53 | }
54 |
55 | .ft-rotator{
56 | display: none;
57 | }
--------------------------------------------------------------------------------
/css/libs/jquery.treeview.css:
--------------------------------------------------------------------------------
1 | .treeview, .treeview ul {
2 | padding: 0;
3 | margin: 0;
4 | list-style: none;
5 | }
6 |
7 | .treeview ul {
8 | background-color: white;
9 | margin-top: 4px;
10 | }
11 |
12 | .treeview .hitarea {
13 | background: url(../img/treeview-default.gif) -64px -25px no-repeat;
14 | height: 16px;
15 | width: 16px;
16 | margin-left: -16px;
17 | float: left;
18 | cursor: pointer;
19 | }
20 | /* fix for IE6 */
21 | * html .hitarea {
22 | display: inline;
23 | float:none;
24 | }
25 |
26 | .treeview li {
27 | margin: 0;
28 | padding: 3px 0pt 3px 16px;
29 | }
30 |
31 | .treeview a.selected {
32 | background-color: #eee;
33 | }
34 |
35 | #treecontrol { margin: 1em 0; display: none; }
36 |
37 | .treeview .hover { color: red; cursor: pointer; }
38 |
39 | .treeview li { background: 0 0 no-repeat; }
40 | .treeview li.collapsable, .treeview li.expandable { background-position: 0 -176px; }
41 |
42 | .treeview .expandable-hitarea { background-position: -80px -3px; }
43 |
44 | .treeview li.last { background-position: 0 -1766px }
45 | .treeview li.lastCollapsable, .treeview li.lastExpandable { background-image: url(../img/treeview-default.gif); }
46 | .treeview li.lastCollapsable { background-position: 0 -111px }
47 | .treeview li.lastExpandable { background-position: -32px -67px }
48 |
49 | .treeview div.lastCollapsable-hitarea, .treeview div.lastExpandable-hitarea { background-position: 0; }
50 |
51 | .treeview-red li { background-image: url(../img/treeview-red-line.gif); }
52 | .treeview-red .hitarea, .treeview-red li.lastCollapsable, .treeview-red li.lastExpandable { background-image: url(../img/treeview-red.gif); }
53 |
54 | .treeview-black li { background-image: url(../img/treeview-black-line.gif); }
55 | .treeview-black .hitarea, .treeview-black li.lastCollapsable, .treeview-black li.lastExpandable { background-image: url(../img/treeview-black.gif); }
56 |
57 | .treeview-gray li { background-image: url(../img/treeview-gray-line.gif); }
58 | .treeview-gray .hitarea, .treeview-gray li.lastCollapsable, .treeview-gray li.lastExpandable { background-image: url(../img/treeview-gray.gif); }
59 |
60 | .treeview-famfamfam li { background-image: url(../img/treeview-famfamfam-line.gif); }
61 | .treeview-famfamfam .hitarea, .treeview-famfamfam li.lastCollapsable, .treeview-famfamfam li.lastExpandable { background-image: url(../img/treeview-famfamfam.gif); }
62 |
63 | .treeview .placeholder {
64 | background: url(../img/ajax-loader.gif) 0 0 no-repeat;
65 | height: 16px;
66 | width: 16px;
67 | display: block;
68 | }
69 |
70 | .filetree li { padding: 3px 0 2px 16px; }
71 | .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; padding-left: 20px; }
72 | .filetree span.folder { background: url(../img/folder.gif) 0 0 no-repeat; }
73 | .filetree li.expandable span.folder { background: url(../img/folder-closed.gif) 0 0 no-repeat; }
74 | .filetree span.file { background: url(../img/file.gif) 0 0 no-repeat; }
75 |
--------------------------------------------------------------------------------
/css/providers/flex.css:
--------------------------------------------------------------------------------
1 | .ui {
2 | display: block;
3 | position: absolute;
4 | width: auto;
5 | height: auto;
6 | cursor: pointer;
7 | }
8 | .ui:first-child{
9 | margin:2px;
10 | text-align: center;
11 | vertical-align: middle;
12 | }
13 |
14 | .trans{
15 |
16 | }
17 | .ft-scaler-right {
18 | cursor: nw-resize;
19 | }
20 | .ft-scaler-left{
21 | cursor: ne-resize;
22 | }
23 | .ft-scaler-center{
24 | cursor:s-resize;
25 | }
26 | .flex-label{
27 | text-align: left;
28 | }
29 | .flex-cpicker {
30 | width:22px;
31 | height: 22px;
32 | max-width: 22px;
33 | max-height: 22px;
34 | border: 1px solid #fff;
35 | background: url(../img/icons/ColorPicker.png) 100% no-repeat;
36 | }
37 | .flex-ntp .btn {
38 | width:23px;
39 | height:20px;
40 | }
41 | .flex-ntp .spinner-input {
42 | float: left;
43 | height: 30px;
44 | }
45 | .flex-ntp .btn-group {
46 | margin-top: 0px;
47 | }
48 | .flex-combobox{
49 | border:0; color:#000; background:transparent;
50 | font-weight:bold; padding:2px 10px;
51 | width:120px;
52 | background: url(../img/arrow.png) no-repeat 98.5% 12px #fff;
53 | -webkit-appearance: none;
54 | border:1px solid #ccc;
55 | -webkit-touch-callout: none;
56 | -webkit-user-select: none;
57 | -khtml-user-select: none;
58 | -moz-user-select: none;
59 | -ms-user-select: none;
60 | user-select: none;
61 | }
62 | .flex-dg {
63 | width:250px;
64 | height: 250px;
65 | border: 1px solid #ddd;
66 | background: #fff;
67 | }
68 | .flex-dg thead {
69 | position: relative;
70 | background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0.43, rgb(242,242,242)),
71 | color-stop(0.78, rgb(255,255,255)));
72 | }
73 | .flex-button {
74 | width:100px;
75 | min-height: 22px;
76 | background-image: -webkit-gradient(linear,left bottom,left top,color-stop(0.43, rgb(242,242,242)),
77 | color-stop(0.78, rgb(255,255,255)));
78 | border: 1px solid #ccc;
79 | border-radius: 4px;
80 | text-align: center;
81 | vertical-align: middle;
82 | }
83 | .flex-textarea textarea{
84 | min-width: 5%;
85 | min-height: 5%;
86 | width: 100%;
87 | height: 100%;
88 | }
89 | .flex-image{
90 | width: 200px;
91 | height:200px;
92 | }
93 | .flex-image img{
94 | width:100%;
95 | height: 100%;
96 | }
97 | .flex-checkbox {
98 | float: left;
99 | display: block;
100 | cursor: pointer;
101 | margin-left: 0px;
102 | position: relative;
103 | }
104 | .flex-checkbox label{
105 | float: left;
106 | }
107 | .flex-panel{
108 | display: block;
109 | width: 300px;
110 | height: 200px;
111 | background: white;
112 | box-shadow:0 1px 3px rgba(0,0,0,.4);
113 | border:1px solid #ccc;
114 | border-radius:3px;
115 | overflow: hidden;
116 | }
117 | .flex-panel .panel-title{
118 | margin:0 0;
119 | padding:0 0;
120 | font-size: 14px;
121 | font-weight: 200;
122 | padding: 10px 0px 0px 15px;
123 | color:#111;
124 | text-align: left;
125 | height: 30px;
126 | text-shadow:0 1px 0 rgba(0,0,0,.4);
127 | background-color: #f8f8f8;
128 | background-image: -moz-linear-gradient(top, #f8f8f8, #cccccc);
129 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f8f8f8), to(#cccccc));
130 | background-image: -webkit-linear-gradient(top, #f8f8f8, #cccccc);
131 | background-image: -o-linear-gradient(top, #f8f8f8, #cccccc);
132 | background-image: linear-gradient(to bottom, #f8f8f8, #cccccc);
133 | background-repeat: repeat-x;
134 | border-color: #ccc;
135 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#f8f8f8', GradientType=0);
136 | position:relative;
137 | }
138 | .group{
139 | width: 100%;
140 | height: 100%;
141 | background:#ffffff;
142 | display: inline-block;
143 | }
--------------------------------------------------------------------------------
/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/favicon.ico
--------------------------------------------------------------------------------
/js/libs/addon/comment/comment.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | "use strict";
3 |
4 | var noOptions = {};
5 | var nonWS = /[^\s\u00a0]/;
6 | var Pos = CodeMirror.Pos;
7 |
8 | function firstNonWS(str) {
9 | var found = str.search(nonWS);
10 | return found == -1 ? 0 : found;
11 | }
12 |
13 | CodeMirror.commands.toggleComment = function(cm) {
14 | var from = cm.getCursor("start"), to = cm.getCursor("end");
15 | cm.uncomment(from, to) || cm.lineComment(from, to);
16 | };
17 |
18 | CodeMirror.defineExtension("lineComment", function(from, to, options) {
19 | if (!options) options = noOptions;
20 | var self = this, mode = CodeMirror.innerMode(self.getMode(), self.getTokenAt(from).state).mode;
21 | var commentString = options.lineComment || mode.lineComment;
22 | if (!commentString) {
23 | if (options.blockCommentStart || mode.blockCommentStart) {
24 | options.fullLines = true;
25 | self.blockComment(from, to, options);
26 | }
27 | return;
28 | }
29 | var firstLine = self.getLine(from.line);
30 | if (firstLine == null) return;
31 | var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
32 | var pad = options.padding == null ? " " : options.padding;
33 | var blankLines = options.commentBlankLines;
34 |
35 | self.operation(function() {
36 | if (options.indent) {
37 | var baseString = firstLine.slice(0, firstNonWS(firstLine));
38 | for (var i = from.line; i < end; ++i) {
39 | var line = self.getLine(i), cut = baseString.length;
40 | if (!blankLines && !nonWS.test(line)) continue;
41 | if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
42 | self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
43 | }
44 | } else {
45 | for (var i = from.line; i < end; ++i) {
46 | if (blankLines || nonWS.test(self.getLine(i)))
47 | self.replaceRange(commentString + pad, Pos(i, 0));
48 | }
49 | }
50 | });
51 | });
52 |
53 | CodeMirror.defineExtension("blockComment", function(from, to, options) {
54 | if (!options) options = noOptions;
55 | var self = this, mode = CodeMirror.innerMode(self.getMode(), self.getTokenAt(from).state).mode;
56 | var startString = options.blockCommentStart || mode.blockCommentStart;
57 | var endString = options.blockCommentEnd || mode.blockCommentEnd;
58 | if (!startString || !endString) {
59 | if ((options.lineComment || mode.lineComment) && options.fullLines != false)
60 | self.lineComment(from, to, options);
61 | return;
62 | }
63 |
64 | var end = Math.min(to.line, self.lastLine());
65 | if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
66 |
67 | var pad = options.padding == null ? " " : options.padding;
68 | if (from.line > end) return;
69 |
70 | self.operation(function() {
71 | if (options.fullLines != false) {
72 | var lastLineHasText = nonWS.test(self.getLine(end));
73 | self.replaceRange(pad + endString, Pos(end));
74 | self.replaceRange(startString + pad, Pos(from.line, 0));
75 | var lead = options.blockCommentLead || mode.blockCommentLead;
76 | if (lead != null) for (var i = from.line + 1; i <= end; ++i)
77 | if (i != end || lastLineHasText)
78 | self.replaceRange(lead + pad, Pos(i, 0));
79 | } else {
80 | self.replaceRange(endString, to);
81 | self.replaceRange(startString, from);
82 | }
83 | });
84 | });
85 |
86 | CodeMirror.defineExtension("uncomment", function(from, to, options) {
87 | if (!options) options = noOptions;
88 | var self = this, mode = CodeMirror.innerMode(self.getMode(), self.getTokenAt(from).state).mode;
89 | var end = Math.min(to.line, self.lastLine()), start = Math.min(from.line, end);
90 |
91 | // Try finding line comments
92 | var lineString = options.lineComment || mode.lineComment, lines = [];
93 | var pad = options.padding == null ? " " : options.padding;
94 | lineComment: for(;;) {
95 | if (!lineString) break;
96 | for (var i = start; i <= end; ++i) {
97 | var line = self.getLine(i);
98 | var found = line.indexOf(lineString);
99 | if (found == -1 && (i != end || i == start) && nonWS.test(line)) break lineComment;
100 | if (i != start && nonWS.test(line.slice(0, found))) break lineComment;
101 | lines.push(line);
102 | }
103 | self.operation(function() {
104 | for (var i = start; i <= end; ++i) {
105 | var line = lines[i - start];
106 | var pos = line.indexOf(lineString), endPos = pos + lineString.length;
107 | if (pos < 0) continue;
108 | if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
109 | self.replaceRange("", Pos(i, pos), Pos(i, endPos));
110 | }
111 | });
112 | return true;
113 | }
114 |
115 | // Try block comments
116 | var startString = options.blockCommentStart || mode.blockCommentStart;
117 | var endString = options.blockCommentEnd || mode.blockCommentEnd;
118 | if (!startString || !endString) return false;
119 | var lead = options.blockCommentLead || mode.blockCommentLead;
120 | var startLine = self.getLine(start), endLine = end == start ? startLine : self.getLine(end);
121 | var open = startLine.indexOf(startString), close = endLine.lastIndexOf(endString);
122 | if (close == -1 && start != end) {
123 | endLine = self.getLine(--end);
124 | close = endLine.lastIndexOf(endString);
125 | }
126 | if (open == -1 || close == -1) return false;
127 |
128 | self.operation(function() {
129 | self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
130 | Pos(end, close + endString.length));
131 | var openEnd = open + startString.length;
132 | if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
133 | self.replaceRange("", Pos(start, open), Pos(start, openEnd));
134 | if (lead) for (var i = start + 1; i <= end; ++i) {
135 | var line = self.getLine(i), found = line.indexOf(lead);
136 | if (found == -1 || nonWS.test(line.slice(0, found))) continue;
137 | var foundEnd = found + lead.length;
138 | if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
139 | self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
140 | }
141 | });
142 | return true;
143 | });
144 | })();
145 |
--------------------------------------------------------------------------------
/js/libs/addon/dialog/dialog.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-dialog {
2 | position: absolute;
3 | left: 0; right: 0;
4 | background: white;
5 | z-index: 15;
6 | padding: .1em .8em;
7 | overflow: hidden;
8 | color: #333;
9 | }
10 |
11 | .CodeMirror-dialog-top {
12 | border-bottom: 1px solid #eee;
13 | top: 0;
14 | }
15 |
16 | .CodeMirror-dialog-bottom {
17 | border-top: 1px solid #eee;
18 | bottom: 0;
19 | }
20 |
21 | .CodeMirror-dialog input {
22 | border: none;
23 | outline: none;
24 | background: transparent;
25 | width: 20em;
26 | color: inherit;
27 | font-family: monospace;
28 | }
29 |
30 | .CodeMirror-dialog button {
31 | font-size: 70%;
32 | }
33 |
--------------------------------------------------------------------------------
/js/libs/addon/dialog/dialog.js:
--------------------------------------------------------------------------------
1 | // Open simple dialogs on top of an editor. Relies on dialog.css.
2 |
3 | (function() {
4 | function dialogDiv(cm, template, bottom) {
5 | var wrap = cm.getWrapperElement();
6 | var dialog;
7 | dialog = wrap.appendChild(document.createElement("div"));
8 | if (bottom) {
9 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
10 | } else {
11 | dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
12 | }
13 | dialog.innerHTML = template;
14 | return dialog;
15 | }
16 |
17 | CodeMirror.defineExtension("openDialog", function(template, callback, options) {
18 | var dialog = dialogDiv(this, template, options && options.bottom);
19 | var closed = false, me = this;
20 | function close() {
21 | if (closed) return;
22 | closed = true;
23 | dialog.parentNode.removeChild(dialog);
24 | }
25 | var inp = dialog.getElementsByTagName("input")[0], button;
26 | if (inp) {
27 | CodeMirror.on(inp, "keydown", function(e) {
28 | if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
29 | if (e.keyCode == 13 || e.keyCode == 27) {
30 | CodeMirror.e_stop(e);
31 | close();
32 | me.focus();
33 | if (e.keyCode == 13) callback(inp.value);
34 | }
35 | });
36 | if (options && options.onKeyUp) {
37 | CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
38 | }
39 | if (options && options.value) inp.value = options.value;
40 | inp.focus();
41 | CodeMirror.on(inp, "blur", close);
42 | } else if (button = dialog.getElementsByTagName("button")[0]) {
43 | CodeMirror.on(button, "click", function() {
44 | close();
45 | me.focus();
46 | });
47 | button.focus();
48 | CodeMirror.on(button, "blur", close);
49 | }
50 | return close;
51 | });
52 |
53 | CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
54 | var dialog = dialogDiv(this, template, options && options.bottom);
55 | var buttons = dialog.getElementsByTagName("button");
56 | var closed = false, me = this, blurring = 1;
57 | function close() {
58 | if (closed) return;
59 | closed = true;
60 | dialog.parentNode.removeChild(dialog);
61 | me.focus();
62 | }
63 | buttons[0].focus();
64 | for (var i = 0; i < buttons.length; ++i) {
65 | var b = buttons[i];
66 | (function(callback) {
67 | CodeMirror.on(b, "click", function(e) {
68 | CodeMirror.e_preventDefault(e);
69 | close();
70 | if (callback) callback(me);
71 | });
72 | })(callbacks[i]);
73 | CodeMirror.on(b, "blur", function() {
74 | --blurring;
75 | setTimeout(function() { if (blurring <= 0) close(); }, 200);
76 | });
77 | CodeMirror.on(b, "focus", function() { ++blurring; });
78 | }
79 | });
80 | })();
81 |
--------------------------------------------------------------------------------
/js/libs/addon/display/placeholder.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
3 | var prev = old && old != CodeMirror.Init;
4 | if (val && !prev) {
5 | cm.on("focus", onFocus);
6 | cm.on("blur", onBlur);
7 | cm.on("change", onChange);
8 | onChange(cm);
9 | } else if (!val && prev) {
10 | cm.off("focus", onFocus);
11 | cm.off("blur", onBlur);
12 | cm.off("change", onChange);
13 | clearPlaceholder(cm);
14 | var wrapper = cm.getWrapperElement();
15 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
16 | }
17 |
18 | if (val && !cm.hasFocus()) onBlur(cm);
19 | });
20 |
21 | function clearPlaceholder(cm) {
22 | if (cm.state.placeholder) {
23 | cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
24 | cm.state.placeholder = null;
25 | }
26 | }
27 | function setPlaceholder(cm) {
28 | clearPlaceholder(cm);
29 | var elt = cm.state.placeholder = document.createElement("pre");
30 | elt.style.cssText = "height: 0; overflow: visible";
31 | elt.className = "CodeMirror-placeholder";
32 | elt.appendChild(document.createTextNode(cm.getOption("placeholder")));
33 | cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
34 | }
35 |
36 | function onFocus(cm) {
37 | clearPlaceholder(cm);
38 | }
39 | function onBlur(cm) {
40 | if (isEmpty(cm)) setPlaceholder(cm);
41 | }
42 | function onChange(cm) {
43 | var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
44 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
45 |
46 | if (cm.hasFocus()) return;
47 | if (empty) setPlaceholder(cm);
48 | else clearPlaceholder(cm);
49 | }
50 |
51 | function isEmpty(cm) {
52 | return (cm.lineCount() === 1) && (cm.getLine(0) === "");
53 | }
54 | })();
55 |
--------------------------------------------------------------------------------
/js/libs/addon/edit/closebrackets.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var DEFAULT_BRACKETS = "()[]{}''\"\"";
3 | var SPACE_CHAR_REGEX = /\s/;
4 |
5 | CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
6 | var wasOn = old && old != CodeMirror.Init;
7 | if (val && !wasOn)
8 | cm.addKeyMap(buildKeymap(typeof val == "string" ? val : DEFAULT_BRACKETS));
9 | else if (!val && wasOn)
10 | cm.removeKeyMap("autoCloseBrackets");
11 | });
12 |
13 | function buildKeymap(pairs) {
14 | var map = {
15 | name : "autoCloseBrackets",
16 | Backspace: function(cm) {
17 | if (cm.somethingSelected()) return CodeMirror.Pass;
18 | var cur = cm.getCursor(), line = cm.getLine(cur.line);
19 | if (cur.ch && cur.ch < line.length &&
20 | pairs.indexOf(line.slice(cur.ch - 1, cur.ch + 1)) % 2 == 0)
21 | cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1));
22 | else
23 | return CodeMirror.Pass;
24 | }
25 | };
26 | var closingBrackets = "";
27 | for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
28 | if (left != right) closingBrackets += right;
29 | function surround(cm) {
30 | var selection = cm.getSelection();
31 | cm.replaceSelection(left + selection + right);
32 | }
33 | function maybeOverwrite(cm) {
34 | var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
35 | if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass;
36 | else cm.execCommand("goCharRight");
37 | }
38 | map["'" + left + "'"] = function(cm) {
39 | if (left == "'" && cm.getTokenAt(cm.getCursor()).type == "comment")
40 | return CodeMirror.Pass;
41 | if (cm.somethingSelected()) return surround(cm);
42 | if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
43 | var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
44 | var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch);
45 | if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar))
46 | cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
47 | else
48 | return CodeMirror.Pass;
49 | };
50 | if (left != right) map["'" + right + "'"] = maybeOverwrite;
51 | })(pairs.charAt(i), pairs.charAt(i + 1));
52 | return map;
53 | }
54 | })();
55 |
--------------------------------------------------------------------------------
/js/libs/addon/edit/closetag.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Tag-closer extension for CodeMirror.
3 | *
4 | * This extension adds an "autoCloseTags" option that can be set to
5 | * either true to get the default behavior, or an object to further
6 | * configure its behavior.
7 | *
8 | * These are supported options:
9 | *
10 | * `whenClosing` (default true)
11 | * Whether to autoclose when the '/' of a closing tag is typed.
12 | * `whenOpening` (default true)
13 | * Whether to autoclose the tag when the final '>' of an opening
14 | * tag is typed.
15 | * `dontCloseTags` (default is empty tags for HTML, none for XML)
16 | * An array of tag names that should not be autoclosed.
17 | * `indentTags` (default is block tags for HTML, none for XML)
18 | * An array of tag names that should, when opened, cause a
19 | * blank line to be added inside the tag, and the blank line and
20 | * closing line to be indented.
21 | *
22 | * See demos/closetag.html for a usage example.
23 | */
24 |
25 | (function() {
26 | CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
27 | if (val && (old == CodeMirror.Init || !old)) {
28 | var map = {name: "autoCloseTags"};
29 | if (typeof val != "object" || val.whenClosing)
30 | map["'/'"] = function(cm) { return autoCloseTag(cm, '/'); };
31 | if (typeof val != "object" || val.whenOpening)
32 | map["'>'"] = function(cm) { return autoCloseTag(cm, '>'); };
33 | cm.addKeyMap(map);
34 | } else if (!val && (old != CodeMirror.Init && old)) {
35 | cm.removeKeyMap("autoCloseTags");
36 | }
37 | });
38 |
39 | var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
40 | "source", "track", "wbr"];
41 | var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
42 | "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
43 |
44 | function autoCloseTag(cm, ch) {
45 | var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
46 | var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
47 | if (inner.mode.name != "xml") return CodeMirror.Pass;
48 |
49 | var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
50 | var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
51 | var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
52 |
53 | if (ch == ">" && state.tagName) {
54 | var tagName = state.tagName;
55 | if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
56 | var lowerTagName = tagName.toLowerCase();
57 | // Don't process the '>' at the end of an end-tag or self-closing tag
58 | if (tok.type == "tag" && state.type == "closeTag" ||
59 | tok.string.indexOf("/") == (tok.string.length - 1) || // match something like
60 | dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1)
61 | return CodeMirror.Pass;
62 |
63 | var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
64 | var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1);
65 | cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "" + tagName + ">",
66 | {head: curPos, anchor: curPos});
67 | if (doIndent) {
68 | cm.indentLine(pos.line + 1);
69 | cm.indentLine(pos.line + 2);
70 | }
71 | return;
72 | } else if (ch == "/" && tok.string == "<") {
73 | var tagName = state.context && state.context.tagName;
74 | if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
75 | return;
76 | }
77 | return CodeMirror.Pass;
78 | }
79 |
80 | function indexOf(collection, elt) {
81 | if (collection.indexOf) return collection.indexOf(elt);
82 | for (var i = 0, e = collection.length; i < e; ++i)
83 | if (collection[i] == elt) return i;
84 | return -1;
85 | }
86 | })();
87 |
--------------------------------------------------------------------------------
/js/libs/addon/edit/continuecomment.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var modes = ["clike", "css", "javascript"];
3 | for (var i = 0; i < modes.length; ++i)
4 | CodeMirror.extendMode(modes[i], {blockCommentStart: "/*",
5 | blockCommentEnd: "*/",
6 | blockCommentContinue: " * "});
7 |
8 | function continueComment(cm) {
9 | var pos = cm.getCursor(), token = cm.getTokenAt(pos);
10 | var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode;
11 | var space;
12 |
13 | if (token.type == "comment" && mode.blockCommentStart) {
14 | var end = token.string.indexOf(mode.blockCommentEnd);
15 | var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
16 | if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) {
17 | // Comment ended, don't continue it
18 | } else if (token.string.indexOf(mode.blockCommentStart) == 0) {
19 | space = full.slice(0, token.start);
20 | if (!/^\s*$/.test(space)) {
21 | space = "";
22 | for (var i = 0; i < token.start; ++i) space += " ";
23 | }
24 | } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 &&
25 | found + mode.blockCommentContinue.length > token.start &&
26 | /^\s*$/.test(full.slice(0, found))) {
27 | space = full.slice(0, found);
28 | }
29 | }
30 |
31 | if (space != null)
32 | cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end");
33 | else
34 | return CodeMirror.Pass;
35 | }
36 |
37 | CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
38 | if (prev && prev != CodeMirror.Init)
39 | cm.removeKeyMap("continueComment");
40 | var map = {name: "continueComment"};
41 | map[typeof val == "string" ? val : "Enter"] = continueComment;
42 | cm.addKeyMap(map);
43 | });
44 | })();
45 |
--------------------------------------------------------------------------------
/js/libs/addon/edit/continuelist.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | 'use strict';
3 |
4 | var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/,
5 | unorderedBullets = '*+-';
6 |
7 | CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
8 | var pos = cm.getCursor(),
9 | inList = cm.getStateAfter(pos.line).list,
10 | match;
11 |
12 | if (!inList || !(match = cm.getLine(pos.line).match(listRE))) {
13 | cm.execCommand('newlineAndIndent');
14 | return;
15 | }
16 |
17 | var indent = match[1], after = match[4];
18 | var bullet = unorderedBullets.indexOf(match[2]) >= 0
19 | ? match[2]
20 | : (parseInt(match[3], 10) + 1) + '.';
21 |
22 | cm.replaceSelection('\n' + indent + bullet + after, 'end');
23 | };
24 |
25 | }());
26 |
--------------------------------------------------------------------------------
/js/libs/addon/edit/matchbrackets.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
3 | (document.documentMode == null || document.documentMode < 8);
4 |
5 | var Pos = CodeMirror.Pos;
6 |
7 | var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
8 | function findMatchingBracket(cm) {
9 | var maxScanLen = cm.state._matchBrackets.maxScanLineLength || 10000;
10 |
11 | var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
12 | var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
13 | if (!match) return null;
14 | var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
15 | var style = cm.getTokenAt(Pos(cur.line, pos + 1)).type;
16 |
17 | var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
18 | function scan(line, lineNo, start) {
19 | if (!line.text) return;
20 | var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
21 | if (line.text.length > maxScanLen) return null;
22 | var checkTokenStyles = line.text.length < 1000;
23 | if (start != null) pos = start + d;
24 | for (; pos != end; pos += d) {
25 | var ch = line.text.charAt(pos);
26 | if (re.test(ch) && (!checkTokenStyles || cm.getTokenAt(Pos(lineNo, pos + 1)).type == style)) {
27 | var match = matching[ch];
28 | if (match.charAt(1) == ">" == forward) stack.push(ch);
29 | else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
30 | else if (!stack.length) return {pos: pos, match: true};
31 | }
32 | }
33 | }
34 | for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
35 | if (i == cur.line) found = scan(line, i, pos);
36 | else found = scan(cm.getLineHandle(i), i);
37 | if (found) break;
38 | }
39 | return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos), match: found && found.match};
40 | }
41 |
42 | function matchBrackets(cm, autoclear) {
43 | // Disable brace matching in long lines, since it'll cause hugely slow updates
44 | var maxHighlightLen = cm.state._matchBrackets.maxHighlightLineLength || 1000;
45 | var found = findMatchingBracket(cm);
46 | if (!found || cm.getLine(found.from.line).length > maxHighlightLen ||
47 | found.to && cm.getLine(found.to.line).length > maxHighlightLen)
48 | return;
49 |
50 | var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
51 | var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
52 | var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
53 | // Kludge to work around the IE bug from issue #1193, where text
54 | // input stops going to the textare whever this fires.
55 | if (ie_lt8 && cm.state.focused) cm.display.input.focus();
56 | var clear = function() {
57 | cm.operation(function() { one.clear(); two && two.clear(); });
58 | };
59 | if (autoclear) setTimeout(clear, 800);
60 | else return clear;
61 | }
62 |
63 | var currentlyHighlighted = null;
64 | function doMatchBrackets(cm) {
65 | cm.operation(function() {
66 | if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
67 | if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
68 | });
69 | }
70 |
71 | CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
72 | if (old && old != CodeMirror.Init)
73 | cm.off("cursorActivity", doMatchBrackets);
74 | if (val) {
75 | cm.state._matchBrackets = typeof val == "object" ? val : {};
76 | cm.on("cursorActivity", doMatchBrackets);
77 | }
78 | });
79 |
80 | CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
81 | CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);});
82 | })();
83 |
--------------------------------------------------------------------------------
/js/libs/addon/fold/brace-fold.js:
--------------------------------------------------------------------------------
1 | CodeMirror.braceRangeFinder = function(cm, start) {
2 | var line = start.line, lineText = cm.getLine(line);
3 | var at = lineText.length, startChar, tokenType;
4 | for (; at > 0;) {
5 | var found = lineText.lastIndexOf("{", at);
6 | var startToken = '{', endToken = '}';
7 | if (found < start.ch) {
8 | found = lineText.lastIndexOf("[", at);
9 | if (found < start.ch) break;
10 | startToken = '['; endToken = ']';
11 | }
12 |
13 | tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type;
14 | if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; }
15 | at = found - 1;
16 | }
17 | if (startChar == null || lineText.lastIndexOf(startToken) > startChar) return;
18 | var count = 1, lastLine = cm.lineCount(), end, endCh;
19 | outer: for (var i = line + 1; i < lastLine; ++i) {
20 | var text = cm.getLine(i), pos = 0;
21 | for (;;) {
22 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
23 | if (nextOpen < 0) nextOpen = text.length;
24 | if (nextClose < 0) nextClose = text.length;
25 | pos = Math.min(nextOpen, nextClose);
26 | if (pos == text.length) break;
27 | if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) {
28 | if (pos == nextOpen) ++count;
29 | else if (!--count) { end = i; endCh = pos; break outer; }
30 | }
31 | ++pos;
32 | }
33 | }
34 | if (end == null || end == line + 1) return;
35 | return {from: CodeMirror.Pos(line, startChar + 1),
36 | to: CodeMirror.Pos(end, endCh)};
37 | };
38 |
--------------------------------------------------------------------------------
/js/libs/addon/fold/foldcode.js:
--------------------------------------------------------------------------------
1 | CodeMirror.newFoldFunction = function(rangeFinder, widget) {
2 | if (widget == null) widget = "\u2194";
3 | if (typeof widget == "string") {
4 | var text = document.createTextNode(widget);
5 | widget = document.createElement("span");
6 | widget.appendChild(text);
7 | widget.className = "CodeMirror-foldmarker";
8 | }
9 |
10 | return function(cm, pos) {
11 | if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
12 | var range = rangeFinder(cm, pos);
13 | if (!range) return;
14 |
15 | var present = cm.findMarksAt(range.from), cleared = 0;
16 | for (var i = 0; i < present.length; ++i) {
17 | if (present[i].__isFold) {
18 | ++cleared;
19 | present[i].clear();
20 | }
21 | }
22 | if (cleared) return;
23 |
24 | var myWidget = widget.cloneNode(true);
25 | CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();});
26 | var myRange = cm.markText(range.from, range.to, {
27 | replacedWith: myWidget,
28 | clearOnEnter: true,
29 | __isFold: true
30 | });
31 | };
32 | };
33 |
--------------------------------------------------------------------------------
/js/libs/addon/fold/indent-fold.js:
--------------------------------------------------------------------------------
1 | CodeMirror.indentRangeFinder = function(cm, start) {
2 | var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
3 | var myIndent = CodeMirror.countColumn(firstLine, null, tabSize);
4 | for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) {
5 | var curLine = cm.getLine(i);
6 | if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent &&
7 | CodeMirror.countColumn(cm.getLine(i-1), null, tabSize) > myIndent)
8 | return {from: CodeMirror.Pos(start.line, firstLine.length),
9 | to: CodeMirror.Pos(i, curLine.length)};
10 | }
11 | };
12 |
--------------------------------------------------------------------------------
/js/libs/addon/fold/xml-fold.js:
--------------------------------------------------------------------------------
1 | CodeMirror.tagRangeFinder = (function() {
2 | var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
3 | var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
4 | var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
5 |
6 | return function(cm, start) {
7 | var line = start.line, ch = start.ch, lineText = cm.getLine(line);
8 |
9 | function nextLine() {
10 | if (line >= cm.lastLine()) return;
11 | ch = 0;
12 | lineText = cm.getLine(++line);
13 | return true;
14 | }
15 | function toTagEnd() {
16 | for (;;) {
17 | var gt = lineText.indexOf(">", ch);
18 | if (gt == -1) { if (nextLine()) continue; else return; }
19 | var lastSlash = lineText.lastIndexOf("/", gt);
20 | var selfClose = lastSlash > -1 && /^\s*$/.test(lineText.slice(lastSlash + 1, gt));
21 | ch = gt + 1;
22 | return selfClose ? "selfClose" : "regular";
23 | }
24 | }
25 | function toNextTag() {
26 | for (;;) {
27 | xmlTagStart.lastIndex = ch;
28 | var found = xmlTagStart.exec(lineText);
29 | if (!found) { if (nextLine()) continue; else return; }
30 | ch = found.index + found[0].length;
31 | return found;
32 | }
33 | }
34 |
35 | var stack = [], startCh;
36 | for (;;) {
37 | var openTag = toNextTag(), end;
38 | if (!openTag || line != start.line || !(end = toTagEnd())) return;
39 | if (!openTag[1] && end != "selfClose") {
40 | stack.push(openTag[2]);
41 | startCh = ch;
42 | break;
43 | }
44 | }
45 |
46 | for (;;) {
47 | var next = toNextTag(), end, tagLine = line, tagCh = ch - (next ? next[0].length : 0);
48 | if (!next || !(end = toTagEnd())) return;
49 | if (end == "selfClose") continue;
50 | if (next[1]) { // closing tag
51 | for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
52 | stack.length = i;
53 | break;
54 | }
55 | if (!stack.length) return {
56 | from: CodeMirror.Pos(start.line, startCh),
57 | to: CodeMirror.Pos(tagLine, tagCh)
58 | };
59 | } else { // opening tag
60 | stack.push(next[2]);
61 | }
62 | }
63 | };
64 | })();
65 |
--------------------------------------------------------------------------------
/js/libs/addon/hint/javascript-hint.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | var Pos = CodeMirror.Pos;
3 |
4 | function forEach(arr, f) {
5 | for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
6 | }
7 |
8 | function arrayContains(arr, item) {
9 | if (!Array.prototype.indexOf) {
10 | var i = arr.length;
11 | while (i--) {
12 | if (arr[i] === item) {
13 | return true;
14 | }
15 | }
16 | return false;
17 | }
18 | return arr.indexOf(item) != -1;
19 | }
20 |
21 | function scriptHint(editor, keywords, getToken, options) {
22 | // Find the token at the cursor
23 | var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
24 | token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
25 |
26 | // If it's not a 'word-style' token, ignore the token.
27 | if (!/^[\w$_]*$/.test(token.string)) {
28 | token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
29 | type: token.string == "." ? "property" : null};
30 | }
31 | // If it is a property, find out what it is a property of.
32 | while (tprop.type == "property") {
33 | tprop = getToken(editor, Pos(cur.line, tprop.start));
34 | if (tprop.string != ".") return;
35 | tprop = getToken(editor, Pos(cur.line, tprop.start));
36 | if (tprop.string == ')') {
37 | var level = 1;
38 | do {
39 | tprop = getToken(editor, Pos(cur.line, tprop.start));
40 | switch (tprop.string) {
41 | case ')': level++; break;
42 | case '(': level--; break;
43 | default: break;
44 | }
45 | } while (level > 0);
46 | tprop = getToken(editor, Pos(cur.line, tprop.start));
47 | if (tprop.type.indexOf("variable") === 0)
48 | tprop.type = "function";
49 | else return; // no clue
50 | }
51 | if (!context) var context = [];
52 | context.push(tprop);
53 | }
54 | return {list: getCompletions(token, context, keywords, options),
55 | from: Pos(cur.line, token.start),
56 | to: Pos(cur.line, token.end)};
57 | }
58 |
59 | CodeMirror.javascriptHint = function(editor, options) {
60 | return scriptHint(editor, javascriptKeywords,
61 | function (e, cur) {return e.getTokenAt(cur);},
62 | options);
63 | };
64 |
65 | function getCoffeeScriptToken(editor, cur) {
66 | // This getToken, it is for coffeescript, imitates the behavior of
67 | // getTokenAt method in javascript.js, that is, returning "property"
68 | // type and treat "." as indepenent token.
69 | var token = editor.getTokenAt(cur);
70 | if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
71 | token.end = token.start;
72 | token.string = '.';
73 | token.type = "property";
74 | }
75 | else if (/^\.[\w$_]*$/.test(token.string)) {
76 | token.type = "property";
77 | token.start++;
78 | token.string = token.string.replace(/\./, '');
79 | }
80 | return token;
81 | }
82 |
83 | CodeMirror.coffeescriptHint = function(editor, options) {
84 | return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
85 | };
86 |
87 | var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
88 | "toUpperCase toLowerCase split concat match replace search").split(" ");
89 | var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
90 | "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
91 | var funcProps = "prototype apply call bind".split(" ");
92 | var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
93 | "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
94 | var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
95 | "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
96 |
97 | function getCompletions(token, context, keywords, options) {
98 | var found = [], start = token.string;
99 | function maybeAdd(str) {
100 | if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
101 | }
102 | function gatherCompletions(obj) {
103 | if (typeof obj == "string") forEach(stringProps, maybeAdd);
104 | else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
105 | else if (obj instanceof Function) forEach(funcProps, maybeAdd);
106 | for (var name in obj) maybeAdd(name);
107 | }
108 |
109 | if (context) {
110 | // If this is a property, see if it belongs to some object we can
111 | // find in the current environment.
112 | var obj = context.pop(), base;
113 | if (obj.type.indexOf("variable") === 0) {
114 | if (options && options.additionalContext)
115 | base = options.additionalContext[obj.string];
116 | base = base || window[obj.string];
117 | } else if (obj.type == "string") {
118 | base = "";
119 | } else if (obj.type == "atom") {
120 | base = 1;
121 | } else if (obj.type == "function") {
122 | if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
123 | (typeof window.jQuery == 'function'))
124 | base = window.jQuery();
125 | else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
126 | base = window._();
127 | }
128 | while (base != null && context.length)
129 | base = base[context.pop().string];
130 | if (base != null) gatherCompletions(base);
131 | }
132 | else {
133 | // If not, just look in the window object and any local scope
134 | // (reading into JS mode internals to get at the local and global variables)
135 | for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
136 | for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
137 | gatherCompletions(window);
138 | forEach(keywords, maybeAdd);
139 | }
140 | return found;
141 | }
142 | })();
143 |
--------------------------------------------------------------------------------
/js/libs/addon/hint/pig-hint.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | function forEach(arr, f) {
3 | for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
4 | }
5 |
6 | function arrayContains(arr, item) {
7 | if (!Array.prototype.indexOf) {
8 | var i = arr.length;
9 | while (i--) {
10 | if (arr[i] === item) {
11 | return true;
12 | }
13 | }
14 | return false;
15 | }
16 | return arr.indexOf(item) != -1;
17 | }
18 |
19 | function scriptHint(editor, _keywords, getToken) {
20 | // Find the token at the cursor
21 | var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
22 | // If it's not a 'word-style' token, ignore the token.
23 |
24 | if (!/^[\w$_]*$/.test(token.string)) {
25 | token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
26 | className: token.string == ":" ? "pig-type" : null};
27 | }
28 |
29 | if (!context) var context = [];
30 | context.push(tprop);
31 |
32 | var completionList = getCompletions(token, context);
33 | completionList = completionList.sort();
34 | //prevent autocomplete for last word, instead show dropdown with one word
35 | if(completionList.length == 1) {
36 | completionList.push(" ");
37 | }
38 |
39 | return {list: completionList,
40 | from: CodeMirror.Pos(cur.line, token.start),
41 | to: CodeMirror.Pos(cur.line, token.end)};
42 | }
43 |
44 | CodeMirror.pigHint = function(editor) {
45 | return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
46 | };
47 |
48 | var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
49 | + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
50 | + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
51 | + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
52 | + "NEQ MATCHES TRUE FALSE";
53 | var pigKeywordsU = pigKeywords.split(" ");
54 | var pigKeywordsL = pigKeywords.toLowerCase().split(" ");
55 |
56 | var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";
57 | var pigTypesU = pigTypes.split(" ");
58 | var pigTypesL = pigTypes.toLowerCase().split(" ");
59 |
60 | var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
61 | + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
62 | + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
63 | + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
64 | + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
65 | + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
66 | + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
67 | + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
68 | + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
69 | + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";
70 | var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");
71 | var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");
72 | var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "
73 | + "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "
74 | + "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "
75 | + "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "
76 | + "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "
77 | + "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "
78 | + "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");
79 |
80 | function getCompletions(token, context) {
81 | var found = [], start = token.string;
82 | function maybeAdd(str) {
83 | if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
84 | }
85 |
86 | function gatherCompletions(obj) {
87 | if(obj == ":") {
88 | forEach(pigTypesL, maybeAdd);
89 | }
90 | else {
91 | forEach(pigBuiltinsU, maybeAdd);
92 | forEach(pigBuiltinsL, maybeAdd);
93 | forEach(pigBuiltinsC, maybeAdd);
94 | forEach(pigTypesU, maybeAdd);
95 | forEach(pigTypesL, maybeAdd);
96 | forEach(pigKeywordsU, maybeAdd);
97 | forEach(pigKeywordsL, maybeAdd);
98 | }
99 | }
100 |
101 | if (context) {
102 | // If this is a property, see if it belongs to some object we can
103 | // find in the current environment.
104 | var obj = context.pop(), base;
105 |
106 | if (obj.type == "variable")
107 | base = obj.string;
108 | else if(obj.type == "variable-3")
109 | base = ":" + obj.string;
110 |
111 | while (base != null && context.length)
112 | base = base[context.pop().string];
113 | if (base != null) gatherCompletions(base);
114 | }
115 | return found;
116 | }
117 | })();
118 |
--------------------------------------------------------------------------------
/js/libs/addon/hint/python-hint.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | function forEach(arr, f) {
3 | for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
4 | }
5 |
6 | function arrayContains(arr, item) {
7 | if (!Array.prototype.indexOf) {
8 | var i = arr.length;
9 | while (i--) {
10 | if (arr[i] === item) {
11 | return true;
12 | }
13 | }
14 | return false;
15 | }
16 | return arr.indexOf(item) != -1;
17 | }
18 |
19 | function scriptHint(editor, _keywords, getToken) {
20 | // Find the token at the cursor
21 | var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
22 | // If it's not a 'word-style' token, ignore the token.
23 |
24 | if (!/^[\w$_]*$/.test(token.string)) {
25 | token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
26 | className: token.string == ":" ? "python-type" : null};
27 | }
28 |
29 | if (!context) var context = [];
30 | context.push(tprop);
31 |
32 | var completionList = getCompletions(token, context);
33 | completionList = completionList.sort();
34 | //prevent autocomplete for last word, instead show dropdown with one word
35 | if(completionList.length == 1) {
36 | completionList.push(" ");
37 | }
38 |
39 | return {list: completionList,
40 | from: CodeMirror.Pos(cur.line, token.start),
41 | to: CodeMirror.Pos(cur.line, token.end)};
42 | }
43 |
44 | CodeMirror.pythonHint = function(editor) {
45 | return scriptHint(editor, pythonKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
46 | };
47 |
48 | var pythonKeywords = "and del from not while as elif global or with assert else if pass yield"
49 | + "break except import print class exec in raise continue finally is return def for lambda try";
50 | var pythonKeywordsL = pythonKeywords.split(" ");
51 | var pythonKeywordsU = pythonKeywords.toUpperCase().split(" ");
52 |
53 | var pythonBuiltins = "abs divmod input open staticmethod all enumerate int ord str "
54 | + "any eval isinstance pow sum basestring execfile issubclass print super"
55 | + "bin file iter property tuple bool filter len range type"
56 | + "bytearray float list raw_input unichr callable format locals reduce unicode"
57 | + "chr frozenset long reload vars classmethod getattr map repr xrange"
58 | + "cmp globals max reversed zip compile hasattr memoryview round __import__"
59 | + "complex hash min set apply delattr help next setattr buffer"
60 | + "dict hex object slice coerce dir id oct sorted intern ";
61 | var pythonBuiltinsL = pythonBuiltins.split(" ").join("() ").split(" ");
62 | var pythonBuiltinsU = pythonBuiltins.toUpperCase().split(" ").join("() ").split(" ");
63 |
64 | function getCompletions(token, context) {
65 | var found = [], start = token.string;
66 | function maybeAdd(str) {
67 | if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
68 | }
69 |
70 | function gatherCompletions(_obj) {
71 | forEach(pythonBuiltinsL, maybeAdd);
72 | forEach(pythonBuiltinsU, maybeAdd);
73 | forEach(pythonKeywordsL, maybeAdd);
74 | forEach(pythonKeywordsU, maybeAdd);
75 | }
76 |
77 | if (context) {
78 | // If this is a property, see if it belongs to some object we can
79 | // find in the current environment.
80 | var obj = context.pop(), base;
81 |
82 | if (obj.type == "variable")
83 | base = obj.string;
84 | else if(obj.type == "variable-3")
85 | base = ":" + obj.string;
86 |
87 | while (base != null && context.length)
88 | base = base[context.pop().string];
89 | if (base != null) gatherCompletions(base);
90 | }
91 | return found;
92 | }
93 | })();
94 |
--------------------------------------------------------------------------------
/js/libs/addon/hint/show-hint.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-hints {
2 | position: absolute;
3 | z-index: 10;
4 | overflow: hidden;
5 | list-style: none;
6 |
7 | margin: 0;
8 | padding: 2px;
9 |
10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13 | border-radius: 3px;
14 | border: 1px solid silver;
15 |
16 | background: white;
17 | font-size: 90%;
18 | font-family: monospace;
19 |
20 | max-height: 20em;
21 | overflow-y: auto;
22 | }
23 |
24 | .CodeMirror-hint {
25 | margin: 0;
26 | padding: 0 4px;
27 | border-radius: 2px;
28 | max-width: 19em;
29 | overflow: hidden;
30 | white-space: pre;
31 | color: black;
32 | cursor: pointer;
33 | }
34 |
35 | .CodeMirror-hint-active {
36 | background: #08f;
37 | color: white;
38 | }
39 |
--------------------------------------------------------------------------------
/js/libs/addon/hint/xml-hint.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | CodeMirror.xmlHints = [];
4 |
5 | CodeMirror.xmlHint = function(cm) {
6 |
7 | var cursor = cm.getCursor();
8 |
9 | if (cursor.ch > 0) {
10 |
11 | var text = cm.getRange(CodeMirror.Pos(0, 0), cursor);
12 | var typed = '';
13 | var simbol = '';
14 | for(var i = text.length - 1; i >= 0; i--) {
15 | if(text[i] == ' ' || text[i] == '<') {
16 | simbol = text[i];
17 | break;
18 | }
19 | else {
20 | typed = text[i] + typed;
21 | }
22 | }
23 |
24 | text = text.slice(0, text.length - typed.length);
25 |
26 | var path = getActiveElement(text) + simbol;
27 | var hints = CodeMirror.xmlHints[path];
28 |
29 | if(typeof hints === 'undefined')
30 | hints = [''];
31 | else {
32 | hints = hints.slice(0);
33 | for (var i = hints.length - 1; i >= 0; i--) {
34 | if(hints[i].indexOf(typed) != 0)
35 | hints.splice(i, 1);
36 | }
37 | }
38 |
39 | return {
40 | list: hints,
41 | from: CodeMirror.Pos(cursor.line, cursor.ch - typed.length),
42 | to: cursor
43 | };
44 | }
45 | };
46 |
47 | var getActiveElement = function(text) {
48 |
49 | var element = '';
50 |
51 | if(text.length >= 0) {
52 |
53 | var regex = new RegExp('<([^!?][^\\s/>]*)[\\s\\S]*?>', 'g');
54 |
55 | var matches = [];
56 | var match;
57 | while ((match = regex.exec(text)) != null) {
58 | matches.push({
59 | tag: match[1],
60 | selfclose: (match[0].slice(match[0].length - 2) === '/>')
61 | });
62 | }
63 |
64 | for (var i = matches.length - 1, skip = 0; i >= 0; i--) {
65 |
66 | var item = matches[i];
67 |
68 | if (item.tag[0] == '/')
69 | {
70 | skip++;
71 | }
72 | else if (item.selfclose == false)
73 | {
74 | if (skip > 0)
75 | {
76 | skip--;
77 | }
78 | else
79 | {
80 | element = '<' + item.tag + '>' + element;
81 | }
82 | }
83 | }
84 |
85 | element += getOpenTag(text);
86 | }
87 |
88 | return element;
89 | };
90 |
91 | var getOpenTag = function(text) {
92 |
93 | var open = text.lastIndexOf('<');
94 | var close = text.lastIndexOf('>');
95 |
96 | if (close < open)
97 | {
98 | text = text.slice(open);
99 |
100 | if(text != '<') {
101 |
102 | var space = text.indexOf(' ');
103 | if(space < 0)
104 | space = text.indexOf('\t');
105 | if(space < 0)
106 | space = text.indexOf('\n');
107 |
108 | if (space < 0)
109 | space = text.length;
110 |
111 | return text.slice(0, space);
112 | }
113 | }
114 |
115 | return '';
116 | };
117 |
118 | })();
119 |
--------------------------------------------------------------------------------
/js/libs/addon/lint/javascript-lint.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | var bogus = [ "Dangerous comment" ];
4 |
5 | var warnings = [ [ "Expected '{'",
6 | "Statement body should be inside '{ }' braces." ] ];
7 |
8 | var errors = [ "Missing semicolon", "Extra comma", "Missing property name",
9 | "Unmatched ", " and instead saw", " is not defined",
10 | "Unclosed string", "Stopping, unable to continue" ];
11 |
12 | function validator(options, text) {
13 | JSHINT(text, options);
14 | var errors = JSHINT.data().errors, result = [];
15 | if (errors) parseErrors(errors, result);
16 | return result;
17 | }
18 |
19 | CodeMirror.javascriptValidatorWithOptions = function(options) {
20 | return function(text) { return validator(options, text); };
21 | };
22 |
23 | CodeMirror.javascriptValidator = CodeMirror.javascriptValidatorWithOptions(null);
24 |
25 | function cleanup(error) {
26 | // All problems are warnings by default
27 | fixWith(error, warnings, "warning", true);
28 | fixWith(error, errors, "error");
29 |
30 | return isBogus(error) ? null : error;
31 | }
32 |
33 | function fixWith(error, fixes, severity, force) {
34 | var description, fix, find, replace, found;
35 |
36 | description = error.description;
37 |
38 | for ( var i = 0; i < fixes.length; i++) {
39 | fix = fixes[i];
40 | find = (typeof fix === "string" ? fix : fix[0]);
41 | replace = (typeof fix === "string" ? null : fix[1]);
42 | found = description.indexOf(find) !== -1;
43 |
44 | if (force || found) {
45 | error.severity = severity;
46 | }
47 | if (found && replace) {
48 | error.description = replace;
49 | }
50 | }
51 | }
52 |
53 | function isBogus(error) {
54 | var description = error.description;
55 | for ( var i = 0; i < bogus.length; i++) {
56 | if (description.indexOf(bogus[i]) !== -1) {
57 | return true;
58 | }
59 | }
60 | return false;
61 | }
62 |
63 | function parseErrors(errors, output) {
64 | for ( var i = 0; i < errors.length; i++) {
65 | var error = errors[i];
66 | if (error) {
67 | var linetabpositions, index;
68 |
69 | linetabpositions = [];
70 |
71 | // This next block is to fix a problem in jshint. Jshint
72 | // replaces
73 | // all tabs with spaces then performs some checks. The error
74 | // positions (character/space) are then reported incorrectly,
75 | // not taking the replacement step into account. Here we look
76 | // at the evidence line and try to adjust the character position
77 | // to the correct value.
78 | if (error.evidence) {
79 | // Tab positions are computed once per line and cached
80 | var tabpositions = linetabpositions[error.line];
81 | if (!tabpositions) {
82 | var evidence = error.evidence;
83 | tabpositions = [];
84 | // ugggh phantomjs does not like this
85 | // forEachChar(evidence, function(item, index) {
86 | Array.prototype.forEach.call(evidence, function(item,
87 | index) {
88 | if (item === '\t') {
89 | // First col is 1 (not 0) to match error
90 | // positions
91 | tabpositions.push(index + 1);
92 | }
93 | });
94 | linetabpositions[error.line] = tabpositions;
95 | }
96 | if (tabpositions.length > 0) {
97 | var pos = error.character;
98 | tabpositions.forEach(function(tabposition) {
99 | if (pos > tabposition) pos -= 1;
100 | });
101 | error.character = pos;
102 | }
103 | }
104 |
105 | var start = error.character - 1, end = start + 1;
106 | if (error.evidence) {
107 | index = error.evidence.substring(start).search(/.\b/);
108 | if (index > -1) {
109 | end += index;
110 | }
111 | }
112 |
113 | // Convert to format expected by validation service
114 | error.description = error.reason;// + "(jshint)";
115 | error.start = error.character;
116 | error.end = end;
117 | error = cleanup(error);
118 |
119 | if (error)
120 | output.push({message: error.description,
121 | severity: error.severity,
122 | from: CodeMirror.Pos(error.line - 1, start),
123 | to: CodeMirror.Pos(error.line - 1, end)});
124 | }
125 | }
126 | }
127 | })();
128 |
--------------------------------------------------------------------------------
/js/libs/addon/lint/json-lint.js:
--------------------------------------------------------------------------------
1 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint
2 |
3 | CodeMirror.jsonValidator = function(text) {
4 | var found = [];
5 | jsonlint.parseError = function(str, hash) {
6 | var loc = hash.loc;
7 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
8 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
9 | message: str});
10 | };
11 | try { jsonlint.parse(text); }
12 | catch(e) {}
13 | return found;
14 | };
15 |
--------------------------------------------------------------------------------
/js/libs/addon/lint/lint.css:
--------------------------------------------------------------------------------
1 | /* The lint marker gutter */
2 | .CodeMirror-lint-markers {
3 | width: 16px;
4 | }
5 |
6 | .CodeMirror-lint-tooltip {
7 | background-color: infobackground;
8 | border: 1px solid black;
9 | border-radius: 4px 4px 4px 4px;
10 | color: infotext;
11 | font-family: monospace;
12 | font-size: 10pt;
13 | overflow: hidden;
14 | padding: 2px 5px;
15 | position: fixed;
16 | white-space: pre;
17 | z-index: 100;
18 | max-width: 600px;
19 | opacity: 0;
20 | transition: opacity .4s;
21 | -moz-transition: opacity .4s;
22 | -webkit-transition: opacity .4s;
23 | -o-transition: opacity .4s;
24 | -ms-transition: opacity .4s;
25 | }
26 |
27 | .CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
28 | background-position: left bottom;
29 | background-repeat: repeat-x;
30 | }
31 |
32 | .CodeMirror-lint-mark-error {
33 | background-image:
34 | url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
35 | ;
36 | }
37 |
38 | .CodeMirror-lint-mark-warning {
39 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
40 | }
41 |
42 | .CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
43 | background-position: center center;
44 | background-repeat: no-repeat;
45 | cursor: pointer;
46 | display: inline-block;
47 | height: 16px;
48 | width: 16px;
49 | vertical-align: middle;
50 | position: relative;
51 | }
52 |
53 | .CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
54 | padding-left: 18px;
55 | background-position: top left;
56 | background-repeat: no-repeat;
57 | }
58 |
59 | .CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
60 | background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZ+wJJwSCwaScgkySgkjTQZTkYzWhadnE5oE+pwqkSshwQqkzxfa4kkQXxEpA9J9EFI1KQGQQBAigYCBA14ExEWF0gXihETeA0QD3AkD5QQg0NsDnAJmwkOd5gYFSQKpXAFDBhqaxgLBwQBBAapq00YEg0UDRKqTGtKSL7Cw8JBADs=");
61 | }
62 |
63 | .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
64 | background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAP7bc//egf/ij/7ijv/jl/7kl//mnv7lnv/uwf7CTP7DTf7DT/7IW//Na/7Na//NbP7QdP/dmbltAIJNAF03AMSAJMSCLKqASa2DS6uBSquCSrGHTq6ETbCHT7WKUrKIUcCVXL+UXMOYX8GWXsSZYMiib6+ETbOIUcOXX86uhd3Muf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACsALAAAAAAQABAAAAZowJVwSCwaj0ihikRSJYcoBEL0XKlGkcjImQQhJBREKFnyICoThKeE/AAW6AXgdPyUAgrLJBEo0YsbAQyDhAEdRRwDDw8OaA4NDQImRBgFEJdglxAEGEQZKQcHBqOkKRpFF6mqq1WtrUEAOw==");
65 | }
66 |
67 | .CodeMirror-lint-marker-multiple {
68 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEAQvB2JVdrAAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAD1JREFUCNdtjkESADAEAzemf69f66HMqGlOIhYiFRFRtSQBWAY7mzx+EDTL6sSgb1jTk7Q87rxyqe37fXsAa78gLyZnRgEAAAAASUVORK5CYII=");
69 | background-repeat: no-repeat;
70 | background-position: right bottom;
71 | width: 100%; height: 100%;
72 | }
73 |
74 | /* Styles for the overview ruler
75 | .annotationOverview {
76 | cursor: pointer;
77 | border-radius: 2px;
78 | left: 2px;
79 | width: 8px;
80 | }
81 | .annotationOverview.error {
82 | background-color: lightcoral;
83 | border: 1px solid darkred;
84 | }
85 | .annotationOverview.warning {
86 | background-color: Gold;
87 | border: 1px solid black;
88 | }
89 |
90 | .annotationHTML.overlay {
91 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEAQvB2JVdrAAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAD1JREFUCNdtjkESADAEAzemf69f66HMqGlOIhYiFRFRtSQBWAY7mzx+EDTL6sSgb1jTk7Q87rxyqe37fXsAa78gLyZnRgEAAAAASUVORK5CYII=");
92 | background-position: right bottom;
93 | position: relative;
94 | top: -16px;
95 | }
96 | */
--------------------------------------------------------------------------------
/js/libs/addon/mode/loadmode.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
3 |
4 | var loading = {};
5 | function splitCallback(cont, n) {
6 | var countDown = n;
7 | return function() { if (--countDown == 0) cont(); };
8 | }
9 | function ensureDeps(mode, cont) {
10 | var deps = CodeMirror.modes[mode].dependencies;
11 | if (!deps) return cont();
12 | var missing = [];
13 | for (var i = 0; i < deps.length; ++i) {
14 | if (!CodeMirror.modes.hasOwnProperty(deps[i]))
15 | missing.push(deps[i]);
16 | }
17 | if (!missing.length) return cont();
18 | var split = splitCallback(cont, missing.length);
19 | for (var i = 0; i < missing.length; ++i)
20 | CodeMirror.requireMode(missing[i], split);
21 | }
22 |
23 | CodeMirror.requireMode = function(mode, cont) {
24 | if (typeof mode != "string") mode = mode.name;
25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
27 |
28 | var script = document.createElement("script");
29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode);
30 | var others = document.getElementsByTagName("script")[0];
31 | others.parentNode.insertBefore(script, others);
32 | var list = loading[mode] = [cont];
33 | var count = 0, poll = setInterval(function() {
34 | if (++count > 100) return clearInterval(poll);
35 | if (CodeMirror.modes.hasOwnProperty(mode)) {
36 | clearInterval(poll);
37 | loading[mode] = null;
38 | ensureDeps(mode, function() {
39 | for (var i = 0; i < list.length; ++i) list[i]();
40 | });
41 | }
42 | }, 200);
43 | };
44 |
45 | CodeMirror.autoLoadMode = function(instance, mode) {
46 | if (!CodeMirror.modes.hasOwnProperty(mode))
47 | CodeMirror.requireMode(mode, function() {
48 | instance.setOption("mode", instance.getOption("mode"));
49 | });
50 | };
51 | }());
52 |
--------------------------------------------------------------------------------
/js/libs/addon/mode/multiplex.js:
--------------------------------------------------------------------------------
1 | CodeMirror.multiplexingMode = function(outer /*, others */) {
2 | // Others should be {open, close, mode [, delimStyle]} objects
3 | var others = Array.prototype.slice.call(arguments, 1);
4 | var n_others = others.length;
5 |
6 | function indexOf(string, pattern, from) {
7 | if (typeof pattern == "string") return string.indexOf(pattern, from);
8 | var m = pattern.exec(from ? string.slice(from) : string);
9 | return m ? m.index + from : -1;
10 | }
11 |
12 | return {
13 | startState: function() {
14 | return {
15 | outer: CodeMirror.startState(outer),
16 | innerActive: null,
17 | inner: null
18 | };
19 | },
20 |
21 | copyState: function(state) {
22 | return {
23 | outer: CodeMirror.copyState(outer, state.outer),
24 | innerActive: state.innerActive,
25 | inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
26 | };
27 | },
28 |
29 | token: function(stream, state) {
30 | if (!state.innerActive) {
31 | var cutOff = Infinity, oldContent = stream.string;
32 | for (var i = 0; i < n_others; ++i) {
33 | var other = others[i];
34 | var found = indexOf(oldContent, other.open, stream.pos);
35 | if (found == stream.pos) {
36 | stream.match(other.open);
37 | state.innerActive = other;
38 | state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
39 | return other.delimStyle;
40 | } else if (found != -1 && found < cutOff) {
41 | cutOff = found;
42 | }
43 | }
44 | if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
45 | var outerToken = outer.token(stream, state.outer);
46 | if (cutOff != Infinity) stream.string = oldContent;
47 | return outerToken;
48 | } else {
49 | var curInner = state.innerActive, oldContent = stream.string;
50 | var found = indexOf(oldContent, curInner.close, stream.pos);
51 | if (found == stream.pos) {
52 | stream.match(curInner.close);
53 | state.innerActive = state.inner = null;
54 | return curInner.delimStyle;
55 | }
56 | if (found > -1) stream.string = oldContent.slice(0, found);
57 | var innerToken = curInner.mode.token(stream, state.inner);
58 | if (found > -1) stream.string = oldContent;
59 | var cur = stream.current(), found = cur.indexOf(curInner.close);
60 | if (found > -1) stream.backUp(cur.length - found);
61 | return innerToken;
62 | }
63 | },
64 |
65 | indent: function(state, textAfter) {
66 | var mode = state.innerActive ? state.innerActive.mode : outer;
67 | if (!mode.indent) return CodeMirror.Pass;
68 | return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
69 | },
70 |
71 | blankLine: function(state) {
72 | var mode = state.innerActive ? state.innerActive.mode : outer;
73 | if (mode.blankLine) {
74 | mode.blankLine(state.innerActive ? state.inner : state.outer);
75 | }
76 | if (!state.innerActive) {
77 | for (var i = 0; i < n_others; ++i) {
78 | var other = others[i];
79 | if (other.open === "\n") {
80 | state.innerActive = other;
81 | state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "") : 0);
82 | }
83 | }
84 | } else if (state.innerActive.close === "\n") {
85 | state.innerActive = state.inner = null;
86 | }
87 | },
88 |
89 | electricChars: outer.electricChars,
90 |
91 | innerMode: function(state) {
92 | return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
93 | }
94 | };
95 | };
96 |
--------------------------------------------------------------------------------
/js/libs/addon/mode/overlay.js:
--------------------------------------------------------------------------------
1 | // Utility function that allows modes to be combined. The mode given
2 | // as the base argument takes care of most of the normal mode
3 | // functionality, but a second (typically simple) mode is used, which
4 | // can override the style of text. Both modes get to parse all of the
5 | // text, but when both assign a non-null style to a piece of code, the
6 | // overlay wins, unless the combine argument was true, in which case
7 | // the styles are combined.
8 |
9 | // overlayParser is the old, deprecated name
10 | CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) {
11 | return {
12 | startState: function() {
13 | return {
14 | base: CodeMirror.startState(base),
15 | overlay: CodeMirror.startState(overlay),
16 | basePos: 0, baseCur: null,
17 | overlayPos: 0, overlayCur: null
18 | };
19 | },
20 | copyState: function(state) {
21 | return {
22 | base: CodeMirror.copyState(base, state.base),
23 | overlay: CodeMirror.copyState(overlay, state.overlay),
24 | basePos: state.basePos, baseCur: null,
25 | overlayPos: state.overlayPos, overlayCur: null
26 | };
27 | },
28 |
29 | token: function(stream, state) {
30 | if (stream.start == state.basePos) {
31 | state.baseCur = base.token(stream, state.base);
32 | state.basePos = stream.pos;
33 | }
34 | if (stream.start == state.overlayPos) {
35 | stream.pos = stream.start;
36 | state.overlayCur = overlay.token(stream, state.overlay);
37 | state.overlayPos = stream.pos;
38 | }
39 | stream.pos = Math.min(state.basePos, state.overlayPos);
40 | if (stream.eol()) state.basePos = state.overlayPos = 0;
41 |
42 | if (state.overlayCur == null) return state.baseCur;
43 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
44 | else return state.overlayCur;
45 | },
46 |
47 | indent: base.indent && function(state, textAfter) {
48 | return base.indent(state.base, textAfter);
49 | },
50 | electricChars: base.electricChars,
51 |
52 | innerMode: function(state) { return {state: state.base, mode: base}; },
53 |
54 | blankLine: function(state) {
55 | if (base.blankLine) base.blankLine(state.base);
56 | if (overlay.blankLine) overlay.blankLine(state.overlay);
57 | }
58 | };
59 | };
60 |
--------------------------------------------------------------------------------
/js/libs/addon/runmode/colorize.js:
--------------------------------------------------------------------------------
1 | CodeMirror.colorize = (function() {
2 |
3 | var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
4 |
5 | function textContent(node, out) {
6 | if (node.nodeType == 3) return out.push(node.nodeValue);
7 | for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
8 | textContent(ch, out);
9 | if (isBlock.test(node.nodeType)) out.push("\n");
10 | }
11 | }
12 |
13 | return function(collection, defaultMode) {
14 | if (!collection) collection = document.body.getElementsByTagName("pre");
15 |
16 | for (var i = 0; i < collection.length; ++i) {
17 | var node = collection[i];
18 | var mode = node.getAttribute("data-lang") || defaultMode;
19 | if (!mode) continue;
20 |
21 | var text = [];
22 | textContent(node, text);
23 | node.innerHTML = "";
24 | CodeMirror.runMode(text.join(""), mode, node);
25 |
26 | node.className += " cm-s-default";
27 | }
28 | };
29 | })();
30 |
--------------------------------------------------------------------------------
/js/libs/addon/runmode/runmode-standalone.js:
--------------------------------------------------------------------------------
1 | /* Just enough of CodeMirror to run runMode under node.js */
2 |
3 | window.CodeMirror = {};
4 |
5 | function splitLines(string){ return string.split(/\r?\n|\r/); };
6 |
7 | function StringStream(string) {
8 | this.pos = this.start = 0;
9 | this.string = string;
10 | }
11 | StringStream.prototype = {
12 | eol: function() {return this.pos >= this.string.length;},
13 | sol: function() {return this.pos == 0;},
14 | peek: function() {return this.string.charAt(this.pos) || null;},
15 | next: function() {
16 | if (this.pos < this.string.length)
17 | return this.string.charAt(this.pos++);
18 | },
19 | eat: function(match) {
20 | var ch = this.string.charAt(this.pos);
21 | if (typeof match == "string") var ok = ch == match;
22 | else var ok = ch && (match.test ? match.test(ch) : match(ch));
23 | if (ok) {++this.pos; return ch;}
24 | },
25 | eatWhile: function(match) {
26 | var start = this.pos;
27 | while (this.eat(match)){}
28 | return this.pos > start;
29 | },
30 | eatSpace: function() {
31 | var start = this.pos;
32 | while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
33 | return this.pos > start;
34 | },
35 | skipToEnd: function() {this.pos = this.string.length;},
36 | skipTo: function(ch) {
37 | var found = this.string.indexOf(ch, this.pos);
38 | if (found > -1) {this.pos = found; return true;}
39 | },
40 | backUp: function(n) {this.pos -= n;},
41 | column: function() {return this.start;},
42 | indentation: function() {return 0;},
43 | match: function(pattern, consume, caseInsensitive) {
44 | if (typeof pattern == "string") {
45 | var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
46 | if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
47 | if (consume !== false) this.pos += pattern.length;
48 | return true;
49 | }
50 | } else {
51 | var match = this.string.slice(this.pos).match(pattern);
52 | if (match && consume !== false) this.pos += match[0].length;
53 | return match;
54 | }
55 | },
56 | current: function(){return this.string.slice(this.start, this.pos);}
57 | };
58 | CodeMirror.StringStream = StringStream;
59 |
60 | CodeMirror.startState = function (mode, a1, a2) {
61 | return mode.startState ? mode.startState(a1, a2) : true;
62 | };
63 |
64 | var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
65 | CodeMirror.defineMode = function (name, mode) { modes[name] = mode; };
66 | CodeMirror.defineMIME = function (mime, spec) { mimeModes[mime] = spec; };
67 | CodeMirror.getMode = function (options, spec) {
68 | if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
69 | spec = mimeModes[spec];
70 | if (typeof spec == "string")
71 | var mname = spec, config = {};
72 | else if (spec != null)
73 | var mname = spec.name, config = spec;
74 | var mfactory = modes[mname];
75 | if (!mfactory) throw new Error("Unknown mode: " + spec);
76 | return mfactory(options, config || {});
77 | };
78 |
79 | CodeMirror.runMode = function (string, modespec, callback, options) {
80 | var mode = CodeMirror.getMode({ indentUnit: 2 }, modespec);
81 |
82 | if (callback.nodeType == 1) {
83 | var tabSize = (options && options.tabSize) || 4;
84 | var node = callback, col = 0;
85 | node.innerHTML = "";
86 | callback = function (text, style) {
87 | if (text == "\n") {
88 | node.appendChild(document.createElement("br"));
89 | col = 0;
90 | return;
91 | }
92 | var content = "";
93 | // replace tabs
94 | for (var pos = 0; ;) {
95 | var idx = text.indexOf("\t", pos);
96 | if (idx == -1) {
97 | content += text.slice(pos);
98 | col += text.length - pos;
99 | break;
100 | } else {
101 | col += idx - pos;
102 | content += text.slice(pos, idx);
103 | var size = tabSize - col % tabSize;
104 | col += size;
105 | for (var i = 0; i < size; ++i) content += " ";
106 | pos = idx + 1;
107 | }
108 | }
109 |
110 | if (style) {
111 | var sp = node.appendChild(document.createElement("span"));
112 | sp.className = "cm-" + style.replace(/ +/g, " cm-");
113 | sp.appendChild(document.createTextNode(content));
114 | } else {
115 | node.appendChild(document.createTextNode(content));
116 | }
117 | };
118 | }
119 |
120 | var lines = splitLines(string), state = CodeMirror.startState(mode);
121 | for (var i = 0, e = lines.length; i < e; ++i) {
122 | if (i) callback("\n");
123 | var stream = new CodeMirror.StringStream(lines[i]);
124 | while (!stream.eol()) {
125 | var style = mode.token(stream, state);
126 | callback(stream.current(), style, i, stream.start);
127 | stream.start = stream.pos;
128 | }
129 | }
130 | };
131 |
--------------------------------------------------------------------------------
/js/libs/addon/runmode/runmode.js:
--------------------------------------------------------------------------------
1 | CodeMirror.runMode = function(string, modespec, callback, options) {
2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
3 | var ie = /MSIE \d/.test(navigator.userAgent);
4 | var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
5 |
6 | if (callback.nodeType == 1) {
7 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
8 | var node = callback, col = 0;
9 | node.innerHTML = "";
10 | callback = function(text, style) {
11 | if (text == "\n") {
12 | // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
13 | // Emitting a carriage return makes everything ok.
14 | node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
15 | col = 0;
16 | return;
17 | }
18 | var content = "";
19 | // replace tabs
20 | for (var pos = 0;;) {
21 | var idx = text.indexOf("\t", pos);
22 | if (idx == -1) {
23 | content += text.slice(pos);
24 | col += text.length - pos;
25 | break;
26 | } else {
27 | col += idx - pos;
28 | content += text.slice(pos, idx);
29 | var size = tabSize - col % tabSize;
30 | col += size;
31 | for (var i = 0; i < size; ++i) content += " ";
32 | pos = idx + 1;
33 | }
34 | }
35 |
36 | if (style) {
37 | var sp = node.appendChild(document.createElement("span"));
38 | sp.className = "cm-" + style.replace(/ +/g, " cm-");
39 | sp.appendChild(document.createTextNode(content));
40 | } else {
41 | node.appendChild(document.createTextNode(content));
42 | }
43 | };
44 | }
45 |
46 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
47 | for (var i = 0, e = lines.length; i < e; ++i) {
48 | if (i) callback("\n");
49 | var stream = new CodeMirror.StringStream(lines[i]);
50 | while (!stream.eol()) {
51 | var style = mode.token(stream, state);
52 | callback(stream.current(), style, i, stream.start);
53 | stream.start = stream.pos;
54 | }
55 | }
56 | };
57 |
--------------------------------------------------------------------------------
/js/libs/addon/runmode/runmode.node.js:
--------------------------------------------------------------------------------
1 | /* Just enough of CodeMirror to run runMode under node.js */
2 |
3 | function splitLines(string){ return string.split(/\r?\n|\r/); };
4 |
5 | function StringStream(string) {
6 | this.pos = this.start = 0;
7 | this.string = string;
8 | }
9 | StringStream.prototype = {
10 | eol: function() {return this.pos >= this.string.length;},
11 | sol: function() {return this.pos == 0;},
12 | peek: function() {return this.string.charAt(this.pos) || null;},
13 | next: function() {
14 | if (this.pos < this.string.length)
15 | return this.string.charAt(this.pos++);
16 | },
17 | eat: function(match) {
18 | var ch = this.string.charAt(this.pos);
19 | if (typeof match == "string") var ok = ch == match;
20 | else var ok = ch && (match.test ? match.test(ch) : match(ch));
21 | if (ok) {++this.pos; return ch;}
22 | },
23 | eatWhile: function(match) {
24 | var start = this.pos;
25 | while (this.eat(match)){}
26 | return this.pos > start;
27 | },
28 | eatSpace: function() {
29 | var start = this.pos;
30 | while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
31 | return this.pos > start;
32 | },
33 | skipToEnd: function() {this.pos = this.string.length;},
34 | skipTo: function(ch) {
35 | var found = this.string.indexOf(ch, this.pos);
36 | if (found > -1) {this.pos = found; return true;}
37 | },
38 | backUp: function(n) {this.pos -= n;},
39 | column: function() {return this.start;},
40 | indentation: function() {return 0;},
41 | match: function(pattern, consume, caseInsensitive) {
42 | if (typeof pattern == "string") {
43 | var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
44 | if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
45 | if (consume !== false) this.pos += pattern.length;
46 | return true;
47 | }
48 | } else {
49 | var match = this.string.slice(this.pos).match(pattern);
50 | if (match && consume !== false) this.pos += match[0].length;
51 | return match;
52 | }
53 | },
54 | current: function(){return this.string.slice(this.start, this.pos);}
55 | };
56 | exports.StringStream = StringStream;
57 |
58 | exports.startState = function(mode, a1, a2) {
59 | return mode.startState ? mode.startState(a1, a2) : true;
60 | };
61 |
62 | var modes = exports.modes = {}, mimeModes = exports.mimeModes = {};
63 | exports.defineMode = function(name, mode) {
64 | if (arguments.length > 2) {
65 | mode.dependencies = [];
66 | for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
67 | }
68 | modes[name] = mode;
69 | };
70 | exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
71 |
72 | exports.defineMode("null", function() {
73 | return {token: function(stream) {stream.skipToEnd();}};
74 | });
75 | exports.defineMIME("text/plain", "null");
76 |
77 | exports.getMode = function(options, spec) {
78 | if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
79 | spec = mimeModes[spec];
80 | if (typeof spec == "string")
81 | var mname = spec, config = {};
82 | else if (spec != null)
83 | var mname = spec.name, config = spec;
84 | var mfactory = modes[mname];
85 | if (!mfactory) throw new Error("Unknown mode: " + spec);
86 | return mfactory(options, config || {});
87 | };
88 |
89 | exports.runMode = function(string, modespec, callback) {
90 | var mode = exports.getMode({indentUnit: 2}, modespec);
91 | var lines = splitLines(string), state = exports.startState(mode);
92 | for (var i = 0, e = lines.length; i < e; ++i) {
93 | if (i) callback("\n");
94 | var stream = new exports.StringStream(lines[i]);
95 | while (!stream.eol()) {
96 | var style = mode.token(stream, state);
97 | callback(stream.current(), style, i, stream.start);
98 | stream.start = stream.pos;
99 | }
100 | }
101 | };
102 |
--------------------------------------------------------------------------------
/js/libs/addon/search/match-highlighter.js:
--------------------------------------------------------------------------------
1 | // Highlighting text that matches the selection
2 | //
3 | // Defines an option highlightSelectionMatches, which, when enabled,
4 | // will style strings that match the selection throughout the
5 | // document.
6 | //
7 | // The option can be set to true to simply enable it, or to a
8 | // {minChars, style} object to explicitly configure it. minChars is
9 | // the minimum amount of characters that should be selected for the
10 | // behavior to occur, and style is the token style to apply to the
11 | // matches. This will be prefixed by "cm-" to create an actual CSS
12 | // class name.
13 |
14 | (function() {
15 | var DEFAULT_MIN_CHARS = 2;
16 | var DEFAULT_TOKEN_STYLE = "matchhighlight";
17 |
18 | function State(options) {
19 | this.minChars = typeof options == "object" && options.minChars || DEFAULT_MIN_CHARS;
20 | this.style = typeof options == "object" && options.style || DEFAULT_TOKEN_STYLE;
21 | this.overlay = null;
22 | }
23 |
24 | CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
25 | var prev = old && old != CodeMirror.Init;
26 | if (val && !prev) {
27 | cm.state.matchHighlighter = new State(val);
28 | cm.on("cursorActivity", highlightMatches);
29 | } else if (!val && prev) {
30 | var over = cm.state.matchHighlighter.overlay;
31 | if (over) cm.removeOverlay(over);
32 | cm.state.matchHighlighter = null;
33 | cm.off("cursorActivity", highlightMatches);
34 | }
35 | });
36 |
37 | function highlightMatches(cm) {
38 | cm.operation(function() {
39 | var state = cm.state.matchHighlighter;
40 | if (state.overlay) {
41 | cm.removeOverlay(state.overlay);
42 | state.overlay = null;
43 | }
44 |
45 | if (!cm.somethingSelected()) return;
46 | var selection = cm.getSelection().replace(/^\s+|\s+$/g, "");
47 | if (selection.length < state.minChars) return;
48 |
49 | cm.addOverlay(state.overlay = makeOverlay(selection, state.style));
50 | });
51 | }
52 |
53 | function makeOverlay(query, style) {
54 | return {token: function(stream) {
55 | if (stream.match(query)) return style;
56 | stream.next();
57 | stream.skipTo(query.charAt(0)) || stream.skipToEnd();
58 | }};
59 | }
60 | })();
61 |
--------------------------------------------------------------------------------
/js/libs/addon/search/search.js:
--------------------------------------------------------------------------------
1 | // Define search commands. Depends on dialog.js or another
2 | // implementation of the openDialog method.
3 |
4 | // Replace works a little oddly -- it will do the replace on the next
5 | // Ctrl-G (or whatever is bound to findNext) press. You prevent a
6 | // replace by making sure the match is no longer selected when hitting
7 | // Ctrl-G.
8 |
9 | (function() {
10 | function searchOverlay(query) {
11 | if (typeof query == "string") return {token: function(stream) {
12 | if (stream.match(query)) return "searching";
13 | stream.next();
14 | stream.skipTo(query.charAt(0)) || stream.skipToEnd();
15 | }};
16 | return {token: function(stream) {
17 | if (stream.match(query)) return "searching";
18 | while (!stream.eol()) {
19 | stream.next();
20 | if (stream.match(query, false)) break;
21 | }
22 | }};
23 | }
24 |
25 | function SearchState() {
26 | this.posFrom = this.posTo = this.query = null;
27 | this.overlay = null;
28 | }
29 | function getSearchState(cm) {
30 | return cm.state.search || (cm.state.search = new SearchState());
31 | }
32 | function getSearchCursor(cm, query, pos) {
33 | // Heuristic: if the query string is all lowercase, do a case insensitive search.
34 | return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase());
35 | }
36 | function dialog(cm, text, shortText, f) {
37 | if (cm.openDialog) cm.openDialog(text, f);
38 | else f(prompt(shortText, ""));
39 | }
40 | function confirmDialog(cm, text, shortText, fs) {
41 | if (cm.openConfirm) cm.openConfirm(text, fs);
42 | else if (confirm(shortText)) fs[0]();
43 | }
44 | function parseQuery(query) {
45 | var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
46 | return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query;
47 | }
48 | var queryDialog =
49 | 'Search: (Use /re/ syntax for regexp search) ';
50 | function doSearch(cm, rev) {
51 | var state = getSearchState(cm);
52 | if (state.query) return findNext(cm, rev);
53 | dialog(cm, queryDialog, "Search for:", function(query) {
54 | cm.operation(function() {
55 | if (!query || state.query) return;
56 | state.query = parseQuery(query);
57 | cm.removeOverlay(state.overlay);
58 | state.overlay = searchOverlay(query);
59 | cm.addOverlay(state.overlay);
60 | state.posFrom = state.posTo = cm.getCursor();
61 | findNext(cm, rev);
62 | });
63 | });
64 | }
65 | function findNext(cm, rev) {cm.operation(function() {
66 | var state = getSearchState(cm);
67 | var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
68 | if (!cursor.find(rev)) {
69 | cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
70 | if (!cursor.find(rev)) return;
71 | }
72 | cm.setSelection(cursor.from(), cursor.to());
73 | state.posFrom = cursor.from(); state.posTo = cursor.to();
74 | });}
75 | function clearSearch(cm) {cm.operation(function() {
76 | var state = getSearchState(cm);
77 | if (!state.query) return;
78 | state.query = null;
79 | cm.removeOverlay(state.overlay);
80 | });}
81 |
82 | var replaceQueryDialog =
83 | 'Replace: (Use /re/ syntax for regexp search) ';
84 | var replacementQueryDialog = 'With: ';
85 | var doReplaceConfirm = "Replace? Yes No Stop ";
86 | function replace(cm, all) {
87 | dialog(cm, replaceQueryDialog, "Replace:", function(query) {
88 | if (!query) return;
89 | query = parseQuery(query);
90 | dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
91 | if (all) {
92 | cm.operation(function() {
93 | for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
94 | if (typeof query != "string") {
95 | var match = cm.getRange(cursor.from(), cursor.to()).match(query);
96 | cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];}));
97 | } else cursor.replace(text);
98 | }
99 | });
100 | } else {
101 | clearSearch(cm);
102 | var cursor = getSearchCursor(cm, query, cm.getCursor());
103 | var advance = function() {
104 | var start = cursor.from(), match;
105 | if (!(match = cursor.findNext())) {
106 | cursor = getSearchCursor(cm, query);
107 | if (!(match = cursor.findNext()) ||
108 | (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
109 | }
110 | cm.setSelection(cursor.from(), cursor.to());
111 | confirmDialog(cm, doReplaceConfirm, "Replace?",
112 | [function() {doReplace(match);}, advance]);
113 | };
114 | var doReplace = function(match) {
115 | cursor.replace(typeof query == "string" ? text :
116 | text.replace(/\$(\d)/, function(_, i) {return match[i];}));
117 | advance();
118 | };
119 | advance();
120 | }
121 | });
122 | });
123 | }
124 |
125 | CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
126 | CodeMirror.commands.findNext = doSearch;
127 | CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
128 | CodeMirror.commands.clearSearch = clearSearch;
129 | CodeMirror.commands.replace = replace;
130 | CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
131 | })();
132 |
--------------------------------------------------------------------------------
/js/libs/addon/search/searchcursor.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | var Pos = CodeMirror.Pos;
3 |
4 | function SearchCursor(doc, query, pos, caseFold) {
5 | this.atOccurrence = false; this.doc = doc;
6 | if (caseFold == null && typeof query == "string") caseFold = false;
7 |
8 | pos = pos ? doc.clipPos(pos) : Pos(0, 0);
9 | this.pos = {from: pos, to: pos};
10 |
11 | // The matches method is filled in based on the type of query.
12 | // It takes a position and a direction, and returns an object
13 | // describing the next occurrence of the query, or null if no
14 | // more matches were found.
15 | if (typeof query != "string") { // Regexp match
16 | if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g");
17 | this.matches = function(reverse, pos) {
18 | if (reverse) {
19 | query.lastIndex = 0;
20 | var line = doc.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start;
21 | for (;;) {
22 | query.lastIndex = cutOff;
23 | var newMatch = query.exec(line);
24 | if (!newMatch) break;
25 | match = newMatch;
26 | start = match.index;
27 | cutOff = match.index + (match[0].length || 1);
28 | if (cutOff == line.length) break;
29 | }
30 | var matchLen = (match && match[0].length) || 0;
31 | if (!matchLen) {
32 | if (start == 0 && line.length == 0) {match = undefined;}
33 | else if (start != doc.getLine(pos.line).length) {
34 | matchLen++;
35 | }
36 | }
37 | } else {
38 | query.lastIndex = pos.ch;
39 | var line = doc.getLine(pos.line), match = query.exec(line);
40 | var matchLen = (match && match[0].length) || 0;
41 | var start = match && match.index;
42 | if (start + matchLen != line.length && !matchLen) matchLen = 1;
43 | }
44 | if (match && matchLen)
45 | return {from: Pos(pos.line, start),
46 | to: Pos(pos.line, start + matchLen),
47 | match: match};
48 | };
49 | } else { // String query
50 | if (caseFold) query = query.toLowerCase();
51 | var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
52 | var target = query.split("\n");
53 | // Different methods for single-line and multi-line queries
54 | if (target.length == 1) {
55 | if (!query.length) {
56 | // Empty string would match anything and never progress, so
57 | // we define it to match nothing instead.
58 | this.matches = function() {};
59 | } else {
60 | this.matches = function(reverse, pos) {
61 | var line = fold(doc.getLine(pos.line)), len = query.length, match;
62 | if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
63 | : (match = line.indexOf(query, pos.ch)) != -1)
64 | return {from: Pos(pos.line, match),
65 | to: Pos(pos.line, match + len)};
66 | };
67 | }
68 | } else {
69 | this.matches = function(reverse, pos) {
70 | var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(doc.getLine(ln));
71 | var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
72 | if (reverse ? offsetA >= pos.ch || offsetA != match.length
73 | : offsetA <= pos.ch || offsetA != line.length - match.length)
74 | return;
75 | for (;;) {
76 | if (reverse ? !ln : ln == doc.lineCount() - 1) return;
77 | line = fold(doc.getLine(ln += reverse ? -1 : 1));
78 | match = target[reverse ? --idx : ++idx];
79 | if (idx > 0 && idx < target.length - 1) {
80 | if (line != match) return;
81 | else continue;
82 | }
83 | var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
84 | if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
85 | return;
86 | var start = Pos(pos.line, offsetA), end = Pos(ln, offsetB);
87 | return {from: reverse ? end : start, to: reverse ? start : end};
88 | }
89 | };
90 | }
91 | }
92 | }
93 |
94 | SearchCursor.prototype = {
95 | findNext: function() {return this.find(false);},
96 | findPrevious: function() {return this.find(true);},
97 |
98 | find: function(reverse) {
99 | var self = this, pos = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);
100 | function savePosAndFail(line) {
101 | var pos = Pos(line, 0);
102 | self.pos = {from: pos, to: pos};
103 | self.atOccurrence = false;
104 | return false;
105 | }
106 |
107 | for (;;) {
108 | if (this.pos = this.matches(reverse, pos)) {
109 | if (!this.pos.from || !this.pos.to) { console.log(this.matches, this.pos); }
110 | this.atOccurrence = true;
111 | return this.pos.match || true;
112 | }
113 | if (reverse) {
114 | if (!pos.line) return savePosAndFail(0);
115 | pos = Pos(pos.line-1, this.doc.getLine(pos.line-1).length);
116 | }
117 | else {
118 | var maxLine = this.doc.lineCount();
119 | if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
120 | pos = Pos(pos.line + 1, 0);
121 | }
122 | }
123 | },
124 |
125 | from: function() {if (this.atOccurrence) return this.pos.from;},
126 | to: function() {if (this.atOccurrence) return this.pos.to;},
127 |
128 | replace: function(newText) {
129 | if (!this.atOccurrence) return;
130 | var lines = CodeMirror.splitLines(newText);
131 | this.doc.replaceRange(lines, this.pos.from, this.pos.to);
132 | this.pos.to = Pos(this.pos.from.line + lines.length - 1,
133 | lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0));
134 | }
135 | };
136 |
137 | CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
138 | return new SearchCursor(this.doc, query, pos, caseFold);
139 | });
140 | CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
141 | return new SearchCursor(this, query, pos, caseFold);
142 | });
143 | })();
144 |
--------------------------------------------------------------------------------
/js/libs/addon/selection/active-line.js:
--------------------------------------------------------------------------------
1 | // Because sometimes you need to style the cursor's line.
2 | //
3 | // Adds an option 'styleActiveLine' which, when enabled, gives the
4 | // active line's wrapping
the CSS class "CodeMirror-activeline",
5 | // and gives its background
the class "CodeMirror-activeline-background".
6 |
7 | (function() {
8 | "use strict";
9 | var WRAP_CLASS = "CodeMirror-activeline";
10 | var BACK_CLASS = "CodeMirror-activeline-background";
11 |
12 | CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
13 | var prev = old && old != CodeMirror.Init;
14 | if (val && !prev) {
15 | updateActiveLine(cm);
16 | cm.on("cursorActivity", updateActiveLine);
17 | } else if (!val && prev) {
18 | cm.off("cursorActivity", updateActiveLine);
19 | clearActiveLine(cm);
20 | delete cm.state.activeLine;
21 | }
22 | });
23 |
24 | function clearActiveLine(cm) {
25 | if ("activeLine" in cm.state) {
26 | cm.removeLineClass(cm.state.activeLine, "wrap", WRAP_CLASS);
27 | cm.removeLineClass(cm.state.activeLine, "background", BACK_CLASS);
28 | }
29 | }
30 |
31 | function updateActiveLine(cm) {
32 | var line = cm.getLineHandle(cm.getCursor().line);
33 | if (cm.state.activeLine == line) return;
34 | clearActiveLine(cm);
35 | cm.addLineClass(line, "wrap", WRAP_CLASS);
36 | cm.addLineClass(line, "background", BACK_CLASS);
37 | cm.state.activeLine = line;
38 | }
39 | })();
40 |
--------------------------------------------------------------------------------
/js/libs/addon/selection/mark-selection.js:
--------------------------------------------------------------------------------
1 | // Because sometimes you need to mark the selected *text*.
2 | //
3 | // Adds an option 'styleSelectedText' which, when enabled, gives
4 | // selected text the CSS class given as option value, or
5 | // "CodeMirror-selectedtext" when the value is not a string.
6 |
7 | (function() {
8 | "use strict";
9 |
10 | CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
11 | var prev = old && old != CodeMirror.Init;
12 | if (val && !prev) {
13 | cm.state.markedSelection = [];
14 | cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
15 | reset(cm);
16 | cm.on("cursorActivity", onCursorActivity);
17 | cm.on("change", onChange);
18 | } else if (!val && prev) {
19 | cm.off("cursorActivity", onCursorActivity);
20 | cm.off("change", onChange);
21 | clear(cm);
22 | cm.state.markedSelection = cm.state.markedSelectionStyle = null;
23 | }
24 | });
25 |
26 | function onCursorActivity(cm) {
27 | cm.operation(function() { update(cm); });
28 | }
29 |
30 | function onChange(cm) {
31 | if (cm.state.markedSelection.length)
32 | cm.operation(function() { clear(cm); });
33 | }
34 |
35 | var CHUNK_SIZE = 8;
36 | var Pos = CodeMirror.Pos;
37 |
38 | function cmp(pos1, pos2) {
39 | return pos1.line - pos2.line || pos1.ch - pos2.ch;
40 | }
41 |
42 | function coverRange(cm, from, to, addAt) {
43 | if (cmp(from, to) == 0) return;
44 | var array = cm.state.markedSelection;
45 | var cls = cm.state.markedSelectionStyle;
46 | for (var line = from.line;;) {
47 | var start = line == from.line ? from : Pos(line, 0);
48 | var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
49 | var end = atEnd ? to : Pos(endLine, 0);
50 | var mark = cm.markText(start, end, {className: cls});
51 | if (addAt == null) array.push(mark);
52 | else array.splice(addAt++, 0, mark);
53 | if (atEnd) break;
54 | line = endLine;
55 | }
56 | }
57 |
58 | function clear(cm) {
59 | var array = cm.state.markedSelection;
60 | for (var i = 0; i < array.length; ++i) array[i].clear();
61 | array.length = 0;
62 | }
63 |
64 | function reset(cm) {
65 | clear(cm);
66 | var from = cm.getCursor("start"), to = cm.getCursor("end");
67 | coverRange(cm, from, to);
68 | }
69 |
70 | function update(cm) {
71 | var from = cm.getCursor("start"), to = cm.getCursor("end");
72 | if (cmp(from, to) == 0) return clear(cm);
73 |
74 | var array = cm.state.markedSelection;
75 | if (!array.length) return coverRange(cm, from, to);
76 |
77 | var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
78 | if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
79 | cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
80 | return reset(cm);
81 |
82 | while (cmp(from, coverStart.from) > 0) {
83 | array.shift().clear();
84 | coverStart = array[0].find();
85 | }
86 | if (cmp(from, coverStart.from) < 0) {
87 | if (coverStart.to.line - from.line < CHUNK_SIZE) {
88 | array.shift().clear();
89 | coverRange(cm, from, coverStart.to, 0);
90 | } else {
91 | coverRange(cm, from, coverStart.from, 0);
92 | }
93 | }
94 |
95 | while (cmp(to, coverEnd.to) < 0) {
96 | array.pop().clear();
97 | coverEnd = array[array.length - 1].find();
98 | }
99 | if (cmp(to, coverEnd.to) > 0) {
100 | if (to.line - coverEnd.from.line < CHUNK_SIZE) {
101 | array.pop().clear();
102 | coverRange(cm, coverEnd.from, to);
103 | } else {
104 | coverRange(cm, coverEnd.to, to);
105 | }
106 | }
107 | }
108 | })();
109 |
--------------------------------------------------------------------------------
/js/libs/mode/css/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: CSS mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: CSS mode
14 |
49 |
52 |
53 |
MIME types defined: text/css
.
54 |
55 |
Parsing/Highlighting Tests: normal , verbose .
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/js/libs/mode/css/scss.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: SCSS mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: SCSS mode
14 |
15 | /* Some example SCSS */
16 |
17 | @import "compass/css3";
18 | $variable: #333;
19 |
20 | $blue: #3bbfce;
21 | $margin: 16px;
22 |
23 | .content-navigation {
24 | #nested {
25 | background-color: black;
26 | }
27 | border-color: $blue;
28 | color:
29 | darken($blue, 9%);
30 | }
31 |
32 | .border {
33 | padding: $margin / 2;
34 | margin: $margin / 2;
35 | border-color: $blue;
36 | }
37 |
38 | @mixin table-base {
39 | th {
40 | text-align: center;
41 | font-weight: bold;
42 | }
43 | td, th {padding: 2px}
44 | }
45 |
46 | table.hl {
47 | margin: 2em 0;
48 | td.ln {
49 | text-align: right;
50 | }
51 | }
52 |
53 | li {
54 | font: {
55 | family: serif;
56 | weight: bold;
57 | size: 1.2em;
58 | }
59 | }
60 |
61 | @mixin left($dist) {
62 | float: left;
63 | margin-left: $dist;
64 | }
65 |
66 | #data {
67 | @include left(10px);
68 | @include table-base;
69 | }
70 |
71 | .source {
72 | @include flow-into(target);
73 | border: 10px solid green;
74 | margin: 20px;
75 | width: 200px; }
76 |
77 | .new-container {
78 | @include flow-from(target);
79 | border: 10px solid red;
80 | margin: 20px;
81 | width: 200px; }
82 |
83 | body {
84 | margin: 0;
85 | padding: 3em 6em;
86 | font-family: tahoma, arial, sans-serif;
87 | color: #000;
88 | }
89 |
90 | @mixin yellow() {
91 | background: yellow;
92 | }
93 |
94 | .big {
95 | font-size: 14px;
96 | }
97 |
98 | .nested {
99 | @include border-radius(3px);
100 | @extend .big;
101 | p {
102 | background: whitesmoke;
103 | a {
104 | color: red;
105 | }
106 | }
107 | }
108 |
109 | #navigation a {
110 | font-weight: bold;
111 | text-decoration: none !important;
112 | }
113 |
114 | h1 {
115 | font-size: 2.5em;
116 | }
117 |
118 | h2 {
119 | font-size: 1.7em;
120 | }
121 |
122 | h1:before, h2:before {
123 | content: "::";
124 | }
125 |
126 | code {
127 | font-family: courier, monospace;
128 | font-size: 80%;
129 | color: #418A8A;
130 | }
131 |
132 |
139 |
140 |
MIME types defined: text/scss
.
141 |
142 |
Parsing/Highlighting Tests: normal , verbose .
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/js/libs/mode/css/scss_test.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var mode = CodeMirror.getMode({tabSize: 4}, "text/x-scss");
3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
4 |
5 | MT('url_with_quotation',
6 | "[tag foo] { [property background][operator :][string-2 url]([string test.jpg]) }");
7 |
8 | MT('url_with_double_quotes',
9 | "[tag foo] { [property background][operator :][string-2 url]([string \"test.jpg\"]) }");
10 |
11 | MT('url_with_single_quotes',
12 | "[tag foo] { [property background][operator :][string-2 url]([string \'test.jpg\']) }");
13 |
14 | MT('string',
15 | "[def @import] [string \"compass/css3\"]");
16 |
17 | MT('important_keyword',
18 | "[tag foo] { [property background][operator :][string-2 url]([string \'test.jpg\']) [keyword !important] }");
19 |
20 | MT('variable',
21 | "[variable-2 $blue][operator :][atom #333]");
22 |
23 | MT('variable_as_attribute',
24 | "[tag foo] { [property color][operator :][variable-2 $blue] }");
25 |
26 | MT('numbers',
27 | "[tag foo] { [property padding][operator :][number 10px] [number 10] [number 10em] [number 8in] }");
28 |
29 | MT('number_percentage',
30 | "[tag foo] { [property width][operator :][number 80%] }");
31 |
32 | MT('selector',
33 | "[builtin #hello][qualifier .world]{}");
34 |
35 | MT('singleline_comment',
36 | "[comment // this is a comment]");
37 |
38 | MT('multiline_comment',
39 | "[comment /*foobar*/]");
40 |
41 | MT('attribute_with_hyphen',
42 | "[tag foo] { [property font-size][operator :][number 10px] }");
43 |
44 | MT('string_after_attribute',
45 | "[tag foo] { [property content][operator :][string \"::\"] }");
46 |
47 | MT('directives',
48 | "[def @include] [qualifier .mixin]");
49 |
50 | MT('basic_structure',
51 | "[tag p] { [property background][operator :][keyword red]; }");
52 |
53 | MT('nested_structure',
54 | "[tag p] { [tag a] { [property color][operator :][keyword red]; } }");
55 |
56 | MT('mixin',
57 | "[def @mixin] [tag table-base] {}");
58 |
59 | MT('number_without_semicolon',
60 | "[tag p] {[property width][operator :][number 12]}",
61 | "[tag a] {[property color][operator :][keyword red];}");
62 |
63 | MT('atom_in_nested_block',
64 | "[tag p] { [tag a] { [property color][operator :][atom #000]; } }");
65 |
66 | MT('interpolation_in_property',
67 | "[tag foo] { [operator #{][variable-2 $hello][operator }:][atom #000]; }");
68 |
69 | MT('interpolation_in_selector',
70 | "[tag foo][operator #{][variable-2 $hello][operator }] { [property color][operator :][atom #000]; }");
71 |
72 | MT('interpolation_error',
73 | "[tag foo][operator #{][error foo][operator }] { [property color][operator :][atom #000]; }");
74 |
75 | MT("divide_operator",
76 | "[tag foo] { [property width][operator :][number 4] [operator /] [number 2] }");
77 |
78 | MT('nested_structure_with_id_selector',
79 | "[tag p] { [builtin #hello] { [property color][operator :][keyword red]; } }");
80 | })();
81 |
--------------------------------------------------------------------------------
/js/libs/mode/css/test.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var mode = CodeMirror.getMode({tabSize: 4}, "css");
3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
4 |
5 | // Requires at least one media query
6 | MT("atMediaEmpty",
7 | "[def @media] [error {] }");
8 |
9 | MT("atMediaMultiple",
10 | "[def @media] [keyword not] [attribute screen] [operator and] ([property color]), [keyword not] [attribute print] [operator and] ([property color]) { }");
11 |
12 | MT("atMediaCheckStack",
13 | "[def @media] [attribute screen] { } [tag foo] { }");
14 |
15 | MT("atMediaCheckStack",
16 | "[def @media] [attribute screen] ([property color]) { } [tag foo] { }");
17 |
18 | MT("atMediaCheckStackInvalidAttribute",
19 | "[def @media] [attribute&error foobarhello] { } [tag foo] { }");
20 |
21 | // Error, because "and" is only allowed immediately preceding a media expression
22 | MT("atMediaInvalidAttribute",
23 | "[def @media] [attribute&error foobarhello] { }");
24 |
25 | // Error, because "and" is only allowed immediately preceding a media expression
26 | MT("atMediaInvalidAnd",
27 | "[def @media] [error and] [attribute screen] { }");
28 |
29 | // Error, because "not" is only allowed as the first item in each media query
30 | MT("atMediaInvalidNot",
31 | "[def @media] [attribute screen] [error not] ([error not]) { }");
32 |
33 | // Error, because "only" is only allowed as the first item in each media query
34 | MT("atMediaInvalidOnly",
35 | "[def @media] [attribute screen] [error only] ([error only]) { }");
36 |
37 | // Error, because "foobarhello" is neither a known type or property, but
38 | // property was expected (after "and"), and it should be in parenthese.
39 | MT("atMediaUnknownType",
40 | "[def @media] [attribute screen] [operator and] [error foobarhello] { }");
41 |
42 | // Error, because "color" is not a known type, but is a known property, and
43 | // should be in parentheses.
44 | MT("atMediaInvalidType",
45 | "[def @media] [attribute screen] [operator and] [error color] { }");
46 |
47 | // Error, because "print" is not a known property, but is a known type,
48 | // and should not be in parenthese.
49 | MT("atMediaInvalidProperty",
50 | "[def @media] [attribute screen] [operator and] ([error print]) { }");
51 |
52 | // Soft error, because "foobarhello" is not a known property or type.
53 | MT("atMediaUnknownProperty",
54 | "[def @media] [attribute screen] [operator and] ([property&error foobarhello]) { }");
55 |
56 | MT("tagSelector",
57 | "[tag foo] { }");
58 |
59 | MT("classSelector",
60 | "[qualifier .foo-bar_hello] { }");
61 |
62 | MT("idSelector",
63 | "[builtin #foo] { [error #foo] }");
64 |
65 | MT("tagSelectorUnclosed",
66 | "[tag foo] { [property margin][operator :] [number 0] } [tag bar] { }");
67 |
68 | MT("tagStringNoQuotes",
69 | "[tag foo] { [property font-family][operator :] [variable-2 hello] [variable-2 world]; }");
70 |
71 | MT("tagStringDouble",
72 | "[tag foo] { [property font-family][operator :] [string \"hello world\"]; }");
73 |
74 | MT("tagStringSingle",
75 | "[tag foo] { [property font-family][operator :] [string 'hello world']; }");
76 |
77 | MT("tagColorKeyword",
78 | "[tag foo] {" +
79 | "[property color][operator :] [keyword black];" +
80 | "[property color][operator :] [keyword navy];" +
81 | "[property color][operator :] [keyword yellow];" +
82 | "}");
83 |
84 | MT("tagColorHex3",
85 | "[tag foo] { [property background][operator :] [atom #fff]; }");
86 |
87 | MT("tagColorHex6",
88 | "[tag foo] { [property background][operator :] [atom #ffffff]; }");
89 |
90 | MT("tagColorHex4",
91 | "[tag foo] { [property background][operator :] [atom&error #ffff]; }");
92 |
93 | MT("tagColorHexInvalid",
94 | "[tag foo] { [property background][operator :] [atom&error #ffg]; }");
95 |
96 | MT("tagNegativeNumber",
97 | "[tag foo] { [property margin][operator :] [number -5px]; }");
98 |
99 | MT("tagPositiveNumber",
100 | "[tag foo] { [property padding][operator :] [number 5px]; }");
101 |
102 | MT("tagVendor",
103 | "[tag foo] { [meta -foo-][property box-sizing][operator :] [meta -foo-][string-2 border-box]; }");
104 |
105 | MT("tagBogusProperty",
106 | "[tag foo] { [property&error barhelloworld][operator :] [number 0]; }");
107 |
108 | MT("tagTwoProperties",
109 | "[tag foo] { [property margin][operator :] [number 0]; [property padding][operator :] [number 0]; }");
110 |
111 | MT("commentSGML",
112 | "[comment ]");
113 | })();
114 |
--------------------------------------------------------------------------------
/js/libs/mode/haxe/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: Haxe mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: Haxe mode
14 |
15 |
16 | import one.two.Three;
17 |
18 | @attr("test")
19 | class Foo<T> extends Three
20 | {
21 | public function new()
22 | {
23 | noFoo = 12;
24 | }
25 |
26 | public static inline function doFoo(obj:{k:Int, l:Float}):Int
27 | {
28 | for(i in 0...10)
29 | {
30 | obj.k++;
31 | trace(i);
32 | var var1 = new Array();
33 | if(var1.length > 1)
34 | throw "Error";
35 | }
36 | // The following line should not be colored, the variable is scoped out
37 | var1;
38 | /* Multi line
39 | * Comment test
40 | */
41 | return obj.k;
42 | }
43 | private function bar():Void
44 | {
45 | #if flash
46 | var t1:String = "1.21";
47 | #end
48 | try {
49 | doFoo({k:3, l:1.2});
50 | }
51 | catch (e : String) {
52 | trace(e);
53 | }
54 | var t2:Float = cast(3.2);
55 | var t3:haxe.Timer = new haxe.Timer();
56 | var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
57 | var t5 = ~/123+.*$/i;
58 | doFoo(t4);
59 | untyped t1 = 4;
60 | bob = new Foo<Int>
61 | }
62 | public var okFoo(default, never):Float;
63 | var noFoo(getFoo, null):Int;
64 | function getFoo():Int {
65 | return noFoo;
66 | }
67 |
68 | public var three:Int;
69 | }
70 | enum Color
71 | {
72 | red;
73 | green;
74 | blue;
75 | grey( v : Int );
76 | rgb (r:Int,g:Int,b:Int);
77 | }
78 |
79 |
80 |
87 |
88 |
MIME types defined: text/x-haxe
.
89 |
90 |
91 |
--------------------------------------------------------------------------------
/js/libs/mode/htmlembedded/htmlembedded.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
2 |
3 | //config settings
4 | var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
5 | scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
6 |
7 | //inner modes
8 | var scriptingMode, htmlMixedMode;
9 |
10 | //tokenizer when in html mode
11 | function htmlDispatch(stream, state) {
12 | if (stream.match(scriptStartRegex, false)) {
13 | state.token=scriptingDispatch;
14 | return scriptingMode.token(stream, state.scriptState);
15 | }
16 | else
17 | return htmlMixedMode.token(stream, state.htmlState);
18 | }
19 |
20 | //tokenizer when in scripting mode
21 | function scriptingDispatch(stream, state) {
22 | if (stream.match(scriptEndRegex, false)) {
23 | state.token=htmlDispatch;
24 | return htmlMixedMode.token(stream, state.htmlState);
25 | }
26 | else
27 | return scriptingMode.token(stream, state.scriptState);
28 | }
29 |
30 |
31 | return {
32 | startState: function() {
33 | scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
34 | htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
35 | return {
36 | token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
37 | htmlState : CodeMirror.startState(htmlMixedMode),
38 | scriptState : CodeMirror.startState(scriptingMode)
39 | };
40 | },
41 |
42 | token: function(stream, state) {
43 | return state.token(stream, state);
44 | },
45 |
46 | indent: function(state, textAfter) {
47 | if (state.token == htmlDispatch)
48 | return htmlMixedMode.indent(state.htmlState, textAfter);
49 | else if (scriptingMode.indent)
50 | return scriptingMode.indent(state.scriptState, textAfter);
51 | },
52 |
53 | copyState: function(state) {
54 | return {
55 | token : state.token,
56 | htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
57 | scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
58 | };
59 | },
60 |
61 | electricChars: "/{}:",
62 |
63 | innerMode: function(state) {
64 | if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
65 | else return {state: state.htmlState, mode: htmlMixedMode};
66 | }
67 | };
68 | }, "htmlmixed");
69 |
70 | CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
71 | CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
72 | CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
73 | CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
74 |
--------------------------------------------------------------------------------
/js/libs/mode/htmlembedded/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: Html Embedded Scripts mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
CodeMirror: Html Embedded Scripts mode
18 |
19 |
20 | <%
21 | function hello(who) {
22 | return "Hello " + who;
23 | }
24 | %>
25 | This is an example of EJS (embedded javascript)
26 | The program says <%= hello("world") %>.
27 |
30 |
31 |
32 |
42 |
43 |
Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
44 | JavaScript, CSS and XML. Other dependancies include those of the scriping language chosen.
45 |
46 |
MIME types defined: application/x-aspx
(ASP.NET),
47 | application/x-ejs
(Embedded Javascript), application/x-jsp
(JavaServer Pages)
48 |
49 |
50 |
--------------------------------------------------------------------------------
/js/libs/mode/htmlmixed/htmlmixed.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
2 | var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
3 | var cssMode = CodeMirror.getMode(config, "css");
4 |
5 | var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
6 | scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
7 | mode: CodeMirror.getMode(config, "javascript")});
8 | if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
9 | var conf = scriptTypesConf[i];
10 | scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
11 | }
12 | scriptTypes.push({matches: /./,
13 | mode: CodeMirror.getMode(config, "text/plain")});
14 |
15 | function html(stream, state) {
16 | var tagName = state.htmlState.tagName;
17 | var style = htmlMode.token(stream, state.htmlState);
18 | if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
19 | // Script block: mode to change to depends on type attribute
20 | var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
21 | scriptType = scriptType ? scriptType[1] : "";
22 | if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
23 | for (var i = 0; i < scriptTypes.length; ++i) {
24 | var tp = scriptTypes[i];
25 | if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
26 | if (tp.mode) {
27 | state.token = script;
28 | state.localMode = tp.mode;
29 | state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
30 | }
31 | break;
32 | }
33 | }
34 | } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
35 | state.token = css;
36 | state.localMode = cssMode;
37 | state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
38 | }
39 | return style;
40 | }
41 | function maybeBackup(stream, pat, style) {
42 | var cur = stream.current();
43 | var close = cur.search(pat), m;
44 | if (close > -1) stream.backUp(cur.length - close);
45 | else if (m = cur.match(/<\/?$/)) {
46 | stream.backUp(cur.length);
47 | if (!stream.match(pat, false)) stream.match(cur[0]);
48 | }
49 | return style;
50 | }
51 | function script(stream, state) {
52 | if (stream.match(/^<\/\s*script\s*>/i, false)) {
53 | state.token = html;
54 | state.localState = state.localMode = null;
55 | return html(stream, state);
56 | }
57 | return maybeBackup(stream, /<\/\s*script\s*>/,
58 | state.localMode.token(stream, state.localState));
59 | }
60 | function css(stream, state) {
61 | if (stream.match(/^<\/\s*style\s*>/i, false)) {
62 | state.token = html;
63 | state.localState = state.localMode = null;
64 | return html(stream, state);
65 | }
66 | return maybeBackup(stream, /<\/\s*style\s*>/,
67 | cssMode.token(stream, state.localState));
68 | }
69 |
70 | return {
71 | startState: function() {
72 | var state = htmlMode.startState();
73 | return {token: html, localMode: null, localState: null, htmlState: state};
74 | },
75 |
76 | copyState: function(state) {
77 | if (state.localState)
78 | var local = CodeMirror.copyState(state.localMode, state.localState);
79 | return {token: state.token, localMode: state.localMode, localState: local,
80 | htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
81 | },
82 |
83 | token: function(stream, state) {
84 | return state.token(stream, state);
85 | },
86 |
87 | indent: function(state, textAfter) {
88 | if (!state.localMode || /^\s*<\//.test(textAfter))
89 | return htmlMode.indent(state.htmlState, textAfter);
90 | else if (state.localMode.indent)
91 | return state.localMode.indent(state.localState, textAfter);
92 | else
93 | return CodeMirror.Pass;
94 | },
95 |
96 | electricChars: "/{}:",
97 |
98 | innerMode: function(state) {
99 | return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
100 | }
101 | };
102 | }, "xml", "javascript", "css");
103 |
104 | CodeMirror.defineMIME("text/html", "htmlmixed");
105 |
--------------------------------------------------------------------------------
/js/libs/mode/htmlmixed/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: HTML mixed mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
CodeMirror: HTML mixed mode
18 |
19 |
20 |
21 |
22 | Mixed HTML Example
23 |
31 |
32 |
33 | Mixed HTML Example
34 |
39 |
40 |
41 |
42 |
54 |
55 |
The HTML mixed mode depends on the XML, JavaScript, and CSS modes.
56 |
57 |
It takes an optional mode configuration
58 | option, scriptTypes
, which can be used to add custom
59 | behavior for specific <script type="...">
tags. If
60 | given, it should hold an array of {matches, mode}
61 | objects, where matches
is a string or regexp that
62 | matches the script type, and mode
is
63 | either null
, for script types that should stay in
64 | HTML mode, or a mode
65 | spec corresponding to the mode that should be used for the
66 | script.
67 |
68 |
MIME types defined: text/html
69 | (redefined, only takes effect if you load this parser after the
70 | XML parser).
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/js/libs/mode/http/http.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("http", function() {
2 | function failFirstLine(stream, state) {
3 | stream.skipToEnd();
4 | state.cur = header;
5 | return "error";
6 | }
7 |
8 | function start(stream, state) {
9 | if (stream.match(/^HTTP\/\d\.\d/)) {
10 | state.cur = responseStatusCode;
11 | return "keyword";
12 | } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) {
13 | state.cur = requestPath;
14 | return "keyword";
15 | } else {
16 | return failFirstLine(stream, state);
17 | }
18 | }
19 |
20 | function responseStatusCode(stream, state) {
21 | var code = stream.match(/^\d+/);
22 | if (!code) return failFirstLine(stream, state);
23 |
24 | state.cur = responseStatusText;
25 | var status = Number(code[0]);
26 | if (status >= 100 && status < 200) {
27 | return "positive informational";
28 | } else if (status >= 200 && status < 300) {
29 | return "positive success";
30 | } else if (status >= 300 && status < 400) {
31 | return "positive redirect";
32 | } else if (status >= 400 && status < 500) {
33 | return "negative client-error";
34 | } else if (status >= 500 && status < 600) {
35 | return "negative server-error";
36 | } else {
37 | return "error";
38 | }
39 | }
40 |
41 | function responseStatusText(stream, state) {
42 | stream.skipToEnd();
43 | state.cur = header;
44 | return null;
45 | }
46 |
47 | function requestPath(stream, state) {
48 | stream.eatWhile(/\S/);
49 | state.cur = requestProtocol;
50 | return "string-2";
51 | }
52 |
53 | function requestProtocol(stream, state) {
54 | if (stream.match(/^HTTP\/\d\.\d$/)) {
55 | state.cur = header;
56 | return "keyword";
57 | } else {
58 | return failFirstLine(stream, state);
59 | }
60 | }
61 |
62 | function header(stream) {
63 | if (stream.sol() && !stream.eat(/[ \t]/)) {
64 | if (stream.match(/^.*?:/)) {
65 | return "atom";
66 | } else {
67 | stream.skipToEnd();
68 | return "error";
69 | }
70 | } else {
71 | stream.skipToEnd();
72 | return "string";
73 | }
74 | }
75 |
76 | function body(stream) {
77 | stream.skipToEnd();
78 | return null;
79 | }
80 |
81 | return {
82 | token: function(stream, state) {
83 | var cur = state.cur;
84 | if (cur != header && cur != body && stream.eatSpace()) return null;
85 | return cur(stream, state);
86 | },
87 |
88 | blankLine: function(state) {
89 | state.cur = body;
90 | },
91 |
92 | startState: function() {
93 | return {cur: start};
94 | }
95 | };
96 | });
97 |
98 | CodeMirror.defineMIME("message/http", "http");
99 |
--------------------------------------------------------------------------------
/js/libs/mode/http/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: HTTP mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: HTTP mode
14 |
15 |
16 | POST /somewhere HTTP/1.1
17 | Host: example.com
18 | If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
19 | Content-Type: application/x-www-form-urlencoded;
20 | charset=utf-8
21 | User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
22 |
23 | This is the request body!
24 |
25 |
26 |
29 |
30 |
MIME types defined: message/http
.
31 |
32 |
33 |
--------------------------------------------------------------------------------
/js/libs/mode/javascript/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: JavaScript mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
CodeMirror: JavaScript mode
17 |
18 |
19 | // Demo code (the actual new parser character stream implementation)
20 |
21 | function StringStream(string) {
22 | this.pos = 0;
23 | this.string = string;
24 | }
25 |
26 | StringStream.prototype = {
27 | done: function() {return this.pos >= this.string.length;},
28 | peek: function() {return this.string.charAt(this.pos);},
29 | next: function() {
30 | if (this.pos < this.string.length)
31 | return this.string.charAt(this.pos++);
32 | },
33 | eat: function(match) {
34 | var ch = this.string.charAt(this.pos);
35 | if (typeof match == "string") var ok = ch == match;
36 | else var ok = ch && match.test ? match.test(ch) : match(ch);
37 | if (ok) {this.pos++; return ch;}
38 | },
39 | eatWhile: function(match) {
40 | var start = this.pos;
41 | while (this.eat(match));
42 | if (this.pos > start) return this.string.slice(start, this.pos);
43 | },
44 | backUp: function(n) {this.pos -= n;},
45 | column: function() {return this.pos;},
46 | eatSpace: function() {
47 | var start = this.pos;
48 | while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
49 | return this.pos - start;
50 | },
51 | match: function(pattern, consume, caseInsensitive) {
52 | if (typeof pattern == "string") {
53 | function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
54 | if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
55 | if (consume !== false) this.pos += str.length;
56 | return true;
57 | }
58 | }
59 | else {
60 | var match = this.string.slice(this.pos).match(pattern);
61 | if (match && consume !== false) this.pos += match[0].length;
62 | return match;
63 | }
64 | }
65 | };
66 |
67 |
68 |
76 |
77 |
78 | JavaScript mode supports a two configuration
79 | options:
80 |
81 | json
which will set the mode to expect JSON
82 | data rather than a JavaScript program.
83 | typescript
which will activate additional
84 | syntax highlighting and some other things for TypeScript code
85 | (demo ).
86 | statementIndent
which (given a number) will
87 | determine the amount of indentation to use for statements
88 | continued on a new line.
89 |
90 |
91 |
92 |
MIME types defined: text/javascript
, application/json
, text/typescript
, application/typescript
.
93 |
94 |
95 |
--------------------------------------------------------------------------------
/js/libs/mode/javascript/typescript.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: TypeScript mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: TypeScript mode
14 |
15 |
16 | class Greeter {
17 | greeting: string;
18 | constructor (message: string) {
19 | this.greeting = message;
20 | }
21 | greet() {
22 | return "Hello, " + this.greeting;
23 | }
24 | }
25 |
26 | var greeter = new Greeter("world");
27 |
28 | var button = document.createElement('button')
29 | button.innerText = "Say Hello"
30 | button.onclick = function() {
31 | alert(greeter.greet())
32 | }
33 |
34 | document.body.appendChild(button)
35 |
36 |
37 |
38 |
45 |
46 |
This is a specialization of the JavaScript mode .
47 |
48 |
49 |
--------------------------------------------------------------------------------
/js/libs/mode/meta.js:
--------------------------------------------------------------------------------
1 | CodeMirror.modeInfo = [
2 | {name: 'APL', mime: 'text/apl', mode: 'apl'},
3 | {name: 'Asterisk', mime: 'text/x-asterisk', mode: 'asterisk'},
4 | {name: 'C', mime: 'text/x-csrc', mode: 'clike'},
5 | {name: 'C++', mime: 'text/x-c++src', mode: 'clike'},
6 | {name: 'Cobol', mime: 'text/x-cobol', mode: 'cobol'},
7 | {name: 'Java', mime: 'text/x-java', mode: 'clike'},
8 | {name: 'C#', mime: 'text/x-csharp', mode: 'clike'},
9 | {name: 'Scala', mime: 'text/x-scala', mode: 'clike'},
10 | {name: 'Clojure', mime: 'text/x-clojure', mode: 'clojure'},
11 | {name: 'CoffeeScript', mime: 'text/x-coffeescript', mode: 'coffeescript'},
12 | {name: 'Common Lisp', mime: 'text/x-common-lisp', mode: 'commonlisp'},
13 | {name: 'CSS', mime: 'text/css', mode: 'css'},
14 | {name: 'D', mime: 'text/x-d', mode: 'd'},
15 | {name: 'diff', mime: 'text/x-diff', mode: 'diff'},
16 | {name: 'ECL', mime: 'text/x-ecl', mode: 'ecl'},
17 | {name: 'Erlang', mime: 'text/x-erlang', mode: 'erlang'},
18 | {name: 'Gas', mime: 'text/x-gas', mode: 'gas'},
19 | {name: 'GitHub Flavored Markdown', mode: 'gfm'},
20 | {name: 'GO', mime: 'text/x-go', mode: 'go'},
21 | {name: 'Groovy', mime: 'text/x-groovy', mode: 'groovy'},
22 | {name: 'Haskell', mime: 'text/x-haskell', mode: 'haskell'},
23 | {name: 'Haxe', mime: 'text/x-haxe', mode: 'haxe'},
24 | {name: 'ASP.NET', mime: 'application/x-aspx', mode: 'htmlembedded'},
25 | {name: 'Embedded Javascript', mime: 'application/x-ejs', mode: 'htmlembedded'},
26 | {name: 'JavaServer Pages', mime: 'application/x-jsp', mode: 'htmlembedded'},
27 | {name: 'HTML', mime: 'text/html', mode: 'htmlmixed'},
28 | {name: 'HTTP', mime: 'message/http', mode: 'http'},
29 | {name: 'JavaScript', mime: 'text/javascript', mode: 'javascript'},
30 | {name: 'JSON', mime: 'application/x-json', mode: 'javascript'},
31 | {name: 'JSON', mime: 'application/json', mode: 'javascript'},
32 | {name: 'TypeScript', mime: 'application/typescript', mode: 'javascript'},
33 | {name: 'Jinja2', mime: 'jinja2', mode: 'jinja2'},
34 | {name: 'LESS', mime: 'text/x-less', mode: 'less'},
35 | {name: 'LiveScript', mime: 'text/x-livescript', mode: 'livescript'},
36 | {name: 'Lua', mime: 'text/x-lua', mode: 'lua'},
37 | {name: 'Markdown (GitHub-flavour)', mime: 'text/x-markdown', mode: 'markdown'},
38 | {name: 'mIRC', mime: 'text/mirc', mode: 'mirc'},
39 | {name: 'NTriples', mime: 'text/n-triples', mode: 'ntriples'},
40 | {name: 'OCaml', mime: 'text/x-ocaml', mode: 'ocaml'},
41 | {name: 'Pascal', mime: 'text/x-pascal', mode: 'pascal'},
42 | {name: 'Perl', mime: 'text/x-perl', mode: 'perl'},
43 | {name: 'PHP', mime: 'text/x-php', mode: 'php'},
44 | {name: 'PHP(HTML)', mime: 'application/x-httpd-php', mode: 'php'},
45 | {name: 'Pig', mime: 'text/x-pig', mode: 'pig'},
46 | {name: 'Plain Text', mime: 'text/plain', mode: 'null'},
47 | {name: 'Properties files', mime: 'text/x-properties', mode: 'clike'},
48 | {name: 'Python', mime: 'text/x-python', mode: 'python'},
49 | {name: 'R', mime: 'text/x-rsrc', mode: 'r'},
50 | {name: 'reStructuredText', mime: 'text/x-rst', mode: 'rst'},
51 | {name: 'Ruby', mime: 'text/x-ruby', mode: 'ruby'},
52 | {name: 'Rust', mime: 'text/x-rustsrc', mode: 'rust'},
53 | {name: 'Sass', mime: 'text/x-sass', mode: 'sass'},
54 | {name: 'Scheme', mime: 'text/x-scheme', mode: 'scheme'},
55 | {name: 'SCSS', mime: 'text/x-scss', mode: 'css'},
56 | {name: 'Shell', mime: 'text/x-sh', mode: 'shell'},
57 | {name: 'Sieve', mime: 'application/sieve', mode: 'sieve'},
58 | {name: 'Smalltalk', mime: 'text/x-stsrc', mode: 'smalltalk'},
59 | {name: 'Smarty', mime: 'text/x-smarty', mode: 'smarty'},
60 | {name: 'SPARQL', mime: 'application/x-sparql-query', mode: 'sparql'},
61 | {name: 'SQL', mime: 'text/x-sql', mode: 'sql'},
62 | {name: 'MariaDB', mime: 'text/x-mariadb', mode: 'sql'},
63 | {name: 'sTeX', mime: 'text/x-stex', mode: 'stex'},
64 | {name: 'LaTeX', mime: 'text/x-latex', mode: 'stex'},
65 | {name: 'Tcl', mime: 'text/x-tcl', mode: 'tcl'},
66 | {name: 'TiddlyWiki ', mime: 'text/x-tiddlywiki', mode: 'tiddlywiki'},
67 | {name: 'Tiki wiki', mime: 'text/tiki', mode: 'tiki'},
68 | {name: 'VB.NET', mime: 'text/x-vb', mode: 'vb'},
69 | {name: 'VBScript', mime: 'text/vbscript', mode: 'vbscript'},
70 | {name: 'Velocity', mime: 'text/velocity', mode: 'velocity'},
71 | {name: 'Verilog', mime: 'text/x-verilog', mode: 'verilog'},
72 | {name: 'XML', mime: 'application/xml', mode: 'xml'},
73 | {name: 'HTML', mime: 'text/html', mode: 'xml'},
74 | {name: 'XQuery', mime: 'application/xquery', mode: 'xquery'},
75 | {name: 'YAML', mime: 'text/x-yaml', mode: 'yaml'},
76 | {name: 'Z80', mime: 'text/x-z80', mode: 'z80'}
77 | ];
78 |
--------------------------------------------------------------------------------
/js/libs/mode/xml/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
CodeMirror: XML mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
CodeMirror: XML mode
14 |
15 | <html style="color: green">
16 | <!-- this is a comment -->
17 | <head>
18 | <title>HTML Example</title>
19 | </head>
20 | <body>
21 | The indentation tries to be <em>somewhat "do what
22 | I mean"</em>... but might not match your style.
23 | </body>
24 | </html>
25 |
26 |
32 |
The XML mode supports two configuration parameters:
33 |
34 | htmlMode (boolean)
35 | This switches the mode to parse HTML instead of XML. This
36 | means attributes do not have to be quoted, and some elements
37 | (such as br
) do not require a closing tag.
38 | alignCDATA (boolean)
39 | Setting this to true will force the opening tag of CDATA
40 | blocks to not be indented.
41 |
42 |
43 |
MIME types defined: application/xml
, text/html
.
44 |
45 |
46 |
--------------------------------------------------------------------------------
/js/libs/mode/xquery/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2011 by MarkLogic Corporation
2 | Author: Mike Brevoort
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
--------------------------------------------------------------------------------
/js/libs/mode/xquery/test.js:
--------------------------------------------------------------------------------
1 | // Don't take these too seriously -- the expected results appear to be
2 | // based on the results of actual runs without any serious manual
3 | // verification. If a change you made causes them to fail, the test is
4 | // as likely to wrong as the code.
5 |
6 | (function() {
7 | var mode = CodeMirror.getMode({tabSize: 4}, "xquery");
8 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
9 |
10 | MT("eviltest",
11 | "[keyword xquery] [keyword version] [variable "1][keyword .][atom 0][keyword -][variable ml"][def&variable ;] [comment (: this is : a \"comment\" :)]",
12 | " [keyword let] [variable $let] [keyword :=] [variable <x] [variable attr][keyword =][variable "value">"test"<func>][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable <][keyword /][variable func><][keyword /][variable x>]",
13 | " [keyword let] [variable $joe][keyword :=][atom 1]",
14 | " [keyword return] [keyword element] [variable element] {",
15 | " [keyword attribute] [variable attribute] { [atom 1] },",
16 | " [keyword element] [variable test] { [variable 'a'] }, [keyword attribute] [variable foo] { [variable "bar"] },",
17 | " [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],",
18 | " [keyword //][variable x] } [comment (: a more 'evil' test :)]",
19 | " [comment (: Modified Blakeley example (: with nested comment :) ... :)]",
20 | " [keyword declare] [keyword private] [keyword function] [def&variable local:declare]() {()}[variable ;]",
21 | " [keyword declare] [keyword private] [keyword function] [def&variable local:private]() {()}[variable ;]",
22 | " [keyword declare] [keyword private] [keyword function] [def&variable local:function]() {()}[variable ;]",
23 | " [keyword declare] [keyword private] [keyword function] [def&variable local:local]() {()}[variable ;]",
24 | " [keyword let] [variable $let] [keyword :=] [variable <let>let] [variable $let] [keyword :=] [variable "let"<][keyword /let][variable >]",
25 | " [keyword return] [keyword element] [variable element] {",
26 | " [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },",
27 | " [keyword attribute] [variable fn:doc] { [variable "bar"] [variable castable] [keyword as] [atom xs:string] },",
28 | " [keyword element] [variable text] { [keyword text] { [variable "text"] } },",
29 | " [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],",
30 | " [keyword //][variable fn:doc]",
31 | " }");
32 |
33 | MT("testEmptySequenceKeyword",
34 | "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()");
35 |
36 | MT("testMultiAttr",
37 | "[tag ][variable hello] [variable world][tag
]");
38 |
39 | MT("test namespaced variable",
40 | "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]");
41 |
42 | MT("test EQName variable",
43 | "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]",
44 | "[tag ]{[variable $\"http://www.example.com/ns/my\":var]}[tag ]");
45 |
46 | MT("test EQName function",
47 | "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
48 | " [variable $a] [keyword +] [atom 2]",
49 | "}[variable ;]",
50 | "[tag ]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag ]");
51 |
52 | MT("test EQName function with single quotes",
53 | "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
54 | " [variable $a] [keyword +] [atom 2]",
55 | "}[variable ;]",
56 | "[tag ]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag ]");
57 |
58 | MT("testProcessingInstructions",
59 | "[def&variable data]([comment&meta ]) [keyword instance] [keyword of] [atom xs:string]");
60 |
61 | MT("testQuoteEscapeDouble",
62 | "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]",
63 | "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])");
64 | })();
65 |
--------------------------------------------------------------------------------
/js/libs/mode/yaml/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CodeMirror: YAML mode
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | CodeMirror: YAML mode
14 |
15 | --- # Favorite movies
16 | - Casablanca
17 | - North by Northwest
18 | - The Man Who Wasn't There
19 | --- # Shopping list
20 | [milk, pumpkin pie, eggs, juice]
21 | --- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
22 | name: John Smith
23 | age: 33
24 | --- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
25 | {name: John Smith, age: 33}
26 | ---
27 | receipt: Oz-Ware Purchase Invoice
28 | date: 2007-08-06
29 | customer:
30 | given: Dorothy
31 | family: Gale
32 |
33 | items:
34 | - part_no: A4786
35 | descrip: Water Bucket (Filled)
36 | price: 1.47
37 | quantity: 4
38 |
39 | - part_no: E1628
40 | descrip: High Heeled "Ruby" Slippers
41 | size: 8
42 | price: 100.27
43 | quantity: 1
44 |
45 | bill-to: &id001
46 | street: |
47 | 123 Tornado Alley
48 | Suite 16
49 | city: East Centerville
50 | state: KS
51 |
52 | ship-to: *id001
53 |
54 | specialDelivery: >
55 | Follow the Yellow Brick
56 | Road to the Emerald City.
57 | Pay no attention to the
58 | man behind the curtain.
59 | ...
60 |
61 |
64 |
65 | MIME types defined: text/x-yaml
.
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/js/libs/mode/yaml/yaml.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("yaml", function() {
2 |
3 | var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
4 | var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
5 |
6 | return {
7 | token: function(stream, state) {
8 | var ch = stream.peek();
9 | var esc = state.escaped;
10 | state.escaped = false;
11 | /* comments */
12 | if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
13 | stream.skipToEnd(); return "comment";
14 | }
15 | if (state.literal && stream.indentation() > state.keyCol) {
16 | stream.skipToEnd(); return "string";
17 | } else if (state.literal) { state.literal = false; }
18 | if (stream.sol()) {
19 | state.keyCol = 0;
20 | state.pair = false;
21 | state.pairStart = false;
22 | /* document start */
23 | if(stream.match(/---/)) { return "def"; }
24 | /* document end */
25 | if (stream.match(/\.\.\./)) { return "def"; }
26 | /* array list item */
27 | if (stream.match(/\s*-\s+/)) { return 'meta'; }
28 | }
29 | /* pairs (associative arrays) -> key */
30 | if (!state.pair && stream.match(/^\s*([a-z0-9\._-])+(?=\s*:)/i)) {
31 | state.pair = true;
32 | state.keyCol = stream.indentation();
33 | return "atom";
34 | }
35 | if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
36 |
37 | /* inline pairs/lists */
38 | if (stream.match(/^(\{|\}|\[|\])/)) {
39 | if (ch == '{')
40 | state.inlinePairs++;
41 | else if (ch == '}')
42 | state.inlinePairs--;
43 | else if (ch == '[')
44 | state.inlineList++;
45 | else
46 | state.inlineList--;
47 | return 'meta';
48 | }
49 |
50 | /* list seperator */
51 | if (state.inlineList > 0 && !esc && ch == ',') {
52 | stream.next();
53 | return 'meta';
54 | }
55 | /* pairs seperator */
56 | if (state.inlinePairs > 0 && !esc && ch == ',') {
57 | state.keyCol = 0;
58 | state.pair = false;
59 | state.pairStart = false;
60 | stream.next();
61 | return 'meta';
62 | }
63 |
64 | /* start of value of a pair */
65 | if (state.pairStart) {
66 | /* block literals */
67 | if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
68 | /* references */
69 | if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
70 | /* numbers */
71 | if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
72 | if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
73 | /* keywords */
74 | if (stream.match(keywordRegex)) { return 'keyword'; }
75 | }
76 |
77 | /* nothing found, continue */
78 | state.pairStart = false;
79 | state.escaped = (ch == '\\');
80 | stream.next();
81 | return null;
82 | },
83 | startState: function() {
84 | return {
85 | pair: false,
86 | pairStart: false,
87 | keyCol: 0,
88 | inlinePairs: 0,
89 | inlineList: 0,
90 | literal: false,
91 | escaped: false
92 | };
93 | }
94 | };
95 | });
96 |
97 | CodeMirror.defineMIME("text/x-yaml", "yaml");
98 |
--------------------------------------------------------------------------------
/js/libs/theme/ambiance-mobile.css:
--------------------------------------------------------------------------------
1 | .cm-s-ambiance.CodeMirror {
2 | -webkit-box-shadow: none;
3 | -moz-box-shadow: none;
4 | box-shadow: none;
5 | }
6 |
--------------------------------------------------------------------------------
/js/libs/theme/blackboard.css:
--------------------------------------------------------------------------------
1 | /* Port of TextMate's Blackboard theme */
2 |
3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; }
7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
8 |
9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; }
10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; }
11 | .cm-s-blackboard .cm-number { color: #D8FA3C; }
12 | .cm-s-blackboard .cm-def { color: #8DA6CE; }
13 | .cm-s-blackboard .cm-variable { color: #FF6400; }
14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;}
15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; }
16 | .cm-s-blackboard .cm-string { color: #61CE3C; }
17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; }
18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; }
19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; }
21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; }
22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; }
23 | .cm-s-blackboard .cm-header { color: #FF6400; }
24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; }
25 | .cm-s-blackboard .cm-link { color: #8DA6CE; }
26 |
--------------------------------------------------------------------------------
/js/libs/theme/cobalt.css:
--------------------------------------------------------------------------------
1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; }
2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
6 |
7 | .cm-s-cobalt span.cm-comment { color: #08f; }
8 | .cm-s-cobalt span.cm-atom { color: #845dc4; }
9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; }
11 | .cm-s-cobalt span.cm-string { color: #3ad900; }
12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; }
13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
15 | .cm-s-cobalt span.cm-error { color: #9d1e15; }
16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
18 | .cm-s-cobalt span.cm-link { color: #845dc4; }
19 |
--------------------------------------------------------------------------------
/js/libs/theme/eclipse.css:
--------------------------------------------------------------------------------
1 | .cm-s-eclipse span.cm-meta {color: #FF1717;}
2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
3 | .cm-s-eclipse span.cm-atom {color: #219;}
4 | .cm-s-eclipse span.cm-number {color: #164;}
5 | .cm-s-eclipse span.cm-def {color: #00f;}
6 | .cm-s-eclipse span.cm-variable {color: black;}
7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
9 | .cm-s-eclipse span.cm-property {color: black;}
10 | .cm-s-eclipse span.cm-operator {color: black;}
11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;}
12 | .cm-s-eclipse span.cm-string {color: #2A00FF;}
13 | .cm-s-eclipse span.cm-string-2 {color: #f50;}
14 | .cm-s-eclipse span.cm-error {color: #f00;}
15 | .cm-s-eclipse span.cm-qualifier {color: #555;}
16 | .cm-s-eclipse span.cm-builtin {color: #30a;}
17 | .cm-s-eclipse span.cm-bracket {color: #cc7;}
18 | .cm-s-eclipse span.cm-tag {color: #170;}
19 | .cm-s-eclipse span.cm-attribute {color: #00c;}
20 | .cm-s-eclipse span.cm-link {color: #219;}
21 |
22 | .cm-s-eclipse .CodeMirror-matchingbracket {
23 | outline:1px solid grey;
24 | color:black !important;
25 | }
26 |
--------------------------------------------------------------------------------
/js/libs/theme/elegant.css:
--------------------------------------------------------------------------------
1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
4 | .cm-s-elegant span.cm-variable {color: black;}
5 | .cm-s-elegant span.cm-variable-2 {color: #b11;}
6 | .cm-s-elegant span.cm-qualifier {color: #555;}
7 | .cm-s-elegant span.cm-keyword {color: #730;}
8 | .cm-s-elegant span.cm-builtin {color: #30a;}
9 | .cm-s-elegant span.cm-error {background-color: #fdd;}
10 | .cm-s-elegant span.cm-link {color: #762;}
11 |
--------------------------------------------------------------------------------
/js/libs/theme/erlang-dark.css:
--------------------------------------------------------------------------------
1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
6 |
7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; }
8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
10 | .cm-s-erlang-dark span.cm-builtin { color: #eaa; }
11 | .cm-s-erlang-dark span.cm-comment { color: #77f; }
12 | .cm-s-erlang-dark span.cm-def { color: #e7a; }
13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; }
14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; }
16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
17 | .cm-s-erlang-dark span.cm-operator { color: #d11; }
18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; }
19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; }
20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; }
21 | .cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
22 |
--------------------------------------------------------------------------------
/js/libs/theme/lesser-dark.css:
--------------------------------------------------------------------------------
1 | /*
2 | http://lesscss.org/ dark theme
3 | Ported to CodeMirror by Peter Kroon
4 | */
5 | .cm-s-lesser-dark {
6 | line-height: 1.3em;
7 | }
8 | .cm-s-lesser-dark {
9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
10 | }
11 |
12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
16 |
17 | div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
18 |
19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
21 |
22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; }
23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; }
24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; }
25 | .cm-s-lesser-dark span.cm-def {color: white;}
26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; }
29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;}
30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;}
31 | .cm-s-lesser-dark span.cm-comment { color: #666; }
32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; }
33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;}
34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; }
35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; }
36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;}
37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
39 | .cm-s-lesser-dark span.cm-tag { color: #669199; }
40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;}
41 | .cm-s-lesser-dark span.cm-header {color: #a0a;}
42 | .cm-s-lesser-dark span.cm-quote {color: #090;}
43 | .cm-s-lesser-dark span.cm-hr {color: #999;}
44 | .cm-s-lesser-dark span.cm-link {color: #00c;}
45 |
--------------------------------------------------------------------------------
/js/libs/theme/midnight.css:
--------------------------------------------------------------------------------
1 | /* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
2 |
3 | /**/
4 | .breakpoints {width: .8em;}
5 | .breakpoint { color: #822; }
6 |
7 | /**/
8 | span.CodeMirror-matchhighlight { background: #494949 }
9 | .CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67; !important }
10 |
11 | /**/
12 | .activeline {background: #253540 !important;}
13 |
14 | .cm-s-midnight.CodeMirror {
15 | background: #0F192A;
16 | color: #D1EDFF;
17 | }
18 |
19 | .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
20 |
21 | .cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
22 | .cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
23 | .cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;}
24 | .cm-s-midnight .CodeMirror-cursor {
25 | border-left: 1px solid #F8F8F0 !important;
26 | }
27 |
28 | .cm-s-midnight span.cm-comment {color: #428BDD;}
29 | .cm-s-midnight span.cm-atom {color: #AE81FF;}
30 | .cm-s-midnight span.cm-number {color: #D1EDFF;}
31 |
32 | .cm-s-midnight span.cm-property, .cm-s-tropicaleve span.cm-attribute {color: #A6E22E;}
33 | .cm-s-midnight span.cm-keyword {color: #E83737;}
34 | .cm-s-midnight span.cm-string {color: #1DC116;}
35 |
36 | .cm-s-midnight span.cm-variable {color: #FFAA3E;}
37 | .cm-s-midnight span.cm-variable-2 {color: #FFAA3E;}
38 | .cm-s-midnight span.cm-def {color: #4DD;}
39 | .cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;}
40 | .cm-s-midnight span.cm-bracket {color: #D1EDFF;}
41 | .cm-s-midnight span.cm-tag {color: #008;}
42 | .cm-s-midnight span.cm-link {color: #AE81FF;}
43 |
44 | .cm-s-midnight .CodeMirror-matchingbracket {
45 | text-decoration: underline;
46 | color: white !important;
47 | }
48 |
49 | .typ { color: #FFAA3E; }
50 | .atn { color: #606; }
51 | .atv { color: #080; }
52 | .dec { color: #606; }
53 |
--------------------------------------------------------------------------------
/js/libs/theme/monokai.css:
--------------------------------------------------------------------------------
1 | /* Based on Sublime Text's Monokai theme */
2 |
3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
8 |
9 | .cm-s-monokai span.cm-comment {color: #75715e;}
10 | .cm-s-monokai span.cm-atom {color: #ae81ff;}
11 | .cm-s-monokai span.cm-number {color: #ae81ff;}
12 |
13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
14 | .cm-s-monokai span.cm-keyword {color: #f92672;}
15 | .cm-s-monokai span.cm-string {color: #e6db74;}
16 |
17 | .cm-s-monokai span.cm-variable {color: #a6e22e;}
18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;}
19 | .cm-s-monokai span.cm-def {color: #fd971f;}
20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;}
22 | .cm-s-monokai span.cm-tag {color: #f92672;}
23 | .cm-s-monokai span.cm-link {color: #ae81ff;}
24 |
25 | .cm-s-monokai .CodeMirror-matchingbracket {
26 | text-decoration: underline;
27 | color: white !important;
28 | }
29 |
--------------------------------------------------------------------------------
/js/libs/theme/neat.css:
--------------------------------------------------------------------------------
1 | .cm-s-neat span.cm-comment { color: #a86; }
2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
3 | .cm-s-neat span.cm-string { color: #a22; }
4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
6 | .cm-s-neat span.cm-variable { color: black; }
7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
8 | .cm-s-neat span.cm-meta {color: #555;}
9 | .cm-s-neat span.cm-link { color: #3a3; }
10 |
--------------------------------------------------------------------------------
/js/libs/theme/night.css:
--------------------------------------------------------------------------------
1 | /* Loosely based on the Midnight Textmate theme */
2 |
3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; }
5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
8 |
9 | .cm-s-night span.cm-comment { color: #6900a1; }
10 | .cm-s-night span.cm-atom { color: #845dc4; }
11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
12 | .cm-s-night span.cm-keyword { color: #599eff; }
13 | .cm-s-night span.cm-string { color: #37f14a; }
14 | .cm-s-night span.cm-meta { color: #7678e2; }
15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
17 | .cm-s-night span.cm-error { color: #9d1e15; }
18 | .cm-s-night span.cm-bracket { color: #8da6ce; }
19 | .cm-s-night span.cm-comment { color: #6900a1; }
20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
21 | .cm-s-night span.cm-link { color: #845dc4; }
22 |
--------------------------------------------------------------------------------
/js/libs/theme/rubyblue.css:
--------------------------------------------------------------------------------
1 | .cm-s-rubyblue { font-family: Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
2 |
3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; }
7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
8 |
9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; }
11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; }
13 | .cm-s-rubyblue span.cm-string { color: #F08047; }
14 | .cm-s-rubyblue span.cm-meta { color: #F0F; }
15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
17 | .cm-s-rubyblue span.cm-error { color: #AF2018; }
18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; }
19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; }
20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
22 |
--------------------------------------------------------------------------------
/js/libs/theme/twilight.css:
--------------------------------------------------------------------------------
1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
3 |
4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
7 |
8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
9 | .cm-s-twilight .cm-atom { color: #FC0; }
10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/
11 | .cm-s-twilight .cm-def { color: #8DA6CE; }
12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/
15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
19 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; }
20 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
21 | .cm-s-twilight .cm-tag { color: #997643; } /**/
22 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
23 | .cm-s-twilight .cm-header { color: #FF6400; }
24 | .cm-s-twilight .cm-hr { color: #AEAEAE; }
25 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
26 |
27 |
--------------------------------------------------------------------------------
/js/libs/theme/vibrant-ink.css:
--------------------------------------------------------------------------------
1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */
2 |
3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
5 |
6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
9 |
10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; }
12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; }
13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
16 | .cm-s-vibrant-ink .cm-operator { color: #888; }
17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C }
19 | .cm-s-vibrant-ink .cm-string-2 { color: red }
20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; }
26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
27 | .cm-s-vibrant-ink .cm-link { color: blue; }
28 |
--------------------------------------------------------------------------------
/js/libs/theme/xq-dark.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 by MarkLogic Corporation
3 | Author: Mike Brevoort
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 | */
23 | .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
24 | .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
25 | .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
26 | .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
27 | .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
28 |
29 | .cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
30 | .cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
31 | .cm-s-xq-dark span.cm-number {color: #164;}
32 | .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
33 | .cm-s-xq-dark span.cm-variable {color: #FFF;}
34 | .cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
35 | .cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
36 | .cm-s-xq-dark span.cm-property {}
37 | .cm-s-xq-dark span.cm-operator {}
38 | .cm-s-xq-dark span.cm-comment {color: gray;}
39 | .cm-s-xq-dark span.cm-string {color: #9FEE00;}
40 | .cm-s-xq-dark span.cm-meta {color: yellow;}
41 | .cm-s-xq-dark span.cm-error {color: #f00;}
42 | .cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
43 | .cm-s-xq-dark span.cm-builtin {color: #30a;}
44 | .cm-s-xq-dark span.cm-bracket {color: #cc7;}
45 | .cm-s-xq-dark span.cm-tag {color: #FFBD40;}
46 | .cm-s-xq-dark span.cm-attribute {color: #FFF700;}
47 |
--------------------------------------------------------------------------------
/js/libs/theme/xq-light.css:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2011 by MarkLogic Corporation
3 | Author: Mike Brevoort
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 | */
23 | .cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }
24 | .cm-s-xq-light span.cm-atom {color: #6C8CD5;}
25 | .cm-s-xq-light span.cm-number {color: #164;}
26 | .cm-s-xq-light span.cm-def {text-decoration:underline;}
27 | .cm-s-xq-light span.cm-variable {color: black; }
28 | .cm-s-xq-light span.cm-variable-2 {color:black;}
29 | .cm-s-xq-light span.cm-variable-3 {color: black; }
30 | .cm-s-xq-light span.cm-property {}
31 | .cm-s-xq-light span.cm-operator {}
32 | .cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}
33 | .cm-s-xq-light span.cm-string {color: red;}
34 | .cm-s-xq-light span.cm-meta {color: yellow;}
35 | .cm-s-xq-light span.cm-error {color: #f00;}
36 | .cm-s-xq-light span.cm-qualifier {color: grey}
37 | .cm-s-xq-light span.cm-builtin {color: #7EA656;}
38 | .cm-s-xq-light span.cm-bracket {color: #cc7;}
39 | .cm-s-xq-light span.cm-tag {color: #3F7F7F;}
40 | .cm-s-xq-light span.cm-attribute {color: #7F007F;}
41 |
42 | .cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}
43 | .cm-s-xq-light .CodeMirror-matchingbracket {border:1px solid grey;color:black !important;background:yellow;}
--------------------------------------------------------------------------------
/js/providers/flex-ui.js:
--------------------------------------------------------------------------------
1 | ;var UI = {
2 | generateUUID:function () {
3 | var d = new Date().getTime();
4 | var uuid = 'xxxx'.replace(/[xy]/g, function(c) {
5 | var r = (d + Math.random()*4)%15 | 0;
6 | d = Math.floor(d/16);
7 | return (c=='x' ? r : (r&0x7|0x8)).toString(16);
8 | });
9 | return uuid;
10 | },
11 | ApplicationStart:function()
12 | {
13 |
14 | return '\n\
15 | \n\
18 | \n\
19 | \t\t\\n\
20 | \n';
21 | },
22 | ApplicationEnd:function()
23 | {
24 | return ' ';
25 | },
26 | button:function (label)
27 | {
28 | if(label == null)
29 | label = "Button";
30 | //return ''+label+' ';
31 | return ''+label+'
\n';
32 | },
33 | checkbox:function ()
34 | {
35 | return ''+
36 | ''+
37 | 'checkbox '+
38 | ' '+
39 | '
';
40 | },
41 | colorpicker: function()
42 | {
43 | return '\n\
44 |
';
45 | },
46 | combobox: function(arr)
47 | { var cbx;
48 | var options='\n';
49 | if( arr !== undefined)
50 | {
51 | for (var i = 0; i < arr.length; i++) {
52 | var item = '\t '+arr[i]+' \n';
53 | options +=item;
54 | };
55 | options += ' ';
56 | cbx = options;
57 | }else{
58 | cbx = '\n\
59 | Item 1 \n\
60 | Item 2 \n\
61 | Item 3 \n\
62 | Item 4 \n\
63 | ';
64 | }
65 |
66 | return cbx;
67 | },
68 | datagrid :function(){
69 | var table = ''+
70 | '
'+
71 | ''+
72 | ''+
73 | '# '+
74 | 'Column 1 '+
75 | 'Column 2 '+
76 | 'Column 3 '+
77 | ' '+
78 | ' '+
79 | ''+
80 | ''+
81 | '1 '+
82 | 'Foo 1 '+
83 | 'Bar '+
84 | 'Foobar '+
85 | ' '+
86 | ''+
87 | '2 '+
88 | 'Foo 2 '+
89 | 'Bar '+
90 | 'Foobar '+
91 | ' '+
92 | ''+
93 | '3 '+
94 | 'Foo 3 '+
95 | 'Bar '+
96 | 'Foobar '+
97 | ' '+
98 | ' '+
99 | '
'+
100 | '
';
101 |
102 | return table;
103 | },
104 | numericstepper: function(){
105 | var ntp = '\n\
106 |
\n\
107 |
\n\
108 | \t\t\n\
109 | \t\t \n\
110 | \t \n\
111 | \t\n\
112 | \t \n\
113 | \t \n\
114 | \t
\n\
115 |
';
116 | return ntp;
117 | },
118 | label :function (){
119 | var lbl = 'Label
';
120 | return lbl;
121 | },
122 | textinput:function(){
123 | return ''+
124 | ''+
125 | ' '+
126 | ' '+
127 | '
';
128 | },
129 | textarea:function(){
130 | return ''+
131 | '
'+
132 | ' ';
133 | },
134 | image:function(src){
135 | return '
'+
136 | '
'+
137 | '
';
138 | },
139 | //Layouts
140 |
141 | panel:function(){
142 | var p ='
\n\
143 |
Sample Panel
\n\
144 |
\n\
145 |
';
146 | return p;
147 | }
148 |
149 | };
--------------------------------------------------------------------------------
/js/ui/properties.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Properties
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/temp/TES:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/temp/TES
--------------------------------------------------------------------------------
/temp/first-shot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/igorcosta/ApacheFlexUIBuilder/322f4df428c8da47a8d213b7d13a5937f80697cd/temp/first-shot.png
--------------------------------------------------------------------------------