@limetech/lime-elements 36.0.0-next.8 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{dateFormatter-05d80b12.js → dateFormatter-d7a8d40d.js} +1 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +19 -11
- package/dist/cjs/limel-code-editor.cjs.entry.js +1596 -2
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +3 -3
- package/dist/cjs/limel-dock-button.cjs.entry.js +32 -6
- package/dist/cjs/limel-dock.cjs.entry.js +6 -7
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +2 -2
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +13 -6
- package/dist/cjs/limel-menu-list.cjs.entry.js +2 -3
- package/dist/cjs/limel-menu.cjs.entry.js +3 -14
- package/dist/cjs/limel-popover_4.cjs.entry.js +1 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +4 -5
- package/dist/cjs/limel-table.cjs.entry.js +17 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{moment-5cfac5cd.js → moment-d1e35cdc.js} +2 -2
- package/dist/collection/components/button/button.css +11 -7
- package/dist/collection/components/chip-set/chip-set.css +6 -2
- package/dist/collection/components/chip-set/chip-set.js +21 -13
- package/dist/collection/components/code-editor/code-editor.css +153 -1
- package/dist/collection/components/code-editor/code-editor.js +90 -2
- package/dist/collection/components/collapsible-section/collapsible-section.css +8 -7
- package/dist/collection/components/date-picker/date-picker.js +18 -1
- package/dist/collection/components/dock/dock-button/dock-button.css +15 -9
- package/dist/collection/components/dock/dock-button/dock-button.js +61 -24
- package/dist/collection/components/dock/dock.css +7 -3
- package/dist/collection/components/dock/dock.js +53 -7
- package/dist/collection/components/input-field/input-field.js +32 -7
- package/dist/collection/components/menu/menu.js +3 -14
- package/dist/collection/components/menu-list/menu-list.js +5 -25
- package/dist/collection/components/popover-surface/popover-surface.css +5 -4
- package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +21 -8
- package/dist/collection/components/select/select.css +10 -11
- package/dist/collection/components/select/select.template.js +3 -4
- package/dist/collection/components/table/columns.js +1 -0
- package/dist/collection/components/table/layout.js +8 -0
- package/dist/collection/components/table/table.css +89 -61
- package/dist/collection/components/table/table.js +46 -15
- package/dist/collection/style/internal/codemirror-tooltip.scss +19 -0
- package/dist/collection/style/mixins.scss +11 -0
- package/dist/esm/{dateFormatter-2cad0292.js → dateFormatter-784c3334.js} +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-button.entry.js +1 -1
- package/dist/esm/limel-chip-set.entry.js +19 -11
- package/dist/esm/limel-code-editor.entry.js +1596 -2
- package/dist/esm/limel-collapsible-section.entry.js +1 -1
- package/dist/esm/limel-date-picker.entry.js +3 -3
- package/dist/esm/limel-dock-button.entry.js +32 -6
- package/dist/esm/limel-dock.entry.js +6 -7
- package/dist/esm/limel-flatpickr-adapter.entry.js +2 -2
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-input-field.entry.js +13 -6
- package/dist/esm/limel-menu-list.entry.js +2 -3
- package/dist/esm/limel-menu.entry.js +3 -14
- package/dist/esm/limel-popover_4.entry.js +1 -1
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-select.entry.js +4 -5
- package/dist/esm/limel-table.entry.js +18 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{moment-367e51c5.js → moment-faa8a4a8.js} +2 -2
- package/dist/lime-elements/lime-elements.css +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-7e571ec6.entry.js → p-0ba0c38a.entry.js} +1 -1
- package/dist/lime-elements/p-104c89e8.entry.js +1 -0
- package/dist/lime-elements/p-1390fdcb.entry.js +126 -0
- package/dist/lime-elements/{p-1dfccbc5.entry.js → p-2fc4f4ff.entry.js} +1 -1
- package/dist/lime-elements/p-3cf4aae0.entry.js +1 -0
- package/dist/lime-elements/p-4dc07252.entry.js +82 -0
- package/dist/lime-elements/p-5ef52589.entry.js +1 -0
- package/dist/lime-elements/p-653faf47.entry.js +1 -0
- package/dist/lime-elements/{p-d76f896d.js → p-73df4d83.js} +1 -1
- package/dist/lime-elements/p-93f42a32.entry.js +1 -0
- package/dist/lime-elements/p-945afca2.js +3 -0
- package/dist/lime-elements/p-b0e54dc2.entry.js +1 -0
- package/dist/lime-elements/p-c15da26d.entry.js +1 -0
- package/dist/lime-elements/{p-af0ec482.entry.js → p-c544c05b.entry.js} +1 -1
- package/dist/lime-elements/p-c59cbd68.entry.js +1 -0
- package/dist/lime-elements/p-cb8db8c2.entry.js +37 -0
- package/dist/lime-elements/p-f41567a1.entry.js +1 -0
- package/dist/lime-elements/p-f5df4d4f.entry.js +1 -0
- package/dist/lime-elements/style/internal/codemirror-tooltip.scss +19 -0
- package/dist/lime-elements/style/mixins.scss +11 -0
- package/dist/types/components/chip-set/chip-set.d.ts +3 -2
- package/dist/types/components/code-editor/code-editor.d.ts +14 -0
- package/dist/types/components/date-picker/date-picker.d.ts +4 -0
- package/dist/types/components/dock/dock-button/dock-button.d.ts +21 -5
- package/dist/types/components/dock/dock.d.ts +15 -3
- package/dist/types/components/input-field/input-field.d.ts +6 -0
- package/dist/types/components/menu/menu.d.ts +1 -2
- package/dist/types/components/menu-list/menu-list.d.ts +2 -7
- package/dist/types/components/table/layout.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +16 -1
- package/dist/types/components/table/table.types.d.ts +4 -0
- package/dist/types/components.d.ts +71 -15
- package/package.json +5 -4
- package/dist/lime-elements/p-1a2ffe75.entry.js +0 -82
- package/dist/lime-elements/p-1e59114e.entry.js +0 -1
- package/dist/lime-elements/p-3af5f9ad.js +0 -3
- package/dist/lime-elements/p-5ad60e14.entry.js +0 -126
- package/dist/lime-elements/p-64f068a8.entry.js +0 -1
- package/dist/lime-elements/p-6966b5df.entry.js +0 -1
- package/dist/lime-elements/p-722d32e0.entry.js +0 -1
- package/dist/lime-elements/p-75152d89.entry.js +0 -1
- package/dist/lime-elements/p-7ee4b825.entry.js +0 -1
- package/dist/lime-elements/p-97d6c4a6.entry.js +0 -1
- package/dist/lime-elements/p-b18cf477.entry.js +0 -1
- package/dist/lime-elements/p-b95e80c9.entry.js +0 -1
- package/dist/lime-elements/p-bd098a11.entry.js +0 -1
- package/dist/lime-elements/p-d1ee4501.entry.js +0 -37
|
@@ -11033,7 +11033,1556 @@ createCommonjsModule(function (module, exports) {
|
|
|
11033
11033
|
});
|
|
11034
11034
|
});
|
|
11035
11035
|
|
|
11036
|
-
const codeEditorCss = ".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px;}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white;}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.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}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.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 .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-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%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.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-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}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}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline: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:-50px}.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;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-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.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{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;}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.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)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}:host{display:flex;font-size:1rem}.editor{width:100%}.editor.is-light-mode{--code-editor-neutral-text-color:var(--contrast-1100);--code-editor-background-color:var(--contrast-200);--code-editor-gutter-background-color:var(--contrast-300);--code-editor-line-number-text-color:var(--contrast-700);--code-editor-cursor-color:var(--color-amber-dark);--code-editor-selection-highlight-color:var(--color-cyan-default);--code-editor-selection-lowlight-color:var(--contrast-600)}.editor.is-light-mode .cm-attribute,.editor.is-light-mode .cm-property,.editor.is-light-mode .cm-keyword{color:rgb(var(--color-violet-light))}.editor.is-light-mode .cm-operator{color:rgb(var(--color-sky-dark))}.editor.is-light-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-light-mode .cm-variable-2{color:rgb(var(--contrast-1100))}.editor.is-light-mode .cm-variable-3,.editor.is-light-mode .cm-type{color:rgb(var(--color-amber-darker))}.editor.is-light-mode .cm-builtin,.editor.is-light-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-light-mode .cm-atom{color:rgb(var(--color-coral-default))}.editor.is-light-mode .cm-tag,.editor.is-light-mode .cm-number{color:rgb(var(--color-magenta-default))}.editor.is-light-mode .cm-def{color:rgb(var(--color-sky-default))}.editor.is-light-mode .cm-string{color:rgb(var(--color-green-dark))}.editor.is-light-mode .cm-string-2{color:rgb(var(--color-pink-default))}.editor.is-light-mode .cm-qualifier{color:rgb(var(--color-grass-default))}.editor.is-light-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-light-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.7)}.editor.is-dark-mode{--code-editor-neutral-text-color:var(--contrast-200);--code-editor-background-color:var(--contrast-1600);--code-editor-gutter-background-color:var(--contrast-1500);--code-editor-line-number-text-color:var(--contrast-1000);--code-editor-cursor-color:var(--color-amber-default);--code-editor-selection-highlight-color:var(--color-cyan-light);--code-editor-selection-lowlight-color:var(--contrast-1700)}.editor.is-dark-mode .cm-attribute,.editor.is-dark-mode .cm-property,.editor.is-dark-mode .cm-keyword{color:rgb(var(--color-purple-lighter))}.editor.is-dark-mode .cm-operator{color:rgb(var(--color-sky-lighter))}.editor.is-dark-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-dark-mode .cm-variable-2{color:rgb(var(--contrast-300))}.editor.is-dark-mode .cm-variable-3,.editor.is-dark-mode .cm-type{color:rgb(var(--color-yellow-light))}.editor.is-dark-mode .cm-builtin,.editor.is-dark-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-dark-mode .cm-atom{color:rgb(var(--color-coral-light))}.editor.is-dark-mode .cm-tag,.editor.is-dark-mode .cm-number{color:rgb(var(--color-magenta-light))}.editor.is-dark-mode .cm-def{color:rgb(var(--color-sky-light))}.editor.is-dark-mode .cm-string{color:rgb(var(--color-lime-light))}.editor.is-dark-mode .cm-string-2{color:rgb(var(--color-pink-lighter))}.editor.is-dark-mode .cm-qualifier{color:rgb(var(--color-grass-light))}.editor.is-dark-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-dark-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.4)}.editor.readonly .CodeMirror-focused .CodeMirror-cursors{visibility:visible !important}.cm-s-lime.CodeMirror{color:rgb(var(--code-editor-neutral-text-color));background-color:rgb(var(--code-editor-background-color));border-radius:0.25rem;height:auto}.cm-s-lime .CodeMirror-scroll{max-height:var(--code-editor-max-height, 10rem)}.cm-s-lime.CodeMirror-focused div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.15)}.cm-s-lime div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.05)}.cm-s-lime .CodeMirror-gutters{background-color:rgb(var(--code-editor-gutter-background-color));color:rgb(var(--code-editor-line-number-text-color));border:none}.cm-s-lime .CodeMirror-guttermarker,.cm-s-lime .CodeMirror-guttermarker-subtle,.cm-s-lime .CodeMirror-linenumber{color:rgb(var(--code-editor-line-number-text-color))}.cm-s-lime .CodeMirror-cursor{border-left:1px solid rgb(var(--code-editor-cursor-color))}.editor.readonly .cm-s-lime .CodeMirror-cursor{border-color:rgba(var(--code-editor-neutral-text-color), 0.5);border-width:0.125rem}.cm-s-lime .CodeMirror-activeline-background{background:rgba(var(--code-editor-selection-lowlight-color), 0.5)}.cm-s-lime .CodeMirror-matchingbracket{font-weight:bold;color:rgb(var(--code-editor-neutral-text-color)) !important;background:rgba(var(--code-editor-selection-highlight-color), 0.15);position:relative}.cm-s-lime .CodeMirror-matchingbracket:before{content:\"_\";color:rgb(var(--code-editor-selection-highlight-color), 0.8);position:absolute;bottom:-0.4rem;left:0;right:0}";
|
|
11036
|
+
createCommonjsModule(function (module, exports) {
|
|
11037
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
11038
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
11039
|
+
|
|
11040
|
+
(function(mod) {
|
|
11041
|
+
mod(codemirror);
|
|
11042
|
+
})(function(CodeMirror) {
|
|
11043
|
+
var GUTTER_ID = "CodeMirror-lint-markers";
|
|
11044
|
+
var LINT_LINE_ID = "CodeMirror-lint-line-";
|
|
11045
|
+
|
|
11046
|
+
function showTooltip(cm, e, content) {
|
|
11047
|
+
var tt = document.createElement("div");
|
|
11048
|
+
tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
|
|
11049
|
+
tt.appendChild(content.cloneNode(true));
|
|
11050
|
+
if (cm.state.lint.options.selfContain)
|
|
11051
|
+
cm.getWrapperElement().appendChild(tt);
|
|
11052
|
+
else
|
|
11053
|
+
document.body.appendChild(tt);
|
|
11054
|
+
|
|
11055
|
+
function position(e) {
|
|
11056
|
+
if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
|
|
11057
|
+
tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
|
|
11058
|
+
tt.style.left = (e.clientX + 5) + "px";
|
|
11059
|
+
}
|
|
11060
|
+
CodeMirror.on(document, "mousemove", position);
|
|
11061
|
+
position(e);
|
|
11062
|
+
if (tt.style.opacity != null) tt.style.opacity = 1;
|
|
11063
|
+
return tt;
|
|
11064
|
+
}
|
|
11065
|
+
function rm(elt) {
|
|
11066
|
+
if (elt.parentNode) elt.parentNode.removeChild(elt);
|
|
11067
|
+
}
|
|
11068
|
+
function hideTooltip(tt) {
|
|
11069
|
+
if (!tt.parentNode) return;
|
|
11070
|
+
if (tt.style.opacity == null) rm(tt);
|
|
11071
|
+
tt.style.opacity = 0;
|
|
11072
|
+
setTimeout(function() { rm(tt); }, 600);
|
|
11073
|
+
}
|
|
11074
|
+
|
|
11075
|
+
function showTooltipFor(cm, e, content, node) {
|
|
11076
|
+
var tooltip = showTooltip(cm, e, content);
|
|
11077
|
+
function hide() {
|
|
11078
|
+
CodeMirror.off(node, "mouseout", hide);
|
|
11079
|
+
if (tooltip) { hideTooltip(tooltip); tooltip = null; }
|
|
11080
|
+
}
|
|
11081
|
+
var poll = setInterval(function() {
|
|
11082
|
+
if (tooltip) for (var n = node;; n = n.parentNode) {
|
|
11083
|
+
if (n && n.nodeType == 11) n = n.host;
|
|
11084
|
+
if (n == document.body) return;
|
|
11085
|
+
if (!n) { hide(); break; }
|
|
11086
|
+
}
|
|
11087
|
+
if (!tooltip) return clearInterval(poll);
|
|
11088
|
+
}, 400);
|
|
11089
|
+
CodeMirror.on(node, "mouseout", hide);
|
|
11090
|
+
}
|
|
11091
|
+
|
|
11092
|
+
function LintState(cm, conf, hasGutter) {
|
|
11093
|
+
this.marked = [];
|
|
11094
|
+
if (conf instanceof Function) conf = {getAnnotations: conf};
|
|
11095
|
+
if (!conf || conf === true) conf = {};
|
|
11096
|
+
this.options = {};
|
|
11097
|
+
this.linterOptions = conf.options || {};
|
|
11098
|
+
for (var prop in defaults) this.options[prop] = defaults[prop];
|
|
11099
|
+
for (var prop in conf) {
|
|
11100
|
+
if (defaults.hasOwnProperty(prop)) {
|
|
11101
|
+
if (conf[prop] != null) this.options[prop] = conf[prop];
|
|
11102
|
+
} else if (!conf.options) {
|
|
11103
|
+
this.linterOptions[prop] = conf[prop];
|
|
11104
|
+
}
|
|
11105
|
+
}
|
|
11106
|
+
this.timeout = null;
|
|
11107
|
+
this.hasGutter = hasGutter;
|
|
11108
|
+
this.onMouseOver = function(e) { onMouseOver(cm, e); };
|
|
11109
|
+
this.waitingFor = 0;
|
|
11110
|
+
}
|
|
11111
|
+
|
|
11112
|
+
var defaults = {
|
|
11113
|
+
highlightLines: false,
|
|
11114
|
+
tooltips: true,
|
|
11115
|
+
delay: 500,
|
|
11116
|
+
lintOnChange: true,
|
|
11117
|
+
getAnnotations: null,
|
|
11118
|
+
async: false,
|
|
11119
|
+
selfContain: null,
|
|
11120
|
+
formatAnnotation: null,
|
|
11121
|
+
onUpdateLinting: null
|
|
11122
|
+
};
|
|
11123
|
+
|
|
11124
|
+
function clearMarks(cm) {
|
|
11125
|
+
var state = cm.state.lint;
|
|
11126
|
+
if (state.hasGutter) cm.clearGutter(GUTTER_ID);
|
|
11127
|
+
if (state.options.highlightLines) clearErrorLines(cm);
|
|
11128
|
+
for (var i = 0; i < state.marked.length; ++i)
|
|
11129
|
+
state.marked[i].clear();
|
|
11130
|
+
state.marked.length = 0;
|
|
11131
|
+
}
|
|
11132
|
+
|
|
11133
|
+
function clearErrorLines(cm) {
|
|
11134
|
+
cm.eachLine(function(line) {
|
|
11135
|
+
var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass);
|
|
11136
|
+
if (has) cm.removeLineClass(line, "wrap", has[0]);
|
|
11137
|
+
});
|
|
11138
|
+
}
|
|
11139
|
+
|
|
11140
|
+
function makeMarker(cm, labels, severity, multiple, tooltips) {
|
|
11141
|
+
var marker = document.createElement("div"), inner = marker;
|
|
11142
|
+
marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity;
|
|
11143
|
+
if (multiple) {
|
|
11144
|
+
inner = marker.appendChild(document.createElement("div"));
|
|
11145
|
+
inner.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple";
|
|
11146
|
+
}
|
|
11147
|
+
|
|
11148
|
+
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
|
|
11149
|
+
showTooltipFor(cm, e, labels, inner);
|
|
11150
|
+
});
|
|
11151
|
+
|
|
11152
|
+
return marker;
|
|
11153
|
+
}
|
|
11154
|
+
|
|
11155
|
+
function getMaxSeverity(a, b) {
|
|
11156
|
+
if (a == "error") return a;
|
|
11157
|
+
else return b;
|
|
11158
|
+
}
|
|
11159
|
+
|
|
11160
|
+
function groupByLine(annotations) {
|
|
11161
|
+
var lines = [];
|
|
11162
|
+
for (var i = 0; i < annotations.length; ++i) {
|
|
11163
|
+
var ann = annotations[i], line = ann.from.line;
|
|
11164
|
+
(lines[line] || (lines[line] = [])).push(ann);
|
|
11165
|
+
}
|
|
11166
|
+
return lines;
|
|
11167
|
+
}
|
|
11168
|
+
|
|
11169
|
+
function annotationTooltip(ann) {
|
|
11170
|
+
var severity = ann.severity;
|
|
11171
|
+
if (!severity) severity = "error";
|
|
11172
|
+
var tip = document.createElement("div");
|
|
11173
|
+
tip.className = "CodeMirror-lint-message CodeMirror-lint-message-" + severity;
|
|
11174
|
+
if (typeof ann.messageHTML != 'undefined') {
|
|
11175
|
+
tip.innerHTML = ann.messageHTML;
|
|
11176
|
+
} else {
|
|
11177
|
+
tip.appendChild(document.createTextNode(ann.message));
|
|
11178
|
+
}
|
|
11179
|
+
return tip;
|
|
11180
|
+
}
|
|
11181
|
+
|
|
11182
|
+
function lintAsync(cm, getAnnotations) {
|
|
11183
|
+
var state = cm.state.lint;
|
|
11184
|
+
var id = ++state.waitingFor;
|
|
11185
|
+
function abort() {
|
|
11186
|
+
id = -1;
|
|
11187
|
+
cm.off("change", abort);
|
|
11188
|
+
}
|
|
11189
|
+
cm.on("change", abort);
|
|
11190
|
+
getAnnotations(cm.getValue(), function(annotations, arg2) {
|
|
11191
|
+
cm.off("change", abort);
|
|
11192
|
+
if (state.waitingFor != id) return
|
|
11193
|
+
if (arg2 && annotations instanceof CodeMirror) annotations = arg2;
|
|
11194
|
+
cm.operation(function() {updateLinting(cm, annotations);});
|
|
11195
|
+
}, state.linterOptions, cm);
|
|
11196
|
+
}
|
|
11197
|
+
|
|
11198
|
+
function startLinting(cm) {
|
|
11199
|
+
var state = cm.state.lint;
|
|
11200
|
+
if (!state) return;
|
|
11201
|
+
var options = state.options;
|
|
11202
|
+
/*
|
|
11203
|
+
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
|
|
11204
|
+
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
|
|
11205
|
+
*/
|
|
11206
|
+
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
|
11207
|
+
if (!getAnnotations) return;
|
|
11208
|
+
if (options.async || getAnnotations.async) {
|
|
11209
|
+
lintAsync(cm, getAnnotations);
|
|
11210
|
+
} else {
|
|
11211
|
+
var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm);
|
|
11212
|
+
if (!annotations) return;
|
|
11213
|
+
if (annotations.then) annotations.then(function(issues) {
|
|
11214
|
+
cm.operation(function() {updateLinting(cm, issues);});
|
|
11215
|
+
});
|
|
11216
|
+
else cm.operation(function() {updateLinting(cm, annotations);});
|
|
11217
|
+
}
|
|
11218
|
+
}
|
|
11219
|
+
|
|
11220
|
+
function updateLinting(cm, annotationsNotSorted) {
|
|
11221
|
+
var state = cm.state.lint;
|
|
11222
|
+
if (!state) return;
|
|
11223
|
+
var options = state.options;
|
|
11224
|
+
clearMarks(cm);
|
|
11225
|
+
|
|
11226
|
+
var annotations = groupByLine(annotationsNotSorted);
|
|
11227
|
+
|
|
11228
|
+
for (var line = 0; line < annotations.length; ++line) {
|
|
11229
|
+
var anns = annotations[line];
|
|
11230
|
+
if (!anns) continue;
|
|
11231
|
+
|
|
11232
|
+
// filter out duplicate messages
|
|
11233
|
+
var message = [];
|
|
11234
|
+
anns = anns.filter(function(item) { return message.indexOf(item.message) > -1 ? false : message.push(item.message) });
|
|
11235
|
+
|
|
11236
|
+
var maxSeverity = null;
|
|
11237
|
+
var tipLabel = state.hasGutter && document.createDocumentFragment();
|
|
11238
|
+
|
|
11239
|
+
for (var i = 0; i < anns.length; ++i) {
|
|
11240
|
+
var ann = anns[i];
|
|
11241
|
+
var severity = ann.severity;
|
|
11242
|
+
if (!severity) severity = "error";
|
|
11243
|
+
maxSeverity = getMaxSeverity(maxSeverity, severity);
|
|
11244
|
+
|
|
11245
|
+
if (options.formatAnnotation) ann = options.formatAnnotation(ann);
|
|
11246
|
+
if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
|
|
11247
|
+
|
|
11248
|
+
if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
|
|
11249
|
+
className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + severity,
|
|
11250
|
+
__annotation: ann
|
|
11251
|
+
}));
|
|
11252
|
+
}
|
|
11253
|
+
// use original annotations[line] to show multiple messages
|
|
11254
|
+
if (state.hasGutter)
|
|
11255
|
+
cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1,
|
|
11256
|
+
options.tooltips));
|
|
11257
|
+
|
|
11258
|
+
if (options.highlightLines)
|
|
11259
|
+
cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity);
|
|
11260
|
+
}
|
|
11261
|
+
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
|
|
11262
|
+
}
|
|
11263
|
+
|
|
11264
|
+
function onChange(cm) {
|
|
11265
|
+
var state = cm.state.lint;
|
|
11266
|
+
if (!state) return;
|
|
11267
|
+
clearTimeout(state.timeout);
|
|
11268
|
+
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay);
|
|
11269
|
+
}
|
|
11270
|
+
|
|
11271
|
+
function popupTooltips(cm, annotations, e) {
|
|
11272
|
+
var target = e.target || e.srcElement;
|
|
11273
|
+
var tooltip = document.createDocumentFragment();
|
|
11274
|
+
for (var i = 0; i < annotations.length; i++) {
|
|
11275
|
+
var ann = annotations[i];
|
|
11276
|
+
tooltip.appendChild(annotationTooltip(ann));
|
|
11277
|
+
}
|
|
11278
|
+
showTooltipFor(cm, e, tooltip, target);
|
|
11279
|
+
}
|
|
11280
|
+
|
|
11281
|
+
function onMouseOver(cm, e) {
|
|
11282
|
+
var target = e.target || e.srcElement;
|
|
11283
|
+
if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
|
|
11284
|
+
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
|
|
11285
|
+
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
|
|
11286
|
+
|
|
11287
|
+
var annotations = [];
|
|
11288
|
+
for (var i = 0; i < spans.length; ++i) {
|
|
11289
|
+
var ann = spans[i].__annotation;
|
|
11290
|
+
if (ann) annotations.push(ann);
|
|
11291
|
+
}
|
|
11292
|
+
if (annotations.length) popupTooltips(cm, annotations, e);
|
|
11293
|
+
}
|
|
11294
|
+
|
|
11295
|
+
CodeMirror.defineOption("lint", false, function(cm, val, old) {
|
|
11296
|
+
if (old && old != CodeMirror.Init) {
|
|
11297
|
+
clearMarks(cm);
|
|
11298
|
+
if (cm.state.lint.options.lintOnChange !== false)
|
|
11299
|
+
cm.off("change", onChange);
|
|
11300
|
+
CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
|
|
11301
|
+
clearTimeout(cm.state.lint.timeout);
|
|
11302
|
+
delete cm.state.lint;
|
|
11303
|
+
}
|
|
11304
|
+
|
|
11305
|
+
if (val) {
|
|
11306
|
+
var gutters = cm.getOption("gutters"), hasLintGutter = false;
|
|
11307
|
+
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
|
|
11308
|
+
var state = cm.state.lint = new LintState(cm, val, hasLintGutter);
|
|
11309
|
+
if (state.options.lintOnChange)
|
|
11310
|
+
cm.on("change", onChange);
|
|
11311
|
+
if (state.options.tooltips != false && state.options.tooltips != "gutter")
|
|
11312
|
+
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
|
|
11313
|
+
|
|
11314
|
+
startLinting(cm);
|
|
11315
|
+
}
|
|
11316
|
+
});
|
|
11317
|
+
|
|
11318
|
+
CodeMirror.defineExtension("performLint", function() {
|
|
11319
|
+
startLinting(this);
|
|
11320
|
+
});
|
|
11321
|
+
});
|
|
11322
|
+
});
|
|
11323
|
+
|
|
11324
|
+
createCommonjsModule(function (module, exports) {
|
|
11325
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
11326
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
11327
|
+
|
|
11328
|
+
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
|
11329
|
+
|
|
11330
|
+
// declare global: jsonlint
|
|
11331
|
+
|
|
11332
|
+
(function(mod) {
|
|
11333
|
+
mod(codemirror);
|
|
11334
|
+
})(function(CodeMirror) {
|
|
11335
|
+
|
|
11336
|
+
CodeMirror.registerHelper("lint", "json", function(text) {
|
|
11337
|
+
var found = [];
|
|
11338
|
+
if (!window.jsonlint) {
|
|
11339
|
+
if (window.console) {
|
|
11340
|
+
window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run.");
|
|
11341
|
+
}
|
|
11342
|
+
return found;
|
|
11343
|
+
}
|
|
11344
|
+
// for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError
|
|
11345
|
+
// is a subproperty
|
|
11346
|
+
var jsonlint = window.jsonlint.parser || window.jsonlint;
|
|
11347
|
+
jsonlint.parseError = function(str, hash) {
|
|
11348
|
+
var loc = hash.loc;
|
|
11349
|
+
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
|
|
11350
|
+
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
|
|
11351
|
+
message: str});
|
|
11352
|
+
};
|
|
11353
|
+
try { jsonlint.parse(text); }
|
|
11354
|
+
catch(e) {}
|
|
11355
|
+
return found;
|
|
11356
|
+
});
|
|
11357
|
+
|
|
11358
|
+
});
|
|
11359
|
+
});
|
|
11360
|
+
|
|
11361
|
+
var foldcode = createCommonjsModule(function (module, exports) {
|
|
11362
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
11363
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
11364
|
+
|
|
11365
|
+
(function(mod) {
|
|
11366
|
+
mod(codemirror);
|
|
11367
|
+
})(function(CodeMirror) {
|
|
11368
|
+
|
|
11369
|
+
function doFold(cm, pos, options, force) {
|
|
11370
|
+
if (options && options.call) {
|
|
11371
|
+
var finder = options;
|
|
11372
|
+
options = null;
|
|
11373
|
+
} else {
|
|
11374
|
+
var finder = getOption(cm, options, "rangeFinder");
|
|
11375
|
+
}
|
|
11376
|
+
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
|
|
11377
|
+
var minSize = getOption(cm, options, "minFoldSize");
|
|
11378
|
+
|
|
11379
|
+
function getRange(allowFolded) {
|
|
11380
|
+
var range = finder(cm, pos);
|
|
11381
|
+
if (!range || range.to.line - range.from.line < minSize) return null;
|
|
11382
|
+
if (force === "fold") return range;
|
|
11383
|
+
|
|
11384
|
+
var marks = cm.findMarksAt(range.from);
|
|
11385
|
+
for (var i = 0; i < marks.length; ++i) {
|
|
11386
|
+
if (marks[i].__isFold) {
|
|
11387
|
+
if (!allowFolded) return null;
|
|
11388
|
+
range.cleared = true;
|
|
11389
|
+
marks[i].clear();
|
|
11390
|
+
}
|
|
11391
|
+
}
|
|
11392
|
+
return range;
|
|
11393
|
+
}
|
|
11394
|
+
|
|
11395
|
+
var range = getRange(true);
|
|
11396
|
+
if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
|
|
11397
|
+
pos = CodeMirror.Pos(pos.line - 1, 0);
|
|
11398
|
+
range = getRange(false);
|
|
11399
|
+
}
|
|
11400
|
+
if (!range || range.cleared || force === "unfold") return;
|
|
11401
|
+
|
|
11402
|
+
var myWidget = makeWidget(cm, options, range);
|
|
11403
|
+
CodeMirror.on(myWidget, "mousedown", function(e) {
|
|
11404
|
+
myRange.clear();
|
|
11405
|
+
CodeMirror.e_preventDefault(e);
|
|
11406
|
+
});
|
|
11407
|
+
var myRange = cm.markText(range.from, range.to, {
|
|
11408
|
+
replacedWith: myWidget,
|
|
11409
|
+
clearOnEnter: getOption(cm, options, "clearOnEnter"),
|
|
11410
|
+
__isFold: true
|
|
11411
|
+
});
|
|
11412
|
+
myRange.on("clear", function(from, to) {
|
|
11413
|
+
CodeMirror.signal(cm, "unfold", cm, from, to);
|
|
11414
|
+
});
|
|
11415
|
+
CodeMirror.signal(cm, "fold", cm, range.from, range.to);
|
|
11416
|
+
}
|
|
11417
|
+
|
|
11418
|
+
function makeWidget(cm, options, range) {
|
|
11419
|
+
var widget = getOption(cm, options, "widget");
|
|
11420
|
+
|
|
11421
|
+
if (typeof widget == "function") {
|
|
11422
|
+
widget = widget(range.from, range.to);
|
|
11423
|
+
}
|
|
11424
|
+
|
|
11425
|
+
if (typeof widget == "string") {
|
|
11426
|
+
var text = document.createTextNode(widget);
|
|
11427
|
+
widget = document.createElement("span");
|
|
11428
|
+
widget.appendChild(text);
|
|
11429
|
+
widget.className = "CodeMirror-foldmarker";
|
|
11430
|
+
} else if (widget) {
|
|
11431
|
+
widget = widget.cloneNode(true);
|
|
11432
|
+
}
|
|
11433
|
+
return widget;
|
|
11434
|
+
}
|
|
11435
|
+
|
|
11436
|
+
// Clumsy backwards-compatible interface
|
|
11437
|
+
CodeMirror.newFoldFunction = function(rangeFinder, widget) {
|
|
11438
|
+
return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
|
|
11439
|
+
};
|
|
11440
|
+
|
|
11441
|
+
// New-style interface
|
|
11442
|
+
CodeMirror.defineExtension("foldCode", function(pos, options, force) {
|
|
11443
|
+
doFold(this, pos, options, force);
|
|
11444
|
+
});
|
|
11445
|
+
|
|
11446
|
+
CodeMirror.defineExtension("isFolded", function(pos) {
|
|
11447
|
+
var marks = this.findMarksAt(pos);
|
|
11448
|
+
for (var i = 0; i < marks.length; ++i)
|
|
11449
|
+
if (marks[i].__isFold) return true;
|
|
11450
|
+
});
|
|
11451
|
+
|
|
11452
|
+
CodeMirror.commands.toggleFold = function(cm) {
|
|
11453
|
+
cm.foldCode(cm.getCursor());
|
|
11454
|
+
};
|
|
11455
|
+
CodeMirror.commands.fold = function(cm) {
|
|
11456
|
+
cm.foldCode(cm.getCursor(), null, "fold");
|
|
11457
|
+
};
|
|
11458
|
+
CodeMirror.commands.unfold = function(cm) {
|
|
11459
|
+
cm.foldCode(cm.getCursor(), { scanUp: false }, "unfold");
|
|
11460
|
+
};
|
|
11461
|
+
CodeMirror.commands.foldAll = function(cm) {
|
|
11462
|
+
cm.operation(function() {
|
|
11463
|
+
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
|
11464
|
+
cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "fold");
|
|
11465
|
+
});
|
|
11466
|
+
};
|
|
11467
|
+
CodeMirror.commands.unfoldAll = function(cm) {
|
|
11468
|
+
cm.operation(function() {
|
|
11469
|
+
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
|
11470
|
+
cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "unfold");
|
|
11471
|
+
});
|
|
11472
|
+
};
|
|
11473
|
+
|
|
11474
|
+
CodeMirror.registerHelper("fold", "combine", function() {
|
|
11475
|
+
var funcs = Array.prototype.slice.call(arguments, 0);
|
|
11476
|
+
return function(cm, start) {
|
|
11477
|
+
for (var i = 0; i < funcs.length; ++i) {
|
|
11478
|
+
var found = funcs[i](cm, start);
|
|
11479
|
+
if (found) return found;
|
|
11480
|
+
}
|
|
11481
|
+
};
|
|
11482
|
+
});
|
|
11483
|
+
|
|
11484
|
+
CodeMirror.registerHelper("fold", "auto", function(cm, start) {
|
|
11485
|
+
var helpers = cm.getHelpers(start, "fold");
|
|
11486
|
+
for (var i = 0; i < helpers.length; i++) {
|
|
11487
|
+
var cur = helpers[i](cm, start);
|
|
11488
|
+
if (cur) return cur;
|
|
11489
|
+
}
|
|
11490
|
+
});
|
|
11491
|
+
|
|
11492
|
+
var defaultOptions = {
|
|
11493
|
+
rangeFinder: CodeMirror.fold.auto,
|
|
11494
|
+
widget: "\u2194",
|
|
11495
|
+
minFoldSize: 0,
|
|
11496
|
+
scanUp: false,
|
|
11497
|
+
clearOnEnter: true
|
|
11498
|
+
};
|
|
11499
|
+
|
|
11500
|
+
CodeMirror.defineOption("foldOptions", null);
|
|
11501
|
+
|
|
11502
|
+
function getOption(cm, options, name) {
|
|
11503
|
+
if (options && options[name] !== undefined)
|
|
11504
|
+
return options[name];
|
|
11505
|
+
var editorOptions = cm.options.foldOptions;
|
|
11506
|
+
if (editorOptions && editorOptions[name] !== undefined)
|
|
11507
|
+
return editorOptions[name];
|
|
11508
|
+
return defaultOptions[name];
|
|
11509
|
+
}
|
|
11510
|
+
|
|
11511
|
+
CodeMirror.defineExtension("foldOption", function(options, name) {
|
|
11512
|
+
return getOption(this, options, name);
|
|
11513
|
+
});
|
|
11514
|
+
});
|
|
11515
|
+
});
|
|
11516
|
+
|
|
11517
|
+
createCommonjsModule(function (module, exports) {
|
|
11518
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
11519
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
11520
|
+
|
|
11521
|
+
(function(mod) {
|
|
11522
|
+
mod(codemirror, foldcode);
|
|
11523
|
+
})(function(CodeMirror) {
|
|
11524
|
+
|
|
11525
|
+
CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
|
|
11526
|
+
if (old && old != CodeMirror.Init) {
|
|
11527
|
+
cm.clearGutter(cm.state.foldGutter.options.gutter);
|
|
11528
|
+
cm.state.foldGutter = null;
|
|
11529
|
+
cm.off("gutterClick", onGutterClick);
|
|
11530
|
+
cm.off("changes", onChange);
|
|
11531
|
+
cm.off("viewportChange", onViewportChange);
|
|
11532
|
+
cm.off("fold", onFold);
|
|
11533
|
+
cm.off("unfold", onFold);
|
|
11534
|
+
cm.off("swapDoc", onChange);
|
|
11535
|
+
}
|
|
11536
|
+
if (val) {
|
|
11537
|
+
cm.state.foldGutter = new State(parseOptions(val));
|
|
11538
|
+
updateInViewport(cm);
|
|
11539
|
+
cm.on("gutterClick", onGutterClick);
|
|
11540
|
+
cm.on("changes", onChange);
|
|
11541
|
+
cm.on("viewportChange", onViewportChange);
|
|
11542
|
+
cm.on("fold", onFold);
|
|
11543
|
+
cm.on("unfold", onFold);
|
|
11544
|
+
cm.on("swapDoc", onChange);
|
|
11545
|
+
}
|
|
11546
|
+
});
|
|
11547
|
+
|
|
11548
|
+
var Pos = CodeMirror.Pos;
|
|
11549
|
+
|
|
11550
|
+
function State(options) {
|
|
11551
|
+
this.options = options;
|
|
11552
|
+
this.from = this.to = 0;
|
|
11553
|
+
}
|
|
11554
|
+
|
|
11555
|
+
function parseOptions(opts) {
|
|
11556
|
+
if (opts === true) opts = {};
|
|
11557
|
+
if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
|
|
11558
|
+
if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
|
|
11559
|
+
if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
|
|
11560
|
+
return opts;
|
|
11561
|
+
}
|
|
11562
|
+
|
|
11563
|
+
function isFolded(cm, line) {
|
|
11564
|
+
var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));
|
|
11565
|
+
for (var i = 0; i < marks.length; ++i) {
|
|
11566
|
+
if (marks[i].__isFold) {
|
|
11567
|
+
var fromPos = marks[i].find(-1);
|
|
11568
|
+
if (fromPos && fromPos.line === line)
|
|
11569
|
+
return marks[i];
|
|
11570
|
+
}
|
|
11571
|
+
}
|
|
11572
|
+
}
|
|
11573
|
+
|
|
11574
|
+
function marker(spec) {
|
|
11575
|
+
if (typeof spec == "string") {
|
|
11576
|
+
var elt = document.createElement("div");
|
|
11577
|
+
elt.className = spec + " CodeMirror-guttermarker-subtle";
|
|
11578
|
+
return elt;
|
|
11579
|
+
} else {
|
|
11580
|
+
return spec.cloneNode(true);
|
|
11581
|
+
}
|
|
11582
|
+
}
|
|
11583
|
+
|
|
11584
|
+
function updateFoldInfo(cm, from, to) {
|
|
11585
|
+
var opts = cm.state.foldGutter.options, cur = from - 1;
|
|
11586
|
+
var minSize = cm.foldOption(opts, "minFoldSize");
|
|
11587
|
+
var func = cm.foldOption(opts, "rangeFinder");
|
|
11588
|
+
// we can reuse the built-in indicator element if its className matches the new state
|
|
11589
|
+
var clsFolded = typeof opts.indicatorFolded == "string" && classTest(opts.indicatorFolded);
|
|
11590
|
+
var clsOpen = typeof opts.indicatorOpen == "string" && classTest(opts.indicatorOpen);
|
|
11591
|
+
cm.eachLine(from, to, function(line) {
|
|
11592
|
+
++cur;
|
|
11593
|
+
var mark = null;
|
|
11594
|
+
var old = line.gutterMarkers;
|
|
11595
|
+
if (old) old = old[opts.gutter];
|
|
11596
|
+
if (isFolded(cm, cur)) {
|
|
11597
|
+
if (clsFolded && old && clsFolded.test(old.className)) return;
|
|
11598
|
+
mark = marker(opts.indicatorFolded);
|
|
11599
|
+
} else {
|
|
11600
|
+
var pos = Pos(cur, 0);
|
|
11601
|
+
var range = func && func(cm, pos);
|
|
11602
|
+
if (range && range.to.line - range.from.line >= minSize) {
|
|
11603
|
+
if (clsOpen && old && clsOpen.test(old.className)) return;
|
|
11604
|
+
mark = marker(opts.indicatorOpen);
|
|
11605
|
+
}
|
|
11606
|
+
}
|
|
11607
|
+
if (!mark && !old) return;
|
|
11608
|
+
cm.setGutterMarker(line, opts.gutter, mark);
|
|
11609
|
+
});
|
|
11610
|
+
}
|
|
11611
|
+
|
|
11612
|
+
// copied from CodeMirror/src/util/dom.js
|
|
11613
|
+
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
|
|
11614
|
+
|
|
11615
|
+
function updateInViewport(cm) {
|
|
11616
|
+
var vp = cm.getViewport(), state = cm.state.foldGutter;
|
|
11617
|
+
if (!state) return;
|
|
11618
|
+
cm.operation(function() {
|
|
11619
|
+
updateFoldInfo(cm, vp.from, vp.to);
|
|
11620
|
+
});
|
|
11621
|
+
state.from = vp.from; state.to = vp.to;
|
|
11622
|
+
}
|
|
11623
|
+
|
|
11624
|
+
function onGutterClick(cm, line, gutter) {
|
|
11625
|
+
var state = cm.state.foldGutter;
|
|
11626
|
+
if (!state) return;
|
|
11627
|
+
var opts = state.options;
|
|
11628
|
+
if (gutter != opts.gutter) return;
|
|
11629
|
+
var folded = isFolded(cm, line);
|
|
11630
|
+
if (folded) folded.clear();
|
|
11631
|
+
else cm.foldCode(Pos(line, 0), opts);
|
|
11632
|
+
}
|
|
11633
|
+
|
|
11634
|
+
function onChange(cm) {
|
|
11635
|
+
var state = cm.state.foldGutter;
|
|
11636
|
+
if (!state) return;
|
|
11637
|
+
var opts = state.options;
|
|
11638
|
+
state.from = state.to = 0;
|
|
11639
|
+
clearTimeout(state.changeUpdate);
|
|
11640
|
+
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
|
|
11641
|
+
}
|
|
11642
|
+
|
|
11643
|
+
function onViewportChange(cm) {
|
|
11644
|
+
var state = cm.state.foldGutter;
|
|
11645
|
+
if (!state) return;
|
|
11646
|
+
var opts = state.options;
|
|
11647
|
+
clearTimeout(state.changeUpdate);
|
|
11648
|
+
state.changeUpdate = setTimeout(function() {
|
|
11649
|
+
var vp = cm.getViewport();
|
|
11650
|
+
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
|
|
11651
|
+
updateInViewport(cm);
|
|
11652
|
+
} else {
|
|
11653
|
+
cm.operation(function() {
|
|
11654
|
+
if (vp.from < state.from) {
|
|
11655
|
+
updateFoldInfo(cm, vp.from, state.from);
|
|
11656
|
+
state.from = vp.from;
|
|
11657
|
+
}
|
|
11658
|
+
if (vp.to > state.to) {
|
|
11659
|
+
updateFoldInfo(cm, state.to, vp.to);
|
|
11660
|
+
state.to = vp.to;
|
|
11661
|
+
}
|
|
11662
|
+
});
|
|
11663
|
+
}
|
|
11664
|
+
}, opts.updateViewportTimeSpan || 400);
|
|
11665
|
+
}
|
|
11666
|
+
|
|
11667
|
+
function onFold(cm, from) {
|
|
11668
|
+
var state = cm.state.foldGutter;
|
|
11669
|
+
if (!state) return;
|
|
11670
|
+
var line = from.line;
|
|
11671
|
+
if (line >= state.from && line < state.to)
|
|
11672
|
+
updateFoldInfo(cm, line, line + 1);
|
|
11673
|
+
}
|
|
11674
|
+
});
|
|
11675
|
+
});
|
|
11676
|
+
|
|
11677
|
+
createCommonjsModule(function (module, exports) {
|
|
11678
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
11679
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
11680
|
+
|
|
11681
|
+
(function(mod) {
|
|
11682
|
+
mod(codemirror);
|
|
11683
|
+
})(function(CodeMirror) {
|
|
11684
|
+
|
|
11685
|
+
function bracketFolding(pairs) {
|
|
11686
|
+
return function(cm, start) {
|
|
11687
|
+
var line = start.line, lineText = cm.getLine(line);
|
|
11688
|
+
|
|
11689
|
+
function findOpening(pair) {
|
|
11690
|
+
var tokenType;
|
|
11691
|
+
for (var at = start.ch, pass = 0;;) {
|
|
11692
|
+
var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1);
|
|
11693
|
+
if (found == -1) {
|
|
11694
|
+
if (pass == 1) break;
|
|
11695
|
+
pass = 1;
|
|
11696
|
+
at = lineText.length;
|
|
11697
|
+
continue;
|
|
11698
|
+
}
|
|
11699
|
+
if (pass == 1 && found < start.ch) break;
|
|
11700
|
+
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
|
|
11701
|
+
if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair};
|
|
11702
|
+
at = found - 1;
|
|
11703
|
+
}
|
|
11704
|
+
}
|
|
11705
|
+
|
|
11706
|
+
function findRange(found) {
|
|
11707
|
+
var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh;
|
|
11708
|
+
outer: for (var i = line; i <= lastLine; ++i) {
|
|
11709
|
+
var text = cm.getLine(i), pos = i == line ? startCh : 0;
|
|
11710
|
+
for (;;) {
|
|
11711
|
+
var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos);
|
|
11712
|
+
if (nextOpen < 0) nextOpen = text.length;
|
|
11713
|
+
if (nextClose < 0) nextClose = text.length;
|
|
11714
|
+
pos = Math.min(nextOpen, nextClose);
|
|
11715
|
+
if (pos == text.length) break;
|
|
11716
|
+
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) {
|
|
11717
|
+
if (pos == nextOpen) ++count;
|
|
11718
|
+
else if (!--count) { end = i; endCh = pos; break outer; }
|
|
11719
|
+
}
|
|
11720
|
+
++pos;
|
|
11721
|
+
}
|
|
11722
|
+
}
|
|
11723
|
+
|
|
11724
|
+
if (end == null || line == end) return null
|
|
11725
|
+
return {from: CodeMirror.Pos(line, startCh),
|
|
11726
|
+
to: CodeMirror.Pos(end, endCh)};
|
|
11727
|
+
}
|
|
11728
|
+
|
|
11729
|
+
var found = [];
|
|
11730
|
+
for (var i = 0; i < pairs.length; i++) {
|
|
11731
|
+
var open = findOpening(pairs[i]);
|
|
11732
|
+
if (open) found.push(open);
|
|
11733
|
+
}
|
|
11734
|
+
found.sort(function(a, b) { return a.ch - b.ch });
|
|
11735
|
+
for (var i = 0; i < found.length; i++) {
|
|
11736
|
+
var range = findRange(found[i]);
|
|
11737
|
+
if (range) return range
|
|
11738
|
+
}
|
|
11739
|
+
return null
|
|
11740
|
+
}
|
|
11741
|
+
}
|
|
11742
|
+
|
|
11743
|
+
CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]]));
|
|
11744
|
+
|
|
11745
|
+
CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]]));
|
|
11746
|
+
|
|
11747
|
+
CodeMirror.registerHelper("fold", "import", function(cm, start) {
|
|
11748
|
+
function hasImport(line) {
|
|
11749
|
+
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
|
11750
|
+
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
|
11751
|
+
if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
|
|
11752
|
+
if (start.type != "keyword" || start.string != "import") return null;
|
|
11753
|
+
// Now find closing semicolon, return its position
|
|
11754
|
+
for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
|
|
11755
|
+
var text = cm.getLine(i), semi = text.indexOf(";");
|
|
11756
|
+
if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
|
|
11757
|
+
}
|
|
11758
|
+
}
|
|
11759
|
+
|
|
11760
|
+
var startLine = start.line, has = hasImport(startLine), prev;
|
|
11761
|
+
if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1))
|
|
11762
|
+
return null;
|
|
11763
|
+
for (var end = has.end;;) {
|
|
11764
|
+
var next = hasImport(end.line + 1);
|
|
11765
|
+
if (next == null) break;
|
|
11766
|
+
end = next.end;
|
|
11767
|
+
}
|
|
11768
|
+
return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end};
|
|
11769
|
+
});
|
|
11770
|
+
|
|
11771
|
+
CodeMirror.registerHelper("fold", "include", function(cm, start) {
|
|
11772
|
+
function hasInclude(line) {
|
|
11773
|
+
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
|
11774
|
+
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
|
11775
|
+
if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
|
|
11776
|
+
if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
|
|
11777
|
+
}
|
|
11778
|
+
|
|
11779
|
+
var startLine = start.line, has = hasInclude(startLine);
|
|
11780
|
+
if (has == null || hasInclude(startLine - 1) != null) return null;
|
|
11781
|
+
for (var end = startLine;;) {
|
|
11782
|
+
var next = hasInclude(end + 1);
|
|
11783
|
+
if (next == null) break;
|
|
11784
|
+
++end;
|
|
11785
|
+
}
|
|
11786
|
+
return {from: CodeMirror.Pos(startLine, has + 1),
|
|
11787
|
+
to: cm.clipPos(CodeMirror.Pos(end))};
|
|
11788
|
+
});
|
|
11789
|
+
|
|
11790
|
+
});
|
|
11791
|
+
});
|
|
11792
|
+
|
|
11793
|
+
var jsonlint_1 = createCommonjsModule(function (module) {
|
|
11794
|
+
var jsonlint = (function(){var require=true,module=false;var exports={};/*
|
|
11795
|
+
json_parse.js
|
|
11796
|
+
2016-05-02
|
|
11797
|
+
|
|
11798
|
+
Public Domain.
|
|
11799
|
+
|
|
11800
|
+
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
|
11801
|
+
|
|
11802
|
+
This file creates a json_parse function.
|
|
11803
|
+
|
|
11804
|
+
json_parse(text, reviver)
|
|
11805
|
+
This method parses a JSON text to produce an object or array.
|
|
11806
|
+
It can throw a SyntaxError exception.
|
|
11807
|
+
|
|
11808
|
+
The optional reviver parameter is a function that can filter and
|
|
11809
|
+
transform the results. It receives each of the keys and values,
|
|
11810
|
+
and its return value is used instead of the original value.
|
|
11811
|
+
If it returns what it received, then the structure is not modified.
|
|
11812
|
+
If it returns undefined then the member is deleted.
|
|
11813
|
+
|
|
11814
|
+
Example:
|
|
11815
|
+
|
|
11816
|
+
// Parse the text. Values that look like ISO date strings will
|
|
11817
|
+
// be converted to Date objects.
|
|
11818
|
+
|
|
11819
|
+
myData = json_parse(text, function (key, value) {
|
|
11820
|
+
var a;
|
|
11821
|
+
if (typeof value === "string") {
|
|
11822
|
+
a =
|
|
11823
|
+
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
|
11824
|
+
if (a) {
|
|
11825
|
+
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
|
11826
|
+
+a[5], +a[6]));
|
|
11827
|
+
}
|
|
11828
|
+
}
|
|
11829
|
+
return value;
|
|
11830
|
+
});
|
|
11831
|
+
|
|
11832
|
+
This is a reference implementation. You are free to copy, modify, or
|
|
11833
|
+
redistribute.
|
|
11834
|
+
|
|
11835
|
+
This code should be minified before deployment.
|
|
11836
|
+
See http://javascript.crockford.com/jsmin.html
|
|
11837
|
+
|
|
11838
|
+
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
|
11839
|
+
NOT CONTROL.
|
|
11840
|
+
*/
|
|
11841
|
+
|
|
11842
|
+
/*jslint for */
|
|
11843
|
+
|
|
11844
|
+
/*property
|
|
11845
|
+
at, b, call, charAt, f, fromCharCode, hasOwnProperty, message, n, name,
|
|
11846
|
+
prototype, push, r, t, text
|
|
11847
|
+
*/
|
|
11848
|
+
|
|
11849
|
+
var ___dougJSONParse = (function () {
|
|
11850
|
+
|
|
11851
|
+
// This is a function that can parse a JSON text, producing a JavaScript
|
|
11852
|
+
// data structure. It is a simple, recursive descent parser. It does not use
|
|
11853
|
+
// eval or regular expressions, so it can be used as a model for implementing
|
|
11854
|
+
// a JSON parser in other languages.
|
|
11855
|
+
|
|
11856
|
+
// We are defining the function inside of another function to avoid creating
|
|
11857
|
+
// global variables.
|
|
11858
|
+
|
|
11859
|
+
var at; // The index of the current character
|
|
11860
|
+
var ch; // The current character
|
|
11861
|
+
var escapee = {
|
|
11862
|
+
"\"": "\"",
|
|
11863
|
+
"\\": "\\",
|
|
11864
|
+
"/": "/",
|
|
11865
|
+
b: "\b",
|
|
11866
|
+
f: "\f",
|
|
11867
|
+
n: "\n",
|
|
11868
|
+
r: "\r",
|
|
11869
|
+
t: "\t"
|
|
11870
|
+
};
|
|
11871
|
+
var text;
|
|
11872
|
+
|
|
11873
|
+
var error = function (m) {
|
|
11874
|
+
|
|
11875
|
+
// Call error when something is wrong.
|
|
11876
|
+
|
|
11877
|
+
throw {
|
|
11878
|
+
name: "SyntaxError",
|
|
11879
|
+
message: m,
|
|
11880
|
+
at: at,
|
|
11881
|
+
text: text
|
|
11882
|
+
};
|
|
11883
|
+
};
|
|
11884
|
+
|
|
11885
|
+
var next = function (c) {
|
|
11886
|
+
|
|
11887
|
+
// If a c parameter is provided, verify that it matches the current character.
|
|
11888
|
+
|
|
11889
|
+
if (c && c !== ch) {
|
|
11890
|
+
error("Expected '" + c + "' instead of '" + ch + "'");
|
|
11891
|
+
}
|
|
11892
|
+
|
|
11893
|
+
// Get the next character. When there are no more characters,
|
|
11894
|
+
// return the empty string.
|
|
11895
|
+
|
|
11896
|
+
ch = text.charAt(at);
|
|
11897
|
+
at += 1;
|
|
11898
|
+
return ch;
|
|
11899
|
+
};
|
|
11900
|
+
|
|
11901
|
+
var number = function () {
|
|
11902
|
+
|
|
11903
|
+
// Parse a number value.
|
|
11904
|
+
|
|
11905
|
+
var value;
|
|
11906
|
+
var string = "";
|
|
11907
|
+
|
|
11908
|
+
if (ch === "-") {
|
|
11909
|
+
string = "-";
|
|
11910
|
+
next("-");
|
|
11911
|
+
}
|
|
11912
|
+
while (ch >= "0" && ch <= "9") {
|
|
11913
|
+
string += ch;
|
|
11914
|
+
next();
|
|
11915
|
+
}
|
|
11916
|
+
if (ch === ".") {
|
|
11917
|
+
string += ".";
|
|
11918
|
+
while (next() && ch >= "0" && ch <= "9") {
|
|
11919
|
+
string += ch;
|
|
11920
|
+
}
|
|
11921
|
+
}
|
|
11922
|
+
if (ch === "e" || ch === "E") {
|
|
11923
|
+
string += ch;
|
|
11924
|
+
next();
|
|
11925
|
+
if (ch === "-" || ch === "+") {
|
|
11926
|
+
string += ch;
|
|
11927
|
+
next();
|
|
11928
|
+
}
|
|
11929
|
+
while (ch >= "0" && ch <= "9") {
|
|
11930
|
+
string += ch;
|
|
11931
|
+
next();
|
|
11932
|
+
}
|
|
11933
|
+
}
|
|
11934
|
+
value = +string;
|
|
11935
|
+
if (!isFinite(value)) {
|
|
11936
|
+
error("Bad number");
|
|
11937
|
+
} else {
|
|
11938
|
+
return value;
|
|
11939
|
+
}
|
|
11940
|
+
};
|
|
11941
|
+
|
|
11942
|
+
var string = function () {
|
|
11943
|
+
|
|
11944
|
+
// Parse a string value.
|
|
11945
|
+
|
|
11946
|
+
var hex;
|
|
11947
|
+
var i;
|
|
11948
|
+
var value = "";
|
|
11949
|
+
var uffff;
|
|
11950
|
+
|
|
11951
|
+
// When parsing for string values, we must look for " and \ characters.
|
|
11952
|
+
|
|
11953
|
+
if (ch === "\"") {
|
|
11954
|
+
while (next()) {
|
|
11955
|
+
if (ch === "\"") {
|
|
11956
|
+
next();
|
|
11957
|
+
return value;
|
|
11958
|
+
}
|
|
11959
|
+
if (ch === "\\") {
|
|
11960
|
+
next();
|
|
11961
|
+
if (ch === "u") {
|
|
11962
|
+
uffff = 0;
|
|
11963
|
+
for (i = 0; i < 4; i += 1) {
|
|
11964
|
+
hex = parseInt(next(), 16);
|
|
11965
|
+
if (!isFinite(hex)) {
|
|
11966
|
+
break;
|
|
11967
|
+
}
|
|
11968
|
+
uffff = uffff * 16 + hex;
|
|
11969
|
+
}
|
|
11970
|
+
value += String.fromCharCode(uffff);
|
|
11971
|
+
} else if (typeof escapee[ch] === "string") {
|
|
11972
|
+
value += escapee[ch];
|
|
11973
|
+
} else {
|
|
11974
|
+
break;
|
|
11975
|
+
}
|
|
11976
|
+
} else {
|
|
11977
|
+
value += ch;
|
|
11978
|
+
}
|
|
11979
|
+
}
|
|
11980
|
+
}
|
|
11981
|
+
error("Bad string");
|
|
11982
|
+
};
|
|
11983
|
+
|
|
11984
|
+
var white = function () {
|
|
11985
|
+
|
|
11986
|
+
// Skip whitespace.
|
|
11987
|
+
|
|
11988
|
+
while (ch && ch <= " ") {
|
|
11989
|
+
next();
|
|
11990
|
+
}
|
|
11991
|
+
};
|
|
11992
|
+
|
|
11993
|
+
var word = function () {
|
|
11994
|
+
|
|
11995
|
+
// true, false, or null.
|
|
11996
|
+
|
|
11997
|
+
switch (ch) {
|
|
11998
|
+
case "t":
|
|
11999
|
+
next("t");
|
|
12000
|
+
next("r");
|
|
12001
|
+
next("u");
|
|
12002
|
+
next("e");
|
|
12003
|
+
return true;
|
|
12004
|
+
case "f":
|
|
12005
|
+
next("f");
|
|
12006
|
+
next("a");
|
|
12007
|
+
next("l");
|
|
12008
|
+
next("s");
|
|
12009
|
+
next("e");
|
|
12010
|
+
return false;
|
|
12011
|
+
case "n":
|
|
12012
|
+
next("n");
|
|
12013
|
+
next("u");
|
|
12014
|
+
next("l");
|
|
12015
|
+
next("l");
|
|
12016
|
+
return null;
|
|
12017
|
+
}
|
|
12018
|
+
error("Unexpected '" + ch + "'");
|
|
12019
|
+
};
|
|
12020
|
+
|
|
12021
|
+
var value; // Place holder for the value function.
|
|
12022
|
+
|
|
12023
|
+
var array = function () {
|
|
12024
|
+
|
|
12025
|
+
// Parse an array value.
|
|
12026
|
+
|
|
12027
|
+
var arr = [];
|
|
12028
|
+
|
|
12029
|
+
if (ch === "[") {
|
|
12030
|
+
next("[");
|
|
12031
|
+
white();
|
|
12032
|
+
if (ch === "]") {
|
|
12033
|
+
next("]");
|
|
12034
|
+
return arr; // empty array
|
|
12035
|
+
}
|
|
12036
|
+
while (ch) {
|
|
12037
|
+
arr.push(value());
|
|
12038
|
+
white();
|
|
12039
|
+
if (ch === "]") {
|
|
12040
|
+
next("]");
|
|
12041
|
+
return arr;
|
|
12042
|
+
}
|
|
12043
|
+
next(",");
|
|
12044
|
+
white();
|
|
12045
|
+
}
|
|
12046
|
+
}
|
|
12047
|
+
error("Bad array");
|
|
12048
|
+
};
|
|
12049
|
+
|
|
12050
|
+
var object = function () {
|
|
12051
|
+
|
|
12052
|
+
// Parse an object value.
|
|
12053
|
+
|
|
12054
|
+
var key;
|
|
12055
|
+
var obj = {};
|
|
12056
|
+
|
|
12057
|
+
if (ch === "{") {
|
|
12058
|
+
next("{");
|
|
12059
|
+
white();
|
|
12060
|
+
if (ch === "}") {
|
|
12061
|
+
next("}");
|
|
12062
|
+
return obj; // empty object
|
|
12063
|
+
}
|
|
12064
|
+
while (ch) {
|
|
12065
|
+
key = string();
|
|
12066
|
+
white();
|
|
12067
|
+
next(":");
|
|
12068
|
+
if (Object.hasOwnProperty.call(obj, key)) {
|
|
12069
|
+
error("Duplicate key '" + key + "'");
|
|
12070
|
+
}
|
|
12071
|
+
obj[key] = value();
|
|
12072
|
+
white();
|
|
12073
|
+
if (ch === "}") {
|
|
12074
|
+
next("}");
|
|
12075
|
+
return obj;
|
|
12076
|
+
}
|
|
12077
|
+
next(",");
|
|
12078
|
+
white();
|
|
12079
|
+
}
|
|
12080
|
+
}
|
|
12081
|
+
error("Bad object");
|
|
12082
|
+
};
|
|
12083
|
+
|
|
12084
|
+
value = function () {
|
|
12085
|
+
|
|
12086
|
+
// Parse a JSON value. It could be an object, an array, a string, a number,
|
|
12087
|
+
// or a word.
|
|
12088
|
+
|
|
12089
|
+
white();
|
|
12090
|
+
switch (ch) {
|
|
12091
|
+
case "{":
|
|
12092
|
+
return object();
|
|
12093
|
+
case "[":
|
|
12094
|
+
return array();
|
|
12095
|
+
case "\"":
|
|
12096
|
+
return string();
|
|
12097
|
+
case "-":
|
|
12098
|
+
return number();
|
|
12099
|
+
default:
|
|
12100
|
+
return (ch >= "0" && ch <= "9")
|
|
12101
|
+
? number()
|
|
12102
|
+
: word();
|
|
12103
|
+
}
|
|
12104
|
+
};
|
|
12105
|
+
|
|
12106
|
+
// Return the json_parse function. It will have access to all of the above
|
|
12107
|
+
// functions and variables.
|
|
12108
|
+
|
|
12109
|
+
return function (source, reviver) {
|
|
12110
|
+
var result;
|
|
12111
|
+
|
|
12112
|
+
text = source;
|
|
12113
|
+
at = 0;
|
|
12114
|
+
ch = " ";
|
|
12115
|
+
result = value();
|
|
12116
|
+
white();
|
|
12117
|
+
if (ch) {
|
|
12118
|
+
error("Syntax error");
|
|
12119
|
+
}
|
|
12120
|
+
|
|
12121
|
+
// If there is a reviver function, we recursively walk the new structure,
|
|
12122
|
+
// passing each name/value pair to the reviver function for possible
|
|
12123
|
+
// transformation, starting with a temporary root object that holds the result
|
|
12124
|
+
// in an empty key. If there is not a reviver function, we simply return the
|
|
12125
|
+
// result.
|
|
12126
|
+
|
|
12127
|
+
return (typeof reviver === "function")
|
|
12128
|
+
? (function walk(holder, key) {
|
|
12129
|
+
var k;
|
|
12130
|
+
var v;
|
|
12131
|
+
var val = holder[key];
|
|
12132
|
+
if (val && typeof val === "object") {
|
|
12133
|
+
for (k in val) {
|
|
12134
|
+
if (Object.prototype.hasOwnProperty.call(val, k)) {
|
|
12135
|
+
v = walk(val, k);
|
|
12136
|
+
if (v !== undefined) {
|
|
12137
|
+
val[k] = v;
|
|
12138
|
+
} else {
|
|
12139
|
+
delete val[k];
|
|
12140
|
+
}
|
|
12141
|
+
}
|
|
12142
|
+
}
|
|
12143
|
+
}
|
|
12144
|
+
return reviver.call(holder, key, val);
|
|
12145
|
+
}({"": result}, ""))
|
|
12146
|
+
: result;
|
|
12147
|
+
};
|
|
12148
|
+
}());
|
|
12149
|
+
/* Jison generated parser */
|
|
12150
|
+
var jsonlint = (function(){
|
|
12151
|
+
var parser = {trace: function trace() { },
|
|
12152
|
+
yy: {},
|
|
12153
|
+
symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
|
|
12154
|
+
terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
|
|
12155
|
+
productions_: [0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],
|
|
12156
|
+
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
|
12157
|
+
|
|
12158
|
+
var $0 = $$.length - 1;
|
|
12159
|
+
switch (yystate) {
|
|
12160
|
+
case 1: // replace escaped characters with actual character
|
|
12161
|
+
this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
|
|
12162
|
+
.replace(/\\n/g,'\n')
|
|
12163
|
+
.replace(/\\r/g,'\r')
|
|
12164
|
+
.replace(/\\t/g,'\t')
|
|
12165
|
+
.replace(/\\v/g,'\v')
|
|
12166
|
+
.replace(/\\f/g,'\f')
|
|
12167
|
+
.replace(/\\b/g,'\b');
|
|
12168
|
+
|
|
12169
|
+
break;
|
|
12170
|
+
case 2:this.$ = Number(yytext);
|
|
12171
|
+
break;
|
|
12172
|
+
case 3:this.$ = null;
|
|
12173
|
+
break;
|
|
12174
|
+
case 4:this.$ = true;
|
|
12175
|
+
break;
|
|
12176
|
+
case 5:this.$ = false;
|
|
12177
|
+
break;
|
|
12178
|
+
case 6:return this.$ = $$[$0-1];
|
|
12179
|
+
case 13:this.$ = {};
|
|
12180
|
+
break;
|
|
12181
|
+
case 14:this.$ = $$[$0-1];
|
|
12182
|
+
break;
|
|
12183
|
+
case 15:this.$ = [$$[$0-2], $$[$0]];
|
|
12184
|
+
break;
|
|
12185
|
+
case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
|
|
12186
|
+
break;
|
|
12187
|
+
case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1];
|
|
12188
|
+
break;
|
|
12189
|
+
case 18:this.$ = [];
|
|
12190
|
+
break;
|
|
12191
|
+
case 19:this.$ = $$[$0-1];
|
|
12192
|
+
break;
|
|
12193
|
+
case 20:this.$ = [$$[$0]];
|
|
12194
|
+
break;
|
|
12195
|
+
case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]);
|
|
12196
|
+
break;
|
|
12197
|
+
}
|
|
12198
|
+
},
|
|
12199
|
+
table: [{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],
|
|
12200
|
+
defaultActions: {16:[2,6]},
|
|
12201
|
+
parseError: function parseError(str, hash) {
|
|
12202
|
+
throw new Error(str);
|
|
12203
|
+
},
|
|
12204
|
+
parse: function parse(input) {
|
|
12205
|
+
var self = this,
|
|
12206
|
+
stack = [0],
|
|
12207
|
+
vstack = [null], // semantic value stack
|
|
12208
|
+
lstack = [], // location stack
|
|
12209
|
+
table = this.table,
|
|
12210
|
+
yytext = '',
|
|
12211
|
+
yylineno = 0,
|
|
12212
|
+
yyleng = 0,
|
|
12213
|
+
recovering = 0,
|
|
12214
|
+
TERROR = 2,
|
|
12215
|
+
EOF = 1;
|
|
12216
|
+
|
|
12217
|
+
//this.reductionCount = this.shiftCount = 0;
|
|
12218
|
+
|
|
12219
|
+
this.lexer.setInput(input);
|
|
12220
|
+
this.lexer.yy = this.yy;
|
|
12221
|
+
this.yy.lexer = this.lexer;
|
|
12222
|
+
if (typeof this.lexer.yylloc == 'undefined')
|
|
12223
|
+
this.lexer.yylloc = {};
|
|
12224
|
+
var yyloc = this.lexer.yylloc;
|
|
12225
|
+
lstack.push(yyloc);
|
|
12226
|
+
|
|
12227
|
+
if (typeof this.yy.parseError === 'function')
|
|
12228
|
+
this.parseError = this.yy.parseError;
|
|
12229
|
+
|
|
12230
|
+
function popStack (n) {
|
|
12231
|
+
stack.length = stack.length - 2*n;
|
|
12232
|
+
vstack.length = vstack.length - n;
|
|
12233
|
+
lstack.length = lstack.length - n;
|
|
12234
|
+
}
|
|
12235
|
+
|
|
12236
|
+
function lex() {
|
|
12237
|
+
var token;
|
|
12238
|
+
token = self.lexer.lex() || 1; // $end = 1
|
|
12239
|
+
// if token isn't its numeric value, convert
|
|
12240
|
+
if (typeof token !== 'number') {
|
|
12241
|
+
token = self.symbols_[token] || token;
|
|
12242
|
+
}
|
|
12243
|
+
return token;
|
|
12244
|
+
}
|
|
12245
|
+
|
|
12246
|
+
var symbol, preErrorSymbol, state, action, r, yyval={},p,len,newState, expected;
|
|
12247
|
+
while (true) {
|
|
12248
|
+
// retreive state number from top of stack
|
|
12249
|
+
state = stack[stack.length-1];
|
|
12250
|
+
|
|
12251
|
+
// use default actions if available
|
|
12252
|
+
if (this.defaultActions[state]) {
|
|
12253
|
+
action = this.defaultActions[state];
|
|
12254
|
+
} else {
|
|
12255
|
+
if (symbol == null)
|
|
12256
|
+
symbol = lex();
|
|
12257
|
+
// read action for current state and first input
|
|
12258
|
+
action = table[state] && table[state][symbol];
|
|
12259
|
+
}
|
|
12260
|
+
|
|
12261
|
+
// handle parse error
|
|
12262
|
+
if (typeof action === 'undefined' || !action.length || !action[0]) {
|
|
12263
|
+
|
|
12264
|
+
if (!recovering) {
|
|
12265
|
+
// Report error
|
|
12266
|
+
expected = [];
|
|
12267
|
+
for (p in table[state]) if (this.terminals_[p] && p > 2) {
|
|
12268
|
+
expected.push("'"+this.terminals_[p]+"'");
|
|
12269
|
+
}
|
|
12270
|
+
var errStr = '';
|
|
12271
|
+
if (this.lexer.showPosition) {
|
|
12272
|
+
errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
|
|
12273
|
+
} else {
|
|
12274
|
+
errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
|
|
12275
|
+
(symbol == 1 /*EOF*/ ? "end of input" :
|
|
12276
|
+
("'"+(this.terminals_[symbol] || symbol)+"'"));
|
|
12277
|
+
}
|
|
12278
|
+
this.parseError(errStr,
|
|
12279
|
+
{text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
|
|
12280
|
+
}
|
|
12281
|
+
|
|
12282
|
+
// just recovered from another error
|
|
12283
|
+
if (recovering == 3) {
|
|
12284
|
+
if (symbol == EOF) {
|
|
12285
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
12286
|
+
}
|
|
12287
|
+
|
|
12288
|
+
// discard current lookahead and grab another
|
|
12289
|
+
yyleng = this.lexer.yyleng;
|
|
12290
|
+
yytext = this.lexer.yytext;
|
|
12291
|
+
yylineno = this.lexer.yylineno;
|
|
12292
|
+
yyloc = this.lexer.yylloc;
|
|
12293
|
+
symbol = lex();
|
|
12294
|
+
}
|
|
12295
|
+
|
|
12296
|
+
// try to recover from error
|
|
12297
|
+
while (1) {
|
|
12298
|
+
// check for error recovery rule in this state
|
|
12299
|
+
if ((TERROR.toString()) in table[state]) {
|
|
12300
|
+
break;
|
|
12301
|
+
}
|
|
12302
|
+
if (state == 0) {
|
|
12303
|
+
throw new Error(errStr || 'Parsing halted.');
|
|
12304
|
+
}
|
|
12305
|
+
popStack(1);
|
|
12306
|
+
state = stack[stack.length-1];
|
|
12307
|
+
}
|
|
12308
|
+
|
|
12309
|
+
preErrorSymbol = symbol; // save the lookahead token
|
|
12310
|
+
symbol = TERROR; // insert generic error symbol as new lookahead
|
|
12311
|
+
state = stack[stack.length-1];
|
|
12312
|
+
action = table[state] && table[state][TERROR];
|
|
12313
|
+
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
|
|
12314
|
+
}
|
|
12315
|
+
|
|
12316
|
+
// this shouldn't happen, unless resolve defaults are off
|
|
12317
|
+
if (action[0] instanceof Array && action.length > 1) {
|
|
12318
|
+
throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
|
|
12319
|
+
}
|
|
12320
|
+
|
|
12321
|
+
switch (action[0]) {
|
|
12322
|
+
|
|
12323
|
+
case 1: // shift
|
|
12324
|
+
//this.shiftCount++;
|
|
12325
|
+
|
|
12326
|
+
stack.push(symbol);
|
|
12327
|
+
vstack.push(this.lexer.yytext);
|
|
12328
|
+
lstack.push(this.lexer.yylloc);
|
|
12329
|
+
stack.push(action[1]); // push state
|
|
12330
|
+
symbol = null;
|
|
12331
|
+
if (!preErrorSymbol) { // normal execution/no error
|
|
12332
|
+
yyleng = this.lexer.yyleng;
|
|
12333
|
+
yytext = this.lexer.yytext;
|
|
12334
|
+
yylineno = this.lexer.yylineno;
|
|
12335
|
+
yyloc = this.lexer.yylloc;
|
|
12336
|
+
if (recovering > 0)
|
|
12337
|
+
recovering--;
|
|
12338
|
+
} else { // error just occurred, resume old lookahead f/ before error
|
|
12339
|
+
symbol = preErrorSymbol;
|
|
12340
|
+
preErrorSymbol = null;
|
|
12341
|
+
}
|
|
12342
|
+
break;
|
|
12343
|
+
|
|
12344
|
+
case 2: // reduce
|
|
12345
|
+
//this.reductionCount++;
|
|
12346
|
+
|
|
12347
|
+
len = this.productions_[action[1]][1];
|
|
12348
|
+
|
|
12349
|
+
// perform semantic action
|
|
12350
|
+
yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
|
|
12351
|
+
// default location, uses first token for firsts, last for lasts
|
|
12352
|
+
yyval._$ = {
|
|
12353
|
+
first_line: lstack[lstack.length-(len||1)].first_line,
|
|
12354
|
+
last_line: lstack[lstack.length-1].last_line,
|
|
12355
|
+
first_column: lstack[lstack.length-(len||1)].first_column,
|
|
12356
|
+
last_column: lstack[lstack.length-1].last_column
|
|
12357
|
+
};
|
|
12358
|
+
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
|
12359
|
+
|
|
12360
|
+
if (typeof r !== 'undefined') {
|
|
12361
|
+
return r;
|
|
12362
|
+
}
|
|
12363
|
+
|
|
12364
|
+
// pop off stack
|
|
12365
|
+
if (len) {
|
|
12366
|
+
stack = stack.slice(0,-1*len*2);
|
|
12367
|
+
vstack = vstack.slice(0, -1*len);
|
|
12368
|
+
lstack = lstack.slice(0, -1*len);
|
|
12369
|
+
}
|
|
12370
|
+
|
|
12371
|
+
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
|
|
12372
|
+
vstack.push(yyval.$);
|
|
12373
|
+
lstack.push(yyval._$);
|
|
12374
|
+
// goto new state = table[STATE][NONTERMINAL]
|
|
12375
|
+
newState = table[stack[stack.length-2]][stack[stack.length-1]];
|
|
12376
|
+
stack.push(newState);
|
|
12377
|
+
break;
|
|
12378
|
+
|
|
12379
|
+
case 3: // accept
|
|
12380
|
+
return true;
|
|
12381
|
+
}
|
|
12382
|
+
|
|
12383
|
+
}
|
|
12384
|
+
|
|
12385
|
+
return true;
|
|
12386
|
+
}};
|
|
12387
|
+
/* Jison generated lexer */
|
|
12388
|
+
var lexer = (function(){
|
|
12389
|
+
var lexer = ({EOF:1,
|
|
12390
|
+
parseError:function parseError(str, hash) {
|
|
12391
|
+
if (this.yy.parseError) {
|
|
12392
|
+
this.yy.parseError(str, hash);
|
|
12393
|
+
} else {
|
|
12394
|
+
throw new Error(str);
|
|
12395
|
+
}
|
|
12396
|
+
},
|
|
12397
|
+
setInput:function (input) {
|
|
12398
|
+
this._input = input;
|
|
12399
|
+
this._more = this._less = this.done = false;
|
|
12400
|
+
this.yylineno = this.yyleng = 0;
|
|
12401
|
+
this.yytext = this.matched = this.match = '';
|
|
12402
|
+
this.conditionStack = ['INITIAL'];
|
|
12403
|
+
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
|
12404
|
+
return this;
|
|
12405
|
+
},
|
|
12406
|
+
input:function () {
|
|
12407
|
+
var ch = this._input[0];
|
|
12408
|
+
this.yytext+=ch;
|
|
12409
|
+
this.yyleng++;
|
|
12410
|
+
this.match+=ch;
|
|
12411
|
+
this.matched+=ch;
|
|
12412
|
+
var lines = ch.match(/\n/);
|
|
12413
|
+
if (lines) this.yylineno++;
|
|
12414
|
+
this._input = this._input.slice(1);
|
|
12415
|
+
return ch;
|
|
12416
|
+
},
|
|
12417
|
+
unput:function (ch) {
|
|
12418
|
+
this._input = ch + this._input;
|
|
12419
|
+
return this;
|
|
12420
|
+
},
|
|
12421
|
+
more:function () {
|
|
12422
|
+
this._more = true;
|
|
12423
|
+
return this;
|
|
12424
|
+
},
|
|
12425
|
+
less:function (n) {
|
|
12426
|
+
this._input = this.match.slice(n) + this._input;
|
|
12427
|
+
},
|
|
12428
|
+
pastInput:function () {
|
|
12429
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
12430
|
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
|
12431
|
+
},
|
|
12432
|
+
upcomingInput:function () {
|
|
12433
|
+
var next = this.match;
|
|
12434
|
+
if (next.length < 20) {
|
|
12435
|
+
next += this._input.substr(0, 20-next.length);
|
|
12436
|
+
}
|
|
12437
|
+
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
|
12438
|
+
},
|
|
12439
|
+
showPosition:function () {
|
|
12440
|
+
var pre = this.pastInput();
|
|
12441
|
+
var c = new Array(pre.length + 1).join("-");
|
|
12442
|
+
return pre + this.upcomingInput() + "\n" + c+"^";
|
|
12443
|
+
},
|
|
12444
|
+
next:function () {
|
|
12445
|
+
if (this.done) {
|
|
12446
|
+
return this.EOF;
|
|
12447
|
+
}
|
|
12448
|
+
if (!this._input) this.done = true;
|
|
12449
|
+
|
|
12450
|
+
var token,
|
|
12451
|
+
match,
|
|
12452
|
+
tempMatch,
|
|
12453
|
+
index,
|
|
12454
|
+
lines;
|
|
12455
|
+
if (!this._more) {
|
|
12456
|
+
this.yytext = '';
|
|
12457
|
+
this.match = '';
|
|
12458
|
+
}
|
|
12459
|
+
var rules = this._currentRules();
|
|
12460
|
+
for (var i=0;i < rules.length; i++) {
|
|
12461
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
12462
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
12463
|
+
match = tempMatch;
|
|
12464
|
+
index = i;
|
|
12465
|
+
if (!this.options.flex) break;
|
|
12466
|
+
}
|
|
12467
|
+
}
|
|
12468
|
+
if (match) {
|
|
12469
|
+
lines = match[0].match(/\n.*/g);
|
|
12470
|
+
if (lines) this.yylineno += lines.length;
|
|
12471
|
+
this.yylloc = {first_line: this.yylloc.last_line,
|
|
12472
|
+
last_line: this.yylineno+1,
|
|
12473
|
+
first_column: this.yylloc.last_column,
|
|
12474
|
+
last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length};
|
|
12475
|
+
this.yytext += match[0];
|
|
12476
|
+
this.match += match[0];
|
|
12477
|
+
this.yyleng = this.yytext.length;
|
|
12478
|
+
this._more = false;
|
|
12479
|
+
this._input = this._input.slice(match[0].length);
|
|
12480
|
+
this.matched += match[0];
|
|
12481
|
+
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
|
12482
|
+
if (this.done && this._input) this.done = false;
|
|
12483
|
+
if (token) return token;
|
|
12484
|
+
else return;
|
|
12485
|
+
}
|
|
12486
|
+
if (this._input === "") {
|
|
12487
|
+
return this.EOF;
|
|
12488
|
+
} else {
|
|
12489
|
+
this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
|
12490
|
+
{text: "", token: null, line: this.yylineno});
|
|
12491
|
+
}
|
|
12492
|
+
},
|
|
12493
|
+
lex:function lex() {
|
|
12494
|
+
var r = this.next();
|
|
12495
|
+
if (typeof r !== 'undefined') {
|
|
12496
|
+
return r;
|
|
12497
|
+
} else {
|
|
12498
|
+
return this.lex();
|
|
12499
|
+
}
|
|
12500
|
+
},
|
|
12501
|
+
begin:function begin(condition) {
|
|
12502
|
+
this.conditionStack.push(condition);
|
|
12503
|
+
},
|
|
12504
|
+
popState:function popState() {
|
|
12505
|
+
return this.conditionStack.pop();
|
|
12506
|
+
},
|
|
12507
|
+
_currentRules:function _currentRules() {
|
|
12508
|
+
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
|
12509
|
+
},
|
|
12510
|
+
topState:function () {
|
|
12511
|
+
return this.conditionStack[this.conditionStack.length-2];
|
|
12512
|
+
},
|
|
12513
|
+
pushState:function begin(condition) {
|
|
12514
|
+
this.begin(condition);
|
|
12515
|
+
}});
|
|
12516
|
+
lexer.options = {};
|
|
12517
|
+
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
|
12518
|
+
switch($avoiding_name_collisions) {
|
|
12519
|
+
case 0:/* skip whitespace */
|
|
12520
|
+
break;
|
|
12521
|
+
case 1:return 6
|
|
12522
|
+
case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4
|
|
12523
|
+
case 3:return 17
|
|
12524
|
+
case 4:return 18
|
|
12525
|
+
case 5:return 23
|
|
12526
|
+
case 6:return 24
|
|
12527
|
+
case 7:return 22
|
|
12528
|
+
case 8:return 21
|
|
12529
|
+
case 9:return 10
|
|
12530
|
+
case 10:return 11
|
|
12531
|
+
case 11:return 8
|
|
12532
|
+
case 12:return 14
|
|
12533
|
+
case 13:return 'INVALID'
|
|
12534
|
+
}
|
|
12535
|
+
};
|
|
12536
|
+
lexer.rules = [/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/];
|
|
12537
|
+
lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}};
|
|
12538
|
+
return lexer;})();
|
|
12539
|
+
parser.lexer = lexer;
|
|
12540
|
+
return parser;
|
|
12541
|
+
})();
|
|
12542
|
+
|
|
12543
|
+
var origParse = jsonlint.parse;
|
|
12544
|
+
|
|
12545
|
+
jsonlint.parse = function(input) {
|
|
12546
|
+
var result = origParse.call(jsonlint, input);
|
|
12547
|
+
var dougJSONParse = typeof ___dougJSONParse === 'undefined' ? require('./doug-json-parse') : ___dougJSONParse;
|
|
12548
|
+
try {
|
|
12549
|
+
dougJSONParse(input);
|
|
12550
|
+
} catch(e) {
|
|
12551
|
+
if(/Duplicate key|Bad string|Unexpected/.test(e.message)) {
|
|
12552
|
+
var linesUntilError = input.substring(0, e.at).split('\n');
|
|
12553
|
+
var line = linesUntilError.length;
|
|
12554
|
+
var col = linesUntilError[line - 1].length - 1;
|
|
12555
|
+
|
|
12556
|
+
this.parseError(e.message, {line: line, col: col, message: e.message.replace(/./, function(l) { return l.toLowerCase(); })});
|
|
12557
|
+
throw SyntaxError(e.message + ' on line ' + line);
|
|
12558
|
+
}
|
|
12559
|
+
}
|
|
12560
|
+
|
|
12561
|
+
return result;
|
|
12562
|
+
};
|
|
12563
|
+
|
|
12564
|
+
if (typeof exports !== 'undefined') {
|
|
12565
|
+
exports.parser = jsonlint;
|
|
12566
|
+
exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); };
|
|
12567
|
+
exports.main = function commonjsMain(args) {
|
|
12568
|
+
if (!args[1])
|
|
12569
|
+
throw new Error('Usage: '+args[0]+' FILE');
|
|
12570
|
+
if (typeof process !== 'undefined') {
|
|
12571
|
+
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
|
|
12572
|
+
} else {
|
|
12573
|
+
var cwd = require("file").path(require("file").cwd());
|
|
12574
|
+
var source = cwd.join(args[1]).read({charset: "utf-8"});
|
|
12575
|
+
}
|
|
12576
|
+
return exports.parser.parse(source);
|
|
12577
|
+
};
|
|
12578
|
+
if (require.main === module) {
|
|
12579
|
+
exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
|
|
12580
|
+
}
|
|
12581
|
+
}
|
|
12582
|
+
return exports;})();if(module.exports) module.exports = jsonlint;
|
|
12583
|
+
});
|
|
12584
|
+
|
|
12585
|
+
const codeEditorCss = ".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px;}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white;}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.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}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.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 .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:transparent}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:transparent}.cm-fat-cursor{caret-color:transparent}@-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%{}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.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-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}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}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none;outline: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:-50px}.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;}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-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.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{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;}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.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)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}.CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:#ffd;border:1px solid black;border-radius:4px 4px 4px 4px;color:black;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark{background-position:left bottom;background-repeat:repeat-x}.CodeMirror-lint-mark-warning{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=\")}.CodeMirror-lint-mark-error{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==\")}.CodeMirror-lint-marker{background-position:center center;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message{padding-left:18px;background-position:top left;background-repeat:no-repeat}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=\")}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=\")}.CodeMirror-lint-marker-multiple{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC\");background-repeat:no-repeat;background-position:right bottom;width:100%;height:100%}.CodeMirror-lint-line-error{background-color:rgba(183, 76, 81, 0.08)}.CodeMirror-lint-line-warning{background-color:rgba(255, 211, 0, 0.1)}.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:\"\\25BE\"}.CodeMirror-foldgutter-folded:after{content:\"\\25B8\"}:host{display:flex;font-size:var(--code-editor-font-size, 0.875rem)}.editor{display:flex;align-items:stretch;width:100%}.editor.is-light-mode{--code-editor-neutral-text-color:var(--contrast-1100);--code-editor-background-color:var(--contrast-200);--code-editor-gutter-background-color:var(--contrast-300);--code-editor-line-number-text-color:var(--contrast-700);--code-editor-cursor-color:var(--color-amber-dark);--code-editor-selection-highlight-color:var(--color-cyan-default);--code-editor-selection-lowlight-color:var(--contrast-600)}.editor.is-light-mode .cm-attribute,.editor.is-light-mode .cm-property,.editor.is-light-mode .cm-keyword{color:rgb(var(--color-violet-light))}.editor.is-light-mode .cm-operator{color:rgb(var(--color-sky-dark))}.editor.is-light-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-light-mode .cm-variable-2{color:rgb(var(--contrast-1100))}.editor.is-light-mode .cm-variable-3,.editor.is-light-mode .cm-type{color:rgb(var(--color-amber-darker))}.editor.is-light-mode .cm-builtin,.editor.is-light-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-light-mode .cm-atom{color:rgb(var(--color-coral-default))}.editor.is-light-mode .cm-tag,.editor.is-light-mode .cm-number{color:rgb(var(--color-magenta-default))}.editor.is-light-mode .cm-def{color:rgb(var(--color-sky-default))}.editor.is-light-mode .cm-string{color:rgb(var(--color-green-dark))}.editor.is-light-mode .cm-string-2{color:rgb(var(--color-pink-default))}.editor.is-light-mode .cm-qualifier{color:rgb(var(--color-grass-default))}.editor.is-light-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-light-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.7)}.editor.is-dark-mode{--code-editor-neutral-text-color:var(--contrast-200);--code-editor-background-color:var(--contrast-1600);--code-editor-gutter-background-color:var(--contrast-1500);--code-editor-line-number-text-color:var(--contrast-1000);--code-editor-cursor-color:var(--color-amber-default);--code-editor-selection-highlight-color:var(--color-cyan-light);--code-editor-selection-lowlight-color:var(--contrast-1700)}.editor.is-dark-mode .cm-attribute,.editor.is-dark-mode .cm-property,.editor.is-dark-mode .cm-keyword{color:rgb(var(--color-purple-lighter))}.editor.is-dark-mode .cm-operator{color:rgb(var(--color-sky-lighter))}.editor.is-dark-mode .cm-variable{color:rgb(var(--color-pink-light))}.editor.is-dark-mode .cm-variable-2{color:rgb(var(--contrast-300))}.editor.is-dark-mode .cm-variable-3,.editor.is-dark-mode .cm-type{color:rgb(var(--color-yellow-light))}.editor.is-dark-mode .cm-builtin,.editor.is-dark-mode .cm-meta{color:rgb(var(--color-amber-default))}.editor.is-dark-mode .cm-atom{color:rgb(var(--color-coral-light))}.editor.is-dark-mode .cm-tag,.editor.is-dark-mode .cm-number{color:rgb(var(--color-magenta-light))}.editor.is-dark-mode .cm-def{color:rgb(var(--color-sky-light))}.editor.is-dark-mode .cm-string{color:rgb(var(--color-lime-light))}.editor.is-dark-mode .cm-string-2{color:rgb(var(--color-pink-lighter))}.editor.is-dark-mode .cm-qualifier{color:rgb(var(--color-grass-light))}.editor.is-dark-mode .cm-error{color:rgb(var(--color-white));background-color:rgb(var(--color-red-default))}.editor.is-dark-mode .cm-comment{color:rgba(var(--code-editor-neutral-text-color), 0.4)}.editor.readonly .CodeMirror-focused .CodeMirror-cursors{visibility:visible !important}.cm-s-lime.CodeMirror{color:rgb(var(--code-editor-neutral-text-color));background-color:rgb(var(--code-editor-background-color));border-radius:0.25rem;height:auto;width:100%}.cm-s-lime .CodeMirror-scroll{max-height:var(--code-editor-max-height, 10rem)}.cm-s-lime.CodeMirror-focused div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.15)}.cm-s-lime div.CodeMirror-selected{background:rgba(var(--code-editor-selection-highlight-color), 0.05)}.cm-s-lime .CodeMirror-gutters{background-color:rgb(var(--code-editor-gutter-background-color));color:rgb(var(--code-editor-line-number-text-color));border:none}.cm-s-lime .CodeMirror-guttermarker,.cm-s-lime .CodeMirror-guttermarker-subtle,.cm-s-lime .CodeMirror-linenumber{color:rgb(var(--code-editor-line-number-text-color))}.cm-s-lime .CodeMirror-cursor{border-left:1px solid rgb(var(--code-editor-cursor-color))}.editor.readonly .cm-s-lime .CodeMirror-cursor{border-color:rgba(var(--code-editor-neutral-text-color), 0.5);border-width:0.125rem}.cm-s-lime .CodeMirror-activeline-background{background:rgba(var(--code-editor-selection-lowlight-color), 0.5)}.cm-s-lime .CodeMirror-matchingbracket{font-weight:bold;color:rgb(var(--code-editor-neutral-text-color)) !important;background:rgba(var(--code-editor-selection-highlight-color), 0.15);position:relative}.cm-s-lime .CodeMirror-matchingbracket:before{content:\"_\";color:rgb(var(--code-editor-selection-highlight-color), 0.8);position:absolute;bottom:-0.4rem;left:0;right:0}.cm-s-lime .CodeMirror-lint-marker-error,.cm-s-lime .CodeMirror-lint-message-error{background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><defs/><path fill='rgb(255,255,255)' d='M7.219 5.781L5.78 7.22 14.563 16 5.78 24.781 7.22 26.22 16 17.437l8.781 8.782 1.438-1.438L17.437 16l8.782-8.781L24.78 5.78 16 14.563z'/></svg>\");background-color:rgb(var(--color-red-default));background-size:0.75rem;border-radius:50%}.cm-s-lime .CodeMirror-foldmarker{position:relative;transition:background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;box-shadow:var(--button-shadow-normal);color:transparent;text-shadow:none;padding:0 0.5rem;border-radius:1rem;background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' xml:space='preserve'><circle cx='16' cy='16' r='2'/><circle cx='26' cy='16' r='2'/><circle cx='6' cy='16' r='2'/></svg>\");background-size:contain;background-repeat:no-repeat;background-position:center}.cm-s-lime .CodeMirror-foldmarker:hover{box-shadow:var(--button-shadow-hovered)}.cm-s-lime .CodeMirror-foldmarker:active{box-shadow:var(--button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}.is-dark-mode .cm-s-lime .CodeMirror-foldmarker{background-color:rgb(var(--contrast-1200))}.cm-s-lime [class^=CodeMirror-foldgutter]{color:var(--code-editor-neutral-text-color);transition:opacity 0.2s ease;opacity:0.4}.cm-s-lime [class^=CodeMirror-foldgutter]:hover{opacity:1}.cm-s-lime .CodeMirror-foldgutter-folded{opacity:0.7}";
|
|
11037
12586
|
|
|
11038
12587
|
const CodeEditor = class {
|
|
11039
12588
|
constructor(hostRef) {
|
|
@@ -11051,6 +12600,14 @@ const CodeEditor = class {
|
|
|
11051
12600
|
* Displays line numbers in the editor
|
|
11052
12601
|
*/
|
|
11053
12602
|
this.lineNumbers = false;
|
|
12603
|
+
/**
|
|
12604
|
+
* Allows the user to fold code
|
|
12605
|
+
*/
|
|
12606
|
+
this.fold = false;
|
|
12607
|
+
/**
|
|
12608
|
+
* Enables linting of JSON content
|
|
12609
|
+
*/
|
|
12610
|
+
this.lint = false;
|
|
11054
12611
|
/**
|
|
11055
12612
|
* Select color scheme for the editor
|
|
11056
12613
|
*/
|
|
@@ -11092,16 +12649,37 @@ const CodeEditor = class {
|
|
|
11092
12649
|
}
|
|
11093
12650
|
this.editor = this.createEditor();
|
|
11094
12651
|
}
|
|
12652
|
+
watchValue(newValue) {
|
|
12653
|
+
if (!this.editor) {
|
|
12654
|
+
return;
|
|
12655
|
+
}
|
|
12656
|
+
const currentValue = this.editor.getValue();
|
|
12657
|
+
if (newValue === currentValue) {
|
|
12658
|
+
// Circuit breaker for when the change comes from the editor itself
|
|
12659
|
+
// The caret position will be reset without this
|
|
12660
|
+
return;
|
|
12661
|
+
}
|
|
12662
|
+
this.editor.getDoc().setValue(newValue || '');
|
|
12663
|
+
}
|
|
11095
12664
|
createEditor() {
|
|
11096
12665
|
const options = this.getOptions();
|
|
11097
12666
|
const editor = codemirror(this.host.shadowRoot.querySelector('.editor'), options);
|
|
11098
12667
|
editor.on('change', this.handleChange);
|
|
12668
|
+
// Replace tab with spaces and use the actual indent setting for
|
|
12669
|
+
// the space count
|
|
12670
|
+
editor.setOption('extraKeys', {
|
|
12671
|
+
Tab: (codeMirror) => {
|
|
12672
|
+
const spaces = Array(codeMirror.getOption('indentUnit') + 1).join(' ');
|
|
12673
|
+
codeMirror.replaceSelection(spaces);
|
|
12674
|
+
},
|
|
12675
|
+
});
|
|
11099
12676
|
return editor;
|
|
11100
12677
|
}
|
|
11101
12678
|
getOptions() {
|
|
11102
12679
|
let mode = this.language;
|
|
11103
12680
|
const TAB_SIZE = 4;
|
|
11104
12681
|
let theme = 'lime light';
|
|
12682
|
+
const gutters = [];
|
|
11105
12683
|
if (this.isDarkMode()) {
|
|
11106
12684
|
theme = 'lime dark';
|
|
11107
12685
|
}
|
|
@@ -11110,6 +12688,13 @@ const CodeEditor = class {
|
|
|
11110
12688
|
name: 'application/json',
|
|
11111
12689
|
json: true,
|
|
11112
12690
|
};
|
|
12691
|
+
if (this.lint) {
|
|
12692
|
+
gutters.push('CodeMirror-lint-markers');
|
|
12693
|
+
if (!('jsonlint' in window)) {
|
|
12694
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
12695
|
+
window['jsonlint'] = jsonlint_1;
|
|
12696
|
+
}
|
|
12697
|
+
}
|
|
11113
12698
|
}
|
|
11114
12699
|
else if (this.language === 'typescript') {
|
|
11115
12700
|
mode = {
|
|
@@ -11117,9 +12702,12 @@ const CodeEditor = class {
|
|
|
11117
12702
|
typescript: true,
|
|
11118
12703
|
};
|
|
11119
12704
|
}
|
|
12705
|
+
if (this.fold) {
|
|
12706
|
+
gutters.push('CodeMirror-foldgutter');
|
|
12707
|
+
}
|
|
11120
12708
|
return {
|
|
11121
12709
|
mode: mode,
|
|
11122
|
-
value: this.value,
|
|
12710
|
+
value: this.value || '',
|
|
11123
12711
|
theme: theme,
|
|
11124
12712
|
readOnly: this.readonly,
|
|
11125
12713
|
tabSize: TAB_SIZE,
|
|
@@ -11127,6 +12715,9 @@ const CodeEditor = class {
|
|
|
11127
12715
|
lineNumbers: this.lineNumbers,
|
|
11128
12716
|
styleActiveLine: true,
|
|
11129
12717
|
matchBrackets: true,
|
|
12718
|
+
lint: this.lint,
|
|
12719
|
+
foldGutter: this.fold,
|
|
12720
|
+
gutters: gutters,
|
|
11130
12721
|
};
|
|
11131
12722
|
}
|
|
11132
12723
|
isDarkMode() {
|
|
@@ -11151,6 +12742,9 @@ const CodeEditor = class {
|
|
|
11151
12742
|
return matchMedia('(prefers-color-scheme: dark)');
|
|
11152
12743
|
}
|
|
11153
12744
|
get host() { return getElement(this); }
|
|
12745
|
+
static get watchers() { return {
|
|
12746
|
+
"value": ["watchValue"]
|
|
12747
|
+
}; }
|
|
11154
12748
|
};
|
|
11155
12749
|
CodeEditor.style = codeEditorCss;
|
|
11156
12750
|
|