@matdata/yasgui 4.7.4 → 4.8.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.
Files changed (38) hide show
  1. package/build/ts/src/PersistentConfig.js +127 -0
  2. package/build/ts/src/PersistentConfig.js.map +1 -0
  3. package/build/ts/src/Tab.d.ts +2 -1
  4. package/build/ts/src/Tab.js +600 -0
  5. package/build/ts/src/Tab.js.map +1 -0
  6. package/build/ts/src/TabContextMenu.d.ts +1 -0
  7. package/build/ts/src/TabContextMenu.js +116 -0
  8. package/build/ts/src/TabContextMenu.js.map +1 -0
  9. package/build/ts/src/TabElements.d.ts +1 -0
  10. package/build/ts/src/TabElements.js +305 -0
  11. package/build/ts/src/TabElements.js.map +1 -0
  12. package/build/ts/src/TabSettingsModal.js +320 -0
  13. package/build/ts/src/TabSettingsModal.js.map +1 -0
  14. package/build/ts/src/defaults.js +59 -0
  15. package/build/ts/src/defaults.js.map +1 -0
  16. package/build/ts/src/endpointSelect.d.ts +1 -0
  17. package/build/ts/src/endpointSelect.js +242 -0
  18. package/build/ts/src/endpointSelect.js.map +1 -0
  19. package/build/ts/src/index.d.ts +2 -0
  20. package/build/ts/src/index.js +251 -0
  21. package/build/ts/src/index.js.map +1 -0
  22. package/build/ts/src/linkUtils.d.ts +1 -1
  23. package/build/ts/src/linkUtils.js +205 -0
  24. package/build/ts/src/linkUtils.js.map +1 -0
  25. package/build/yasgui.min.css +2 -2
  26. package/build/yasgui.min.css.map +7 -1
  27. package/build/yasgui.min.js +1125 -3
  28. package/build/yasgui.min.js.map +7 -1
  29. package/package.json +1 -1
  30. package/src/Tab.ts +20 -2
  31. package/src/TabContextMenu.ts +1 -1
  32. package/src/TabElements.ts +3 -3
  33. package/src/TabSettingsModal.ts +8 -8
  34. package/src/endpointSelect.ts +1 -1
  35. package/src/index.ts +2 -2
  36. package/src/linkUtils.ts +1 -1
  37. package/build/yasgui.html +0 -24
  38. package/build/yasgui.min.js.LICENSE.txt +0 -59
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@matdata/yasgui",
3
3
  "description": "Yet Another SPARQL GUI",
4
- "version": "4.7.4",
4
+ "version": "4.8.0",
5
5
  "main": "build/yasgui.min.js",
6
6
  "types": "build/ts/src/index.d.ts",
7
7
  "license": "MIT",
package/src/Tab.ts CHANGED
@@ -7,7 +7,7 @@ import { default as Yasr, Parser, Config as YasrConfig, PersistentConfig as Yasr
7
7
  import { mapValues, eq, mergeWith, words, deburr, invert } from "lodash-es";
8
8
  import * as shareLink from "./linkUtils";
9
9
  import EndpointSelect from "./endpointSelect";
10
- require("./tab.scss");
10
+ import "./tab.scss";
11
11
  import { getRandomId, default as Yasgui, YasguiRequestConfig } from "./";
12
12
  export interface PersistedJsonYasr extends YasrPersistentConfig {
13
13
  responseSummary: Parser.ResponseSummary;
@@ -621,8 +621,26 @@ WHERE {
621
621
 
622
622
  const result = await response.text();
623
623
 
624
+ // Create a query response object similar to what Yasqe produces
625
+ // This includes headers so the Parser can detect the content type
626
+ const queryResponse = {
627
+ ok: response.ok,
628
+ status: response.status,
629
+ statusText: response.statusText,
630
+ headers: response.headers,
631
+ type: response.type,
632
+ content: result,
633
+ };
634
+
624
635
  // Set the response in Yasr
625
- this.yasr.setResponse(result, duration);
636
+ this.yasr.setResponse(queryResponse, duration);
637
+
638
+ // Auto-select the Graph plugin if it's available
639
+ // The selectPlugin method will call draw() which will determine if it can handle the results
640
+ if (this.yasr.plugins["Graph"]) {
641
+ this.yasr.selectPlugin("Graph");
642
+ }
643
+
626
644
  this.yasr.hideLoading();
627
645
  this.emit("queryResponse", this);
628
646
  } catch (error) {
@@ -3,7 +3,7 @@ import { default as Yasgui, getRandomId } from "./";
3
3
  import Tab from "./Tab";
4
4
  import { TabListEl } from "./TabElements";
5
5
  import { cloneDeep } from "lodash-es";
6
- require("./TabContextMenu.scss");
6
+ import "./TabContextMenu.scss";
7
7
  export interface TabContextConfig {
8
8
  name: string;
9
9
  action: (this: HTMLElement, ev: MouseEvent) => any;
@@ -1,8 +1,8 @@
1
1
  import Yasgui from "./";
2
2
  import TabContextMenu from "./TabContextMenu";
3
3
  import { hasClass, addClass, removeClass } from "@matdata/yasgui-utils";
4
- const sortablejs = require("sortablejs");
5
- require("./TabElements.scss");
4
+ import sortablejs from "sortablejs";
5
+ import "./TabElements.scss";
6
6
  export interface TabList {}
7
7
  export class TabListEl {
8
8
  private tabList: TabList;
@@ -234,7 +234,7 @@ export class TabList {
234
234
  this._tabsListEl.setAttribute("role", "tablist");
235
235
  this._tabsListEl.addEventListener("keydown", this.handleKeydownArrowKeys);
236
236
 
237
- sortablejs.default.create(this._tabsListEl, {
237
+ sortablejs.create(this._tabsListEl, {
238
238
  group: "tabList",
239
239
  animation: 100,
240
240
  onUpdate: (_ev: any) => {
@@ -9,14 +9,14 @@ const AcceptOptionsMap: { key: string; value: string }[] = [
9
9
  { key: "TSV", value: "text/tab-separated-values" },
10
10
  ];
11
11
  const AcceptHeaderGraphMap: { key: string; value: string }[] = [
12
- { key: "Turtle", value: "text/turtle" },
13
- { key: "JSON", value: "application/rdf+json" },
14
- { key: "RDF/XML", value: "application/rdf+xml" },
15
- { key: "TriG", value: "application/trig" },
16
- { key: "N-Triples", value: "application/n-triples" },
17
- { key: "N-Quads", value: "application/n-quads" },
18
- { key: "CSV", value: "text/csv" },
19
- { key: "TSV", value: "text/tab-separated-values" },
12
+ { key: "Turtle", value: "text/turtle,*/*;q=0.9" },
13
+ { key: "JSON", value: "application/rdf+json,*/*;q=0.9" },
14
+ { key: "RDF/XML", value: "application/rdf+xml,*/*;q=0.9" },
15
+ { key: "TriG", value: "application/trig,*/*;q=0.9" },
16
+ { key: "N-Triples", value: "application/n-triples,*/*;q=0.9" },
17
+ { key: "N-Quads", value: "application/n-quads,*/*;q=0.9" },
18
+ { key: "CSV", value: "text/csv,*/*;q=0.9" },
19
+ { key: "TSV", value: "text/tab-separated-values,*/*;q=0.9" },
20
20
  ];
21
21
 
22
22
  export default class TabSettingsModal {
@@ -2,7 +2,7 @@ import Autocomplete from "@tarekraafat/autocomplete.js";
2
2
  import { EventEmitter } from "events";
3
3
  import { pick } from "lodash-es";
4
4
  import { addClass } from "@matdata/yasgui-utils";
5
- require("./endpointSelect.scss");
5
+ import "./endpointSelect.scss";
6
6
  import parse from "autosuggest-highlight/parse";
7
7
  import DOMPurify from "dompurify";
8
8
 
package/src/index.ts CHANGED
@@ -12,8 +12,8 @@ import { default as Yasr, Config as YasrConfig } from "@matdata/yasr";
12
12
  import { addClass, removeClass } from "@matdata/yasgui-utils";
13
13
  import GeoPlugin from "yasgui-geo-tg";
14
14
  import GraphPlugin from "@matdata/yasgui-graph-plugin";
15
- require("./index.scss");
16
- require("@matdata/yasr/src/scss/global.scss");
15
+ import "./index.scss";
16
+ import "../../yasr/src/scss/global.scss";
17
17
 
18
18
  // Register plugins to Yasr
19
19
  Yasr.registerPlugin("Geo", GeoPlugin);
package/src/linkUtils.ts CHANGED
@@ -1,4 +1,4 @@
1
- const JsUri = require("jsuri");
1
+ import JsUri from "jsuri";
2
2
 
3
3
  import { default as Tab, PersistedJson } from "./Tab";
4
4
  import Yasr from "@matdata/yasr";
package/build/yasgui.html DELETED
@@ -1,24 +0,0 @@
1
- <!doctype html><html><head><meta charset="UTF-8"><style>body {
2
- font-family: 'Roboto', sans-serif;
3
- margin: 0px;
4
- }
5
- .navItem a {
6
- color: #555;
7
- text-decoration: none;
8
- padding: 5px;
9
- padding-right:15px;
10
- }
11
- .navItem a:hover {
12
- color:#222
13
- }
14
- .navItem.active a {
15
- color: black;
16
- font-size:110%;
17
- }</style><script src="../../packages/yasgui/static/yasgui.polyfill.min.js"></script><link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"><title></title><script defer="defer" src="/yasgui.min.js"></script><script defer="defer" src="/yasqe.min.js"></script><script defer="defer" src="/yasr.min.js"></script><link href="/yasgui.min.css" rel="stylesheet"><link href="/yasqe.min.css" rel="stylesheet"><link href="/yasr.min.css" rel="stylesheet"></head><body><div style="background:#eee"><nav style="display: flex"><img src="webpack/yasgui.png" style="max-height:50px;padding:5px;margin-left: 10px" alt="Yasgui Logo"><ul style="display: flex; list-style: none; align-self: center"><li class="navItem active"><a class="nav-link" href="yasgui.html">Yasgui</a></li><li class="navItem false"><a class="nav-link" href="yasqe.html">Yasqe</a></li><li class="navItem false"><a class="nav-link" href="yasr.html">Yasr</a></li></ul></nav></div><div id="yasgui"></div><script>window.onpageshow = function () {
18
- window.yasgui = new Yasgui(document.getElementById("yasgui"), {
19
- corsProxy: "",
20
- requestConfig: {
21
- endpoint: "https://dbpedia.org/sparql",
22
- }
23
- });
24
- };</script></body></html>
@@ -1,59 +0,0 @@
1
- /* @license
2
- Papa Parse
3
- v5.5.3
4
- https://github.com/mholt/PapaParse
5
- License: MIT
6
- */
7
-
8
- /* @preserve
9
- * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
10
- * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
11
- */
12
-
13
- /*!
14
- * The buffer module from node.js, for the browser.
15
- *
16
- * @author Feross Aboukhadijeh <https://feross.org>
17
- * @license MIT
18
- */
19
-
20
- /*!
21
- * jQuery JavaScript Library v3.7.1
22
- * https://jquery.com/
23
- *
24
- * Copyright OpenJS Foundation and other contributors
25
- * Released under the MIT license
26
- * https://jquery.org/license
27
- *
28
- * Date: 2023-08-28T13:37Z
29
- */
30
-
31
- /*!
32
- * jsUri
33
- * https://github.com/derek-watson/jsUri
34
- *
35
- * Copyright 2013, Derek Watson
36
- * Released under the MIT license.
37
- *
38
- * Includes parseUri regular expressions
39
- * http://blog.stevenlevithan.com/archives/parseuri
40
- * Copyright 2007, Steven Levithan
41
- * Released under the MIT license.
42
- */
43
-
44
- /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
45
-
46
- /*! DataTables 2.3.5
47
- * © SpryMedia Ltd - datatables.net/license
48
- */
49
-
50
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
51
-
52
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
53
-
54
- /**!
55
- * Sortable 1.15.6
56
- * @author RubaXa <trash@rubaxa.org>
57
- * @author owenm <owen23355@gmail.com>
58
- * @license MIT
59
- */