insomnia/app/ui/css/components/editor.less

428 lines
8.1 KiB
Plaintext
Raw Normal View History

2016-03-16 23:34:25 +00:00
@import '../constants/colors';
@import '../constants/animations';
2016-03-23 05:58:16 +00:00
@import '../constants/dimensions';
2016-07-20 23:16:28 +00:00
@import '../constants/fonts';
2016-03-16 23:34:25 +00:00
2016-05-01 19:56:30 +00:00
.editor {
box-sizing: border-box;
height: 100% !important;
width: 100%;
2016-09-08 22:04:25 +00:00
display: grid;
2016-09-20 20:53:34 +00:00
grid-template-rows: minmax(0, 1fr) auto;
2016-09-09 00:32:36 +00:00
grid-template-columns: 100%;
&.editor--single-line {
&, * {
font-family: @font-default !important;
text-decoration: inherit;
color: inherit;
}
.CodeMirror > div > textarea {
// This is the hidden div CodeMirror uses for stuff. By, default it's
// a 1000px absolutely positioned thing for doing work inside of. However, this
// means that the drag-n-drop shadow image is wider than it should be. So, we're
// constraining it here, which may break CM in weird ways, but doesn't seem to
// at first glance.
max-width: 5em !important;
}
.CodeMirror,
.CodeMirror-lines {
padding: 0 !important;
margin: 0 !important;
}
.CodeMirror-scroll {
padding-bottom: 1em;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
.CodeMirror-dialog {
opacity: 1;
border: 0;
height: 100%;
animation: fadeIn 500ms;
flex-wrap: nowrap;
padding: 0;
margin: 0;
& {
font-size: 0.95em;
}
}
.nunjucks-widget {
padding-top: 0.2em;
padding-bottom: 0.2em;
}
}
2016-09-08 22:04:25 +00:00
2016-09-20 21:17:01 +00:00
.editor__container {
height: 100%;
width: 100%;
position: relative;
}
.CodeMirror {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
2016-09-13 17:29:09 +00:00
.editor__toolbar {
2016-09-08 22:04:25 +00:00
display: flex;
flex-direction: row;
align-items: center;
2016-09-13 17:29:09 +00:00
border-top: 1px solid @hl-md;
height: @line-height-xs;
font-size: @font-size-sm;
2016-09-08 22:04:25 +00:00
2016-09-13 17:29:09 +00:00
input {
2016-09-13 21:18:22 +00:00
font-family: @font-monospace;
2016-09-08 22:04:25 +00:00
margin-right: 0;
width: 100%;
2016-09-13 17:29:09 +00:00
margin-left: @padding-md;
2016-09-08 22:04:25 +00:00
}
button {
color: @hl;
2016-09-13 17:29:09 +00:00
padding: @padding-xs @padding-md;
height: 100%;
2016-09-08 22:04:25 +00:00
}
}
2016-05-01 19:56:30 +00:00
.CodeMirror {
2016-04-10 06:59:05 +00:00
height: 100% !important;
2016-04-06 04:21:42 +00:00
width: 100%;
2016-05-01 19:56:30 +00:00
box-sizing: border-box;
2016-08-29 17:58:59 +00:00
font-family: @font-monospace;
}
2016-05-01 19:56:30 +00:00
.CodeMirror,
.cm-s-seti.CodeMirror, // Hack because seti theme is dumb
.CodeMirror-gutters,
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
// Let the background behind show through
background-color: transparent !important;
2016-05-01 19:56:30 +00:00
border: 0;
}
.CodeMirror-linenumber, .CodeMirror-guttermarker-subtle {
2016-08-29 17:58:59 +00:00
color: @hl-xl !important;
2016-05-01 19:56:30 +00:00
}
2016-10-02 22:17:55 +00:00
.CodeMirror-gutter {
2017-01-23 22:41:31 +00:00
background-color: var(--color-bg);
2016-10-05 04:43:48 +00:00
}
2016-05-01 19:56:30 +00:00
.CodeMirror-scroll {
cursor: text; // Show text cursor everywhere (not just in .Codemirror-lines)
}
.CodeMirror-lines {
// Scroll past the end
2016-08-22 20:05:42 +00:00
padding-bottom: 30px;
2016-05-01 19:56:30 +00:00
}
.CodeMirror-placeholder {
color: @hl-lg;
2016-05-01 19:56:30 +00:00
}
2016-03-16 23:34:25 +00:00
2016-06-18 22:57:23 +00:00
.CodeMirror-lint-marker-error {
width: 100%;
height: 1em;
display: flex;
background: none;
text-align: center;
&::after {
2017-01-23 22:41:31 +00:00
color: var(--color-danger);
2016-06-18 23:02:01 +00:00
text-align: center;
width: 100%;
2016-06-19 00:08:14 +00:00
font-size: 0.7em; // because the circle is so large
2016-06-18 23:02:01 +00:00
content: '⬤';
2016-06-18 22:57:23 +00:00
}
}
.CodeMirror-activeline-gutter,
.CodeMirror-activeline-background {
background-color: transparent;
}
&:not(.editor--readonly) .CodeMirror-focused .CodeMirror-activeline-gutter,
&:not(.editor--readonly) .CodeMirror-focused .CodeMirror-activeline-background {
background-color: var(--hl-xs);
}
&.editor--readonly .CodeMirror-cursors {
visibility: hidden;
2016-03-24 05:26:04 +00:00
}
2016-03-16 23:34:25 +00:00
}
2016-06-18 22:57:23 +00:00
2016-09-13 17:35:49 +00:00
// Search dialog (and others)
.CodeMirror-dialog {
2017-01-23 22:41:31 +00:00
background: var(--color-bg);
opacity: 0.95;
color: var(--hl);
border-color: var(--hl-md);
2017-01-23 22:41:31 +00:00
box-sizing: border-box;
width: 100%;
padding: @padding-sm @padding-xs @padding-xs @padding-xs;
box-shadow: 0 0 1em rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: row;
align-items: center;
white-space: nowrap;
input {
font-family: @font-monospace !important;
border: 0 !important;
height: 1em !important;
padding: 0 !important;
display: block;
width: 100% !important;
color: var(--color-font);
min-height: 1.5em;
}
* {
margin-left: 0.25em;
margin-right: 0.25em;
}
button {
color: var(--hl);
&:hover {
color: var(--color-font);
}
}
2016-09-13 17:35:49 +00:00
}
// Tooltip for errors
2016-06-18 22:57:23 +00:00
.CodeMirror-lint-tooltip {
2017-01-23 22:41:31 +00:00
background-color: var(--color-bg);
color: var(--color-font);
border-color: @hl-md;
2016-06-18 22:57:23 +00:00
border-radius: 0;
2016-08-29 17:58:59 +00:00
font-size: @font-size-md;
padding: @padding-xs @padding-sm;
z-index: 99999;
2016-06-18 22:57:23 +00:00
.CodeMirror-lint-message-error {
background-image: none;
padding-left: 0;
}
2017-01-23 22:41:31 +00:00
2016-06-18 22:57:23 +00:00
&::after {
display: none;
}
}
2016-06-20 06:43:35 +00:00
/* Based on Sublime Text's Monokai theme */
2017-01-24 22:18:11 +00:00
.CodeMirror {
color: var(--color-font);
line-height: 1.4em;
2016-06-20 06:43:35 +00:00
.CodeMirror-selected {
background: var(--color-font);
opacity: 0.2;
}
2017-01-24 22:18:11 +00:00
.CodeMirror-gutters {
2016-09-13 17:29:09 +00:00
border-right: 0;
}
2017-01-24 22:18:11 +00:00
.CodeMirror-guttermarker {
2017-01-23 22:41:31 +00:00
color: var(--color-font);
}
2017-01-24 22:18:11 +00:00
.CodeMirror-guttermarker-subtle {
color: @hl-lg;
}
2017-01-24 22:18:11 +00:00
.CodeMirror-linenumber {
color: @hl;
}
2017-01-24 22:18:11 +00:00
.CodeMirror-cursor {
2017-01-23 22:41:31 +00:00
border-left: 1px solid var(--color-font);
}
2017-01-24 22:18:11 +00:00
.cm-animate-fat-cursor,
&.cm-fat-cursor .CodeMirror-cursor {
background-color: rgba(255, 139, 147, 0.5) !important;
border-bottom: 2px solid #d60000 !important;
box-sizing: border-box;
}
span.cm-meta,
span.cm-qualifier {
2017-01-23 22:41:31 +00:00
color: var(--color-font);
}
2017-01-24 22:18:11 +00:00
span.cm-atom {
2017-01-23 22:41:31 +00:00
color: var(--color-surprise);
}
2017-01-24 22:18:11 +00:00
span.cm-number {
2017-01-23 22:41:31 +00:00
color: var(--color-surprise);
}
2017-01-24 22:18:11 +00:00
span.cm-keyword {
2017-01-23 22:41:31 +00:00
color: var(--color-danger);
}
2017-01-24 22:18:11 +00:00
span.cm-builtin {
2017-01-23 22:41:31 +00:00
color: var(--color-info);
}
2017-01-24 22:18:11 +00:00
span.cm-string {
2017-01-23 22:41:31 +00:00
color: var(--color-notice);
}
2017-01-24 22:18:11 +00:00
span.cm-property, span.cm-attribute {
2017-01-23 22:41:31 +00:00
color: var(--color-success);
}
2017-01-24 22:18:11 +00:00
span.cm-variable {
2017-01-23 22:41:31 +00:00
color: var(--color-font);
}
2017-01-24 22:18:11 +00:00
span.cm-variable-2 {
2017-01-23 22:41:31 +00:00
color: var(--color-info);
}
2017-01-24 22:18:11 +00:00
span.cm-variable-3 {
2017-02-13 08:12:02 +00:00
color: var(--color-surprise);
}
2017-01-24 22:18:11 +00:00
span.cm-def {
2017-01-23 22:41:31 +00:00
color: var(--color-warning);
}
2017-01-24 22:18:11 +00:00
span.cm-bracket {
2017-01-23 22:41:31 +00:00
color: var(--color-font);
}
2017-01-24 22:18:11 +00:00
span.cm-tag {
2017-01-23 22:41:31 +00:00
color: var(--color-danger);
}
2017-01-24 22:18:11 +00:00
span.cm-header {
2017-01-23 22:41:31 +00:00
color: var(--color-surprise);
}
2017-01-24 22:18:11 +00:00
span.cm-link {
2017-01-23 22:41:31 +00:00
color: var(--color-surprise);
}
2017-02-13 08:12:02 +00:00
span.cm-comment {
color: var(--hl);
}
2017-01-24 22:18:11 +00:00
span.cm-error {
2017-01-23 22:41:31 +00:00
background: var(--color-danger);
color: var(--color-font-danger);
}
span.cm-clickable {
text-decoration: underline;
cursor: pointer;
}
span.cm-clickable:hover {
text-decoration: underline;
}
2017-01-24 22:18:11 +00:00
.CodeMirror-matchingbracket {
2016-07-29 20:37:23 +00:00
color: inherit !important;
text-decoration: underline;
text-decoration-color: var(--color-notice);
box-sizing: border-box;
}
span.cm-nunjucks-variable {
color: var(--color-surprise);
}
span.cm-nunjucks-tag {
color: var(--color-info);
}
span.cm-nunjucks-comment {
color: var(--hl);
}
.nunjucks-widget {
font-family: @font-monospace !important;
padding: 0.13em 0.5em;
box-sizing: border-box;
margin: 0 0.1em;
position: relative;
font-size: 0.9em;
cursor: default;
white-space: nowrap;
text-shadow: 0 0 0.1em rgba(0, 0, 0, 0.4);
&::after {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
opacity: 0.7; // not so bright!
content: " ";
z-index: -1;
border-radius: 0.2em;
box-sizing: border-box;
box-shadow: inset 0 0 0.1em rgba(0, 0, 0, 0.4);
}
label {
padding: 0;
margin: 0;
display: inline;
font-style: italic;
font-size: 0.9em;
}
&.nunjucks-tag {
color: var(--color-font-info);
&::after {
background: var(--color-info);
}
}
&.nunjucks-variable {
color: var(--color-font-surprise);
&::after {
background: var(--color-surprise);
}
}
&[data-active="on"],
&:hover {
background: rgba(255, 255, 255, 0.1);
}
&[data-error="on"] {
color: var(--color-font-danger);
&::after {
background: var(--color-danger);
}
}
&[data-ignore="on"]::after {
background: var(--hl-xl);
color: bar(--color-font);
}
}
}