@matdata/yasgui 5.0.1 → 5.2.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/README.md +196 -111
- package/build/ts/src/PersistentConfig.d.ts +4 -1
- package/build/ts/src/PersistentConfig.js +8 -0
- package/build/ts/src/PersistentConfig.js.map +1 -1
- package/build/ts/src/Tab.d.ts +8 -0
- package/build/ts/src/Tab.js +85 -1
- package/build/ts/src/Tab.js.map +1 -1
- package/build/ts/src/TabElements.js +6 -0
- package/build/ts/src/TabElements.js.map +1 -1
- package/build/ts/src/TabSettingsModal.d.ts +4 -0
- package/build/ts/src/TabSettingsModal.js +128 -9
- package/build/ts/src/TabSettingsModal.js.map +1 -1
- package/build/ts/src/ThemeManager.d.ts +17 -0
- package/build/ts/src/ThemeManager.js +69 -0
- package/build/ts/src/ThemeManager.js.map +1 -0
- package/build/ts/src/defaults.js +4 -0
- package/build/ts/src/defaults.js.map +1 -1
- package/build/ts/src/index.d.ts +16 -0
- package/build/ts/src/index.js +17 -0
- package/build/ts/src/index.js.map +1 -1
- package/build/yasgui.min.css +1 -1
- package/build/yasgui.min.css.map +3 -3
- package/build/yasgui.min.js +114 -98
- package/build/yasgui.min.js.map +4 -4
- package/package.json +1 -1
- package/src/PersistentConfig.ts +10 -1
- package/src/Tab.ts +125 -0
- package/src/TabElements.scss +33 -6
- package/src/TabElements.ts +9 -0
- package/src/TabSettingsModal.scss +154 -20
- package/src/TabSettingsModal.ts +171 -13
- package/src/ThemeManager.ts +120 -0
- package/src/defaults.ts +4 -0
- package/src/endpointSelect.scss +34 -0
- package/src/index.scss +2 -2
- package/src/index.ts +43 -0
- package/src/tab.scss +60 -8
- package/src/themes.scss +543 -0
package/README.md
CHANGED
|
@@ -1,111 +1,196 @@
|
|
|
1
|
-
# YASGUI
|
|
2
|
-
|
|
3
|
-
YASGUI (Yet Another SPARQL GUI) is an advanced SPARQL client for querying and exploring RDF data. It provides a user-friendly interface for writing SPARQL queries, executing them against SPARQL endpoints, and visualizing the results in various formats.
|
|
4
|
-
|
|
5
|
-
Go to https://yasgui.matdata.eu/ and use it freely in production. Or fork this repo and extend it yourself. Contributions are certainly welcome!
|
|
6
|
-
|
|
7
|
-
## Table of Contents
|
|
8
|
-
|
|
9
|
-
- [Useful Links](#useful-links)
|
|
10
|
-
- [Features](#features)
|
|
11
|
-
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
12
|
-
- [Query Editor (Yasqe)](#query-editor-yasqe)
|
|
13
|
-
- [Fullscreen Mode](#fullscreen-mode)
|
|
14
|
-
- [URI Explorer](#uri-explorer)
|
|
15
|
-
- [Prefix Management](#prefix-management)
|
|
16
|
-
- [Result Visualization Plugins (Yasr)](#result-visualization-plugins-yasr)
|
|
17
|
-
- [Installation](#installation)
|
|
18
|
-
- [npm](#npm)
|
|
19
|
-
- [Yarn](#yarn)
|
|
20
|
-
- [Local Development](#local-development)
|
|
21
|
-
- [License](#license)
|
|
22
|
-
|
|
23
|
-
## Useful Links
|
|
24
|
-
|
|
25
|
-
- Production environment: https://yasgui.matdata.eu/
|
|
26
|
-
- Dev environment: https://yasgui-dev.matdata.eu/
|
|
27
|
-
- User documentation: https://docs.triply.cc/yasgui/
|
|
28
|
-
- Developer documentation: https://docs.triply.cc/yasgui-api/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- **
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- **
|
|
59
|
-
- **
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
# YASGUI
|
|
2
|
+
|
|
3
|
+
YASGUI (Yet Another SPARQL GUI) is an advanced SPARQL client for querying and exploring RDF data. It provides a user-friendly interface for writing SPARQL queries, executing them against SPARQL endpoints, and visualizing the results in various formats.
|
|
4
|
+
|
|
5
|
+
Go to https://yasgui.matdata.eu/ and use it freely in production. Or fork this repo and extend it yourself. Contributions are certainly welcome!
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Useful Links](#useful-links)
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
12
|
+
- [Query Editor (Yasqe)](#query-editor-yasqe)
|
|
13
|
+
- [Fullscreen Mode](#fullscreen-mode)
|
|
14
|
+
- [URI Explorer](#uri-explorer)
|
|
15
|
+
- [Prefix Management](#prefix-management)
|
|
16
|
+
- [Result Visualization Plugins (Yasr)](#result-visualization-plugins-yasr)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [npm](#npm)
|
|
19
|
+
- [Yarn](#yarn)
|
|
20
|
+
- [Local Development](#local-development)
|
|
21
|
+
- [License](#license)
|
|
22
|
+
|
|
23
|
+
## Useful Links
|
|
24
|
+
|
|
25
|
+
- Production environment: https://yasgui.matdata.eu/
|
|
26
|
+
- Dev environment: https://yasgui-dev.matdata.eu/ (GitHub Pages - automatically updated with every commit to main branch)
|
|
27
|
+
- User documentation: https://docs.triply.cc/yasgui/
|
|
28
|
+
- Developer documentation: https://docs.triply.cc/yasgui-api/
|
|
29
|
+
- Docker Hub: https://hub.docker.com/r/mathiasvda/yasgui
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
### Themes
|
|
34
|
+
|
|
35
|
+
Yasgui supports both **light** and **dark** themes with instant switching:
|
|
36
|
+
|
|
37
|
+
- **Theme Toggle Button**: Quickly switch between light and dark modes using the button in the tab bar
|
|
38
|
+
- **Persistent Preference**: Your theme choice is automatically saved
|
|
39
|
+
- **System Detection**: Automatically matches your system's dark/light mode preference
|
|
40
|
+
- **Full Coverage**: Consistent theming across all components (editor, results, modals)
|
|
41
|
+
|
|
42
|
+
See the [Theme Guide](./docs/THEME_GUIDE.md) for detailed configuration options and usage examples.
|
|
43
|
+
|
|
44
|
+
See the [Theme Implementation Guide](./docs/THEME_IMPLEMENTATION_GUIDE.md) for detailed instructions on how to implement theme support in your own Yasgui plugins.
|
|
45
|
+
|
|
46
|
+
### Layout Orientation
|
|
47
|
+
|
|
48
|
+
Yasgui supports two layout orientations to optimize screen space usage:
|
|
49
|
+
|
|
50
|
+
- **Vertical Layout (Default)**: YASQE (query editor) positioned above YASR (results viewer)
|
|
51
|
+
- **Horizontal Layout**: YASQE and YASR positioned side-by-side
|
|
52
|
+
|
|
53
|
+
The horizontal layout is particularly useful for wide monitors, allowing you to dedicate the complete height to both the query editor and results viewer.
|
|
54
|
+
|
|
55
|
+
#### Runtime Toggle
|
|
56
|
+
|
|
57
|
+
Users can switch between vertical and horizontal layouts at any time using the **layout toggle button** in the control bar (next to the endpoint selector). This button shows:
|
|
58
|
+
- **Side-by-side rectangles icon** when in vertical mode (click to switch to horizontal)
|
|
59
|
+
- **Stacked rectangles icon** when in horizontal mode (click to switch to vertical)
|
|
60
|
+
|
|
61
|
+
#### Initial Configuration
|
|
62
|
+
|
|
63
|
+
You can also set the initial layout orientation when creating a Yasgui instance:
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
new Yasgui(document.getElementById("yasgui"), {
|
|
67
|
+
orientation: "horizontal" // or "vertical" (default)
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### CSS Customization
|
|
72
|
+
|
|
73
|
+
Customize the header height used in the horizontal layout calculation by setting the CSS custom property:
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
.yasgui {
|
|
77
|
+
--yasgui-header-height: 120px; /* Adjust based on your header height */
|
|
78
|
+
--yasgui-min-height: 500px; /* Minimum height for horizontal layout panels */
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Keyboard Shortcuts
|
|
83
|
+
|
|
84
|
+
#### Query Editor (Yasqe)
|
|
85
|
+
- **Ctrl+Enter** / **Cmd+Enter**: Execute the current query
|
|
86
|
+
- **Ctrl+Space**: Trigger autocomplete
|
|
87
|
+
- **Ctrl+S**: Save query to local storage
|
|
88
|
+
- **Shift+Ctrl+F**: Auto-format the query
|
|
89
|
+
- **Ctrl+/**: Comment/uncomment selected lines
|
|
90
|
+
- **Shift+Ctrl+D**: Duplicate the current line
|
|
91
|
+
- **Shift+Ctrl+K**: Delete the current line
|
|
92
|
+
- **Esc**: Remove focus from the editor
|
|
93
|
+
|
|
94
|
+
#### Fullscreen Mode
|
|
95
|
+
- **F11**: Toggle fullscreen mode for the query editor (Yasqe)
|
|
96
|
+
- **F10**: Toggle fullscreen mode for the results viewer (Yasr)
|
|
97
|
+
- **Ctrl+Shift+F**: Switch between Yasqe and Yasr fullscreen modes
|
|
98
|
+
|
|
99
|
+
#### URI Explorer
|
|
100
|
+
- **Ctrl+Click** on any URI in the query editor: Automatically executes a CONSTRUCT query to explore the clicked URI's connections (incoming and outgoing triples). The query runs in the background without modifying your current query in the editor.
|
|
101
|
+
|
|
102
|
+
### Prefix Management
|
|
103
|
+
- **PREFIX Button**: Insert saved prefix declarations into your query (replaces existing PREFIX lines at the beginning)
|
|
104
|
+
- **Settings Modal**: Access via the settings button (⚙) to manage:
|
|
105
|
+
- **Saved Prefixes**: Define reusable PREFIX declarations
|
|
106
|
+
- **Auto-capture**: Automatically captures new prefixes from your queries (enabled by default)
|
|
107
|
+
- **Request Configuration**: Configure HTTP request method, accept headers, arguments, headers, and named/default graphs
|
|
108
|
+
- **Default Prefixes**: Automatically includes `rdf:` and `rdfs:` prefixes for new users
|
|
109
|
+
- **Prefix Autocomplete**: When typing a prefix declaration (e.g., `PREFIX foaf:`), the editor automatically queries [prefix.cc](https://prefix.cc) to suggest and auto-complete the full URI commonly associated with that prefix. This helps you quickly add standard prefixes without needing to remember their full URIs.
|
|
110
|
+
|
|
111
|
+
### Endpoint Quick Switch Buttons
|
|
112
|
+
|
|
113
|
+
Configure predefined SPARQL endpoint buttons for quick switching between different endpoints:
|
|
114
|
+
|
|
115
|
+
- **Predefined Buttons**: Configure a list of endpoint buttons during Yasgui initialization
|
|
116
|
+
- **User-Defined Buttons**: Users can add their own custom endpoint buttons through the Settings modal
|
|
117
|
+
- **One-Click Switching**: Instantly switch to a different SPARQL endpoint with a single button click
|
|
118
|
+
- **Persistent Custom Buttons**: User-defined buttons are saved in local storage
|
|
119
|
+
- **Fully Themed**: Buttons automatically adapt to light and dark themes
|
|
120
|
+
|
|
121
|
+
For detailed configuration options and examples, see the [Endpoint Buttons Guide](./docs/ENDPOINT_BUTTONS.md).
|
|
122
|
+
|
|
123
|
+
### Result Visualization Plugins (Yasr)
|
|
124
|
+
|
|
125
|
+
Yasgui includes several built-in plugins to visualize SPARQL query results:
|
|
126
|
+
|
|
127
|
+
- **Table**: Interactive table view with sorting, filtering, pagination, and column resizing. Ideal for SELECT query results.
|
|
128
|
+
- **Boolean**: Displays boolean results (true/false) with visual indicators. Automatically used for ASK queries.
|
|
129
|
+
- **Response**: Raw response viewer with syntax highlighting and code folding. Shows the original response from the endpoint in JSON, XML, Turtle, or other formats.
|
|
130
|
+
- **Geo**: Geographic visualization plugin for displaying spatial data on interactive maps. Visualizes geospatial triples with coordinates. See [Yasgui Geo TG Plugin](https://github.com/Thib-G/yasgui-geo-tg) for more details.
|
|
131
|
+
- **Graph**: Visual graph representation of RDF data using nodes and edges. Ideal for CONSTRUCT/DESCRIBE query results. See [Yasgui Graph Plugin](https://github.com/Matdata-eu/yasgui-graph-plugin) for more details.
|
|
132
|
+
- **Error**: Displays error messages and diagnostics when queries fail, including CORS troubleshooting guidance.
|
|
133
|
+
|
|
134
|
+
Plugins are automatically selected based on the query type and response format. You can manually switch between available plugins using the view selector in the results pane.
|
|
135
|
+
|
|
136
|
+
## Installation
|
|
137
|
+
|
|
138
|
+
Below are instructions on how to include Yasgui in your project.
|
|
139
|
+
If you only want to install Yasr or Yasqe, replace yasgui in the commands below.
|
|
140
|
+
|
|
141
|
+
### npm
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
npm i @matdata/yasgui
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Yarn
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
yarn add @matdata/yasgui
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Docker
|
|
154
|
+
|
|
155
|
+
Yasgui is also available as a Docker image on Docker Hub. Images are built and published automatically when a new release is created.
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
docker pull mathiasvda/yasgui:latest
|
|
159
|
+
docker run -p 8080:8080 mathiasvda/yasgui:latest
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
You can customize the default SPARQL endpoint by setting the `YASGUI_DEFAULT_ENDPOINT` environment variable:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
docker run -p 8080:8080 -e YASGUI_DEFAULT_ENDPOINT=https://your-endpoint.com/sparql mathiasvda/yasgui:latest
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The application will be available at `http://localhost:8080`.
|
|
169
|
+
|
|
170
|
+
## Local Development
|
|
171
|
+
|
|
172
|
+
#### Installing dependencies
|
|
173
|
+
|
|
174
|
+
Run `npm install`.
|
|
175
|
+
|
|
176
|
+
#### Running Yasgui locally
|
|
177
|
+
|
|
178
|
+
To develop locally, run `npm run dev`
|
|
179
|
+
|
|
180
|
+
Go to `http://localhost:5173/demo` in your browser to see Yasgui in action.
|
|
181
|
+
|
|
182
|
+
#### Compiling Yasgui
|
|
183
|
+
|
|
184
|
+
Run `npm run build`. It'll store the transpiled js/css files in the `build` directory.
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
This is a fork from [Zazuko](https://github.com/zazuko/Yasgui) who forked it from [Triply](https://github.com/TriplyDB/Yasgui).
|
|
189
|
+
|
|
190
|
+
This code is released under the MIT license.
|
|
191
|
+
|
|
192
|
+
## Release notes
|
|
193
|
+
|
|
194
|
+
Release notes can be found in the release section of the GitHub repository: [Yasgui Releases](https://github.com/Matdata-eu/yasgui/releases)
|
|
195
|
+
|
|
196
|
+
Instructions on how to write release notes are found in
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Yasgui from "./";
|
|
1
|
+
import Yasgui, { EndpointButton } from "./";
|
|
2
2
|
import * as Tab from "./Tab";
|
|
3
3
|
export declare var storageNamespace: string;
|
|
4
4
|
export interface PersistedJson {
|
|
@@ -14,6 +14,7 @@ export interface PersistedJson {
|
|
|
14
14
|
} | undefined;
|
|
15
15
|
prefixes?: string;
|
|
16
16
|
autoCaptureEnabled?: boolean;
|
|
17
|
+
customEndpointButtons?: EndpointButton[];
|
|
17
18
|
}
|
|
18
19
|
export default class PersistentConfig {
|
|
19
20
|
private persistedJson;
|
|
@@ -45,5 +46,7 @@ export default class PersistentConfig {
|
|
|
45
46
|
setPrefixes(prefixes: string): void;
|
|
46
47
|
getAutoCaptureEnabled(): boolean;
|
|
47
48
|
setAutoCaptureEnabled(enabled: boolean): void;
|
|
49
|
+
getCustomEndpointButtons(): EndpointButton[];
|
|
50
|
+
setCustomEndpointButtons(buttons: EndpointButton[]): void;
|
|
48
51
|
static clear(): void;
|
|
49
52
|
}
|
|
@@ -9,6 +9,7 @@ function getDefaults() {
|
|
|
9
9
|
lastClosedTab: undefined,
|
|
10
10
|
prefixes: "",
|
|
11
11
|
autoCaptureEnabled: true,
|
|
12
|
+
customEndpointButtons: [],
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
export default class PersistentConfig {
|
|
@@ -119,6 +120,13 @@ export default class PersistentConfig {
|
|
|
119
120
|
this.persistedJson.autoCaptureEnabled = enabled;
|
|
120
121
|
this.toStorage();
|
|
121
122
|
}
|
|
123
|
+
getCustomEndpointButtons() {
|
|
124
|
+
return this.persistedJson.customEndpointButtons || [];
|
|
125
|
+
}
|
|
126
|
+
setCustomEndpointButtons(buttons) {
|
|
127
|
+
this.persistedJson.customEndpointButtons = buttons;
|
|
128
|
+
this.toStorage();
|
|
129
|
+
}
|
|
122
130
|
static clear() {
|
|
123
131
|
const storage = new YStorage(storageNamespace);
|
|
124
132
|
storage.removeNamespace();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentConfig.js","sourceRoot":"","sources":["../../../../../packages/yasgui/src/PersistentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,CAAC,IAAI,gBAAgB,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"PersistentConfig.js","sourceRoot":"","sources":["../../../../../packages/yasgui/src/PersistentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CA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C;CACF"}
|
package/build/ts/src/Tab.d.ts
CHANGED
|
@@ -51,7 +51,10 @@ export declare class Tab extends EventEmitter {
|
|
|
51
51
|
private yasqeWrapperEl;
|
|
52
52
|
private yasrWrapperEl;
|
|
53
53
|
private endpointSelect;
|
|
54
|
+
private endpointButtonsContainer;
|
|
54
55
|
private settingsModal?;
|
|
56
|
+
private currentOrientation;
|
|
57
|
+
private orientationToggleButton?;
|
|
55
58
|
constructor(yasgui: Yasgui, conf: PersistedJson);
|
|
56
59
|
name(): string;
|
|
57
60
|
getPersistedJson(): PersistedJson;
|
|
@@ -68,10 +71,15 @@ export declare class Tab extends EventEmitter {
|
|
|
68
71
|
setQuery(query: string): this;
|
|
69
72
|
getRequestConfig(): YasguiRequestConfig;
|
|
70
73
|
private initControlbar;
|
|
74
|
+
private initOrientationToggle;
|
|
75
|
+
private updateOrientationToggleIcon;
|
|
76
|
+
toggleOrientation(): void;
|
|
71
77
|
getYasqe(): Yasqe;
|
|
72
78
|
getYasr(): Yasr;
|
|
73
79
|
private initTabSettingsMenu;
|
|
74
80
|
private initEndpointSelectField;
|
|
81
|
+
private initEndpointButtons;
|
|
82
|
+
refreshEndpointButtons(): void;
|
|
75
83
|
private checkEndpointForCors;
|
|
76
84
|
setEndpoint(endpoint: string, endpointHistory?: string[]): this;
|
|
77
85
|
getEndpoint(): string;
|
package/build/ts/src/Tab.js
CHANGED
|
@@ -17,6 +17,14 @@ import * as shareLink from "./linkUtils";
|
|
|
17
17
|
import EndpointSelect from "./endpointSelect";
|
|
18
18
|
import "./tab.scss";
|
|
19
19
|
import { getRandomId, default as Yasgui } from "./";
|
|
20
|
+
const HORIZONTAL_LAYOUT_ICON = `<svg viewBox="0 0 24 24" class="svgImg">
|
|
21
|
+
<rect x="2" y="4" width="9" height="16" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
22
|
+
<rect x="13" y="4" width="9" height="16" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
23
|
+
</svg>`;
|
|
24
|
+
const VERTICAL_LAYOUT_ICON = `<svg viewBox="0 0 24 24" class="svgImg">
|
|
25
|
+
<rect x="2" y="2" width="20" height="8" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
26
|
+
<rect x="2" y="12" width="20" height="10" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
27
|
+
</svg>`;
|
|
20
28
|
export class Tab extends EventEmitter {
|
|
21
29
|
constructor(yasgui, conf) {
|
|
22
30
|
super();
|
|
@@ -156,6 +164,7 @@ WHERE {
|
|
|
156
164
|
throw new Error("Expected a valid configuration to initialize tab with");
|
|
157
165
|
this.yasgui = yasgui;
|
|
158
166
|
this.persistentJson = conf;
|
|
167
|
+
this.currentOrientation = this.yasgui.config.orientation || "vertical";
|
|
159
168
|
}
|
|
160
169
|
name() {
|
|
161
170
|
return this.persistentJson.name;
|
|
@@ -174,6 +183,7 @@ WHERE {
|
|
|
174
183
|
this.rootEl.id = this.persistentJson.id;
|
|
175
184
|
this.rootEl.setAttribute("role", "tabpanel");
|
|
176
185
|
this.rootEl.setAttribute("aria-labelledby", "tab-" + this.persistentJson.id);
|
|
186
|
+
addClass(this.rootEl, `orientation-${this.currentOrientation}`);
|
|
177
187
|
const editorWrapper = document.createElement("div");
|
|
178
188
|
editorWrapper.className = "editorwrapper";
|
|
179
189
|
const controlbarAndYasqeDiv = document.createElement("div");
|
|
@@ -184,6 +194,7 @@ WHERE {
|
|
|
184
194
|
controlbarAndYasqeDiv.appendChild(this.yasqeWrapperEl);
|
|
185
195
|
editorWrapper.appendChild(controlbarAndYasqeDiv);
|
|
186
196
|
this.yasrWrapperEl = document.createElement("div");
|
|
197
|
+
this.yasrWrapperEl.className = "yasrWrapperEl";
|
|
187
198
|
this.initTabSettingsMenu();
|
|
188
199
|
this.rootEl.appendChild(editorWrapper);
|
|
189
200
|
this.rootEl.appendChild(this.yasrWrapperEl);
|
|
@@ -261,10 +272,47 @@ WHERE {
|
|
|
261
272
|
}
|
|
262
273
|
initControlbar() {
|
|
263
274
|
this.initEndpointSelectField();
|
|
275
|
+
this.initOrientationToggle();
|
|
276
|
+
this.initEndpointButtons();
|
|
264
277
|
if (this.yasgui.config.endpointInfo && this.controlBarEl) {
|
|
265
278
|
this.controlBarEl.appendChild(this.yasgui.config.endpointInfo());
|
|
266
279
|
}
|
|
267
280
|
}
|
|
281
|
+
initOrientationToggle() {
|
|
282
|
+
if (!this.controlBarEl)
|
|
283
|
+
return;
|
|
284
|
+
this.orientationToggleButton = document.createElement("button");
|
|
285
|
+
this.orientationToggleButton.className = "tabContextButton orientationToggle";
|
|
286
|
+
this.orientationToggleButton.setAttribute("aria-label", "Toggle layout orientation");
|
|
287
|
+
this.orientationToggleButton.title = "Toggle layout orientation";
|
|
288
|
+
this.updateOrientationToggleIcon();
|
|
289
|
+
this.orientationToggleButton.addEventListener("click", () => {
|
|
290
|
+
this.toggleOrientation();
|
|
291
|
+
});
|
|
292
|
+
this.controlBarEl.appendChild(this.orientationToggleButton);
|
|
293
|
+
}
|
|
294
|
+
updateOrientationToggleIcon() {
|
|
295
|
+
if (!this.orientationToggleButton)
|
|
296
|
+
return;
|
|
297
|
+
this.orientationToggleButton.innerHTML =
|
|
298
|
+
this.currentOrientation === "vertical" ? HORIZONTAL_LAYOUT_ICON : VERTICAL_LAYOUT_ICON;
|
|
299
|
+
this.orientationToggleButton.title =
|
|
300
|
+
this.currentOrientation === "vertical" ? "Switch to horizontal layout" : "Switch to vertical layout";
|
|
301
|
+
}
|
|
302
|
+
toggleOrientation() {
|
|
303
|
+
if (!this.rootEl)
|
|
304
|
+
return;
|
|
305
|
+
removeClass(this.rootEl, `orientation-${this.currentOrientation}`);
|
|
306
|
+
this.currentOrientation = this.currentOrientation === "vertical" ? "horizontal" : "vertical";
|
|
307
|
+
addClass(this.rootEl, `orientation-${this.currentOrientation}`);
|
|
308
|
+
this.updateOrientationToggleIcon();
|
|
309
|
+
if (this.yasqe) {
|
|
310
|
+
this.yasqe.refresh();
|
|
311
|
+
}
|
|
312
|
+
if (this.yasr) {
|
|
313
|
+
this.yasr.refresh();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
268
316
|
getYasqe() {
|
|
269
317
|
return this.yasqe;
|
|
270
318
|
}
|
|
@@ -287,6 +335,40 @@ WHERE {
|
|
|
287
335
|
this.setEndpoint(endpoint, endpointHistory);
|
|
288
336
|
});
|
|
289
337
|
}
|
|
338
|
+
initEndpointButtons() {
|
|
339
|
+
if (!this.controlBarEl)
|
|
340
|
+
throw new Error("Need to initialize wrapper elements before drawing endpoint buttons");
|
|
341
|
+
if (!this.endpointButtonsContainer) {
|
|
342
|
+
this.endpointButtonsContainer = document.createElement("div");
|
|
343
|
+
addClass(this.endpointButtonsContainer, "endpointButtonsContainer");
|
|
344
|
+
this.controlBarEl.appendChild(this.endpointButtonsContainer);
|
|
345
|
+
}
|
|
346
|
+
this.refreshEndpointButtons();
|
|
347
|
+
}
|
|
348
|
+
refreshEndpointButtons() {
|
|
349
|
+
if (!this.endpointButtonsContainer)
|
|
350
|
+
return;
|
|
351
|
+
this.endpointButtonsContainer.innerHTML = "";
|
|
352
|
+
const configButtons = this.yasgui.config.endpointButtons || [];
|
|
353
|
+
const customButtons = this.yasgui.persistentConfig.getCustomEndpointButtons();
|
|
354
|
+
const allButtons = [...configButtons, ...customButtons];
|
|
355
|
+
if (allButtons.length === 0) {
|
|
356
|
+
this.endpointButtonsContainer.style.display = "none";
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
this.endpointButtonsContainer.style.display = "flex";
|
|
360
|
+
allButtons.forEach((buttonConfig) => {
|
|
361
|
+
const button = document.createElement("button");
|
|
362
|
+
addClass(button, "endpointButton");
|
|
363
|
+
button.textContent = buttonConfig.label;
|
|
364
|
+
button.title = `Set endpoint to ${buttonConfig.endpoint}`;
|
|
365
|
+
button.setAttribute("aria-label", `Set endpoint to ${buttonConfig.endpoint}`);
|
|
366
|
+
button.addEventListener("click", () => {
|
|
367
|
+
this.setEndpoint(buttonConfig.endpoint);
|
|
368
|
+
});
|
|
369
|
+
this.endpointButtonsContainer.appendChild(button);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
290
372
|
checkEndpointForCors(endpoint) {
|
|
291
373
|
if (this.yasgui.config.corsProxy && !(endpoint in Yasgui.corsEnabled)) {
|
|
292
374
|
const askUrl = new URL(endpoint);
|
|
@@ -368,7 +450,9 @@ WHERE {
|
|
|
368
450
|
return config;
|
|
369
451
|
}
|
|
370
452
|
initYasqe() {
|
|
371
|
-
const
|
|
453
|
+
const currentTheme = this.yasgui.getTheme();
|
|
454
|
+
const cmTheme = currentTheme === "dark" ? "material-palenight" : "default";
|
|
455
|
+
const yasqeConf = Object.assign(Object.assign({}, this.yasgui.config.yasqe), { theme: cmTheme, value: this.persistentJson.yasqe.value, editorHeight: this.persistentJson.yasqe.editorHeight ? this.persistentJson.yasqe.editorHeight : undefined, persistenceId: null, consumeShareLink: null, createShareableLink: () => this.getShareableLink(), requestConfig: () => {
|
|
372
456
|
const processedReqConfig = Object.assign(Object.assign({ acceptHeaderGraph: "text/turtle", acceptHeaderSelect: "application/sparql-results+json" }, mergeWith({}, this.persistentJson.requestConfig, this.getStaticRequestConfig(), function customizer(objValue, srcValue) {
|
|
373
457
|
if (Array.isArray(objValue) || Array.isArray(srcValue)) {
|
|
374
458
|
return [...(objValue || []), ...(srcValue || [])];
|