@matdata/yasr 5.10.0 → 5.11.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.10.0",
4
+ "version": "5.11.0",
5
5
  "main": "build/yasr.min.js",
6
6
  "types": "build/ts/src/index.d.ts",
7
7
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "directory": "packages/yasr"
25
25
  },
26
26
  "dependencies": {
27
- "@fortawesome/free-solid-svg-icons": "^5.14.0",
27
+ "@fortawesome/free-solid-svg-icons": "^7.1.0",
28
28
  "@json2csv/plainjs": "^7.0.4",
29
29
  "@matdata/yasgui-utils": "^4.6.1",
30
30
  "@matdata/yasqe": "^4.6.1",
package/src/index.ts CHANGED
@@ -2,20 +2,11 @@ import { EventEmitter } from "events";
2
2
  import { merge, filter, mapValues, uniqueId } from "lodash-es";
3
3
  import getDefaults from "./defaults";
4
4
  import type { Plugin } from "./plugins";
5
- import {
6
- Storage as YStorage,
7
- drawFontAwesomeIconAsSvg,
8
- drawSvgStringAsElement,
9
- removeClass,
10
- addClass,
11
- hasClass,
12
- } from "@matdata/yasgui-utils";
5
+ import { Storage as YStorage, removeClass, addClass, hasClass } from "@matdata/yasgui-utils";
13
6
  import Parser from "./parsers";
14
7
  export { default as Parser } from "./parsers";
15
8
  import { addScript, addCss, sanitize } from "./helpers";
16
- import * as faDownload from "@fortawesome/free-solid-svg-icons/faDownload";
17
- import * as faQuestionCircle from "@fortawesome/free-solid-svg-icons/faQuestionCircle";
18
- import * as imgs from "./imgs";
9
+
19
10
  import "./main.scss";
20
11
 
21
12
  export interface PersistentConfig {
@@ -374,7 +365,8 @@ export class Yasr extends EventEmitter {
374
365
  this.downloadBtn.setAttribute("aria-label", "Download Results");
375
366
  this.downloadBtn.setAttribute("tabindex", "0"); // anchor elements with no href are not automatically included in the tabindex
376
367
  this.downloadBtn.setAttribute("role", "button");
377
- const iconEl = drawSvgStringAsElement(drawFontAwesomeIconAsSvg(faDownload));
368
+ const iconEl = document.createElement("i");
369
+ addClass(iconEl, "fas", "fa-download");
378
370
  iconEl.setAttribute("aria-hidden", "true");
379
371
  this.downloadBtn.appendChild(iconEl);
380
372
  this.downloadBtn.addEventListener("click", () => {
@@ -455,12 +447,16 @@ export class Yasr extends EventEmitter {
455
447
  this.fullscreenBtn.setAttribute("tabindex", "0");
456
448
  this.fullscreenBtn.setAttribute("role", "button");
457
449
 
458
- const fullscreenIcon = drawSvgStringAsElement(imgs.fullscreen);
450
+ const fullscreenIcon = document.createElement("i");
451
+ addClass(fullscreenIcon, "fas");
452
+ addClass(fullscreenIcon, "fa-expand");
459
453
  addClass(fullscreenIcon, "fullscreenIcon");
460
454
  fullscreenIcon.setAttribute("aria-hidden", "true");
461
455
  this.fullscreenBtn.appendChild(fullscreenIcon);
462
456
 
463
- const fullscreenExitIcon = drawSvgStringAsElement(imgs.fullscreenExit);
457
+ const fullscreenExitIcon = document.createElement("i");
458
+ addClass(fullscreenExitIcon, "fas");
459
+ addClass(fullscreenExitIcon, "fa-compress");
464
460
  addClass(fullscreenExitIcon, "fullscreenExitIcon");
465
461
  fullscreenExitIcon.setAttribute("aria-hidden", "true");
466
462
  this.fullscreenBtn.appendChild(fullscreenExitIcon);
@@ -520,7 +516,9 @@ export class Yasr extends EventEmitter {
520
516
  private drawDocumentationButton() {
521
517
  this.documentationLink = document.createElement("a");
522
518
  addClass(this.documentationLink, "yasr_btn", "yasr_external_ref_btn");
523
- this.documentationLink.appendChild(drawSvgStringAsElement(drawFontAwesomeIconAsSvg(faQuestionCircle)));
519
+ const icon = document.createElement("i");
520
+ addClass(icon, "fas", "fa-circle-question");
521
+ this.documentationLink.appendChild(icon);
524
522
  this.documentationLink.href = "https://docs.triply.cc/yasgui/";
525
523
  this.documentationLink.target = "_blank";
526
524
  this.documentationLink.rel = "noopener noreferrer";
package/src/main.scss CHANGED
@@ -1,4 +1,6 @@
1
1
  @use "scss/variables.scss";
2
+ @import "@fortawesome/fontawesome-free/css/fontawesome.css";
3
+ @import "@fortawesome/fontawesome-free/css/solid.css";
2
4
 
3
5
  .yasr {
4
6
  display: flex;
@@ -14,17 +16,12 @@
14
16
  .yasr_btn {
15
17
  border: none;
16
18
  background: inherit;
17
- }
18
-
19
- .svgImg {
20
19
  display: flex;
21
- flex-direction: row;
22
- svg {
23
- max-width: 100%;
24
- max-height: 100%;
25
- width: 15px;
26
- height: 15px;
27
- align-self: center;
20
+ align-items: center;
21
+ justify-content: center;
22
+
23
+ i {
24
+ font-size: 16px;
28
25
  }
29
26
  }
30
27
 
@@ -36,10 +33,6 @@
36
33
  color: inherit;
37
34
  text-decoration-color: inherit;
38
35
  }
39
- .svgImg svg {
40
- width: 18px;
41
- height: 18px;
42
- }
43
36
  }
44
37
 
45
38
  a {
@@ -174,15 +167,15 @@
174
167
  .yasr_fullscreenButton {
175
168
  border: none;
176
169
  background: none;
177
-
178
- svg {
179
- height: 20px;
180
- width: 20px;
181
- }
170
+ color: var(--yasgui-button-text, #505050);
182
171
 
183
172
  .fullscreenExitIcon {
184
173
  display: none;
185
174
  }
175
+
176
+ &:hover {
177
+ color: var(--yasgui-button-hover, #337ab7);
178
+ }
186
179
  }
187
180
 
188
181
  &.fullscreen {
@@ -3,9 +3,9 @@
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: center;
6
- svg {
7
- margin-bottom: -10px;
8
- margin-right: 7px;
6
+ i {
7
+ font-size: 30px;
8
+ margin-right: 12px;
9
9
  }
10
10
  }
11
11
  }
@@ -5,11 +5,6 @@ import Yasr from "../../";
5
5
  import { Plugin } from "../";
6
6
  import "./index.scss";
7
7
  export interface PluginConfig {}
8
- import { drawSvgStringAsElement } from "@matdata/yasgui-utils";
9
- const cross =
10
- '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="30" height="30" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><g><path d="M83.288,88.13c-2.114,2.112-5.575,2.112-7.689,0L53.659,66.188c-2.114-2.112-5.573-2.112-7.687,0L24.251,87.907 c-2.113,2.114-5.571,2.114-7.686,0l-4.693-4.691c-2.114-2.114-2.114-5.573,0-7.688l21.719-21.721c2.113-2.114,2.113-5.573,0-7.686 L11.872,24.4c-2.114-2.113-2.114-5.571,0-7.686l4.842-4.842c2.113-2.114,5.571-2.114,7.686,0L46.12,33.591 c2.114,2.114,5.572,2.114,7.688,0l21.721-21.719c2.114-2.114,5.573-2.114,7.687,0l4.695,4.695c2.111,2.113,2.111,5.571-0.003,7.686 L66.188,45.973c-2.112,2.114-2.112,5.573,0,7.686L88.13,75.602c2.112,2.111,2.112,5.572,0,7.687L83.288,88.13z"/></g></svg>';
11
- const check =
12
- '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="30" height="30" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path d="M14.301,49.982l22.606,17.047L84.361,4.903c2.614-3.733,7.76-4.64,11.493-2.026l0.627,0.462 c3.732,2.614,4.64,7.758,2.025,11.492l-51.783,79.77c-1.955,2.791-3.896,3.762-7.301,3.988c-3.405,0.225-5.464-1.039-7.508-3.084 L2.447,61.814c-3.263-3.262-3.263-8.553,0-11.814l0.041-0.019C5.75,46.718,11.039,46.718,14.301,49.982z"/></svg>';
13
8
 
14
9
  export default class Boolean implements Plugin<PluginConfig> {
15
10
  private yasr: Yasr;
@@ -23,7 +18,9 @@ export default class Boolean implements Plugin<PluginConfig> {
23
18
  el.className = "booleanResult";
24
19
 
25
20
  const boolVal = this.yasr.results?.getBoolean();
26
- el.appendChild(drawSvgStringAsElement(boolVal ? check : cross));
21
+ const icon = document.createElement("i");
22
+ icon.className = boolVal ? "fas fa-check" : "fas fa-xmark";
23
+ el.appendChild(icon);
27
24
  const textEl = document.createElement("span");
28
25
  textEl.textContent = boolVal ? "True" : "False";
29
26
  el.appendChild(textEl);
@@ -44,19 +44,12 @@
44
44
  color: #337ab7;
45
45
  padding: 10px;
46
46
  margin: 10px;
47
- svg {
47
+ i {
48
48
  margin-left: 0.5rem;
49
- fill: #337ab7;
50
- color: #337ab7;
51
49
  }
52
50
  &:hover {
53
51
  color: #255681;
54
52
  border-color: #337ab7;
55
- fill: #255681;
56
- svg {
57
- color: #255681;
58
- fill: #255681;
59
- }
60
53
  }
61
54
  }
62
55
  }
@@ -16,10 +16,8 @@ import "codemirror/mode/xml/xml.js";
16
16
  import "codemirror/mode/javascript/javascript.js";
17
17
  import "codemirror/lib/codemirror.css";
18
18
  import "codemirror/theme/material-palenight.css";
19
- import { drawSvgStringAsElement, addClass, removeClass, drawFontAwesomeIconAsSvg } from "@matdata/yasgui-utils";
20
- import * as faAlignIcon from "@fortawesome/free-solid-svg-icons/faAlignLeft";
19
+ import { addClass, removeClass } from "@matdata/yasgui-utils";
21
20
  import { DeepReadonly } from "ts-essentials";
22
- import * as imgs from "../../imgs";
23
21
 
24
22
  export interface PluginConfig {
25
23
  maxLines: number;
@@ -51,7 +49,9 @@ export default class Response implements Plugin<PluginConfig> {
51
49
  return true;
52
50
  }
53
51
  public getIcon() {
54
- return drawSvgStringAsElement(drawFontAwesomeIconAsSvg(faAlignIcon));
52
+ const icon = document.createElement("i");
53
+ icon.className = "fas fa-align-left";
54
+ return icon;
55
55
  }
56
56
  download(filename?: string) {
57
57
  if (!this.yasr.results) return;
@@ -146,7 +146,10 @@ export default class Response implements Plugin<PluginConfig> {
146
146
  const text = document.createElement("span");
147
147
  text.innerText = "Download result";
148
148
  downloadButton.appendChild(text);
149
- downloadButton.appendChild(drawSvgStringAsElement(imgs.download));
149
+ const downloadIcon = document.createElement("i");
150
+ addClass(downloadIcon, "fas");
151
+ addClass(downloadIcon, "fa-download");
152
+ downloadButton.appendChild(downloadIcon);
150
153
  downloadButton.addEventListener("click", () => this.yasr.download());
151
154
  downloadButton.addEventListener("keydown", (event) => {
152
155
  if (event.code === "Space" || event.code === "Enter") this.yasr.download();
@@ -1,4 +0,0 @@
1
- export declare var download: string;
2
- export declare var pivot: string;
3
- export declare var fullscreen: string;
4
- export declare var fullscreenExit: string;
@@ -1,5 +0,0 @@
1
- export var download = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="tiny" x="0" y="0" width="100%" height="100%" viewBox="0 0 100 100" xml:space="preserve"><g id="Captions"/><g id="Your_Icon"><path d="M88,84v-2c0-2.961-0.859-4-4-4H16c-2.961,0-4,0.98-4,4v2c0,3.102,1.039,4,4,4h68 C87.02,88,88,87.039,88,84z M58,12H42c-5,0-6,0.941-6,6v22H16l34,34l34-34H64V18C64,12.941,62.939,12,58,12z"/></g></svg>';
2
- export var pivot = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="100%" width="100%" version="1.1" y="0px" x="0px" viewBox="-949 951 122.65 124.00456"><switch transform="matrix(-1 0 0 1 -1741 23.496)"><foreignObject y="0" x="0" requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" width="1" height="1"/><g transform="matrix(.68779 .053686 -.048647 .75904 -208.42 303.24)"><path d="m-851.8 1025.3c-0.3-0.7-0.8-1.2-1.4-1.6l-28.9-18.3c-2.6-1.6-5.8 0.7-5.1 3.6l2.3 10.1c-17.7-0.4-32-14.6-32.5-32.3l10 2.3c2.9 0.7 5.2-2.5 3.6-5.1l-18.3-28.9c-0.9-1.4-2.6-2-4.2-1.3-0.7 0.3-1.2 0.8-1.6 1.4l-18.3 28.9c-1.6 2.6 0.7 5.8 3.6 5.1l10.1-2.3c0.5 25.9 21.5 46.9 47.5 47.3l-2.3 10c-0.7 2.9 2.5 5.2 5.1 3.6l28.9-18.3c1.6-0.8 2.2-2.6 1.5-4.2z"/></g><g><rect transform="scale(-1,1)" height="182.73" width="58.263" y="943.58" x="789.91"/><path d="m-555.88 62.924v-374.47h1252.1v748.94h-1252.1zm596.4 34.428c1.3908-1.3908 1.3477-2.0517-0.52029-7.9711-0.8688-2.7531-1.5838-5.0324-1.589-5.0651-0.0053-0.03273 1.2924-0.21249 2.8835-0.3995 6.1211-0.71941 14.098-3.8308 19.883-7.7551 12.823-8.6993 21.186-24.002 21.186-38.765 0-3.59 0.04131-3.7083 1.1917-3.425 0.65546 0.16137 3.3047 0.59645 5.8872 0.96682l4.6954 0.67342 1.3092-1.522c0.813-0.945 1.224-1.965 1.085-2.692-0.363-1.901-21.135-29.783-22.678-30.441-2.901-1.2375-3.406-0.57737-12.545 16.409-4.7338 8.7985-8.607 16.462-8.607 17.031 0 1.1765 2.2399 3.6338 3.3124 3.6338 0.39179 0 2.9648-0.71083 5.718-1.5796 2.7531-0.86879 5.0652-1.5838 5.138-1.589 0.36716-0.02595 0.04608 3.5333-0.65244 7.2269-2.3628 12.497-12.327 22.931-24.781 25.95-1.9718 0.47792-3.7039 0.75004-3.8492 0.6047-0.14534-0.14533 0.12002-2.6906 0.58972-5.6561 0.78639-4.9651 0.78618-5.4954-0.0053-6.6999-0.63994-0.98013-1.3213-1.308-2.7159-1.308-1.5863 0-3.9896 1.5653-16.275 10.6-15.151 11.143-16.136 12.125-14.661 14.622 0.9789 1.657 31.34 18.146 33.483 18.184 0.80111 0.01425 1.9333-0.45076 2.5159-1.0334z" transform="matrix(-1,0,0,1,-849.24,951)"/><rect transform="scale(-1,1)" height="134" width="5.8263" y="926.47" x="830.3"/><rect transform="matrix(0,1,1,0,0,0)" height="134" width="5.8263" y="-925.77" x="961.98"/></g></switch><rect height="122.65" width="11.491" y="951" x="-915.98" stroke-width="1.2986"/><rect transform="rotate(90)" height="122.65" width="11.491" y="826.35" x="985.27" stroke-width="1.2986"/></svg>`;
3
- export var fullscreen = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
4
- export var fullscreenExit = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>';
5
- //# sourceMappingURL=imgs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imgs.js","sourceRoot":"","sources":["../../../../../packages/yasr/src/imgs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAI,QAAQ,GACjB,8YAA8Y,CAAC;AACjZ,MAAM,CAAC,IAAI,KAAK,GAAG,qyEAAqyE,CAAC;AACzzE,MAAM,CAAC,IAAI,UAAU,GACnB,8JAA8J,CAAC;AACjK,MAAM,CAAC,IAAI,cAAc,GACvB,6JAA6J,CAAC"}
package/src/imgs.ts DELETED
@@ -1,7 +0,0 @@
1
- export var download =
2
- '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="tiny" x="0" y="0" width="100%" height="100%" viewBox="0 0 100 100" xml:space="preserve"><g id="Captions"/><g id="Your_Icon"><path d="M88,84v-2c0-2.961-0.859-4-4-4H16c-2.961,0-4,0.98-4,4v2c0,3.102,1.039,4,4,4h68 C87.02,88,88,87.039,88,84z M58,12H42c-5,0-6,0.941-6,6v22H16l34,34l34-34H64V18C64,12.941,62.939,12,58,12z"/></g></svg>';
3
- export var pivot = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="100%" width="100%" version="1.1" y="0px" x="0px" viewBox="-949 951 122.65 124.00456"><switch transform="matrix(-1 0 0 1 -1741 23.496)"><foreignObject y="0" x="0" requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" width="1" height="1"/><g transform="matrix(.68779 .053686 -.048647 .75904 -208.42 303.24)"><path d="m-851.8 1025.3c-0.3-0.7-0.8-1.2-1.4-1.6l-28.9-18.3c-2.6-1.6-5.8 0.7-5.1 3.6l2.3 10.1c-17.7-0.4-32-14.6-32.5-32.3l10 2.3c2.9 0.7 5.2-2.5 3.6-5.1l-18.3-28.9c-0.9-1.4-2.6-2-4.2-1.3-0.7 0.3-1.2 0.8-1.6 1.4l-18.3 28.9c-1.6 2.6 0.7 5.8 3.6 5.1l10.1-2.3c0.5 25.9 21.5 46.9 47.5 47.3l-2.3 10c-0.7 2.9 2.5 5.2 5.1 3.6l28.9-18.3c1.6-0.8 2.2-2.6 1.5-4.2z"/></g><g><rect transform="scale(-1,1)" height="182.73" width="58.263" y="943.58" x="789.91"/><path d="m-555.88 62.924v-374.47h1252.1v748.94h-1252.1zm596.4 34.428c1.3908-1.3908 1.3477-2.0517-0.52029-7.9711-0.8688-2.7531-1.5838-5.0324-1.589-5.0651-0.0053-0.03273 1.2924-0.21249 2.8835-0.3995 6.1211-0.71941 14.098-3.8308 19.883-7.7551 12.823-8.6993 21.186-24.002 21.186-38.765 0-3.59 0.04131-3.7083 1.1917-3.425 0.65546 0.16137 3.3047 0.59645 5.8872 0.96682l4.6954 0.67342 1.3092-1.522c0.813-0.945 1.224-1.965 1.085-2.692-0.363-1.901-21.135-29.783-22.678-30.441-2.901-1.2375-3.406-0.57737-12.545 16.409-4.7338 8.7985-8.607 16.462-8.607 17.031 0 1.1765 2.2399 3.6338 3.3124 3.6338 0.39179 0 2.9648-0.71083 5.718-1.5796 2.7531-0.86879 5.0652-1.5838 5.138-1.589 0.36716-0.02595 0.04608 3.5333-0.65244 7.2269-2.3628 12.497-12.327 22.931-24.781 25.95-1.9718 0.47792-3.7039 0.75004-3.8492 0.6047-0.14534-0.14533 0.12002-2.6906 0.58972-5.6561 0.78639-4.9651 0.78618-5.4954-0.0053-6.6999-0.63994-0.98013-1.3213-1.308-2.7159-1.308-1.5863 0-3.9896 1.5653-16.275 10.6-15.151 11.143-16.136 12.125-14.661 14.622 0.9789 1.657 31.34 18.146 33.483 18.184 0.80111 0.01425 1.9333-0.45076 2.5159-1.0334z" transform="matrix(-1,0,0,1,-849.24,951)"/><rect transform="scale(-1,1)" height="134" width="5.8263" y="926.47" x="830.3"/><rect transform="matrix(0,1,1,0,0,0)" height="134" width="5.8263" y="-925.77" x="961.98"/></g></switch><rect height="122.65" width="11.491" y="951" x="-915.98" stroke-width="1.2986"/><rect transform="rotate(90)" height="122.65" width="11.491" y="826.35" x="985.27" stroke-width="1.2986"/></svg>`;
4
- export var fullscreen =
5
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
6
- export var fullscreenExit =
7
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></svg>';