Update dependency versions, serve own third-party resources

This commit is contained in:
David Evans 2018-12-24 14:15:03 +00:00
parent 6b6eba9aa0
commit 7f622103a1
14 changed files with 1235 additions and 1990 deletions

View File

@ -61,6 +61,7 @@ if(DEV) {
'node_modules/requirejs/require.js',
'node_modules/codemirror/lib',
'node_modules/codemirror/addon',
'node_modules/codemirror/mode',
'scripts',
'web/scripts',
]);

View File

@ -60,6 +60,10 @@ The available commands are:
* `npm run unit-test`: runs non-browser-based unit tests in NodeJS
* `npm run web-test`: runs browser-based unit tests via Karma
(currently only Chrome is used)
* `npm run web-test:manual`: same as `web-test` but does not
automatically open browsers; you may follow the terminal instructions
to open the tests in any browser, and the tests will stay open for a
minute after completing (this helps with debugging failures)
* `npm run lint`: runs the linter against all source and test files
* `npm run minify`: runs the `minify-lib` and `minify-web` commands
* `npm run minify-lib`: minifies the library code in `/lib`

View File

@ -4,11 +4,8 @@
<meta http-equiv="content-security-policy" content="
base-uri 'self';
default-src 'none';
script-src 'self' https://cdnjs.cloudflare.com https://unpkg.com;
style-src 'self'
https://cdnjs.cloudflare.com
'sha256-s7UPtBgvov5WNF9C1DlTZDpqwLgEmfiWha5a5p/Zn7E='
;
script-src 'self' https://unpkg.com;
style-src 'self' 'sha256-s7UPtBgvov5WNF9C1DlTZDpqwLgEmfiWha5a5p/Zn7E=';
connect-src 'self';
font-src 'self' data:;
img-src 'self' blob:;
@ -63,48 +60,14 @@
/DEV -->
<!-- LIVE -->
<meta
name="cdn-cm/lib/codemirror"
content="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.js"
data-integrity="sha256-U/4XQwZXDFDdAHjIZt1Lm7sFfmMiFDZzFYprq6XJ0gk="
>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.css"
integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs="
crossorigin="anonymous"
>
<meta
name="cdn-cm/addon/hint/show-hint"
content="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.min.js"
data-integrity="sha256-/Cxd7R7oycnq3vuRycj68ToCzdZ73tux8nSULZiWWK0="
>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.min.css"
integrity="sha256-Ng5EdzHS/CC37tR7tE75e4Th9+fBvOB4eYITOkXS22Q="
crossorigin="anonymous"
>
<meta
name="cdn-cm/addon/edit/trailingspace"
content="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/edit/trailingspace.min.js"
data-integrity="sha256-IazJOM2ma6yJ/doWlcIy+Ica+UAgYJDDyYf/qgkLUNM="
>
<meta
name="cdn-cm/addon/comment/comment"
content="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/comment/comment.min.js"
data-integrity="sha256-xRNygSqAYMT9wcso0FgZEY3ROGoD6JdvYd8M9IjSuNg="
>
<link rel="stylesheet" href="web/lib/codemirror.css">
<meta name="cdn-cm/lib/codemirror" content="web/lib/codemirror.js">
<meta name="cdn-cm/addon/hint/show-hint" content="web/lib/show-hint.js">
<meta name="cdn-cm/addon/edit/trailingspace" content="web/lib/trailingspace.js">
<meta name="cdn-cm/addon/comment/comment" content="web/lib/comment.js">
<script src="lib/sequence-diagram-web.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"
integrity="sha256-0SGl1PJNDyJwcV5T+weg2zpEMrh7xvlwO4oXgvZCeZk="
crossorigin="anonymous"
></script>
<script src="web/lib/require.js"></script>
<link rel="stylesheet" href="web/styles/codemirror-override.css">
<script src="web/lib/editor.min.js"></script>
<!-- /LIVE -->

View File

@ -4,9 +4,8 @@
<meta http-equiv="content-security-policy" content="
base-uri 'self';
default-src 'none';
script-src 'self' 'unsafe-inline' cdnjs.cloudflare.com;
script-src 'self' 'unsafe-inline';
style-src 'self'
https://cdnjs.cloudflare.com
https://fonts.googleapis.com
'sha256-s7UPtBgvov5WNF9C1DlTZDpqwLgEmfiWha5a5p/Zn7E='
;
@ -21,48 +20,24 @@
<link rel="apple-touch-icon" href="web/resources/apple-touch-icon.png">
<link href="https://fonts.googleapis.com/css?family=Vollkorn" rel="stylesheet">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.css"
integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs="
crossorigin="anonymous"
>
<link rel="stylesheet" href="web/styles/library.css">
<script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.min.js"
integrity="sha256-U/4XQwZXDFDdAHjIZt1Lm7sFfmMiFDZzFYprq6XJ0gk="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/xml/xml.min.js"
integrity="sha256-QmQ8vh5c1+UzpnyWXYB7nnY1aqpJmXPVkFWtJHJkLnE="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/javascript/javascript.min.js"
integrity="sha256-MyRbKGolllWYWwxW8jH3jYdhK0p0LpgNjR8PqCa/UNQ="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/runmode/runmode.min.js"
integrity="sha256-Y2iV9vZZs9GsyRIV5HgmKgmfGIsXHpdcknYcbIFkz4M="
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/runmode/colorize.min.js"
integrity="sha256-SBZCwL2uLGWKTMqzecOp2O/ES1NHSKt5QSwtGBVZEoE="
crossorigin="anonymous"
></script>
<!-- DEV
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css">
<script src="node_modules/codemirror/mode/xml/xml.js"></script>
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
<script src="node_modules/codemirror/addon/runmode/runmode.js"></script>
<script src="node_modules/codemirror/addon/runmode/colorize.js"></script>
<script src="scripts/standalone-web.mjs" type="module"></script>
/DEV -->
<!-- LIVE -->
<link rel="stylesheet" href="web/lib/codemirror.css">
<script src="web/lib/codemirror.js"></script>
<script src="web/lib/cm-addons-library.js"></script>
<script src="lib/sequence-diagram-web.min.js"></script>
<!-- /LIVE -->
@ -92,7 +67,9 @@ for(let i = 0; i < elements.length; ++ i) {
SequenceDiagram.renderAll(diagrams);
CodeMirror.colorize();
if (CodeMirror && CodeMirror.colorize) {
CodeMirror.colorize();
}
}, {once: true});</script>

2698
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,11 +29,13 @@
"ephemeral",
"*FontData.mjs"
],
"scripts": {
"copy-third-party": "cat node_modules/codemirror/lib/codemirror.css node_modules/codemirror/addon/hint/show-hint.css > web/lib/codemirror.css && uglifyjs --compress --mangle --output web/lib/codemirror.js -- node_modules/codemirror/lib/codemirror.js && uglifyjs --compress --mangle --output web/lib/show-hint.js -- node_modules/codemirror/addon/hint/show-hint.js && uglifyjs --compress --mangle --output web/lib/trailingspace.js -- node_modules/codemirror/addon/edit/trailingspace.js && uglifyjs --compress --mangle --output web/lib/comment.js -- node_modules/codemirror/addon/comment/comment.js && cat node_modules/codemirror/mode/xml/xml.js node_modules/codemirror/mode/javascript/javascript.js node_modules/codemirror/addon/runmode/runmode.js node_modules/codemirror/addon/runmode/colorize.js | uglifyjs --compress --mangle --output web/lib/cm-addons-library.js && uglifyjs --compress --mangle --warn --output web/lib/require.js -- node_modules/requirejs/require.js",
"lint": "eslint . --config eslintrc.js --ext .js --ext .mjs",
"generate-screenshots": "bin/generate-screenshots.js README.md",
"minify-lib": "rollup --config scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output lib/sequence-diagram-web.min.js -- lib/sequence-diagram-web.js",
"minify-web": "rollup --config web/scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output web/lib/editor.min.js -- web/lib/editor.js",
"minify-web": "rollup --config web/scripts/rollup.config.js && uglifyjs --compress --mangle --warn --output web/lib/editor.min.js -- web/lib/editor.js && npm run copy-third-party",
"minify": "npm run minify-lib && npm run minify-web",
"prepublishOnly": "npm run minify-lib && npm run generate-screenshots && npm test",
"start": "bin/server.js",
@ -44,26 +46,26 @@
},
"devDependencies": {
"buffer-to-stream": "^1.0.0",
"codemirror": "5.37.0",
"eslint": "^5.3.0",
"codemirror": "^5.42.2",
"eslint": "^5.11.0",
"eslint-plugin-jasmine": "^2.10.1",
"jasmine": "^3.2.0",
"karma": "^2.0.5",
"jasmine": "^3.3.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-detect-browsers": "^2.3.2",
"karma-detect-browsers": "^2.3.3",
"karma-firefox-launcher": "^1.1.0",
"karma-jasmine": "^1.1.2",
"karma-jasmine": "^2.0.1",
"karma-safari-launcher": "^1.0.0",
"pngcrush": "^2.0.0",
"requirejs": "2.3.5",
"rollup": "^0.64.1",
"requirejs": "^2.3.6",
"rollup": "^0.68.2",
"rollup-plugin-hypothetical": "^2.1.0",
"rollup-plugin-multi-entry": "^2.0.2",
"source-map-support": "^0.5.6",
"rollup-plugin-multi-entry": "^2.1.0",
"source-map-support": "^0.5.9",
"svg2png": "^4.1.1",
"uglify-es": "3.2.2"
},
"dependencies": {
"opentype.js": "^0.8.0"
"opentype.js": "^0.11.0"
}
}

View File

@ -3,7 +3,7 @@ const manual = Boolean(process.env.MANUAL);
const SUPPORTED_BROWSERS = [
'chrome',
'firefox',
'safari',
// 'safari', // https://github.com/karma-runner/karma-safari-launcher/issues/29
];
if(manual) {

File diff suppressed because one or more lines are too long

382
web/lib/codemirror.css Normal file
View File

@ -0,0 +1,382 @@
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
direction: ltr;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-fat-cursor-mark {
background-color: rgba(20, 255, 20, 0.5);
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
}
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-rulers {
position: absolute;
left: 0; right: 0; top: -50px; bottom: -20px;
overflow: hidden;
}
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0; bottom: 0;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
min-height: 100%;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
padding: 0.1px; /* Force widget margins to stay inside of the container */
}
.CodeMirror-widget {}
.CodeMirror-rtl pre { direction: rtl; }
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, .4);
}
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }
.CodeMirror-hints {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-hint {
margin: 0;
padding: 0 4px;
border-radius: 2px;
white-space: pre;
color: black;
cursor: pointer;
}
li.CodeMirror-hint-active {
background: #08f;
color: white;
}

1
web/lib/codemirror.js Normal file

File diff suppressed because one or more lines are too long

1
web/lib/comment.js Normal file
View File

@ -0,0 +1 @@
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(e){var n=e.search(l);return-1==n?0:n}function t(e,n){var t=e.getMode();return!1!==t.useInnerComments&&t.innerMode?e.getModeAt(n):t}var i={},l=/[^\s\u00a0]/,o=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=i);for(var n=1/0,t=this.listSelections(),l=null,r=t.length-1;r>=0;r--){var a=t[r].from(),m=t[r].to();a.line>=n||(m.line>=n&&(m=o(n,0)),n=a.line,null==l?this.uncomment(a,m,e)?l="un":(this.lineComment(a,m,e),l="line"):"un"==l?this.uncomment(a,m,e):this.lineComment(a,m,e))}}),e.defineExtension("lineComment",function(e,r,a){a||(a=i);var m=this,c=t(m,e),f=m.getLine(e.line);if(null!=f&&!function(e,n,t){return/\bstring\b/.test(e.getTokenTypeAt(o(n.line,0)))&&!/^[\'\"\`]/.test(t)}(m,e,f)){var g=a.lineComment||c.lineComment;if(g){var s=Math.min(0!=r.ch||r.line==e.line?r.line+1:r.line,m.lastLine()+1),d=null==a.padding?" ":a.padding,u=a.commentBlankLines||e.line==r.line;m.operation(function(){if(a.indent){for(var t=null,i=e.line;i<s;++i){var r=(c=m.getLine(i)).slice(0,n(c));(null==t||t.length>r.length)&&(t=r)}for(i=e.line;i<s;++i){var c=m.getLine(i),f=t.length;(u||l.test(c))&&(c.slice(0,f)!=t&&(f=n(c)),m.replaceRange(t+g+d,o(i,0),o(i,f)))}}else for(i=e.line;i<s;++i)(u||l.test(m.getLine(i)))&&m.replaceRange(g+d,o(i,0))})}else(a.blockCommentStart||c.blockCommentStart)&&(a.fullLines=!0,m.blockComment(e,r,a))}}),e.defineExtension("blockComment",function(e,n,r){r||(r=i);var a=this,m=t(a,e),c=r.blockCommentStart||m.blockCommentStart,f=r.blockCommentEnd||m.blockCommentEnd;if(c&&f){if(!/\bcomment\b/.test(a.getTokenTypeAt(o(e.line,0)))){var g=Math.min(n.line,a.lastLine());g!=e.line&&0==n.ch&&l.test(a.getLine(g))&&--g;var s=null==r.padding?" ":r.padding;e.line>g||a.operation(function(){if(0!=r.fullLines){var t=l.test(a.getLine(g));a.replaceRange(s+f,o(g)),a.replaceRange(c+s,o(e.line,0));var i=r.blockCommentLead||m.blockCommentLead;if(null!=i)for(var d=e.line+1;d<=g;++d)(d!=g||t)&&a.replaceRange(i+s,o(d,0))}else a.replaceRange(f,n),a.replaceRange(c,e)})}}else(r.lineComment||m.lineComment)&&0!=r.fullLines&&a.lineComment(e,n,r)}),e.defineExtension("uncomment",function(e,n,r){r||(r=i);var a,m=this,c=t(m,e),f=Math.min(0!=n.ch||n.line==e.line?n.line:n.line-1,m.lastLine()),g=Math.min(e.line,f),s=r.lineComment||c.lineComment,d=[],u=null==r.padding?" ":r.padding;e:if(s){for(var h=g;h<=f;++h){var p=m.getLine(h),v=p.indexOf(s);if(v>-1&&!/comment/.test(m.getTokenTypeAt(o(h,v+1)))&&(v=-1),-1==v&&l.test(p))break e;if(v>-1&&l.test(p.slice(0,v)))break e;d.push(p)}if(m.operation(function(){for(var e=g;e<=f;++e){var n=d[e-g],t=n.indexOf(s),i=t+s.length;t<0||(n.slice(i,i+u.length)==u&&(i+=u.length),a=!0,m.replaceRange("",o(e,t),o(e,i)))}}),a)return!0}var C=r.blockCommentStart||c.blockCommentStart,b=r.blockCommentEnd||c.blockCommentEnd;if(!C||!b)return!1;var k=r.blockCommentLead||c.blockCommentLead,L=m.getLine(g),x=L.indexOf(C);if(-1==x)return!1;var R=f==g?L:m.getLine(f),O=R.indexOf(b,f==g?x+C.length:0),T=o(g,x+1),y=o(f,O+1);if(-1==O||!/comment/.test(m.getTokenTypeAt(T))||!/comment/.test(m.getTokenTypeAt(y))||m.getRange(T,y,"\n").indexOf(b)>-1)return!1;var E=L.lastIndexOf(C,e.ch),M=-1==E?-1:L.slice(0,e.ch).indexOf(b,E+C.length);if(-1!=E&&-1!=M&&M+b.length!=e.ch)return!1;M=R.indexOf(b,n.ch);var S=R.slice(n.ch).lastIndexOf(C,M-n.ch);return E=-1==M||-1==S?-1:n.ch+S,(-1==M||-1==E||E==n.ch)&&(m.operation(function(){m.replaceRange("",o(f,O-(u&&R.slice(O-u.length,O)==u?u.length:0)),o(f,O+b.length));var e=x+C.length;if(u&&L.slice(e,e+u.length)==u&&(e+=u.length),m.replaceRange("",o(g,x),o(g,e)),k)for(var n=g+1;n<=f;++n){var t=m.getLine(n),i=t.indexOf(k);if(-1!=i&&!l.test(t.slice(0,i))){var r=i+k.length;u&&t.slice(r,r+u.length)==u&&(r+=u.length),m.replaceRange("",o(n,i),o(n,r))}}}),!0)})});

1
web/lib/require.js Normal file

File diff suppressed because one or more lines are too long

1
web/lib/show-hint.js Normal file

File diff suppressed because one or more lines are too long

1
web/lib/trailingspace.js Normal file
View File

@ -0,0 +1 @@
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineOption("showTrailingSpace",!1,function(i,n,o){o==e.Init&&(o=!1),o&&!n?i.removeOverlay("trailingspace"):!o&&n&&i.addOverlay({token:function(e){for(var i=e.string.length,n=i;n&&/\s/.test(e.string.charAt(n-1));--n);return n>e.pos?(e.pos=n,null):(e.pos=i,"trailingspace")},name:"trailingspace"})})});