@matdata/yasr 5.2.0 → 5.4.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 CHANGED
@@ -1,196 +1,180 @@
1
1
  # YASGUI
2
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
3
+ **Yet Another SPARQL GUI (YASGUI)** is a powerful, user-friendly web-based interface for querying and exploring RDF data using SPARQL. It combines a feature-rich query editor (YASQE) with a versatile results viewer (YASR) to provide a comprehensive SPARQL IDE.
30
4
 
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
- ```
5
+ 🌐 **Try it now**: [https://yasgui.matdata.eu/](https://yasgui.matdata.eu/)
70
6
 
71
- #### CSS Customization
7
+ [![npm version](https://img.shields.io/npm/v/@matdata/yasgui)](https://www.npmjs.com/package/@matdata/yasgui)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
72
9
 
73
- Customize the header height used in the horizontal layout calculation by setting the CSS custom property:
10
+ ---
74
11
 
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.
12
+ ## Quick Links
101
13
 
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.
14
+ - 📖 **[User Guide](./docs/user-guide.md)** - Complete guide for end users
15
+ - 🛠️ **[Developer Guide](./docs/developer-guide.md)** - API reference and integration guide
16
+ - 🚀 **[Production Environment](https://yasgui.matdata.eu/)** - Live instance
17
+ - 📦 **[npm Package](https://www.npmjs.com/package/@matdata/yasgui)**
18
+ - 🐳 **[Docker Hub](https://hub.docker.com/r/mathiasvda/yasgui)**
19
+ - 📝 **[Releases & Changelog](https://github.com/Matdata-eu/Yasgui/releases)**
20
+ - 💻 **[GitHub Repository](https://github.com/Matdata-eu/Yasgui)**
110
21
 
111
- ### Endpoint Quick Switch Buttons
22
+ ---
112
23
 
113
- Configure predefined SPARQL endpoint buttons for quick switching between different endpoints:
24
+ ## Documentation
114
25
 
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
26
+ The **documentation for YASGUI is hosted on GitHub Pages**:
120
27
 
121
- For detailed configuration options and examples, see the [Endpoint Buttons Guide](./docs/ENDPOINT_BUTTONS.md).
28
+ - **📚 Documentation Website**: [https://yasgui-doc.matdata.eu/](https://matdata-eu.github.io/Yasgui/)
29
+ - User Guide, Developer Guide, API Reference
30
+ - Built with Docusaurus
31
+ - Version-tagged with the repository
122
32
 
123
- ### Result Visualization Plugins (Yasr)
33
+ - **🚀 Development Build**: [https://yasgui-doc.matdata.eu/dev/main/](https://matdata-eu.github.io/Yasgui/dev/main/)
34
+ - Live build from the main branch
35
+ - Updated automatically with every commit
36
+ - Test latest features before release
124
37
 
125
- Yasgui includes several built-in plugins to visualize SPARQL query results:
38
+ The documentation is version-tagged with the repository, ensuring consistency between code and documentation across releases.
126
39
 
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.
40
+ ## Features
133
41
 
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.
42
+ YASGUI provides a complete SPARQL development environment with powerful features:
43
+
44
+ ### ✏️ Advanced Query Editor
45
+ - **[SPARQL Syntax Highlighting](./docs/user-guide.md#yasqe-query-editor)** - Color-coded SPARQL with error detection
46
+ - **[Smart Autocomplete](./docs/user-guide.md#prefix-management)** - Context-aware suggestions for keywords, prefixes, and URIs
47
+ - **[Query Formatting](./docs/user-guide.md#query-formatting)** - One-click query beautification with configurable formatters
48
+ - **[Prefix Management](./docs/user-guide.md#prefix-management)** - Auto-capture and reuse PREFIX declarations
49
+ - **[URI Explorer](./docs/user-guide.md#uri-explorer)** - Ctrl+Click URIs to explore connections
50
+ - **[Keyboard Shortcuts](./docs/user-guide.md#keyboard-shortcuts)** - Efficient query development workflow
51
+
52
+ ### 📊 Powerful Visualizations
53
+ - **[Table Plugin](./docs/user-guide.md#table-plugin)** - Sortable, filterable, paginated result tables
54
+ - **[Graph Plugin](./docs/user-guide.md#graph-plugin)** - Interactive RDF graph visualization
55
+ - **[Geo Plugin](./docs/user-guide.md#geo-plugin)** - Geographic data on interactive maps
56
+ - **[Response Plugin](./docs/user-guide.md#response-plugin)** - Raw response viewer with syntax highlighting
57
+ - **[Boolean Plugin](./docs/user-guide.md#boolean-plugin)** - Visual true/false indicators for ASK queries
58
+ - **[Error Plugin](./docs/user-guide.md#error-plugin)** - Detailed error diagnostics
59
+
60
+ ### 🎨 Themes & Layouts
61
+ - **[Light & Dark Themes](./docs/user-guide.md#themes)** - Seamless theme switching with persistent preferences
62
+ - **[Flexible Layouts](./docs/user-guide.md#layout-orientation)** - Vertical or horizontal editor/results arrangement
63
+
64
+ ### 🔧 Expert Features
65
+ - **[Multiple Tabs](./docs/user-guide.md#query-tabs)** - Work on multiple queries simultaneously
66
+ - **[Endpoint Management](./docs/user-guide.md#endpoint-quick-switch)** - Quick-switch between SPARQL endpoints
67
+ - **[Persistent Storage](./docs/user-guide.md#query-history-and-persistence)** - Auto-save queries and preferences
68
+ - **[URL Sharing](./docs/user-guide.md#share-queries)** - Share queries via URL parameters
69
+ - **[Fullscreen Mode](./docs/user-guide.md#fullscreen-mode)** - Maximize editor or results viewer
70
+ - **[Export Results](./docs/developer-guide.md#yasr-class)** - Download results in various formats
71
+
72
+ For detailed feature documentation, see the **[User Guide](./docs/user-guide.md)**.
135
73
 
136
74
  ## Installation
137
75
 
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
76
  ### npm
142
77
 
143
- ```sh
144
- npm i @matdata/yasgui
78
+ ```bash
79
+ npm install @matdata/yasgui
145
80
  ```
146
81
 
147
82
  ### Yarn
148
83
 
149
- ```sh
84
+ ```bash
150
85
  yarn add @matdata/yasgui
151
86
  ```
152
87
 
153
- ### Docker
88
+ ### CDN
89
+
90
+ ```html
91
+ <link rel="stylesheet" href="https://unpkg.com/@matdata/yasgui/build/yasgui.min.css" />
92
+ <script src="https://unpkg.com/@matdata/yasgui/build/yasgui.min.js"></script>
93
+ ```
154
94
 
155
- Yasgui is also available as a Docker image on Docker Hub. Images are built and published automatically when a new release is created.
95
+ ### Docker
156
96
 
157
- ```sh
97
+ ```bash
158
98
  docker pull mathiasvda/yasgui:latest
159
99
  docker run -p 8080:8080 mathiasvda/yasgui:latest
160
100
  ```
161
101
 
162
- You can customize the default SPARQL endpoint by setting the `YASGUI_DEFAULT_ENDPOINT` environment variable:
163
-
164
- ```sh
102
+ **Custom endpoint:**
103
+ ```bash
165
104
  docker run -p 8080:8080 -e YASGUI_DEFAULT_ENDPOINT=https://your-endpoint.com/sparql mathiasvda/yasgui:latest
166
105
  ```
167
106
 
168
- The application will be available at `http://localhost:8080`.
107
+ For detailed installation instructions and usage examples, see the **[Developer Guide](./docs/developer-guide.md#installation)**.
108
+
109
+ ## Quick Start
110
+
111
+ ### Basic HTML Usage
112
+
113
+ ```html
114
+ <!DOCTYPE html>
115
+ <html>
116
+ <head>
117
+ <link rel="stylesheet" href="https://unpkg.com/@matdata/yasgui/build/yasgui.min.css" />
118
+ </head>
119
+ <body>
120
+ <div id="yasgui"></div>
121
+
122
+ <script src="https://unpkg.com/@matdata/yasgui/build/yasgui.min.js"></script>
123
+ <script>
124
+ const yasgui = new Yasgui(document.getElementById("yasgui"), {
125
+ requestConfig: {
126
+ endpoint: "https://dbpedia.org/sparql"
127
+ }
128
+ });
129
+ </script>
130
+ </body>
131
+ </html>
132
+ ```
169
133
 
170
- ## Local Development
134
+ ### ES Modules / React / Vue / Angular
171
135
 
172
- #### Installing dependencies
136
+ ```javascript
137
+ import Yasgui from '@matdata/yasgui';
138
+ import '@matdata/yasgui/build/yasgui.min.css';
139
+
140
+ const yasgui = new Yasgui(document.getElementById('yasgui'), {
141
+ requestConfig: {
142
+ endpoint: 'https://query.wikidata.org/sparql'
143
+ },
144
+ theme: 'dark',
145
+ orientation: 'horizontal'
146
+ });
147
+ ```
173
148
 
174
- Run `npm install`.
149
+ For framework-specific examples and advanced usage, see the **[Developer Guide](./docs/developer-guide.md#usage-examples)**.
175
150
 
176
- #### Running Yasgui locally
151
+ ---
177
152
 
178
- To develop locally, run `npm run dev`
153
+ ## Contributing
179
154
 
180
- Go to `http://localhost:5173/demo` in your browser to see Yasgui in action.
155
+ We welcome contributions! To get started:
181
156
 
182
- #### Compiling Yasgui
157
+ 1. Fork the repository
158
+ 2. Clone and install: `npm install`
159
+ 3. Run dev server: `npm run dev`
160
+ 4. Make your changes
161
+ 5. Run tests: `npm test`
162
+ 6. Submit a pull request
183
163
 
184
- Run `npm run build`. It'll store the transpiled js/css files in the `build` directory.
164
+ For detailed contribution guidelines, see the **[Developer Guide](./docs/developer-guide.md#contributing)**.
165
+
166
+ ---
185
167
 
186
168
  ## License
187
169
 
170
+ MIT License - see [LICENSE](./LICENSE) file for details.
171
+
188
172
  This is a fork from [Zazuko](https://github.com/zazuko/Yasgui) who forked it from [Triply](https://github.com/TriplyDB/Yasgui).
189
173
 
190
- This code is released under the MIT license.
174
+ ---
191
175
 
192
- ## Release notes
176
+ ## Release Notes & Changelog
193
177
 
194
- Release notes can be found in the release section of the GitHub repository: [Yasgui Releases](https://github.com/Matdata-eu/yasgui/releases)
178
+ Release notes and changelog are available in the [Releases](https://github.com/Matdata-eu/Yasgui/releases) section.
195
179
 
196
- Instructions on how to write release notes are found in
180
+ For instructions on writing release notes, see [release_notes_instructions.md](./docs/release_notes_instructions.md)
@@ -0,0 +1,190 @@
1
+ import { describe, it } from "mocha";
2
+ import { expect } from "chai";
3
+ import Yasr from "../../../index";
4
+ describe("Table Plugin", () => {
5
+ describe("Markdown Generation", () => {
6
+ it("should generate markdown table from simple results", () => {
7
+ const container = document.createElement("div");
8
+ const yasr = new Yasr(container);
9
+ const mockResults = {
10
+ head: {
11
+ vars: ["subject", "predicate", "object"],
12
+ },
13
+ results: {
14
+ bindings: [
15
+ {
16
+ subject: { type: "uri", value: "http://example.org/resource/1" },
17
+ predicate: { type: "uri", value: "http://example.org/name" },
18
+ object: { type: "literal", value: "Test Name" },
19
+ },
20
+ {
21
+ subject: { type: "uri", value: "http://example.org/resource/2" },
22
+ predicate: { type: "uri", value: "http://example.org/name" },
23
+ object: { type: "literal", value: "Another Name" },
24
+ },
25
+ ],
26
+ },
27
+ };
28
+ yasr.setResponse({
29
+ response: JSON.stringify(mockResults),
30
+ status: 200,
31
+ contentType: "application/sparql-results+json",
32
+ }, 0);
33
+ const tablePlugin = yasr.plugins["table"];
34
+ const markdown = tablePlugin.getMarkdownTable();
35
+ expect(markdown).to.be.a("string");
36
+ expect(markdown).to.include("| subject | predicate | object |");
37
+ expect(markdown).to.include("| --- | --- | --- |");
38
+ expect(markdown).to.include("http://example.org/resource/1");
39
+ expect(markdown).to.include("Test Name");
40
+ });
41
+ it("should escape pipe characters in markdown values", () => {
42
+ const container = document.createElement("div");
43
+ const yasr = new Yasr(container);
44
+ const mockResults = {
45
+ head: {
46
+ vars: ["value"],
47
+ },
48
+ results: {
49
+ bindings: [
50
+ {
51
+ value: { type: "literal", value: "text|with|pipes" },
52
+ },
53
+ ],
54
+ },
55
+ };
56
+ yasr.setResponse({
57
+ response: JSON.stringify(mockResults),
58
+ status: 200,
59
+ contentType: "application/sparql-results+json",
60
+ }, 0);
61
+ const tablePlugin = yasr.plugins["table"];
62
+ const markdown = tablePlugin.getMarkdownTable();
63
+ expect(markdown).to.include("text\\|with\\|pipes");
64
+ });
65
+ });
66
+ describe("URI Prefixing", () => {
67
+ it("should show URI prefixes when enabled", () => {
68
+ const container = document.createElement("div");
69
+ const yasr = new Yasr(container, {
70
+ prefixes: {
71
+ ex: "http://example.org/",
72
+ },
73
+ });
74
+ const mockResults = {
75
+ head: {
76
+ vars: ["resource"],
77
+ },
78
+ results: {
79
+ bindings: [
80
+ {
81
+ resource: { type: "uri", value: "http://example.org/test" },
82
+ },
83
+ ],
84
+ },
85
+ };
86
+ yasr.setResponse({
87
+ response: JSON.stringify(mockResults),
88
+ status: 200,
89
+ contentType: "application/sparql-results+json",
90
+ }, 0);
91
+ const tablePlugin = yasr.plugins["table"];
92
+ tablePlugin.draw({ showUriPrefixes: true });
93
+ const tableHtml = container.innerHTML;
94
+ expect(tableHtml).to.include("ex:test");
95
+ });
96
+ it("should show full URIs when prefixing disabled", () => {
97
+ const container = document.createElement("div");
98
+ const yasr = new Yasr(container, {
99
+ prefixes: {
100
+ ex: "http://example.org/",
101
+ },
102
+ });
103
+ const mockResults = {
104
+ head: {
105
+ vars: ["resource"],
106
+ },
107
+ results: {
108
+ bindings: [
109
+ {
110
+ resource: { type: "uri", value: "http://example.org/test" },
111
+ },
112
+ ],
113
+ },
114
+ };
115
+ yasr.setResponse({
116
+ response: JSON.stringify(mockResults),
117
+ status: 200,
118
+ contentType: "application/sparql-results+json",
119
+ }, 0);
120
+ const tablePlugin = yasr.plugins["table"];
121
+ tablePlugin.draw({ showUriPrefixes: false });
122
+ const tableHtml = container.innerHTML;
123
+ expect(tableHtml).to.include("http://example.org/test");
124
+ expect(tableHtml).to.not.include("ex:test");
125
+ });
126
+ });
127
+ describe("Datatype Display", () => {
128
+ it("should show datatypes when enabled", () => {
129
+ const container = document.createElement("div");
130
+ const yasr = new Yasr(container);
131
+ const mockResults = {
132
+ head: {
133
+ vars: ["number"],
134
+ },
135
+ results: {
136
+ bindings: [
137
+ {
138
+ number: {
139
+ type: "literal",
140
+ value: "42",
141
+ datatype: "http://www.w3.org/2001/XMLSchema#integer",
142
+ },
143
+ },
144
+ ],
145
+ },
146
+ };
147
+ yasr.setResponse({
148
+ response: JSON.stringify(mockResults),
149
+ status: 200,
150
+ contentType: "application/sparql-results+json",
151
+ }, 0);
152
+ const tablePlugin = yasr.plugins["table"];
153
+ tablePlugin.draw({ showDatatypes: true });
154
+ const tableHtml = container.innerHTML;
155
+ expect(tableHtml).to.include("^^");
156
+ expect(tableHtml).to.include("XMLSchema#integer");
157
+ });
158
+ it("should hide datatypes when disabled", () => {
159
+ const container = document.createElement("div");
160
+ const yasr = new Yasr(container);
161
+ const mockResults = {
162
+ head: {
163
+ vars: ["number"],
164
+ },
165
+ results: {
166
+ bindings: [
167
+ {
168
+ number: {
169
+ type: "literal",
170
+ value: "42",
171
+ datatype: "http://www.w3.org/2001/XMLSchema#integer",
172
+ },
173
+ },
174
+ ],
175
+ },
176
+ };
177
+ yasr.setResponse({
178
+ response: JSON.stringify(mockResults),
179
+ status: 200,
180
+ contentType: "application/sparql-results+json",
181
+ }, 0);
182
+ const tablePlugin = yasr.plugins["table"];
183
+ tablePlugin.draw({ showDatatypes: false });
184
+ const tableHtml = container.innerHTML;
185
+ expect(tableHtml).to.not.include("^^");
186
+ expect(tableHtml).to.not.include("XMLSchema#integer");
187
+ });
188
+ });
189
+ });
190
+ //# sourceMappingURL=table-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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E,0CAA0C;6BAC9B;yBACzB;qBACF;iBACF;aACF,CAAC;YAEF,IAAI,CAAC,WAAW,CACd;gBACE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;gBACrC,MAAM,EAAE,GAAG;gBACX,WAAW,EAAE,iCAAiC;aAC/C,EACD,CAAC,CACF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAE1C,WAAW,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;YAE3C,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;YACtC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACvC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -11,7 +11,9 @@ export interface PluginConfig {
11
11
  export interface PersistentConfig {
12
12
  pageSize?: number;
13
13
  compact?: boolean;
14
- isEllipsed?: boolean;
14
+ isCompactView?: boolean;
15
+ showUriPrefixes?: boolean;
16
+ showDatatypes?: boolean;
15
17
  }
16
18
  export default class Table implements Plugin<PluginConfig> {
17
19
  private config;
@@ -23,7 +25,9 @@ export default class Table implements Plugin<PluginConfig> {
23
25
  private tableFilterField;
24
26
  private tableSizeField;
25
27
  private tableCompactSwitch;
26
- private tableEllipseSwitch;
28
+ private tableCompactViewSwitch;
29
+ private tableUriPrefixSwitch;
30
+ private tableDatatypeSwitch;
27
31
  private tableResizer;
28
32
  helpReference: string;
29
33
  label: string;
@@ -32,6 +36,7 @@ export default class Table implements Plugin<PluginConfig> {
32
36
  constructor(yasr: Yasr);
33
37
  static defaults: PluginConfig;
34
38
  private getRows;
39
+ private getMarkdownTable;
35
40
  private getUriLinkFromBinding;
36
41
  private getCellContent;
37
42
  private formatLiteral;
@@ -42,7 +47,10 @@ export default class Table implements Plugin<PluginConfig> {
42
47
  private handleTableSearch;
43
48
  private handleTableSizeSelect;
44
49
  private handleSetCompactToggle;
45
- private handleSetEllipsisToggle;
50
+ private handleSetCompactViewToggle;
51
+ private handleSetUriPrefixToggle;
52
+ private handleSetDatatypeToggle;
53
+ private handleCopyMarkdown;
46
54
  drawControls(): void;
47
55
  download(filename?: string): DownloadInfo;
48
56
  canHandleResults(): boolean;