@matdata/yasr 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@matdata/yasr",
3
3
  "description": "Yet Another SPARQL Resultset GUI",
4
- "version": "5.0.1",
4
+ "version": "5.1.0",
5
5
  "main": "build/yasr.min.js",
6
6
  "types": "build/ts/src/index.d.ts",
7
7
  "license": "MIT",
package/src/main.scss CHANGED
@@ -56,7 +56,7 @@
56
56
  // redeclared here to target yasr_btns in btnGroup
57
57
  border-bottom: 2px solid transparent;
58
58
  &.selected {
59
- border-bottom: 2px solid #337ab7;
59
+ border-bottom: 2px solid var(--yasgui-accent-color, #337ab7);
60
60
  }
61
61
  padding-left: 6px;
62
62
  padding-right: 6px;
@@ -123,8 +123,8 @@
123
123
  }
124
124
  }
125
125
  .yasr_btn {
126
- color: #505050;
127
- fill: #505050;
126
+ color: var(--yasgui-button-text, #505050);
127
+ fill: var(--yasgui-button-text, #505050);
128
128
  display: flex;
129
129
  align-items: center;
130
130
  justify-content: center;
@@ -145,8 +145,8 @@
145
145
  box-shadow: none;
146
146
  }
147
147
  &:not(.disabled):hover {
148
- fill: black;
149
- color: black;
148
+ fill: var(--yasgui-button-hover, black);
149
+ color: var(--yasgui-button-hover, black);
150
150
  }
151
151
  }
152
152
 
@@ -191,8 +191,8 @@
191
191
  }
192
192
  &:focus,
193
193
  &.selected {
194
- color: #337ab7;
195
- fill: #337ab7;
194
+ color: var(--yasgui-accent-color, #337ab7);
195
+ fill: var(--yasgui-accent-color, #337ab7);
196
196
  }
197
197
  }
198
198
 
@@ -15,6 +15,7 @@ import "codemirror/mode/xml/xml.js";
15
15
 
16
16
  import "codemirror/mode/javascript/javascript.js";
17
17
  import "codemirror/lib/codemirror.css";
18
+ import "codemirror/theme/material-palenight.css";
18
19
  import { drawSvgStringAsElement, addClass, removeClass, drawFontAwesomeIconAsSvg } from "@matdata/yasgui-utils";
19
20
  import * as faAlignIcon from "@fortawesome/free-solid-svg-icons/faAlignLeft";
20
21
  import { DeepReadonly } from "ts-essentials";
@@ -78,6 +79,10 @@ export default class Response implements Plugin<PluginConfig> {
78
79
  value = lines.slice(0, config.maxLines).join("\n");
79
80
  }
80
81
 
82
+ // Detect current theme from document
83
+ const isDarkTheme = document.documentElement.getAttribute("data-theme") === "dark";
84
+ const cmTheme = isDarkTheme ? "material-palenight" : "default";
85
+
81
86
  const codemirrorOpts: Partial<CodeMirror.EditorConfiguration> = {
82
87
  readOnly: true,
83
88
  lineNumbers: true,
@@ -86,6 +91,7 @@ export default class Response implements Plugin<PluginConfig> {
86
91
  gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
87
92
  value: value,
88
93
  extraKeys: { Tab: false },
94
+ theme: cmTheme,
89
95
  };
90
96
  const mode = this.yasr.results?.getType();
91
97
  if (mode === "json") {