@matdata/yasgui-chart-plugin 0.0.0-stage → 0.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/LICENSE +201 -0
- package/README.md +124 -3
- package/dist/ChartPlugin.d.ts +73 -0
- package/dist/ChartPlugin.d.ts.map +1 -0
- package/dist/chartOptions.d.ts +26 -0
- package/dist/chartOptions.d.ts.map +1 -0
- package/dist/columns.d.ts +45 -0
- package/dist/columns.d.ts.map +1 -0
- package/dist/controls.d.ts +22 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/dataModel.d.ts +75 -0
- package/dist/dataModel.d.ts.map +1 -0
- package/dist/describe/describe-modal.d.ts +109 -0
- package/dist/describe/describe-modal.d.ts.map +1 -0
- package/dist/describe/describe-parser.d.ts +37 -0
- package/dist/describe/describe-parser.d.ts.map +1 -0
- package/dist/describe/resource-query.d.ts +37 -0
- package/dist/describe/resource-query.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/settings.d.ts +40 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/theme.d.ts +17 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/types.d.ts +91 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/yasgui-chart-plugin.cjs.js +51105 -0
- package/dist/yasgui-chart-plugin.cjs.js.map +7 -0
- package/dist/yasgui-chart-plugin.css +495 -0
- package/dist/yasgui-chart-plugin.esm.js +51088 -0
- package/dist/yasgui-chart-plugin.esm.js.map +7 -0
- package/dist/yasgui-chart-plugin.min.css +1 -0
- package/dist/yasgui-chart-plugin.min.js +62 -0
- package/dist/yasgui-chart-plugin.min.js.map +7 -0
- package/package.json +65 -6
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource triples modal
|
|
3
|
+
*
|
|
4
|
+
* Displays the result of a background query for the triples in which a
|
|
5
|
+
* resource is the subject (or object) in a popup window. URIs are shown with
|
|
6
|
+
* the prefixes declared in the main query.
|
|
7
|
+
* Parsed triples are shown in a table; the raw response text is available on a
|
|
8
|
+
* separate tab.
|
|
9
|
+
*
|
|
10
|
+
* URIs in the triples table can be Ctrl+clicked to describe them in turn. The
|
|
11
|
+
* modal keeps those hops in a history that its back, forward and back-to-start
|
|
12
|
+
* buttons (and Alt+←/→) walk through, like a browser.
|
|
13
|
+
*/
|
|
14
|
+
import { DescribeParseResult } from './describe-parser';
|
|
15
|
+
import { PrefixMap } from '../types';
|
|
16
|
+
import { ResourceDirection } from './resource-query';
|
|
17
|
+
/** How the modal should present the query it is showing. */
|
|
18
|
+
export interface DescribeModalView {
|
|
19
|
+
/** Which triples were requested. Defaults to `'subject'`. */
|
|
20
|
+
direction?: ResourceDirection;
|
|
21
|
+
/** Prefixes used to abbreviate URIs in the title and triples table. */
|
|
22
|
+
prefixes?: PrefixMap;
|
|
23
|
+
}
|
|
24
|
+
export type DescribeModalTab = 'triples' | 'raw';
|
|
25
|
+
/** One describe in the modal's navigation history. */
|
|
26
|
+
export interface DescribeHistoryEntry {
|
|
27
|
+
uri: string;
|
|
28
|
+
direction: ResourceDirection;
|
|
29
|
+
}
|
|
30
|
+
export interface DescribeModalCallbacks {
|
|
31
|
+
/**
|
|
32
|
+
* Fetch and show the triples of a URI. Called for Ctrl+clicks inside the
|
|
33
|
+
* modal and for back/forward navigation; the modal has already updated its
|
|
34
|
+
* history.
|
|
35
|
+
*/
|
|
36
|
+
onDescribe?: (uri: string, direction: ResourceDirection) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare class DescribeModal {
|
|
39
|
+
private callbacks;
|
|
40
|
+
private backdrop;
|
|
41
|
+
private modal;
|
|
42
|
+
private contentArea;
|
|
43
|
+
private currentTab;
|
|
44
|
+
private escapeHandler;
|
|
45
|
+
private view;
|
|
46
|
+
private history;
|
|
47
|
+
private historyIndex;
|
|
48
|
+
constructor(callbacks?: DescribeModalCallbacks);
|
|
49
|
+
/**
|
|
50
|
+
* Start a fresh navigation history for a describe launched from outside the
|
|
51
|
+
* modal (the chart).
|
|
52
|
+
*/
|
|
53
|
+
startHistory(uri: string, direction: ResourceDirection): void;
|
|
54
|
+
/**
|
|
55
|
+
* Describe a URI reached from inside the modal, adding it to the history.
|
|
56
|
+
* Entries after the current one (left by going back) are dropped.
|
|
57
|
+
*/
|
|
58
|
+
navigate(uri: string, direction: ResourceDirection): void;
|
|
59
|
+
getHistory(): DescribeHistoryEntry[];
|
|
60
|
+
canGoBack(): boolean;
|
|
61
|
+
canGoForward(): boolean;
|
|
62
|
+
/** Show the previous entry of the history. */
|
|
63
|
+
back(): void;
|
|
64
|
+
/** Show the next entry of the history. */
|
|
65
|
+
forward(): void;
|
|
66
|
+
/** Show the first entry of the history: the original describe. */
|
|
67
|
+
backToStart(): void;
|
|
68
|
+
private goTo;
|
|
69
|
+
/**
|
|
70
|
+
* Show the modal in a loading state.
|
|
71
|
+
*/
|
|
72
|
+
showLoading(uri: string, view?: DescribeModalView): void;
|
|
73
|
+
/**
|
|
74
|
+
* Show the modal with parsed DESCRIBE results.
|
|
75
|
+
*/
|
|
76
|
+
showResults(uri: string, result: DescribeParseResult, view?: DescribeModalView): void;
|
|
77
|
+
/**
|
|
78
|
+
* Show the modal after a query error.
|
|
79
|
+
*/
|
|
80
|
+
showError(uri: string, error: unknown, raw?: string, view?: DescribeModalView): void;
|
|
81
|
+
/**
|
|
82
|
+
* Close the modal and clean up event listeners.
|
|
83
|
+
*/
|
|
84
|
+
close(): void;
|
|
85
|
+
private setView;
|
|
86
|
+
private render;
|
|
87
|
+
/** Back to start, back and forward buttons. */
|
|
88
|
+
private createNavigation;
|
|
89
|
+
private createLoadingView;
|
|
90
|
+
private createErrorView;
|
|
91
|
+
private createResultsView;
|
|
92
|
+
private refreshResultsView;
|
|
93
|
+
private createTriplesTable;
|
|
94
|
+
private createRawSection;
|
|
95
|
+
private createCell;
|
|
96
|
+
/**
|
|
97
|
+
* Cell holding a URI link. A plain click opens the URI; Ctrl+click (Cmd+click
|
|
98
|
+
* on macOS) describes it as subject, Ctrl+Shift+click as object.
|
|
99
|
+
*/
|
|
100
|
+
private createUriCell;
|
|
101
|
+
/** Prefixed name when a query prefix matches, otherwise `<uri>`. */
|
|
102
|
+
private displayUri;
|
|
103
|
+
private displayObject;
|
|
104
|
+
private fullObject;
|
|
105
|
+
private shorten;
|
|
106
|
+
private errorMessage;
|
|
107
|
+
private copyToClipboard;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=describe-modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-modal.d.ts","sourceRoot":"","sources":["../../src/describe/describe-modal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAAwC,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAkC,MAAM,kBAAkB,CAAC;AAErF,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,KAAK,CAAC;AAEjD,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,iBAAiB,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAClE;AAED,qBAAa,aAAa;IAUZ,OAAO,CAAC,SAAS;IAT7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAA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C,gBAAgB;IAkBxB,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAqBrB,oEAAoE;IACpE,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,YAAY;YAUN,eAAe;CAkB9B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DESCRIBE query response parser
|
|
3
|
+
*
|
|
4
|
+
* Normalizes the raw response from yasr.executeQuery() into a simple triple
|
|
5
|
+
* representation that can be rendered in a modal table. Falls back to the raw
|
|
6
|
+
* response text when the response cannot be parsed as SPARQL JSON triples or
|
|
7
|
+
* N-Triples.
|
|
8
|
+
*/
|
|
9
|
+
export interface DescribeTriple {
|
|
10
|
+
subject: string;
|
|
11
|
+
predicate: string;
|
|
12
|
+
object: {
|
|
13
|
+
value: string;
|
|
14
|
+
type: 'uri' | 'literal' | 'bnode';
|
|
15
|
+
datatype?: string;
|
|
16
|
+
lang?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface DescribeParseResult {
|
|
20
|
+
triples: DescribeTriple[];
|
|
21
|
+
raw: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse the raw response from a DESCRIBE background query.
|
|
25
|
+
*
|
|
26
|
+
* Order of parsing:
|
|
27
|
+
* 1. SPARQL JSON results with subject/predicate/object bindings.
|
|
28
|
+
* 2. Turtle/N-Triples via N3 (handles @prefix, multi-line statements, numbers,
|
|
29
|
+
* booleans, lists, etc.).
|
|
30
|
+
* 3. Fall back to returning the raw text with no parsed triples.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseDescribeResponse(response: unknown): Promise<DescribeParseResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Format a triple object for display.
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatDescribeObject(object: DescribeTriple['object']): string;
|
|
37
|
+
//# sourceMappingURL=describe-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-parser.d.ts","sourceRoot":"","sources":["../../src/describe/describe-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;QAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AA4BD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoB3F;AAuFD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,MAAM,CAe7E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource triple queries
|
|
3
|
+
*
|
|
4
|
+
* Builds the SPARQL queries used when a user Ctrl+clicks (or Ctrl+Shift+clicks)
|
|
5
|
+
* a URI in the chart, and abbreviates URIs with the prefixes that were declared
|
|
6
|
+
* in the main YASQE query.
|
|
7
|
+
*
|
|
8
|
+
* - `subject`: all triples where the resource is the subject (<uri> ?p ?o)
|
|
9
|
+
* - `object`: all triples where the resource is the object (?s ?p <uri>)
|
|
10
|
+
*/
|
|
11
|
+
import { PrefixMap } from '../types';
|
|
12
|
+
export type ResourceDirection = 'subject' | 'object';
|
|
13
|
+
/**
|
|
14
|
+
* Keep only well-formed prefix declarations.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizePrefixes(prefixes: unknown): PrefixMap;
|
|
17
|
+
/**
|
|
18
|
+
* Abbreviate a URI to a prefixed name using the given prefixes.
|
|
19
|
+
* Picks the longest matching namespace. Returns `null` when no prefix matches
|
|
20
|
+
* or the resulting local name would not be a valid prefixed name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toPrefixedName(uri: string, prefixes: PrefixMap): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Render a URI as a SPARQL term: a prefixed name when possible, else <iri>.
|
|
25
|
+
*/
|
|
26
|
+
export declare function toSparqlTerm(uri: string, prefixes: PrefixMap): string;
|
|
27
|
+
/**
|
|
28
|
+
* Build the CONSTRUCT query that fetches the triples in which `uri` is the
|
|
29
|
+
* subject or the object. All prefixes from the main query are declared so the
|
|
30
|
+
* query stays readable and servers can use them in their Turtle output.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildResourceQuery(uri: string, direction: ResourceDirection, prefixes?: PrefixMap): string;
|
|
33
|
+
/**
|
|
34
|
+
* Human readable label for a direction, used in menus and the modal title.
|
|
35
|
+
*/
|
|
36
|
+
export declare function directionLabel(direction: ResourceDirection): string;
|
|
37
|
+
//# sourceMappingURL=resource-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-query.d.ts","sourceRoot":"","sources":["../../src/describe/resource-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAUrD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAe7D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAe9E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM,CAErE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,GAAE,SAAc,GACvB,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,GAAG,MAAM,CAEnE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ChartPlugin from './ChartPlugin';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
Yasgui?: {
|
|
5
|
+
Yasr?: {
|
|
6
|
+
registerPlugin: (name: string, plugin: any) => void;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export default ChartPlugin;
|
|
12
|
+
export type { ChartType, ChartSettings, ChartPluginOptions, SparqlSelectResults } from './types';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,CAAC,EAAE;YACP,IAAI,CAAC,EAAE;gBACL,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;aACrD,CAAC;SACH,CAAC;KACH;CACF;AAOD,eAAe,WAAW,CAAC;AAE3B,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart settings
|
|
3
|
+
*
|
|
4
|
+
* Turns the user's saved choices (if any) and the analysed columns into a
|
|
5
|
+
* complete set of chart settings. Whatever the user didn't choose, or chose
|
|
6
|
+
* for columns the current results no longer have, gets the automatic choice:
|
|
7
|
+
*
|
|
8
|
+
* - category: the first column that isn't a number or a label column
|
|
9
|
+
* - values: every numeric column except the category
|
|
10
|
+
* - series: only for "long" results (one value column, a category that
|
|
11
|
+
* repeats, and a second category-like column with few values)
|
|
12
|
+
* - type: a line chart over dates, a scatter plot for numbers against
|
|
13
|
+
* numbers, a histogram for a single numeric column, else bars
|
|
14
|
+
*/
|
|
15
|
+
import type { ColumnInfo } from './columns';
|
|
16
|
+
import type { ChartSettings, ChartType, ResolvedChartSettings } from './types';
|
|
17
|
+
export declare const CHART_TYPES: {
|
|
18
|
+
value: ChartType;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
/** Most distinct values a column may have to be picked as series automatically */
|
|
22
|
+
export declare const MAX_AUTO_SERIES = 12;
|
|
23
|
+
export declare function isChartType(value: unknown): value is ChartType;
|
|
24
|
+
/** Read saved settings defensively: storage may hold anything */
|
|
25
|
+
export declare function sanitizeSettings(raw: unknown): ChartSettings;
|
|
26
|
+
/**
|
|
27
|
+
* The saved choices that apply to results with these variables: choices made
|
|
28
|
+
* for a different query (other variables) are ignored.
|
|
29
|
+
*/
|
|
30
|
+
export declare function settingsForColumns(saved: ChartSettings, vars: string[]): ChartSettings;
|
|
31
|
+
/** Columns that can serve as the category (x axis): anything but label columns */
|
|
32
|
+
export declare function categoryCandidates(columns: ColumnInfo[]): ColumnInfo[];
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the settings to draw with.
|
|
35
|
+
* @param columns analysed result columns
|
|
36
|
+
* @param saved the user's saved choices (may be empty)
|
|
37
|
+
* @param rowCount number of result rows
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveSettings(columns: ColumnInfo[], saved: ChartSettings, rowCount: number): ResolvedChartSettings;
|
|
40
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE/E,eAAO,MAAM,WAAW,EAAE;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAU5D,CAAC;AAIF,kFAAkF;AAClF,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAY5D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAItF;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAEtE;AA2BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,UAAU,EAAE,EACrB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,GACf,qBAAqB,CAqDvB"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme utilities: read the YASGUI theme and its colours, and watch for changes.
|
|
3
|
+
*/
|
|
4
|
+
export interface ChartThemeColors {
|
|
5
|
+
dark: boolean;
|
|
6
|
+
text: string;
|
|
7
|
+
textMuted: string;
|
|
8
|
+
border: string;
|
|
9
|
+
background: string;
|
|
10
|
+
tooltipBackground: string;
|
|
11
|
+
palette: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function getCurrentTheme(): 'light' | 'dark';
|
|
14
|
+
export declare function getThemeColors(): ChartThemeColors;
|
|
15
|
+
/** Call `callback` whenever the document's data-theme attribute changes */
|
|
16
|
+
export declare function watchThemeChanges(callback: () => void): MutationObserver;
|
|
17
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AA6BD,wBAAgB,eAAe,IAAI,OAAO,GAAG,MAAM,CAGlD;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAajD;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,gBAAgB,CAMxE"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the YASGUI Chart Plugin
|
|
3
|
+
*/
|
|
4
|
+
/** Prefix → namespace map, e.g. `{ rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' }` */
|
|
5
|
+
export interface PrefixMap {
|
|
6
|
+
[prefix: string]: string;
|
|
7
|
+
}
|
|
8
|
+
/** One RDF term in a SPARQL JSON result binding */
|
|
9
|
+
export interface SparqlTerm {
|
|
10
|
+
type: 'uri' | 'literal' | 'typed-literal' | 'bnode' | string;
|
|
11
|
+
value: string;
|
|
12
|
+
datatype?: string;
|
|
13
|
+
'xml:lang'?: string;
|
|
14
|
+
}
|
|
15
|
+
export type SparqlBinding = Record<string, SparqlTerm | undefined>;
|
|
16
|
+
/** SPARQL 1.1 JSON results for a SELECT query */
|
|
17
|
+
export interface SparqlSelectResults {
|
|
18
|
+
head: {
|
|
19
|
+
vars: string[];
|
|
20
|
+
};
|
|
21
|
+
results: {
|
|
22
|
+
bindings: SparqlBinding[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Triple binding as exposed by YASR for CONSTRUCT/DESCRIBE responses */
|
|
26
|
+
export interface YasrBinding {
|
|
27
|
+
subject?: {
|
|
28
|
+
value: string;
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
predicate?: {
|
|
32
|
+
value: string;
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
object?: {
|
|
36
|
+
value: string;
|
|
37
|
+
type: string;
|
|
38
|
+
datatype?: string;
|
|
39
|
+
'xml:lang'?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Options for a background query run through `yasr.executeQuery` */
|
|
43
|
+
export interface PluginQueryOptions {
|
|
44
|
+
acceptHeader?: string;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}
|
|
47
|
+
/** The parts of a YASR instance the chart plugin uses */
|
|
48
|
+
export interface Yasr {
|
|
49
|
+
results: any;
|
|
50
|
+
resultsEl: HTMLElement;
|
|
51
|
+
plugins?: Record<string, unknown>;
|
|
52
|
+
config?: {
|
|
53
|
+
plugins?: Record<string, {
|
|
54
|
+
dynamicConfig?: unknown;
|
|
55
|
+
} | undefined>;
|
|
56
|
+
};
|
|
57
|
+
getPrefixes?: () => Record<string, string>;
|
|
58
|
+
storePluginConfig?: (pluginName: string, conf: unknown) => void;
|
|
59
|
+
executeQuery?: (query: string, options?: PluginQueryOptions) => Promise<any>;
|
|
60
|
+
}
|
|
61
|
+
/** Chart types offered in the chart type picker */
|
|
62
|
+
export type ChartType = 'bar' | 'stacked-bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut' | 'scatter' | 'histogram';
|
|
63
|
+
/**
|
|
64
|
+
* The user's chart choices. Saved per tab through YASR's plugin config, so
|
|
65
|
+
* every field is optional: anything missing (or naming a column the current
|
|
66
|
+
* results don't have) falls back to the automatic choice.
|
|
67
|
+
*/
|
|
68
|
+
export interface ChartSettings {
|
|
69
|
+
chartType?: ChartType;
|
|
70
|
+
/** Column used for the x axis / categories / slices */
|
|
71
|
+
category?: string;
|
|
72
|
+
/** Numeric columns plotted as values */
|
|
73
|
+
values?: string[];
|
|
74
|
+
/** The result's variables when these choices were made; other results get the automatic chart */
|
|
75
|
+
columns?: string[];
|
|
76
|
+
/** Column whose distinct values split the data into series (long format); `""` for none */
|
|
77
|
+
series?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Fully resolved chart choices, after applying the automatic defaults */
|
|
80
|
+
export interface ResolvedChartSettings {
|
|
81
|
+
chartType: ChartType;
|
|
82
|
+
category: string | null;
|
|
83
|
+
values: string[];
|
|
84
|
+
series: string | null;
|
|
85
|
+
}
|
|
86
|
+
/** Options that can be passed when registering the plugin */
|
|
87
|
+
export interface ChartPluginOptions {
|
|
88
|
+
/** Maximum number of result rows the chart will plot (default 5000) */
|
|
89
|
+
maxRows?: number;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,SAAS;IACxB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAA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